00001
00002 #include "EcalTrigPrimESProducer.h"
00003
00004 #include <iostream>
00005 #include <fstream>
00006 #include <TMath.h>
00007 #include <sstream>
00008
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010
00011
00012
00013
00014
00015 struct GzInputStream
00016 {
00017 gzFile gzf;
00018 char buffer[256] ;
00019 std::istringstream iss ;
00020 bool eof ;
00021 GzInputStream( const char * file )
00022 : eof(false)
00023 {
00024 gzf = gzopen(file,"rb") ;
00025 if (gzf==Z_NULL)
00026 {
00027 eof = true ;
00028 edm::LogWarning("EcalTPG") <<"Database file "<<file<<" not found!!!";
00029 }
00030 else readLine() ;
00031 }
00032 void readLine()
00033 {
00034 char * res = gzgets(gzf,buffer,256) ;
00035 eof = (res==Z_NULL) ;
00036 if (!eof)
00037 {
00038 iss.clear() ;
00039 iss.str(buffer) ;
00040 }
00041 }
00042 ~GzInputStream()
00043 { gzclose(gzf) ; }
00044 operator void*()
00045 { return ((eof==true)?((void*)0):iss) ; }
00046 } ;
00047
00048 template <typename T>
00049 GzInputStream & operator>>( GzInputStream & gis, T & var )
00050 {
00051 while ((gis)&&(!(gis.iss>>var)))
00052 { gis.readLine() ; }
00053 return gis ;
00054 }
00055
00056
00057
00058
00059
00060
00061 EcalTrigPrimESProducer::EcalTrigPrimESProducer(const edm::ParameterSet& iConfig) :
00062 dbFilename_(iConfig.getUntrackedParameter<std::string>("DatabaseFile","")),
00063 flagPrint_(iConfig.getParameter<bool>("WriteInFile"))
00064 {
00065
00066
00067 setWhatProduced(this, &EcalTrigPrimESProducer::producePedestals) ;
00068 setWhatProduced(this, &EcalTrigPrimESProducer::produceLinearizationConst) ;
00069 setWhatProduced(this, &EcalTrigPrimESProducer::produceSlidingWindow) ;
00070 setWhatProduced(this, &EcalTrigPrimESProducer::produceFineGrainEB) ;
00071 setWhatProduced(this, &EcalTrigPrimESProducer::produceFineGrainEEstrip) ;
00072 setWhatProduced(this, &EcalTrigPrimESProducer::produceFineGrainEEtower) ;
00073 setWhatProduced(this, &EcalTrigPrimESProducer::produceLUT) ;
00074 setWhatProduced(this, &EcalTrigPrimESProducer::produceWeight) ;
00075 setWhatProduced(this, &EcalTrigPrimESProducer::produceWeightGroup) ;
00076 setWhatProduced(this, &EcalTrigPrimESProducer::produceLutGroup) ;
00077 setWhatProduced(this, &EcalTrigPrimESProducer::produceFineGrainEBGroup) ;
00078 setWhatProduced(this, &EcalTrigPrimESProducer::producePhysicsConst) ;
00079 setWhatProduced(this, &EcalTrigPrimESProducer::produceBadX) ;
00080 setWhatProduced(this, &EcalTrigPrimESProducer::produceBadStrip) ;
00081 setWhatProduced(this, &EcalTrigPrimESProducer::produceBadTT) ;
00082 setWhatProduced(this, &EcalTrigPrimESProducer::produceSpike) ;
00083
00084 }
00085
00086
00087 EcalTrigPrimESProducer::~EcalTrigPrimESProducer()
00088 {
00089 }
00090
00091
00092
00093
00094
00095
00096
00097
00098 std::auto_ptr<EcalTPGPedestals> EcalTrigPrimESProducer::producePedestals(const EcalTPGPedestalsRcd & iRecord)
00099 {
00100 std::auto_ptr<EcalTPGPedestals> prod(new EcalTPGPedestals());
00101 parseTextFile() ;
00102 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00103 for (it = mapXtal_.begin() ; it != mapXtal_.end() ; it++) {
00104 EcalTPGPedestal item ;
00105 item.mean_x12 = (it->second)[0] ;
00106 item.mean_x6 = (it->second)[3] ;
00107 item.mean_x1 = (it->second)[6] ;
00108 prod->setValue(it->first,item) ;
00109 }
00110 return prod;
00111 }
00112
00113 std::auto_ptr<EcalTPGLinearizationConst> EcalTrigPrimESProducer::produceLinearizationConst(const EcalTPGLinearizationConstRcd & iRecord)
00114 {
00115 std::auto_ptr<EcalTPGLinearizationConst> prod(new EcalTPGLinearizationConst());
00116 parseTextFile() ;
00117 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00118 for (it = mapXtal_.begin() ; it != mapXtal_.end() ; it++) {
00119 EcalTPGLinearizationConstant item ;
00120 item.mult_x12 = (it->second)[1] ;
00121 item.mult_x6 = (it->second)[4] ;
00122 item.mult_x1 = (it->second)[7] ;
00123 item.shift_x12 = (it->second)[2] ;
00124 item.shift_x6 = (it->second)[5] ;
00125 item.shift_x1 = (it->second)[8] ;
00126 prod->setValue(it->first,item) ;
00127 }
00128 return prod;
00129 }
00130
00131 std::auto_ptr<EcalTPGSlidingWindow> EcalTrigPrimESProducer::produceSlidingWindow(const EcalTPGSlidingWindowRcd & iRecord)
00132 {
00133 std::auto_ptr<EcalTPGSlidingWindow> prod(new EcalTPGSlidingWindow());
00134 parseTextFile() ;
00135 for (int subdet=0 ; subdet<2 ; subdet++) {
00136 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00137 for (it = mapStrip_[subdet].begin() ; it != mapStrip_[subdet].end() ; it++) {
00138 prod->setValue(it->first,(it->second)[0]) ;
00139 }
00140 }
00141 return prod;
00142 }
00143
00144 std::auto_ptr<EcalTPGFineGrainEBIdMap> EcalTrigPrimESProducer::produceFineGrainEB(const EcalTPGFineGrainEBIdMapRcd & iRecord)
00145 {
00146 std::auto_ptr<EcalTPGFineGrainEBIdMap> prod(new EcalTPGFineGrainEBIdMap());
00147 parseTextFile() ;
00148 EcalTPGFineGrainConstEB fg ;
00149 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00150 for (it = mapFg_.begin() ; it != mapFg_.end() ; it++) {
00151 fg.setValues((it->second)[0], (it->second)[1], (it->second)[2], (it->second)[3], (it->second)[4]) ;
00152 prod->setValue(it->first,fg) ;
00153 }
00154 return prod;
00155 }
00156
00157 std::auto_ptr<EcalTPGFineGrainStripEE> EcalTrigPrimESProducer::produceFineGrainEEstrip(const EcalTPGFineGrainStripEERcd & iRecord)
00158 {
00159 std::auto_ptr<EcalTPGFineGrainStripEE> prod(new EcalTPGFineGrainStripEE());
00160 parseTextFile() ;
00161
00162 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00163 for (it = mapStrip_[1].begin() ; it != mapStrip_[1].end() ; it++) {
00164 EcalTPGFineGrainStripEE::Item item ;
00165 item.threshold = (it->second)[2] ;
00166 item.lut = (it->second)[3] ;
00167 prod->setValue(it->first,item) ;
00168 }
00169
00170 for (it = mapStrip_[0].begin() ; it != mapStrip_[0].end() ; it++) {
00171 EcalTPGFineGrainStripEE::Item item ;
00172 item.threshold = (it->second)[2] ;
00173 item.lut = (it->second)[3] ;
00174 prod->setValue(it->first,item) ;
00175 }
00176 return prod;
00177 }
00178
00179 std::auto_ptr<EcalTPGFineGrainTowerEE> EcalTrigPrimESProducer::produceFineGrainEEtower(const EcalTPGFineGrainTowerEERcd & iRecord)
00180 {
00181 std::auto_ptr<EcalTPGFineGrainTowerEE> prod(new EcalTPGFineGrainTowerEE());
00182 parseTextFile() ;
00183 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00184 for (it = mapTower_[1].begin() ; it != mapTower_[1].end() ; it++) {
00185 prod->setValue(it->first,(it->second)[1]) ;
00186 }
00187 return prod;
00188 }
00189
00190 std::auto_ptr<EcalTPGLutIdMap> EcalTrigPrimESProducer::produceLUT(const EcalTPGLutIdMapRcd & iRecord)
00191 {
00192 std::auto_ptr<EcalTPGLutIdMap> prod(new EcalTPGLutIdMap());
00193 parseTextFile() ;
00194 EcalTPGLut lut ;
00195 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00196 for (it = mapLut_.begin() ; it != mapLut_.end() ; it++) {
00197 unsigned int lutArray[1024] ;
00198 for (int i=0 ; i <1024 ; i++) lutArray[i] = (it->second)[i] ;
00199 lut.setLut(lutArray) ;
00200 prod->setValue(it->first,lut) ;
00201 }
00202 return prod;
00203 }
00204
00205 std::auto_ptr<EcalTPGWeightIdMap> EcalTrigPrimESProducer::produceWeight(const EcalTPGWeightIdMapRcd & iRecord)
00206 {
00207 std::auto_ptr<EcalTPGWeightIdMap> prod(new EcalTPGWeightIdMap());
00208 parseTextFile() ;
00209 EcalTPGWeights weights ;
00210 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00211 for (it = mapWeight_.begin() ; it != mapWeight_.end() ; it++) {
00212 weights.setValues((it->second)[0],
00213 (it->second)[1],
00214 (it->second)[2],
00215 (it->second)[3],
00216 (it->second)[4]) ;
00217 prod->setValue(it->first,weights) ;
00218 }
00219 return prod;
00220 }
00221
00222 std::auto_ptr<EcalTPGWeightGroup> EcalTrigPrimESProducer::produceWeightGroup(const EcalTPGWeightGroupRcd & iRecord)
00223 {
00224 std::auto_ptr<EcalTPGWeightGroup> prod(new EcalTPGWeightGroup());
00225 parseTextFile() ;
00226 for (int subdet=0 ; subdet<2 ; subdet++) {
00227 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00228 for (it = mapStrip_[subdet].begin() ; it != mapStrip_[subdet].end() ; it++) {
00229 prod->setValue(it->first,(it->second)[1]) ;
00230 }
00231 }
00232 return prod;
00233 }
00234
00235 std::auto_ptr<EcalTPGLutGroup> EcalTrigPrimESProducer::produceLutGroup(const EcalTPGLutGroupRcd & iRecord)
00236 {
00237 std::auto_ptr<EcalTPGLutGroup> prod(new EcalTPGLutGroup());
00238 parseTextFile() ;
00239 for (int subdet=0 ; subdet<2 ; subdet++) {
00240 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00241 for (it = mapTower_[subdet].begin() ; it != mapTower_[subdet].end() ; it++) {
00242 prod->setValue(it->first,(it->second)[0]) ;
00243 }
00244 }
00245 return prod;
00246 }
00247
00248 std::auto_ptr<EcalTPGFineGrainEBGroup> EcalTrigPrimESProducer::produceFineGrainEBGroup(const EcalTPGFineGrainEBGroupRcd & iRecord)
00249 {
00250 std::auto_ptr<EcalTPGFineGrainEBGroup> prod(new EcalTPGFineGrainEBGroup());
00251 parseTextFile() ;
00252 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00253 for (it = mapTower_[0].begin() ; it != mapTower_[0].end() ; it++) {
00254 prod->setValue(it->first,(it->second)[1]) ;
00255 }
00256 return prod;
00257 }
00258
00259 std::auto_ptr<EcalTPGPhysicsConst> EcalTrigPrimESProducer::producePhysicsConst(const EcalTPGPhysicsConstRcd & iRecord)
00260 {
00261 std::auto_ptr<EcalTPGPhysicsConst> prod(new EcalTPGPhysicsConst());
00262 parseTextFile() ;
00263 std::map<uint32_t, std::vector<float> >::const_iterator it ;
00264 for (it = mapPhys_.begin() ; it != mapPhys_.end() ; it++) {
00265 EcalTPGPhysicsConst::Item item ;
00266 item.EtSat = (it->second)[0] ;
00267 item.ttf_threshold_Low = (it->second)[1] ;
00268 item.ttf_threshold_High = (it->second)[2] ;
00269 item.FG_lowThreshold = (it->second)[3] ;
00270 item.FG_highThreshold = (it->second)[4] ;
00271 item.FG_lowRatio = (it->second)[5] ;
00272 item.FG_highRatio = (it->second)[6] ;
00273 prod->setValue(it->first,item) ;
00274 }
00275 return prod;
00276 }
00277
00278 std::auto_ptr<EcalTPGCrystalStatus> EcalTrigPrimESProducer::produceBadX(const EcalTPGCrystalStatusRcd & iRecord)
00279 {
00280 std::auto_ptr<EcalTPGCrystalStatus> prod(new EcalTPGCrystalStatus());
00281 parseTextFile() ;
00282 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00283 for (it = mapXtal_.begin() ; it != mapXtal_.end() ; it++) {
00284
00285 EcalTPGCrystalStatusCode badXValue;
00286 badXValue.setStatusCode(0);
00287 prod->setValue(it->first,badXValue) ;
00288 }
00289 return prod;
00290
00291 }
00292
00293 std::auto_ptr<EcalTPGStripStatus> EcalTrigPrimESProducer::produceBadStrip(const EcalTPGStripStatusRcd & iRecord)
00294 {
00295 std::auto_ptr<EcalTPGStripStatus> prod(new EcalTPGStripStatus());
00296
00297 return prod;
00298
00299 }
00300
00301 std::auto_ptr<EcalTPGTowerStatus> EcalTrigPrimESProducer::produceBadTT(const EcalTPGTowerStatusRcd & iRecord)
00302 {
00303 std::auto_ptr<EcalTPGTowerStatus> prod(new EcalTPGTowerStatus());
00304 parseTextFile() ;
00305 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
00306
00307 for (it = mapTower_[0].begin() ; it != mapTower_[0].end() ; it++) {
00308
00309 prod->setValue(it->first,0) ;
00310 }
00311
00312 for (it = mapTower_[1].begin() ; it != mapTower_[1].end() ; it++) {
00313
00314 prod->setValue(it->first,0) ;
00315 }
00316
00317 return prod;
00318 }
00319
00320 std::auto_ptr<EcalTPGSpike> EcalTrigPrimESProducer::produceSpike(const EcalTPGSpikeRcd &iRecord)
00321 {
00322 std::auto_ptr<EcalTPGSpike> prod(new EcalTPGSpike());
00323 parseTextFile();
00324
00325 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it;
00326 for(it = mapTower_[0].begin(); it != mapTower_[0].end(); ++it)
00327 {
00328 prod->setValue(it->first, (it->second)[2]);
00329 }
00330 return prod;
00331 }
00332
00333 void EcalTrigPrimESProducer::parseTextFile()
00334 {
00335 if (mapXtal_.size() != 0) return ;
00336
00337 uint32_t id ;
00338 std::string dataCard ;
00339 std::string line;
00340 std::ifstream infile ;
00341 std::vector<unsigned int> param ;
00342 std::vector<float> paramF ;
00343 int NBstripparams[2] = {4, 4} ;
00344 unsigned int data ;
00345 float dataF ;
00346
00347 std::string bufString;
00348 std::string iString;
00349 std::string fString;
00350 std::string filename = "SimCalorimetry/EcalTrigPrimProducers/data/"+dbFilename_;
00351 std::string finalFileName ;
00352 size_t slash=dbFilename_.find("/");
00353 if (slash!=0) {
00354 edm::FileInPath fileInPath(filename);
00355 finalFileName = fileInPath.fullPath() ;
00356 }
00357 else {
00358 finalFileName = dbFilename_.c_str() ;
00359 edm::LogWarning("EcalTPG") <<"Couldnt find database file via fileinpath, trying with pathname directly!!";
00360 }
00361
00362
00363 int k=0;
00364
00365 GzInputStream gis(finalFileName.c_str()) ;
00366 while (gis>>dataCard) {
00367
00368 if (dataCard == "PHYSICS_EB" || dataCard == "PHYSICS_EE") {
00369 gis>>std::dec>>id ;
00370
00371 if (flagPrint_){
00372 std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
00373 }
00374
00375 paramF.clear() ;
00376
00377 std::string st1;
00378 std::string st2;
00379
00380 for (int i=0 ; i <7 ; i++) {
00381 gis>>std::dec>>dataF ;
00382 paramF.push_back(dataF) ;
00383
00384
00385 if (flagPrint_){
00386
00387 if (i < 3){
00388 std::ostringstream oss;
00389 oss << dataF;
00390 std::string result1 = oss.str();
00391
00392 st1.append(result1);
00393 if (i != 2)
00394 st1.append(" ");
00395 }
00396
00397 if (i > 2){
00398 std::ostringstream oss;
00399 oss << dataF;
00400 std::string result2 = oss.str();
00401
00402 st2.append(result2);
00403 if (i != 6)
00404 st2.append(" ");
00405 }
00406
00407 }
00408 }
00409
00410 if (flagPrint_){
00411 std::cout << "" << st1 << std::endl;
00412 std::cout << "" << st2 << std::endl;
00413 std::cout << ""<< std::endl;
00414 }
00415
00416
00417 mapPhys_[id] = paramF ;
00418 }
00419
00420 if (dataCard == "CRYSTAL") {
00421
00422 gis>>std::dec>>id ;
00423
00424 std::string st3;
00425 std::string st4;
00426 std::string st5;
00427
00428 if(flagPrint_){
00429
00430 if(k==0)
00431 std::cout << "COMMENT ====== barrel crystals ====== " <<std::endl;
00432
00433 if (k==61200)
00434 std::cout << "COMMENT ====== endcap crystals ====== " <<std::endl;
00435
00436 k=k+1;
00437
00438 std::cout<<dataCard<<" "<<std::dec<<id << std::endl;
00439 }
00440
00441 param.clear() ;
00442 for (int i=0 ; i <9 ; i++) {
00443 gis>>std::hex>>data ;
00444
00445 param.push_back(data);
00446
00447 if(flagPrint_){
00448 if (i<3){
00449 std::ostringstream oss;
00450 oss << std::hex<< data;
00451 std::string result1 = oss.str();
00452
00453 st3.append("0x");
00454 st3.append(result1);
00455 if (i !=2)
00456 st3.append(" ");
00457
00458 }else if(i>2 && i<6){
00459 std::ostringstream oss;
00460 oss << std::hex << data;
00461 std::string result2 = oss.str();
00462
00463 st4.append("0x");
00464 st4.append(result2);
00465 if (i != 5)
00466 st4.append(" ");
00467 }else if(i>5 && i<9){
00468 std::ostringstream oss;
00469 oss << std::hex<< data;
00470 std::string result3 = oss.str();
00471
00472 st5.append("0x");
00473 st5.append(result3);
00474 if (i != 8)
00475 st5.append(" ");
00476 }
00477 }
00478
00479 }
00480
00481 if(flagPrint_){
00482 std::cout << " " << st3 << std::endl;
00483 std::cout << " " << st4 << std::endl;
00484 std::cout << " " << st5 << std::endl;
00485 }
00486
00487
00488 mapXtal_[id] = param ;
00489 }
00490
00491 if (dataCard == "STRIP_EB") {
00492 gis>>std::dec>>id ;
00493
00494 std::string st1;
00495
00496 if(flagPrint_)
00497 std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
00498
00499 param.clear() ;
00500 for (int i=0 ; i <NBstripparams[0] ; i++) {
00501 gis>>std::hex>>data ;
00502
00503 param.push_back(data);
00504
00505 if(flagPrint_){
00506 if (i==0){
00507 std::cout<<"0x"<<std::hex<< data << std::endl;
00508 }
00509 else if (i==1){
00510 std::cout<<""<<std::hex<< data << std::endl;
00511 }
00512 else if (i>1){
00513 std::ostringstream oss;
00514 if (i==2){
00515 oss<<"0x"<<std::hex<<data;
00516 std::string result4 = oss.str();
00517 st1.append(result4);
00518 }else if(i==3){
00519 std::ostringstream oss;
00520 oss<<" 0x"<<std::hex<<data;
00521 std::string result5 = oss.str();
00522
00523 st1.append(result5);
00524 std::cout<< "" << st1 << std::endl;
00525 }
00526 }
00527 }
00528 }
00529
00530
00531 mapStrip_[0][id] = param ;
00532 }
00533
00534 if (dataCard == "STRIP_EE") {
00535 gis>>std::dec>>id ;
00536
00537 std::string st6;
00538
00539 if(flagPrint_){
00540 std::cout<<dataCard<<" "<<std::dec<<id << std::endl;
00541 }
00542
00543 param.clear() ;
00544 for (int i=0 ; i <NBstripparams[1] ; i++) {
00545 gis>>std::hex>>data ;
00546 param.push_back(data);
00547
00548 if(flagPrint_){
00549 if (i==0){
00550 std::cout<<"0x"<<std::hex<<data << std::endl;
00551 }else if (i==1){
00552 std::cout<<" "<<std::hex<<data<< std::endl;
00553 }else if (i>1){
00554 std::ostringstream oss;
00555 if (i==2){
00556 oss<<"0x"<<std::hex<<data;
00557 std::string result4 = oss.str();
00558 st6.append(result4);
00559 }else if(i==3){
00560 std::ostringstream oss;
00561 oss<<" 0x"<<std::hex<<data;
00562 std::string result5 = oss.str();
00563
00564 st6.append(result5);
00565 std::cout<< "" << st6 << std::endl;
00566 }
00567 }
00568 }
00569 }
00570
00571
00572 mapStrip_[1][id] = param ;
00573 }
00574
00575 if(dataCard == "TOWER_EE"){
00576 gis>>std::dec>>id ;
00577
00578 if(flagPrint_)
00579 std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
00580
00581 param.clear() ;
00582 for (int i=0 ; i <2 ; i++) {
00583 gis>>std::hex>>data ;
00584 param.push_back(data);
00585
00586 if(flagPrint_){
00587 if(i==1){
00588 std::cout << "0x" <<std::dec<<data << std::endl;
00589 }else{
00590 std::cout << " " <<std::dec<<data << std::endl;
00591 }
00592 }
00593 }
00594
00595
00596 mapTower_[1][id] = param ;
00597 }
00598
00599 if (dataCard == "TOWER_EB") {
00600 gis>>std::dec>>id ;
00601
00602 if(flagPrint_)
00603 std::cout<<dataCard<<" "<<std::dec<<id << std::endl;
00604
00605 param.clear() ;
00606 for (int i=0 ; i <3 ; i++) {
00607 gis>>std::dec>>data ;
00608
00609 if(flagPrint_){
00610 std::cout << " " << std::dec << data << std::endl;
00611 }
00612
00613 param.push_back(data) ;
00614 }
00615
00616
00617 mapTower_[0][id] = param ;
00618 }
00619
00620 if (dataCard == "WEIGHT") {
00621
00622 if(flagPrint_)
00623 std::cout<<std::endl;
00624
00625 gis>>std::hex>>id ;
00626 if(flagPrint_){
00627 std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
00628 }
00629
00630 param.clear() ;
00631
00632 std::string st6;
00633 for (int i=0 ; i <5 ; i++) {
00634 gis>>std::hex>>data ;
00635 param.push_back(data);
00636
00637 if(flagPrint_){
00638 std::ostringstream oss;
00639 oss << std::hex<< data;
00640 std::string result4 = oss.str();
00641
00642 st6.append("0x");
00643 st6.append(result4);
00644 st6.append(" ");
00645 }
00646
00647 }
00648
00649 if(flagPrint_){
00650 std::cout << st6 << std::endl;
00651 std::cout<<std::endl;
00652 }
00653
00654
00655 mapWeight_[id] = param ;
00656 }
00657
00658 if (dataCard == "FG") {
00659
00660 if(flagPrint_)
00661 std::cout <<std::endl;
00662
00663 gis>>std::hex>>id ;
00664 if(flagPrint_)
00665 std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
00666
00667 param.clear() ;
00668 std::string st7;
00669 for (int i=0 ; i <5 ; i++) {
00670 gis>>std::hex>>data ;
00671 param.push_back(data);
00672
00673 if(flagPrint_){
00674 std::ostringstream oss;
00675 oss << std::hex<< data;
00676
00677 std::string result5 = oss.str();
00678
00679 st7.append("0x");
00680 st7.append(result5);
00681 if (i != 4)
00682 st7.append(" ");
00683 }
00684 }
00685
00686 if(flagPrint_){
00687 std::cout << st7 << std::endl;
00688 std::cout<<std::endl ;
00689 }
00690
00691 mapFg_[id] = param ;
00692 }
00693
00694 if (dataCard == "LUT") {
00695 gis>>std::hex>>id ;
00696
00697 if(flagPrint_)
00698 std::cout<<dataCard<<" "<<std::dec<<id <<std::endl;
00699
00700 param.clear() ;
00701 for (int i=0 ; i <1024 ; i++) {
00702 gis>>std::hex>>data ;
00703 param.push_back(data);
00704
00705 if(flagPrint_){
00706 std::cout<<"0x"<<std::hex<<data <<std::endl;
00707 }
00708 }
00709
00710 if(flagPrint_)
00711 std::cout<<std::endl ;
00712 std::cout<<std::endl ;
00713
00714 mapLut_[id] = param ;
00715 }
00716 }
00717 }
00718
00719 std::vector<int> EcalTrigPrimESProducer::getRange(int subdet, int tccNb, int towerNbInTcc, int stripNbInTower, int xtalNbInStrip)
00720 {
00721 std::vector<int> range ;
00722 if (subdet == 0) {
00723
00724 range.push_back(37) ;
00725 range.push_back(73) ;
00726 range.push_back(1) ;
00727 range.push_back(69) ;
00728 range.push_back(1) ;
00729 range.push_back(6) ;
00730 range.push_back(1) ;
00731 range.push_back(6) ;
00732 } else {
00733
00734 if (subdet >0 ) {
00735 range.push_back(73) ;
00736 range.push_back(109) ;
00737 } else {
00738 range.push_back(1) ;
00739 range.push_back(37) ;
00740 }
00741 range.push_back(1) ;
00742 range.push_back(29) ;
00743 range.push_back(1) ;
00744 range.push_back(6) ;
00745 range.push_back(1) ;
00746 range.push_back(6) ;
00747 }
00748
00749 if (tccNb>0) {
00750 range[0] = tccNb ;
00751 range[1] = tccNb+1 ;
00752 }
00753 if (towerNbInTcc>0) {
00754 range[2] = towerNbInTcc ;
00755 range[3] = towerNbInTcc+1 ;
00756 }
00757 if (stripNbInTower>0) {
00758 range[4] = stripNbInTower ;
00759 range[5] = stripNbInTower+1 ;
00760 }
00761 if (xtalNbInStrip>0) {
00762 range[6] = xtalNbInStrip ;
00763 range[7] = xtalNbInStrip+1 ;
00764 }
00765
00766 return range ;
00767 }
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804