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
EcalDccWeightBuilder::ecalElectronicsMap_
const EcalElectronicsMapping * ecalElectronicsMap_
Definition: EcalDccWeightBuilder.h:132
EcalDccWeightBuilder::writeToAsciiFile_
bool writeToAsciiFile_
Definition: EcalDccWeightBuilder.h:114
EcalElectronicsMapping
Definition: EcalElectronicsMapping.h:28
EcalDccWeightBuilder
Definition: EcalDccWeightBuilder.h:26
EcalDccWeightBuilder::inputWeights_
std::vector< double > inputWeights_
Definition: EcalDccWeightBuilder.h:109
ESHandle.h
EcalDccWeightBuilder::unbiasWeights
void unbiasWeights(std::vector< double > &weights, std::vector< int32_t > *encodedWeigths)
Definition: EcalDccWeightBuilder.cc:283
EcalIntercalibConstants.h
EcalDccWeightBuilder::writeToRootFile_
bool writeToRootFile_
Definition: EcalDccWeightBuilder.h:115
EcalDccWeightBuilder::computeWeights
void computeWeights(const EcalShapeBase &shape, int binOfMax, double timePhase, int iFirst0, int nWeights, int iSkip0, std::vector< double > &result)
Definition: EcalDccWeightBuilder.cc:207
EcalDccWeightBuilder::mode_t
mode_t
Definition: EcalDccWeightBuilder.h:28
EBDetId.h
EEDetId.h
EcalDccWeightBuilder::sampleToSkip_
int sampleToSkip_
Definition: EcalDccWeightBuilder.h:105
EcalDccWeightBuilder::ecalDccFedIdMin
static const int ecalDccFedIdMin
Definition: EcalDccWeightBuilder.h:134
EcalDccWeightBuilder::dcc1stSample_
int dcc1stSample_
Definition: EcalDccWeightBuilder.h:104
EcalDccWeightBuilder::writeWeightToAsciiFile
void writeWeightToAsciiFile()
Definition: EcalDccWeightBuilder.cc:376
EcalDccWeightBuilder::mode_
std::string mode_
Definition: EcalDccWeightBuilder.h:110
EcalDccWeightBuilder::calibMap_
EcalIntercalibConstantMap & calibMap_
Definition: EcalDccWeightBuilder.h:127
EDAnalyzer.h
EcalDccWeightBuilder::weightScale_
static const double weightScale_
Definition: EcalDccWeightBuilder.h:131
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
EcalDccWeightBuilder::writeWeightToDB
void writeWeightToDB()
Definition: EcalDccWeightBuilder.cc:513
EcalDccWeightBuilder::~EcalDccWeightBuilder
~EcalDccWeightBuilder() override
Definition: EcalDccWeightBuilder.h:39
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
EcalDccWeightBuilder::dccWeightsWithIntercalib_
bool dccWeightsWithIntercalib_
Definition: EcalDccWeightBuilder.h:112
EBShape.h
EcalDccWeightBuilder::dbId
void dbId(const DetId &detId, int &fedId, int &smId, int &ruId, int &xtalId) const
Definition: EcalDccWeightBuilder.cc:605
EcalDccWeightBuilder::asciiOutputFileName_
std::string asciiOutputFileName_
Definition: EcalDccWeightBuilder.h:116
EcalDccWeightBuilder::encodedWeights_
std::map< DetId, std::vector< int > > encodedWeights_
Definition: EcalDccWeightBuilder.h:129
EEShape.h
DetId
Definition: DetId.h:17
alignCSCRings.s
s
Definition: alignCSCRings.py:92
EcalDccWeightBuilder::sqlMode_
bool sqlMode_
Definition: EcalDccWeightBuilder.h:123
EcalDccWeightBuilder::decodeWeight
double decodeWeight(int W)
Definition: EcalDccWeightBuilder.cc:244
EcalShapeBase
Definition: EcalShapeBase.h:24
w
const double w
Definition: UKUtility.cc:23
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99166
EcalDccWeightBuilder::intercalib
double intercalib(const DetId &detId)
Definition: EcalDccWeightBuilder.cc:351
edm::ESHandle< CaloGeometry >
EcalDccWeightBuilder::dbTag_
std::string dbTag_
Definition: EcalDccWeightBuilder.h:121
EcalDccWeightBuilder::geom_
edm::ESHandle< CaloGeometry > geom_
Definition: EcalDccWeightBuilder.h:125
EcalDccWeightBuilder::writeToDB_
bool writeToDB_
Definition: EcalDccWeightBuilder.h:113
EcalDccWeightBuilder::rootOutputFileName_
std::string rootOutputFileName_
Definition: EcalDccWeightBuilder.h:117
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
EcalDccWeightBuilder::writeWeightToRootFile
void writeWeightToRootFile()
Definition: EcalDccWeightBuilder.cc:460
a
double a
Definition: hdecay.h:119
EcalDccWeightBuilder::sort
void sort(const std::vector< T > &a, std::vector< int > &s, bool decreasingOrder=false)
Definition: EcalDccWeightBuilder.cc:247
ecalSimParameterMap_cff.timePhase
timePhase
Definition: ecalSimParameterMap_cff.py:8
EcalDccWeightBuilder::nDccWeights_
int nDccWeights_
Definition: EcalDccWeightBuilder.h:106
EcalDccWeightBuilder::dbUser_
std::string dbUser_
Definition: EcalDccWeightBuilder.h:119
edm::EventSetup
Definition: EventSetup.h:58
EcalDccWeightBuilder::ecalDccFedIdMax
static const int ecalDccFedIdMax
Definition: EcalDccWeightBuilder.h:135
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
EcalDccWeightBuilder::COMPUTE_WEIGHTS
Definition: EcalDccWeightBuilder.h:28
EcalDccWeightBuilder::WEIGHTS_FROM_CONFIG
Definition: EcalDccWeightBuilder.h:28
EcalDccWeightBuilder::encodeWeight
int encodeWeight(double w)
Definition: EcalDccWeightBuilder.cc:242
CaloGeometry.h
EcalDccWeightBuilder::dbPassword_
std::string dbPassword_
Definition: EcalDccWeightBuilder.h:120
EcalDccWeightBuilder::imode_
mode_t imode_
Definition: EcalDccWeightBuilder.h:111
EcalDccWeightBuilder::EcalDccWeightBuilder
EcalDccWeightBuilder(edm::ParameterSet const &ps)
Definition: EcalDccWeightBuilder.cc:44
EcalDccWeightBuilder::nDccs
static const int nDccs
Definition: EcalDccWeightBuilder.h:136
EventSetup.h
EcalDccWeightBuilder::emptyCalibMap_
EcalIntercalibConstantMap emptyCalibMap_
Definition: EcalDccWeightBuilder.h:128
EcalDccWeightBuilder::analyze
void analyze(const edm::Event &event, const edm::EventSetup &es) override
Definition: EcalDccWeightBuilder.cc:78
mps_fire.result
result
Definition: mps_fire.py:311
EcalDccWeightBuilder::computeAllWeights
void computeAllWeights(bool withIntercalib, const edm::EventSetup &es)
Definition: EcalDccWeightBuilder.cc:106
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
EcalDccWeightBuilder::dbSid_
std::string dbSid_
Definition: EcalDccWeightBuilder.h:118
EcalDccWeightBuilder::dbVersion_
int dbVersion_
Definition: EcalDccWeightBuilder.h:122