CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonTrackValidator.h
Go to the documentation of this file.
1 #ifndef MuonTrackValidator_h
2 #define MuonTrackValidator_h
3 
11 
16 
18  public:
21  dirName_ = pset.getParameter<std::string>("dirName");
22  associatormap = pset.getParameter< edm::InputTag >("associatormap");
23  UseAssociators = pset.getParameter< bool >("UseAssociators");
24  tpSelector = TrackingParticleSelector(pset.getParameter<double>("ptMinTP"),
25  pset.getParameter<double>("minRapidityTP"),
26  pset.getParameter<double>("maxRapidityTP"),
27  pset.getParameter<double>("tipTP"),
28  pset.getParameter<double>("lipTP"),
29  pset.getParameter<int>("minHitTP"),
30  pset.getParameter<bool>("signalOnlyTP"),
31  pset.getParameter<bool>("chargedOnlyTP"),
32  pset.getParameter<bool>("stableOnlyTP"),
33  pset.getParameter<std::vector<int> >("pdgIdTP"));
35  pset.getParameter<double>("minRapidityTP"),
36  pset.getParameter<double>("maxRapidityTP"),
37  pset.getParameter<double>("tipTP"),
38  pset.getParameter<double>("lipTP"),
39  pset.getParameter<int>("minHitTP"),
40  pset.getParameter<bool>("chargedOnlyTP"),
41  pset.getParameter<std::vector<int> >("pdgIdTP"));
42 
43  minPhi = pset.getParameter<double>("minPhi");
44  maxPhi = pset.getParameter<double>("maxPhi");
45  nintPhi = pset.getParameter<int>("nintPhi");
46  useGsf = pset.getParameter<bool>("useGsf");
47  BiDirectional_RecoToSim_association = pset.getParameter<bool>("BiDirectional_RecoToSim_association");
48 
49  // dump cfg parameters
50  edm::LogVerbatim("MuonTrackValidator") << "constructing MuonTrackValidator: " << pset.dump();
51 
52  // Declare consumes (also for the base class)
53  bsSrc_Token = consumes<reco::BeamSpot>(bsSrc);
54  tp_effic_Token = consumes<TrackingParticleCollection>(label_tp_effic);
55  tp_fake_Token = consumes<TrackingParticleCollection>(label_tp_fake);
56  for (unsigned int www=0;www<label.size();www++){
58  }
59  simToRecoCollection_Token = consumes<reco::SimToRecoCollection>(associatormap);
60  recoToSimCollection_Token = consumes<reco::RecoToSimCollection>(associatormap);
61 
62  MABH = false;
63  if (!UseAssociators) {
64  // flag MuonAssociatorByHits
65  if (associators[0] == "MuonAssociationByHits") MABH = true;
66  // reset string associators to the map label
67  associators.clear();
68  associators.push_back(associatormap.label());
69  edm::LogVerbatim("MuonTrackValidator") << "--> associators reset to: " <<associators[0];
70  }
71 
72  // inform on which SimHits will be counted
73  if (usetracker) edm::LogVerbatim("MuonTrackValidator")
74  <<"\n usetracker = TRUE : Tracker SimHits WILL be counted";
75  else edm::LogVerbatim("MuonTrackValidator")
76  <<"\n usetracker = FALSE : Tracker SimHits WILL NOT be counted";
77  if (usemuon) edm::LogVerbatim("MuonTrackValidator")
78  <<" usemuon = TRUE : Muon SimHits WILL be counted";
79  else edm::LogVerbatim("MuonTrackValidator")
80  <<" usemuon = FALSE : Muon SimHits WILL NOT be counted"<<std::endl;
81 
82  // loop over the reco::Track collections to validate: check for inconsistent input settings
83  for (unsigned int www=0;www<label.size();www++) {
84  std::string recoTracksLabel = label[www].label();
85  std::string recoTracksInstance = label[www].instance();
86 
87  // tracks with hits only on tracker
88  if (recoTracksLabel=="generalTracks" ||
89  (recoTracksLabel.find("cutsRecoTracks") != std::string::npos) ||
90  recoTracksLabel=="ctfWithMaterialTracksP5LHCNavigation" ||
91  recoTracksLabel=="hltL3TkTracksFromL2" ||
92  (recoTracksLabel=="hltL3Muons" && recoTracksInstance=="L2Seeded"))
93  {
94  if (usemuon) {
95  edm::LogWarning("MuonTrackValidator")
96  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
97  <<"\n with usemuon == true"<<"\n ---> please change to usemuon == false ";
98  }
99  if (!usetracker) {
100  edm::LogWarning("MuonTrackValidator")
101  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
102  <<"\n with usetracker == false"<<"\n ---> please change to usetracker == true ";
103  }
104  }
105 
106  // tracks with hits only on muon detectors
107  else if (recoTracksLabel=="standAloneMuons" ||
108  recoTracksLabel=="standAloneSETMuons" ||
109  recoTracksLabel=="cosmicMuons" ||
110  recoTracksLabel=="hltL2Muons")
111  {
112  if (usetracker) {
113  edm::LogWarning("MuonTrackValidator")
114  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
115  <<"\n with usetracker == true"<<"\n ---> please change to usetracker == false ";
116  }
117  if (!usemuon) {
118  edm::LogWarning("MuonTrackValidator")
119  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
120  <<"\n with usemuon == false"<<"\n ---> please change to usemuon == true ";
121  }
122  }
123 
124  } // for (unsigned int www=0;www<label.size();www++)
125  }
126 
128  virtual ~MuonTrackValidator(){ }
129 
131  // void beginRun(edm::Run const&, edm::EventSetup const&);
133  void analyze(const edm::Event&, const edm::EventSetup& );
135  void endRun(edm::Run const&, edm::EventSetup const&);
137 
138 private:
140  void getRecoMomentum (const reco::Track& track, double& pt, double& ptError,
141  double& qoverp, double& qoverpError, double& lambda, double& lambdaError,
142  double& phi, double& phiError ) const;
144  void getRecoMomentum (const reco::GsfTrack& gsfTrack, double& pt, double& ptError,
145  double& qoverp, double& qoverpError, double& lambda, double& lambdaError,
146  double& phi, double& phiError) const;
147 
148  private:
154  double minPhi, maxPhi;
155  int nintPhi;
156  bool useGsf;
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  //1D
168  std::vector<MonitorElement*> h_nchi2, h_nchi2_prob, h_losthits;
169 
170  //2D
171  std::vector<MonitorElement*> chi2_vs_nhits, etares_vs_eta;
172  std::vector<MonitorElement*> h_ptshifteta;
173  std::vector<MonitorElement*> ptres_vs_phi, chi2_vs_phi, nhits_vs_phi, phires_vs_phi;
174 
175  //Profile2D
176  std::vector<MonitorElement*> ptmean_vs_eta_phi, phimean_vs_eta_phi;
177 
178  //assoc chi2
179  std::vector<MonitorElement*> h_assochi2, h_assochi2_prob;
180 
181  //chi2 and # lost hits vs eta: to be used with doProfileX
182  std::vector<MonitorElement*> chi2_vs_eta, nlosthits_vs_eta;
183  std::vector<MonitorElement*> h_chi2meanh, h_losthits_eta;
184  std::vector<MonitorElement*> h_hits_phi;
185  std::vector<MonitorElement*> h_chi2meanhitsh, h_chi2mean_vs_phi;
186 
187  //resolution of track params: to be used with fitslicesytool
190 
191  //pulls of track params vs eta: to be used with fitslicesytool
193  std::vector<MonitorElement*> ptpull_vs_phi, phipull_vs_phi, thetapull_vs_phi;
195  std::vector<MonitorElement*> h_ptpullphi, h_phipullphi, h_thetapullphi;
196 
197 };
198 
199 
200 #endif
std::vector< MonitorElement * > h_dxypulleta
T getParameter(std::string const &) const
std::vector< MonitorElement * > h_ptpulleta
std::vector< MonitorElement * > etares_vs_eta
std::vector< MonitorElement * > ptres_vs_phi
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > track_Collection_Token
std::vector< MonitorElement * > h_losthits_eta
std::string dump(unsigned int indent=0) const
std::vector< MonitorElement * > h_thetapullphi
std::vector< MonitorElement * > h_ptpullphi
std::vector< MonitorElement * > ptres_vs_eta
std::vector< MonitorElement * > cotThetares_vs_eta
std::vector< MonitorElement * > h_dzpulleta
std::vector< MonitorElement * > h_thetapulleta
std::vector< MonitorElement * > phimean_vs_eta_phi
virtual ~MuonTrackValidator()
Destructor.
std::vector< MonitorElement * > phires_vs_pt
std::vector< MonitorElement * > h_assochi2_prob
std::vector< MonitorElement * > cotThetares_vs_pt
std::vector< MonitorElement * > h_ptshifteta
std::vector< MonitorElement * > dxyres_vs_eta
std::vector< MonitorElement * > dzres_vs_pt
std::vector< MonitorElement * > dzres_vs_eta
void getRecoMomentum(const reco::Track &track, double &pt, double &ptError, double &qoverp, double &qoverpError, double &lambda, double &lambdaError, double &phi, double &phiError) const
retrieval of reconstructed momentum components from reco::Track (== mean values for GSF) ...
std::vector< MonitorElement * > thetapull_vs_phi
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< MonitorElement * > h_assochi2
std::vector< MonitorElement * > chi2_vs_phi
std::vector< MonitorElement * > h_phipulleta
std::vector< MonitorElement * > chi2_vs_nhits
std::vector< MonitorElement * > phires_vs_phi
std::vector< MonitorElement * > h_chi2mean_vs_phi
std::vector< MonitorElement * > h_phipullphi
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
CosmicTrackingParticleSelector cosmictpSelector
std::vector< MonitorElement * > nhits_vs_phi
edm::EDGetTokenT< TrackingParticleCollection > tp_fake_Token
std::vector< MonitorElement * > dxyres_vs_pt
std::vector< edm::InputTag > label
std::vector< MonitorElement * > h_nchi2
std::vector< MonitorElement * > h_nchi2_prob
std::vector< MonitorElement * > ptpull_vs_eta
std::vector< MonitorElement * > dxypull_vs_eta
void analyze(const edm::Event &, const edm::EventSetup &)
Method called before the event loop.
std::vector< MonitorElement * > phipull_vs_eta
std::vector< MonitorElement * > thetapull_vs_eta
MuonTrackValidator(const edm::ParameterSet &pset)
Constructor.
ObjectSelector< CosmicTrackingParticleSelector > CosmicTrackingParticleSelector
std::vector< MonitorElement * > ptmean_vs_eta_phi
edm::EDGetTokenT< reco::RecoToSimCollection > recoToSimCollection_Token
edm::EDGetTokenT< reco::SimToRecoCollection > simToRecoCollection_Token
std::vector< MonitorElement * > chi2_vs_eta
TrackingParticleSelector tpSelector
std::vector< MonitorElement * > h_losthits
std::vector< MonitorElement * > ptpull_vs_phi
edm::InputTag associatormap
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
std::vector< MonitorElement * > ptres_vs_pt
std::vector< MonitorElement * > h_chi2meanhitsh
std::vector< MonitorElement * > phires_vs_eta
std::vector< MonitorElement * > h_hits_phi
std::vector< std::string > associators
std::vector< MonitorElement * > nlosthits_vs_eta
std::vector< MonitorElement * > dzpull_vs_eta
edm::EDGetTokenT< TrackingParticleCollection > tp_effic_Token
Definition: Run.h:41
std::vector< MonitorElement * > h_chi2meanh
void endRun(edm::Run const &, edm::EventSetup const &)
Method called at the end of the event loop.
std::vector< MonitorElement * > phipull_vs_phi
edm::EDGetTokenT< reco::BeamSpot > bsSrc_Token
Definition: DDAxes.h:10