CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalGetLaserData Class Reference

#include <EcalGetLaserData.h>

Inheritance diagram for EcalGetLaserData:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup)
 
 EcalGetLaserData (const edm::ParameterSet &iConfig)
 
 ~EcalGetLaserData ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 

Private Attributes

std::map< std::string,
unsigned long long > 
m_cacheIDs
 
std::map< std::string,
std::string > 
m_records
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 35 of file EcalGetLaserData.h.

Constructor & Destructor Documentation

EcalGetLaserData::EcalGetLaserData ( const edm::ParameterSet iConfig)
explicit

Definition at line 57 of file EcalGetLaserData.cc.

References edm::ParameterSet::getParameter(), i, m_cacheIDs, m_records, record, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, and convertSQLitetoXML_cfg::toGet.

57  :
58  // m_timetype(iConfig.getParameter<std::string>("timetype")),
59  m_cacheIDs(),
60  m_records()
61 {
62  std::string container;
65 
66  //m_firstRun=(unsigned long long)atoi( iConfig.getParameter<std::string>("firstRun").c_str());
67  //m_lastRun=(unsigned long long)atoi( iConfig.getParameter<std::string>("lastRun").c_str());
68 
69  typedef std::vector< edm::ParameterSet > Parameters;
70  Parameters toGet = iConfig.getParameter<Parameters>("toGet");
71  for(Parameters::iterator i = toGet.begin(); i != toGet.end(); ++i) {
72  container = i->getParameter<std::string>("container");
73  record = i->getParameter<std::string>("record");
74  m_cacheIDs.insert( std::make_pair(container, 0) );
75  m_records.insert( std::make_pair(container, record) );
76 
77  } //now do what ever initialization is needed
78 
79 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::map< std::string, std::string > m_records
JetCorrectorParameters::Record record
Definition: classes.h:7
vector< ParameterSet > Parameters
std::map< std::string, unsigned long long > m_cacheIDs
EcalGetLaserData::~EcalGetLaserData ( )

Definition at line 82 of file EcalGetLaserData.cc.

83 {
84 
85  // do anything here that needs to be done at desctruction time
86  // (e.g. close files, deallocate resources etc.)
87 
88 }

Member Function Documentation

void EcalGetLaserData::analyze ( const edm::Event evt,
const edm::EventSetup evtSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 97 of file EcalGetLaserData.cc.

References alpha, gather_cfg::cout, edm::EventSetup::get(), patZpeak::handle, EBDetId::hashedIndex(), EEDetId::hashedIndex(), i, EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, m_records, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p1, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p2, edm::ESHandle< class >::product(), record, ecalTPGAnalyzer_cfg::recordName, EcalCondObjectContainer< T >::size(), AlCaHLTBitMon_QueryRunRegistry::string, EcalLaserAPDPNRatios::EcalLaserTimeStamp::t1, EcalLaserAPDPNRatios::EcalLaserTimeStamp::t2, cond::timestamp, EEDetId::validDetId(), and edm::Timestamp::value().

98 {
99  using namespace edm;
100 
101  // loop on offline DB conditions to be transferred as from config file
102  std::string container;
104  typedef std::map<std::string, std::string>::const_iterator recordIter;
105  for (recordIter i = m_records.begin(); i != m_records.end(); ++i) {
106  container = (*i).first;
107  record = (*i).second;
108 
109  std::string recordName = m_records[container];
110 
111 
112  if (container == "EcalLaserAPDPNRatios") {
113 
114  // get from offline DB the last valid laser set
116  evtSetup.get<EcalLaserAPDPNRatiosRcd>().get(handle);
117 
118  // this is the offline object
121 
122  const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap = handle.product()->getLaserMap();
123  const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap = handle.product()->getTimeMap();
124 
125  // loop through ecal barrel
126  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
127  if(iEta==0) continue;
128  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
129 
130  EBDetId ebdetid(iEta,iPhi);
131  int hi = ebdetid.hashedIndex();
132 
133  if (hi<static_cast<int>(laserRatiosMap.size())) {
134  apdpnpair = laserRatiosMap[hi];
135  std::cout << "A sample value of APDPN pair EB : "
136  << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 << std::endl;
137  } else {
138  edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl;
139  }
140 
141  }
142  }
143 
144  // loop through ecal endcap
145  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
146  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
147 
148  if (!EEDetId::validDetId(iX,iY,1))
149  continue;
150 
151  EEDetId eedetidpos(iX,iY,1);
152  int hi = eedetidpos.hashedIndex();
153 
154  if (hi< static_cast<int>(laserRatiosMap.size())) {
155  apdpnpair = laserRatiosMap[hi];
156  std::cout << "A sample value of APDPN pair EE+ : "
157  << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 << std::endl;
158  } else {
159  edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl;
160  }
161 
162  if (!EEDetId::validDetId(iX,iY,-1))
163  continue;
164  EEDetId eedetidneg(iX,iY,1);
165  hi = eedetidneg.hashedIndex();
166 
167  if (hi< static_cast<int>(laserRatiosMap.size())) {
168  apdpnpair = laserRatiosMap[hi];
169  std::cout << "A sample value of APDPN pair EE- : "
170  << hi << " : " << apdpnpair.p1 << " , " << apdpnpair.p2 << std::endl;
171  } else {
172  edm::LogError("EcalGetLaserData") << "error with laserRatiosMap!" << std::endl;
173  }
174  }
175  }
176 
177  for(int i=0; i<92; i++){
178  timestamp = laserTimeMap[i];
179  std::cout << "A value of timestamp pair : "
180  << i << " " << timestamp.t1.value() << " , " << timestamp.t2.value() << std::endl;
181  }
182 
183  std::cout <<".. just retrieved the last valid record from DB "<< std::endl;
184 
185  } else if(container == "EcalLaserAPDPNRatiosRef") {
186 
187  // get from offline DB the last valid laser set
189  evtSetup.get<EcalLaserAPDPNRatiosRefRcd>().get(handle);
190 
191  EcalLaserAPDPNref apdpnref;
192  const EcalLaserAPDPNRatiosRefMap& laserRefMap = handle.product()->getMap();
193 
194  // first barrel
195  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
196  if(iEta==0) continue;
197  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
198 
199  EBDetId ebdetid(iEta,iPhi);
200  int hi = ebdetid.hashedIndex();
201 
202  if (hi< static_cast<int>(laserRefMap.size())) {
203  apdpnref = laserRefMap[hi];
204  std::cout << "A sample value of APDPN Reference value EB : "
205  << hi << " : " << apdpnref << std::endl;
206  } else {
207  edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl;
208  }
209  }
210  }
211 
212  // now for endcap
213  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
214  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
215 
216  if (!EEDetId::validDetId(iX,iY,1))
217  continue;
218 
219  EEDetId eedetidpos(iX,iY,1);
220  int hi = eedetidpos.hashedIndex();
221 
222  if (hi< static_cast<int>(laserRefMap.size())) {
223  apdpnref = laserRefMap[hi];
224  std::cout << "A sample value of APDPN Reference value EE+ : "
225  << hi << " : " << apdpnref << std::endl;
226 
227  } else {
228  edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl;
229  }
230 
231  if (!EEDetId::validDetId(iX,iY,-1))
232  continue;
233  EEDetId eedetidneg(iX,iY,-1);
234  hi = eedetidneg.hashedIndex();
235 
236  if (hi< static_cast<int>(laserRefMap.size())) {
237  apdpnref = laserRefMap[hi];
238  std::cout << "A sample value of APDPN Reference value EE- : "
239  << hi << " : " << apdpnref << std::endl;
240  } else {
241  edm::LogError("EcalGetLaserData") << "error with laserRefMap!" << std::endl;
242  }
243  }
244  }
245 
246  std::cout << "... just retrieved the last valid record from DB "<< std::endl;
247 
248  } else if (container == "EcalLaserAlphas") {
249 
250  // get from offline DB the last valid laser set
252  evtSetup.get<EcalLaserAlphasRcd>().get(handle);
253 
254  // this is the offline object
256  const EcalLaserAlphaMap& laserAlphaMap = handle.product()->getMap(); // map of apdpns
257 
258  // first barrel
259  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
260  if(iEta==0) continue;
261  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
262 
263  EBDetId ebdetid(iEta,iPhi);
264  int hi = ebdetid.hashedIndex();
265 
266  if (hi< static_cast<int>(laserAlphaMap.size())) {
267  alpha = laserAlphaMap[hi];
268  std::cout << " A sample value of Alpha value EB : " << hi << " : " << alpha << std::endl;
269  } else {
270  edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl;
271  }
272  }
273  }
274 
275  // next endcap
276  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
277  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
278 
279  if (!EEDetId::validDetId(iX,iY,1))
280  continue;
281 
282  EEDetId eedetidpos(iX,iY,1);
283  int hi = eedetidpos.hashedIndex();
284 
285  if (hi< static_cast<int>(laserAlphaMap.size())) {
286  alpha = laserAlphaMap[hi];
287  std::cout << " A sample value of Alpha value EE+ : " << hi << " : " << alpha << std::endl;
288  } else {
289  edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl;
290  }
291 
292 
293  if (!EEDetId::validDetId(iX,iY,-1))
294  continue;
295  EEDetId eedetidneg(iX,iY,-1);
296  hi = eedetidneg.hashedIndex();
297 
298  if (hi< static_cast<int>(laserAlphaMap.size())) {
299  alpha = laserAlphaMap[hi];
300  std::cout << " A sample value of Alpha value EE- : " << hi << " : " << alpha << std::endl;
301  } else {
302  edm::LogError("EcalGetLaserData") << "error with laserAlphaMap!" << std::endl;
303  }
304  }
305  }
306 
307  std::cout <<"... just retrieved the last valid record from DB "<< std::endl;
308 
309  } else {
310  edm::LogError("EcalGetLaserData") << "Cannot retrieve for container: "
311  << container << std::endl;
312  }
313 
314  }
315 
316 }
int i
Definition: DBlmapReader.cc:9
float EcalLaserAlpha
float alpha
Definition: AMPTWrapper.h:95
static const int MIN_IPHI
Definition: EBDetId.h:142
std::map< std::string, std::string > m_records
JetCorrectorParameters::Record record
Definition: classes.h:7
static const int IX_MIN
Definition: EEDetId.h:294
float EcalLaserAPDPNref
static const int IY_MIN
Definition: EEDetId.h:298
tuple handle
Definition: patZpeak.py:22
static const int IX_MAX
Definition: EEDetId.h:302
static const int MAX_IPHI
Definition: EBDetId.h:144
std::vector< EcalLaserTimeStamp > EcalLaserTimeStampMap
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
static const int MAX_IETA
Definition: EBDetId.h:143
tuple cout
Definition: gather_cfg.py:121
static const int IY_MAX
Definition: EEDetId.h:306
TimeValue_t value() const
Definition: Timestamp.h:56
void EcalGetLaserData::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 321 of file EcalGetLaserData.cc.

322 {
323 }
void EcalGetLaserData::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 327 of file EcalGetLaserData.cc.

327  {
328 }

Member Data Documentation

std::map<std::string, unsigned long long> EcalGetLaserData::m_cacheIDs
private

Definition at line 47 of file EcalGetLaserData.h.

Referenced by EcalGetLaserData().

std::map<std::string, std::string> EcalGetLaserData::m_records
private

Definition at line 48 of file EcalGetLaserData.h.

Referenced by analyze(), and EcalGetLaserData().