CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DTT0Calibration.h
Go to the documentation of this file.
1 #ifndef CalibMuon_DTT0Calibration_H
2 #define CalibMuon_DTT0Calibration_H
3 
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 protected:
53 private:
54  // Generate the histo name
55  std::string getHistoName(const DTWireId& wId) const;
56  std::string getHistoName(const DTLayerId& lId) const;
57 
58  // Debug flag
59  bool debug;
60 
61  // The label used to retrieve digis from the event
63 
64  // The root file which contain the histos per layer
65  TFile theFile;
66 
67  //The event counter
68  unsigned int nevents;
69  //Number of events to be used for the t0 per layer histos
70  unsigned int eventsForLayerT0;
71  //Number of events to be used for the t0 reference per wire
72  unsigned int eventsForWireT0;
73 
74  //Acceptance of t0 w.r.t. reference peak
75  double tpPeakWidth;
76 
77  //Acceptance of t0 w.r.t. reference peak
79 
80  //Digi's will be rejected if too far from TP peak
81  unsigned int rejectDigiFromPeak;
82 
83  //The wheels,sector to be calibrated (default All)
85  int selWheel;
87  int selSector;
88 
89  // Map of the histos and graph by layer
90  std::map<DTLayerId, TH1I> theHistoLayerMap;
91 
92  // Histogram containing position of all peaks
94 
95  TSpectrum spectrum;
96 
97  //Layer with histos for each wire
98  std::vector<DTWireId> wireIdWithHistos;
99  std::vector<DTLayerId> layerIdWithWireHistos;
100 
101  //Maps with t0, sigma, number of digi per wire
102  std::map<DTWireId, double> theAbsoluteT0PerWire;
103  std::map<DTWireId, double> theRelativeT0PerWire;
104  std::map<DTWireId, double> theSigmaT0PerWire;
105  std::map<DTWireId, int> nDigiPerWire;
106  std::map<DTWireId, int> nDigiPerWire_ref;
107  std::map<DTWireId, double> mK;
108  std::map<DTWireId, double> mK_ref;
109  std::map<DTWireId, double> qK;
110  //Map with histo per wire for the chosen layer
111  std::map<DTWireId, TH1I> theHistoWireMap;
112  //Map with mean and RMS of t0 per layer
113  std::map<std::string, double> theT0LayerMap;
114  std::map<std::string, double> theSigmaT0LayerMap;
115  std::map<DTLayerId, double> theTPPeakMap;
116  //Ref. t0 per chamber
117  std::map<DTChamberId, double> theSumT0ByChamber;
118  std::map<DTChamberId, int> theCountT0ByChamber;
119  std::map<DTChamberId, double> theSigmaT0ByChamber;
120  std::map<DTChamberId, double> theMeanT0ByChamber;
121  std::map<DTChamberId, double> theRefT0ByChamber;
122 
123  //DTGeometry used to loop on the SL in the endJob
126 };
127 #endif
std::vector< DTLayerId > layerIdWithWireHistos
double tpPeakWidthPerLayer
std::map< DTLayerId, TH1I > theHistoLayerMap
std::map< DTWireId, double > theAbsoluteT0PerWire
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< DTChamberId, double > theMeanT0ByChamber
std::vector< DTWireId > wireIdWithHistos
std::string theCalibWheel
std::map< DTChamberId, double > theRefT0ByChamber
std::string getHistoName(const DTWireId &wId) const
std::map< DTWireId, double > mK_ref
std::map< std::string, double > theT0LayerMap
edm::ESHandle< DTGeometry > dtGeom
std::map< DTChamberId, int > theCountT0ByChamber
unsigned int eventsForLayerT0
Definition: DTT0.h:48
std::map< DTLayerId, double > theTPPeakMap
std::map< DTWireId, double > theSigmaT0PerWire
unsigned int rejectDigiFromPeak
std::map< std::string, double > theSigmaT0LayerMap
~DTT0Calibration() override
Destructor.
std::string theCalibSector
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, int > nDigiPerWire
std::map< DTWireId, double > mK
std::map< DTWireId, int > nDigiPerWire_ref
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
std::map< DTWireId, double > theRelativeT0PerWire
std::map< DTWireId, double > qK
std::map< DTChamberId, double > theSumT0ByChamber
std::map< DTChamberId, double > theSigmaT0ByChamber
std::map< DTWireId, TH1I > theHistoWireMap
DTT0Calibration(const edm::ParameterSet &pset)
Constructor.
TSpectrum spectrum
unsigned int eventsForWireT0