CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalDeadChannelRecoveryAlgos Class Reference

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

Public Member Functions

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

Private Member Functions

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

Private Attributes

const CaloTopologycalotopo
 

Detailed Description

Date:
2010/08/06 20:24:54
Revision:
1.7

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

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

Definition at line 35 of file EcalDeadChannelRecoveryAlgos.h.

Constructor & Destructor Documentation

EcalDeadChannelRecoveryAlgos::EcalDeadChannelRecoveryAlgos ( const CaloTopology theCaloTopology)

Definition at line 51 of file EcalDeadChannelRecoveryAlgos.cc.

53 {
54  //now do what ever initialization is needed
55  calotopo = theCaloTopology;
56 }
EcalDeadChannelRecoveryAlgos::EcalDeadChannelRecoveryAlgos ( )
EcalDeadChannelRecoveryAlgos::~EcalDeadChannelRecoveryAlgos ( )

Definition at line 59 of file EcalDeadChannelRecoveryAlgos.cc.

60 {
61 
62  // do anything here that needs to be done at desctruction time
63  // (e.g. close files, deallocate resources etc.)
64 
65 }

Member Function Documentation

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

Definition at line 109 of file EcalDeadChannelRecoveryAlgos.cc.

110 {
111  return correct(Id, hit_collection, algo_, Sum8Cut);
112 }
EcalRecHit correct(const EBDetId Id, const EcalRecHitCollection *hit_collection, std::string algo_, double Sum8Cut)
EcalRecHit EcalDeadChannelRecoveryAlgos::correct ( const EBDetId  Id,
const EcalRecHitCollection hit_collection,
std::string  algo_,
double  Sum8Cut 
)

Definition at line 73 of file EcalDeadChannelRecoveryAlgos.cc.

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

74 {
75  double NewEnergy=0.0;
76 
77  double MNxN[121];
78  int IndDeadChannel[1]={-1};
79 
80  double sum8 = MakeNxNMatrice(Id,hit_collection,IndDeadChannel,MNxN);
81 
82  if(algo_=="Spline"){
83 
84  if(sum8>Sum8Cut){
85  if(IndDeadChannel[0]>0)NewEnergy = CorrectDeadChannelsClassic(MNxN,Id.ieta());
86  }
87  }else if(algo_=="NeuralNetworks"){
88  if(sum8>Sum8Cut){
89  if(IndDeadChannel[0]>0)NewEnergy = CorrectDeadChannelsNN(MNxN);
90  }
91  }
92 
93  // protect against non physical high values
94  // < sum(energy in neighbours) > = 0.8 * xtal with maximum energy
95  // => can choose 5 as highest possible energy to be assigned to
96  // the dead channel
97  uint32_t flag = 0;
98  if ( NewEnergy > 5. * sum8 ) {
99  NewEnergy = 0;
100  //flag = EcalRecHit::kDead;
101  }
102 
103  EcalRecHit NewHit(Id,NewEnergy,0, flag);
104  return NewHit;
105 
106 }
long int flag
Definition: mlp_lapack.h:47
double CorrectDeadChannelsClassic(double *M11x11Input, const int DCeta)
int ieta() const
get the crystal ieta
Definition: EBDetId.h:52
double MakeNxNMatrice(EBDetId itID, const EcalRecHitCollection *hit_collection, int *IndDeadChannel, double *MNxN)
double CorrectDeadChannelsNN(double *M5x5Input)
double EcalDeadChannelRecoveryAlgos::MakeNxNMatrice ( EBDetId  itID,
const EcalRecHitCollection hit_collection,
int *  IndDeadChannel,
double *  MNxN 
)
private

Definition at line 121 of file EcalDeadChannelRecoveryAlgos.cc.

References abs, DetId::Ecal, EcalBarrel, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), CaloSubdetectorTopology::getWindow(), i, EBDetId::ieta(), EBDetId::iphi(), DetId::null(), and findQualityFiles::size.

