CMS 3D CMS Logo

EcalDeadChannelRecoveryAlgos Class Reference

Date
2007/05/09 14:58:40
Revision
1.3
More...

#include <RecoLocalCalo/EcalDeadChannelRecoveryAlgos/src/EcalDeadChannelRecoveryAlgos.cc>

List of all members.

Public Member Functions

EcalRecHit Correct (const EBDetId Id, const EcalRecHitCollection *hit_collection, string algo_, double Sum8Cut)
 EcalDeadChannelRecoveryAlgos ()
 EcalDeadChannelRecoveryAlgos (const CaloTopology theCaloTopology)
 ~EcalDeadChannelRecoveryAlgos ()

Private Member Functions

double MakeNxNMatrice (EBDetId itID, const EcalRecHitCollection *hit_collection, double *MNxN)

Private Attributes

CaloTopology calotopo


Detailed Description

Date
2007/05/09 14:58:40
Revision
1.3

Description: <one line="" class="" summary>="">.

Implementation: <Notes on="" implementation>="">

Definition at line 37 of file EcalDeadChannelRecoveryAlgos.h.


Constructor & Destructor Documentation

EcalDeadChannelRecoveryAlgos::EcalDeadChannelRecoveryAlgos ( const CaloTopology  theCaloTopology  ) 

Definition at line 51 of file EcalDeadChannelRecoveryAlgos.cc.

References calotopo.

00053 {
00054   //now do what ever initialization is needed
00055   calotopo = theCaloTopology;
00056 }

EcalDeadChannelRecoveryAlgos::EcalDeadChannelRecoveryAlgos (  ) 

EcalDeadChannelRecoveryAlgos::~EcalDeadChannelRecoveryAlgos (  ) 

Definition at line 59 of file EcalDeadChannelRecoveryAlgos.cc.

00060 {
00061  
00062    // do anything here that needs to be done at desctruction time
00063    // (e.g. close files, deallocate resources etc.)
00064 
00065 }


Member Function Documentation

EcalRecHit EcalDeadChannelRecoveryAlgos::Correct ( const EBDetId  Id,
const EcalRecHitCollection hit_collection,
string  algo_,
double  Sum8Cut 
)

Definition at line 73 of file EcalDeadChannelRecoveryAlgos.cc.

References CorrectDeadChannelsClassic(), CorrectDeadChannelsNN(), EBDetId::ieta(), and MakeNxNMatrice().

Referenced by EcalDeadChannelRecoveryProducers::produce().

00074 {
00075   double NewEnergy=0.0;
00076   
00077   double MNxN[121];
00078 
00079   if(algo_=="Spline"){
00080      
00081     if(MakeNxNMatrice(Id,hit_collection,MNxN)>Sum8Cut){
00082       NewEnergy = CorrectDeadChannelsClassic(MNxN,Id.ieta());
00083     }
00084   }else if(algo_=="NeuralNetworks"){
00085    
00086     if(MakeNxNMatrice(Id,hit_collection,MNxN)>Sum8Cut){
00087       NewEnergy = CorrectDeadChannelsNN(MNxN);
00088     }
00089   }
00090   
00091 
00092   EcalRecHit NewHit(Id,NewEnergy,0);
00093   return NewHit;
00094 
00095 }

double EcalDeadChannelRecoveryAlgos::MakeNxNMatrice ( EBDetId  itID,
const EcalRecHitCollection hit_collection,
double *  MNxN 
) [private]

Definition at line 105 of file EcalDeadChannelRecoveryAlgos.cc.

References funct::abs(), calotopo, GenMuonPlsPt100GeV_cfg::cout, DetId::Ecal, EcalBarrel, edm::SortedCollection< T, SORT >::end(), lat::endl(), edm::SortedCollection< T, SORT >::find(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), i, EBDetId::ieta(), int, EBDetId::iphi(), DetId::null(), and size.

Referenced by Correct().

