CMS 3D CMS Logo

MuonTrackValidator.h
Go to the documentation of this file.
1 #ifndef MuonTrackValidator_h
2 #define MuonTrackValidator_h
3 
12 
16 
18 public:
21  dirName_ = pset.getParameter<std::string>("dirName");
22  associatormap = pset.getParameter<edm::InputTag>("associatormap");
23  UseAssociators = pset.getParameter<bool>("UseAssociators");
24  useGEMs_ = pset.getParameter<bool>("useGEMs");
25  useME0_ = pset.getParameter<bool>("useME0");
26  edm::ParameterSet tpset = pset.getParameter<edm::ParameterSet>("muonTPSelector");
27  tpSelector = TrackingParticleSelector(tpset.getParameter<double>("ptMin"),
28  tpset.getParameter<double>("ptMax"),
29  tpset.getParameter<double>("minRapidity"),
30  tpset.getParameter<double>("maxRapidity"),
31  tpset.getParameter<double>("tip"),
32  tpset.getParameter<double>("lip"),
33  tpset.getParameter<int>("minHit"),
34  tpset.getParameter<bool>("signalOnly"),
35  tpset.getParameter<bool>("intimeOnly"),
36  tpset.getParameter<bool>("chargedOnly"),
37  tpset.getParameter<bool>("stableOnly"),
38  tpset.getParameter<std::vector<int> >("pdgId"));
39 
40  cosmictpSelector = CosmicTrackingParticleSelector(tpset.getParameter<double>("ptMin"),
41  tpset.getParameter<double>("minRapidity"),
42  tpset.getParameter<double>("maxRapidity"),
43  tpset.getParameter<double>("tip"),
44  tpset.getParameter<double>("lip"),
45  tpset.getParameter<int>("minHit"),
46  tpset.getParameter<bool>("chargedOnly"),
47  tpset.getParameter<std::vector<int> >("pdgId"));
48 
49  BiDirectional_RecoToSim_association = pset.getParameter<bool>("BiDirectional_RecoToSim_association");
50 
51  // dump cfg parameters
52  edm::LogVerbatim("MuonTrackValidator") << "constructing MuonTrackValidator: " << pset.dump();
53 
54  // Declare consumes (also for the base class)
55  bsSrc_Token = consumes<reco::BeamSpot>(bsSrc);
56  tp_effic_Token = consumes<TrackingParticleCollection>(label_tp_effic);
57  tp_fake_Token = consumes<TrackingParticleCollection>(label_tp_fake);
58  pileupinfo_Token = consumes<std::vector<PileupSummaryInfo> >(label_pileupinfo);
59  for (unsigned int www = 0; www < label.size(); www++) {
60  track_Collection_Token.push_back(consumes<edm::View<reco::Track> >(label[www]));
61  }
62  simToRecoCollection_Token = consumes<reco::SimToRecoCollection>(associatormap);
63  recoToSimCollection_Token = consumes<reco::RecoToSimCollection>(associatormap);
64 
65  _simHitTpMapTag = mayConsume<SimHitTPAssociationProducer::SimHitTPAssociationList>(
66  pset.getParameter<edm::InputTag>("simHitTpMapTag"));
67 
68  MABH = false;
69  if (!UseAssociators) {
70  // flag MuonAssociatorByHits
71  if (associators[0] == "MuonAssociationByHits")
72  MABH = true;
73  // reset string associators to the map label
74  associators.clear();
75  associators.push_back(associatormap.label());
76  edm::LogVerbatim("MuonTrackValidator") << "--> associators reset to: " << associators[0];
77  } else {
78  for (auto const& associator : associators) {
79  consumes<reco::TrackToTrackingParticleAssociator>(edm::InputTag(associator));
80  }
81  }
82 
83  // inform on which SimHits will be counted
84  if (usetracker)
85  edm::LogVerbatim("MuonTrackValidator") << "\n usetracker = TRUE : Tracker SimHits WILL be counted";
86  else
87  edm::LogVerbatim("MuonTrackValidator") << "\n usetracker = FALSE : Tracker SimHits WILL NOT be counted";
88  if (usemuon)
89  edm::LogVerbatim("MuonTrackValidator") << " usemuon = TRUE : Muon SimHits WILL be counted";
90  else
91  edm::LogVerbatim("MuonTrackValidator") << " usemuon = FALSE : Muon SimHits WILL NOT be counted" << std::endl;
92 
93  // loop over the reco::Track collections to validate: check for inconsistent input settings
94  for (unsigned int www = 0; www < label.size(); www++) {
95  std::string recoTracksLabel = label[www].label();
96  std::string recoTracksInstance = label[www].instance();
97 
98  // tracks with hits only on tracker
99  if (recoTracksLabel == "generalTracks" || (recoTracksLabel.find("cutsRecoTracks") != std::string::npos) ||
100  recoTracksLabel == "ctfWithMaterialTracksP5LHCNavigation" || recoTracksLabel == "hltL3TkTracksFromL2" ||
101  (recoTracksLabel == "hltL3Muons" && recoTracksInstance == "L2Seeded")) {
102  if (usemuon) {
103  edm::LogWarning("MuonTrackValidator")
104  << "\n*** WARNING : inconsistent input tracksTag = " << label[www] << "\n with usemuon == true"
105  << "\n ---> please change to usemuon == false ";
106  }
107  if (!usetracker) {
108  edm::LogWarning("MuonTrackValidator")
109  << "\n*** WARNING : inconsistent input tracksTag = " << label[www] << "\n with usetracker == false"
110  << "\n ---> please change to usetracker == true ";
111  }
112  }
113 
114  // tracks with hits only on muon detectors
115  else if (recoTracksLabel == "standAloneMuons" || recoTracksLabel == "standAloneSETMuons" ||
116  recoTracksLabel == "cosmicMuons" || recoTracksLabel == "hltL2Muons") {
117  if (usetracker) {
118  edm::LogWarning("MuonTrackValidator")
119  << "\n*** WARNING : inconsistent input tracksTag = " << label[www] << "\n with usetracker == true"
120  << "\n ---> please change to usetracker == false ";
121  }
122  if (!usemuon) {
123  edm::LogWarning("MuonTrackValidator")
124  << "\n*** WARNING : inconsistent input tracksTag = " << label[www] << "\n with usemuon == false"
125  << "\n ---> please change to usemuon == true ";
126  }
127  }
128 
129  } // for (unsigned int www=0;www<label.size();www++)
130  }
131 
133  ~MuonTrackValidator() override {}
134 
136  // void beginRun(edm::Run const&, edm::EventSetup const&);
138  void analyze(const edm::Event&, const edm::EventSetup&) override;
140  // void dqmEndRun(edm::Run const&, edm::EventSetup const&) override;
142 
143 private:
149 
151  bool useGEMs_;
152  bool useME0_;
153 
154  // select tracking particles
155  //(i.e. "denominator" of the efficiency ratio)
158 
159  // flag new validation logic (bidirectional RecoToSim association)
161  // flag MuonAssociatorByHits
162  bool MABH;
163 };
164 
165 #endif
MuonTrackValidatorBase::tp_fake_Token
edm::EDGetTokenT< TrackingParticleCollection > tp_fake_Token
Definition: MuonTrackValidatorBase.h:210
MuonTrackValidatorBase::label
std::vector< edm::InputTag > label
Definition: MuonTrackValidatorBase.h:199
MuonTrackValidator::recoToSimCollection_Token
edm::EDGetTokenT< reco::RecoToSimCollection > recoToSimCollection_Token
Definition: MuonTrackValidator.h:147
MuonTrackValidatorBase.h
MuonTrackValidatorBase::label_tp_effic
edm::InputTag label_tp_effic
Definition: MuonTrackValidatorBase.h:201
MuonTrackValidator::UseAssociators
bool UseAssociators
Definition: MuonTrackValidator.h:150
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
CosmicTrackingParticleSelector
Definition: CosmicTrackingParticleSelector.h:39
TrackAssociation.h
EDAnalyzer.h
TrackingParticleSelector
Definition: TrackingParticleSelector.h:16
MuonTrackValidator::bookHistograms
void bookHistograms(DQMEDAnalyzer::DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Method called at the end of the event loop.
Definition: MuonTrackValidator.cc:24
MuonTrackValidator::~MuonTrackValidator
~MuonTrackValidator() override
Destructor.
Definition: MuonTrackValidator.h:133
MuonTrackValidator::useME0_
bool useME0_
Definition: MuonTrackValidator.h:152
MuonTrackValidatorBase::tp_effic_Token
edm::EDGetTokenT< TrackingParticleCollection > tp_effic_Token
Definition: MuonTrackValidatorBase.h:209
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
Track.h
MuonTrackValidator::useGEMs_
bool useGEMs_
Definition: MuonTrackValidator.h:151
MuonTrackValidatorBase::pileupinfo_Token
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupinfo_Token
Definition: MuonTrackValidatorBase.h:211
MuonTrackValidator::_simHitTpMapTag
edm::EDGetTokenT< SimHitTPAssociationProducer::SimHitTPAssociationList > _simHitTpMapTag
Definition: MuonTrackValidator.h:148
reco::modules::TrackingParticleSelector
SingleObjectSelector< TrackingParticleCollection, ::TrackingParticleSelector > TrackingParticleSelector
Definition: TrackingParticleSelector.cc:17
MuonTrackValidatorBase::bsSrc_Token
edm::EDGetTokenT< reco::BeamSpot > bsSrc_Token
Definition: MuonTrackValidatorBase.h:208
ctfWithMaterialTrackMCMatch_cfi.associator
associator
Definition: ctfWithMaterialTrackMCMatch_cfi.py:7
MuonTrackValidator::dirName_
std::string dirName_
Definition: MuonTrackValidator.h:144
MuonTrackValidator::associatormap
edm::InputTag associatormap
Definition: MuonTrackValidator.h:145
DQMEDAnalyzer.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
edm::View
Definition: CaloClusterFwd.h:14
reco::CosmicTrackingParticleSelector
ObjectSelector< CosmicTrackingParticleSelector > CosmicTrackingParticleSelector
Definition: CosmicTrackingParticleSelector.cc:16
TrackToTrackingParticleAssociator.h
edm::ParameterSet
Definition: ParameterSet.h:36
MuonTrackValidator::cosmictpSelector
CosmicTrackingParticleSelector cosmictpSelector
Definition: MuonTrackValidator.h:157
MuonTrackValidatorBase::associators
std::vector< std::string > associators
Definition: MuonTrackValidatorBase.h:204
MuonTrackValidator::MuonTrackValidator
MuonTrackValidator(const edm::ParameterSet &pset)
Constructor.
Definition: MuonTrackValidator.h:20
edm::LogVerbatim
Definition: MessageLogger.h:297
MuonTrackValidatorBase::usemuon
bool usemuon
Definition: MuonTrackValidatorBase.h:261
edm::EventSetup
Definition: EventSetup.h:57
MuonTrackValidatorBase::track_Collection_Token
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > track_Collection_Token
Definition: MuonTrackValidatorBase.h:207
MuonTrackValidator::simToRecoCollection_Token
edm::EDGetTokenT< reco::SimToRecoCollection > simToRecoCollection_Token
Definition: MuonTrackValidator.h:146
MuonTrackValidatorBase
Definition: MuonTrackValidatorBase.h:37
MuonTrackValidatorBase::label_pileupinfo
edm::InputTag label_pileupinfo
Definition: MuonTrackValidatorBase.h:203
MuonTrackValidator
Definition: MuonTrackValidator.h:17
Frameworkfwd.h
MuonTrackValidatorBase::bsSrc
edm::InputTag bsSrc
Definition: MuonTrackValidatorBase.h:200
MuonTrackValidatorBase::usetracker
bool usetracker
Definition: MuonTrackValidatorBase.h:261
MuonTrackValidator::BiDirectional_RecoToSim_association
bool BiDirectional_RecoToSim_association
Definition: MuonTrackValidator.h:160
dqm::implementation::IBooker
Definition: DQMStore.h:43
MuonTrackValidatorBase::label_tp_fake
edm::InputTag label_tp_fake
Definition: MuonTrackValidatorBase.h:202
MuonTrackValidator::tpSelector
TrackingParticleSelector tpSelector
Definition: MuonTrackValidator.h:156
edm::Event
Definition: Event.h:73
MuonTrackValidator::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Method called before the event loop.
Definition: MuonTrackValidator.cc:358
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MuonTrackValidator::MABH
bool MABH
Definition: MuonTrackValidator.h:162