121  {
122 
123  // std::cout<<" In MakeNxNMatrice "<<std::endl;
124 
125  //Build NxN around a given cristal
126  for(int i=0; i<121;i++)MNxN[i]=0.0;
127 
128 // std::cout<<"===================================================================="<<std::endl;
129 // std::cout<<" Dead Cell CENTRAL eta = "<< itID.ieta()<<" , phi = "<< itID.iphi()<<std::endl;
130 
132  int size =5;
133  std::vector<DetId> NxNaroundDC = topology->getWindow(itID,size,size);
134  // std::cout<<"===================================================================="<<std::endl;
135 
136 
137  // std::cout<<"NxNaroundDC size is = "<<NxNaroundDC.size()<<std::endl;
138  std::vector<DetId>::const_iterator theCells;
139 
140  EBDetId EBCellMax = itID;
141  double EnergyMax = 0.0;
142 
143  for(theCells=NxNaroundDC.begin();theCells<NxNaroundDC.end();theCells++){
144  EBDetId EBCell = EBDetId(*theCells);
145 
146  // We Will look for the cristal with maximum energy
147  if(!EBCell.null()){
148  EcalRecHitCollection::const_iterator goS_it = hit_collection->find(EBCell);
149  if( goS_it != hit_collection->end() && goS_it->energy()>=EnergyMax){EnergyMax=goS_it->energy(); EBCellMax = EBCell;}
150  }else{
151  continue;
152  }
153  }
154  if(EBCellMax.null()){/*cout<<" Error No maximum found around dead channel, no corrections applied"<<std::endl;*/return 0;}
155  // std::cout << " Max Cont Crystal eta phi E = " << EBCellMax.ieta() <<" "<< EBCellMax.iphi() <<" "<< EnergyMax<<std::endl;
156 
157 
158 
159  //NxNaroundMaxCont with N==11
160  // 000 is now the maximum containement one:
162  //Any modification of the following parameters will require changes in the Correction algos
163  // The window is large enought to avoid modification of the number.
164  int FixedSize =11;
165  std::vector<DetId> NxNaroundMaxCont = topology->getWindow(EBCellMax,FixedSize,FixedSize);
166 
167  double ESUMis=0.0;
168  int theIndex=0;
169 
170  std::vector<DetId>::const_iterator itCells;
171  for(itCells=NxNaroundMaxCont.begin();itCells<NxNaroundMaxCont.end();itCells++){
172  EBDetId EBitCell = EBDetId(*itCells);
173  int CReta = EBitCell.ieta();
174  int CRphi = EBitCell.iphi();
175 
176  double Energy = 0.0;
177  if(!EBitCell.null()){
178  EcalRecHitCollection::const_iterator goS_it = hit_collection->find(EBitCell);
179  if( goS_it != hit_collection->end() ) Energy=goS_it->energy();
180  }
181 
182  // std::cout<<"Around DC we have eta,phi,E "<<CReta<<" "<<CRphi<<" "<<Energy<<std::endl;
183 
184  //============
185  int ietaCorr = 0;
186  if((CReta * EBCellMax.ieta()) < 0 && EBCellMax.ieta()>0 )ietaCorr= -1;
187  if((CReta * EBCellMax.ieta()) < 0 && EBCellMax.ieta()<0 )ietaCorr= 1;
188  if((CReta * EBCellMax.ieta()) > 0 )ietaCorr= 0;
189  int ieta = -( (CReta -ietaCorr) - EBCellMax.ieta() ) + int((FixedSize - 1)/2);
190 
191  int iphiCorr = 0;
192  if((CRphi - EBCellMax.iphi())> 50)iphiCorr= 360;
193  if((CRphi - EBCellMax.iphi())<-50)iphiCorr=-360;
194  int iphi = CRphi - EBCellMax.iphi() - iphiCorr + int((FixedSize - 1)/2);
195 
196  int MIndex = ieta+iphi*FixedSize;
197  if(abs(CReta)<=85)
198  MNxN[MIndex]=Energy;
199  if(EBitCell == itID)IndDeadChannel[0]= MIndex;
200 
201 
202  //============
203 
204 
205 
206 
207  //We add up the energy in 5x5 around the MaxCont to decide if we will correct for DCs
208  // if(theIndex>=36 && theIndex<=40)ESUMis += Energy;
209  //SB: Modify to sum8 only
210  if(theIndex>=48 && theIndex<=50)ESUMis += Energy;
211  if(theIndex>=59 && theIndex<=61)ESUMis += Energy;
212  if(theIndex>=70 && theIndex<=72)ESUMis += Energy;
213  // if(theIndex>=80 && theIndex<=84)ESUMis += Energy;
214  theIndex++;
215  }
216  // std::cout<<"Around MaxCont Collected Energy in 5x5 is = "<< ESUMis <<std::endl;
217  //So now, we have a vector which is ordered around the Maximum containement and which contains a dead channel as:
218  //Filling of the vector : NxNaroundDC with N==11 Typo are possible...
219  // 000 is Maximum containement which is in +/- 5 from DC
220  //
221  // 120 119 118 117 116 115 114 113 112 111 110
222  // 109 108 107 106 105 104 103 102 101 100 099
223  // 098 097 096 095 094 093 092 091 090 089 088
224  // 087 086 085 084 083 082 081 080 079 078 077
225  // 076 075 074 073 072 071 070 069 068 067 066
226  // 065 064 063 062 061 060 059 058 057 056 055
227  // 054 053 052 051 050 049 048 047 046 045 044
228  // 043 042 041 040 039 038 037 036 035 034 033
229  // 032 031 030 029 028 027 026 025 024 023 022
230  // 021 020 019 018 017 016 015 014 013 012 011
231  // 010 009 008 007 006 005 004 003 002 001 000
233 
234 
235 
236  //================
237 
238  return ESUMis;
239 }
int i
Definition: DBlmapReader.cc:9
std::vector< EcalRecHit >::const_iterator const_iterator
#define abs(x)
Definition: mlp_lapack.h:159
int iphi() const
get the crystal iphi
Definition: EBDetId.h:54
int ieta() const
get the crystal ieta
Definition: EBDetId.h:52
const_iterator end() const
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
bool null() const
is this a null id ?
Definition: DetId.h:47
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
iterator find(key_type k)
tuple size
Write out results.

Member Data Documentation

const CaloTopology* EcalDeadChannelRecoveryAlgos::calotopo
private

Definition at line 47 of file EcalDeadChannelRecoveryAlgos.h.