#include <CSCPedestalsDBConditions.h>
Public Types | |
typedef const CSCDBPedestals * | ReturnType |
Public Member Functions | |
CSCPedestalsDBConditions (const edm::ParameterSet &) | |
ReturnType | produceDBPedestals (const CSCDBPedestalsRcd &) |
~CSCPedestalsDBConditions () | |
Static Public Member Functions | |
static CSCDBPedestals * | prefillDBPedestals () |
Private Member Functions | |
void | setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) |
Private Attributes | |
CSCDBPedestals * | cndbPedestals |
Definition at line 20 of file CSCPedestalsDBConditions.h.
typedef const CSCDBPedestals* CSCPedestalsDBConditions::ReturnType |
Definition at line 27 of file CSCPedestalsDBConditions.h.
CSCPedestalsDBConditions::CSCPedestalsDBConditions | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 10 of file CSCPedestalsDBConditions.cc.
References cndbPedestals, prefillDBPedestals(), produceDBPedestals(), and edm::ESProducer::setWhatProduced().
{ //the following line is needed to tell the framework what // data is being produced cndbPedestals = prefillDBPedestals(); // added by Zhen (changed since 1_2_0) setWhatProduced(this,&CSCPedestalsDBConditions::produceDBPedestals); findingRecord<CSCDBPedestalsRcd>(); //now do what ever other initialization is needed }
CSCPedestalsDBConditions::~CSCPedestalsDBConditions | ( | ) |
Definition at line 22 of file CSCPedestalsDBConditions.cc.
References cndbPedestals.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) delete cndbPedestals; }
CSCDBPedestals * CSCPedestalsDBConditions::prefillDBPedestals | ( | ) | [inline, static] |
Definition at line 47 of file CSCPedestalsDBConditions.h.
References dtNoiseDBValidation_cfg::cerr, cmsRelvalreport::exit, CSCDBPedestals::factor_ped, CSCDBPedestals::factor_rms, i, recoMuon::in, gen::k, and CSCDBPedestals::pedestals.
Referenced by CSCPedestalsDBConditions().
{ const int PED_FACTOR=10; const int RMS_FACTOR=1000; const int MAX_SIZE = 252288; //const int MAX_SIZE = 273024; //for extra ME1a unganged case const int MAX_SHORT= 32767; CSCDBPedestals * cndbpedestals = new CSCDBPedestals(); int db_index; float db_ped, db_rms; std::vector<int> db_index_id; std::vector<float> db_peds; std::vector<float> db_pedrms; int new_index; float new_ped,new_rms; std::vector<int> new_index_id; std::vector<float> new_peds; std::vector<float> new_pedrms; int counter; int db_nrlines=0; int new_nrlines=0; std::ifstream dbdata; dbdata.open("old_dbpeds.dat",std::ios::in); if(!dbdata) { std::cerr <<"Error: old_dbpeds.dat -> no such file!"<< std::endl; exit(1); } while (!dbdata.eof() ) { dbdata >> db_index >> db_ped >> db_rms ; db_index_id.push_back(db_index); db_peds.push_back(db_ped); db_pedrms.push_back(db_rms); db_nrlines++; } dbdata.close(); std::ifstream newdata; newdata.open("peds.dat",std::ios::in); if(!newdata) { std::cerr <<"Error: peds.dat -> no such file!"<< std::endl; exit(1); } while (!newdata.eof() ) { newdata >> new_index >> new_ped >> new_rms ; new_index_id.push_back(new_index); new_peds.push_back(new_ped); new_pedrms.push_back(new_rms); new_nrlines++; } newdata.close(); CSCDBPedestals::PedestalContainer & itemvector = cndbpedestals->pedestals; itemvector.resize(MAX_SIZE); cndbpedestals->factor_ped= int (PED_FACTOR); cndbpedestals->factor_rms= int (RMS_FACTOR); for(int i=0; i<MAX_SIZE;++i){ itemvector[i].ped= (short int) (db_peds[i]*PED_FACTOR+0.5); itemvector[i].rms= (short int) (db_pedrms[i]*RMS_FACTOR+0.5); } for(int i=0; i<MAX_SIZE;++i){ counter=db_index_id[i]; itemvector[i] = itemvector[counter]; itemvector[i].ped = int (db_peds[i]); itemvector[i].rms = int (db_pedrms[i]); for (unsigned int k=0;k<new_index_id.size()-1;k++){ if(counter==new_index_id[k]){ if((short int) (fabs(new_peds[k]*PED_FACTOR+0.5))<MAX_SHORT) itemvector[counter].ped= int (new_peds[k]*PED_FACTOR+0.5); if((short int) (fabs(new_pedrms[k]*RMS_FACTOR+0.5))<MAX_SHORT) itemvector[counter].rms= int (new_pedrms[k]*RMS_FACTOR+0.5); itemvector[i] = itemvector[counter]; //if (new_peds[k]==0) itemvector[counter].ped = int (db_peds[i]); //if (new_pedrms[k]==0) itemvector[counter].rms = int (db_pedrms[i]); } } if (counter>223968){ itemvector[counter].ped = int (db_peds[i]); itemvector[counter].rms = int (db_pedrms[i]); itemvector[i] = itemvector[counter]; } } return cndbpedestals; }
CSCPedestalsDBConditions::ReturnType CSCPedestalsDBConditions::produceDBPedestals | ( | const CSCDBPedestalsRcd & | iRecord | ) |
Definition at line 37 of file CSCPedestalsDBConditions.cc.
References cndbPedestals.
Referenced by CSCPedestalsDBConditions().
{ //need a new object so to not be deleted at exit CSCDBPedestals* mydata=new CSCDBPedestals( *cndbPedestals ); return mydata; }
void CSCPedestalsDBConditions::setIntervalFor | ( | const edm::eventsetup::EventSetupRecordKey & | , |
const edm::IOVSyncValue & | , | ||
edm::ValidityInterval & | oValidity | ||
) | [private, virtual] |
Implements edm::EventSetupRecordIntervalFinder.
Definition at line 45 of file CSCPedestalsDBConditions.cc.
References edm::IOVSyncValue::beginOfTime(), and edm::IOVSyncValue::endOfTime().
{ oValidity = edm::ValidityInterval(edm::IOVSyncValue::beginOfTime(),edm::IOVSyncValue::endOfTime()); }
Definition at line 34 of file CSCPedestalsDBConditions.h.
Referenced by CSCPedestalsDBConditions(), produceDBPedestals(), and ~CSCPedestalsDBConditions().