CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalTestDevDB.cc
Go to the documentation of this file.
3 
7 
9 
13 
15 
17 
19 
20 #include <map>
21 #include <vector>
22 
23 using namespace std;
24 
26  m_timetype(iConfig.getParameter<std::string>("timetype")),
27  m_cacheIDs(),
28  m_records()
29 {
30 
31  std::string container;
34 
35  m_firstRun=static_cast<unsigned long>(atoi( iConfig.getParameter<std::string>("firstRun").c_str()));
36  m_lastRun=static_cast<unsigned long>(atoi( iConfig.getParameter<std::string>("lastRun").c_str()));
37  m_interval=static_cast<unsigned long>(atoi( iConfig.getParameter<std::string>("interval").c_str()));
38 
39  typedef std::vector< edm::ParameterSet > Parameters;
40  Parameters toCopy = iConfig.getParameter<Parameters>("toCopy");
41  for(Parameters::iterator i = toCopy.begin(); i != toCopy.end(); ++i) {
42  container = i->getParameter<std::string>("container");
43  record = i->getParameter<std::string>("record");
44  m_cacheIDs.insert( std::make_pair(container, 0) );
45  m_records.insert( std::make_pair(container, record) );
46  }
47 
48 }
49 
50 
52 {
53 
54 }
55 
56 void EcalTestDevDB::analyze( const edm::Event& evt, const edm::EventSetup& evtSetup)
57 {
58 
60  if ( !dbOutput.isAvailable() ) {
61  throw cms::Exception("PoolDBOutputService is not available");
62  }
63 
64 
65 
66  std::string container;
68  typedef std::map<std::string, std::string>::const_iterator recordIter;
69  for (recordIter i = m_records.begin(); i != m_records.end(); ++i) {
70  container = (*i).first;
71  record = (*i).second;
72 
73  std::string recordName = m_records[container];
74 
75 
76  // Loop through each of the runs
77 
78  unsigned long nrec=(m_lastRun-m_firstRun)/m_interval+1;
79  unsigned long nstart=0;
80  if (m_firstRun == 0 && m_lastRun == 0) {
81  // it should do at least once the loop
82  nstart=0;
83  nrec=1;
84  }
85 
86  for(unsigned long i=nstart; i<nrec; i++) {
87  unsigned long irun=m_firstRun+i*m_interval;
88 
89 
90  // Arguments 0 0 mean infinite IOV
91  if (m_firstRun == 0 && m_lastRun == 0) {
92  std::cout << "Infinite IOV mode" << std::endl;
94  }
95 
96  std::cout << "Starting Transaction for run " << irun << "..." << std::flush;
97 
98  if (container == "EcalPedestals") {
99  EcalPedestals* condObject= generateEcalPedestals();
100 
101  if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) {
102  // create new
103  std::cout<<"First One "<<std::endl;
104  dbOutput->createNewIOV<const EcalPedestals>( condObject, dbOutput->beginOfTime(),dbOutput->endOfTime() ,recordName);
105  } else {
106  // append
107  std::cout<<"Old One "<<std::endl;
108  dbOutput->appendSinceTime<const EcalPedestals>( condObject, irun , recordName);
109  }
110 
111  } else if (container == "EcalADCToGeVConstant") {
112 
114  if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) {
115  // create new
116  std::cout<<"First One "<<std::endl;
117  dbOutput->createNewIOV<const EcalADCToGeVConstant>( condObject, dbOutput->beginOfTime(),dbOutput->endOfTime() ,recordName);
118  } else {
119  // append
120  std::cout<<"Old One "<<std::endl;
121  dbOutput->appendSinceTime<const EcalADCToGeVConstant>( condObject, irun , recordName);
122  }
123 
124 
125  } else if (container == "EcalIntercalibConstants") {
127  if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) {
128  // create new
129  std::cout<<"First One "<<std::endl;
130  dbOutput->createNewIOV<const EcalIntercalibConstants>( condObject, dbOutput->beginOfTime(),dbOutput->endOfTime() ,recordName);
131  } else {
132  // append
133  std::cout<<"Old One "<<std::endl;
134  dbOutput->appendSinceTime<const EcalIntercalibConstants>( condObject, irun , recordName);
135  }
136  } else if (container == "EcalLinearCorrections") {
138  if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) {
139  // create new
140  std::cout<<"First One "<<std::endl;
141  dbOutput->createNewIOV<const EcalLinearCorrections>( condObject, dbOutput->beginOfTime(),dbOutput->endOfTime() ,recordName);
142  } else {
143  // append
144  std::cout<<"Old One "<<std::endl;
145  dbOutput->appendSinceTime<const EcalLinearCorrections>( condObject, irun , recordName);
146  }
147 
148  } else if (container == "EcalGainRatios") {
149  EcalGainRatios* condObject= generateEcalGainRatios();
150  if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) {
151  // create new
152  std::cout<<"First One "<<std::endl;
153  dbOutput->createNewIOV<const EcalGainRatios>( condObject,dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName);
154  } else {
155  // append
156  std::cout<<"Old One "<<std::endl;
157  dbOutput->appendSinceTime<const EcalGainRatios>( condObject, irun , recordName);
158  }
159 
160  } else if (container == "EcalWeightXtalGroups") {
162  if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) {
163  // create new
164  std::cout<<"First One "<<std::endl;
165  dbOutput->createNewIOV<const EcalWeightXtalGroups>( condObject, dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName);
166  } else {
167  // append
168  std::cout<<"Old One "<<std::endl;
169  dbOutput->appendSinceTime<const EcalWeightXtalGroups>( condObject, irun , recordName);
170  }
171 
172  } else if (container == "EcalTBWeights") {
173  EcalTBWeights* condObject= generateEcalTBWeights();
174  if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) {
175  // create new
176  std::cout<<"First One "<<std::endl;
177  dbOutput->createNewIOV<const EcalTBWeights>( condObject, dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName);
178  } else {
179  // append
180  std::cout<<"Old One "<<std::endl;
181  dbOutput->appendSinceTime<const EcalTBWeights>( condObject, irun , recordName);
182  }
183 
184  } else if (container == "EcalLaserAPDPNRatios") {
186  if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) {
187  // create new
188  std::cout<<"First One "<<std::endl;
189  dbOutput->createNewIOV<const EcalLaserAPDPNRatios>( condObject,dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName);
190  } else {
191  // append
192  std::cout<<"Old One "<<std::endl;
193  dbOutput->appendSinceTime<const EcalLaserAPDPNRatios>( condObject, irun , recordName);
194  }
195  } else if (container == "EcalLaserAPDPNRatiosRef") {
197  if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) {
198  // create new
199  std::cout<<"First One "<<std::endl;
200  dbOutput->createNewIOV<const EcalLaserAPDPNRatiosRef>( condObject, dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName);
201  } else {
202  // append
203  std::cout<<"Old One "<<std::endl;
204  dbOutput->appendSinceTime<const EcalLaserAPDPNRatiosRef>( condObject, irun , recordName);
205  }
206  } else if (container == "EcalLaserAlphas") {
208  if(irun==m_firstRun && dbOutput->isNewTagRequest(recordName)) {
209  // create new
210  std::cout<<"First One "<<std::endl;
211  dbOutput->createNewIOV<const EcalLaserAlphas>( condObject,dbOutput->beginOfTime(), dbOutput->endOfTime() ,recordName);
212  } else {
213  // append
214  std::cout<<"Old One "<<std::endl;
215  dbOutput->appendSinceTime<const EcalLaserAlphas>( condObject, irun , recordName);
216  }
217  } else {
218  std::cout << "it does not work yet for " << container << "..." << std::flush;
219 
220  }
221 
222 
223  }
224 
225 
226  }
227 
228 
229 }
230 
231 
232 //-------------------------------------------------------------
235 //-------------------------------------------------------------
236 
237  EcalPedestals* peds = new EcalPedestals();
238  EcalPedestals::Item item;
239  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
240  if(iEta==0) continue;
241  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
242  item.mean_x1 = 200.*( (double)std::rand()/(double(RAND_MAX)+double(1)) );
243  item.rms_x1 = (double)std::rand()/(double(RAND_MAX)+double(1));
244  item.mean_x6 = 1200.*( (double)std::rand()/(double(RAND_MAX)+double(1)) );
245  item.rms_x6 = 6.*( (double)std::rand()/(double(RAND_MAX)+double(1)) );
246  item.mean_x12 = 2400.*( (double)std::rand()/(double(RAND_MAX)+double(1)) );
247  item.rms_x12 = 12.*( (double)std::rand()/(double(RAND_MAX)+double(1)) );
248 
249  EBDetId ebdetid(iEta,iPhi);
250  peds->insert(std::make_pair(ebdetid.rawId(),item));
251  }
252  }
253  return peds;
254 }
255 
256 //-------------------------------------------------------------
259 //-------------------------------------------------------------
260 
261  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
262  EcalADCToGeVConstant* agc = new EcalADCToGeVConstant(36.+r*4., 60.+r*4);
263  return agc;
264 }
265 
266 //-------------------------------------------------------------
269 //-------------------------------------------------------------
270 
272 
273  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
274  if(ieta==0) continue;
275  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId:: MAX_IPHI; ++iphi) {
276 
277  EBDetId ebid(ieta,iphi);
278 
279  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
280  ical->setValue( ebid.rawId(), 0.85 + r*0.3 );
281  } // loop over phi
282  } // loop over eta
283  return ical;
284 }
285 
286 //-------------------------------------------------------------
289 //-------------------------------------------------------------
290 
292 
293  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
294  if(ieta==0) continue;
295  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId::MAX_IPHI; ++iphi) {
296  if (EBDetId::validDetId(ieta,iphi)) {
297  EBDetId ebid(ieta,iphi);
298 
299 
301  pairAPDPN.p1 = 1.0;
302  pairAPDPN.p2 = 1.0;
303  pairAPDPN.p3 = 1.0;
304  ical->setValue( ebid, pairAPDPN );
305  }
306  }
307  }
308 
309  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
310  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
311  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
312  if (EEDetId::validDetId(iX,iY,1)) {
313 
314  EEDetId eedetidpos(iX,iY,1);
315 
317  pairAPDPN.p1 = 1.0;
318  pairAPDPN.p2 = 1.0;
319  pairAPDPN.p3 = 1.0;
320 
321  ical->setValue( eedetidpos, pairAPDPN );
322  }
323 
324  if (EEDetId::validDetId(iX,iY,-1)) {
325 
326  EEDetId eedetidneg(iX,iY,-1);
327 
329  pairAPDPN.p1 = 1.0;
330  pairAPDPN.p2 = 1.0;
331  pairAPDPN.p3 = 1.0;
332 
333  ical->setValue( eedetidneg, pairAPDPN );
334  }
335  }
336  }
337 
339  for(int i=0; i<92; i++){
340 
341  TimeStamp.t1 = edm::Timestamp(0);
344 
345  ical->setTime(i, TimeStamp);
346 
347 
348  }
349 
350 
351 
352 
353  return ical;
354 }
355 
356 //-------------------------------------------------------------
359 //-------------------------------------------------------------
360 
361  // create gain ratios
362  EcalGainRatios* gratio = new EcalGainRatios;
363 
364  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
365  if(ieta==0) continue;
366  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId:: MAX_IPHI; ++iphi) {
367 
368  EBDetId ebid(ieta,iphi);
369 
370  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
371 
373  gr.setGain12Over6( 1.9 + r*0.2 );
374  gr.setGain6Over1( 5.9 + r*0.2 );
375 
376  gratio->setValue( ebid.rawId(), gr );
377 
378  } // loop over phi
379  } // loop over eta
380  return gratio;
381 }
382 
383 //-------------------------------------------------------------
386 //-------------------------------------------------------------
387 
388  EcalWeightXtalGroups* xtalGroups = new EcalWeightXtalGroups();
389  for(int ieta=-EBDetId::MAX_IETA; ieta<=EBDetId::MAX_IETA; ++ieta) {
390  if(ieta==0) continue;
391  for(int iphi=EBDetId::MIN_IPHI; iphi<=EBDetId:: MAX_IPHI; ++iphi) {
392  EBDetId ebid(ieta,iphi);
393  xtalGroups->setValue(ebid.rawId(), EcalXtalGroupId(ieta) ); // define rings in eta
394  }
395  }
396  return xtalGroups;
397 }
398 
399 //-------------------------------------------------------------
402 //-------------------------------------------------------------
403 
404  EcalTBWeights* tbwgt = new EcalTBWeights();
405 
406  // create weights for each distinct group ID
407  int nMaxTDC = 10;
408  for(int igrp=-EBDetId::MAX_IETA; igrp<=EBDetId::MAX_IETA; ++igrp) {
409  if(igrp==0) continue;
410  for(int itdc=1; itdc<=nMaxTDC; ++itdc) {
411  // generate random number
412  double r = (double)std::rand()/( double(RAND_MAX)+double(1) );
413 
414  // make a new set of weights
415  EcalWeightSet wgt;
418 
419  for(size_t i=0; i<3; ++i) {
420  for(size_t j=0; j<10; ++j) {
421  double ww = igrp*itdc*r + i*10. + j;
422  //std::cout << "row: " << i << " col: " << j << " - val: " << ww << std::endl;
423  mat1(i,j)=ww;
424  mat2(i,j)=100+ww;
425  }
426  }
427 
428  // fill the chi2 matrcies
429  r = (double)std::rand()/( double(RAND_MAX)+double(1) );
432  for(size_t i=0; i<10; ++i) {
433  for(size_t j=0; j<10; ++j) {
434  double ww = igrp*itdc*r + i*10. + j;
435  mat3(i,j)=1000+ww;
436  mat4(i,j)=1000+100+ww;
437  }
438  }
439 
440  // put the weight in the container
441  tbwgt->setValue(std::make_pair(igrp,itdc), wgt);
442  }
443  }
444  return tbwgt;
445 }
446 
447 
448 
449 //--------------------------------------------------------------
452 //--------------------------------------------------------------
453 
455 
458 
459  // if((m_firstRun == 0 && i_run == 0) || (m_firstRun == 1 && i_run == 1)){
460 
461  std::cout << "First & last run: " << i_run << " " << m_firstRun << " " << m_lastRun << " " << std::endl;
462  if (m_firstRun == i_run && (i_run == 0 || i_run == 1) ) {
463 
464  APDPNpair.p1= (double(1)+1/double(log(exp(1)+double((i_run-m_firstRun)*10))))/double(2);
465  APDPNpair.p2= (double(1)+1/double(log(exp(1)+double((i_run-m_firstRun)*10)+double(10))))/double(2);
466  APDPNpair.p3= double(0);
467  std::cout << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2 << std::endl;
468 
469  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
470  if(iEta==0) continue;
471  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
472  //APDPNpair.p1= double(1);
473  //APDPNpair.p2= double(1);
474 
475  EBDetId ebid(iEta,iPhi);
476  int hi = ebid.hashedIndex();
477 
478  if (hi< static_cast<int>(laser->getLaserMap().size())) {
479  laser->setValue(hi, APDPNpair);
480  } else {
481  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
482  continue;
483  }
484  }
485  }
486 
487  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
488  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
489  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
490 
491  if (!EEDetId::validDetId(iX,iY,1))
492  continue;
493 
494  EEDetId eedetidpos(iX,iY,1);
495  //APDPNpair.p1 = double(1);
496  //APDPNpair.p2 = double(1);
497 
498  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
499  if (hi< static_cast<int>(laser->getLaserMap().size())) {
500  laser->setValue(hi, APDPNpair);
501  } else {
502  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
503  continue;
504  }
505 
506  if (!EEDetId::validDetId(iX,iY,-1))
507  continue;
508 
509  EEDetId eedetidneg(iX,iY,-1);
510  //APDPNpair.p1 = double(1);
511  //APDPNpair.p2 = double(1);
512  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
513  if (hi< static_cast<int>(laser->getLaserMap().size())) {
514  laser->setValue(hi, APDPNpair);
515  } else {
516  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
517  continue;
518  }
519  }
520  }
521 
522  std::cout << std::endl;
523  for(int i=0; i<92; i++){
524  if (i< static_cast<int>(laser->getTimeMap().size())) {
525  TimeStamp.t1 = edm::Timestamp(1380*(i_run-m_firstRun) + 15*i);
526  TimeStamp.t2 = edm::Timestamp(1380*(i_run-m_firstRun + 1) + 15*i);
527  laser->setTime(i, TimeStamp);
528  //std::cout << " Timestamp for " << i << " : " << TimeStamp.t1.value() << " , " << TimeStamp.t2.value() << std::endl;
529  } else {
530  edm::LogError("EcalTestDevDB") << "error with laser Map (time)!" << std::endl;
531  continue;
532  }
533  }
534 
535  }else{
536 
537  APDPNpair.p1= (double(1)+1/double(log(exp(1)+double((i_run-m_firstRun)*10))))/double(2);
538  APDPNpair.p2= (double(1)+1/double(log(exp(1)+double((i_run-m_firstRun)*10)+double(10))))/double(2);
539  APDPNpair.p3= double(0);
540  std::cout << i_run << " " << m_firstRun << " " << APDPNpair.p1 << " " << APDPNpair.p2 << std::endl;
541 
542  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
543  if(iEta==0) continue;
544  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
545  EBDetId ebid(iEta,iPhi);
546  int hi = ebid.hashedIndex();
547 
548  if (hi< static_cast<int>(laser->getLaserMap().size())) {
549  laser->setValue(hi, APDPNpair);
550  } else {
551  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
552  }
553  }
554  }
555  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
556  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
557  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
558 
559  if (!EEDetId::validDetId(iX,iY,1))
560  continue;
561 
562  EEDetId eedetidpos(iX,iY,1);
563  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
564  if (hi< static_cast<int>(laser->getLaserMap().size())) {
565  laser->setValue(hi, APDPNpair);
566  } else {
567  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
568  continue;
569  }
570 
571  if (!EEDetId::validDetId(iX,iY,-1))
572  continue;
573 
574  EEDetId eedetidneg(iX,iY,-1);
575  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
576  if (hi< static_cast<int>(laser->getLaserMap().size())) {
577  laser->setValue(hi, APDPNpair);
578  } else {
579  edm::LogError("EcalTestDevDB") << "error with laser Map (ratio)!" << std::endl;
580  continue;
581  }
582  }
583  }
584 
585  std::cout << std::endl;
586  for(int i=0; i<92; i++){
587  if (i< static_cast<int>(laser->getTimeMap().size())) {
588  TimeStamp.t1 = edm::Timestamp(1380*(i_run-m_firstRun) + 15*i);
589  TimeStamp.t2 = edm::Timestamp(1380*(i_run-m_firstRun + 1) + 15*i);
590  laser->setTime(i, TimeStamp);
591  //std::cout << " Timestamp for " << i << " : " << TimeStamp.t1.value() << " , " << TimeStamp.t2.value() << std::endl;
592  } else {
593  edm::LogError("EcalTestDevDB") << "error with laser Map (time)!" << std::endl;
594  continue;
595  }
596  }
597 
598  }
599 
600  return laser;
601 }
602 
603 
604 //--------------------------------------------------------------
607 //--------------------------------------------------------------
608 
610 
611  EcalLaserAPDPNref APDPNref;
612 
613 
614  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
615  if(iEta==0) continue;
616  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
617  APDPNref=double(1.5);
618  EBDetId ebid(iEta,iPhi);
619 
620  int hi = ebid.hashedIndex();
621  if (hi< static_cast<int>(laser->getMap().size())) {
622  laser->setValue(hi, APDPNref);
623  } else {
624  edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << std::endl;
625  }
626 
627  }
628  }
629 
630  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
631  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
632 
633  if (!EEDetId::validDetId(iX,iY,1))
634  continue;
635 
636  EEDetId eedetidpos(iX,iY,1);
637  APDPNref=double(1.5);
638 
639  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
640  if (hi< static_cast<int>(laser->getMap().size())) {
641  laser->setValue(hi, APDPNref);
642  } else {
643  edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << std::endl;
644  }
645 
646  if (!EEDetId::validDetId(iX,iY,-1))
647  continue;
648 
649  EEDetId eedetidneg(iX,iY,-1);
650  APDPNref=double(1.5);
651 
652  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
653  if (hi< static_cast<int>(laser->getMap().size())) {
654  laser->setValue(hi, APDPNref);
655  } else {
656  edm::LogError("EcalTestDevDB") << "error with laser Map (ref)!" << std::endl;
657  }
658  }
659  }
660 
661  return laser;
662 }
663 
664 //--------------------------------------------------------------
667 //--------------------------------------------------------------
668 
670 
671  EcalLaserAlpha Alpha;
672 
673  for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
674  if(iEta==0) continue;
675  for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
676  Alpha = double(1.55);
677  EBDetId ebid(iEta,iPhi);
678 
679  int hi = ebid.hashedIndex();
680  if (hi< static_cast<int>(laser->getMap().size())) {
681  laser->setValue(hi, Alpha);
682  } else {
683  edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << std::endl;
684  }
685  }
686  }
687 
688  for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
689  for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
690 
691  if (!EEDetId::validDetId(iX,iY,1))
692  continue;
693 
694  EEDetId eedetidpos(iX,iY,1);
695  Alpha = double(1.55);
696 
697  int hi = eedetidpos.hashedIndex() + EBDetId::MAX_HASH + 1;
698  if (hi< static_cast<int>(laser->getMap().size())) {
699  laser->setValue(hi, Alpha);
700  } else {
701  edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << std::endl;
702  }
703 
704  if (!EEDetId::validDetId(iX,iY,-1))
705  continue;
706  EEDetId eedetidneg(iX,iY,-1);
707  Alpha = double(1.55);
708 
709  hi = eedetidneg.hashedIndex() + EBDetId::MAX_HASH + 1;
710  if (hi< static_cast<int>(laser->getMap().size())) {
711  laser->setValue(hi, Alpha);
712  } else {
713  edm::LogError("EcalTestDevDB") << "error with laser Map (alpha)!" << std::endl;
714  }
715  }
716  }
717 
718  return laser;
719 }
RunNumber_t run() const
Definition: EventID.h:39
EcalChi2WeightMatrix & getChi2WeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:31
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
float EcalLaserAlpha
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:86
static const int MIN_IPHI
Definition: EBDetId.h:142
static Timestamp endOfTime()
Definition: Timestamp.h:102
void setValue(uint32_t rawId, const Values &value)
const EventID & eventID() const
Definition: IOVSyncValue.h:42
JetCorrectorParameters::Record record
Definition: classes.h:7
const self & getMap() const
static const int MAX_HASH
Definition: EBDetId.h:157
EcalLaserAlphas * generateEcalLaserAlphas()
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
EcalCondObjectContainer< EcalXtalGroupId > EcalWeightXtalGroups
EcalLaserAPDPNRatiosRefMap EcalLaserAPDPNRatiosRef
std::map< std::string, std::string > m_records
Definition: EcalTestDevDB.h:64
void setValue(const EcalXtalGroupId &groupId, const EcalTDCId &tdcId, const EcalWeightSet &weight)
EcalLaserAPDPNRatiosRef * generateEcalLaserAPDPNRatiosRef()
EcalTimeDependentCorrections EcalLinearCorrections
static const int IX_MIN
Definition: EEDetId.h:294
unsigned long m_lastRun
Definition: EcalTestDevDB.h:66
void setTime(int hashedIndex, const Times &value)
float EcalLaserAPDPNref
static const int IY_MIN
Definition: EEDetId.h:298
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
void setGain12Over6(const float &g)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
void setValue(const uint32_t id, const Item &item)
EcalTestDevDB(const edm::ParameterSet &iConfig)
const EcalLaserAPDPNRatiosMap & getLaserMap() const
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
void setTime(int hashedIndex, const EcalLaserTimeStamp &value)
vector< ParameterSet > Parameters
EcalGainRatioMap EcalGainRatios
bool isNewTagRequest(const std::string &recordName)
EcalLaserAlphaMap EcalLaserAlphas
bool isAvailable() const
Definition: Service.h:46
int j
Definition: DBlmapReader.cc:9
EcalChi2WeightMatrix & getChi2WeightsAfterGainSwitch()
Definition: EcalWeightSet.h:32
EcalWeightXtalGroups * generateEcalWeightXtalGroups()
EcalLinearCorrections * generateEcalLinearCorrections()
EcalLaserAPDPNRatios * generateEcalLaserAPDPNRatios(uint32_t i_run)
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:30
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void insert(std::pair< uint32_t, Item > const &a)
unsigned int m_interval
Definition: EcalTestDevDB.h:67
math::Matrix< 10, 10 >::type EcalChi2WeightMatrix
Definition: EcalWeightSet.h:23
static const int IX_MAX
Definition: EEDetId.h:302
EcalPedestalsMap EcalPedestals
Definition: EcalPedestals.h:53
unsigned long m_firstRun
Definition: EcalTestDevDB.h:65
int hashedIndex() const
Definition: EEDetId.h:182
static const int MAX_IPHI
Definition: EBDetId.h:144
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:29
const EcalLaserTimeStampMap & getTimeMap() const
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
EcalTBWeights * generateEcalTBWeights()
static const int MAX_IETA
Definition: EBDetId.h:143
void setValue(uint32_t rawId, const EcalLaserAPDPNpair &value)
EcalIntercalibConstantMap EcalIntercalibConstants
EcalGainRatios * generateEcalGainRatios()
virtual void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup)
Signal rand(Signal arg)
Definition: vlib.cc:442
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:22
EcalPedestals * generateEcalPedestals()
EcalADCToGeVConstant * generateEcalADCToGeVConstant()
tuple cout
Definition: gather_cfg.py:121
static const int IY_MAX
Definition: EEDetId.h:306
std::map< std::string, unsigned long long > m_cacheIDs
Definition: EcalTestDevDB.h:63
void setGain6Over1(const float &g)
EcalIntercalibConstants * generateEcalIntercalibConstants()
tuple log
Definition: cmsBatch.py:341