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
CSCNoiseMatrixDBConditions Class Reference

#include <CSCNoiseMatrixDBConditions.h>

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

Public Types

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

Public Member Functions

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

Private Attributes

CSCDBNoiseMatrixcndbMatrix
 

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

Member Typedef Documentation

Definition at line 27 of file CSCNoiseMatrixDBConditions.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file CSCNoiseMatrixDBConditions.cc.

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

10 {
11  //the following line is needed to tell the framework what
12  // data is being produced
14  // added by Zhen (changed since 1_2_0)
16  findingRecord<CSCDBNoiseMatrixRcd>();
17  //now do what ever other initialization is needed
18 }
static CSCDBNoiseMatrix * prefillDBNoiseMatrix()
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
ReturnType produceDBNoiseMatrix(const CSCDBNoiseMatrixRcd &)
CSCNoiseMatrixDBConditions::~CSCNoiseMatrixDBConditions ( )

Definition at line 21 of file CSCNoiseMatrixDBConditions.cc.

References cndbMatrix.

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

Member Function Documentation

CSCDBNoiseMatrix * CSCNoiseMatrixDBConditions::prefillDBNoiseMatrix ( )
inlinestatic

Definition at line 44 of file CSCNoiseMatrixDBConditions.h.

References ecal_dqm_sourceclient-live_cfg::cerr, counter, cmsRelvalreport::exit, CSCDBNoiseMatrix::factor_noise, i, recoMuon::in, relval_2017::k, and CSCDBNoiseMatrix::matrix.

Referenced by CSCNoiseMatrixDBConditions().

