Skip to content

Commit

Permalink
Added GEM offlien DQM.
Browse files Browse the repository at this point in the history
  • Loading branch information
seungjin-yang committed Oct 15, 2020
1 parent 3c5a655 commit c2c4005
Show file tree
Hide file tree
Showing 19 changed files with 1,281 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from DQM.DTMonitorClient.dtDQMOfflineClients_Cosmics_cff import *
from DQM.RPCMonitorClient.RPCTier0Client_cff import *
from DQM.CSCMonitorModule.csc_dqm_offlineclient_cosmics_cff import *
from DQMOffline.Muon.gem_dqm_offline_client_cff import *
from DQMServices.Components.DQMFEDIntegrityClient_cff import *

DQMNone = cms.Sequence()
Expand All @@ -27,6 +28,12 @@
DQMOfflineCosmics_SecondStepMuonDPG = cms.Sequence( dtClientsCosmics *
rpcTier0Client *
cscOfflineCosmicsClients )

from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM
_run3_GEM_DQMOfflineCosmics_SecondStepMuonDPG = DQMOfflineCosmics_SecondStepMuonDPG.copy()
_run3_GEM_DQMOfflineCosmics_SecondStepMuonDPG += gemClients
run3_GEM.toReplaceWith(DQMOfflineCosmics_SecondStepMuonDPG, _run3_GEM_DQMOfflineCosmics_SecondStepMuonDPG)

DQMOfflineCosmics_SecondStepFED = cms.Sequence( dqmFEDIntegrityClient )

DQMOfflineCosmics_SecondStep_PreDPG = cms.Sequence(
Expand Down
6 changes: 6 additions & 0 deletions DQMOffline/Configuration/python/DQMOfflineCosmics_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from DQM.DTMonitorModule.dtDQMOfflineSources_Cosmics_cff import *
from DQM.RPCMonitorClient.RPCTier0Source_cff import *
from DQM.CSCMonitorModule.csc_dqm_sourceclient_offline_cff import *
from DQMOffline.Muon.gem_dqm_offline_source_cff import *
from DQM.EcalPreshowerMonitorModule.es_dqm_source_offline_cosmic_cff import *
from DQM.CastorMonitor.castor_dqm_sourceclient_offline_cff import *

Expand All @@ -33,6 +34,11 @@
rpcTier0Source *
cscSources )

from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM
_run3_GEM_DQMOfflineCosmicsMuonDPG = DQMOfflineCosmicsMuonDPG.copy()
_run3_GEM_DQMOfflineCosmicsMuonDPG += gemSources
run3_GEM.toReplaceWith(DQMOfflineCosmicsMuonDPG, _run3_GEM_DQMOfflineCosmicsMuonDPG)

DQMOfflineCosmicsCASTOR = cms.Sequence( castorSources )

DQMOfflineCosmicsPreDPG = cms.Sequence( DQMOfflineCosmicsDCS *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from DQM.DTMonitorClient.dtDQMOfflineClients_cff import *
from DQM.RPCMonitorClient.RPCTier0Client_cff import *
from DQM.CSCMonitorModule.csc_dqm_offlineclient_collisions_cff import *
from DQMOffline.Muon.gem_dqm_offline_client_cff import *
from DQMServices.Components.DQMFEDIntegrityClient_cff import *

DQMNone = cms.Sequence()
Expand All @@ -28,6 +29,11 @@
rpcTier0Client *
cscOfflineCollisionsClients )

from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM
_run3_GEM_DQMOfflineHeavyIons_SecondStepMuonDPG = DQMOfflineHeavyIons_SecondStepMuonDPG.copy()
_run3_GEM_DQMOfflineHeavyIons_SecondStepMuonDPG += gemClients
run3_GEM.toReplaceWith(DQMOfflineHeavyIons_SecondStepMuonDPG, _run3_GEM_DQMOfflineHeavyIons_SecondStepMuonDPG)

DQMOfflineHeavyIons_SecondStepFED = cms.Sequence( dqmFEDIntegrityClient )

