CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalTrigPrimESProducer.cc
Go to the documentation of this file.
1 // user include files
3 
4 #include <iostream>
5 #include <fstream>
6 #include <TMath.h>
7 #include <sstream>
8 
10 
11 //
12 // input stream from a gz file
13 //
14 
16  {
17  gzFile gzf;
18  char buffer[256] ;
19  std::istringstream iss ;
20  bool eof ;
21  GzInputStream( const char * file )
22  : eof(false)
23  {
24  gzf = gzopen(file,"rb") ;
25  if (gzf==Z_NULL)
26  {
27  eof = true ;
28  edm::LogWarning("EcalTPG") <<"Database file "<<file<<" not found!!!";
29  }
30  else readLine() ;
31  }
32  void readLine()
33  {
34  char * res = gzgets(gzf,buffer,256) ;
35  eof = (res==Z_NULL) ;
36  if (!eof)
37  {
38  iss.clear() ;
39  iss.str(buffer) ;
40  }
41  }
43  { gzclose(gzf) ; }
44  operator void*()
45  { return ((eof==true)?((void*)0):iss) ; }
46  } ;
47 
48 template <typename T>
50  {
51  while ((gis)&&(!(gis.iss>>var)))
52  { gis.readLine() ; }
53  return gis ;
54  }
55 
56 
57 //
58 // constructors and destructor
59 //
60 
62  dbFilename_(iConfig.getUntrackedParameter<std::string>("DatabaseFile","")),
63  flagPrint_(iConfig.getParameter<bool>("WriteInFile"))
64 {
65  //the following line is needed to tell the framework what
66  // data is being produced
83  //now do what ever other initialization is needed
84 }
85 
86 
88 {
89 }
90 
91 //
92 // member functions
93 //
94 
95 // ------------ method called to produce the data ------------
96 
97 
98 std::auto_ptr<EcalTPGPedestals> EcalTrigPrimESProducer::producePedestals(const EcalTPGPedestalsRcd & iRecord)
99 {
100  std::auto_ptr<EcalTPGPedestals> prod(new EcalTPGPedestals());
101  parseTextFile() ;
102  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
103  for (it = mapXtal_.begin() ; it != mapXtal_.end() ; it++) {
104  EcalTPGPedestal item ;
105  item.mean_x12 = (it->second)[0] ;
106  item.mean_x6 = (it->second)[3] ;
107  item.mean_x1 = (it->second)[6] ;
108  prod->setValue(it->first,item) ;
109  }
110  return prod;
111 }
112 
113 std::auto_ptr<EcalTPGLinearizationConst> EcalTrigPrimESProducer::produceLinearizationConst(const EcalTPGLinearizationConstRcd & iRecord)
114 {
115  std::auto_ptr<EcalTPGLinearizationConst> prod(new EcalTPGLinearizationConst());
116  parseTextFile() ;
117  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
118  for (it = mapXtal_.begin() ; it != mapXtal_.end() ; it++) {
120  item.mult_x12 = (it->second)[1] ;
121  item.mult_x6 = (it->second)[4] ;
122  item.mult_x1 = (it->second)[7] ;
123  item.shift_x12 = (it->second)[2] ;
124  item.shift_x6 = (it->second)[5] ;
125  item.shift_x1 = (it->second)[8] ;
126  prod->setValue(it->first,item) ;
127  }
128  return prod;
129 }
130 
131 std::auto_ptr<EcalTPGSlidingWindow> EcalTrigPrimESProducer::produceSlidingWindow(const EcalTPGSlidingWindowRcd & iRecord)
132 {
133  std::auto_ptr<EcalTPGSlidingWindow> prod(new EcalTPGSlidingWindow());
134  parseTextFile() ;
135  for (int subdet=0 ; subdet<2 ; subdet++) {
136  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
137  for (it = mapStrip_[subdet].begin() ; it != mapStrip_[subdet].end() ; it++) {
138  prod->setValue(it->first,(it->second)[0]) ;
139  }
140  }
141  return prod;
142 }
143 
144 std::auto_ptr<EcalTPGFineGrainEBIdMap> EcalTrigPrimESProducer::produceFineGrainEB(const EcalTPGFineGrainEBIdMapRcd & iRecord)
145 {
146  std::auto_ptr<EcalTPGFineGrainEBIdMap> prod(new EcalTPGFineGrainEBIdMap());
147  parseTextFile() ;
149  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
150  for (it = mapFg_.begin() ; it != mapFg_.end() ; it++) {
151  fg.setValues((it->second)[0], (it->second)[1], (it->second)[2], (it->second)[3], (it->second)[4]) ;
152  prod->setValue(it->first,fg) ;
153  }
154  return prod;
155 }
156 
157 std::auto_ptr<EcalTPGFineGrainStripEE> EcalTrigPrimESProducer::produceFineGrainEEstrip(const EcalTPGFineGrainStripEERcd & iRecord)
158 {
159  std::auto_ptr<EcalTPGFineGrainStripEE> prod(new EcalTPGFineGrainStripEE());
160  parseTextFile() ;
161  // EE Strips
162  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
163  for (it = mapStrip_[1].begin() ; it != mapStrip_[1].end() ; it++) {
165  item.threshold = (it->second)[2] ;
166  item.lut = (it->second)[3] ;
167  prod->setValue(it->first,item) ;
168  }
169  // EB Strips
170  for (it = mapStrip_[0].begin() ; it != mapStrip_[0].end() ; it++) {
172  item.threshold = (it->second)[2] ;
173  item.lut = (it->second)[3] ;
174  prod->setValue(it->first,item) ;
175  }
176  return prod;
177 }
178 
179 std::auto_ptr<EcalTPGFineGrainTowerEE> EcalTrigPrimESProducer::produceFineGrainEEtower(const EcalTPGFineGrainTowerEERcd & iRecord)
180 {
181  std::auto_ptr<EcalTPGFineGrainTowerEE> prod(new EcalTPGFineGrainTowerEE());
182  parseTextFile() ;
183  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
184  for (it = mapTower_[1].begin() ; it != mapTower_[1].end() ; it++) {
185  prod->setValue(it->first,(it->second)[1]) ;
186  }
187  return prod;
188 }
189 
190 std::auto_ptr<EcalTPGLutIdMap> EcalTrigPrimESProducer::produceLUT(const EcalTPGLutIdMapRcd & iRecord)
191 {
192  std::auto_ptr<EcalTPGLutIdMap> prod(new EcalTPGLutIdMap());
193  parseTextFile() ;
194  EcalTPGLut lut ;
195  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
196  for (it = mapLut_.begin() ; it != mapLut_.end() ; it++) {
197  unsigned int lutArray[1024] ;
198  for (int i=0 ; i <1024 ; i++) lutArray[i] = (it->second)[i] ;
199  lut.setLut(lutArray) ;
200  prod->setValue(it->first,lut) ;
201  }
202  return prod;
203 }
204 
205 std::auto_ptr<EcalTPGWeightIdMap> EcalTrigPrimESProducer::produceWeight(const EcalTPGWeightIdMapRcd & iRecord)
206 {
207  std::auto_ptr<EcalTPGWeightIdMap> prod(new EcalTPGWeightIdMap());
208  parseTextFile() ;
210  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
211  for (it = mapWeight_.begin() ; it != mapWeight_.end() ; it++) {
212  weights.setValues((it->second)[0],
213  (it->second)[1],
214  (it->second)[2],
215  (it->second)[3],
216  (it->second)[4]) ;
217  prod->setValue(it->first,weights) ;
218  }
219  return prod;
220 }
221 
222 std::auto_ptr<EcalTPGWeightGroup> EcalTrigPrimESProducer::produceWeightGroup(const EcalTPGWeightGroupRcd & iRecord)
223 {
224  std::auto_ptr<EcalTPGWeightGroup> prod(new EcalTPGWeightGroup());
225  parseTextFile() ;
226  for (int subdet=0 ; subdet<2 ; subdet++) {
227  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
228  for (it = mapStrip_[subdet].begin() ; it != mapStrip_[subdet].end() ; it++) {
229  prod->setValue(it->first,(it->second)[1]) ;
230  }
231  }
232  return prod;
233 }
234 
235 std::auto_ptr<EcalTPGLutGroup> EcalTrigPrimESProducer::produceLutGroup(const EcalTPGLutGroupRcd & iRecord)
236 {
237  std::auto_ptr<EcalTPGLutGroup> prod(new EcalTPGLutGroup());
238  parseTextFile() ;
239  for (int subdet=0 ; subdet<2 ; subdet++) {
240  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
241  for (it = mapTower_[subdet].begin() ; it != mapTower_[subdet].end() ; it++) {
242  prod->setValue(it->first,(it->second)[0]) ;
243  }
244  }
245  return prod;
246 }
247 
248 std::auto_ptr<EcalTPGFineGrainEBGroup> EcalTrigPrimESProducer::produceFineGrainEBGroup(const EcalTPGFineGrainEBGroupRcd & iRecord)
249 {
250  std::auto_ptr<EcalTPGFineGrainEBGroup> prod(new EcalTPGFineGrainEBGroup());
251  parseTextFile() ;
252  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
253  for (it = mapTower_[0].begin() ; it != mapTower_[0].end() ; it++) {
254  prod->setValue(it->first,(it->second)[1]) ;
255  }
256  return prod;
257 }
258 
259 std::auto_ptr<EcalTPGPhysicsConst> EcalTrigPrimESProducer::producePhysicsConst(const EcalTPGPhysicsConstRcd & iRecord)
260 {
261  std::auto_ptr<EcalTPGPhysicsConst> prod(new EcalTPGPhysicsConst());
262  parseTextFile() ;
263  std::map<uint32_t, std::vector<float> >::const_iterator it ;
264  for (it = mapPhys_.begin() ; it != mapPhys_.end() ; it++) {
266  item.EtSat = (it->second)[0] ;
267  item.ttf_threshold_Low = (it->second)[1] ;
268  item.ttf_threshold_High = (it->second)[2] ;
269  item.FG_lowThreshold = (it->second)[3] ;
270  item.FG_highThreshold = (it->second)[4] ;
271  item.FG_lowRatio = (it->second)[5] ;
272  item.FG_highRatio = (it->second)[6] ;
273  prod->setValue(it->first,item) ;
274  }
275  return prod;
276 }
277 
278 std::auto_ptr<EcalTPGCrystalStatus> EcalTrigPrimESProducer::produceBadX(const EcalTPGCrystalStatusRcd & iRecord)
279 {
280  std::auto_ptr<EcalTPGCrystalStatus> prod(new EcalTPGCrystalStatus());
281  parseTextFile() ;
282  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
283  for (it = mapXtal_.begin() ; it != mapXtal_.end() ; it++) {
284 
285  EcalTPGCrystalStatusCode badXValue;
286  badXValue.setStatusCode(0);
287  prod->setValue(it->first,badXValue) ;
288  }
289  return prod;
290 
291 }
292 
293 std::auto_ptr<EcalTPGStripStatus> EcalTrigPrimESProducer::produceBadStrip(const EcalTPGStripStatusRcd & iRecord)
294 {
295  std::auto_ptr<EcalTPGStripStatus> prod(new EcalTPGStripStatus());
296  // returns an empty map
297  return prod;
298 
299 }
300 
301 std::auto_ptr<EcalTPGTowerStatus> EcalTrigPrimESProducer::produceBadTT(const EcalTPGTowerStatusRcd & iRecord)
302 {
303  std::auto_ptr<EcalTPGTowerStatus> prod(new EcalTPGTowerStatus());
304  parseTextFile() ;
305  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
306  //Barrel
307  for (it = mapTower_[0].begin() ; it != mapTower_[0].end() ; it++) {
308  //set the BadTT status to 0
309  prod->setValue(it->first,0) ;
310  }
311  //Endcap
312  for (it = mapTower_[1].begin() ; it != mapTower_[1].end() ; it++) {
313  //set the BadTT status to 0
314  prod->setValue(it->first,0) ;
315  }
316 
317  return prod;
318 }
319 
320 std::auto_ptr<EcalTPGSpike> EcalTrigPrimESProducer::produceSpike(const EcalTPGSpikeRcd &iRecord)
321 {
322  std::auto_ptr<EcalTPGSpike> prod(new EcalTPGSpike());
323  parseTextFile();
324  // Only need to do barrel
325  std::map<uint32_t, std::vector<uint32_t> >::const_iterator it;
326  for(it = mapTower_[0].begin(); it != mapTower_[0].end(); ++it)
327  {
328  prod->setValue(it->first, (it->second)[2]);
329  }
330  return prod;
331 }
332 
334 {
335  if (mapXtal_.size() != 0) return ; // just parse the file once!
336 
337  uint32_t id ;
338  std::string dataCard ;
340  std::ifstream infile ;
341  std::vector<unsigned int> param ;
342  std::vector<float> paramF ;
343  int NBstripparams[2] = {4, 4} ;
344  unsigned int data ;
345  float dataF ;
346 
347  std::string bufString;
348  std::string iString;
349  std::string fString;
350  std::string filename = "SimCalorimetry/EcalTrigPrimProducers/data/"+dbFilename_;
351  std::string finalFileName ;
352  size_t slash=dbFilename_.find("/");
353  if (slash!=0) {
354  edm::FileInPath fileInPath(filename);
355  finalFileName = fileInPath.fullPath() ;
356  }
357  else {
358  finalFileName = dbFilename_.c_str() ;
359  edm::LogWarning("EcalTPG") <<"Couldnt find database file via fileinpath, trying with pathname directly!!";
360  }
361 
362 
363  int k=0;
364 
365  GzInputStream gis(finalFileName.c_str()) ;
366  while (gis>>dataCard) {
367 
368  if (dataCard == "PHYSICS_EB" || dataCard == "PHYSICS_EE") {
369  gis>>std::dec>>id ;
370 
371  if (flagPrint_){
372  std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
373  }
374 
375  paramF.clear() ;
376 
377  std::string st1;
378  std::string st2;
379 
380  for (int i=0 ; i <7 ; i++) {
381  gis>>std::dec>>dataF ;
382  paramF.push_back(dataF) ;
383 
384  //std::cout<<", "<<std::dec<<dataF ;
385  if (flagPrint_){
386  //---------------------------------
387  if (i < 3){
388  std::ostringstream oss;
389  oss << dataF;
390  std::string result1 = oss.str();
391 
392  st1.append(result1);
393  if (i != 2)
394  st1.append(" ");
395  }
396 
397  if (i > 2){
398  std::ostringstream oss;
399  oss << dataF;
400  std::string result2 = oss.str();
401 
402  st2.append(result2);
403  if (i != 6)
404  st2.append(" ");
405  }
406  //----------------------------------
407  }
408  }
409 
410  if (flagPrint_){
411  std::cout << "" << st1 << std::endl;
412  std::cout << "" << st2 << std::endl;
413  std::cout << ""<< std::endl;
414  }
415 
416  //std::cout<<std::endl ;
417  mapPhys_[id] = paramF ;
418  }
419 
420  if (dataCard == "CRYSTAL") {
421 
422  gis>>std::dec>>id ;
423  //std::cout<<dataCard<<" "<<std::dec<<id;
424  std::string st3;
425  std::string st4;
426  std::string st5;
427 
428  if(flagPrint_){
429  //Print this comment only one time
430  if(k==0)
431  std::cout << "COMMENT ====== barrel crystals ====== " <<std::endl;
432 
433  if (k==61200)
434  std::cout << "COMMENT ====== endcap crystals ====== " <<std::endl;
435 
436  k=k+1;
437 
438  std::cout<<dataCard<<" "<<std::dec<<id << std::endl;
439  }
440 
441  param.clear() ;
442  for (int i=0 ; i <9 ; i++) {
443  gis>>std::hex>>data ;
444  //std::cout<<", "<<std::hex<<data ;
445  param.push_back(data);
446 
447  if(flagPrint_){
448  if (i<3){
449  std::ostringstream oss;
450  oss << std::hex<< data;
451  std::string result1 = oss.str();
452 
453  st3.append("0x");
454  st3.append(result1);
455  if (i !=2)
456  st3.append(" ");
457 
458  }else if(i>2 && i<6){
459  std::ostringstream oss;
460  oss << std::hex << data;
461  std::string result2 = oss.str();
462 
463  st4.append("0x");
464  st4.append(result2);
465  if (i != 5)
466  st4.append(" ");
467  }else if(i>5 && i<9){
468  std::ostringstream oss;
469  oss << std::hex<< data;
470  std::string result3 = oss.str();
471 
472  st5.append("0x");
473  st5.append(result3);
474  if (i != 8)
475  st5.append(" ");
476  }
477  }
478 
479  }//end for
480 
481  if(flagPrint_){
482  std::cout << " " << st3 << std::endl;
483  std::cout << " " << st4 << std::endl;
484  std::cout << " " << st5 << std::endl;
485  }
486 
487  //std::cout<<std::endl ;
488  mapXtal_[id] = param ;
489  }
490 
491  if (dataCard == "STRIP_EB") {
492  gis>>std::dec>>id ;
493 
494  std::string st1;
495 
496  if(flagPrint_)
497  std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
498 
499  param.clear() ;
500  for (int i=0 ; i <NBstripparams[0] ; i++) {
501  gis>>std::hex>>data ;
502  //std::cout << " data = " << data << std::endl;
503  param.push_back(data);
504 
505  if(flagPrint_){
506  if (i==0){
507  std::cout<<"0x"<<std::hex<< data << std::endl;
508  }
509  else if (i==1){
510  std::cout<<""<<std::hex<< data << std::endl;
511  }
512  else if (i>1){
513  std::ostringstream oss;
514  if (i==2){
515  oss<<"0x"<<std::hex<<data;
516  std::string result4 = oss.str();
517  st1.append(result4);
518  }else if(i==3){
519  std::ostringstream oss;
520  oss<<" 0x"<<std::hex<<data;
521  std::string result5 = oss.str();
522 
523  st1.append(result5);
524  std::cout<< "" << st1 << std::endl;
525  }
526  }
527  }
528  }
529 
530  //std::cout<<std::endl ;
531  mapStrip_[0][id] = param ;
532  }
533 
534  if (dataCard == "STRIP_EE") {
535  gis>>std::dec>>id ;
536 
537  std::string st6;
538 
539  if(flagPrint_){
540  std::cout<<dataCard<<" "<<std::dec<<id << std::endl;
541  }
542 
543  param.clear() ;
544  for (int i=0 ; i <NBstripparams[1] ; i++) {
545  gis>>std::hex>>data ;
546  param.push_back(data);
547 
548  if(flagPrint_){
549  if (i==0){
550  std::cout<<"0x"<<std::hex<<data << std::endl;
551  }else if (i==1){
552  std::cout<<" "<<std::hex<<data<< std::endl;
553  }else if (i>1){
554  std::ostringstream oss;
555  if (i==2){
556  oss<<"0x"<<std::hex<<data;
557  std::string result4 = oss.str();
558  st6.append(result4);
559  }else if(i==3){
560  std::ostringstream oss;
561  oss<<" 0x"<<std::hex<<data;
562  std::string result5 = oss.str();
563 
564  st6.append(result5);
565  std::cout<< "" << st6 << std::endl;
566  }
567  }
568  }
569  }
570 
571  //std::cout<<std::endl ;
572  mapStrip_[1][id] = param ;
573  }
574 
575  if(dataCard == "TOWER_EE"){
576  gis>>std::dec>>id ;
577 
578  if(flagPrint_)
579  std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
580 
581  param.clear() ;
582  for (int i=0 ; i <2 ; i++) {
583  gis>>std::hex>>data ;
584  param.push_back(data);
585 
586  if(flagPrint_){
587  if(i==1){
588  std::cout << "0x" <<std::dec<<data << std::endl;
589  }else{
590  std::cout << " " <<std::dec<<data << std::endl;
591  }
592  }
593  }
594 
595  //std::cout<<std::endl ;
596  mapTower_[1][id] = param ;
597  }
598 
599  if (dataCard == "TOWER_EB") {
600  gis>>std::dec>>id ;
601 
602  if(flagPrint_)
603  std::cout<<dataCard<<" "<<std::dec<<id << std::endl;
604 
605  param.clear() ;
606  for (int i=0 ; i <3 ; i++) {
607  gis>>std::dec>>data ;
608 
609  if(flagPrint_){
610  std::cout << " " << std::dec << data << std::endl;
611  }
612 
613  param.push_back(data) ;
614  }
615 
616  //std::cout<<std::endl ;
617  mapTower_[0][id] = param ;
618  }
619 
620  if (dataCard == "WEIGHT") {
621 
622  if(flagPrint_)
623  std::cout<<std::endl;
624 
625  gis>>std::hex>>id ;
626  if(flagPrint_){
627  std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
628  }
629 
630  param.clear() ;
631 
632  std::string st6;
633  for (int i=0 ; i <5 ; i++) {
634  gis>>std::hex>>data ;
635  param.push_back(data);
636 
637  if(flagPrint_){
638  std::ostringstream oss;
639  oss << std::hex<< data;
640  std::string result4 = oss.str();
641 
642  st6.append("0x");
643  st6.append(result4);
644  st6.append(" ");
645  }
646 
647  }
648 
649  if(flagPrint_){
650  std::cout << st6 << std::endl;
651  std::cout<<std::endl;
652  }
653 
654  //std::cout<<std::endl ;
655  mapWeight_[id] = param ;
656  }
657 
658  if (dataCard == "FG") {
659 
660  if(flagPrint_)
661  std::cout <<std::endl;
662 
663  gis>>std::hex>>id ;
664  if(flagPrint_)
665  std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
666 
667  param.clear() ;
668  std::string st7;
669  for (int i=0 ; i <5 ; i++) {
670  gis>>std::hex>>data ;
671  param.push_back(data);
672 
673  if(flagPrint_){
674  std::ostringstream oss;
675  oss << std::hex<< data;
676 
677  std::string result5 = oss.str();
678 
679  st7.append("0x");
680  st7.append(result5);
681  if (i != 4)
682  st7.append(" ");
683  }
684  }
685 
686  if(flagPrint_){
687  std::cout << st7 << std::endl;
688  std::cout<<std::endl ;
689  }
690 
691  mapFg_[id] = param ;
692  }
693 
694  if (dataCard == "LUT") {
695  gis>>std::hex>>id ;
696 
697  if(flagPrint_)
698  std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
699 
700  param.clear() ;
701  for (int i=0 ; i <1024 ; i++) {
702  gis>>std::hex>>data ;
703  param.push_back(data);
704 
705  if(flagPrint_){
706  std::cout<<"0x"<<std::hex<<data <<std::endl;
707  }
708  }
709 
710  if(flagPrint_)
711  std::cout<<std::endl ;
712  std::cout<<std::endl ;
713 
714  mapLut_[id] = param ;
715  }
716  }
717 }
718 
719 std::vector<int> EcalTrigPrimESProducer::getRange(int subdet, int tccNb, int towerNbInTcc, int stripNbInTower, int xtalNbInStrip)
720 {
721  std::vector<int> range ;
722  if (subdet == 0) {
723  // Barrel
724  range.push_back(37) ; // stccNbMin
725  range.push_back(73) ; // tccNbMax
726  range.push_back(1) ; // towerNbMin
727  range.push_back(69) ; // towerNbMax
728  range.push_back(1) ; // stripNbMin
729  range.push_back(6) ; // stripNbMax
730  range.push_back(1) ; // xtalNbMin
731  range.push_back(6) ; // xtalNbMax
732  } else {
733  // Endcap eta >0
734  if (subdet >0 ) {
735  range.push_back(73) ; // tccNbMin
736  range.push_back(109) ; // tccNbMax
737  } else { //endcap eta <0
738  range.push_back(1) ; // tccNbMin
739  range.push_back(37) ; // tccNbMax
740  }
741  range.push_back(1) ; // towerNbMin
742  range.push_back(29) ; // towerNbMax
743  range.push_back(1) ; // stripNbMin
744  range.push_back(6) ; // stripNbMax
745  range.push_back(1) ; // xtalNbMin
746  range.push_back(6) ; // xtalNbMax
747  }
748 
749  if (tccNb>0) {
750  range[0] = tccNb ;
751  range[1] = tccNb+1 ;
752  }
753  if (towerNbInTcc>0) {
754  range[2] = towerNbInTcc ;
755  range[3] = towerNbInTcc+1 ;
756  }
757  if (stripNbInTower>0) {
758  range[4] = stripNbInTower ;
759  range[5] = stripNbInTower+1 ;
760  }
761  if (xtalNbInStrip>0) {
762  range[6] = xtalNbInStrip ;
763  range[7] = xtalNbInStrip+1 ;
764  }
765 
766  return range ;
767 }
768 
769 // bool EcalTrigPrimESProducer::getNextString(gzFile &gzf){
770 // size_t blank;
771 // if (bufpos_==0) {
772 // gzgets(gzf,buf_,80);
773 // if (gzeof(gzf)) return true;
774 // bufString_=std::string(buf_);
775 // }
776 // int pos=0;
777 // pos =bufpos_;
778 // // look for next non-blank
779 // while (pos<bufString_.size()) {
780 // if (!bufString_.compare(pos,1," ")) pos++;
781 // else break;
782 // }
783 // blank=bufString_.find(" ",pos);
784 // size_t end = blank;
785 // if (blank==std::string::npos) end=bufString_.size();
786 // sub_=bufString_.substr(pos,end-pos);
787 // bufpos_= blank;
788 // if (blank==std::string::npos) bufpos_=0;
789 // return false;
790 // }
791 //
792 // int EcalTrigPrimESProducer::converthex() {
793 // // converts hex dec string sub to hexa
794 // //FIXME:: find something better (istrstream?)!!!!
795 //
796 // std::string chars("0123456789abcdef");
797 // int hex=0;
798 // for (size_t i=2;i<sub_.length();++i) {
799 // size_t f=chars.find(sub_[i]);
800 // if (f==std::string::npos) break; //FIXME: length is 4 for 0x3!!
801 // hex=hex*16+chars.find(sub_[i]);
802 // }
803 // return hex;
804 // }
int i
Definition: DBlmapReader.cc:9
std::vector< int > getRange(int subdet, int smNb, int towerNbInSm, int stripNbInTower=0, int xtalNbInStrip=0)
std::auto_ptr< EcalTPGLutGroup > produceLutGroup(const EcalTPGLutGroupRcd &)
void setValues(const uint32_t &ThresholdETLow, const uint32_t &ThresholdETHigh, const uint32_t &RatioLow, const uint32_t &RatioHigh, const uint32_t &LUT)
std::auto_ptr< EcalTPGTowerStatus > produceBadTT(const EcalTPGTowerStatusRcd &)
std::map< uint32_t, std::vector< uint32_t > > mapTower_[2]
std::auto_ptr< EcalTPGSpike > produceSpike(const EcalTPGSpikeRcd &)
void setLut(const unsigned int *lut)
Definition: EcalTPGLut.cc:20
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::auto_ptr< EcalTPGStripStatus > produceBadStrip(const EcalTPGStripStatusRcd &)
void setStatusCode(const uint16_t &val)
std::map< uint32_t, std::vector< uint32_t > > mapXtal_
std::auto_ptr< EcalTPGFineGrainTowerEE > produceFineGrainEEtower(const EcalTPGFineGrainTowerEERcd &)
std::auto_ptr< EcalTPGCrystalStatus > produceBadX(const EcalTPGCrystalStatusRcd &)
EcalTPGCrystalStatusMap EcalTPGCrystalStatus
tuple lut
Definition: lumiPlot.py:244
std::auto_ptr< EcalTPGFineGrainStripEE > produceFineGrainEEstrip(const EcalTPGFineGrainStripEERcd &)
std::map< uint32_t, std::vector< uint32_t > > mapWeight_
std::auto_ptr< EcalTPGFineGrainEBIdMap > produceFineGrainEB(const EcalTPGFineGrainEBIdMapRcd &)
std::auto_ptr< EcalTPGSlidingWindow > produceSlidingWindow(const EcalTPGSlidingWindowRcd &)
std::auto_ptr< EcalTPGPedestals > producePedestals(const EcalTPGPedestalsRcd &)
EcalTrigPrimESProducer(const edm::ParameterSet &)
std::auto_ptr< EcalTPGLinearizationConst > produceLinearizationConst(const EcalTPGLinearizationConstRcd &)
std::map< uint32_t, std::vector< uint32_t > > mapFg_
GzInputStream(const char *file)
std::auto_ptr< EcalTPGLutIdMap > produceLUT(const EcalTPGLutIdMapRcd &)
std::istream & operator>>(std::istream &input, CLHEP::HepGenMatrix &matrix)
Definition: matrixSaver.cc:111
std::map< uint32_t, std::vector< float > > mapPhys_
#define begin
Definition: vmac.h:30
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::auto_ptr< EcalTPGWeightGroup > produceWeightGroup(const EcalTPGWeightGroupRcd &)
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
volatile std::atomic< bool > shutdown_flag false
std::string fullPath() const
Definition: FileInPath.cc:165
void setValues(const uint32_t &w0, const uint32_t &w1, const uint32_t &w2, const uint32_t &w3, const uint32_t &w4)
std::map< uint32_t, std::vector< uint32_t > > mapLut_
EcalTPGPedestalsMap EcalTPGPedestals
std::auto_ptr< EcalTPGPhysicsConst > producePhysicsConst(const EcalTPGPhysicsConstRcd &)
long double T
std::auto_ptr< EcalTPGFineGrainEBGroup > produceFineGrainEBGroup(const EcalTPGFineGrainEBGroupRcd &)
std::auto_ptr< EcalTPGWeightIdMap > produceWeight(const EcalTPGWeightIdMapRcd &)
std::map< uint32_t, std::vector< uint32_t > > mapStrip_[2]
std::istringstream iss
EcalTPGLinearizationConstMap EcalTPGLinearizationConst