CMS 3D CMS Logo

NewMuonTrackValidator.h
Go to the documentation of this file.
1 #ifndef NewMuonTrackValidator_h
2 #define NewMuonTrackValidator_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("NewMuonTrackValidator") << "constructing NewMuonTrackValidator: " << 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++){
61  }
62  simToRecoCollection_Token = consumes<reco::SimToRecoCollection>(associatormap);
63  recoToSimCollection_Token = consumes<reco::RecoToSimCollection>(associatormap);
64 
65  _simHitTpMapTag = mayConsume<SimHitTPAssociationProducer::SimHitTPAssociationList>(pset.getParameter<edm::InputTag>("simHitTpMapTag"));
66 
67  MABH = false;
68  if (!UseAssociators) {
69  // flag MuonAssociatorByHits
70  if (associators[0] == "MuonAssociationByHits") MABH = true;
71  // reset string associators to the map label
72  associators.clear();
73  associators.push_back(associatormap.label());
74  edm::LogVerbatim("NewMuonTrackValidator") << "--> associators reset to: " <<associators[0];
75  } else {
76  for (auto const& associator :associators) {
77  consumes<reco::TrackToTrackingParticleAssociator>(edm::InputTag(associator));
78  }
79  }
80 
81  // inform on which SimHits will be counted
82  if (usetracker) edm::LogVerbatim("NewMuonTrackValidator")
83  <<"\n usetracker = TRUE : Tracker SimHits WILL be counted";
84  else edm::LogVerbatim("NewMuonTrackValidator")
85  <<"\n usetracker = FALSE : Tracker SimHits WILL NOT be counted";
86  if (usemuon) edm::LogVerbatim("NewMuonTrackValidator")
87  <<" usemuon = TRUE : Muon SimHits WILL be counted";
88  else edm::LogVerbatim("NewMuonTrackValidator")
89  <<" usemuon = FALSE : Muon SimHits WILL NOT be counted"<<std::endl;
90 
91  // loop over the reco::Track collections to validate: check for inconsistent input settings
92  for (unsigned int www=0;www<label.size();www++) {
93  std::string recoTracksLabel = label[www].label();
94  std::string recoTracksInstance = label[www].instance();
95 
96  // tracks with hits only on tracker
97  if (recoTracksLabel=="generalTracks" ||
98  (recoTracksLabel.find("cutsRecoTracks") != std::string::npos) ||
99  recoTracksLabel=="ctfWithMaterialTracksP5LHCNavigation" ||
100  recoTracksLabel=="hltL3TkTracksFromL2" ||
101  (recoTracksLabel=="hltL3Muons" && recoTracksInstance=="L2Seeded"))
102  {
103  if (usemuon) {
104  edm::LogWarning("NewMuonTrackValidator")
105  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
106  <<"\n with usemuon == true"<<"\n ---> please change to usemuon == false ";
107  }
108  if (!usetracker) {
109  edm::LogWarning("NewMuonTrackValidator")
110  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
111  <<"\n with usetracker == false"<<"\n ---> please change to usetracker == true ";
112  }
113  }
114 
115  // tracks with hits only on muon detectors
116  else if (recoTracksLabel=="standAloneMuons" ||
117  recoTracksLabel=="standAloneSETMuons" ||
118  recoTracksLabel=="cosmicMuons" ||
119  recoTracksLabel=="hltL2Muons")
120  {
121  if (usetracker) {
122  edm::LogWarning("NewMuonTrackValidator")
123  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
124  <<"\n with usetracker == true"<<"\n ---> please change to usetracker == false ";
125  }
126  if (!usemuon) {
127  edm::LogWarning("NewMuonTrackValidator")
128  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
129  <<"\n with usemuon == false"<<"\n ---> please change to usemuon == true ";
130  }
131  }
132 
133  } // for (unsigned int www=0;www<label.size();www++)
134  }
135 
138 
140  // void beginRun(edm::Run const&, edm::EventSetup const&);
142  void analyze(const edm::Event&, const edm::EventSetup&) override;
144  // void endRun(edm::Run const&, edm::EventSetup const&) override;
145  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
146 
147  private:
153 
155  bool useGEMs_;
156  bool useME0_;
157 
158  // select tracking particles
159  //(i.e. "denominator" of the efficiency ratio)
162 
163  // flag new validation logic (bidirectional RecoToSim association)
165  // flag MuonAssociatorByHits
166  bool MABH;
167 
168 };
169 
170 
171 #endif
T getParameter(std::string const &) const
edm::EDGetTokenT< SimHitTPAssociationProducer::SimHitTPAssociationList > _simHitTpMapTag
std::string dump(unsigned int indent=0) const
edm::EDGetTokenT< TrackingParticleCollection > tp_effic_Token
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > track_Collection_Token
edm::EDGetTokenT< reco::BeamSpot > bsSrc_Token
TrackingParticleSelector tpSelector
void analyze(const edm::Event &, const edm::EventSetup &) override
Method called before the event loop.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
edm::EDGetTokenT< TrackingParticleCollection > tp_fake_Token
NewMuonTrackValidator(const edm::ParameterSet &pset)
Constructor.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Method called at the end of the event loop.
ObjectSelector< CosmicTrackingParticleSelector > CosmicTrackingParticleSelector
virtual ~NewMuonTrackValidator()
Destructor.
edm::EDGetTokenT< reco::RecoToSimCollection > recoToSimCollection_Token
edm::EDGetTokenT< reco::SimToRecoCollection > simToRecoCollection_Token
CosmicTrackingParticleSelector cosmictpSelector
std::vector< std::string > associators
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupinfo_Token
std::vector< edm::InputTag > label
Definition: Run.h:43