CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTPCondAnalyzer.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Class:      EcalTPDBAnalyzer
00004 //
00010 //
00011 //
00012 // Original Author:  Ursula Berthon
00013 //         Created:  Wed Oct 15  11:38:38 CEST 2008
00014 // $Id: EcalTPCondAnalyzer.cc,v 1.4 2011/03/09 13:10:32 ebecheva Exp $
00015 //
00016 //
00017 //
00018 
00019 
00020 // system include files
00021 #include <memory>
00022 #include <utility>
00023 #include <iostream>
00024 #include <fstream>
00025 
00026 // user include files
00027 #include "FWCore/Framework/interface/EDAnalyzer.h"
00028 #include "FWCore/Framework/interface/Event.h"
00029 #include "FWCore/Framework/interface/MakerMacros.h"
00030 #include "FWCore/Framework/interface/ESHandle.h"
00031 
00032 #include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h"
00033 #include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBGroupRcd.h"
00034 #include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h"
00035 #include "CondFormats/DataRecord/interface/EcalTPGLutIdMapRcd.h"
00036 #include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBIdMapRcd.h"
00037 #include "CondFormats/DataRecord/interface/EcalTPGFineGrainTowerEERcd.h"
00038 #include "CondFormats/DataRecord/interface/EcalTPGLinearizationConstRcd.h"
00039 #include "CondFormats/DataRecord/interface/EcalTPGPedestalsRcd.h"
00040 #include "CondFormats/DataRecord/interface/EcalTPGSlidingWindowRcd.h"
00041 #include "CondFormats/DataRecord/interface/EcalTPGWeightIdMapRcd.h"
00042 #include "CondFormats/DataRecord/interface/EcalTPGWeightGroupRcd.h"
00043 #include "CondFormats/DataRecord/interface/EcalTPGFineGrainStripEERcd.h"
00044 #include "CondFormats/DataRecord/interface/EcalTPGCrystalStatusRcd.h"
00045 #include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h"
00046 #include "CondFormats/DataRecord/interface/EcalTPGStripStatusRcd.h"
00047 #include "CondFormats/DataRecord/interface/EcalTPGSpikeRcd.h"
00048 
00049 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
00050 #include "DataFormats/EcalDetId/interface/EcalTriggerElectronicsId.h"
00051 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00052 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00053 
00054 #include "SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTPCondAnalyzer.h"
00055 
00056 EcalTPCondAnalyzer::EcalTPCondAnalyzer(const edm::ParameterSet&  iConfig)
00057 
00058 {}
00059 
00060 void EcalTPCondAnalyzer::beginRun(const edm::Run & run, edm::EventSetup const& evtSetup){
00061  // get geometry
00062   
00063   edm::ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle, theBarrelGeometry_handle;
00064   evtSetup.get<EcalEndcapGeometryRecord>().get("EcalEndcap",theEndcapGeometry_handle);
00065   evtSetup.get<EcalBarrelGeometryRecord>().get("EcalBarrel",theBarrelGeometry_handle);
00066   theEndcapGeometry_ = &(*theEndcapGeometry_handle);
00067   theBarrelGeometry_ = &(*theBarrelGeometry_handle);
00068 
00069   cacheID_=this->getRecords(evtSetup);
00070 }
00071 
00072 void EcalTPCondAnalyzer::beginJob() 
00073 {}
00074 
00075 
00076 EcalTPCondAnalyzer::~EcalTPCondAnalyzer() {
00077 }
00078 
00079 unsigned long long  EcalTPCondAnalyzer::getRecords(edm::EventSetup const& setup) {
00080   //
00081   // get Eventsetup records and print them
00082   //
00083    printComment();
00084 
00085    edm::ESHandle<EcalTPGPhysicsConst> theEcalTPGPhysConst_handle;
00086   setup.get<EcalTPGPhysicsConstRcd>().get(theEcalTPGPhysConst_handle);
00087   const EcalTPGPhysicsConst * ecaltpPhysConst = theEcalTPGPhysConst_handle.product();
00088   printEcalTPGPhysicsConst(ecaltpPhysConst);
00089   // for EcalFenixStrip...
00090 
00091   // get parameter records for xtals
00092   edm::ESHandle<EcalTPGLinearizationConst> theEcalTPGLinearization_handle;
00093   setup.get<EcalTPGLinearizationConstRcd>().get(theEcalTPGLinearization_handle);
00094   const EcalTPGLinearizationConst * ecaltpLin = theEcalTPGLinearization_handle.product();
00095 
00096   edm::ESHandle<EcalTPGPedestals> theEcalTPGPedestals_handle;
00097   setup.get<EcalTPGPedestalsRcd>().get(theEcalTPGPedestals_handle);
00098   const EcalTPGPedestals * ecaltpPed = theEcalTPGPedestals_handle.product();
00099   printCRYSTAL(ecaltpPed,ecaltpLin );
00100 
00101 
00102   //weight
00103   edm::ESHandle<EcalTPGWeightIdMap> theEcalTPGWEightIdMap_handle;
00104   setup.get<EcalTPGWeightIdMapRcd>().get(theEcalTPGWEightIdMap_handle);
00105   const EcalTPGWeightIdMap * ecaltpgWeightMap = theEcalTPGWEightIdMap_handle.product();
00106   printWEIGHT(ecaltpgWeightMap);
00107 
00108    // .. and for EcalFenixTcp
00109 
00110   edm::ESHandle<EcalTPGFineGrainEBIdMap> theEcalTPGFineGrainEBIdMap_handle;
00111   setup.get<EcalTPGFineGrainEBIdMapRcd>().get(theEcalTPGFineGrainEBIdMap_handle);
00112   const EcalTPGFineGrainEBIdMap * ecaltpgFineGrainEB = theEcalTPGFineGrainEBIdMap_handle.product();
00113   printEcalTPGFineGrainEBIdMap(ecaltpgFineGrainEB);
00114 
00115 
00116   edm::ESHandle<EcalTPGLutIdMap> theEcalTPGLutIdMap_handle;
00117   setup.get<EcalTPGLutIdMapRcd>().get(theEcalTPGLutIdMap_handle);
00118   const EcalTPGLutIdMap * ecaltpgLut = theEcalTPGLutIdMap_handle.product();
00119   printEcalTPGLutIdMap(ecaltpgLut);
00120 
00121   //for strips
00122   edm::ESHandle<EcalTPGSlidingWindow> theEcalTPGSlidingWindow_handle;
00123   setup.get<EcalTPGSlidingWindowRcd>().get(theEcalTPGSlidingWindow_handle);
00124   const EcalTPGSlidingWindow * ecaltpgSlidW = theEcalTPGSlidingWindow_handle.product();
00125   edm::ESHandle<EcalTPGFineGrainStripEE> theEcalTPGFineGrainStripEE_handle;
00126   setup.get<EcalTPGFineGrainStripEERcd>().get(theEcalTPGFineGrainStripEE_handle);
00127   const EcalTPGFineGrainStripEE * ecaltpgFgStripEE = theEcalTPGFineGrainStripEE_handle.product();     
00128   edm::ESHandle<EcalTPGWeightGroup> theEcalTPGWEightGroup_handle;
00129   setup.get<EcalTPGWeightGroupRcd>().get(theEcalTPGWEightGroup_handle);
00130   const EcalTPGWeightGroup * ecaltpgWeightGroup = theEcalTPGWEightGroup_handle.product();
00131   printSTRIP(ecaltpgSlidW,ecaltpgWeightGroup,ecaltpgFgStripEE);
00132 
00133   // get parameter records for towers
00134   edm::ESHandle<EcalTPGLutGroup> theEcalTPGLutGroup_handle;
00135   setup.get<EcalTPGLutGroupRcd>().get(theEcalTPGLutGroup_handle);
00136   const EcalTPGLutGroup * ecaltpgLutGroup = theEcalTPGLutGroup_handle.product();
00137 
00138   edm::ESHandle<EcalTPGFineGrainEBGroup> theEcalTPGFineGrainEBGroup_handle;
00139   setup.get<EcalTPGFineGrainEBGroupRcd>().get(theEcalTPGFineGrainEBGroup_handle);
00140   const EcalTPGFineGrainEBGroup * ecaltpgFgEBGroup = theEcalTPGFineGrainEBGroup_handle.product();
00141   edm::ESHandle<EcalTPGSpike> theEcalTPGSpike_handle;
00142   setup.get<EcalTPGSpikeRcd>().get(theEcalTPGSpike_handle);
00143   const EcalTPGSpike * ecaltpgSpikeTh = theEcalTPGSpike_handle.product();
00144 
00145   printTOWEREB(ecaltpgSpikeTh, ecaltpgFgEBGroup,ecaltpgLutGroup);
00146   edm::ESHandle<EcalTPGFineGrainTowerEE> theEcalTPGFineGrainTowerEE_handle;
00147   setup.get<EcalTPGFineGrainTowerEERcd>().get(theEcalTPGFineGrainTowerEE_handle);
00148   const EcalTPGFineGrainTowerEE * ecaltpgFineGrainTowerEE = theEcalTPGFineGrainTowerEE_handle.product();
00149 
00150   printTOWEREE(ecaltpgFineGrainTowerEE, ecaltpgLutGroup);
00151 
00152   // get parameters for BadX
00153 /*  edm::ESHandle<EcalTPGCrystalStatus> theEcalTPGCrystalStatus_handle;
00154   setup.get<EcalTPGCrystalStatusRcd>().get(theEcalTPGCrystalStatus_handle);
00155   const EcalTPGCrystalStatus * ecaltpgBadX = theEcalTPGCrystalStatus_handle.product();
00156   printBadX(ecaltpgBadX);
00157 
00158   // get parameters for BadTT
00159   edm::ESHandle<EcalTPGTowerStatus> theEcalTPGTowerStatus_handle;
00160   setup.get<EcalTPGTowerStatusRcd>().get(theEcalTPGTowerStatus_handle);
00161   const EcalTPGTowerStatus * ecaltpgBadTT = theEcalTPGTowerStatus_handle.product();
00162   printBadTT(ecaltpgBadTT);
00163 */  
00164   
00165   // get parameters for BadStrip
00166 /*  edm::ESHandle<EcalTPGStripStatus> theEcalTPGStripStatus_handle;
00167   setup.get<EcalTPGStripStatusRcd>().get(theEcalTPGStripStatus_handle);
00168   const EcalTPGStripStatus * ecaltpgBadStrip = theEcalTPGStripStatus_handle.product();
00169   printBadStrip(ecaltpgBadStrip);
00170 */
00171 
00172   
00173   std::cout<<"EOF"<<std::endl;
00174 
00175   return setup.get<EcalTPGFineGrainTowerEERcd>().cacheIdentifier();
00176 }
00177 
00178 // ------------ method called to analyze the data  ------------
00179 void
00180 EcalTPCondAnalyzer::analyze(const edm::Event& iEvent, const  edm::EventSetup & iSetup){
00181 }
00182 
00183 void
00184 EcalTPCondAnalyzer::endJob(){
00185 }
00186 
00187 void EcalTPCondAnalyzer::printEcalTPGPhysicsConst(const EcalTPGPhysicsConst *ecaltpgPhysConst) const {
00188   EcalTPGPhysicsConstMapIterator it;
00189   const EcalTPGPhysicsConstMap mymap=ecaltpgPhysConst->getMap();
00190   for (it=mymap.begin();it!=mymap.end();++it) {
00191     if (it==mymap.begin()) {
00192       std::cout<<"\nPHYSICS_EB "<<(*it).first<<std::endl;
00193     } else {
00194       std::cout<<"\nPHYSICS_EE "<<(*it).first<<std::endl;
00195     }
00196     std::cout<<(*it).second.EtSat<<" "<<(*it).second.ttf_threshold_Low<<" "<<(*it).second.ttf_threshold_High<<std::endl;
00197     std::cout<<(*it).second.FG_lowThreshold<<" "<<(*it).second.FG_highThreshold<<" "<<(*it).second.FG_lowRatio<<" "<<(*it).second.FG_highRatio<<std::endl;
00198   }
00199 }
00200 
00201 void  EcalTPCondAnalyzer::printSTRIP(const EcalTPGSlidingWindow *slWin,const EcalTPGWeightGroup *ecaltpgWeightGroup,const EcalTPGFineGrainStripEE * ecaltpgFgStripEE) const {
00202   // print STRIP information
00203   const EcalTPGSlidingWindowMap &slwinmap = slWin -> getMap();
00204   const EcalTPGFineGrainStripEEMap &fgstripEEmap= ecaltpgFgStripEE->getMap();
00205   EcalTPGSlidingWindowMapIterator it;
00206   const EcalTPGGroups::EcalTPGGroupsMap &gMap=ecaltpgWeightGroup->getMap();
00207   EcalTPGGroups::EcalTPGGroupsMapItr groupId;
00208 
00209   std::cout<<std::endl;
00210   for (int mysub=1;mysub<=2;++mysub) {
00211     std::cout<<std::endl;
00212     for (it=slwinmap.begin();it!=slwinmap.end();++it) {
00213       EcalTriggerElectronicsId elid((*it).first);
00214       groupId=gMap.find((*it).first);
00215       int subdet =elid.subdet();
00216       if (subdet==mysub) {
00217         if (subdet==1) {
00218           std::cout<<"STRIP_EB "<<std::dec<<(*it).first<<std::endl;
00219           std::cout << std::hex << "0x" <<(*it).second<<std::endl ;
00220           std::cout  <<" " <<(*groupId).second<< std::endl ; //weightgroupid
00221         }else if (subdet==2) {
00222           std::cout<<"STRIP_EE "<<std::dec<<(*it).first<<std::endl;
00223           std::cout << std::hex << "0x" <<(*it).second<<std::endl ;
00224           std::cout <<" " <<(*groupId).second<<std::endl ;//weightgroupid
00225           EcalTPGFineGrainStripEEMapIterator it2=fgstripEEmap.find((*it).first);
00226           if (it2==fgstripEEmap.end()) {
00227             edm::LogWarning("EcalTPGCondAnalyzer") <<" could not find strip Id "<<(*it).first<<", given in sliding window, inside the EcalTPGFineGranStripEEMap!!!";
00228           } else {
00229             EcalTPGFineGrainStripEE::Item item=(*it2).second;
00230             std::cout<<std::hex<<"0x"<<item.threshold<<" 0x"<<item.lut<<std::endl ;  
00231           }
00232         }
00233       }
00234     }
00235   }
00236 }
00237 
00238 void EcalTPCondAnalyzer::printWEIGHT(const EcalTPGWeightIdMap * ecaltpgWeightIdMap) const {
00239     
00240   std::cout<<std::endl;
00241     EcalTPGWeightIdMap::EcalTPGWeightMapItr it;
00242     uint32_t w0,w1,w2,w3,w4;
00243     const EcalTPGWeightIdMap::EcalTPGWeightMap map=ecaltpgWeightIdMap->getMap();
00244     for (it=map.begin();it!=map.end();++it) {
00245       std::cout <<"WEIGHT "<<(*it).first<<std::endl;
00246       (*it).second.getValues(w0,w1,w2,w3,w4);
00247       std::cout <<std::hex<<"0x"<<w0<<" 0x"<<w1<<" 0x"<<w2<<" 0x"<<w3<<" 0x"<<w4<<" "<<std::endl;
00248     }
00249 }
00250 
00251 void  EcalTPCondAnalyzer::printEcalTPGFineGrainEBIdMap(const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB) const {
00252     EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMapItr it;
00253     const EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMap map=ecaltpgFineGrainEB->getMap();
00254     uint32_t ThresholdETLow, ThresholdETHigh, RatioLow, RatioHigh, LUT;
00255 
00256     std::cout<<std::endl;
00257     for (it=map.begin();it!=map.end();++it) {
00258       std::cout <<"FG "<<(*it).first<<std::endl;
00259       (*it).second.getValues(ThresholdETLow, ThresholdETHigh, RatioLow, RatioHigh, LUT);
00260       std::cout <<std::hex<<"0x"<<ThresholdETLow<<" 0x"<<ThresholdETHigh<<" 0x"<<RatioLow<<" 0x"<<RatioHigh<<" 0x"<<LUT<<std::endl;
00261     }
00262 }
00263 
00264 
00265 void EcalTPCondAnalyzer::printEcalTPGLutIdMap(const EcalTPGLutIdMap *ecaltpgLut) const {
00266     EcalTPGLutIdMap::EcalTPGLutMapItr it;
00267     const EcalTPGLutIdMap::EcalTPGLutMap map=ecaltpgLut->getMap();
00268 
00269     std::cout<<std::endl;
00270     for (it=map.begin();it!=map.end();++it) {
00271       std::cout <<"LUT "<<(*it).first<<std::endl;
00272       const unsigned int * lut=(*it).second.getLut();
00273       for (unsigned int i=0;i<1024;++i)  std::cout <<std::hex<<"0x"<<*lut++<<std::endl;
00274     }
00275 }
00276 
00277 void EcalTPCondAnalyzer::printCRYSTAL(const EcalTPGPedestals * ecaltpPed, const EcalTPGLinearizationConst * ecaltpLin ) {
00278 
00279   std::cout<<std::endl;
00280   const EcalTPGPedestalsMap pedMap=ecaltpPed->getMap();
00281   const EcalTPGLinearizationConstMap linMap=ecaltpLin->getMap();
00282 
00283   const std::vector<DetId> & ebCells = theBarrelGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel);
00284 
00285   std::cout<<"COMMENT ====== barrel crystals ====== "<<std::endl; 
00286   for (std::vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
00287     EBDetId id(*it) ;
00288     std::cout <<"CRYSTAL "<<std::dec<<id.rawId()<<std::endl;
00289     const EcalTPGPedestal &ped=pedMap[id.rawId()];
00290     const EcalTPGLinearizationConstant &lin=linMap[id.rawId()];
00291     std::cout<<std::hex<<" 0x"<<ped.mean_x12<<" 0x"<<lin.mult_x12<<" 0x"<<lin.shift_x12<<std::endl;
00292     std::cout<<std::hex<<" 0x"<<ped.mean_x6 <<" 0x"<<lin.mult_x6 <<" 0x"<<lin.shift_x6<<std::endl;
00293     std::cout<<std::hex<<" 0x"<<ped.mean_x1 <<" 0x"<<lin.mult_x1 <<" 0x"<<lin.shift_x1<<std::endl;
00294   }
00295 
00296   const std::vector<DetId> & eeCells = theEndcapGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap);
00297   std::cout<<"COMMENT ====== endcap crystals ====== "<<std::endl; 
00298   for (std::vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
00299     EEDetId id(*it) ;
00300     std::cout <<"CRYSTAL "<<std::dec<<id.rawId()<<std::endl;
00301     const EcalTPGPedestal &ped=pedMap[id.rawId()];
00302     const EcalTPGLinearizationConstant &lin=linMap[id.rawId()];
00303     std::cout<<std::hex<<" 0x"<<ped.mean_x12<<" 0x"<<lin.mult_x12<<" 0x"<<lin.shift_x12<<std::endl;
00304     std::cout<<std::hex<<" 0x"<<ped.mean_x6 <<" 0x"<<lin.mult_x6 <<" 0x"<<lin.shift_x6<<std::endl;
00305     std::cout<<std::hex<<" 0x"<<ped.mean_x1 <<" 0x"<<lin.mult_x1 <<" 0x"<<lin.shift_x1<<std::endl;
00306   }
00307 }
00308 void EcalTPCondAnalyzer::printComment() const {
00309   std::cout<<"COMMENT put your comments here\n"<<
00310   "COMMENT =================================\n"<<
00311   "COMMENT           physics EB structure\n"<<
00312   "COMMENT\n"<<
00313   "COMMENT  EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)\n"<<
00314   "COMMENT  FG_lowThreshold (GeV), FG_highThreshold (GeV), FG_lowRatio, FG_highRatio\n"<<
00315   "COMMENT =================================\n"<<
00316   "COMMENT\n"<<
00317   "COMMENT =================================\n"<<
00318   "COMMENT           physics EE structure\n"<<
00319   "COMMENT\n"<<
00320   "COMMENT  EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)\n"<<
00321   "COMMENT  FG_Threshold (GeV), dummy, dummy, dummy\n"<<
00322   "COMMENT =================================\n"<<
00323   "COMMENT\n"<<
00324   "COMMENT =================================\n"<<
00325   "COMMENT           crystal structure (same for EB and EE)\n"<<
00326   "COMMENT\n"<<
00327   "COMMENT  ped, mult, shift [gain12]\n"<<
00328   "COMMENT  ped, mult, shift [gain6]\n"<<
00329   "COMMENT  ped, mult, shift [gain1]\n"<<
00330   "COMMENT =================================\n"<<
00331   "COMMENT\n"<<
00332   "COMMENT =================================\n"<<
00333   "COMMENT           strip EB structure\n"<<
00334   "COMMENT\n"<<
00335   "COMMENT  sliding_window\n"<<
00336   "COMMENT  weightGroupId\n"<<
00337   "COMMENT  threshold_sfg lut_sfg\n"<<
00338   "COMMENT =================================\n"<<
00339   "COMMENT\n"<<
00340   "COMMENT =================================\n"<<
00341   "COMMENT           strip EE structure\n"<<
00342   "COMMENT\n"<<
00343   "COMMENT  sliding_window\n"<<
00344   "COMMENT  weightGroupId\n"<<
00345   "COMMENT  threshold_fg lut_fg\n"<<
00346   "COMMENT =================================\n"<<
00347   "COMMENT\n"<<
00348   "COMMENT =================================\n"<<
00349   "COMMENT           tower EB structure\n"<<
00350   "COMMENT\n"<<
00351   "COMMENT  LUTGroupId\n"<<
00352   "COMMENT  FgGroupId\n"<<
00353   "COMMENT  spike_killing_threshold\n"<<
00354   "COMMENT =================================\n"<<
00355   "COMMENT\n"<<
00356   "COMMENT =================================\n"<<
00357   "COMMENT           tower EE structure\n"<<
00358   "COMMENT\n"<<
00359   "COMMENT  LUTGroupId\n"<<
00360   "COMMENT  tower_lut_fg\n"<<
00361   "COMMENT =================================\n"<<
00362   "COMMENT\n"<<
00363   "COMMENT =================================\n"<<
00364   "COMMENT           Weight structure\n"<<
00365   "COMMENT\n"<<
00366   "COMMENT  weightGroupId\n"<<
00367   "COMMENT  w0, w1, w2, w3, w4\n"<<
00368   "COMMENT =================================\n"<<
00369   "COMMENT\n"<<
00370   "COMMENT =================================\n"<<
00371   "COMMENT           lut structure\n"<<
00372   "COMMENT\n"<<
00373   "COMMENT  LUTGroupId\n"<<
00374   "COMMENT  LUT[1-1024]\n"<<
00375   "COMMENT =================================\n"<<
00376   "COMMENT\n"<<
00377   "COMMENT =================================\n"<<
00378   "COMMENT           fg EB structure\n"<<
00379   "COMMENT\n"<<
00380   "COMMENT  FgGroupId\n"<<
00381   "COMMENT  el, eh, tl, th, lut_fg\n"<<
00382   "COMMENT =================================\n"<<
00383   "COMMENT"<<std::endl;
00384 }
00385 
00386 /*void EcalTPCondAnalyzer::printTOWEREB(const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup,const EcalTPGLutGroup *ecaltpgLutGroup) const {
00387 
00388     const EcalTPGGroups::EcalTPGGroupsMap &lutMap=ecaltpgLutGroup->getMap();
00389     EcalTPGGroups::EcalTPGGroupsMapItr lutGroupId;
00390     const EcalTPGGroups::EcalTPGGroupsMap &fgMap=ecaltpgFgEBGroup->getMap();
00391     EcalTPGGroups::EcalTPGGroupsMapItr it;
00392     
00393     std::cout<<std::endl;
00394     for (it=fgMap.begin();it!=fgMap.end();++it) {
00395       std::cout <<"TOWER_EB "<<std::dec<<(*it).first<<std::endl;
00396       lutGroupId=lutMap.find((*it).first);
00397       std::cout <<" "<<(*it).second<<std::endl;
00398       std::cout <<" "<<(*lutGroupId).second<<std::endl;
00399     }
00400 }
00401 */
00402 
00403 void EcalTPCondAnalyzer::printTOWEREB(const EcalTPGSpike *ecaltpgSpikeTh, const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup,const EcalTPGLutGroup *ecaltpgLutGroup) const {
00404  
00405     const EcalTPGGroups::EcalTPGGroupsMap &lutMap=ecaltpgLutGroup->getMap();
00406     EcalTPGGroups::EcalTPGGroupsMapItr lutGroupId;
00407     const EcalTPGGroups::EcalTPGGroupsMap &fgMap=ecaltpgFgEBGroup->getMap();
00408     EcalTPGGroups::EcalTPGGroupsMapItr it;
00409     
00410     const EcalTPGSpike::EcalTPGSpikeMap spikeThMap = ecaltpgSpikeTh->getMap();
00411     EcalTPGSpike::EcalTPGSpikeMapIterator itSpikeTh;
00412     
00413     std::cout<<std::endl;
00414     for (it=fgMap.begin();it!=fgMap.end();++it) {
00415       std::cout <<"TOWER_EB "<<std::dec<<(*it).first<<std::endl;
00416       lutGroupId=lutMap.find((*it).first);
00417       itSpikeTh=spikeThMap.find((*it).first);
00418       std::cout <<std::hex<<" "<<(*it).second<<std::endl;
00419       std::cout <<std::hex<<" "<<(*lutGroupId).second<<std::endl;
00420       std::cout <<std::hex<<" "<<(*itSpikeTh).second<<std::endl; 
00421     }
00422 }
00423 
00424 void EcalTPCondAnalyzer::printTOWEREE(const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE,const EcalTPGLutGroup *ecaltpgLutGroup) const {
00425 
00426     EcalTPGFineGrainTowerEEMapIterator it;
00427     const EcalTPGFineGrainTowerEEMap map=ecaltpgFineGrainTowerEE->getMap();
00428     const EcalTPGGroups::EcalTPGGroupsMap &lutMap=ecaltpgLutGroup->getMap();
00429     EcalTPGGroups::EcalTPGGroupsMapItr lutGroupId;
00430 
00431     std::cout<<std::endl;
00432     for (it=map.begin();it!=map.end();++it) {
00433       std::cout <<"TOWER_EE "<<std::dec<<(*it).first<<std::endl;
00434       lutGroupId=lutMap.find((*it).first);
00435       std::cout <<" "<<(*lutGroupId).second<<std::endl;
00436       std::cout <<std::hex<<"0x"<<(*it).second<<std::endl;
00437     }
00438 }
00439 
00440 /*void EcalTPCondAnalyzer::printBadX(const EcalTPGCrystalStatus *ecaltpgBadX) const {
00441   
00442   std::ofstream myfile;
00443   myfile.open("badXvalues.txt");
00444   
00445   const EcalTPGCrystalStatusMap & badXMap = ecaltpgBadX->getMap();
00446 
00447   const std::vector<DetId> & ebCells = theBarrelGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel);
00448 
00449   myfile <<"COMMENT ====== barrel masked crystals ====== "<<std::endl; 
00450   myfile << "RawId         eta      phi   " << std::endl; 
00451 
00452   for (std::vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
00453 
00454     EBDetId id(*it) ;
00455     const EcalTPGCrystalStatusCode &badXeb=badXMap[id.rawId()];
00456     // Print in the text file obly the masked crystals
00457     if (badXeb.getStatusCode() != 0){    
00458       myfile << "" << id.rawId() << "      " << id.ieta() << "      " << id.iphi() << std::endl;
00459     }
00460     
00461   }
00462   
00463   myfile << " " << std::endl;
00464 
00465   const std::vector<DetId> & eeCells = theEndcapGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap);
00466   
00467   myfile <<"COMMENT ====== endcap masked crystals ====== "<<std::endl; 
00468   myfile << "RawId       x      y      z   " << std::endl; 
00469   
00470   for (std::vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
00471     
00472     EEDetId id(*it) ;
00473     const EcalTPGCrystalStatusCode &badXee=badXMap[id.rawId()];
00474     // Print in the text file only the masked clystals
00475     if (badXee.getStatusCode() != 0){ 
00476       myfile << "" << id.rawId() << "   " << id.ix() << "      " << id.iy() << "     "<< id.zside() << std::endl;
00477     } 
00478   }
00479   
00480   myfile.close();
00481 }
00482 */
00483 
00484 
00485 /*void EcalTPCondAnalyzer::printBadTT(const EcalTPGTowerStatus *ecaltpgBadTT) const {
00486   std::ofstream myfilebadTT;
00487   myfilebadTT.open("badTTvalues.txt");
00488   int ieta = 0;
00489   int iphi = 0;
00490   
00491   const EcalTPGTowerStatusMap & badTTMap = ecaltpgBadTT -> getMap();
00492   EcalTPGTowerStatusMapIterator it;
00493   
00494   myfilebadTT <<"Barrel and endcap masked Trigger Towers"<<std::endl;
00495   myfilebadTT <<"RawId " << "     iphi " << "  ieta " << std::endl;
00496   myfilebadTT <<""<< std::endl;
00497   
00498   for (it=badTTMap.begin();it!=badTTMap.end();++it) {
00499     
00500     // Print in the text file only the masked barrel and endcap TTs
00501     if ((*it).second != 0){
00502     
00503       EcalTrigTowerDetId  ttId((*it).first);
00504       ieta = ttId.ieta();
00505       iphi = ttId.iphi();
00506 
00507       myfilebadTT <<""<< std::dec<<(*it).first << "  " << iphi << "     " << ieta << std::endl;
00508       
00509     }
00510   }
00511   
00512   
00513   myfilebadTT.close();
00514 
00515 }
00516 */