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::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

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
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () 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::DataProxyProvider
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::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &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 TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
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::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
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.

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 }

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

◆ ~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.

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  int db_nrlines = 0;
88  int new_nrlines = 0;
89 
90  std::ifstream dbdata;
91  dbdata.open("old_dbmatrix.dat", std::ios::in);
92  if (!dbdata) {
93  std::cerr << "Error: old_dbmatrix.dat -> no such file!" << std::endl;
94  exit(1);
95  }
96 
97  while (!dbdata.eof()) {
98  dbdata >> db_index >> db_elm33 >> db_elm34 >> db_elm44 >> db_elm35 >> db_elm45 >> db_elm55 >> db_elm46 >>
99  db_elm56 >> db_elm66 >> db_elm57 >> db_elm67 >> db_elm77;
100  db_index_id.push_back(db_index);
101  db_elem33.push_back(db_elm33);
102  db_elem34.push_back(db_elm34);
103  db_elem35.push_back(db_elm35);
104  db_elem44.push_back(db_elm44);
105  db_elem45.push_back(db_elm45);
106  db_elem46.push_back(db_elm46);
107  db_elem55.push_back(db_elm55);
108  db_elem56.push_back(db_elm56);
109  db_elem57.push_back(db_elm57);
110  db_elem66.push_back(db_elm66);
111  db_elem67.push_back(db_elm67);
112  db_elem77.push_back(db_elm77);
113  db_nrlines++;
114  }
115  dbdata.close();
116 
117  std::ifstream newdata;
118  newdata.open("matrix.dat", std::ios::in);
119  if (!newdata) {
120  std::cerr << "Error: matrix.dat -> no such file!" << std::endl;
121  exit(1);
122  }
123 
124  while (!newdata.eof()) {
125  newdata >> new_index >> new_elm33 >> new_elm34 >> new_elm44 >> new_elm35 >> new_elm45 >> new_elm55 >> new_elm46 >>
126  new_elm56 >> new_elm66 >> new_elm57 >> new_elm67 >> new_elm77;
127  // new_cham_id.push_back(new_chamber_id);
128  new_index_id.push_back(new_index);
129  new_elem33.push_back(new_elm33);
130  new_elem34.push_back(new_elm34);
131  new_elem35.push_back(new_elm35);
132  new_elem44.push_back(new_elm44);
133  new_elem45.push_back(new_elm45);
134  new_elem46.push_back(new_elm46);
135  new_elem55.push_back(new_elm55);
136  new_elem56.push_back(new_elm56);
137  new_elem57.push_back(new_elm57);
138  new_elem66.push_back(new_elm66);
139  new_elem67.push_back(new_elm67);
140  new_elem77.push_back(new_elm77);
141  new_nrlines++;
142  }
143  newdata.close();
144 
145  CSCDBNoiseMatrix::NoiseMatrixContainer &itemvector = cndbmatrix->matrix;
146  itemvector.resize(MAX_SIZE);
147  cndbmatrix->factor_noise = int(FACTOR);
148 
149  for (int i = 0; i < MAX_SIZE; ++i) {
150  itemvector[i].elem33 = (short int)(db_elem33[i] * FACTOR + 0.5);
151  itemvector[i].elem34 = (short int)(db_elem34[i] * FACTOR + 0.5);
152  itemvector[i].elem35 = (short int)(db_elem35[i] * FACTOR + 0.5);
153  itemvector[i].elem44 = (short int)(db_elem44[i] * FACTOR + 0.5);
154  itemvector[i].elem45 = (short int)(db_elem45[i] * FACTOR + 0.5);
155  itemvector[i].elem46 = (short int)(db_elem46[i] * FACTOR + 0.5);
156  itemvector[i].elem55 = (short int)(db_elem55[i] * FACTOR + 0.5);
157  itemvector[i].elem56 = (short int)(db_elem56[i] * FACTOR + 0.5);
158  itemvector[i].elem57 = (short int)(db_elem57[i] * FACTOR + 0.5);
159  itemvector[i].elem66 = (short int)(db_elem66[i] * FACTOR + 0.5);
160  itemvector[i].elem67 = (short int)(db_elem67[i] * FACTOR + 0.5);
161  itemvector[i].elem77 = (short int)(db_elem77[i] * FACTOR + 0.5);
162  }
163 
164  for (int i = 0; i < MAX_SIZE; ++i) {
165  counter = db_index_id[i];
166  itemvector[i] = itemvector[counter];
167  itemvector[i].elem33 = int(db_elem33[i]);
168  itemvector[i].elem34 = int(db_elem34[i]);
169  itemvector[i].elem35 = int(db_elem35[i]);
170  itemvector[i].elem44 = int(db_elem44[i]);
171  itemvector[i].elem45 = int(db_elem45[i]);
172  itemvector[i].elem46 = int(db_elem46[i]);
173  itemvector[i].elem55 = int(db_elem55[i]);
174  itemvector[i].elem56 = int(db_elem56[i]);
175  itemvector[i].elem57 = int(db_elem57[i]);
176  itemvector[i].elem66 = int(db_elem66[i]);
177  itemvector[i].elem67 = int(db_elem67[i]);
178  itemvector[i].elem77 = int(db_elem77[i]);
179 
180  for (unsigned int k = 0; k < new_index_id.size() - 1; k++) {
181  if (counter == new_index_id[k]) {
182  if ((short int)(fabs(new_elem33[k] * FACTOR + 0.5)) < MAX_SHORT)
183  itemvector[counter].elem33 = int(new_elem33[k] * FACTOR + 0.5);
184  if ((short int)(fabs(new_elem34[k] * FACTOR + 0.5)) < MAX_SHORT)
185  itemvector[counter].elem34 = int(new_elem34[k] * FACTOR + 0.5);
186  if ((short int)(fabs(new_elem35[k] * FACTOR + 0.5)) < MAX_SHORT)
187  itemvector[counter].elem35 = int(new_elem35[k] * FACTOR + 0.5);
188  if ((short int)(fabs(new_elem44[k] * FACTOR + 0.5)) < MAX_SHORT)
189  itemvector[counter].elem44 = int(new_elem44[k] * FACTOR + 0.5);
190  if ((short int)(fabs(new_elem45[k] * FACTOR + 0.5)) < MAX_SHORT)
191  itemvector[counter].elem45 = int(new_elem45[k] * FACTOR + 0.5);
192  if ((short int)(fabs(new_elem46[k] * FACTOR + 0.5)) < MAX_SHORT)
193  itemvector[counter].elem46 = int(new_elem46[k] * FACTOR + 0.5);
194  if ((short int)(fabs(new_elem55[k] * FACTOR + 0.5)) < MAX_SHORT)
195  itemvector[counter].elem55 = int(new_elem55[k] * FACTOR + 0.5);
196  if ((short int)(fabs(new_elem56[k] * FACTOR + 0.5)) < MAX_SHORT)
197  itemvector[counter].elem56 = int(new_elem56[k] * FACTOR + 0.5);
198  if ((short int)(fabs(new_elem57[k] * FACTOR + 0.5)) < MAX_SHORT)
199  itemvector[counter].elem57 = int(new_elem57[k] * FACTOR + 0.5);
200  if ((short int)(fabs(new_elem66[k] * FACTOR + 0.5)) < MAX_SHORT)
201  itemvector[counter].elem66 = int(new_elem66[k] * FACTOR + 0.5);
202  if ((short int)(fabs(new_elem67[k] * FACTOR + 0.5)) < MAX_SHORT)
203  itemvector[counter].elem67 = int(new_elem67[k] * FACTOR + 0.5);
204  if ((short int)(fabs(new_elem77[k] * FACTOR + 0.5)) < MAX_SHORT)
205  itemvector[counter].elem77 = int(new_elem77[k] * FACTOR + 0.5);
206  itemvector[i] = itemvector[counter];
207  }
208  }
209 
210  if (counter > 223968) {
211  itemvector[counter].elem33 = int(db_elem33[i]);
212  itemvector[counter].elem34 = int(db_elem34[i]);
213  itemvector[counter].elem35 = int(db_elem35[i]);
214  itemvector[counter].elem44 = int(db_elem44[i]);
215  itemvector[counter].elem45 = int(db_elem45[i]);
216  itemvector[counter].elem46 = int(db_elem46[i]);
217  itemvector[counter].elem55 = int(db_elem55[i]);
218  itemvector[counter].elem56 = int(db_elem56[i]);
219  itemvector[counter].elem57 = int(db_elem57[i]);
220  itemvector[counter].elem66 = int(db_elem66[i]);
221  itemvector[counter].elem67 = int(db_elem67[i]);
222  itemvector[counter].elem77 = int(db_elem77[i]);
223  itemvector[i] = itemvector[counter];
224  }
225  }
226 
227  return cndbmatrix;
228 }

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

