CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapEcal.h

Go to the documentation of this file.
00001 #ifndef _CALO_MISCALIB_MAP_ECAL
00002 #define _CALO_MISCALIB_MAP_ECAL
00003 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h"
00004 #include "CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMap.h"
00005 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00006 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00007 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00008 #include "FWCore/Framework/interface/EDProducer.h"
00009 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00010 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00011 #include <iostream>
00012 #include <iomanip>
00013 #include <map>
00014 #include <vector>
00015 
00016 
00017 
00018 class CaloMiscalibMapEcal: public CaloMiscalibMap {
00019 public:
00020 CaloMiscalibMapEcal(){ 
00021 }
00022 
00023 void prefillMap(){
00024   
00025 
00026    for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
00027      if(iEta==0) continue;
00028      for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
00029 
00030        try 
00031          {
00032            EBDetId ebdetid(iEta,iPhi);
00033            map_.setValue(ebdetid.rawId(),1.0);
00034          }
00035        catch (...)
00036          {
00037          }
00038      }
00039    }
00040    
00041    for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00042      for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00043        try 
00044          {
00045            EEDetId eedetidpos(iX,iY,1);
00046            map_.setValue(eedetidpos.rawId(),1.0);
00047            EEDetId eedetidneg(iX,iY,-1);
00048            map_.setValue(eedetidneg.rawId(),1.0);
00049          }
00050        catch (...)
00051          {
00052          }
00053      }
00054    }
00055 
00056 
00057 }
00058 
00059 
00060 virtual void addCell(const DetId &cell, float scaling_factor)
00061 {
00062 map_.setValue(cell.rawId(),scaling_factor);
00063 }
00064 
00065 void print()
00066  {
00067 
00068    int icount=0;
00069    for(int iEta=-EBDetId::MAX_IETA; iEta<=EBDetId::MAX_IETA ;++iEta) {
00070      if(iEta==0) continue;
00071      for(int iPhi=EBDetId::MIN_IPHI; iPhi<=EBDetId::MAX_IPHI; ++iPhi) {
00072        if (EBDetId::validDetId(iEta,iPhi))
00073          {
00074            EBDetId ebdetid(iEta,iPhi);
00075            EcalIntercalibConstantMap::const_iterator icalit= map_.find(ebdetid.rawId());
00076            EcalIntercalibConstant icalconst;
00077            icalconst = (*icalit);
00078            
00079            icount++;
00080            if(icount%230==0){
00081              std::cout<< "here is value for chan eta/phi "<<iEta<<"/"<<iPhi<<"="<<icalconst<<std::endl;}
00082          }
00083      }
00084    }
00085    for(int iX=EEDetId::IX_MIN; iX<=EEDetId::IX_MAX ;++iX) {
00086      for(int iY=EEDetId::IY_MIN; iY<=EEDetId::IY_MAX; ++iY) {
00087        if (EEDetId::validDetId(iX,iY,1))
00088          {
00089            EEDetId eedetidpos(iX,iY,1);
00090            EcalIntercalibConstantMap::const_iterator icalit= map_.find(eedetidpos.rawId());
00091            EcalIntercalibConstant icalconst;
00092            icalconst = (*icalit);
00093 
00094            EEDetId eedetidneg(iX,iY,-1);
00095            EcalIntercalibConstantMap::const_iterator icalit2= map_.find(eedetidneg.rawId());
00096            EcalIntercalibConstant icalconst2;
00097            icalconst2 = (*icalit2);
00098 
00099 
00100            icount++;
00101            if(icount%230==0){
00102 
00103              std::cout<< "here is value for chan x/y "<<iX<<"/"<<iY<<" pos side is ="<<icalconst<< " and neg side is= "<< icalconst2<<std::endl;}
00104 
00105          }
00106      }
00107    }
00108  
00109 }
00110 
00111 const EcalIntercalibConstants & get(){
00112 return map_;
00113 }
00114 
00115 private:
00116 
00117 EcalIntercalibConstants map_;
00118 const CaloSubdetectorGeometry *geometry;
00119 };
00120 
00121 #endif