CMS 3D CMS Logo

EcalDccWeightBuilder.h
Go to the documentation of this file.
1 #ifndef CalibCalorimetry_EcalSRTools_EcalDccWeightBuilder_h
2 #define CalibCalorimetry_EcalSRTools_EcalDccWeightBuilder_h
3 
17 
18 #include <vector>
19 #include <map>
20 #include <cinttypes>
21 
22 // Forward declarations:
24 
28 private:
30 
31  //constructor(s) and destructor(s)
32 public:
37 
40  ~EcalDccWeightBuilder() override{};
41 
42  //method(s)
43 public:
48  void analyze(const edm::Event& event, const edm::EventSetup& es) override;
49 
50 private:
65  int binOfMax,
66  double timePhase,
67  int iFirst0,
68  int nWeights,
69  int iSkip0,
70  std::vector<double>& result);
71 
72  void computeAllWeights(bool withIntercalib, const edm::EventSetup& es);
73 
74  int encodeWeight(double w);
75 
76  double decodeWeight(int W);
77 
78  void unbiasWeights(std::vector<double>& weights, std::vector<int32_t>* encodedWeigths);
79 
84  double intercalib(const DetId& detId);
85 
87  void writeWeightToRootFile();
88  void writeWeightToDB();
89 
90  //converts DetId to IDs used by DB:
91  void dbId(const DetId& detId, int& fedId, int& smId, int& ruId, int& xtalId) const;
92 
99  template <class T>
100  void sort(const std::vector<T>& a, std::vector<int>& s, bool decreasingOrder = false);
101 
102  //attribute(s)
103 protected:
104 private:
110  std::vector<double> inputWeights_;
124  bool sqlMode_;
125 
129 
131 
134  std::map<DetId, std::vector<int> > encodedWeights_;
135 
138 
139  static const double weightScale_;
141 
142  static const int ecalDccFedIdMin = 601;
143  static const int ecalDccFedIdMax = 654;
144  static const int nDccs = ecalDccFedIdMax - ecalDccFedIdMin + 1;
145 };
146 
147 #endif //CalibCalorimetry_EcalSRTools_EcalDccWeightBuilder_h not defined
std::map< DetId, std::vector< int > > encodedWeights_
void analyze(const edm::Event &event, const edm::EventSetup &es) override
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
T w() const
double intercalib(const DetId &detId)
void dbId(const DetId &detId, int &fedId, int &smId, int &ruId, int &xtalId) const
std::vector< double > inputWeights_
edm::ESHandle< CaloGeometry > geom_
static const double weightScale_
const edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > intercalibConstToken_
void computeWeights(const EcalShapeBase &shape, int binOfMax, double timePhase, int iFirst0, int nWeights, int iSkip0, std::vector< double > &result)
void sort(const std::vector< T > &a, std::vector< int > &s, bool decreasingOrder=false)
EcalIntercalibConstantMap & calibMap_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
Definition: EBShape.h:7
Definition: DetId.h:17
EcalIntercalibConstantMap emptyCalibMap_
void unbiasWeights(std::vector< double > &weights, std::vector< int32_t > *encodedWeigths)
EcalDccWeightBuilder(edm::ParameterSet const &ps)
double a
Definition: hdecay.h:121
void computeAllWeights(bool withIntercalib, const edm::EventSetup &es)
static const int ecalDccFedIdMax
const EcalElectronicsMapping * ecalElectronicsMap_
static const int ecalDccFedIdMin
Definition: event.py:1
Definition: EEShape.h:7