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 
7 
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:
44 
49  void analyze(const edm::Event& event, const edm::EventSetup& es) override;
50 
51 private:
52 
66  void
67  computeWeights(const EcalShapeBase& shape,
68  int binOfMax, double timePhase,
69  int iFirst0, int nWeights, 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,
79  std::vector<int32_t>* encodedWeigths);
80 
85  double intercalib(const DetId& detId);
86 
88  void writeWeightToRootFile();
89  void writeWeightToDB();
90 
91  //converts DetId to IDs used by DB:
92  void dbId(const DetId& detId, int& fedId, int& smId, int& ruId,
93  int& xtalId) const;
94 
101  template<class T>
102  void sort(const std::vector<T>& a,
103  std::vector<int>& s,
104  bool decreasingOrder = false);
105 
106 
107  //attribute(s)
108 protected:
109 private:
115  std::vector<double> inputWeights_;
129  bool sqlMode_;
130 
132 
135  std::map<DetId, std::vector<int> > encodedWeights_;
136 
137  static const double weightScale_;
139 
140  static const int ecalDccFedIdMin = 601;
141  static const int ecalDccFedIdMax = 654;
142  static const int nDccs = ecalDccFedIdMax-ecalDccFedIdMin+1;
143 };
144 
145 #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