CMS 3D CMS Logo

MuonTrackValidator.h
Go to the documentation of this file.
1 #ifndef MuonTrackValidator_h
2 #define MuonTrackValidator_h
3 
12 
16 
20 
25 
27 public:
35  dirName_ = pset.getParameter<std::string>("dirName");
36  associatormap = pset.getParameter<edm::InputTag>("associatormap");
37  UseAssociators = pset.getParameter<bool>("UseAssociators");
38  useGEMs_ = pset.getParameter<bool>("useGEMs");
39  useME0_ = pset.getParameter<bool>("useME0");
40  edm::ParameterSet tpset = pset.getParameter<edm::ParameterSet>("muonTPSelector");
41  tpSelector = TrackingParticleSelector(tpset.getParameter<double>("ptMin"),
42  tpset.getParameter<double>("ptMax"),
43  tpset.getParameter<double>("minRapidity"),
44  tpset.getParameter<double>("maxRapidity"),
45  tpset.getParameter<double>("tip"),
46  tpset.getParameter<double>("lip"),
47  tpset.getParameter<int>("minHit"),
48  tpset.getParameter<bool>("signalOnly"),
49  tpset.getParameter<bool>("intimeOnly"),
50  tpset.getParameter<bool>("chargedOnly"),
51  tpset.getParameter<bool>("stableOnly"),
52  tpset.getParameter<std::vector<int> >("pdgId"));
53 
54  cosmictpSelector = CosmicTrackingParticleSelector(tpset.getParameter<double>("ptMin"),
55  tpset.getParameter<double>("minRapidity"),
56  tpset.getParameter<double>("maxRapidity"),
57  tpset.getParameter<double>("tip"),
58  tpset.getParameter<double>("lip"),
59  tpset.getParameter<int>("minHit"),
60  tpset.getParameter<bool>("chargedOnly"),
61  tpset.getParameter<std::vector<int> >("pdgId"));
62 
63  BiDirectional_RecoToSim_association = pset.getParameter<bool>("BiDirectional_RecoToSim_association");
64 
65  // dump cfg parameters
66  edm::LogVerbatim("MuonTrackValidator") << "constructing MuonTrackValidator: " << pset.dump();
67 
68  // Declare consumes (also for the base class)
69  bsSrc_Token = consumes<reco::BeamSpot>(bsSrc);
71  tp_refvector_Token = consumes<TrackingParticleRefVector>(label_tp);
72  else
73  tp_Token = consumes<TrackingParticleCollection>(label_tp);
74  pileupinfo_Token = consumes<std::vector<PileupSummaryInfo> >(label_pileupinfo);
75  for (unsigned int www = 0; www < label.size(); www++) {
76  track_Collection_Token.push_back(consumes<edm::View<reco::Track> >(label[www]));
77  }
78  simToRecoCollection_Token = consumes<reco::SimToRecoCollection>(associatormap);
79  recoToSimCollection_Token = consumes<reco::RecoToSimCollection>(associatormap);
80 
81  _simHitTpMapTag = mayConsume<SimHitTPAssociationProducer::SimHitTPAssociationList>(
82  pset.getParameter<edm::InputTag>("simHitTpMapTag"));
83 
84  MABH = false;
85  if (!UseAssociators) {
86  // flag MuonAssociatorByHits
87  if (associators[0] == "MuonAssociationByHits")
88  MABH = true;
89  // reset string associators to the map label
90  associators.clear();
91  associators.push_back(associatormap.label());
92  edm::LogVerbatim("MuonTrackValidator") << "--> associators reset to: " << associators[0];
93  } else {
94  for (auto const& associator : associators) {
95  consumes<reco::TrackToTrackingParticleAssociator>(edm::InputTag(associator));
96  }
97  }
98 
99  // inform on which SimHits will be counted
100  if (usetracker)
101  edm::LogVerbatim("MuonTrackValidator") << "\n usetracker = TRUE : Tracker SimHits WILL be counted";
102  else
103  edm::LogVerbatim("MuonTrackValidator") << "\n usetracker = FALSE : Tracker SimHits WILL NOT be counted";
104  if (usemuon)
105  edm::LogVerbatim("MuonTrackValidator") << " usemuon = TRUE : Muon SimHits WILL be counted";
106  else
107  edm::LogVerbatim("MuonTrackValidator") << " usemuon = FALSE : Muon SimHits WILL NOT be counted" << std::endl;
108 
109  // loop over the reco::Track collections to validate: check for inconsistent input settings
110  for (unsigned int www = 0; www < label.size(); www++) {
111  std::string recoTracksLabel = label[www].label();
112  std::string recoTracksInstance = label[www].instance();
113 
114  // tracks with hits only on tracker
115  if (recoTracksLabel == "generalTracks" || recoTracksLabel == "probeTracks" ||
116  recoTracksLabel == "displacedTracks" || recoTracksLabel == "extractGemMuons" ||
117  recoTracksLabel == "extractMe0Muons" || recoTracksLabel == "ctfWithMaterialTracksP5LHCNavigation" ||
118  recoTracksLabel == "ctfWithMaterialTracksP5" ||
119  recoTracksLabel == "hltIterL3OIMuonTrackSelectionHighPurity" || recoTracksLabel == "hltIterL3MuonMerged" ||
120  recoTracksLabel == "hltIterL3MuonAndMuonFromL1Merged") {
121  if (usemuon) {
122  edm::LogWarning("MuonTrackValidator")
123  << "\n*** WARNING : inconsistent input tracksTag = " << label[www] << "\n with usemuon == true"
124  << "\n ---> resetting to usemuon == false ";
125  usemuon = false;
126  }
127  if (!usetracker) {
128  edm::LogWarning("MuonTrackValidator")
129  << "\n*** WARNING : inconsistent input tracksTag = " << label[www] << "\n with usetracker == false"
130  << "\n ---> resetting to usetracker == true ";
131  usetracker = true;
132  }
133  }
134 
135  // tracks with hits only on muon detectors
136  else if (recoTracksLabel == "seedsOfSTAmuons" || recoTracksLabel == "standAloneMuons" ||
137  recoTracksLabel == "seedsOfDisplacedSTAmuons" || recoTracksLabel == "displacedStandAloneMuons" ||
138  recoTracksLabel == "refittedStandAloneMuons" || recoTracksLabel == "cosmicMuons" ||
139  recoTracksLabel == "cosmicMuons1Leg" || recoTracksLabel == "hltL2Muons") {
140  if (usetracker) {
141  edm::LogWarning("MuonTrackValidator")
142  << "\n*** WARNING : inconsistent input tracksTag = " << label[www] << "\n with usetracker == true"
143  << "\n ---> resetting to usetracker == false ";
144  usetracker = false;
145  }
146  if (!usemuon) {
147  edm::LogWarning("MuonTrackValidator")
148  << "\n*** WARNING : inconsistent input tracksTag = " << label[www] << "\n with usemuon == false"
149  << "\n ---> resetting to usemuon == true ";
150  usemuon = true;
151  }
152  }
153 
154  } // for (unsigned int www=0;www<label.size();www++)
155  }
156 
158  ~MuonTrackValidator() override {}
159 
160  void analyze(const edm::Event&, const edm::EventSetup&) override;
162 
163 private:
169 
172 
174  bool useGEMs_;
175  bool useME0_;
176 
177  // select tracking particles
178  //(i.e. "denominator" of the efficiency ratio)
181 
182  // flag new validation logic (bidirectional RecoToSim association)
184  // flag MuonAssociatorByHits
185  bool MABH;
186 };
187 
188 #endif
LCToCPAssociation_cfi.associator
associator
Definition: LCToCPAssociation_cfi.py:4
MuonTrackValidatorBase::label
std::vector< edm::InputTag > label
Definition: MuonTrackValidatorBase.h:208
MuonTrackValidator::recoToSimCollection_Token
edm::EDGetTokenT< reco::RecoToSimCollection > recoToSimCollection_Token
Definition: MuonTrackValidator.h:167
MuonTrackValidatorBase.h
ESHandle.h
ESInputTag
MuonTrackValidator::UseAssociators
bool UseAssociators
Definition: MuonTrackValidator.h:173
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
CosmicTrackingParticleSelector
Definition: CosmicTrackingParticleSelector.h:39
TrackAssociation.h
MuonTrackValidatorBase::tp_Token
edm::EDGetTokenT< TrackingParticleCollection > tp_Token
Definition: MuonTrackValidatorBase.h:218
EDAnalyzer.h
TrackingParticleSelector
Definition: TrackingParticleSelector.h:16
MuonTrackValidator::bookHistograms
void bookHistograms(DQMEDAnalyzer::DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: MuonTrackValidator.cc:24
MuonTrackValidator::~MuonTrackValidator
~MuonTrackValidator() override
Destructor.
Definition: MuonTrackValidator.h:158
MuonTrackValidator::useME0_
bool useME0_
Definition: MuonTrackValidator.h:175
MuonTrackValidator::cosmictpDefinerEsToken
const edm::ESGetToken< CosmicParametersDefinerForTP, TrackAssociatorRecord > cosmictpDefinerEsToken
Definition: MuonTrackValidator.h:171
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
Track.h
MuonTrackValidator::useGEMs_
bool useGEMs_
Definition: MuonTrackValidator.h:174
MuonTrackValidatorBase::pileupinfo_Token
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupinfo_Token
Definition: MuonTrackValidatorBase.h:220
MuonTrackValidator::_simHitTpMapTag
edm::EDGetTokenT< SimHitTPAssociationProducer::SimHitTPAssociationList > _simHitTpMapTag
Definition: MuonTrackValidator.h:168
CosmicParametersDefinerForTP
Definition: CosmicParametersDefinerForTP.h:15
MuonTrackValidatorBase::tp_refvector_Token
edm::EDGetTokenT< TrackingParticleRefVector > tp_refvector_Token
Definition: MuonTrackValidatorBase.h:219
reco::modules::TrackingParticleSelector
SingleObjectSelector< TrackingParticleCollection, ::TrackingParticleSelector > TrackingParticleSelector
Definition: TrackingParticleSelector.cc:17
TrackAssociatorRecord
Definition: TrackAssociatorRecord.h:18
MuonTrackValidatorBase::bsSrc_Token
edm::EDGetTokenT< reco::BeamSpot > bsSrc_Token
Definition: MuonTrackValidatorBase.h:217
MuonTrackValidator::dirName_
std::string dirName_
Definition: MuonTrackValidator.h:164
MuonTrackValidator::associatormap
edm::InputTag associatormap
Definition: MuonTrackValidator.h:165
DQMEDAnalyzer.h
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:47
Event.h
MuonTrackValidator::cosmictpSelector
CosmicTrackingParticleSelector cosmictpSelector
Definition: MuonTrackValidator.h:180
MuonTrackValidatorBase::associators
std::vector< std::string > associators
Definition: MuonTrackValidatorBase.h:213
MuonTrackValidatorBase::label_tp
edm::InputTag label_tp
Definition: MuonTrackValidatorBase.h:210
MuonTrackValidator::MuonTrackValidator
MuonTrackValidator(const edm::ParameterSet &pset)
Constructor.
Definition: MuonTrackValidator.h:29
MuonTrackValidatorBase::usemuon
bool usemuon
Definition: MuonTrackValidatorBase.h:272
edm::EventSetup
Definition: EventSetup.h:58
TrackAssociatorRecord.h
MuonTrackValidatorBase::track_Collection_Token
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > track_Collection_Token
Definition: MuonTrackValidatorBase.h:216
MuonTrackValidatorBase::parametersDefiner
std::string parametersDefiner
Definition: MuonTrackValidatorBase.h:215
edm::ESGetToken< ParametersDefinerForTP, TrackAssociatorRecord >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ParametersDefinerForTP.h
MuonTrackValidator::simToRecoCollection_Token
edm::EDGetTokenT< reco::SimToRecoCollection > simToRecoCollection_Token
Definition: MuonTrackValidator.h:166
MuonTrackValidatorBase
Definition: MuonTrackValidatorBase.h:37
MuonTrackValidatorBase::label_pileupinfo
edm::InputTag label_pileupinfo
Definition: MuonTrackValidatorBase.h:212
MuonTrackValidator::tpDefinerEsToken
const edm::ESGetToken< ParametersDefinerForTP, TrackAssociatorRecord > tpDefinerEsToken
Definition: MuonTrackValidator.h:170
MuonTrackValidator
Definition: MuonTrackValidator.h:26
Frameworkfwd.h
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
MuonTrackValidatorBase::bsSrc
edm::InputTag bsSrc
Definition: MuonTrackValidatorBase.h:209
MuonTrackValidatorBase::label_tp_refvector
bool label_tp_refvector
Definition: MuonTrackValidatorBase.h:211
MuonTrackValidatorBase::usetracker
bool usetracker
Definition: MuonTrackValidatorBase.h:272
MuonTrackValidator::BiDirectional_RecoToSim_association
bool BiDirectional_RecoToSim_association
Definition: MuonTrackValidator.h:183
dqm::implementation::IBooker
Definition: DQMStore.h:43
MuonTrackValidator::tpSelector
TrackingParticleSelector tpSelector
Definition: MuonTrackValidator.h:179
ConsumesCollector.h
ParameterSet.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
MuonTrackValidator::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: MuonTrackValidator.cc:359
edm::InputTag
Definition: InputTag.h:15
CosmicParametersDefinerForTP.h
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
ParametersDefinerForTP
Definition: ParametersDefinerForTP.h:19
MuonTrackValidator::MABH
bool MABH
Definition: MuonTrackValidator.h:185