CMS 3D CMS Logo

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 
31 
32 class DQMStore;
33 
34 class BeamSpot;
35 namespace dqm {
37 {
38  public:
42  void initHisto(DQMStore::IBooker & ibooker, const edm::EventSetup &, const edm::ParameterSet&);
43 
44  void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track);
45 
46  void doSoftReset (DQMStore * dqmStore_);
47  void doReset ();
48  void undoSoftReset(DQMStore * dqmStore_);
49  void setLumiFlag();
50  // Compute and locally store the number of Good vertices found
51  // in the event. This information is used as X-axis value in
52  // the hit-efficiency plots derived from the hit patter. This
53  // ugly design to avoid comuting this very same quantity for
54  // each and every track while in the analyze method. A
55  // redesign of the class is needed in the future.
56  void setNumberOfGoodVertices(const edm::Event &);
57  void setBX(const edm::Event &);
58  void setLumi(const edm::Event &, const edm::EventSetup& iSetup);
59 
60  private:
61  void initHistos();
62  void fillHistosForState(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
63  void bookHistosForState(std::string sname,DQMStore::IBooker & ibooker);
69  void fillHistosForHitProperties(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
70  void fillHistosForLScertification(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
71  void fillHistosForTrackerSpecific(const reco::Track & track);
72  void fillHistosForEfficiencyFromHitPatter(const reco::Track & track, const std::string suffix, const float monitoring);
73 
74  // ----------member data ---------------------------
76 
82 
84 
86 
89  bool doBSPlots_;
90  bool doPVPlots_;
97  // ADD by Mia
104  // ADD by Mia in order to clean the tracking MEs
105  // do not plot *Theta* and TrackPx* and TrackPy*
108  // ADD by Mia in order to not plot DistanceOfClosestApproach w.r.t. (0,0,0)
109  // the DistanceOfClosestApproach w.r.t. the beam-spot is already shown in DistanceOfClosestApproachToBS
112 
114 
115  // ADD by Mia in order to turnON test MEs
117 
118  //For HI Plots
120 
121  // IP significance plots
123 
124  // Compute the hit-finding efficiency using the HitPattern of
125  // the reconstructed tracks
129  int pvNDOF_;
134 
135  struct TkParameterMEs {
137  TrackP(NULL)
138  , TrackPx(NULL)
139  , TrackPy(NULL)
140  , TrackPz(NULL)
141  , TrackPt(NULL)
142 
143  , TrackPxErr(NULL)
144  , TrackPyErr(NULL)
145  , TrackPzErr(NULL)
146  , TrackPtErr(NULL)
147  , TrackPErr(NULL)
148 
150 
151  , TrackQ(NULL)
152 
153  , TrackPhi(NULL)
154  , TrackEta(NULL)
155  , TrackTheta(NULL)
156 
157  , TrackPhiErr(NULL)
158  , TrackEtaErr(NULL)
160 
165 
172 
179 
186 
193 
197 
199  , Chi2oNDFVsPt(NULL)
203 
207  {}
208 
214 
220 
222 
224 
230 
232 
236 
241 
248 
255 
262 
269 
273 
279 
283 
284  };
285  std::map<std::string, TkParameterMEs> TkParameterMEMap;
286 
287 
293 
294 
299 
306 
313 
320 
327 
330 
331 
332  MonitorElement* NumberOfLayersPerTrack[4] = {nullptr,nullptr,nullptr,nullptr};
333 
337 
338  MonitorElement* NumberOfLayersVsPhiVsEtaPerTrack[4]= {nullptr,nullptr,nullptr,nullptr};
339 
340 
344 
350 
354 
382  // TESTING MEs
385 
386  // add by Mia in order to deal w/ LS transitions
389 
390  //new plots for Heavy Ion DQM
400 
401  // IP significance plots
408 
419 
422  };
423  std::map<std::string, TkRecHitsPerSubDetMEs> TkRecHitsPerSubDetMEMap;
424 
425  struct Key {
426  int det;
427  int subdet;
429  explicit Key(int det, int subdet,int monitoring):det(det),subdet(subdet),monitoring(monitoring){};
430  bool operator==(const Key & other) const {
431  return (det == other.det && subdet == other.subdet && monitoring == other.monitoring);
432  }
433  };
434 
435  struct KeyHasher {
436  std::size_t operator()(const Key& k) const {
437  // 3 bits (0x7) for kind of monitoring (7 kinds at most)
438  // next 8 bits to the subdetector (255 subdetectors at most)
439  // next 8 bits to the detector (255 detectors at most)
440  return (size_t)(
441  (k.monitoring & (0x7)) |
442  ((k.subdet & (0xff)) << 3) |
443  ((k.det & (0xff)) << 11));
444  }
445  };
446 
447  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_valid_;
448  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_missing_;
449  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_inactive_;
450  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_bad_;
451  std::unordered_map<Key, MonitorElement *, KeyHasher> hits_total_;
452  unsigned int good_vertices_;
453  unsigned int bx_;
454  float pixel_lumi_;
455  float scal_lumi_;
456  enum monQuantity {
462  };
463  std::string monName[monQuantity::END] = { "", "VsBX", "VsPIXELLUMI", "VsSCALLUMI" };
464 
465  std::string histname; //for naming the histograms according to algorithm used
466 };
467 }
468 #endif
MonitorElement * NumberOfMORecHitsPerTrackVsTheta
MonitorElement * sipDzToPV
std::map< std::string, TkParameterMEs > TkParameterMEMap
MonitorElement * NumberOfValidRecHitsPerTrack
MonitorElement * Ptdist_HighPurity
unsigned int bx_
MonitorElement * sip2dToPV
MonitorElement * Chi2oNDFVsTheta
MonitorElement * NumberOfLayersPerTrackVsEta
MonitorElement * xPointOfClosestApproachVsZ0wrtPV
MonitorElement * Chi2ProbVsTheta
MonitorElement * NumberOfValidRecHitsPerTrackVsPhi
MonitorElement * dNdPt_HighPurity
MonitorElement * sipDxyToPV
MonitorElement * LongDCASig
MonitorElement * NumberOfMIRecHitVsPtVsEtaPerTrack
MonitorElement * yPointOfClosestApproach
void doSoftReset(DQMStore *dqmStore_)
MonitorElement * NumberOfValidRecHitsPerTrackVsPt
unsigned int good_vertices_
void initHisto(DQMStore::IBooker &ibooker, const edm::EventSetup &, const edm::ParameterSet &)
bool doTrackRecHitVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:99
MonitorElement * DistanceOfClosestApproachToBSVsPhi
MonitorElement * zPointOfClosestApproachToPV
std::string stateName_
Definition: TrackAnalyzer.h:85
void fillHistosForEfficiencyFromHitPatter(const reco::Track &track, const std::string suffix, const float monitoring)
#define NULL
Definition: scimark2.h:8
MonitorElement * NumberOfLostRecHitsPerTrackVsPt
MonitorElement * NumberOfMIRecHitsPerTrackVsEta
MonitorElement * yPointOfClosestApproachVsZ0wrtPV
MonitorElement * NumberOfLostRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * NumberOfMORecHitsPerTrackVsEta
edm::EDGetTokenT< LumiScalersCollection > lumiscalersToken_
Definition: TrackAnalyzer.h:80
MonitorElement * sipDxyToBS
bool doTrackLayersVsPhiVsEtaPerTrack_
MonitorElement * NumberOfMORecHitsPerTrackVsPt
MonitorElement * NumberOfLostRecHitsPerTrackVsEta
MonitorElement * algorithm
MonitorElement * NumberOfMORecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfLayersPerTrackVsTheta
MonitorElement * NumberOfValidRecHitVsPhiVsEtaPerTrack
void fillHistosForHitProperties(const edm::EventSetup &iSetup, const reco::Track &track, std::string sname)
MonitorElement * NumberOfMIRecHitVsPhiVsEtaPerTrack
void bookHistosForHitProperties(DQMStore::IBooker &ibooker)
MonitorElement * yPointOfClosestApproachToPV
void bookHistosForTrackerSpecific(DQMStore::IBooker &ibooker)
MonitorElement * NumberOfMIRecHitsPerTrackVsPt
MonitorElement * xPointOfClosestApproach
MonitorElement * Chi2oNDF_lumiFlag
MonitorElement * DistanceOfClosestApproach
MonitorElement * Chi2oNDF
MonitorElement * NumberOfRecHitsPerTrackVsPhi
MonitorElement * ValidFractionPerTrack
bool doRecHitVsPtVsEtaPerTrack_
Definition: TrackAnalyzer.h:96
bool doTrackRecHitVsPtVsEtaPerTrack_
int iEvent
Definition: GenABIO.cc:230
void setBX(const edm::Event &)
TrackAnalyzer(const edm::ParameterSet &)
MonitorElement * DistanceOfClosestApproachToPVVsPhi
MonitorElement * NumberOfMORecHitVsPtVsEtaPerTrack
MonitorElement * NumberOfLayersPerTrackVsEta
MonitorElement * NumberOfLayersPerTrackVsPhi
MonitorElement * NumberOfRecHitsPerTrackVsEta
MonitorElement * xPointOfClosestApproachVsZ0wrtBS
MonitorElement * Chi2ProbVsEta
MonitorElement * stoppingSourceVSeta
void bookHistosForLScertification(DQMStore::IBooker &ibooker)
MonitorElement * DistanceOfClosestApproachToBS
MonitorElement * yPointOfClosestApproachVsZ0wrtBS
MonitorElement * NumberOfRecHitVsPhiVsEtaPerTrack
void fillHistosForTrackerSpecific(const reco::Track &track)
edm::ParameterSet const * conf_
Definition: TrackAnalyzer.h:83
MonitorElement * NumberOfLayersPerTrackVsTheta
MonitorElement * NumberOfLostRecHitsPerTrackVsTheta
MonitorElement * NumberOfLayersVsPhiVsEtaPerTrack[4]
MonitorElement * NumberOfMORecHitsPerTrackVsPhi
MonitorElement * dNhitdPt_HighPurity
MonitorElement * sipDzToBS
MonitorElement * xPointOfClosestApproachVsZ0wrt000
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: TrackAnalyzer.h:77
MonitorElement * DistanceOfClosestApproachVsPhi
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_valid_
MonitorElement * TESTDistanceOfClosestApproachToBS
void undoSoftReset(DQMStore *dqmStore_)
std::string monName[monQuantity::END]
MonitorElement * NumberOfMIRecHitsPerTrack
edm::EDGetTokenT< reco::VertexCollection > pvToken_
Definition: TrackAnalyzer.h:78
MonitorElement * ValidFractionVsPhiVsEtaPerTrack
MonitorElement * NhitVsEta_HighPurity
int k[5][pyjets_maxn]
MonitorElement * stoppingSourceVSphi
MonitorElement * NumberOfValidRecHitsPerTrackVsTheta
void setNumberOfGoodVertices(const edm::Event &)
MonitorElement * NumberOfLayersPerTrackVsPhi
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_inactive_
void bookHistosForBeamSpot(DQMStore::IBooker &ibooker)
MonitorElement * dNdPhi_HighPurity
void fillHistosForState(const edm::EventSetup &iSetup, const reco::Track &track, std::string sname)
MonitorElement * NumberOfMIRecHitsPerTrackVsTheta
std::string histname
void bookHistosForState(std::string sname, DQMStore::IBooker &ibooker)
MonitorElement * TESTDistanceOfClosestApproachToBSVsPhi
MonitorElement * oriAlgo
bool doGeneralPropertiesPlots_
Definition: TrackAnalyzer.h:92
MonitorElement * NumberOfRecHitsPerTrack
void fillHistosForLScertification(const edm::EventSetup &iSetup, const reco::Track &track, std::string sname)
MonitorElement * NumberOfMIRecHitsPerTrackVsPhi
MonitorElement * NhitVsPhi_HighPurity
MonitorElement * yPointOfClosestApproachVsZ0wrt000
MonitorElement * NumberOfLostRecHitVsPtVsEtaPerTrack
std::string TopFolder_
Definition: TrackAnalyzer.h:75
bool doRecHitVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:95
MonitorElement * NumberOfValidRecHitVsPtVsEtaPerTrack
MonitorElement * Chi2oNDFVsPhi
std::map< std::string, TkRecHitsPerSubDetMEs > TkRecHitsPerSubDetMEMap
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_bad_
MonitorElement * Chi2
MonitorElement * xPointOfClosestApproachToPV
bool operator==(const Key &other) const
MonitorElement * NumberOfLostRecHitsPerTrackVsPhi
MonitorElement * DistanceOfClosestApproachVsTheta
MonitorElement * dNdEta_HighPurity
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_missing_
MonitorElement * stoppingSource
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClustersToken_
Definition: TrackAnalyzer.h:79
void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, const edm::EventSetup &iSetup, const std::string suffix)
MonitorElement * DeltaZToPV
MonitorElement * zPointOfClosestApproachVsPhi
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
std::string qualityString_
MonitorElement * NumberOfMORecHitsPerTrack
MonitorElement * zPointOfClosestApproach
MonitorElement * Chi2ProbVsPhi
MonitorElement * AbsDistanceOfClosestApproachToBS
void setLumi(const edm::Event &, const edm::EventSetup &iSetup)
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_total_
MonitorElement * DistanceOfClosestApproachVsEta
MonitorElement * sip3dToPV
MonitorElement * Chi2Prob
std::size_t operator()(const Key &k) const
MonitorElement * DistanceOfClosestApproachToPV
MonitorElement * TransDCASig
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::Track &track)
bool doLayersVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:98
MonitorElement * NumberOfLostRecHitsPerTrack
MonitorElement * NumberOfRecHitsPerTrack_lumiFlag
Key(int det, int subdet, int monitoring)
MonitorElement * NumberOfLayersPerTrack[4]