CMS 3D CMS Logo

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::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Public Types

typedef std::unique_ptr< CSCDBPedestalsReturnType
 

Public Member Functions

 CSCPedestalsDBConditions (const edm::ParameterSet &)
 
ReturnType produceDBPedestals (const CSCDBPedestalsRcd &)
 
 ~CSCPedestalsDBConditions () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const EventSetupRecordIntervalFinderoperator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

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

Private Attributes

CSCDBPedestalscndbPedestals
 

Additional Inherited Members

- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- Protected Member Functions inherited from edm::ESProducer
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProductResolverFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- 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

◆ ReturnType

Definition at line 27 of file CSCPedestalsDBConditions.h.

Constructor & Destructor Documentation

◆ CSCPedestalsDBConditions()

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

Definition at line 8 of file CSCPedestalsDBConditions.cc.

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

8  {
9  // the following line is needed to tell the framework what
10  // data is being produced
11  // added by Zhen (changed since 1_2_0)
13  findingRecord<CSCDBPedestalsRcd>();
14  // now do what ever other initialization is needed
15 }
ReturnType produceDBPedestals(const CSCDBPedestalsRcd &)
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166

◆ ~CSCPedestalsDBConditions()

CSCPedestalsDBConditions::~CSCPedestalsDBConditions ( )
override

Definition at line 17 of file CSCPedestalsDBConditions.cc.

17  {
18  // do anything here that needs to be done at desctruction time
19  // (e.g. close files, deallocate resources etc.)
20 }

Member Function Documentation

◆ prefillDBPedestals()

CSCDBPedestals * CSCPedestalsDBConditions::prefillDBPedestals ( )
inlinestatic

Definition at line 48 of file CSCPedestalsDBConditions.h.

References DMR_cfg::cerr, counter, beamvalidation::exit(), CSCDBPedestals::factor_ped, CSCDBPedestals::factor_rms, mps_fire::i, recoMuon::in, createfilelist::int, dqmdumpme::k, pixelgpudetails::MAX_SIZE, and CSCDBPedestals::pedestals.

Referenced by produceDBPedestals().

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 
69  std::ifstream dbdata;
70  dbdata.open("old_dbpeds.dat", std::ios::in);
71  if (!dbdata) {
72  std::cerr << "Error: old_dbpeds.dat -> no such file!" << std::endl;
73  exit(1);
74  }
75 
76  while (!dbdata.eof()) {
77  dbdata >> db_index >> db_ped >> db_rms;
78  db_index_id.push_back(db_index);
79  db_peds.push_back(db_ped);
80  db_pedrms.push_back(db_rms);
81  }
82  dbdata.close();
83 
84  std::ifstream newdata;
85  newdata.open("peds.dat", std::ios::in);
86  if (!newdata) {
87  std::cerr << "Error: peds.dat -> no such file!" << std::endl;
88  exit(1);
89  }
90 
91  while (!newdata.eof()) {
92  newdata >> new_index >> new_ped >> new_rms;
93  new_index_id.push_back(new_index);
94  new_peds.push_back(new_ped);
95  new_pedrms.push_back(new_rms);
96  }
97  newdata.close();
98 
99  CSCDBPedestals::PedestalContainer &itemvector = cndbpedestals->pedestals;
100  itemvector.resize(MAX_SIZE);
101  cndbpedestals->factor_ped = int(PED_FACTOR);
102  cndbpedestals->factor_rms = int(RMS_FACTOR);
103 
104  for (int i = 0; i < MAX_SIZE; ++i) {
105  itemvector[i].ped = (short int)(db_peds[i] * PED_FACTOR + 0.5);
106  itemvector[i].rms = (short int)(db_pedrms[i] * RMS_FACTOR + 0.5);
107  }
108 
109  for (int i = 0; i < MAX_SIZE; ++i) {
110  counter = db_index_id[i];
111  itemvector[i] = itemvector[counter];
112  itemvector[i].ped = int(db_peds[i]);
113  itemvector[i].rms = int(db_pedrms[i]);
114 
115  for (unsigned int k = 0; k < new_index_id.size() - 1; k++) {
116  if (counter == new_index_id[k]) {
117  if ((short int)(fabs(new_peds[k] * PED_FACTOR + 0.5)) < MAX_SHORT)
118  itemvector[counter].ped = int(new_peds[k] * PED_FACTOR + 0.5);
119  if ((short int)(fabs(new_pedrms[k] * RMS_FACTOR + 0.5)) < MAX_SHORT)
120  itemvector[counter].rms = int(new_pedrms[k] * RMS_FACTOR + 0.5);
121  itemvector[i] = itemvector[counter];
122  // if (new_peds[k]==0) itemvector[counter].ped = int (db_peds[i]);
123  // if (new_pedrms[k]==0) itemvector[counter].rms = int (db_pedrms[i]);
124  }
125  }
126 
127  if (counter > 223968) {
128  itemvector[counter].ped = int(db_peds[i]);
129  itemvector[counter].rms = int(db_pedrms[i]);
130  itemvector[i] = itemvector[counter];
131  }
132  }
133  return cndbpedestals;
134 }
std::vector< Item > PedestalContainer
PedestalContainer pedestals
static std::atomic< unsigned int > counter
constexpr unsigned int MAX_SIZE
def exit(msg="")

◆ produceDBPedestals()

CSCPedestalsDBConditions::ReturnType CSCPedestalsDBConditions::produceDBPedestals ( const CSCDBPedestalsRcd iRecord)

Definition at line 27 of file CSCPedestalsDBConditions.cc.

References prefillDBPedestals().

Referenced by CSCPedestalsDBConditions().

27  {
28  // need a new object so to not be deleted at exit
30 }
std::unique_ptr< CSCDBPedestals > ReturnType
static CSCDBPedestals * prefillDBPedestals()

◆ setIntervalFor()

void CSCPedestalsDBConditions::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue ,
edm::ValidityInterval oValidity 
)
overrideprivatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 32 of file CSCPedestalsDBConditions.cc.

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

34  {
36 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88

Member Data Documentation

◆ cndbPedestals

CSCDBPedestals* CSCPedestalsDBConditions::cndbPedestals
private

Definition at line 36 of file CSCPedestalsDBConditions.h.