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  void setBX(const edm::Event &);
54 
55  private:
56  void initHistos();
57  void fillHistosForState(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
58  void bookHistosForState(std::string sname,DQMStore::IBooker & ibooker);
64  void fillHistosForHitProperties(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
65  void fillHistosForLScertification(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
66  void fillHistosForTrackerSpecific(const reco::Track & track);
67  void fillHistosForEfficiencyFromHitPatter(const reco::Track & track, const std::string suffix, const unsigned int monitoring);
68 
69  // ----------member data ---------------------------
71 
74 
76 
79  bool doBSPlots_;
80  bool doPVPlots_;
86  // ADD by Mia
92  // ADD by Mia in order to clean the tracking MEs
93  // do not plot *Theta* and TrackPx* and TrackPy*
96  // ADD by Mia in order to not plot DistanceOfClosestApproach w.r.t. (0,0,0)
97  // the DistanceOfClosestApproach w.r.t. the beam-spot is already shown in DistanceOfClosestApproachToBS
100 
102 
103  // ADD by Mia in order to turnON test MEs
105 
106  //For HI Plots
108 
109  // IP significance plots
111 
112  // Compute the hit-finding efficiency using the HitPattern of
113  // the reconstructed tracks
116  int pvNDOF_;
118 
119  struct TkParameterMEs {
121  TrackP(NULL)
122  , TrackPx(NULL)
123  , TrackPy(NULL)
124  , TrackPz(NULL)
125  , TrackPt(NULL)
126 
127  , TrackPxErr(NULL)
128  , TrackPyErr(NULL)
129  , TrackPzErr(NULL)
130  , TrackPtErr(NULL)
131  , TrackPErr(NULL)
132 
134 
135  , TrackQ(NULL)
136 
137  , TrackPhi(NULL)
138  , TrackEta(NULL)
139  , TrackTheta(NULL)
140 
141  , TrackPhiErr(NULL)
142  , TrackEtaErr(NULL)
144 
149 
154 
159 
164 
169 
173 
177 
181  {}
182 
188 
194 
196 
198 
204 
206 
210 
215 
220 
225 
230 
235 
239 
243 
247 
248  };
249  std::map<std::string, TkParameterMEs> TkParameterMEMap;
250 
251 
257 
258 
263 
268 
273 
278 
283 
286 
287 
288  MonitorElement* NumberOfLayersPerTrack[4] = {nullptr,nullptr,nullptr,nullptr};
289 
293 
294  MonitorElement* NumberOfLayersVsPhiVsEtaPerTrack[4]= {nullptr,nullptr,nullptr,nullptr};
295 
299 
303 
307 
333  // TESTING MEs
336 
337  // add by Mia in order to deal w/ LS transitions
340 
341  //new plots for Heavy Ion DQM
351 
352  // IP significance plots
359 
367 
370  };
371  std::map<std::string, TkRecHitsPerSubDetMEs> TkRecHitsPerSubDetMEMap;
372 
373  struct Key {
374  int det;
375  int subdet;
377  explicit Key(int det, int subdet,int monitoring):det(det),subdet(subdet),monitoring(monitoring){};
378  bool operator==(const Key & other) const {
379  return (det == other.det && subdet == other.subdet && monitoring == other.monitoring);
380  }
381  };
382 
383  // Trivial hasher function: warning, it only works if det has less than 99 subdets.
384  struct KeyHasher {
385  std::size_t operator()(const Key& k) const {
386  return k.det*1000+k.subdet*10+k.monitoring;
387  }
388  };
389 
390  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_valid_;
391  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_missing_;
392  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_inactive_;
393  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_bad_;
394  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_total_;
395  unsigned int good_vertices_;
396  unsigned int bx_;
397  enum monQuantity {
401  };
402  std::string monName[monQuantity::END] = { "", "VsBX" };
403 
404  std::string histname; //for naming the histograms according to algorithm used
405 };
406 #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:77
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
Key(int det, int subdet, int monitoring)
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:75
bool doGeneralPropertiesPlots_
Definition: TrackAnalyzer.h:82
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
bool doEffFromHitPatternVsBX_
MonitorElement * sipDzToBS
std::map< std::string, TkParameterMEs > TkParameterMEMap
MonitorElement * NumberOfLayersPerTrack[4]
MonitorElement * NhitVsPhi_HighPurity
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * algorithm
bool doHitPropertiesPlots_
Definition: TrackAnalyzer.h:84
MonitorElement * DistanceOfClosestApproach
bool doRecHitVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:85
MonitorElement * NumberOfLayersPerTrackVsTheta
MonitorElement * NumberOfRecHitsPerTrack_lumiFlag
std::map< std::string, TkRecHitsPerSubDetMEs > TkRecHitsPerSubDetMEMap
MonitorElement * NumberOfValidRecHitVsPhiVsEtaPerTrack
bool doMeasurementStatePlots_
Definition: TrackAnalyzer.h:83
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:90
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:99
bool doEffFromHitPatternVsPU_
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * NumberOfLostRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfMIRecHitVsPhiVsEtaPerTrack
MonitorElement * xPointOfClosestApproach
MonitorElement * Chi2oNDFVsTheta
MonitorElement * NumberOfMIRecHitsPerTrack
bool doTrackLayersVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:89
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
MonitorElement * NumberOfRecHitsPerTrackVsPhi
MonitorElement * dNdPt_HighPurity
void setBX(const edm::Event &)
std::string TopFolder_
Definition: TrackAnalyzer.h:70
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()
MonitorElement * NumberOfLayersPerTrackVsEta
MonitorElement * NumberOfValidRecHitsPerTrackVsTheta
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: TrackAnalyzer.h:72
MonitorElement * sipDxyToPV
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::Track &track)
MonitorElement * xPointOfClosestApproachVsZ0wrtPV
MonitorElement * NumberOfMORecHitsPerTrackVsTheta
MonitorElement * yPointOfClosestApproachVsZ0wrtBS
void fillHistosForEfficiencyFromHitPatter(const reco::Track &track, const std::string suffix, const unsigned int monitoring)
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:98
MonitorElement * Chi2ProbVsEta
MonitorElement * zPointOfClosestApproachToPV
MonitorElement * DistanceOfClosestApproachToPV
bool doTrackPxPyPlots_
Definition: TrackAnalyzer.h:95
MonitorElement * NumberOfRecHitVsPhiVsEtaPerTrack
MonitorElement * DistanceOfClosestApproachToBSVsPhi
bool doLayersVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:87
unsigned int bx_
MonitorElement * ValidFractionPerTrack
MonitorElement * NhitVsEta_HighPurity
void doSoftReset(DQMStore *dqmStore_)
bool doTrackRecHitVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:88
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:91
MonitorElement * Chi2Prob
MonitorElement * TrackEtaPhiOuter
MonitorElement * yPointOfClosestApproachVsZ0wrtPV
void setNumberOfGoodVertices(const edm::Event &)
void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, const edm::EventSetup &iSetup, const std::string suffix)
MonitorElement * zPointOfClosestApproach
TrackAnalyzer(const edm::ParameterSet &)
MonitorElement * NumberOfLostRecHitsPerTrackVsPhi
MonitorElement * Chi2ProbVsEta
MonitorElement * TrackEtaPhiInner
MonitorElement * NumberOfMORecHitsPerTrackVsEta
MonitorElement * DistanceOfClosestApproachToBS
std::string monName[monQuantity::END]
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:73
MonitorElement * Chi2oNDFVsPhi