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 
13 
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  MABH = false;
53  if (!UseAssociators) {
54  // flag MuonAssociatorByHits
55  if (associators[0] == "MuonAssociationByHits") MABH = true;
56  // reset string associators to the map label
57  associators.clear();
58  associators.push_back(associatormap.label());
59  edm::LogVerbatim("MuonTrackValidator") << "--> associators reset to: " <<associators[0];
60  }
61 
62  // inform on which SimHits will be counted
63  if (usetracker) edm::LogVerbatim("MuonTrackValidator")
64  <<"\n usetracker = TRUE : Tracker SimHits WILL be counted";
65  else edm::LogVerbatim("MuonTrackValidator")
66  <<"\n usetracker = FALSE : Tracker SimHits WILL NOT be counted";
67  if (usemuon) edm::LogVerbatim("MuonTrackValidator")
68  <<" usemuon = TRUE : Muon SimHits WILL be counted";
69  else edm::LogVerbatim("MuonTrackValidator")
70  <<" usemuon = FALSE : Muon SimHits WILL NOT be counted"<<std::endl;
71 
72  // loop over the reco::Track collections to validate: check for inconsistent input settings
73  for (unsigned int www=0;www<label.size();www++) {
74  std::string recoTracksLabel = label[www].label();
75  std::string recoTracksInstance = label[www].instance();
76 
77  // tracks with hits only on tracker
78  if (recoTracksLabel=="generalTracks" ||
79  (recoTracksLabel.find("cutsRecoTracks") != std::string::npos) ||
80  recoTracksLabel=="ctfWithMaterialTracksP5LHCNavigation" ||
81  recoTracksLabel=="hltL3TkTracksFromL2" ||
82  (recoTracksLabel=="hltL3Muons" && recoTracksInstance=="L2Seeded"))
83  {
84  if (usemuon) {
85  edm::LogWarning("MuonTrackValidator")
86  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
87  <<"\n with usemuon == true"<<"\n ---> please change to usemuon == false ";
88  }
89  if (!usetracker) {
90  edm::LogWarning("MuonTrackValidator")
91  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
92  <<"\n with usetracker == false"<<"\n ---> please change to usetracker == true ";
93  }
94  }
95 
96  // tracks with hits only on muon detectors
97  else if (recoTracksLabel=="standAloneMuons" ||
98  recoTracksLabel=="standAloneSETMuons" ||
99  recoTracksLabel=="cosmicMuons" ||
100  recoTracksLabel=="hltL2Muons")
101  {
102  if (usetracker) {
103  edm::LogWarning("MuonTrackValidator")
104  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
105  <<"\n with usetracker == true"<<"\n ---> please change to usetracker == false ";
106  }
107  if (!usemuon) {
108  edm::LogWarning("MuonTrackValidator")
109  <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
110  <<"\n with usemuon == false"<<"\n ---> please change to usemuon == true ";
111  }
112  }
113 
114  } // for (unsigned int www=0;www<label.size();www++)
115  }
116 
118  virtual ~MuonTrackValidator(){ }
119 
121  void beginRun(edm::Run const&, edm::EventSetup const&);
123  void analyze(const edm::Event&, const edm::EventSetup& );
125  void endRun(edm::Run const&, edm::EventSetup const&);
126 
127 private:
129  void getRecoMomentum (const reco::Track& track, double& pt, double& ptError,
130  double& qoverp, double& qoverpError, double& lambda, double& lambdaError,
131  double& phi, double& phiError ) const;
133  void getRecoMomentum (const reco::GsfTrack& gsfTrack, double& pt, double& ptError,
134  double& qoverp, double& qoverpError, double& lambda, double& lambdaError,
135  double& phi, double& phiError) const;
136 
137  private:
138  std::string dirName_;
141  double minPhi, maxPhi;
142  int nintPhi;
143  bool useGsf;
144  // select tracking particles
145  //(i.e. "denominator" of the efficiency ratio)
148 
149  // flag new validation logic (bidirectional RecoToSim association)
151  // flag MuonAssociatorByHits
152  bool MABH;
153 
154  //1D
155  std::vector<MonitorElement*> h_nchi2, h_nchi2_prob, h_losthits;
156 
157  //2D
158  std::vector<MonitorElement*> chi2_vs_nhits, etares_vs_eta;
159  std::vector<MonitorElement*> h_ptshifteta;
160  std::vector<MonitorElement*> ptres_vs_phi, chi2_vs_phi, nhits_vs_phi, phires_vs_phi;
161 
162  //Profile2D
163  std::vector<MonitorElement*> ptmean_vs_eta_phi, phimean_vs_eta_phi;
164 
165  //assoc chi2
166  std::vector<MonitorElement*> h_assochi2, h_assochi2_prob;
167 
168  //chi2 and # lost hits vs eta: to be used with doProfileX
169  std::vector<MonitorElement*> chi2_vs_eta, nlosthits_vs_eta;
170  std::vector<MonitorElement*> h_chi2meanh, h_losthits_eta;
171  std::vector<MonitorElement*> h_hits_phi;
172  std::vector<MonitorElement*> h_chi2meanhitsh, h_chi2mean_vs_phi;
173 
174  //resolution of track params: to be used with fitslicesytool
177 
178  //pulls of track params vs eta: to be used with fitslicesytool
180  std::vector<MonitorElement*> ptpull_vs_phi, phipull_vs_phi, thetapull_vs_phi;
182  std::vector<MonitorElement*> h_ptpullphi, h_phipullphi, h_thetapullphi;
183 
184 };
185 
186 
187 #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< MonitorElement * > h_losthits_eta
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
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
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 once per event.
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
void beginRun(edm::Run const &, edm::EventSetup const &)
Method called before the event loop.
std::vector< MonitorElement * > chi2_vs_eta
TrackingParticleSelector tpSelector
std::vector< MonitorElement * > h_losthits
std::vector< MonitorElement * > ptpull_vs_phi
edm::InputTag associatormap
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
std::string dump() const
Definition: Run.h:33
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
Definition: DDAxes.h:10