DQMOfflineHeavyIons_SecondStep_PreDPG = cms.Sequence(
Expand Down
6 changes: 6 additions & 0 deletions DQMOffline/Configuration/python/DQMOfflineHeavyIons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from DQM.DTMonitorModule.dtDQMOfflineSources_HI_cff import *
from DQM.RPCMonitorClient.RPCTier0Source_cff import *
from DQM.CSCMonitorModule.csc_dqm_sourceclient_offline_cff import *
from DQMOffline.Muon.gem_dqm_offline_source_cff import *
from DQM.BeamMonitor.AlcaBeamMonitorHeavyIons_cff import *

DQMNone = cms.Sequence()
Expand All @@ -37,6 +38,11 @@
rpcTier0Source *
cscSources )

from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM
_run3_GEM_DQMOfflineHeavyIonsMuonDPG = DQMOfflineHeavyIonsMuonDPG.copy()
_run3_GEM_DQMOfflineHeavyIonsMuonDPG += gemSources
run3_GEM.toReplaceWith(DQMOfflineHeavyIonsMuonDPG, _run3_GEM_DQMOfflineHeavyIonsMuonDPG)

DQMOfflineHeavyIonsPreDPG = cms.Sequence( DQMOfflineHeavyIonsDCS *
DQMOfflineHeavyIonsL1T *
DQMOfflineHeavyIonsEcal *
Expand Down
10 changes: 10 additions & 0 deletions DQMOffline/Configuration/python/DQMOffline_SecondStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from DQM.DTMonitorClient.dtDQMOfflineClients_cff import *
from DQM.RPCMonitorClient.RPCTier0Client_cff import *
from DQM.CSCMonitorModule.csc_dqm_offlineclient_collisions_cff import *
from DQMOffline.Muon.gem_dqm_offline_client_cff import *
from DQMOffline.Hcal.HcalDQMOfflinePostProcessor_cff import *
from DQM.HcalTasks.OfflineHarvestingSequence_pp import *
from DQMServices.Components.DQMFEDIntegrityClient_cff import *
Expand All @@ -29,6 +30,11 @@
rpcTier0Client *
cscOfflineCollisionsClients )

from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM
_run3_GEM_DQMOffline_SecondStepMuonDPG = DQMOffline_SecondStepMuonDPG.copy()
_run3_GEM_DQMOffline_SecondStepMuonDPG += gemClients
run3_GEM.toReplaceWith(DQMOffline_SecondStepMuonDPG, _run3_GEM_DQMOffline_SecondStepMuonDPG)

DQMOffline_SecondStepHcal = cms.Sequence( hcalOfflineHarvesting )

DQMOffline_SecondStepHcal2 = cms.Sequence( HcalDQMOfflinePostProcessor )
Expand Down Expand Up @@ -189,6 +195,10 @@
muonQualityTests
)

_run3_GEM_DQMHarvestMuon = DQMHarvestMuon.copy()
_run3_GEM_DQMHarvestMuon += gemClients
run3_GEM.toReplaceWith(DQMHarvestMuon, _run3_GEM_DQMHarvestMuon)

DQMHarvestEcal = cms.Sequence( ecal_dqm_client_offline *
es_dqm_client_offline
)
Expand Down
10 changes: 10 additions & 0 deletions DQMOffline/Configuration/python/DQMOffline_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from DQM.DTMonitorModule.dtDQMOfflineSources_cff import *
from DQM.RPCMonitorClient.RPCTier0Source_cff import *
from DQM.CSCMonitorModule.csc_dqm_sourceclient_offline_cff import *
from DQMOffline.Muon.gem_dqm_offline_source_cff import *
from DQM.CastorMonitor.castor_dqm_sourceclient_offline_cff import *
from DQM.CTPPS.ctppsDQM_cff import *
from DQM.SiTrackerPhase2.Phase2TrackerDQMFirstStep_cff import *
Expand Down Expand Up @@ -60,6 +61,11 @@
rpcTier0Source *
cscSources )

from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM
_run3_GEM_DQMOfflineMuonDPG = DQMOfflineMuonDPG.copy()
_run3_GEM_DQMOfflineMuonDPG += gemSources
run3_GEM.toReplaceWith(DQMOfflineMuonDPG, _run3_GEM_DQMOfflineMuonDPG)

