CMS 3D CMS Logo

EcalDccWeightBuilder.h
Go to the documentation of this file.
1 /*
2  */
3 
4 #ifndef ECALDCCWEIGHTBUILDER_CC
5 #define ECALDCCWEIGHTBUILDER_CC
6 
16 
17 #include <vector>
18 #include <map>
19 #include <cinttypes>
20 
21 // Forward declarations:
23 
27 private:
29 
30  //constructor(s) and destructor(s)
31 public:
36 
39  ~EcalDccWeightBuilder() override{};
40 
41  //method(s)
42 public:
47  void analyze(const edm::Event& event, const edm::EventSetup& es) override;
48 
49 private:
63  void computeWeights(const EcalShapeBase& shape,
64  int binOfMax,
65  double timePhase,
66  int iFirst0,
67  int nWeights,
68  int iSkip0,
69  std::vector<double>& result);
70 
71  void computeAllWeights(bool withIntercalib, const edm::EventSetup& es);
72 
73  int encodeWeight(double w);
74 
75  double decodeWeight(int W);
76 
77  void unbiasWeights(std::vector<double>& weights, std::vector<int32_t>* encodedWeigths);
78 
83  double intercalib(const DetId& detId);
84 
86  void writeWeightToRootFile();
87  void writeWeightToDB();
88 
89  //converts DetId to IDs used by DB:
90  void dbId(const DetId& detId, int& fedId, int& smId, int& ruId, int& xtalId) const;
91 
98  template <class T>
99  void sort(const std::vector<T>& a, std::vector<int>& s, bool decreasingOrder = false);
100 
101  //attribute(s)
102 protected:
103 private:
109  std::vector<double> inputWeights_;
123  bool sqlMode_;
124 
126 
129  std::map<DetId, std::vector<int> > encodedWeights_;
130 
131  static const double weightScale_;
133 
134  static const int ecalDccFedIdMin = 601;
135  static const int ecalDccFedIdMax = 654;
136  static const int nDccs = ecalDccFedIdMax - ecalDccFedIdMin + 1;
137 };
138 
139 #endif //ECALDCCWEIGHTBUILDER_CC not defined
const double w
Definition: UKUtility.cc:23
std::map< DetId, std::vector< int > > encodedWeights_
void analyze(const edm::Event &event, const edm::EventSetup &es) override
double intercalib(const DetId &detId)
std::vector< double > inputWeights_
edm::ESHandle< CaloGeometry > geom_
static const double weightScale_
void dbId(const DetId &detId, int &fedId, int &smId, int &ruId, int &xtalId) const
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_
Definition: DetId.h:18
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