45 {
46  //const int MAX_SIZE = 273024; //for ME1a unganged
47  const int MAX_SIZE = 252288;
48  const int FACTOR=1000;
49  const int MAX_SHORT= 32767;
50 
51  int new_index, db_index;
52  float db_elm33,db_elm34, db_elm44, db_elm35, db_elm45, db_elm55;
53  float db_elm46, db_elm56, db_elm66, db_elm57, db_elm67, db_elm77;
54  std::vector<int> db_index_id;
55  std::vector<float> db_elem33;
56  std::vector<float> db_elem34;
57  std::vector<float> db_elem44;
58  std::vector<float> db_elem45;
59  std::vector<float> db_elem35;
60  std::vector<float> db_elem55;
61  std::vector<float> db_elem46;
62  std::vector<float> db_elem56;
63  std::vector<float> db_elem66;
64  std::vector<float> db_elem57;
65  std::vector<float> db_elem67;
66  std::vector<float> db_elem77;
67 
68 
69  float new_elm33,new_elm34, new_elm44, new_elm35, new_elm45, new_elm55;
70  float new_elm46, new_elm56, new_elm66, new_elm57, new_elm67, new_elm77;
71  std::vector<int> new_cham_id;
72  std::vector<int> new_index_id;
73  std::vector<float> new_elem33;
74  std::vector<float> new_elem34;
75  std::vector<float> new_elem44;
76  std::vector<float> new_elem45;
77  std::vector<float> new_elem35;
78  std::vector<float> new_elem55;
79  std::vector<float> new_elem46;
80  std::vector<float> new_elem56;
81  std::vector<float> new_elem66;
82  std::vector<float> new_elem57;
83  std::vector<float> new_elem67;
84  std::vector<float> new_elem77;
85 
86  CSCDBNoiseMatrix * cndbmatrix = new CSCDBNoiseMatrix();
87 
88  int counter;
89  int db_nrlines=0;
90  int new_nrlines=0;
91 
92  std::ifstream dbdata;
93  dbdata.open("old_dbmatrix.dat",std::ios::in);
94  if(!dbdata) {
95  std::cerr <<"Error: old_dbmatrix.dat -> no such file!"<< std::endl;
96  exit(1);
97  }
98 
99  while (!dbdata.eof() ) {
100  dbdata >> db_index >> db_elm33 >> db_elm34 >> db_elm44 >> db_elm35 >> db_elm45 >> db_elm55 >> db_elm46 >> db_elm56 >> db_elm66 >> db_elm57 >> db_elm67 >> db_elm77 ;
101  db_index_id.push_back(db_index);
102  db_elem33.push_back(db_elm33);
103  db_elem34.push_back(db_elm34);
104  db_elem35.push_back(db_elm35);
105  db_elem44.push_back(db_elm44);
106  db_elem45.push_back(db_elm45);
107  db_elem46.push_back(db_elm46);
108  db_elem55.push_back(db_elm55);
109  db_elem56.push_back(db_elm56);
110  db_elem57.push_back(db_elm57);
111  db_elem66.push_back(db_elm66);
112  db_elem67.push_back(db_elm67);
113  db_elem77.push_back(db_elm77);
114  db_nrlines++;
115  }
116  dbdata.close();
117 
118  std::ifstream newdata;
119  newdata.open("matrix.dat",std::ios::in);
120  if(!newdata) {
121  std::cerr <<"Error: matrix.dat -> no such file!"<< std::endl;
122  exit(1);
123  }
124 
125  while (!newdata.eof() ) {
126  newdata >> new_index>> new_elm33 >> new_elm34 >> new_elm44 >> new_elm35 >> new_elm45 >> new_elm55 >> new_elm46 >> 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 
165  for(int i=0; i<MAX_SIZE;++i){
166  counter=db_index_id[i];
167  itemvector[i] = itemvector[counter];
168  itemvector[i].elem33 = int (db_elem33[i]);
169  itemvector[i].elem34 = int (db_elem34[i]);
170  itemvector[i].elem35 = int (db_elem35[i]);
171  itemvector[i].elem44 = int (db_elem44[i]);
172  itemvector[i].elem45 = int (db_elem45[i]);
173  itemvector[i].elem46 = int (db_elem46[i]);
174  itemvector[i].elem55 = int (db_elem55[i]);
175  itemvector[i].elem56 = int (db_elem56[i]);
176  itemvector[i].elem57 = int (db_elem57[i]);
177  itemvector[i].elem66 = int (db_elem66[i]);
178  itemvector[i].elem67 = int (db_elem67[i]);
179  itemvector[i].elem77 = int (db_elem77[i]);
180 
181  for (unsigned int k=0;k<new_index_id.size()-1;k++){
182  if(counter==new_index_id[k]){
183  if((short int) (fabs(new_elem33[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem33 = int (new_elem33[k]*FACTOR+0.5);
184  if((short int) (fabs(new_elem34[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem34 = int (new_elem34[k]*FACTOR+0.5);
185  if((short int) (fabs(new_elem35[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem35 = int (new_elem35[k]*FACTOR+0.5);
186  if((short int) (fabs(new_elem44[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem44 = int (new_elem44[k]*FACTOR+0.5);
187  if((short int) (fabs(new_elem45[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem45 = int (new_elem45[k]*FACTOR+0.5);
188  if((short int) (fabs(new_elem46[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem46 = int (new_elem46[k]*FACTOR+0.5);
189  if((short int) (fabs(new_elem55[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem55 = int (new_elem55[k]*FACTOR+0.5);
190  if((short int) (fabs(new_elem56[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem56 = int (new_elem56[k]*FACTOR+0.5);
191  if((short int) (fabs(new_elem57[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem57 = int (new_elem57[k]*FACTOR+0.5);
192  if((short int) (fabs(new_elem66[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem66 = int (new_elem66[k]*FACTOR+0.5);
193  if((short int) (fabs(new_elem67[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem67 = int (new_elem67[k]*FACTOR+0.5);
194  if((short int) (fabs(new_elem77[k]*FACTOR+0.5))<MAX_SHORT) itemvector[counter].elem77 = int (new_elem77[k]*FACTOR+0.5);
195  itemvector[i] = itemvector[counter];
196  }
197  }
198 
199  if (counter>223968){
200  itemvector[counter].elem33 = int (db_elem33[i]);
201  itemvector[counter].elem34 = int (db_elem34[i]);
202  itemvector[counter].elem35 = int (db_elem35[i]);
203  itemvector[counter].elem44 = int (db_elem44[i]);
204  itemvector[counter].elem45 = int (db_elem45[i]);
205  itemvector[counter].elem46 = int (db_elem46[i]);
206  itemvector[counter].elem55 = int (db_elem55[i]);
207  itemvector[counter].elem56 = int (db_elem56[i]);
208  itemvector[counter].elem57 = int (db_elem57[i]);
209  itemvector[counter].elem66 = int (db_elem66[i]);
210  itemvector[counter].elem67 = int (db_elem67[i]);
211  itemvector[counter].elem77 = int (db_elem77[i]);
212  itemvector[i] = itemvector[counter];
213  }
214  }
215 
216  return cndbmatrix;
217 }
int i
Definition: DBlmapReader.cc:9
std::vector< Item > NoiseMatrixContainer
static std::atomic< unsigned int > counter
NoiseMatrixContainer matrix
CSCNoiseMatrixDBConditions::ReturnType CSCNoiseMatrixDBConditions::produceDBNoiseMatrix ( const CSCDBNoiseMatrixRcd iRecord)

Definition at line 36 of file CSCNoiseMatrixDBConditions.cc.

References cndbMatrix.

Referenced by CSCNoiseMatrixDBConditions().

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

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 44 of file CSCNoiseMatrixDBConditions.cc.

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

46  {
48 
49  }
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

CSCDBNoiseMatrix* CSCNoiseMatrixDBConditions::cndbMatrix
private