CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CSCNoiseMatrixDBConditions Class Reference

#include <CSCNoiseMatrixDBConditions.h>

Inheritance diagram for CSCNoiseMatrixDBConditions:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Public Types

typedef std::unique_ptr< CSCDBNoiseMatrixReturnType
 

Public Member Functions

 CSCNoiseMatrixDBConditions (const edm::ParameterSet &)
 
ReturnType produceDBNoiseMatrix (const CSCDBNoiseMatrixRcd &)
 
 ~CSCNoiseMatrixDBConditions () 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 CSCDBNoiseMatrixprefillDBNoiseMatrix ()
 
- 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

CSCDBNoiseMatrixcndbMatrix
 

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 CSCNoiseMatrixDBConditions.h.

Member Typedef Documentation

◆ ReturnType

Definition at line 27 of file CSCNoiseMatrixDBConditions.h.

Constructor & Destructor Documentation

◆ CSCNoiseMatrixDBConditions()

CSCNoiseMatrixDBConditions::CSCNoiseMatrixDBConditions ( const edm::ParameterSet iConfig)

Definition at line 8 of file CSCNoiseMatrixDBConditions.cc.

References produceDBNoiseMatrix(), 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<CSCDBNoiseMatrixRcd>();
14  // now do what ever other initialization is needed
15 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
ReturnType produceDBNoiseMatrix(const CSCDBNoiseMatrixRcd &)

◆ ~CSCNoiseMatrixDBConditions()

CSCNoiseMatrixDBConditions::~CSCNoiseMatrixDBConditions ( )
override

Definition at line 17 of file CSCNoiseMatrixDBConditions.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

◆ prefillDBNoiseMatrix()

CSCDBNoiseMatrix * CSCNoiseMatrixDBConditions::prefillDBNoiseMatrix ( )
inlinestatic

Definition at line 44 of file CSCNoiseMatrixDBConditions.h.

References DMR_cfg::cerr, counter, beamvalidation::exit(), CSCDBNoiseMatrix::factor_noise, mps_fire::i, recoMuon::in, createfilelist::int, isotrackApplyRegressor::k, CSCDBNoiseMatrix::matrix, and pixelgpudetails::MAX_SIZE.

Referenced by produceDBNoiseMatrix().