Referenced by produceDBNoiseMatrix().

◆ produceDBNoiseMatrix()

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

Definition at line 27 of file CSCNoiseMatrixDBConditions.cc.

28  {
29  // need a new object so to not be deleted at exit
31 }

References prefillDBNoiseMatrix().

Referenced by CSCNoiseMatrixDBConditions().

◆ setIntervalFor()

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

Member Data Documentation

◆ cndbMatrix

CSCDBNoiseMatrix* CSCNoiseMatrixDBConditions::cndbMatrix
private

Definition at line 36 of file CSCNoiseMatrixDBConditions.h.

counter
Definition: counter.py:1
mps_fire.i
i
Definition: mps_fire.py:428
CSCDBNoiseMatrix::factor_noise
int factor_noise
Definition: CSCDBNoiseMatrix.h:19
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
CSCNoiseMatrixDBConditions::produceDBNoiseMatrix
ReturnType produceDBNoiseMatrix(const CSCDBNoiseMatrixRcd &)
Definition: CSCNoiseMatrixDBConditions.cc:27
CSCDBNoiseMatrix::matrix
NoiseMatrixContainer matrix
Definition: CSCDBNoiseMatrix.h:24
pixelgpudetails::MAX_SIZE
constexpr unsigned int MAX_SIZE
Definition: SiPixelROCsStatusAndMapping.h:10
dqmdumpme.k
k
Definition: dqmdumpme.py:60
CSCNoiseMatrixDBConditions::ReturnType
std::unique_ptr< CSCDBNoiseMatrix > ReturnType
Definition: CSCNoiseMatrixDBConditions.h:27
CSCDBNoiseMatrix::NoiseMatrixContainer
std::vector< Item > NoiseMatrixContainer
Definition: CSCDBNoiseMatrix.h:23
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
recoMuon::in
Definition: RecoMuonEnumerators.h:6
CSCDBNoiseMatrix
Definition: CSCDBNoiseMatrix.h:9
createfilelist.int
int
Definition: createfilelist.py:10
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:18
CSCNoiseMatrixDBConditions::prefillDBNoiseMatrix
static CSCDBNoiseMatrix * prefillDBNoiseMatrix()
Definition: CSCNoiseMatrixDBConditions.h:44
cond::ValidityInterval
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8