CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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.6 2011/10/24 15:27:54 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           EcalTPGFineGrainStripEEMapIterator it2=fgstripEEmap.find((*it).first);
00222           if (it2==fgstripEEmap.end()) {
00223             edm::LogWarning("EcalTPGCondAnalyzer") <<" could not find strip Id "<<(*it).first<<", given in sliding window, inside the EcalTPGFineGranStripEEMap!!!";
00224           } else {
00225             EcalTPGFineGrainStripEE::Item item=(*it2).second;
00226             std::cout<<std::hex<<"0x"<<item.threshold<<" 0x"<<item.lut<<std::endl ;  
00227           }
00228         }else if (subdet==2) {
00229           std::cout<<"STRIP_EE "<<std::dec<<(*it).first<<std::endl;
00230           std::cout << std::hex << "0x" <<(*it).second<<std::endl ;
00231           std::cout <<" " <<(*groupId).second<<std::endl ;//weightgroupid
00232           EcalTPGFineGrainStripEEMapIterator it2=fgstripEEmap.find((*it).first);
00233           if (it2==fgstripEEmap.end()) {
00234             edm::LogWarning("EcalTPGCondAnalyzer") <<" could not find strip Id "<<(*it).first<<", given in sliding window, inside the EcalTPGFineGranStripEEMap!!!";
00235           } else {
00236             EcalTPGFineGrainStripEE::Item item=(*it2).second;
00237             std::cout<<std::hex<<"0x"<<item.threshold<<" 0x"<<item.lut<<std::endl ;  
00238           }
00239         }
00240       }
00241     }
00242   }
00243 }
00244 
00245 void EcalTPCondAnalyzer::printWEIGHT(const EcalTPGWeightIdMap * ecaltpgWeightIdMap) const {
00246     
00247   std::cout<<std::endl;
00248     EcalTPGWeightIdMap::EcalTPGWeightMapItr it;
00249     uint32_t w0,w1,w2,w3,w4;
00250     const EcalTPGWeightIdMap::EcalTPGWeightMap map=ecaltpgWeightIdMap->getMap();
00251     for (it=map.begin();it!=map.end();++it) {
00252       std::cout <<"WEIGHT "<<(*it).first<<std::endl;
00253       (*it).second.getValues(w0,w1,w2,w3,w4);
00254       std::cout <<std::hex<<"0x"<<w0<<" 0x"<<w1<<" 0x"<<w2<<" 0x"<<w3<<" 0x"<<w4<<" "<<std::endl;
00255       std::cout<<std::endl;
00256       std::cout<<std::endl;
00257     }
00258 }
00259 
00260 void  EcalTPCondAnalyzer::printEcalTPGFineGrainEBIdMap(const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB) const {
00261     EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMapItr it;
00262     const EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMap map=ecaltpgFineGrainEB->getMap();
00263     uint32_t ThresholdETLow, ThresholdETHigh, RatioLow, RatioHigh, LUT;
00264 
00265     //std::cout<<std::endl;
00266     for (it=map.begin();it!=map.end();++it) {
00267       std::cout <<"FG "<<(*it).first<<std::endl;
00268       (*it).second.getValues(ThresholdETLow, ThresholdETHigh, RatioLow, RatioHigh, LUT);
00269       std::cout <<std::hex<<"0x"<<ThresholdETLow<<" 0x"<<ThresholdETHigh<<" 0x"<<RatioLow<<" 0x"<<RatioHigh<<" 0x"<<LUT<<std::endl;
00270     }
00271 }
00272 
00273 
00274 void EcalTPCondAnalyzer::printEcalTPGLutIdMap(const EcalTPGLutIdMap *ecaltpgLut) const {
00275     EcalTPGLutIdMap::EcalTPGLutMapItr it;
00276     const EcalTPGLutIdMap::EcalTPGLutMap map=ecaltpgLut->getMap();
00277 
00278     std::cout<<std::endl;
00279     for (it=map.begin();it!=map.end();++it) {
00280       std::cout <<"LUT "<<(*it).first<<std::endl;
00281       const unsigned int * lut=(*it).second.getLut();
00282       for (unsigned int i=0;i<1024;++i)  std::cout <<std::hex<<"0x"<<*lut++<<std::endl;
00283     }
00284 }
00285 
00286 void EcalTPCondAnalyzer::printCRYSTAL(const EcalTPGPedestals * ecaltpPed, const EcalTPGLinearizationConst * ecaltpLin ) {
00287 
00288   std::cout<<std::endl;
00289   const EcalTPGPedestalsMap pedMap=ecaltpPed->getMap();
00290   const EcalTPGLinearizationConstMap linMap=ecaltpLin->getMap();
00291 
00292   const std::vector<DetId> & ebCells = theBarrelGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel);
00293 
00294   std::cout<<"COMMENT ====== barrel crystals ====== "<<std::endl; 
00295   for (std::vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
00296     EBDetId id(*it) ;
00297     std::cout <<"CRYSTAL "<<std::dec<<id.rawId()<<std::endl;
00298     const EcalTPGPedestal &ped=pedMap[id.rawId()];
00299     const EcalTPGLinearizationConstant &lin=linMap[id.rawId()];
00300     std::cout<<std::hex<<" 0x"<<ped.mean_x12<<" 0x"<<lin.mult_x12<<" 0x"<<lin.shift_x12<<std::endl;
00301     std::cout<<std::hex<<" 0x"<<ped.mean_x6 <<" 0x"<<lin.mult_x6 <<" 0x"<<lin.shift_x6<<std::endl;
00302     std::cout<<std::hex<<" 0x"<<ped.mean_x1 <<" 0x"<<lin.mult_x1 <<" 0x"<<lin.shift_x1<<std::endl;
00303   }
00304 
00305   const std::vector<DetId> & eeCells = theEndcapGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap);
00306   std::cout<<"COMMENT ====== endcap crystals ====== "<<std::endl; 
00307   for (std::vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
00308     EEDetId id(*it) ;
00309     std::cout <<"CRYSTAL "<<std::dec<<id.rawId()<<std::endl;
00310     const EcalTPGPedestal &ped=pedMap[id.rawId()];
00311     const EcalTPGLinearizationConstant &lin=linMap[id.rawId()];
00312     std::cout<<std::hex<<" 0x"<<ped.mean_x12<<" 0x"<<lin.mult_x12<<" 0x"<<lin.shift_x12<<std::endl;
00313     std::cout<<std::hex<<" 0x"<<ped.mean_x6 <<" 0x"<<lin.mult_x6 <<" 0x"<<lin.shift_x6<<std::endl;
00314     std::cout<<std::hex<<" 0x"<<ped.mean_x1 <<" 0x"<<lin.mult_x1 <<" 0x"<<lin.shift_x1<<std::endl;
00315   }
00316 }
00317 void EcalTPCondAnalyzer::printComment() const {
00318   std::cout<<"COMMENT put your comments here\n"<<
00319   "COMMENT =================================\n"<<
00320   "COMMENT           physics EB structure\n"<<
00321   "COMMENT\n"<<
00322   "COMMENT  EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)\n"<<
00323   "COMMENT  FG_lowThreshold (GeV), FG_highThreshold (GeV), FG_lowRatio, FG_highRatio\n"<<
00324   "COMMENT =================================\n"<<
00325   "COMMENT\n"<<
00326   "COMMENT =================================\n"<<
00327   "COMMENT           physics EE structure\n"<<
00328   "COMMENT\n"<<
00329   "COMMENT  EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)\n"<<
00330   "COMMENT  FG_Threshold (GeV), dummy, dummy, dummy\n"<<
00331   "COMMENT =================================\n"<<
00332   "COMMENT\n"<<
00333   "COMMENT =================================\n"<<
00334   "COMMENT           crystal structure (same for EB and EE)\n"<<
00335   "COMMENT\n"<<
00336   "COMMENT  ped, mult, shift [gain12]\n"<<
00337   "COMMENT  ped, mult, shift [gain6]\n"<<
00338   "COMMENT  ped, mult, shift [gain1]\n"<<
00339   "COMMENT =================================\n"<<
00340   "COMMENT\n"<<
00341   "COMMENT =================================\n"<<
00342   "COMMENT           strip EB structure\n"<<
00343   "COMMENT\n"<<
00344   "COMMENT  sliding_window\n"<<
00345   "COMMENT  weightGroupId\n"<<
00346   "COMMENT  threshold_sfg lut_sfg\n"<<
00347   "COMMENT =================================\n"<<
00348   "COMMENT\n"<<
00349   "COMMENT =================================\n"<<
00350   "COMMENT           strip EE structure\n"<<
00351   "COMMENT\n"<<
00352   "COMMENT  sliding_window\n"<<
00353   "COMMENT  weightGroupId\n"<<
00354   "COMMENT  threshold_fg lut_fg\n"<<
00355   "COMMENT =================================\n"<<
00356   "COMMENT\n"<<
00357   "COMMENT =================================\n"<<
00358   "COMMENT           tower EB structure\n"<<
00359   "COMMENT\n"<<
00360   "COMMENT  LUTGroupId\n"<<
00361   "COMMENT  FgGroupId\n"<<
00362   "COMMENT  spike_killing_threshold\n"<<
00363   "COMMENT =================================\n"<<
00364   "COMMENT\n"<<
00365   "COMMENT =================================\n"<<
00366   "COMMENT           tower EE structure\n"<<
00367   "COMMENT\n"<<
00368   "COMMENT  LUTGroupId\n"<<
00369   "COMMENT  tower_lut_fg\n"<<
00370   "COMMENT =================================\n"<<
00371   "COMMENT\n"<<
00372   "COMMENT =================================\n"<<
00373   "COMMENT           Weight structure\n"<<
00374   "COMMENT\n"<<
00375   "COMMENT  weightGroupId\n"<<
00376   "COMMENT  w0, w1, w2, w3, w4\n"<<
00377   "COMMENT =================================\n"<<
00378   "COMMENT\n"<<
00379   "COMMENT =================================\n"<<
00380   "COMMENT           lut structure\n"<<
00381   "COMMENT\n"<<
00382   "COMMENT  LUTGroupId\n"<<
00383   "COMMENT  LUT[1-1024]\n"<<
00384   "COMMENT =================================\n"<<
00385   "COMMENT\n"<<
00386   "COMMENT =================================\n"<<
00387   "COMMENT           fg EB structure\n"<<
00388   "COMMENT\n"<<
00389   "COMMENT  FgGroupId\n"<<
00390   "COMMENT  el, eh, tl, th, lut_fg\n"<<
00391   "COMMENT =================================\n"<<
00392   "COMMENT"<<std::endl;
00393 }
00394 
00395 /*void EcalTPCondAnalyzer::printTOWEREB(const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup,const EcalTPGLutGroup *ecaltpgLutGroup) const {
00396 
00397     const EcalTPGGroups::EcalTPGGroupsMap &lutMap=ecaltpgLutGroup->getMap();
00398     EcalTPGGroups::EcalTPGGroupsMapItr lutGroupId;
00399     const EcalTPGGroups::EcalTPGGroupsMap &fgMap=ecaltpgFgEBGroup->getMap();
00400     EcalTPGGroups::EcalTPGGroupsMapItr it;
00401     
00402     std::cout<<std::endl;
00403     for (it=fgMap.begin();it!=fgMap.end();++it) {
00404       std::cout <<"TOWER_EB "<<std::dec<<(*it).first<<std::endl;
00405       lutGroupId=lutMap.find((*it).first);
00406       std::cout <<" "<<(*it).second<<std::endl;
00407       std::cout <<" "<<(*lutGroupId).second<<std::endl;
00408     }
00409 }
00410 */
00411 
00412 void EcalTPCondAnalyzer::printTOWEREB(const EcalTPGSpike *ecaltpgSpikeTh, const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup,const EcalTPGLutGroup *ecaltpgLutGroup) const {
00413  
00414     const EcalTPGGroups::EcalTPGGroupsMap &lutMap=ecaltpgLutGroup->getMap();
00415     EcalTPGGroups::EcalTPGGroupsMapItr lutGroupId;
00416     const EcalTPGGroups::EcalTPGGroupsMap &fgMap=ecaltpgFgEBGroup->getMap();
00417     EcalTPGGroups::EcalTPGGroupsMapItr it;
00418     
00419     const EcalTPGSpike::EcalTPGSpikeMap spikeThMap = ecaltpgSpikeTh->getMap();
00420     EcalTPGSpike::EcalTPGSpikeMapIterator itSpikeTh;
00421     
00422     std::cout<<std::endl;
00423     for (it=fgMap.begin();it!=fgMap.end();++it) {
00424       std::cout <<"TOWER_EB "<<std::dec<<(*it).first<<std::endl;
00425       lutGroupId=lutMap.find((*it).first);
00426       itSpikeTh=spikeThMap.find((*it).first);
00427       std::cout <<" "<<(*it).second<<std::endl;
00428       std::cout <<" "<<(*lutGroupId).second<<std::endl;
00429       std::cout <<" "<<(*itSpikeTh).second<<std::endl; 
00430     }
00431 }
00432 
00433 void EcalTPCondAnalyzer::printTOWEREE(const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE,const EcalTPGLutGroup *ecaltpgLutGroup) const {
00434 
00435     EcalTPGFineGrainTowerEEMapIterator it;
00436     const EcalTPGFineGrainTowerEEMap map=ecaltpgFineGrainTowerEE->getMap();
00437     const EcalTPGGroups::EcalTPGGroupsMap &lutMap=ecaltpgLutGroup->getMap();
00438     EcalTPGGroups::EcalTPGGroupsMapItr lutGroupId;
00439 
00440     std::cout<<std::endl;
00441     for (it=map.begin();it!=map.end();++it) {
00442       std::cout <<"TOWER_EE "<<std::dec<<(*it).first<<std::endl;
00443       lutGroupId=lutMap.find((*it).first);
00444       std::cout <<" "<<(*lutGroupId).second<<std::endl;
00445       std::cout <<std::hex<<"0x"<<(*it).second<<std::endl;
00446     }
00447 }
00448 
00449 /*void EcalTPCondAnalyzer::printBadX(const EcalTPGCrystalStatus *ecaltpgBadX) const {
00450   
00451   std::ofstream myfile;
00452   myfile.open("badXvalues.txt");
00453   
00454   const EcalTPGCrystalStatusMap & badXMap = ecaltpgBadX->getMap();
00455 
00456   const std::vector<DetId> & ebCells = theBarrelGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel);
00457 
00458   myfile <<"COMMENT ====== barrel masked crystals ====== "<<std::endl; 
00459   myfile << "RawId         eta      phi   " << std::endl; 
00460 
00461   for (std::vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
00462 
00463     EBDetId id(*it) ;
00464     const EcalTPGCrystalStatusCode &badXeb=badXMap[id.rawId()];
00465     // Print in the text file obly the masked crystals
00466     if (badXeb.getStatusCode() != 0){    
00467       myfile << "" << id.rawId() << "      " << id.ieta() << "      " << id.iphi() << std::endl;
00468     }
00469     
00470   }
00471   
00472   myfile << " " << std::endl;
00473 
00474   const std::vector<DetId> & eeCells = theEndcapGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap);
00475   
00476   myfile <<"COMMENT ====== endcap masked crystals ====== "<<std::endl; 
00477   myfile << "RawId       x      y      z   " << std::endl; 
00478   
00479   for (std::vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
00480     
00481     EEDetId id(*it) ;
00482     const EcalTPGCrystalStatusCode &badXee=badXMap[id.rawId()];
00483     // Print in the text file only the masked clystals
00484     if (badXee.getStatusCode() != 0){ 
00485       myfile << "" << id.rawId() << "   " << id.ix() << "      " << id.iy() << "     "<< id.zside() << std::endl;
00486     } 
00487   }
00488   
00489   myfile.close();
00490 }
00491 */
00492 
00493 
00494 /*void EcalTPCondAnalyzer::printBadTT(const EcalTPGTowerStatus *ecaltpgBadTT) const {
00495   std::ofstream myfilebadTT;
00496   myfilebadTT.open("badTTvalues.txt");
00497   int ieta = 0;
00498   int iphi = 0;
00499   
00500   const EcalTPGTowerStatusMap & badTTMap = ecaltpgBadTT -> getMap();
00501   EcalTPGTowerStatusMapIterator it;
00502   
00503   myfilebadTT <<"Barrel and endcap masked Trigger Towers"<<std::endl;
00504   myfilebadTT <<"RawId " << "     iphi " << "  ieta " << std::endl;
00505   myfilebadTT <<""<< std::endl;
00506   
00507   for (it=badTTMap.begin();it!=badTTMap.end();++it) {
00508     
00509     // Print in the text file only the masked barrel and endcap TTs
00510     if ((*it).second != 0){
00511     
00512       EcalTrigTowerDetId  ttId((*it).first);
00513       ieta = ttId.ieta();
00514       iphi = ttId.iphi();
00515 
00516       myfilebadTT <<""<< std::dec<<(*it).first << "  " << iphi << "     " << ieta << std::endl;
00517       
00518     }
00519   }
00520   
00521   
00522   myfilebadTT.close();
00523 
00524 }
00525 */