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>("minRapidity"),
29  tpset.getParameter<double>("maxRapidity"),
30  tpset.getParameter<double>("tip"),
31  tpset.getParameter<double>("lip"),
32  tpset.getParameter<int>("minHit"),
33  tpset.getParameter<bool>("signalOnly"),
34  tpset.getParameter<bool>("intimeOnly"),
35  tpset.getParameter<bool>("chargedOnly"),
36  tpset.getParameter<bool>("stableOnly"),
37  tpset.getParameter<std::vector<int> >("pdgId"));
38 
39  cosmictpSelector = CosmicTrackingParticleSelector(tpset.getParameter<double>("ptMin"),
40  tpset.getParameter<double>("minRapidity"),
41  tpset.getParameter<double>("maxRapidity"),
42  tpset.getParameter<double>("tip"),
43  tpset.getParameter<double>("lip"),
44  tpset.getParameter<int>("minHit"),
45  tpset.getParameter<bool>("chargedOnly"),
46  tpset.getParameter<std::vector<int> >("pdgId"));
47 
48  BiDirectional_RecoToSim_association = pset.getParameter<bool>("BiDirectional_RecoToSim_association");
49 
50  // dump cfg parameters
51  edm::LogVerbatim("NewMuonTrackValidator") << "constructing NewMuonTrackValidator: " << pset.dump();
52 
53  // Declare consumes (also for the base class)
54  bsSrc_Token = consumes<reco::BeamSpot>(bsSrc);
55  tp_effic_Token = consumes<TrackingParticleCollection>(label_tp_effic);
56  tp_fake_Token = consumes<TrackingParticleCollection>(label_tp_fake);
57  pileupinfo_Token = consumes<std::vector<PileupSummaryInfo> >(label_pileupinfo);
58  for (unsigned int www=0;www<label.size();www++){
60  }
61  simToRecoCollection_Token = consumes<reco::SimToRecoCollection>(associatormap);
62  recoToSimCollection_Token = consumes<reco::RecoToSimCollection>(associatormap);
63 
64  _simHitTpMapTag = mayConsume<SimHitTPAssociationProducer::SimHitTPAssociationList>(pset.getParameter<edm::InputTag>("simHitTpMapTag"));
65 
66  MABH = false;
67  if (!UseAssociators) {
68  // flag MuonAssociatorByHits
69  if (associators[0] == "MuonAssociationByHits") MABH = true;
70  // reset string associators to the map label
71  associators.clear();
72  associators.push_back(associatormap.label());
73  edm::LogVerbatim("NewMuonTrackValidator") << "--> associators reset to: " <<associators[0];
74  } else {
75  for (auto const& associator :associators) {
76  consumes<reco::TrackToTrackingParticleAssociator>(edm::InputTag(associator));
77  }
78  }
79 
80  // inform on which SimHits will be counted
81  if (usetracker) edm::LogVerbatim("NewMuonTrackValidator")
82  <<"\n usetracker = TRUE : Tracker SimHits WILL be counted";
83  else edm::LogVerbatim("NewMuonTrackValidator")
84  <<"\n usetracker = FALSE : Tracker SimHits WILL NOT be counted";
85  if (usemuon) edm::LogVerbatim("NewMuonTrackValidator")
86  <<" usemuon = TRUE : Muon SimHits WILL be counted";
87  else edm::LogVerbatim("NewMuonTrackValidator")
88  <<" usemuon = FALSE : Muon SimHits WILL NOT be counted"<<std::endl;
89 
90  // loop over the reco::Track collections to validate: check for inconsistent input settings
91  for (unsigned int www=0;www<label.size();www++) {
92  std::string recoTracksLabel = label[www].label();
93  std::string recoTracksInstance = label[www].instance();
94 
95  // tracks with hits only on tracker
96  if (recoTracksLabel=="generalTracks" ||
97  (recoTracksLabel.find("cutsRecoTracks") != std::string::npos) ||
98  recoTracksLabel=="ctfWithMaterialTracksP5LHCNavigation" ||
99  recoTracksLabel=="hltL3TkTracksFromL2" ||
100  (recoTracksLabel=="hltL3Muons" && recoTracksInstance=="L2Seeded"))
101  {
102  if (usemuon) {
103  edm::LogWarning("NewMuonTrackValidator")
104  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
105  <<"\n with usemuon == true"<<"\n ---> please change to usemuon == false ";
106  }
107  if (!usetracker) {
108  edm::LogWarning("NewMuonTrackValidator")
109  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
110  <<"\n with usetracker == false"<<"\n ---> please change to usetracker == true ";
111  }
112  }
113 
114  // tracks with hits only on muon detectors
115  else if (recoTracksLabel=="standAloneMuons" ||
116  recoTracksLabel=="standAloneSETMuons" ||
117  recoTracksLabel=="cosmicMuons" ||
118  recoTracksLabel=="hltL2Muons")
119  {
120  if (usetracker) {
121  edm::LogWarning("NewMuonTrackValidator")
122  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
123  <<"\n with usetracker == true"<<"\n ---> please change to usetracker == false ";
124  }
125  if (!usemuon) {
126  edm::LogWarning("NewMuonTrackValidator")
127  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
128  <<"\n with usemuon == false"<<"\n ---> please change to usemuon == true ";
129  }
130  }
131 
132  } // for (unsigned int www=0;www<label.size();www++)
133  }
134 
137 
139  // void beginRun(edm::Run const&, edm::EventSetup const&);
141  void analyze(const edm::Event&, const edm::EventSetup&) override;
143  // void endRun(edm::Run const&, edm::EventSetup const&) override;
144  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
145 
146  private:
152 
154  bool useGEMs_;
155  bool useME0_;
156 
157  // select tracking particles
158  //(i.e. "denominator" of the efficiency ratio)
161 
162  // flag new validation logic (bidirectional RecoToSim association)
164  // flag MuonAssociatorByHits
165  bool MABH;
166 
167 };
168 
169 
170 #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:42