1 #ifndef _CSCGAINSDBCONDITIONS_H 2 #define _CSCGAINSDBCONDITIONS_H 47 const int FACTOR = 1000;
48 const int MAX_SHORT = 32767;
53 std::vector<int> db_index_id;
54 std::vector<float> db_slope;
55 std::vector<float> db_intercept;
56 std::vector<float> db_chi2;
58 float new_gainslope, new_intercpt, new_chisq;
59 std::vector<int> new_cham_id;
60 std::vector<int> new_index_id;
61 std::vector<int> new_strips;
62 std::vector<float> new_slope;
63 std::vector<float> new_intercept;
64 std::vector<float> new_chi2;
71 std::cerr <<
"Error: old_dbgains.dat -> no such file!" << std::endl;
75 while (!dbdata.eof()) {
76 dbdata >> db_index >> db_gainslope;
77 db_index_id.push_back(db_index);
78 db_slope.push_back(db_gainslope);
84 std::ifstream newdata;
87 std::cerr <<
"Error: gains.dat -> no such file!" << std::endl;
91 while (!newdata.eof()) {
92 newdata >> new_index >> new_gainslope >> new_intercpt >> new_chisq;
93 new_index_id.push_back(new_index);
94 new_slope.push_back(new_gainslope);
95 new_intercept.push_back(new_intercpt);
96 new_chi2.push_back(new_chisq);
106 itemvector[
i].gain_slope =
int(db_slope[
i] * FACTOR + 0.5);
111 itemvector[
i] = itemvector[
counter];
112 itemvector[
i].gain_slope =
int(db_slope[
i]);
114 for (
unsigned int k = 0;
k < new_index_id.size() - 1;
k++) {
116 if ((
short int)(fabs(new_slope[
k] * FACTOR + 0.5)) < MAX_SHORT)
117 itemvector[
counter].gain_slope =
int(new_slope[
k] * FACTOR + 0.5);
118 itemvector[
i] = itemvector[
counter];
123 itemvector[
i] = itemvector[
counter];
CSCGainsDBConditions(const edm::ParameterSet &)
ReturnType produceDBGains(const CSCDBGainsRcd &)
static CSCDBGains * prefillDBGains()
std::vector< Item > GainContainer
~CSCGainsDBConditions() override
static std::atomic< unsigned int > counter
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
constexpr unsigned int MAX_SIZE
std::unique_ptr< CSCDBGains > ReturnType