44  {
45  // const int MAX_SIZE = 273024; //for ME1a unganged
46  const int MAX_SIZE = 252288;
47  const int FACTOR = 1000;
48  const int MAX_SHORT = 32767;
49 
50  int new_index, db_index;
51  float db_elm33, db_elm34, db_elm44, db_elm35, db_elm45, db_elm55;
52  float db_elm46, db_elm56, db_elm66, db_elm57, db_elm67, db_elm77;
53  std::vector<int> db_index_id;
54  std::vector<float> db_elem33;
55  std::vector<float> db_elem34;
56  std::vector<float> db_elem44;
57  std::vector<float> db_elem45;
58  std::vector<float> db_elem35;
59  std::vector<float> db_elem55;
60  std::vector<float> db_elem46;
61  std::vector<float> db_elem56;
62  std::vector<float> db_elem66;
63  std::vector<float> db_elem57;
64  std::vector<float> db_elem67;
65  std::vector<float> db_elem77;
66 
67  float new_elm33, new_elm34, new_elm44, new_elm35, new_elm45, new_elm55;
68  float new_elm46, new_elm56, new_elm66, new_elm57, new_elm67, new_elm77;
69  std::vector<int> new_cham_id;
70  std::vector<int> new_index_id;
71  std::vector<float> new_elem33;
72  std::vector<float> new_elem34;
73  std::vector<float> new_elem44;
74  std::vector<float> new_elem45;
75  std::vector<float> new_elem35;
76  std::vector<float> new_elem55;
77  std::vector<float> new_elem46;
78  std::vector<float> new_elem56;
79  std::vector<float> new_elem66;
80  std::vector<float> new_elem57;
81  std::vector<float> new_elem67;
82  std::vector<float> new_elem77;
83 
84  CSCDBNoiseMatrix *cndbmatrix = new CSCDBNoiseMatrix();
85 
86  int counter;
87 
88  std::ifstream dbdata;
89  dbdata.open("old_dbmatrix.dat", std::ios::in);
90  if (!dbdata) {
91  std::cerr << "Error: old_dbmatrix.dat -> no such file!" << std::endl;
92  exit(1);
93  }
94 
95  while (!dbdata.eof()) {
96  dbdata >> db_index >> db_elm33 >> db_elm34 >> db_elm44 >> db_elm35 >> db_elm45 >> db_elm55 >> db_elm46 >>
97  db_elm56 >> db_elm66 >> db_elm57 >> db_elm67 >> db_elm77;
98  db_index_id.push_back(db_index);
99  db_elem33.push_back(db_elm33);
100  db_elem34.push_back(db_elm34);
101  db_elem35.push_back(db_elm35);
102  db_elem44.push_back(db_elm44);
103  db_elem45.push_back(db_elm45);
104  db_elem46.push_back(db_elm46);
105  db_elem55.push_back(db_elm55);
106  db_elem56.push_back(db_elm56);
107  db_elem57.push_back(db_elm57);
108  db_elem66.push_back(db_elm66);
109  db_elem67.push_back(db_elm67);
110  db_elem77.push_back(db_elm77);
111  }
112  dbdata.close();
113 
114  std::ifstream newdata;
115  newdata.open("matrix.dat", std::ios::in);
116  if (!newdata) {
117  std::cerr << "Error: matrix.dat -> no such file!" << std::endl;
118  exit(1);
119  }
120 
121  while (!newdata.eof()) {
122  newdata >> new_index >> new_elm33 >> new_elm34 >> new_elm44 >> new_elm35 >> new_elm45 >> new_elm55 >> new_elm46 >>
123  new_elm56 >> new_elm66 >> new_elm57 >> new_elm67 >> new_elm77;
124  // new_cham_id.push_back(new_chamber_id);
125  new_index_id.push_back(new_index);
126  new_elem33.push_back(new_elm33);
127  new_elem34.push_back(new_elm34);
128  new_elem35.push_back(new_elm35);
129  new_elem44.push_back(new_elm44);
130  new_elem45.push_back(new_elm45);
131  new_elem46.push_back(new_elm46);
132  new_elem55.push_back(new_elm55);
133  new_elem56.push_back(new_elm56);
134  new_elem57.push_back(new_elm57);
135  new_elem66.push_back(new_elm66);
136  new_elem67.push_back(new_elm67);
137  new_elem77.push_back(new_elm77);
138  }
139  newdata.close();
140 
141  CSCDBNoiseMatrix::NoiseMatrixContainer &itemvector = cndbmatrix->matrix;
142  itemvector.resize(MAX_SIZE);
143  cndbmatrix->factor_noise = int(FACTOR);
144 
145  for (int i = 0; i < MAX_SIZE; ++i) {
146  itemvector[i].elem33 = (short int)(db_elem33[i] * FACTOR + 0.5);
147  itemvector[i].elem34 = (short int)(db_elem34[i] * FACTOR + 0.5);
148  itemvector[i].elem35 = (short int)(db_elem35[i] * FACTOR + 0.5);
149  itemvector[i].elem44 = (short int)(db_elem44[i] * FACTOR + 0.5);
150  itemvector[i].elem45 = (short int)(db_elem45[i] * FACTOR + 0.5);
151  itemvector[i].elem46 = (short int)(db_elem46[i] * FACTOR + 0.5);
152  itemvector[i].elem55 = (short int)(db_elem55[i] * FACTOR + 0.5);
153  itemvector[i].elem56 = (short int)(db_elem56[i] * FACTOR + 0.5);
154  itemvector[i].elem57 = (short int)(db_elem57[i] * FACTOR + 0.5);
155  itemvector[i].elem66 = (short int)(db_elem66[i] * FACTOR + 0.5);
156  itemvector[i].elem67 = (short int)(db_elem67[i] * FACTOR + 0.5);
157  itemvector[i].elem77 = (short int)(db_elem77[i] * FACTOR + 0.5);
158  }
159 
160  for (int i = 0; i < MAX_SIZE; ++i) {
161  counter = db_index_id[i];
162  itemvector[i] = itemvector[counter];
163  itemvector[i].elem33 = int(db_elem33[i]);
164  itemvector[i].elem34 = int(db_elem34[i]);
165  itemvector[i].elem35 = int(db_elem35[i]);
166  itemvector[i].elem44 = int(db_elem44[i]);
167  itemvector[i].elem45 = int(db_elem45[i]);
168  itemvector[i].elem46 = int(db_elem46[i]);
169  itemvector[i].elem55 = int(db_elem55[i]);
170  itemvector[i].elem56 = int(db_elem56[i]);
171  itemvector[i].elem57 = int(db_elem57[i]);
172  itemvector[i].elem66 = int(db_elem66[i]);
173  itemvector[i].elem67 = int(db_elem67[i]);
174  itemvector[i].elem77 = int(db_elem77[i]);
175 
176  for (unsigned int k = 0; k < new_index_id.size() - 1; k++) {
177  if (counter == new_index_id[k]) {
178  if ((short int)(fabs(new_elem33[k] * FACTOR + 0.5)) < MAX_SHORT)
179  itemvector[counter].elem33 = int(new_elem33[k] * FACTOR + 0.5);
180  if ((short int)(fabs(new_elem34[k] * FACTOR + 0.5)) < MAX_SHORT)
181  itemvector[counter].elem34 = int(new_elem34[k] * FACTOR + 0.5);
182  if ((short int)(fabs(new_elem35[k] * FACTOR + 0.5)) < MAX_SHORT)
183  itemvector[counter].elem35 = int(new_elem35[k] * FACTOR + 0.5);
184  if ((short int)(fabs(new_elem44[k] * FACTOR + 0.5)) < MAX_SHORT)
185  itemvector[counter].elem44 = int(new_elem44[k] * FACTOR + 0.5);
186  if ((short int)(fabs(new_elem45[k] * FACTOR + 0.5)) < MAX_SHORT)
187  itemvector[counter].elem45 = int(new_elem45[k] * FACTOR + 0.5);
188  if ((short int)(fabs(new_elem46[k] * FACTOR + 0.5)) < MAX_SHORT)
189  itemvector[counter].elem46 = int(new_elem46[k] * FACTOR + 0.5);
190  if ((short int)(fabs(new_elem55[k] * FACTOR + 0.5)) < MAX_SHORT)
191  itemvector[counter].elem55 = int(new_elem55[k] * FACTOR + 0.5);
192  if ((short int)(fabs(new_elem56[k] * FACTOR + 0.5)) < MAX_SHORT)
193  itemvector[counter].elem56 = int(new_elem56[k] * FACTOR + 0.5);
194  if ((short int)(fabs(new_elem57[k] * FACTOR + 0.5)) < MAX_SHORT)
195  itemvector[counter].elem57 = int(new_elem57[k] * FACTOR + 0.5);
196  if ((short int)(fabs(new_elem66[k] * FACTOR + 0.5)) < MAX_SHORT)
197  itemvector[counter].elem66 = int(new_elem66[k] * FACTOR + 0.5);
198  if ((short int)(fabs(new_elem67[k] * FACTOR + 0.5)) < MAX_SHORT)
199  itemvector[counter].elem67 = int(new_elem67[k] * FACTOR + 0.5);
200  if ((short int)(fabs(new_elem77[k] * FACTOR + 0.5)) < MAX_SHORT)
201  itemvector[counter].elem77 = int(new_elem77[k] * FACTOR + 0.5);
202  itemvector[i] = itemvector[counter];
203  }
204  }
205 
206  if (counter > 223968) {
207  itemvector[counter].elem33 = int(db_elem33[i]);
208  itemvector[counter].elem34 = int(db_elem34[i]);
209  itemvector[counter].elem35 = int(db_elem35[i]);
210  itemvector[counter].elem44 = int(db_elem44[i]);
211  itemvector[counter].elem45 = int(db_elem45[i]);
212  itemvector[counter].elem46 = int(db_elem46[i]);
213  itemvector[counter].elem55 = int(db_elem55[i]);
214  itemvector[counter].elem56 = int(db_elem56[i]);
215  itemvector[counter].elem57 = int(db_elem57[i]);
216  itemvector[counter].elem66 = int(db_elem66[i]);
217  itemvector[counter].elem67 = int(db_elem67[i]);
218  itemvector[counter].elem77 = int(db_elem77[i]);
219  itemvector[i] = itemvector[counter];
220  }
221  }
222 
223  return cndbmatrix;
224 }
std::vector< Item > NoiseMatrixContainer
static std::atomic< unsigned int > counter
constexpr unsigned int MAX_SIZE
NoiseMatrixContainer matrix
def exit(msg="")

◆ produceDBNoiseMatrix()

CSCNoiseMatrixDBConditions::ReturnType CSCNoiseMatrixDBConditions::produceDBNoiseMatrix ( const CSCDBNoiseMatrixRcd iRecord)

Definition at line 27 of file CSCNoiseMatrixDBConditions.cc.

References prefillDBNoiseMatrix().

Referenced by CSCNoiseMatrixDBConditions().

28  {
29  // need a new object so to not be deleted at exit
31 }
static CSCDBNoiseMatrix * prefillDBNoiseMatrix()
std::unique_ptr< CSCDBNoiseMatrix > ReturnType

◆ setIntervalFor()

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

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 33 of file CSCNoiseMatrixDBConditions.cc.

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

35  {
37 }
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

◆ cndbMatrix

CSCDBNoiseMatrix* CSCNoiseMatrixDBConditions::cndbMatrix
private

Definition at line 36 of file CSCNoiseMatrixDBConditions.h.