CMS 3D CMS Logo

DTT0Calibration.h
Go to the documentation of this file.
1 #ifndef CalibMuon_DTT0Calibration_H
2 #define CalibMuon_DTT0Calibration_H
3 
14 //#include "FWCore/Framework/interface/EDAnalyzer.h"
20 
21 #include <string>
22 #include <vector>
23 #include <map>
24 
25 #include "TFile.h"
26 #include "TH1I.h"
27 #include "TH1D.h"
28 #include "TSpectrum.h"
29 
30 //class TFile;
31 //class TH1I;
32 //class TH1D;
33 //class TSpectrum;
34 class DTT0;
35 
37 public:
40 
42  ~DTT0Calibration() override;
43 
44  // Operations
45 
47  void analyze(const edm::Event & event, const edm::EventSetup& eventSetup) override;
48 
50  void endJob() override;
51 
52 
53 protected:
54 
55 private:
56  // Generate the histo name
57  std::string getHistoName(const DTWireId& wId) const;
58  std::string getHistoName(const DTLayerId& lId) const;
59 
60  // Debug flag
61  bool debug;
62 
63  // The label used to retrieve digis from the event
65 
66  // The root file which contain the histos per layer
67  TFile theFile;
68 
69  //The event counter
70  unsigned int nevents;
71  //Number of events to be used for the t0 per layer histos
72  unsigned int eventsForLayerT0;
73  //Number of events to be used for the t0 reference per wire
74  unsigned int eventsForWireT0;
75 
76  //Acceptance of t0 w.r.t. reference peak
77  double tpPeakWidth;
78 
79  //Acceptance of t0 w.r.t. reference peak
81 
82  //Digi's will be rejected if too far from TP peak
83  unsigned int rejectDigiFromPeak;
84 
85  //The wheels,sector to be calibrated (default All)
87  int selWheel;
89  int selSector;
90 
91  // Map of the histos and graph by layer
92  std::map<DTLayerId, TH1I> theHistoLayerMap;
93 
94  // Histogram containing position of all peaks
96 
97  TSpectrum spectrum;
98 
99  //Layer with histos for each wire
100  std::vector<DTWireId> wireIdWithHistos;
101  std::vector<DTLayerId> layerIdWithWireHistos;
102 
103  //Maps with t0, sigma, number of digi per wire
104  std::map<DTWireId,double> theAbsoluteT0PerWire;
105  std::map<DTWireId,double> theRelativeT0PerWire;
106  std::map<DTWireId,double> theSigmaT0PerWire;
107  std::map<DTWireId,int> nDigiPerWire;
108  std::map<DTWireId,int> nDigiPerWire_ref;
109  std::map<DTWireId,double> mK;
110  std::map<DTWireId,double> mK_ref;
111  std::map<DTWireId,double> qK;
112  //Map with histo per wire for the chosen layer
113  std::map<DTWireId,TH1I> theHistoWireMap;
114  //Map with mean and RMS of t0 per layer
115  std::map<std::string,double> theT0LayerMap;
116  std::map<std::string,double> theSigmaT0LayerMap;
117  std::map<DTLayerId,double> theTPPeakMap;
118  //Ref. t0 per chamber
119  std::map<DTChamberId,double> theSumT0ByChamber;
120  std::map<DTChamberId,int> theCountT0ByChamber;
121  std::map<DTChamberId,double> theSigmaT0ByChamber;
122  std::map<DTChamberId,double> theMeanT0ByChamber;
123  std::map<DTChamberId,double> theRefT0ByChamber;
124 
125  //DTGeometry used to loop on the SL in the endJob
127 };
128 #endif
129 
std::vector< DTLayerId > layerIdWithWireHistos
double tpPeakWidthPerLayer
std::map< DTLayerId, TH1I > theHistoLayerMap
void endJob() override
Compute the mean and the RMS of the t0 from the maps and write them to the DB with channel granularit...
unsigned int nevents
std::map< DTWireId, double > theAbsoluteT0PerWire
std::map< DTChamberId, double > theRefT0ByChamber
std::map< DTLayerId, double > theTPPeakMap
std::map< DTWireId, int > nDigiPerWire
std::vector< DTWireId > wireIdWithHistos
std::string theCalibWheel
std::map< DTChamberId, int > theCountT0ByChamber
std::string getHistoName(const DTWireId &wId) const
std::map< DTWireId, double > theSigmaT0PerWire
edm::ESHandle< DTGeometry > dtGeom
std::map< DTWireId, double > mK
unsigned int eventsForLayerT0
Definition: DTT0.h:53
unsigned int rejectDigiFromPeak
std::map< DTWireId, double > theRelativeT0PerWire
~DTT0Calibration() override
Destructor.
std::string theCalibSector
std::map< DTWireId, double > qK
std::map< std::string, double > theSigmaT0LayerMap
std::map< std::string, double > theT0LayerMap
edm::EDGetTokenT< DTDigiCollection > digiToken
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
Fill the maps with t0 (by channel)
std::map< DTWireId, double > mK_ref
std::map< DTWireId, TH1I > theHistoWireMap
std::map< DTChamberId, double > theSumT0ByChamber
DTT0Calibration(const edm::ParameterSet &pset)
Constructor.
TSpectrum spectrum
unsigned int eventsForWireT0
std::map< DTChamberId, double > theMeanT0ByChamber
Definition: event.py:1
std::map< DTWireId, int > nDigiPerWire_ref
std::map< DTChamberId, double > theSigmaT0ByChamber