#include <CSCGainsDBConditions.h>
Public Types | |
typedef const CSCDBGains * | ReturnType |
Public Member Functions | |
CSCGainsDBConditions (const edm::ParameterSet &) | |
ReturnType | produceDBGains (const CSCDBGainsRcd &) |
~CSCGainsDBConditions () | |
Static Public Member Functions | |
static CSCDBGains * | prefillDBGains () |
Private Member Functions | |
void | setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) |
Private Attributes | |
CSCDBGains * | cndbGains |
Definition at line 20 of file CSCGainsDBConditions.h.
typedef const CSCDBGains* CSCGainsDBConditions::ReturnType |
Definition at line 28 of file CSCGainsDBConditions.h.
CSCGainsDBConditions::CSCGainsDBConditions | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 10 of file CSCGainsDBConditions.cc.
References cndbGains, prefillDBGains(), produceDBGains(), and edm::ESProducer::setWhatProduced().
{ //the following line is needed to tell the framework what // data is being produced cndbGains = prefillDBGains(); // added by Zhen (changed since 1_2_0) setWhatProduced(this,&CSCGainsDBConditions::produceDBGains); findingRecord<CSCDBGainsRcd>(); //now do what ever other initialization is needed }
CSCGainsDBConditions::~CSCGainsDBConditions | ( | ) |
Definition at line 22 of file CSCGainsDBConditions.cc.
References cndbGains.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) delete cndbGains; }
CSCDBGains * CSCGainsDBConditions::prefillDBGains | ( | ) | [inline, static] |
Definition at line 44 of file CSCGainsDBConditions.h.
References benchmark_cfg::cerr, gather_cfg::cout, cmsRelvalreport::exit, CSCDBGains::factor_gain, CSCDBGains::gains, i, recoMuon::in, and gen::k.
Referenced by CSCGainsDBConditions().
{ // const int MAX_SIZE = 273024;//for ME1a unganged const int MAX_SIZE = 252288; const int FACTOR = 1000; const int MAX_SHORT = 32767; CSCDBGains * cndbgains = new CSCDBGains(); int db_index; float db_gainslope;//db_intercpt, db_chisq; std::vector<int> db_index_id; std::vector<float> db_slope; std::vector<float> db_intercept; std::vector<float> db_chi2; int new_index; float new_gainslope,new_intercpt, new_chisq; std::vector<int> new_cham_id; std::vector<int> new_index_id; std::vector<int> new_strips; std::vector<float> new_slope; std::vector<float> new_intercept; std::vector<float> new_chi2; int counter; int db_nrlines=0; int new_nrlines=0; std::ifstream dbdata; dbdata.open("old_dbgains.dat",std::ios::in); if(!dbdata) { std::cerr <<"Error: old_dbgains.dat -> no such file!"<< std::endl; exit(1); } while (!dbdata.eof() ) { dbdata >> db_index >> db_gainslope; db_index_id.push_back(db_index); db_slope.push_back(db_gainslope); //db_intercept.push_back(db_intercpt); //db_chi2.push_back(db_chisq); db_nrlines++; } dbdata.close(); std::ifstream newdata; newdata.open("gains.dat",std::ios::in); if(!newdata) { std::cerr <<"Error: gains.dat -> no such file!"<< std::endl; exit(1); } while (!newdata.eof() ) { newdata >> new_index >> new_gainslope >> new_intercpt >> new_chisq ; new_index_id.push_back(new_index); new_slope.push_back(new_gainslope); new_intercept.push_back(new_intercpt); new_chi2.push_back(new_chisq); new_nrlines++; } newdata.close(); CSCDBGains::GainContainer & itemvector = cndbgains->gains; itemvector.resize(MAX_SIZE); cndbgains->factor_gain = (short int) (FACTOR); std::cout<<" myfactor "<<cndbgains->factor_gain<<std::endl; for(int i=0; i<MAX_SIZE;++i){ itemvector[i].gain_slope= int (db_slope[i]*FACTOR+0.5); } for(int i=0; i<MAX_SIZE;++i){ counter=db_index_id[i]; itemvector[i] = itemvector[counter]; itemvector[i].gain_slope = int (db_slope[i]); for (unsigned int k=0;k<new_index_id.size()-1;k++){ if(counter==new_index_id[k]){ if ((short int) (fabs(new_slope[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].gain_slope= int (new_slope[k]*FACTOR+0.5); itemvector[i] = itemvector[counter]; } } if(counter>223968){ itemvector[counter].gain_slope = int (db_slope[i]); itemvector[i] = itemvector[counter]; } } return cndbgains; }
CSCGainsDBConditions::ReturnType CSCGainsDBConditions::produceDBGains | ( | const CSCDBGainsRcd & | iRecord | ) |
Definition at line 37 of file CSCGainsDBConditions.cc.
References cndbGains.
Referenced by CSCGainsDBConditions().
{ //need a new object so to not be deleted at exit CSCDBGains* mydata=new CSCDBGains( *cndbGains ); return mydata; }
void CSCGainsDBConditions::setIntervalFor | ( | const edm::eventsetup::EventSetupRecordKey & | , |
const edm::IOVSyncValue & | , | ||
edm::ValidityInterval & | oValidity | ||
) | [private, virtual] |
Implements edm::EventSetupRecordIntervalFinder.
Definition at line 45 of file CSCGainsDBConditions.cc.
References edm::IOVSyncValue::beginOfTime(), and edm::IOVSyncValue::endOfTime().
{ oValidity = edm::ValidityInterval(edm::IOVSyncValue::beginOfTime(),edm::IOVSyncValue::endOfTime()); }
CSCDBGains* CSCGainsDBConditions::cndbGains [private] |
Definition at line 35 of file CSCGainsDBConditions.h.
Referenced by CSCGainsDBConditions(), produceDBGains(), and ~CSCGainsDBConditions().