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