1 #ifndef _CSCPEDESTALSDBCONDITIONS_H
2 #define _CSCPEDESTALSDBCONDITIONS_H
49 const int PED_FACTOR=10;
50 const int RMS_FACTOR=1000;
51 const int MAX_SIZE = 252288;
53 const int MAX_SHORT= 32767;
58 std::vector<int> db_index_id;
59 std::vector<float> db_peds;
60 std::vector<float> db_pedrms;
62 float new_ped,new_rms;
63 std::vector<int> new_index_id;
64 std::vector<float> new_peds;
65 std::vector<float> new_pedrms;
74 std::cerr <<
"Error: old_dbpeds.dat -> no such file!"<< std::endl;
78 while (!dbdata.eof() ) {
79 dbdata >> db_index >> db_ped >> db_rms ;
80 db_index_id.push_back(db_index);
81 db_peds.push_back(db_ped);
82 db_pedrms.push_back(db_rms);
87 std::ifstream newdata;
90 std::cerr <<
"Error: peds.dat -> no such file!"<< std::endl;
94 while (!newdata.eof() ) {
95 newdata >> new_index >> new_ped >> new_rms ;
96 new_index_id.push_back(new_index);
97 new_peds.push_back(new_ped);
98 new_pedrms.push_back(new_rms);
104 itemvector.resize(MAX_SIZE);
108 for(
int i=0;
i<MAX_SIZE;++
i){
109 itemvector[
i].ped= (
short int) (db_peds[
i]*PED_FACTOR+0.5);
110 itemvector[
i].rms= (
short int) (db_pedrms[
i]*RMS_FACTOR+0.5);
113 for(
int i=0;
i<MAX_SIZE;++
i){
114 counter=db_index_id[
i];
115 itemvector[
i] = itemvector[
counter];
116 itemvector[
i].ped = int (db_peds[
i]);
117 itemvector[
i].rms = int (db_pedrms[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_peds[k]*PED_FACTOR+0.5))<MAX_SHORT) itemvector[
counter].ped= int (new_peds[k]*PED_FACTOR+0.5);
122 if((
short int) (fabs(new_pedrms[k]*RMS_FACTOR+0.5))<MAX_SHORT) itemvector[
counter].rms= int (new_pedrms[k]*RMS_FACTOR+0.5);
123 itemvector[
i] = itemvector[
counter];
130 itemvector[
counter].ped = int (db_peds[i]);
131 itemvector[
counter].rms = int (db_pedrms[i]);
132 itemvector[
i] = itemvector[
counter];
136 return cndbpedestals;
ReturnType produceDBPedestals(const CSCDBPedestalsRcd &)
const CSCDBPedestals * ReturnType
CSCDBPedestals * cndbPedestals
static CSCDBPedestals * prefillDBPedestals()
std::vector< Item > PedestalContainer
~CSCPedestalsDBConditions()
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
PedestalContainer pedestals
CSCPedestalsDBConditions(const edm::ParameterSet &)
static std::atomic< unsigned int > counter