CMS 3D CMS Logo

TrackAnalyzer.h
Go to the documentation of this file.
1 #ifndef TrackAnalyzer_H
2 #define TrackAnalyzer_H
3 //
7 // Original Author: Suchandra Dutta, Giorgia Mila
8 // Created: Thu 28 22:45:30 CEST 2008
9 
10 #include <memory>
11 #include <fstream>
12 #include <unordered_map>
22 
26 
36 
37 class BeamSpot;
38 namespace tadqm {
39  class TrackAnalyzer {
40  public:
46  void initHisto(DQMStore::IBooker& ibooker, const edm::EventSetup&, const edm::ParameterSet&);
47 
48  void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track);
49 
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.
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  const edm::EventSetup& iSetup,
70  const std::string suffix,
71  bool useInac);
72  void fillHistosForHitProperties(const edm::EventSetup& iSetup, const reco::Track& track, std::string sname);
76  const std::string suffix,
77  const float monitoring,
78  bool useInac);
79 
80  // ----------member data ---------------------------
82 
91 
93 
95 
97 
108  // ADD by Mia
115  // ADD by Mia in order to clean the tracking MEs
116  // do not plot *Theta* and TrackPx* and TrackPy*
119  // ADD by Mia in order to not plot DistanceOfClosestApproach w.r.t. (0,0,0)
120  // the DistanceOfClosestApproach w.r.t. the beam-spot is already shown in DistanceOfClosestApproachToBS
123 
125 
126  // ADD by Mia in order to turnON test MEs
128 
129  //For HI Plots
131 
132  // IP significance plots
134 
135  // Compute the hit-finding efficiency using the HitPattern of
136  // the reconstructed tracks
140  int pvNDOF_;
141  const bool forceSCAL_;
146 
147  struct TkParameterMEs {
149  : TrackP(nullptr),
150  TrackPx(nullptr),
151  TrackPy(nullptr),
152  TrackPz(nullptr),
153  TrackPt(nullptr)
154 
155  ,
156  TrackPxErr(nullptr),
157  TrackPyErr(nullptr),
158  TrackPzErr(nullptr),
159  TrackPtErr(nullptr),
160  TrackPErr(nullptr)
161 
162  ,
163  TrackPtErrVsEta(nullptr)
164 
165  ,
166  TrackQ(nullptr)
167 
168  ,
169  TrackPhi(nullptr),
170  TrackEta(nullptr),
171  TrackTheta(nullptr)
172 
173  ,
174  TrackPhiErr(nullptr),
175  TrackEtaErr(nullptr),
176  TrackThetaErr(nullptr)
177 
178  ,
183 
184  ,
191 
192  ,
199 
200  ,
207 
208  ,
215 
216  ,
220 
221  ,
222  Chi2oNDFVsNHits(nullptr),
223  Chi2oNDFVsPt(nullptr),
224  Chi2oNDFVsEta(nullptr),
225  Chi2oNDFVsPhi(nullptr),
226  Chi2oNDFVsTheta(nullptr)
227 
228  ,
229  Chi2ProbVsEta(nullptr),
230  Chi2ProbVsPhi(nullptr),
231  Chi2ProbVsTheta(nullptr) {}
232 
252 
258 
260 
263 
274 
276 
280 
285 
292 
299 
306 
313 
317 
323 
327  };
328  std::map<std::string, TkParameterMEs> TkParameterMEMap;
329 
335 
340 
347 
354 
361 
368 
371 
372  MonitorElement* NumberOfLayersPerTrack[4] = {nullptr, nullptr, nullptr, nullptr};
373 
377 
378  MonitorElement* NumberOfLayersVsPhiVsEtaPerTrack[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};
379 
383 
389 
393 
430  // TESTING MEs
433 
434  // add by Mia in order to deal w/ LS transitions
437 
438  //new plots for Heavy Ion DQM
448 
449  // IP significance plots
456 
467 
470  };
471  std::map<std::string, TkRecHitsPerSubDetMEs> TkRecHitsPerSubDetMEMap;
472 
473  struct Key {
474  int det;
475  int subdet;
477  explicit Key(int det, int subdet, int monitoring) : det(det), subdet(subdet), monitoring(monitoring){};
478  bool operator==(const Key& other) const {
479  return (det == other.det && subdet == other.subdet && monitoring == other.monitoring);
480  }
481  };
482 
483  struct KeyHasher {
484  std::size_t operator()(const Key& k) const {
485  // 3 bits (0x7) for kind of monitoring (7 kinds at most)
486  // next 8 bits to the subdetector (255 subdetectors at most)
487  // next 8 bits to the detector (255 detectors at most)
488  return (size_t)((k.monitoring & (0x7)) | ((k.subdet & (0xff)) << 3) | ((k.det & (0xff)) << 11));
489  }
490  };
491 
492  std::unordered_map<Key, MonitorElement*, KeyHasher> hits_valid_;
493  std::unordered_map<Key, MonitorElement*, KeyHasher> hits_missing_;
494  std::unordered_map<Key, MonitorElement*, KeyHasher> hits_inactive_;
495  std::unordered_map<Key, MonitorElement*, KeyHasher> hits_bad_;
496  std::unordered_map<Key, MonitorElement*, KeyHasher> hits_total_;
497  unsigned int good_vertices_;
498  unsigned int bx_;
499  float pixel_lumi_;
500  float scal_lumi_;
502  std::string monName[monQuantity::END] = {"", "VsBX", "VsPIXELLUMI", "VsSCALLUMI"};
503 
504  std::string histname; //for naming the histograms according to algorithm used
505  };
506 } // namespace tadqm
507 #endif
MonitorElement * dNdPhi_HighPurity
MonitorElement * NumberOfLostRecHitsPerTrackVsPhi
MonitorElement * NumberOfValidRecHitsPerTrackVsPt
MonitorElement * NumberOfMIRecHitsPerTrackVsTheta
MonitorElement * NumberOfLostRecHitsPerTrackVsEta
std::string monName[monQuantity::END]
MonitorElement * NumberOfRecHitsPerTrackVsPhi
MonitorElement * NumberOfLayersPerTrack[4]
MonitorElement * ValidFractionVsPhiVsEtaPerTrack
MonitorElement * NumberOfMORecHitsPerTrackVsPt
MonitorElement * NumberOfLostRecHitsPerTrackVsPhi
MonitorElement * LongDCASig
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_total_
MonitorElement * NumberOfRecHitsPerTrackVsEta
MonitorElement * algorithm
MonitorElement * TrackPt_NegEta_Phi_btw_32_16
MonitorElement * sipDxyToPV
MonitorElement * NumberOfLostRecHitsPerTrackVsPt
MonitorElement * DistanceOfClosestApproach
std::string qualityString_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClustersToken_
Definition: TrackAnalyzer.h:85
MonitorElement * NumberOfMORecHitsPerTrackVsTheta
MonitorElement * NumberOfLayersPerTrackVsPhi
MonitorElement * stoppingSource
MonitorElement * NumberOfLostRecHitsPerTrackVsPt
MonitorElement * NumberOfValidRecHitVsPtVsEtaPerTrack
void bookHistosForTrackerSpecific(DQMStore::IBooker &ibooker)
void bookHistosForHitProperties(DQMStore::IBooker &ibooker)
MonitorElement * NumberOfMIRecHitVsPtVsEtaPerTrack
void setBX(const edm::Event &)
MonitorElement * DistanceOfClosestApproachToBSdz
MonitorElement * NumberOfMORecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfLostRecHitVsPhiVsEtaPerTrack
MonitorElement * DistanceOfClosestApproachError
MonitorElement * Chi2oNDFVsPhi
MonitorElement * NumberOfLayersPerTrackVsPhi
MonitorElement * DeltaZToPVZoom
MonitorElement * Chi2oNDFVsNHits
MonitorElement * xPointOfClosestApproachVsZ0wrtPV
MonitorElement * sip2dToPV
dqm::legacy::MonitorElement MonitorElement
Definition: TrackAnalyzer.h:42
MonitorElement * Chi2oNDF
TrackAnalyzer(const edm::ParameterSet &)
MonitorElement * DeltaZToPV
MonitorElement * NumberOfLostRecHitsPerTrack
MonitorElement * NumberOfMIRecHitsPerTrackVsEta
MonitorElement * yPointOfClosestApproach
MonitorElement * sipDxyToBS
void initHisto(DQMStore::IBooker &ibooker, const edm::EventSetup &, const edm::ParameterSet &)
MonitorElement * xPointOfClosestApproach
MonitorElement * DistanceOfClosestApproachErrorVsEta
edm::EDGetTokenT< OnlineLuminosityRecord > metaDataToken_
Definition: TrackAnalyzer.h:87
void fillHistosForLScertification(const edm::EventSetup &iSetup, const reco::Track &track, std::string sname)
MonitorElement * Chi2oNDFVsPt
MonitorElement * TrackPt_NegEta_Phi_btw_16_0
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::Track &track)
MonitorElement * NumberOfLayersPerTrackVsEta
MonitorElement * TransDCASig
MonitorElement * NumberOfLayersPerTrackVsEta
MonitorElement * DistanceOfClosestApproachVsPhi
void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, const edm::EventSetup &iSetup, const std::string suffix, bool useInac)
MonitorElement * Chi2oNDFVsTheta
Key(int det, int subdet, int monitoring)
MonitorElement * NumberOfRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfMIRecHitVsPhiVsEtaPerTrack
MonitorElement * DistanceOfClosestApproachToPVVsPhi
bool operator==(const Key &other) const
MonitorElement * NumberOfValidRecHitVsPhiVsEtaPerTrack
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
Definition: TrackAnalyzer.h:88
int iEvent
Definition: GenABIO.cc:224
MonitorElement * stoppingSourceVSeta
MonitorElement * dNdPt_HighPurity
MonitorElement * NumberOfLayersPerTrackVsTheta
edm::EDGetTokenT< LumiScalersCollection > lumiscalersToken_
Definition: TrackAnalyzer.h:86
MonitorElement * Chi2oNDF_lumiFlag
MonitorElement * stoppingSourceVSphi
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
MonitorElement * NumberOfLayersPerTrackVsTheta
bool doTrackRecHitVsPhiVsEtaPerTrack_
MonitorElement * DistanceOfClosestApproachErrorVsPt
MonitorElement * sip3dToPV
void fillHistosForState(const edm::EventSetup &iSetup, const reco::Track &track, std::string sname)
MonitorElement * xPointOfClosestApproachToPV
MonitorElement * NumberOfMORecHitsPerTrack
MonitorElement * Chi2Prob
MonitorElement * dNhitdPt_HighPurity
unsigned int good_vertices_
MonitorElement * NumberOfValidRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfValidRecHitsPerTrackVsTheta
MonitorElement * NumberOfLostRecHitsPerTrackVsEta
MonitorElement * Chi2ProbVsEta
MonitorElement * TrackPt_PosEta_Phi_btw_16_0
void fillHistosForTrackerSpecific(const reco::Track &track)
std::string stateName_
Definition: TrackAnalyzer.h:96
MonitorElement * yPointOfClosestApproachVsZ0wrtPV
MonitorElement * zPointOfClosestApproachToPV
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_missing_
MonitorElement * NhitVsEta_HighPurity
MonitorElement * DistanceOfClosestApproachVsTheta
MonitorElement * Chi2ProbVsPhi
MonitorElement * NumberOfMIRecHitsPerTrackVsPhi
bool doTrackRecHitVsPtVsEtaPerTrack_
std::map< std::string, TkParameterMEs > TkParameterMEMap
MonitorElement * NumberOfLayersVsPhiVsEtaPerTrack[5]
MonitorElement * Chi2ProbVsTheta
dqm::legacy::DQMStore DQMStore
Definition: TrackAnalyzer.h:41
MonitorElement * NumberOfMIRecHitsPerTrackVsTheta
MonitorElement * NumberOfRecHitsPerTrackVsPhi
MonitorElement * NumberOfMIRecHitVsPtVsEtaPerTrack
MonitorElement * zPointOfClosestApproach
edm::ParameterSet const * conf_
Definition: TrackAnalyzer.h:94
MonitorElement * sipDzToPV
MonitorElement * Chi2
MonitorElement * sipDzToBS
MonitorElement * NumberOfValidRecHitsPerTrackVsPhi
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: TrackAnalyzer.h:83
MonitorElement * NumberOfMORecHitsPerTrackVsTheta
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackBuilderToken_
Definition: TrackAnalyzer.h:90
void bookHistosForState(std::string sname, DQMStore::IBooker &ibooker)
MonitorElement * DistanceOfClosestApproachErrorVsPhi
void setLumi(const edm::Event &, const edm::EventSetup &iSetup)
void bookHistosForBeamSpot(DQMStore::IBooker &ibooker)
std::size_t operator()(const Key &k) const
MonitorElement * DistanceOfClosestApproachVsEta
MonitorElement * NumberOfMORecHitVsPhiVsEtaPerTrack
void setNumberOfGoodVertices(const edm::Event &)
MonitorElement * TESTDistanceOfClosestApproachToBSVsPhi
MonitorElement * DistanceOfClosestApproachToBS
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_inactive_
std::string TopFolder_
Definition: TrackAnalyzer.h:81
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
MonitorElement * NumberOfMIRecHitsPerTrackVsPhi
MonitorElement * NumberOfLostRecHitVsPtVsEtaPerTrack
MonitorElement * NumberOfMIRecHitsPerTrackVsPt
MonitorElement * NhitVsPhi_HighPurity
MonitorElement * NumberOfRecHitsPerTrack
MonitorElement * xPointOfClosestApproachVsZ0wrtBS
MonitorElement * NumberOfRecHitsPerTrack_lumiFlag
edm::EDGetTokenT< reco::VertexCollection > pvToken_
Definition: TrackAnalyzer.h:84
MonitorElement * Ptdist_HighPurity
MonitorElement * NumberOfMORecHitsPerTrackVsPhi
MonitorElement * NumberOfMORecHitsPerTrackVsEta
MonitorElement * DistanceOfClosestApproachToPVZoom
MonitorElement * DistanceOfClosestApproachToBSVsEta
MonitorElement * DistanceOfClosestApproachErrorVsDxy
MonitorElement * NumberOfValidRecHitsPerTrack
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_bad_
MonitorElement * NumberOfMORecHitVsPtVsEtaPerTrack
void fillHistosForEfficiencyFromHitPatter(const reco::Track &track, const std::string suffix, const float monitoring, bool useInac)
MonitorElement * AbsDistanceOfClosestApproachToBS
MonitorElement * NumberOfValidRecHitsPerTrackVsTheta
MonitorElement * yPointOfClosestApproachVsZ0wrtBS
MonitorElement * TESTDistanceOfClosestApproachToBS
MonitorElement * yPointOfClosestApproachToPV
void fillHistosForHitProperties(const edm::EventSetup &iSetup, const reco::Track &track, std::string sname)
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * oriAlgo
MonitorElement * TrackPt_NegEta_Phi_btw_neg16_neg32
MonitorElement * NumberOfValidRecHitsPerTrackVsPt
MonitorElement * NumberOfLostRecHitVsPtVsEtaPerTrack
MonitorElement * NumberOfMIRecHitsPerTrackVsEta
MonitorElement * NumberOfMIRecHitVsPhiVsEtaPerTrack
MonitorElement * yPointOfClosestApproachVsZ0wrt000
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_valid_
MonitorElement * NumberOfMORecHitsPerTrackVsPt
MonitorElement * dNdEta_HighPurity
bool doTrackLayersVsPhiVsEtaPerTrack_
MonitorElement * NumberOfValidRecHitVsPtVsEtaPerTrack
MonitorElement * xPointOfClosestApproachVsZ0wrt000
std::map< std::string, TkRecHitsPerSubDetMEs > TkRecHitsPerSubDetMEMap
MonitorElement * TrackPt_PosEta_Phi_btw_neg16_neg32
MonitorElement * TrackEtaPhiInvertedoutofphase
MonitorElement * NumberOfMIRecHitsPerTrack
MonitorElement * NumberOfValidRecHitsPerTrackVsPhi
MonitorElement * zPointOfClosestApproachVsPhi
MonitorElement * TrackPt_NegEta_Phi_btw_0_neg16
MonitorElement * NumberOfMIRecHitsPerTrackVsPt
MonitorElement * NumberOfLostRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfMORecHitVsPtVsEtaPerTrack
MonitorElement * DistanceOfClosestApproachToPV
MonitorElement * NumberOfMORecHitsPerTrackVsEta
MonitorElement * Chi2oNDFVsEta
MonitorElement * NumberOfLostRecHitsPerTrackVsTheta
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * NumberOfMORecHitsPerTrackVsPhi
MonitorElement * DistanceOfClosestApproachToBSVsPhi
MonitorElement * NumberOfRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfRecHitsPerTrackVsEta
MonitorElement * ValidFractionPerTrack
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
Definition: TrackAnalyzer.h:89
void bookHistosForLScertification(DQMStore::IBooker &ibooker)
MonitorElement * TrackPt_PosEta_Phi_btw_0_neg16
MonitorElement * TrackPt_PosEta_Phi_btw_32_16
MonitorElement * NumberOfLostRecHitsPerTrackVsTheta