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 {
34  class TrackAnalyzer {
35  public:
39  void initHisto(DQMStore::IBooker& ibooker, const edm::EventSetup&, const edm::ParameterSet&);
40 
41  void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Track& track);
42 
43  void doSoftReset(DQMStore* dqmStore_);
44  void doReset();
45  void undoSoftReset(DQMStore* dqmStore_);
46  void setLumiFlag();
47  // Compute and locally store the number of Good vertices found
48  // in the event. This information is used as X-axis value in
49  // the hit-efficiency plots derived from the hit patter. This
50  // ugly design to avoid comuting this very same quantity for
51  // each and every track while in the analyze method. A
52  // redesign of the class is needed in the future.
54  void setBX(const edm::Event&);
55  void setLumi(const edm::Event&, const edm::EventSetup& iSetup);
56 
57  private:
58  void initHistos();
59  void fillHistosForState(const edm::EventSetup& iSetup, const reco::Track& track, std::string sname);
60  void bookHistosForState(std::string sname, DQMStore::IBooker& ibooker);
66  const edm::EventSetup& iSetup,
67  const std::string suffix,
68  bool useInac);
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);
73  const std::string suffix,
74  const float monitoring,
75  bool useInac);
76 
77  // ----------member data ---------------------------
79 
85 
87 
89 
92  bool doBSPlots_;
93  bool doPVPlots_;
100  // ADD by Mia
107  // ADD by Mia in order to clean the tracking MEs
108  // do not plot *Theta* and TrackPx* and TrackPy*
111  // ADD by Mia in order to not plot DistanceOfClosestApproach w.r.t. (0,0,0)
112  // the DistanceOfClosestApproach w.r.t. the beam-spot is already shown in DistanceOfClosestApproachToBS
115 
117 
118  // ADD by Mia in order to turnON test MEs
120 
121  //For HI Plots
123 
124  // IP significance plots
126 
127  // Compute the hit-finding efficiency using the HitPattern of
128  // the reconstructed tracks
132  int pvNDOF_;
137 
138  struct TkParameterMEs {
140  : TrackP(nullptr),
141  TrackPx(nullptr),
142  TrackPy(nullptr),
143  TrackPz(nullptr),
145 
146  ,
152 
153  ,
155 
156  ,
157  TrackQ(nullptr)
158 
159  ,
160  TrackPhi(nullptr),
161  TrackEta(nullptr),
163 
164  ,
168 
169  ,
174 
175  ,
182 
183  ,
190 
191  ,
198 
199  ,
206 
207  ,
211 
212  ,
218 
219  ,
223 
243 
249 
251 
254 
269 
271 
275 
280 
287 
294 
301 
308 
312 
318 
322  };
323  std::map<std::string, TkParameterMEs> TkParameterMEMap;
324 
330 
335 
342 
349 
356 
363 
366 
367  MonitorElement* NumberOfLayersPerTrack[4] = {nullptr, nullptr, nullptr, nullptr};
368 
372 
373  MonitorElement* NumberOfLayersVsPhiVsEtaPerTrack[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};
374 
378 
384 
388 
425  // TESTING MEs
428 
429  // add by Mia in order to deal w/ LS transitions
432 
433  //new plots for Heavy Ion DQM
443 
444  // IP significance plots
451 
462 
465  };
466  std::map<std::string, TkRecHitsPerSubDetMEs> TkRecHitsPerSubDetMEMap;
467 
468  struct Key {
469  int det;
470  int subdet;
472  explicit Key(int det, int subdet, int monitoring) : det(det), subdet(subdet), monitoring(monitoring){};
473  bool operator==(const Key& other) const {
474  return (det == other.det && subdet == other.subdet && monitoring == other.monitoring);
475  }
476  };
477 
478  struct KeyHasher {
479  std::size_t operator()(const Key& k) const {
480  // 3 bits (0x7) for kind of monitoring (7 kinds at most)
481  // next 8 bits to the subdetector (255 subdetectors at most)
482  // next 8 bits to the detector (255 detectors at most)
483  return (size_t)((k.monitoring & (0x7)) | ((k.subdet & (0xff)) << 3) | ((k.det & (0xff)) << 11));
484  }
485  };
486 
487  std::unordered_map<Key, MonitorElement*, KeyHasher> hits_valid_;
488  std::unordered_map<Key, MonitorElement*, KeyHasher> hits_missing_;
489  std::unordered_map<Key, MonitorElement*, KeyHasher> hits_inactive_;
490  std::unordered_map<Key, MonitorElement*, KeyHasher> hits_bad_;
491  std::unordered_map<Key, MonitorElement*, KeyHasher> hits_total_;
492  unsigned int good_vertices_;
493  unsigned int bx_;
494  float pixel_lumi_;
495  float scal_lumi_;
497  std::string monName[monQuantity::END] = {"", "VsBX", "VsPIXELLUMI", "VsSCALLUMI"};
498 
499  std::string histname; //for naming the histograms according to algorithm used
500  };
501 } // namespace dqm
502 #endif
MonitorElement * NumberOfMORecHitsPerTrackVsTheta
MonitorElement * sipDzToPV
std::map< std::string, TkParameterMEs > TkParameterMEMap
MonitorElement * NumberOfValidRecHitsPerTrack
MonitorElement * Ptdist_HighPurity
unsigned int bx_
MonitorElement * DistanceOfClosestApproachErrorVsEta
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 * TkEtaPhi_RelativeDifference_byFoldingmap
MonitorElement * TrackPt_NegEta_Phi_btw_16_0
MonitorElement * sipDxyToPV
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_inactive_
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 &)
#define nullptr
bool doTrackRecHitVsPhiVsEtaPerTrack_
MonitorElement * DistanceOfClosestApproachToBSVsPhi
MonitorElement * zPointOfClosestApproachToPV
std::string stateName_
Definition: TrackAnalyzer.h:88
MonitorElement * TrackPt_NegEta_Phi_btw_neg16_neg32
MonitorElement * NumberOfLostRecHitsPerTrackVsPt
MonitorElement * TrackPt_PosEta_Phi_btw_32_16
MonitorElement * NumberOfMIRecHitsPerTrackVsEta
MonitorElement * TrackEtaPhiInvertedoutofphase
MonitorElement * yPointOfClosestApproachVsZ0wrtPV
MonitorElement * NumberOfLostRecHitVsPhiVsEtaPerTrack
MonitorElement * NumberOfRecHitsPerTrackVsTheta
MonitorElement * NumberOfMORecHitsPerTrackVsEta
edm::EDGetTokenT< LumiScalersCollection > lumiscalersToken_
Definition: TrackAnalyzer.h:83
MonitorElement * sipDxyToBS
bool doTrackLayersVsPhiVsEtaPerTrack_
MonitorElement * NumberOfMORecHitsPerTrackVsPt
MonitorElement * NumberOfLostRecHitsPerTrackVsEta
MonitorElement * DistanceOfClosestApproachError
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:99
bool doTrackRecHitVsPtVsEtaPerTrack_
int iEvent
Definition: GenABIO.cc:224
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 * TkEtaPhi_Ratio_byFoldingmap
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:86
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
MonitorElement * TkEtaPhi_Ratio_byFoldingmap_op
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: TrackAnalyzer.h:80
MonitorElement * DistanceOfClosestApproachVsPhi
MonitorElement * TESTDistanceOfClosestApproachToBS
void undoSoftReset(DQMStore *dqmStore_)
std::string monName[monQuantity::END]
MonitorElement * NumberOfMIRecHitsPerTrack
MonitorElement * DeltaZToPVZoom
MonitorElement * DistanceOfClosestApproachErrorVsDxy
edm::EDGetTokenT< reco::VertexCollection > pvToken_
Definition: TrackAnalyzer.h:81
MonitorElement * ValidFractionVsPhiVsEtaPerTrack
MonitorElement * DistanceOfClosestApproachToBSVsEta
MonitorElement * NhitVsEta_HighPurity
int k[5][pyjets_maxn]
MonitorElement * stoppingSourceVSphi
MonitorElement * NumberOfValidRecHitsPerTrackVsTheta
void setNumberOfGoodVertices(const edm::Event &)
MonitorElement * NumberOfLayersPerTrackVsPhi
void bookHistosForBeamSpot(DQMStore::IBooker &ibooker)
MonitorElement * TkEtaPhi_RelativeDifference_byFoldingmap_op
MonitorElement * TrackPt_PosEta_Phi_btw_16_0
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:95
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:78
bool doRecHitVsPhiVsEtaPerTrack_
Definition: TrackAnalyzer.h:98
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_missing_
MonitorElement * TrackPt_PosEta_Phi_btw_0_neg16
MonitorElement * TrackPt_PosEta_Phi_btw_neg16_neg32
MonitorElement * DistanceOfClosestApproachErrorVsPt
MonitorElement * NumberOfValidRecHitVsPtVsEtaPerTrack
MonitorElement * Chi2oNDFVsPhi
std::map< std::string, TkRecHitsPerSubDetMEs > TkRecHitsPerSubDetMEMap
MonitorElement * Chi2
MonitorElement * xPointOfClosestApproachToPV
bool operator==(const Key &other) const
MonitorElement * NumberOfLostRecHitsPerTrackVsPhi
MonitorElement * DistanceOfClosestApproachVsTheta
MonitorElement * dNdEta_HighPurity
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_valid_
MonitorElement * stoppingSource
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClustersToken_
Definition: TrackAnalyzer.h:82
MonitorElement * DistanceOfClosestApproachToPVZoom
MonitorElement * DeltaZToPV
MonitorElement * zPointOfClosestApproachVsPhi
MonitorElement * NumberOfValidRecHitsPerTrackVsEta
std::string qualityString_
MonitorElement * NumberOfMORecHitsPerTrack
MonitorElement * TrackPt_NegEta_Phi_btw_0_neg16
MonitorElement * zPointOfClosestApproach
MonitorElement * Chi2ProbVsPhi
MonitorElement * AbsDistanceOfClosestApproachToBS
void setLumi(const edm::Event &, const edm::EventSetup &iSetup)
MonitorElement * DistanceOfClosestApproachErrorVsPhi
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_bad_
MonitorElement * TrackPt_NegEta_Phi_btw_32_16
MonitorElement * DistanceOfClosestApproachVsEta
MonitorElement * sip3dToPV
MonitorElement * Chi2Prob
std::unordered_map< Key, MonitorElement *, KeyHasher > hits_total_
std::size_t operator()(const Key &k) const
MonitorElement * DistanceOfClosestApproachToBSdz
MonitorElement * DistanceOfClosestApproachToPV
MonitorElement * TransDCASig
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::Track &track)
bool doLayersVsPhiVsEtaPerTrack_
MonitorElement * NumberOfLostRecHitsPerTrack
MonitorElement * NumberOfRecHitsPerTrack_lumiFlag
Key(int det, int subdet, int monitoring)
MonitorElement * NumberOfLayersPerTrack[4]