1 #ifndef _CSCGAINSDBCONDITIONS_H
2 #define _CSCGAINSDBCONDITIONS_H
47 const int MAX_SIZE = 252288;
48 const int FACTOR = 1000;
49 const int MAX_SHORT = 32767;
54 std::vector<int> db_index_id;
55 std::vector<float> db_slope;
56 std::vector<float> db_intercept;
57 std::vector<float> db_chi2;
59 float new_gainslope,new_intercpt, new_chisq;
60 std::vector<int> new_cham_id;
61 std::vector<int> new_index_id;
62 std::vector<int> new_strips;
63 std::vector<float> new_slope;
64 std::vector<float> new_intercept;
65 std::vector<float> new_chi2;
74 std::cerr <<
"Error: old_dbgains.dat -> no such file!"<< std::endl;
78 while (!dbdata.eof() ) {
79 dbdata >> db_index >> db_gainslope;
80 db_index_id.push_back(db_index);
81 db_slope.push_back(db_gainslope);
88 std::ifstream newdata;
91 std::cerr <<
"Error: gains.dat -> no such file!"<< std::endl;
95 while (!newdata.eof() ) {
96 newdata >> new_index >> new_gainslope >> new_intercpt >> new_chisq ;
97 new_index_id.push_back(new_index);
98 new_slope.push_back(new_gainslope);
99 new_intercept.push_back(new_intercpt);
100 new_chi2.push_back(new_chisq);
106 itemvector.resize(MAX_SIZE);
110 for(
int i=0;
i<MAX_SIZE;++
i){
111 itemvector[
i].gain_slope= int (db_slope[
i]*FACTOR+0.5);
114 for(
int i=0;
i<MAX_SIZE;++
i){
115 counter=db_index_id[
i];
116 itemvector[
i] = itemvector[counter];
117 itemvector[
i].gain_slope = int (db_slope[
i]);
119 for (
unsigned int k=0;
k<new_index_id.size()-1;
k++){
120 if(counter==new_index_id[
k]){
121 if ((
short int) (fabs(new_slope[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].gain_slope= int (new_slope[k]*FACTOR+0.5);
122 itemvector[
i] = itemvector[counter];
126 itemvector[counter].gain_slope = int (db_slope[i]);
127 itemvector[
i] = itemvector[counter];
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
CSCGainsDBConditions(const edm::ParameterSet &)
const CSCDBGains * ReturnType
ReturnType produceDBGains(const CSCDBGainsRcd &)
static CSCDBGains * prefillDBGains()
std::vector< Item > GainContainer