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 
29 
31 
32 class BeamSpot;
33 namespace dqm {
35 {
36  public:
40  void initHisto(DQMStore::IBooker & ibooker, const edm::EventSetup &, const edm::ParameterSet&);
41 
42  void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track);
43 
44  void doSoftReset (DQMStore * dqmStore_);
45  void doReset ();
46  void undoSoftReset(DQMStore * dqmStore_);
47  void setLumiFlag();
48  // Compute and locally store the number of Good vertices found
49  // in the event. This information is used as X-axis value in
50  // the hit-efficiency plots derived from the hit patter. This
51  // ugly design to avoid comuting this very same quantity for
52  // each and every track while in the analyze method. A
53  // redesign of the class is needed in the future.
54  void setNumberOfGoodVertices(const edm::Event &);
55  void setBX(const edm::Event &);
56  void setLumi(const edm::Event &, const edm::EventSetup& iSetup);
57 
58  private:
59  void initHistos();
60  void fillHistosForState(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
61  void bookHistosForState(std::string sname,DQMStore::IBooker & ibooker);
66  void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, const edm::EventSetup & iSetup, const std::string suffix, bool useInac);
67  void fillHistosForHitProperties(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
68  void fillHistosForLScertification(const edm::EventSetup& iSetup, const reco::Track & track, std::string sname);
69  void fillHistosForTrackerSpecific(const reco::Track & track);
70  void fillHistosForEfficiencyFromHitPatter(const reco::Track & track, const std::string suffix, const float monitoring,bool useInac);
71 
72  // ----------member data ---------------------------
74 
80 
82 
84 
87  bool doBSPlots_;
88  bool doPVPlots_;
95  // ADD by Mia
102  // ADD by Mia in order to clean the tracking MEs
103  // do not plot *Theta* and TrackPx* and TrackPy*
106  // ADD by Mia in order to not plot DistanceOfClosestApproach w.r.t. (0,0,0)
107  // the DistanceOfClosestApproach w.r.t. the beam-spot is already shown in DistanceOfClosestApproachToBS
110 
112 
113  // ADD by Mia in order to turnON test MEs
115 
116  //For HI Plots
118 
119  // IP significance plots
121 
122  // Compute the hit-finding efficiency using the HitPattern of
123  // the reconstructed tracks
127  int pvNDOF_;
132 
133  struct TkParameterMEs {
135  TrackP(nullptr)
136  , TrackPx(nullptr)
137  , TrackPy(nullptr)
138  , TrackPz(nullptr)
139  , TrackPt(nullptr)
140 
145  , TrackPErr(nullptr)
146 
148 
149  , TrackQ(nullptr)
150 
151  , TrackPhi(nullptr)
152  , TrackEta(nullptr)
154 
158 
163 
170 
177 
184 
191 
195 
201 
205  {}
206 
212 
218 
220 
222 
228 
230 
234 
239 
246 
253 
260 
267 
271 
277 
281 
282  };
283  std::map<std::string, TkParameterMEs> TkParameterMEMap;
284 
285 
291 
292 
297 
304 
311 
318 
325 
328 
329 
330  MonitorElement* NumberOfLayersPerTrack[4] = {nullptr,nullptr,nullptr,nullptr};
331 
335 
336  MonitorElement* NumberOfLayersVsPhiVsEtaPerTrack[5]= {nullptr,nullptr,nullptr,nullptr,nullptr};
337 
338 
342 
348 
352 
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
void fillHistosForEfficiencyFromHitPatter(const reco::Track &track, const std::string suffix, const float monitoring, bool useInac)
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:97
MonitorElement * DistanceOfClosestApproachToBSVsPhi
MonitorElement * zPointOfClosestApproachToPV
std::string stateName_
Definition: TrackAnalyzer.h:83
MonitorElement * NumberOfLostRecHitsPerTrackVsPt
MonitorElement * NumberOfMIRecHitsPerTrackVsEta
MonitorElement * yPointOfClosestApproachVsZ0wrtPV
#define nullptr
MonitorElement * NumberOfLostRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * NumberOfMORecHitsPerTrackVsEta
edm::EDGetTokenT< LumiScalersCollection > lumiscalersToken_
Definition: TrackAnalyzer.h:78
MonitorElement * sipDxyToBS
bool doTrackLayersVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:99
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:94
bool doTrackRecHitVsPtVsEtaPerTrack_
Definition: TrackAnalyzer.h:98
int iEvent
Definition: GenABIO.cc:230
void setBX(const edm::Event &)
TrackAnalyzer(const edm::ParameterSet &)
MonitorElement * NumberOfLayersVsPhiVsEtaPerTrack[5]
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:81
MonitorElement * NumberOfLayersPerTrackVsTheta
MonitorElement * NumberOfLostRecHitsPerTrackVsTheta
MonitorElement * NumberOfMORecHitsPerTrackVsPhi
void bookHistosForEfficiencyFromHitPatter(DQMStore::IBooker &ibooker, const edm::EventSetup &iSetup, const std::string suffix, bool useInac)
MonitorElement * dNhitdPt_HighPurity
MonitorElement * sipDzToBS
MonitorElement * xPointOfClosestApproachVsZ0wrt000
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: TrackAnalyzer.h:75
MonitorElement * DistanceOfClosestApproachVsPhi
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_valid_
MonitorElement * TESTDistanceOfClosestApproachToBS
void undoSoftReset(DQMStore *dqmStore_)
std::string monName[monQuantity::END]
MonitorElement * NumberOfMIRecHitsPerTrack
MonitorElement * DeltaZToPVZoom
edm::EDGetTokenT< reco::VertexCollection > pvToken_
Definition: TrackAnalyzer.h:76
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:90
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:73
bool doRecHitVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:93
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:77
MonitorElement * DistanceOfClosestApproachToPVZoom
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:96
MonitorElement * NumberOfLostRecHitsPerTrack
MonitorElement * NumberOfRecHitsPerTrack_lumiFlag
Key(int det, int subdet, int monitoring)
MonitorElement * NumberOfLayersPerTrack[4]