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

#include <CSCCrosstalkDBConditions.h>

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

Public Types

typedef const CSCDBCrosstalkReturnType
 
- 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

 CSCCrosstalkDBConditions (const edm::ParameterSet &)
 
ReturnType produceDBCrosstalk (const CSCDBCrosstalkRcd &)
 
 ~CSCCrosstalkDBConditions ()
 
- 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 CSCDBCrosstalkprefillDBCrosstalk ()
 
- 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

CSCDBCrosstalkcndbCrosstalk
 

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

Member Typedef Documentation

Definition at line 28 of file CSCCrosstalkDBConditions.h.

Constructor & Destructor Documentation

CSCCrosstalkDBConditions::CSCCrosstalkDBConditions ( const edm::ParameterSet iConfig)

Definition at line 10 of file CSCCrosstalkDBConditions.cc.

References cndbCrosstalk, prefillDBCrosstalk(), produceDBCrosstalk(), 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<CSCDBCrosstalkRcd>();
18  //now do what ever other initialization is needed
19 }
ReturnType produceDBCrosstalk(const CSCDBCrosstalkRcd &)
static CSCDBCrosstalk * prefillDBCrosstalk()
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
CSCCrosstalkDBConditions::~CSCCrosstalkDBConditions ( )

Definition at line 22 of file CSCCrosstalkDBConditions.cc.

References cndbCrosstalk.

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

Member Function Documentation

CSCDBCrosstalk * CSCCrosstalkDBConditions::prefillDBCrosstalk ( )
inlinestatic

Definition at line 46 of file CSCCrosstalkDBConditions.h.

References dtNoiseDBValidation_cfg::cerr, counter, CSCDBCrosstalk::crosstalk, cmsRelvalreport::exit, CSCDBCrosstalk::factor_intercept, CSCDBCrosstalk::factor_slope, i, recoMuon::in, and gen::k.

Referenced by CSCCrosstalkDBConditions().

