CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CSCPedestalsDBConditions Class Reference

#include <CSCPedestalsDBConditions.h>

Inheritance diagram for CSCPedestalsDBConditions:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

typedef const CSCDBPedestalsReturnType
 
- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey, boost::shared_ptr
< DataProxy > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 

Public Member Functions

 CSCPedestalsDBConditions (const edm::ParameterSet &)
 
ReturnType produceDBPedestals (const CSCDBPedestalsRcd &)
 
 ~CSCPedestalsDBConditions ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider ()
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const
eventsetup::ComponentDescription
descriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set
< eventsetup::EventSetupRecordKey
findingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder ()
 

Static Public Member Functions

static CSCDBPedestalsprefillDBPedestals ()
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
 

Private Attributes

CSCDBPedestalscndbPedestals
 

Additional Inherited Members

- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Detailed Description

Definition at line 20 of file CSCPedestalsDBConditions.h.

Member Typedef Documentation

Definition at line 27 of file CSCPedestalsDBConditions.h.

Constructor & Destructor Documentation

CSCPedestalsDBConditions::CSCPedestalsDBConditions ( const edm::ParameterSet iConfig)

Definition at line 10 of file CSCPedestalsDBConditions.cc.

References cndbPedestals, prefillDBPedestals(), produceDBPedestals(), and edm::ESProducer::setWhatProduced().

11 {
12  //the following line is needed to tell the framework what
13  // data is being produced
15  // added by Zhen (changed since 1_2_0)
17  findingRecord<CSCDBPedestalsRcd>();
18  //now do what ever other initialization is needed
19 }
ReturnType produceDBPedestals(const CSCDBPedestalsRcd &)
static CSCDBPedestals * prefillDBPedestals()
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
CSCPedestalsDBConditions::~CSCPedestalsDBConditions ( )

Definition at line 22 of file CSCPedestalsDBConditions.cc.

References cndbPedestals.

23 {
24 
25  // do anything here that needs to be done at desctruction time
26  // (e.g. close files, deallocate resources etc.)
27  delete cndbPedestals;
28 }

Member Function Documentation

CSCDBPedestals * CSCPedestalsDBConditions::prefillDBPedestals ( )
inlinestatic

Definition at line 47 of file CSCPedestalsDBConditions.h.

References ecal_dqm_sourceclient-live_cfg::cerr, counter, cmsRelvalreport::exit, CSCDBPedestals::factor_ped, CSCDBPedestals::factor_rms, i, recoMuon::in, relval_steps::k, and CSCDBPedestals::pedestals.

Referenced by CSCPedestalsDBConditions().

48 {
49  const int PED_FACTOR=10;
50  const int RMS_FACTOR=1000;
51  const int MAX_SIZE = 252288;
52  //const int MAX_SIZE = 273024; //for extra ME1a unganged case
53  const int MAX_SHORT= 32767;
54  CSCDBPedestals * cndbpedestals = new CSCDBPedestals();
55 
56  int db_index;
57  float db_ped, db_rms;
58  std::vector<int> db_index_id;
59  std::vector<float> db_peds;
60  std::vector<float> db_pedrms;
61  int new_index;
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;
66 
67  int counter;
68  int db_nrlines=0;
69  int new_nrlines=0;
70 
71  std::ifstream dbdata;
72  dbdata.open("old_dbpeds.dat",std::ios::in);
73  if(!dbdata) {
74  std::cerr <<"Error: old_dbpeds.dat -> no such file!"<< std::endl;
75  exit(1);
76  }
77 
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);
83  db_nrlines++;
84  }
85  dbdata.close();
86 
87  std::ifstream newdata;
88  newdata.open("peds.dat",std::ios::in);
89  if(!newdata) {
90  std::cerr <<"Error: peds.dat -> no such file!"<< std::endl;
91  exit(1);
92  }
93 
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);
99  new_nrlines++;
100  }
101  newdata.close();
102 
103  CSCDBPedestals::PedestalContainer & itemvector = cndbpedestals->pedestals;
104  itemvector.resize(MAX_SIZE);
105  cndbpedestals->factor_ped= int (PED_FACTOR);
106  cndbpedestals->factor_rms= int (RMS_FACTOR);
107 
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);
111  }
112 
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]);
118 
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];
124  //if (new_peds[k]==0) itemvector[counter].ped = int (db_peds[i]);
125  //if (new_pedrms[k]==0) itemvector[counter].rms = int (db_pedrms[i]);
126  }
127  }
128 
129  if (counter>223968){
130  itemvector[counter].ped = int (db_peds[i]);
131  itemvector[counter].rms = int (db_pedrms[i]);
132  itemvector[i] = itemvector[counter];
133  }
134 
135  }
136  return cndbpedestals;
137 }
int i
Definition: DBlmapReader.cc:9
std::vector< Item > PedestalContainer
PedestalContainer pedestals
static std::atomic< unsigned int > counter
CSCPedestalsDBConditions::ReturnType CSCPedestalsDBConditions::produceDBPedestals ( const CSCDBPedestalsRcd iRecord)

Definition at line 37 of file CSCPedestalsDBConditions.cc.

References cndbPedestals.

Referenced by CSCPedestalsDBConditions().

38 {
39  //need a new object so to not be deleted at exit
41  return mydata;
42 
43 }
void CSCPedestalsDBConditions::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue ,
edm::ValidityInterval oValidity 
)
privatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 45 of file CSCPedestalsDBConditions.cc.

References edm::IOVSyncValue::beginOfTime(), and edm::IOVSyncValue::endOfTime().

47  {
49 
50  }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
static const IOVSyncValue & beginOfTime()

Member Data Documentation

CSCDBPedestals* CSCPedestalsDBConditions::cndbPedestals
private