CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackAnalyzer.h
Go to the documentation of this file.
1 #ifndef TrackAnalyzer_H
2 #define TrackAnalyzer_H
3 // -*- C++ -*-
4 //
5 //
9 // Original Author: Suchandra Dutta, Giorgia Mila
10 // Created: Thu 28 22:45:30 CEST 2008
11 
12 #include <memory>
13 #include <fstream>
14 #include <unordered_map>
24 
28 
29 class DQMStore;
30 
31 class BeamSpot;
33 {
34  public:
37  virtual ~TrackAnalyzer();
38  virtual void initHisto(DQMStore::IBooker & ibooker, const edm::EventSetup &);
39 
40  virtual void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track);
41 
42  void doSoftReset (DQMStore * dqmStore_);
43  void doReset ();
44  void undoSoftReset(DQMStore * dqmStore_);
45  void setLumiFlag();
46  // Compute and locally store the number of Good vertices found
47  // in the event. This information is used as X-axis value in
48  // the hit-efficiency plots derived from the hit patter. This
49  // ugly design to avoid comuting this very same quantity for
50  // each and every track while in the analyze method. A
51  // redesign of the class is needed in the future.
52  void setNumberOfGoodVertices(const edm::Event &);
53 
54  private:
55  void initHistos();
56  void fillHistosForState(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
57  void bookHistosForState(std::string sname,DQMStore::IBooker & ibooker);
63  void fillHistosForHitProperties(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
64  void fillHistosForLScertification(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
65  void fillHistosForTrackerSpecific(const reco::Track & track);
66 
67  // ----------member data ---------------------------
69 
72 
74 
77  bool doBSPlots_;
78  bool doPVPlots_;
84  // ADD by Mia
90  // ADD by Mia in order to clean the tracking MEs
91  // do not plot *Theta* and TrackPx* and TrackPy*
94  // ADD by Mia in order to not plot DistanceOfClosestApproach w.r.t. (0,0,0)
95  // the DistanceOfClosestApproach w.r.t. the beam-spot is already shown in DistanceOfClosestApproachToBS
98 
100 
101  // ADD by Mia in order to turnON test MEs
103 
104  //For HI Plots
106 
107  // IP significance plots
109 
110  // Compute the hit-finding efficiency using the HitPattern of
111  // the reconstructed tracks
113  int pvNDOF_;
115 
116  struct TkParameterMEs {
118  TrackP(NULL)
119  , TrackPx(NULL)
120  , TrackPy(NULL)
121  , TrackPz(NULL)
122  , TrackPt(NULL)
123 
124  , TrackPxErr(NULL)
125  , TrackPyErr(NULL)
126  , TrackPzErr(NULL)
127  , TrackPtErr(NULL)
128  , TrackPErr(NULL)
129 
131 
132  , TrackQ(NULL)
133 
134  , TrackPhi(NULL)
135  , TrackEta(NULL)
136  , TrackTheta(NULL)
137 
138  , TrackPhiErr(NULL)
139  , TrackEtaErr(NULL)
141 
146 
151 
156 
161 
166 
170 
174 
178  {}
179 
185 
191 
193 
195 
201 
203 
207 
212 
217 
222 
227 
232 
236 
240 
244 
245  };
246  std::map<std::string, TkParameterMEs> TkParameterMEMap;
247 
248 
254 
255 
260 
265 
270 
275 
280 
283 
284 
285  MonitorElement* NumberOfLayersPerTrack[4] = {nullptr,nullptr,nullptr,nullptr};
286 
290 
291  MonitorElement* NumberOfLayersVsPhiVsEtaPerTrack[4]= {nullptr,nullptr,nullptr,nullptr};
292 
296 
300 
304 
330  // TESTING MEs
333 
334  // add by Mia in order to deal w/ LS transitions
337 
338  //new plots for Heavy Ion DQM
348 
349  // IP significance plots
356 
364 
367  };
368  std::map<std::string, TkRecHitsPerSubDetMEs> TkRecHitsPerSubDetMEMap;
369 
370  struct Key {
371  int det;
372  int subdet;
373  explicit Key(int det, int subdet):det(det),subdet(subdet){};
374  bool operator==(const Key & other) const {
375  return (det == other.det && subdet == other.subdet);
376  }
377  };
378 
379  // Trivial hasher function: warning, it only works if det has less than 99 subdets.
380  struct KeyHasher {
381  std::size_t operator()(const Key& k) const {
382  return k.det*100+k.subdet;
383  }
384  };
385 
386  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_valid_;
387  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_missing_;
388  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_inactive_;
389  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_bad_;
390  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_total_;
391  unsigned int good_vertices_;
392 
393 
394  std::string histname; //for naming the histograms according to algorithm used
395 };
396 #endif
MonitorElement * NumberOfRecHitsPerTrackVsPhi
MonitorElement * stoppingSourceVSphi
MonitorElement * NumberOfValidRecHitsPerTrackVsPhi
MonitorElement * Chi2ProbVsPhi
MonitorElement * NumberOfLayersPerTrackVsPhi
MonitorElement * NumberOfLostRecHitsPerTrackVsPhi
MonitorElement * DistanceOfClosestApproachToPVVsPhi
MonitorElement * NumberOfLostRecHitsPerTrackVsEta
MonitorElement * NumberOfLostRecHitsPerTrackVsEta
MonitorElement * NumberOfRecHitVsPhiVsEtaPerTrack
bool doTrackerSpecific_
Definition: TrackAnalyzer.h:75
MonitorElement * ValidFractionVsPhiVsEtaPerTrack
MonitorElement * dNhitdPt_HighPurity
void fillHistosForTrackerSpecific(const reco::Track &track)
MonitorElement * NumberOfRecHitsPerTrackVsEta
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_valid_
void bookHistosForLScertification(DQMStore::IBooker &ibooker)
MonitorElement * stoppingSourceVSeta
MonitorElement * NumberOfLostRecHitsPerTrackVsTheta
std::size_t operator()(const Key &k) const
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_bad_
MonitorElement * NumberOfValidRecHitsPerTrack
void fillHistosForHitProperties(const edm::EventSetup &iSetup, const reco::Track &track, std::string sname)
MonitorElement * Chi2oNDF_lumiFlag
MonitorElement * xPointOfClosestApproachToPV
MonitorElement * NumberOfLayersPerTrackVsPhi
MonitorElement * sip3dToPV
MonitorElement * NumberOfMORecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfLostRecHitsPerTrack
edm::ParameterSet conf_
Definition: TrackAnalyzer.h:73
bool doGeneralPropertiesPlots_
Definition: TrackAnalyzer.h:80
void fillHistosForLScertification(const edm::EventSetup &iSetup, const reco::Track &track, std::string sname)
MonitorElement * Chi2oNDFVsPhi
MonitorElement * Chi2ProbVsPhi
MonitorElement * NumberOfMIRecHitsPerTrackVsPhi
MonitorElement * NumberOfLostRecHitVsPhiVsEtaPerTrack
MonitorElement * DistanceOfClosestApproachVsPhi
#define NULL
Definition: scimark2.h:8
MonitorElement * sipDzToBS
std::map< std::string, TkParameterMEs > TkParameterMEMap
MonitorElement * NumberOfLayersPerTrack[4]
MonitorElement * NhitVsPhi_HighPurity
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * algorithm
bool doHitPropertiesPlots_
Definition: TrackAnalyzer.h:82
MonitorElement * DistanceOfClosestApproach
bool doRecHitVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:83
MonitorElement * NumberOfLayersPerTrackVsTheta
MonitorElement * NumberOfRecHitsPerTrack_lumiFlag
std::map< std::string, TkRecHitsPerSubDetMEs > TkRecHitsPerSubDetMEMap
MonitorElement * NumberOfValidRecHitVsPhiVsEtaPerTrack
bool doMeasurementStatePlots_
Definition: TrackAnalyzer.h:81
MonitorElement * NumberOfRecHitsPerTrack
MonitorElement * Ptdist_HighPurity
MonitorElement * NumberOfLayersVsPhiVsEtaPerTrack[4]
MonitorElement * NumberOfMIRecHitsPerTrackVsEta
MonitorElement * TESTDistanceOfClosestApproachToBSVsPhi
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_total_
bool doTrack2DChi2Plots_
Definition: TrackAnalyzer.h:88
MonitorElement * Chi2ProbVsTheta
MonitorElement * Chi2oNDFVsEta
MonitorElement * TransDCASig
int iEvent
Definition: GenABIO.cc:230
MonitorElement * NumberOfMIRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfRecHitsPerTrackVsPhi
MonitorElement * xPointOfClosestApproachVsZ0wrt000
std::string qualityString_
MonitorElement * oriAlgo
bool doDCAwrt000Plots_
Definition: TrackAnalyzer.h:97
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * NumberOfLostRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfMIRecHitVsPhiVsEtaPerTrack
MonitorElement * xPointOfClosestApproach
MonitorElement * Chi2oNDFVsTheta
MonitorElement * NumberOfMIRecHitsPerTrack
bool doTrackLayersVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:87
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
MonitorElement * NumberOfRecHitsPerTrackVsPhi
MonitorElement * dNdPt_HighPurity
std::string TopFolder_
Definition: TrackAnalyzer.h:68
MonitorElement * xPointOfClosestApproachVsZ0wrtBS
MonitorElement * NumberOfValidRecHitsPerTrackVsPhi
MonitorElement * dNdPhi_HighPurity
MonitorElement * NumberOfLostRecHitsPerTrackVsTheta
MonitorElement * NumberOfValidRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfMIRecHitsPerTrackVsPhi
MonitorElement * yPointOfClosestApproachToPV
MonitorElement * Chi2ProbVsTheta
MonitorElement * NumberOfRecHitsPerTrackVsEta
MonitorElement * NumberOfMORecHitsPerTrackVsTheta
MonitorElement * sip2dToPV
MonitorElement * NumberOfMORecHitsPerTrackVsEta
MonitorElement * Chi2oNDFVsTheta
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_inactive_
MonitorElement * sipDzToPV
MonitorElement * sipDxyToBS
MonitorElement * TrackThetaErr
bool operator==(const Key &other) const
void bookHistosForHitProperties(DQMStore::IBooker &ibooker)
MonitorElement * DistanceOfClosestApproachVsEta
MonitorElement * zPointOfClosestApproachVsPhi
MonitorElement * NumberOfLayersPerTrackVsEta
MonitorElement * dNdEta_HighPurity
MonitorElement * NumberOfLayersPerTrackVsTheta
void bookHistosForTrackerSpecific(DQMStore::IBooker &ibooker)
MonitorElement * stoppingSource
void fillHistosForState(const edm::EventSetup &iSetup, const reco::Track &track, std::string sname)
MonitorElement * Chi2
virtual ~TrackAnalyzer()
bool doLumiAnalysis_
Definition: TrackAnalyzer.h:99
Key(int det, int subdet)
MonitorElement * NumberOfLayersPerTrackVsEta
MonitorElement * NumberOfValidRecHitsPerTrackVsTheta
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: TrackAnalyzer.h:70
MonitorElement * sipDxyToPV
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::Track &track)
MonitorElement * xPointOfClosestApproachVsZ0wrtPV
MonitorElement * NumberOfMORecHitsPerTrackVsTheta
MonitorElement * yPointOfClosestApproachVsZ0wrtBS
MonitorElement * NumberOfMORecHitsPerTrackVsPhi
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_missing_
MonitorElement * DistanceOfClosestApproachVsTheta
void bookHistosForBeamSpot(DQMStore::IBooker &ibooker)
MonitorElement * NumberOfLayersPerTrackVsEta
MonitorElement * NumberOfMIRecHitsPerTrackVsTheta
bool doDCAwrtPVPlots_
Definition: TrackAnalyzer.h:96
MonitorElement * Chi2ProbVsEta
bool doEffFromHitPattern_
MonitorElement * zPointOfClosestApproachToPV
MonitorElement * DistanceOfClosestApproachToPV
bool doTrackPxPyPlots_
Definition: TrackAnalyzer.h:93
MonitorElement * NumberOfRecHitVsPhiVsEtaPerTrack
MonitorElement * DistanceOfClosestApproachToBSVsPhi
bool doLayersVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:85
MonitorElement * ValidFractionPerTrack
MonitorElement * NhitVsEta_HighPurity
void doSoftReset(DQMStore *dqmStore_)
bool doTrackRecHitVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:86
MonitorElement * NumberOfMORecHitsPerTrackVsPhi
MonitorElement * yPointOfClosestApproachVsZ0wrt000
unsigned int good_vertices_
MonitorElement * TrackPtErrVsEta
MonitorElement * TESTDistanceOfClosestApproachToBS
virtual void initHisto(DQMStore::IBooker &ibooker, const edm::EventSetup &)
MonitorElement * NumberOfMIRecHitsPerTrackVsTheta
MonitorElement * NumberOfRecHitsPerTrackVsEta
MonitorElement * NumberOfValidRecHitsPerTrackVsTheta
void bookHistosForState(std::string sname, DQMStore::IBooker &ibooker)
MonitorElement * yPointOfClosestApproach
MonitorElement * NumberOfMIRecHitsPerTrackVsEta
bool doRecHitsPerTrackProfile_
Definition: TrackAnalyzer.h:89
MonitorElement * Chi2Prob
MonitorElement * TrackEtaPhiOuter
MonitorElement * yPointOfClosestApproachVsZ0wrtPV
void setNumberOfGoodVertices(const edm::Event &)
MonitorElement * zPointOfClosestApproach
TrackAnalyzer(const edm::ParameterSet &)
MonitorElement * NumberOfLostRecHitsPerTrackVsPhi
MonitorElement * Chi2ProbVsEta
MonitorElement * TrackEtaPhiInner
MonitorElement * NumberOfMORecHitsPerTrackVsEta
MonitorElement * DistanceOfClosestApproachToBS
MonitorElement * Chi2oNDF
std::string histname
MonitorElement * Chi2oNDFVsEta
void undoSoftReset(DQMStore *dqmStore_)
MonitorElement * NumberOfMORecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfMORecHitsPerTrack
MonitorElement * NumberOfLayersPerTrackVsPhi
MonitorElement * LongDCASig
edm::EDGetTokenT< reco::VertexCollection > pvToken_
Definition: TrackAnalyzer.h:71
void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, const edm::EventSetup &iSetup)
MonitorElement * Chi2oNDFVsPhi