47 {
48  // const int MAX_SIZE = 273024; //for ME1a unganged
49  const int MAX_SIZE = 252288;
50  const int SLOPE_FACTOR=10000000;
51  const int INTERCEPT_FACTOR=100000;
52  const int MAX_SHORT= 32767;
53  CSCDBCrosstalk * cndbcrosstalk = new CSCDBCrosstalk();
54 
55  int db_index,new_index;
56  float db_slope_right,db_slope_left,db_intercept_right;
57  float db_intercept_left;
58  std::vector<int> db_index_id;
59  std::vector<float> db_slope_r;
60  std::vector<float> db_intercept_r;
61  std::vector<float> db_slope_l;
62  std::vector<float> db_intercept_l;
63  float new_slope_right,new_slope_left,new_intercept_right;
64  float new_intercept_left;
65  std::vector<int> new_index_id;
66  std::vector<float> new_slope_r;
67  std::vector<float> new_intercept_r;
68  std::vector<float> new_slope_l;
69  std::vector<float> new_intercept_l;
70 
71  int counter;
72  int db_nrlines=0;
73  int new_nrlines=0;
74 
75  std::ifstream dbdata;
76  dbdata.open("old_dbxtalk.dat",std::ios::in);
77  if(!dbdata) {
78  std::cerr <<"Error: old_dbxtalk.dat -> no such file!"<< std::endl;
79  exit(1);
80  }
81 
82  while (!dbdata.eof() ) {
83  dbdata >> db_index >> db_slope_right >> db_intercept_right >> db_slope_left >> db_intercept_left ;
84  db_index_id.push_back(db_index);
85  db_slope_r.push_back(db_slope_right);
86  db_slope_l.push_back(db_slope_left);
87  db_intercept_r.push_back(db_intercept_right);
88  db_intercept_l.push_back(db_intercept_left);
89  db_nrlines++;
90  }
91  dbdata.close();
92 
93  std::ifstream newdata;
94  newdata.open("xtalk.dat",std::ios::in);
95  if(!newdata) {
96  std::cerr <<"Error: xtalk.dat -> no such file!"<< std::endl;
97  exit(1);
98  }
99 
100  while (!newdata.eof() ) {
101  newdata >> new_index >> new_slope_right >> new_intercept_right >> new_slope_left >> new_intercept_left;
102  new_index_id.push_back(new_index);
103  new_slope_r.push_back(new_slope_right);
104  new_slope_l.push_back(new_slope_left);
105  new_intercept_r.push_back(new_intercept_right);
106  new_intercept_l.push_back(new_intercept_left);
107  new_nrlines++;
108  }
109  newdata.close();
110 
111  CSCDBCrosstalk::CrosstalkContainer & itemvector = cndbcrosstalk->crosstalk;
112  itemvector.resize(MAX_SIZE);
113  cndbcrosstalk->factor_slope = int (SLOPE_FACTOR);
114  cndbcrosstalk->factor_intercept = int (INTERCEPT_FACTOR);
115 
116  for(int i=0; i<MAX_SIZE;++i){
117  itemvector[i].xtalk_slope_right=(short int) (db_slope_r[i]*SLOPE_FACTOR+0.5);
118  itemvector[i].xtalk_intercept_right= (short int) (db_intercept_r[i]*INTERCEPT_FACTOR+0.5);
119  itemvector[i].xtalk_slope_left= (short int) (db_slope_l[i]*SLOPE_FACTOR+0.5);
120  itemvector[i].xtalk_intercept_left= (short int) (db_intercept_l[i]*INTERCEPT_FACTOR+0.5);
121  }
122 
123  for(int i=0; i<MAX_SIZE;++i){
124  counter=db_index_id[i];
125  for (unsigned int k=0;k<new_index_id.size()-1;k++){
126  if(counter==new_index_id[k]){
127  if ((short int) (fabs(new_slope_r[k]*SLOPE_FACTOR+0.5))<MAX_SHORT) itemvector[counter].xtalk_slope_right= int (new_slope_r[k]*SLOPE_FACTOR+0.5);
128  if ((short int) (fabs(new_intercept_r[k]*INTERCEPT_FACTOR+0.5))<MAX_SHORT) itemvector[counter].xtalk_intercept_right= int (new_intercept_r[k]*INTERCEPT_FACTOR+0.5);
129  if ((short int) (fabs(new_slope_l[k]*SLOPE_FACTOR+0.5))<MAX_SHORT) itemvector[counter].xtalk_slope_left= int (new_slope_l[k]*SLOPE_FACTOR+0.5);
130  if ((short int) (fabs(new_intercept_l[k]*INTERCEPT_FACTOR+0.5))<MAX_SHORT) itemvector[counter].xtalk_intercept_left= int (new_intercept_l[k]*INTERCEPT_FACTOR+0.5);
131  itemvector[i] = itemvector[counter];
132  //std::cout<<" counter "<<counter <<" dbindex "<<new_index_id[k]<<" dbslope " <<db_slope_r[k]<<" new slope "<<new_slope_r[k]<<std::endl;
133  }
134  }
135 
136  if (counter>223968){
137  itemvector[counter].xtalk_slope_right = int (db_slope_r[i]);
138  itemvector[counter].xtalk_slope_left = int (db_slope_l[i]);
139  itemvector[counter].xtalk_intercept_right = int (db_intercept_r[i]);
140  itemvector[counter].xtalk_intercept_left = int (db_intercept_l[i]);
141  }
142  }
143 
144  return cndbcrosstalk;
145 
146 }
int i
Definition: DBlmapReader.cc:9
std::vector< Item > CrosstalkContainer
int k[5][pyjets_maxn]
static std::atomic< unsigned int > counter
CrosstalkContainer crosstalk
CSCCrosstalkDBConditions::ReturnType CSCCrosstalkDBConditions::produceDBCrosstalk ( const CSCDBCrosstalkRcd iRecord)

Definition at line 37 of file CSCCrosstalkDBConditions.cc.

References cndbCrosstalk.

Referenced by CSCCrosstalkDBConditions().

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

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 45 of file CSCCrosstalkDBConditions.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

CSCDBCrosstalk* CSCCrosstalkDBConditions::cndbCrosstalk
private