00105                                                                                                                         {
00106 
00107 
00108 
00109   //Build NxN around a given cristal
00110   for(int i=0; i<121;i++)MNxN[i]=0.0;
00111   
00112   //cout<<"===================================================================="<<endl;
00113   //cout<<" Dead Cell CENTRAL  eta = "<< itID.ieta()<<" ,  phi = "<< itID.iphi()<<endl;
00114 
00115   const CaloSubdetectorTopology* topology=calotopo.getSubdetectorTopology(DetId::Ecal,EcalBarrel);
00116   int size =5;
00117   std::vector<DetId> NxNaroundDC = topology->getWindow(itID,size,size);
00118   
00119   
00120   //cout<<"NxNaroundDC size is = "<<NxNaroundDC.size()<<endl;
00121   vector<DetId>::const_iterator theCells;
00122   
00123   EBDetId EBCellMax = itID;
00124   double EnergyMax = 0.0;
00125 
00126   for(theCells=NxNaroundDC.begin();theCells<NxNaroundDC.end();theCells++){
00127     EBDetId EBCell = EBDetId(*theCells);
00128       
00129     // We Will look for the cristal with maximum energy 
00130     if(!EBCell.null()){
00131       EcalRecHitCollection::const_iterator goS_it = hit_collection->find(EBCell);
00132       if( goS_it !=  hit_collection->end() && goS_it->energy()>=EnergyMax){EnergyMax=goS_it->energy(); EBCellMax = EBCell;}
00133     }else{
00134       continue; 
00135     }
00136   } 
00137   if(EBCellMax.null()){cout<<" Error No maximum found around dead channel, no corrections applied"<<endl;return 0;}
00138   //cout << " Max Cont Crystal eta phi E = " << EBCellMax.ieta() <<" "<< EBCellMax.iphi() <<" "<< EnergyMax<<endl;
00139 
00140 
00141   
00142   //NxNaroundMaxCont with N==11
00143   // 000 is now the maximum containement one:
00145   //Any modification of the following parameters will require changes in the Correction algos
00146   // The window is large enought to avoid modification of the number.
00147   int FixedSize =11;
00148   std::vector<DetId> NxNaroundMaxCont = topology->getWindow(EBCellMax,FixedSize,FixedSize);
00149 
00150   double ESUMis=0.0;
00151   int theIndex=0;
00152 
00153   vector<DetId>::const_iterator itCells;
00154   for(itCells=NxNaroundMaxCont.begin();itCells<NxNaroundMaxCont.end();itCells++){
00155     EBDetId EBitCell = EBDetId(*itCells);
00156     int CReta = EBitCell.ieta();
00157     int CRphi = EBitCell.iphi();
00158 
00159     double Energy = 0.0;
00160     if(!EBitCell.null()){
00161       EcalRecHitCollection::const_iterator goS_it = hit_collection->find(EBitCell);
00162       if( goS_it !=  hit_collection->end() ) Energy=goS_it->energy();
00163     }
00164 
00165     //cout<<"Around DC we have eta,phi,E "<<CReta<<" "<<CRphi<<" "<<Energy<<endl;
00166 
00167     //============
00168     int ietaCorr = 0;
00169     if((CReta * EBCellMax.ieta()) < 0 && EBCellMax.ieta()>0 )ietaCorr= -1;
00170     if((CReta * EBCellMax.ieta()) < 0 && EBCellMax.ieta()<0 )ietaCorr=  1;
00171     if((CReta * EBCellMax.ieta()) > 0 )ietaCorr= 0;
00172     int ieta = -( (CReta -ietaCorr) - EBCellMax.ieta() ) + int((FixedSize - 1)/2);
00173 
00174     int iphiCorr = 0;
00175     if((CRphi - EBCellMax.iphi())> 50)iphiCorr= 360;
00176     if((CRphi - EBCellMax.iphi())<-50)iphiCorr=-360;
00177     int iphi = CRphi - EBCellMax.iphi() - iphiCorr + int((FixedSize - 1)/2);
00178 
00179     int MIndex = ieta+iphi*FixedSize;
00180     if(abs(CReta)<=85)
00181     MNxN[MIndex]=Energy;
00182     
00183     
00184     //============
00185 
00186 
00187 
00188     
00189     //We add up the energy in 5x5 around the MaxCont to decide if we will correct for DCs
00190     if(theIndex>=36 && theIndex<=40)ESUMis +=  Energy;
00191     if(theIndex>=47 && theIndex<=51)ESUMis +=  Energy;
00192     if(theIndex>=58 && theIndex<=62)ESUMis +=  Energy;
00193     if(theIndex>=69 && theIndex<=73)ESUMis +=  Energy;
00194     if(theIndex>=80 && theIndex<=84)ESUMis +=  Energy;
00195     theIndex++;
00196   }
00197   //cout<<"Around MaxCont Collected Energy in 5x5 is =  "<< ESUMis  <<endl;
00198   //So now, we have a vector which is ordered around the Maximum containement and which contains a dead channel as:
00199     //Filling of the vector : NxNaroundDC with N==11 Typo are possible...
00200     // 000 is Maximum containement which is in +/- 5 from DC
00201     //
00202     // 120 119 118 117 116 115 114 113 112 111 110  
00203     // 109 108 107 106 105 104 103 102 101 100 099 
00204     // 098 097 096 095 094 093 092 091 090 089 088
00205     // 087 086 085 084 083 082 081 080 079 078 077
00206     // 076 075 074 073 072 071 070 069 068 067 066
00207     // 065 064 063 062 061 060 059 058 057 056 055
00208     // 054 053 052 051 050 049 048 047 046 045 044
00209     // 043 042 041 040 039 038 037 036 035 034 033
00210     // 032 031 030 029 028 027 026 025 024 023 022
00211     // 021 020 019 018 017 016 015 014 013 012 011
00212     // 010 009 008 007 006 005 004 003 002 001 000
00214   
00215 
00216   
00217   //================
00218 
00219   return ESUMis;
00220 }


Member Data Documentation

CaloTopology EcalDeadChannelRecoveryAlgos::calotopo [private]

Definition at line 48 of file EcalDeadChannelRecoveryAlgos.h.

Referenced by EcalDeadChannelRecoveryAlgos(), and MakeNxNMatrice().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:29 2009 for CMSSW by  doxygen 1.5.4