DQMOfflineCASTOR = cms.Sequence( castorSources )

DQMOfflineCTPPS = cms.Sequence( ctppsDQMOfflineSource )
Expand Down Expand Up @@ -221,6 +227,10 @@
muonMonitors
)

_run3_GEM_DQMOfflineMuon = DQMOfflineMuon.copy()
_run3_GEM_DQMOfflineMuon += gemSources
run3_GEM.toReplaceWith(DQMOfflineMuon, _run3_GEM_DQMOfflineMuon)

#Taus not created in pp conditions for HI
from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
_DQMOfflineTAU = cms.Sequence()
Expand Down
63 changes: 63 additions & 0 deletions DQMOffline/Muon/interface/GEMEfficiencyAnalyzer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef DQMOffline_Muon_GEMEfficiencyAnalyzer_h
#define DQMOffline_Muon_GEMEfficiencyAnalyzer_h

#include "DQMOffline/Muon/interface/GEMOfflineDQMBase.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "DataFormats/GEMRecHit/interface/GEMRecHitCollection.h"
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "DataFormats/MuonReco/interface/MuonSelectors.h"
#include "Geometry/GEMGeometry/interface/GEMGeometry.h"
#include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"

class GEMEfficiencyAnalyzer : public GEMOfflineDQMBase {
public:
explicit GEMEfficiencyAnalyzer(const edm::ParameterSet &);
~GEMEfficiencyAnalyzer() override;

protected:
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override;

private:
void bookDetectorOccupancy(
DQMStore::IBooker &, const GEMStation *, const MEMapKey1 &, const TString &, const TString &);
void bookOccupancy(DQMStore::IBooker &, const MEMapKey2 &, const TString &, const TString &);
void bookResolution(DQMStore::IBooker &, const MEMapKey3 &, const TString &, const TString &);

const GEMRecHit *findMatchedHit(const float, const GEMRecHitCollection::range &);

edm::EDGetTokenT<GEMRecHitCollection> rechit_token_;
edm::EDGetTokenT<edm::View<reco::Muon> > muon_token_;

MuonServiceProxy *muon_service_;

bool use_global_muon_;
float residual_x_cut_;

std::vector<double> pt_binning_;
int eta_nbins_;
double eta_low_;
double eta_up_;

std::string folder_;

TString title_;
TString matched_title_;

MEMap1 me_detector_;
MEMap1 me_detector_matched_;

MEMap2 me_muon_pt_;
MEMap2 me_muon_eta_;
MEMap2 me_muon_pt_matched_;
MEMap2 me_muon_eta_matched_;

MEMap3 me_residual_x_; // local
MEMap3 me_residual_y_; // local
MEMap3 me_residual_phi_; // global
MEMap3 me_pull_x_;
MEMap3 me_pull_y_;
};

#endif // DQMOffline_Muon_GEMEfficiencyAnalyzer_h
32 changes: 32 additions & 0 deletions DQMOffline/Muon/interface/GEMEfficiencyHarvester.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef DQMOffline_Muon_GEMEfficiencyHarvester_h
#define DQMOffline_Muon_GEMEfficiencyHarvester_h

#include "DQMServices/Core/interface/DQMEDHarvester.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include <vector>
#include <string>

class GEMEfficiencyHarvester : public DQMEDHarvester {
public:
GEMEfficiencyHarvester(const edm::ParameterSet&);
~GEMEfficiencyHarvester() override;
void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override;

private:
TProfile* computeEfficiency(const TH1F*, const TH1F*, const char*, const char*, const double confidence_level = 0.683);

TH2F* computeEfficiency(const TH2F*, const TH2F*, const char*, const char*);

std::vector<std::string> splitString(std::string, const std::string);
std::tuple<std::string, int, bool, int> parseResidualName(std::string, const std::string);

void doEfficiency(DQMStore::IBooker&, DQMStore::IGetter&);
void doResolution(DQMStore::IBooker&, DQMStore::IGetter&, const std::string);

std::string folder_;
std::string log_category_;
};

#endif // DQMOffline_Muon_GEMEfficiencyHarvester_h
Loading

0 comments on commit c2c4005

Please sign in to comment.