CMS 3D CMS Logo

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

#include <EcalRecHitWorkerRecover.h>

Inheritance diagram for EcalRecHitWorkerRecover:
EcalRecHitWorkerBaseClass

Public Member Functions

 EcalRecHitWorkerRecover (const edm::ParameterSet &)
 
bool run (const edm::Event &evt, const EcalUncalibratedRecHit &uncalibRH, EcalRecHitCollection &result)
 
void set (const edm::EventSetup &es)
 
virtual ~EcalRecHitWorkerRecover ()
 
- Public Member Functions inherited from EcalRecHitWorkerBaseClass
 EcalRecHitWorkerBaseClass (const edm::ParameterSet &)
 
virtual ~EcalRecHitWorkerBaseClass ()
 

Protected Member Functions

bool alreadyInserted (const DetId &id)
 
float estimateEnergy (int ieta, EcalRecHitCollection *hits, std::set< DetId > sId, std::vector< DetId > vId)
 
void insertRecHit (const EcalRecHit &hit, EcalRecHitCollection &collection)
 
float recCheckCalib (float energy, int ieta)
 

Protected Attributes

edm::ESHandle< CaloGeometrycaloGeometry_
 
edm::ESHandle< CaloTopologycaloTopology_
 
const CaloSubdetectorGeometryebGeom_
 
const EcalElectronicsMappingecalMapping_
 
EcalTPGScale ecalScale_
 
const CaloSubdetectorGeometryeeGeom_
 
const CaloGeometrygeo_
 
bool killDeadChannels_
 
edm::ESHandle< EcalLaserDbServicelaser
 
double logWarningEtThreshold_EB_FE_
 
double logWarningEtThreshold_EE_FE_
 
edm::ESHandle
< CaloSubdetectorGeometry
pEBGeom_
 
edm::ESHandle
< EcalElectronicsMapping
pEcalMapping_
 
edm::ESHandle
< CaloSubdetectorGeometry
pEEGeom_
 
EcalRecHitSimpleAlgorechitMaker_
 
bool recoverEBFE_
 
bool recoverEBIsolatedChannels_
 
bool recoverEBVFE_
 
std::set< DetIdrecoveredDetIds_EB_
 
std::set< DetIdrecoveredDetIds_EE_
 
bool recoverEEFE_
 
bool recoverEEIsolatedChannels_
 
bool recoverEEVFE_
 
std::string singleRecoveryMethod_
 
double singleRecoveryThreshold_
 
edm::InputTag tpDigiCollection_
 
edm::ESHandle
< EcalTrigTowerConstituentsMap
ttMap_
 

Additional Inherited Members

- Public Types inherited from EcalRecHitWorkerBaseClass
enum  RecoveryFlags {
  EB_single, EE_single, EB_VFE, EE_VFE,
  EB_FE, EE_FE
}
 

Detailed Description

Algorithms to recover dead channels

Id:
EcalRecHitWorkerRecover.h,v 1.7 2010/12/03 12:58:16 argiro Exp
Date:
2010/12/03 12:58:16
Revision:
1.7

Definition at line 29 of file EcalRecHitWorkerRecover.h.

Constructor & Destructor Documentation

EcalRecHitWorkerRecover::EcalRecHitWorkerRecover ( const edm::ParameterSet ps)

Definition at line 22 of file EcalRecHitWorkerRecover.cc.

References edm::ParameterSet::getParameter(), killDeadChannels_, logWarningEtThreshold_EB_FE_, logWarningEtThreshold_EE_FE_, rechitMaker_, recoverEBFE_, recoverEBIsolatedChannels_, recoverEBVFE_, recoverEEFE_, recoverEEIsolatedChannels_, recoverEEVFE_, singleRecoveryMethod_, singleRecoveryThreshold_, and tpDigiCollection_.

22  :
24 {
26  // isolated channel recovery
27  singleRecoveryMethod_ = ps.getParameter<std::string>("singleChannelRecoveryMethod");
28  singleRecoveryThreshold_ = ps.getParameter<double>("singleChannelRecoveryThreshold");
29  killDeadChannels_ = ps.getParameter<bool>("killDeadChannels");
30  recoverEBIsolatedChannels_ = ps.getParameter<bool>("recoverEBIsolatedChannels");
31  recoverEEIsolatedChannels_ = ps.getParameter<bool>("recoverEEIsolatedChannels");
32  recoverEBVFE_ = ps.getParameter<bool>("recoverEBVFE");
33  recoverEEVFE_ = ps.getParameter<bool>("recoverEEVFE");
34  recoverEBFE_ = ps.getParameter<bool>("recoverEBFE");
35  recoverEEFE_ = ps.getParameter<bool>("recoverEEFE");
36 
37  tpDigiCollection_ = ps.getParameter<edm::InputTag>("triggerPrimitiveDigiCollection");
38  logWarningEtThreshold_EB_FE_ = ps.getParameter<double>("logWarningEtThreshold_EB_FE");
39  logWarningEtThreshold_EE_FE_ = ps.getParameter<double>("logWarningEtThreshold_EE_FE");
40 }
T getParameter(std::string const &) const
EcalRecHitWorkerBaseClass(const edm::ParameterSet &)
EcalRecHitSimpleAlgo * rechitMaker_
virtual EcalRecHitWorkerRecover::~EcalRecHitWorkerRecover ( )
inlinevirtual

Definition at line 32 of file EcalRecHitWorkerRecover.h.

32 {};

Member Function Documentation

bool EcalRecHitWorkerRecover::alreadyInserted ( const DetId id)
protected

Definition at line 377 of file EcalRecHitWorkerRecover.cc.

References EcalBarrel, EcalEndcap, recoveredDetIds_EB_, and recoveredDetIds_EE_.

Referenced by insertRecHit(), and run().

378 {
379  bool res = false;
380  if ( id.subdetId() == EcalBarrel ) {
381  res = ( recoveredDetIds_EB_.find( id ) != recoveredDetIds_EB_.end() );
382  } else if ( id.subdetId() == EcalEndcap ) {
383  res = ( recoveredDetIds_EE_.find( id ) != recoveredDetIds_EE_.end() );
384  } else {
385  edm::LogError("EcalRecHitWorkerRecover::InvalidDetId") << "Invalid DetId " << id.rawId();
386  }
387  return res;
388 }
std::set< DetId > recoveredDetIds_EE_
std::set< DetId > recoveredDetIds_EB_
float EcalRecHitWorkerRecover::estimateEnergy ( int  ieta,
EcalRecHitCollection hits,
std::set< DetId sId,
std::vector< DetId vId 
)
protected

Definition at line 330 of file EcalRecHitWorkerRecover.cc.

References prof2calltree::count, relval_parameters_module::energy, PV3DBase< T, PVType, FrameType >::eta(), eta(), edm::SortedCollection< T, SORT >::find(), geo_, and CaloGeometry::getPosition().

Referenced by run().

330  {
331 
332  float xtalE=0;
333  int count = 0;
334  for (std::vector<DetId>::const_iterator vIdit = vId.begin(); vIdit != vId.end(); ++ vIdit){
335  std::set<DetId>::const_iterator sIdit = sId.find(*vIdit);
336  if (sIdit==sId.end()){
337  float energy = hits->find(*vIdit)->energy();
338  float eta = geo_->getPosition(*vIdit).eta();
339  float pf = 1.0/cosh(eta);
340  xtalE += energy*pf;
341  count++;
342  }
343  }
344 
345  if (count==0) return 63.75*(ieta>26?2:1); //If there are no overlapping crystals return saturated value.
346  else return xtalE*((vId.size()/(float)count) - 1)*(ieta>26?2:1);
347 
348 
349 }
T eta() const
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:68
T eta() const
Definition: PV3DBase.h:70
iterator find(key_type k)
void EcalRecHitWorkerRecover::insertRecHit ( const EcalRecHit hit,
EcalRecHitCollection collection 
)
protected

Definition at line 352 of file EcalRecHitWorkerRecover.cc.

References alreadyInserted(), EcalBarrel, EcalEndcap, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), EcalRecHit::id(), edm::SortedCollection< T, SORT >::push_back(), DetId::rawId(), recoveredDetIds_EB_, recoveredDetIds_EE_, and DetId::subdetId().

Referenced by run().

353 {
354  // skip already inserted DetId's and raise a log warning
355  if ( alreadyInserted( hit.id() ) ) {
356  edm::LogWarning("EcalRecHitWorkerRecover") << "DetId already recovered! Skipping...";
357  return;
358  }
359  EcalRecHitCollection::iterator it = collection.find( hit.id() );
360  if ( it == collection.end() ) {
361  // insert the hit in the collection
362  collection.push_back( hit );
363  } else {
364  // overwrite existing recHit
365  *it = hit;
366  }
367  if ( hit.id().subdetId() == EcalBarrel ) {
368  recoveredDetIds_EB_.insert( hit.id() );
369  } else if ( hit.id().subdetId() == EcalEndcap ) {
370  recoveredDetIds_EE_.insert( hit.id() );
371  } else {
372  edm::LogError("EcalRecHitWorkerRecover::InvalidDetId") << "Invalid DetId " << hit.id().rawId();
373  }
374 }
bool alreadyInserted(const DetId &id)
void push_back(T const &t)
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
std::vector< T >::iterator iterator
const_iterator end() const
DetId id() const
get the id
Definition: EcalRecHit.h:74
std::set< DetId > recoveredDetIds_EE_
iterator find(key_type k)
std::set< DetId > recoveredDetIds_EB_
float EcalRecHitWorkerRecover::recCheckCalib ( float  energy,
int  ieta 
)
protected

Definition at line 392 of file EcalRecHitWorkerRecover.cc.

392  {
393 
394  return eTT;
395 
396 }
bool EcalRecHitWorkerRecover::run ( const edm::Event evt,
const EcalUncalibratedRecHit uncalibRH,
EcalRecHitCollection result 
)
virtual

Implements EcalRecHitWorkerBaseClass.

Definition at line 65 of file EcalRecHitWorkerRecover.cc.

References alreadyInserted(), caloTopology_, EcalRecHitWorkerBaseClass::EB_FE, EcalRecHitWorkerBaseClass::EB_single, EcalRecHitWorkerBaseClass::EB_VFE, ebGeom_, ecalScale_, EcalRecHitWorkerBaseClass::EE_FE, EcalRecHitWorkerBaseClass::EE_single, EcalRecHitWorkerBaseClass::EE_VFE, edm::SortedCollection< T, SORT >::end(), relval_parameters_module::energy, estimateEnergy(), PV3DBase< T, PVType, FrameType >::eta(), eta(), edm::SortedCollection< T, SORT >::find(), flags, geo_, edm::Event::getByLabel(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getPosition(), CaloCellGeometry::getPosition(), EcalTPGScale::getTPGInGeV(), i, EcalUncalibratedRecHit::id(), ExpressReco_HICollisions_FallBack::id, insertRecHit(), edm::InputTag::instance(), edm::HandleBase::isValid(), EEDetId::ix(), EcalScDetId::ix(), EEDetId::iy(), EcalScDetId::iy(), j, EcalRecHit::kDead, killDeadChannels_, EcalRecHit::kL1SpikeFlag, EcalRecHit::kNeighboursRecovered, EcalRecHit::kTowerRecovered, EcalRecHit::kTPSaturated, edm::InputTag::label(), logWarningEtThreshold_EB_FE_, logWarningEtThreshold_EE_FE_, edm::Handle< T >::product(), edm::ESHandle< class >::product(), EcalUncalibratedRecHit::recoFlag(), recoverEBFE_, recoverEBIsolatedChannels_, recoverEBVFE_, recoverEEFE_, recoverEEIsolatedChannels_, recoverEEVFE_, query::result, EcalRecHit::setFlagBits(), funct::sin(), singleRecoveryMethod_, singleRecoveryThreshold_, PV3DBase< T, PVType, FrameType >::theta(), theta(), tpDigiCollection_, ttMap_, v, EEDetId::validDetId(), EEDetId::zside(), and EcalScDetId::zside().

68 {
69  DetId detId=uncalibRH.id();
70  uint32_t flags = uncalibRH.recoFlag();
71 
72  // get laser coefficient
73  //float lasercalib = laser->getLaserCorrection( detId, evt.time());
74 
75  // killDeadChannels_ = true, means explicitely kill dead channels even if the recovered energies are computed in the code
76  // if you don't want to store the recovered energies in the rechit you can produce LogWarnings if logWarningEtThreshold_EB(EE)_FE>0
77  // logWarningEtThreshold_EB(EE)_FE_<0 will not compute the recovered energies at all (faster)
78  // Revovery in the EE is not tested, recovered energies may not make sense
79  // EE recovery computation is not tested against segmentation faults, use with caution even if you are going to killDeadChannels=true
80 
81  if ( killDeadChannels_ ) {
86  ) {
87  EcalRecHit hit( detId, 0., 0., EcalRecHit::kDead );
88  hit.setFlagBits( (0x1 << EcalRecHit::kDead) ) ;
89  insertRecHit( hit, result); // insert trivial rechit with kDead flag
90  return true;
91  }
92  if ( flags == EcalRecHitWorkerRecover::EB_FE && !recoverEBFE_) {
93  EcalTrigTowerDetId ttDetId( ((EBDetId)detId).tower() );
94  std::vector<DetId> vid = ttMap_->constituentsOf( ttDetId );
95  for ( std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); ++dit ) {
96  EcalRecHit hit( (*dit), 0., 0., EcalRecHit::kDead );
97  hit.setFlagBits( (0x1 << EcalRecHit::kDead) ) ;
98  insertRecHit( hit, result ); // insert trivial rechit with kDead flag
99  }
100  if(logWarningEtThreshold_EB_FE_<0)return true; // if you don't want log warning just return true
101  }
102  if ( flags == EcalRecHitWorkerRecover::EE_FE && !recoverEEFE_) {
103  EEDetId id( detId );
104  EcalScDetId sc( 1+(id.ix()-1)/5, 1+(id.iy()-1)/5, id.zside() );
105  std::vector<DetId> eeC;
106  for(int dx=1; dx<=5; ++dx){
107  for(int dy=1; dy<=5; ++dy){
108  int ix = (sc.ix()-1)*5 + dx;
109  int iy = (sc.iy()-1)*5 + dy;
110  int iz = sc.zside();
111  if(EEDetId::validDetId(ix, iy, iz)){
112  eeC.push_back(EEDetId(ix, iy, iz));
113  }
114  }
115  }
116  for ( size_t i = 0; i < eeC.size(); ++i ) {
117  EcalRecHit hit( eeC[i], 0., 0., EcalRecHit::kDead );
118  hit.setFlagBits( (0x1 << EcalRecHit::kDead) ) ;
119  insertRecHit( hit, result ); // insert trivial rechit with kDead flag
120  }
121  if(logWarningEtThreshold_EE_FE_<0) return true; // if you don't want log warning just return true
122  }
123  }
124 
125  if ( flags == EcalRecHitWorkerRecover::EB_single ) {
126  // recover as single dead channel
127  const EcalRecHitCollection * hit_collection = &result;
128  EcalDeadChannelRecoveryAlgos deadChannelCorrector(caloTopology_.product());
129 
130  // channel recovery
131  EcalRecHit hit = deadChannelCorrector.correct( detId, hit_collection, singleRecoveryMethod_, singleRecoveryThreshold_ );
132  EcalRecHitCollection::const_iterator ti = result.find( detId );
133  if ( hit.energy() != 0 ) {
134  hit.setFlags( EcalRecHit::kNeighboursRecovered );
135  hit.setFlagBits( (0x1 << EcalRecHit::kNeighboursRecovered) ) ;
136  } else {
137  // recovery failed
138  hit.setFlags( EcalRecHit::kDead );
139  hit.setFlagBits( (0x1 << EcalRecHit::kDead) ) ;
140  }
141  insertRecHit( hit, result );
142  } else if ( flags == EcalRecHitWorkerRecover::EB_VFE ) {
143  // recover as dead VFE
144  EcalRecHit hit( detId, 0., 0., EcalRecHit::kDead );
145  hit.setFlagBits( (0x1 << EcalRecHit::kDead) ) ;
146  // recovery not implemented
147  insertRecHit( hit, result );
148  } else if ( flags == EcalRecHitWorkerRecover::EB_FE ) {
149  // recover as dead TT
150  EcalTrigTowerDetId ttDetId( ((EBDetId)detId).tower() );
152  evt.getByLabel(tpDigiCollection_, pTPDigis);
153  const EcalTrigPrimDigiCollection * tpDigis = 0;
154  if ( pTPDigis.isValid() ) {
155  tpDigis = pTPDigis.product();
156  } else {
157  edm::LogError("EcalRecHitWorkerRecover") << "Can't get the product " << tpDigiCollection_.instance()
158  << " with label " << tpDigiCollection_.label();
159  return false;
160  }
161  EcalTrigPrimDigiCollection::const_iterator tp = tpDigis->find( ttDetId );
162  // recover the whole trigger tower
163  if ( tp != tpDigis->end() ) {
164  //std::vector<DetId> vid = ecalMapping_->dccTowerConstituents( ecalMapping_->DCCid( ttDetId ), ecalMapping_->iTT( ttDetId ) );
165  std::vector<DetId> vid = ttMap_->constituentsOf( ttDetId );
166  float tpEt = ecalScale_.getTPGInGeV( tp->compressedEt(), tp->id() );
167  float tpEtThreshEB = logWarningEtThreshold_EB_FE_;
168  if(tpEt>tpEtThreshEB){
169  edm::LogWarning("EnergyInDeadEB_FE")<<"TP energy in the dead TT = "<<tpEt<<" at "<<ttDetId;
170  }
171  if ( !killDeadChannels_ || recoverEBFE_ ) {
172  // democratic energy sharing
173  for ( std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); ++dit ) {
174  if (alreadyInserted(*dit)) continue;
175  float theta = ebGeom_->getGeometry(*dit)->getPosition().theta();
176  float tpEt = ecalScale_.getTPGInGeV( tp->compressedEt(), tp->id() );
177  EcalRecHit hit( *dit, tpEt / (float)vid.size() / sin(theta), 0., EcalRecHit::kTowerRecovered );
178  hit.setFlagBits( (0x1 << EcalRecHit::kTowerRecovered) ) ;
179  if ( tp->compressedEt() == 0xFF ) hit.setFlagBits( (0x1 << EcalRecHit::kTPSaturated) );
180  if ( tp->sFGVB() ) hit.setFlagBits( (0x1 << EcalRecHit::kL1SpikeFlag) );
181  insertRecHit( hit, result );
182  }
183  }
184  } else {
185  // tp not found => recovery failed
186  std::vector<DetId> vid = ttMap_->constituentsOf( ttDetId );
187  for ( std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); ++dit ) {
188  if (alreadyInserted(*dit)) continue;
189  EcalRecHit hit( *dit,0., 0., EcalRecHit::kDead );
190  hit.setFlagBits( (0x1 << EcalRecHit::kDead) ) ;
191  EcalRecHitCollection::iterator it = result.find( *dit );
192  insertRecHit( hit, result );
193  }
194  }
195  } else if ( flags == EcalRecHitWorkerRecover::EE_FE ) {
196  // Structure for recovery:
197  // ** SC --> EEDetId constituents (eeC) --> associated Trigger Towers (aTT) --> EEDetId constituents (aTTC)
198  // ** energy for a SC EEDetId = [ sum_aTT(energy) - sum_aTTC(energy) ] / N_eeC
199  // .. i.e. the total energy of the TTs covering the SC minus
200  // .. the energy of the recHits in the TTs but not in the SC
201  //std::vector<DetId> vid = ecalMapping_->dccTowerConstituents( ecalMapping_->DCCid( ttDetId ), ecalMapping_->iTT( ttDetId ) );
202  // due to lack of implementation of the EcalTrigTowerDetId ix,iy methods in EE we compute Et recovered energies (in EB we compute E)
203  // --- RECOVERY NOT YET VALIDATED
204  EEDetId eeId( detId );
205  EcalScDetId sc( (eeId.ix()-1)/5+1, (eeId.iy()-1)/5+1, eeId.zside() );
206  std::set<DetId> eeC;
207  for(int dx=1; dx<=5; ++dx){
208  for(int dy=1; dy<=5; ++dy){
209  int ix = (sc.ix()-1)*5 + dx;
210  int iy = (sc.iy()-1)*5 + dy;
211  int iz = sc.zside();
212  if(EEDetId::validDetId(ix, iy, iz)){
213  eeC.insert(EEDetId(ix, iy, iz));
214  }
215  }
216  }
217 
219  evt.getByLabel(tpDigiCollection_, pTPDigis);
220  const EcalTrigPrimDigiCollection * tpDigis = 0;
221  if ( pTPDigis.isValid() ) {
222  tpDigis = pTPDigis.product();
223  } else {
224  edm::LogError("EcalRecHitWorkerRecover") << "Can't get the product " << tpDigiCollection_.instance()
225  << " with label " << tpDigiCollection_.label();
226  return false;
227  }
228  // associated trigger towers
229  std::set<EcalTrigTowerDetId> aTT;
230  for ( std::set<DetId>::const_iterator it = eeC.begin(); it!=eeC.end(); ++it ) {
231  aTT.insert( ttMap_->towerOf( *it ) );
232  }
233  // associated trigger towers: total energy
234  float totE = 0;
235  // associated trigger towers: EEDetId constituents
236  std::set<DetId> aTTC;
237  bool atLeastOneTPSaturated = false;
238  for ( std::set<EcalTrigTowerDetId>::const_iterator it = aTT.begin(); it != aTT.end(); ++it ) {
239  // add the energy of this trigger tower
240  EcalTrigPrimDigiCollection::const_iterator itTP = tpDigis->find( *it );
241  if ( itTP != tpDigis->end() ) {
242  EcalTrigTowerDetId ttId = itTP->id();
243 
244  std::vector<DetId> v = ttMap_->constituentsOf( *it );
245  if ( itTP->compressedEt() == 0xFF ){ // In the case of a saturated trigger tower, a fraction
246  atLeastOneTPSaturated = true; //of the saturated energy is put in: number of xtals in dead region/total xtals in TT *63.75
247 
248  //Alternative recovery algorithm that I will now investigate.
249  //Estimate energy sums the energy in the working channels, then decides how much energy
250  //to put here depending on that. Duncan 20101203
251 
252  totE += estimateEnergy(itTP->id().ietaAbs(), &result, eeC, v);
253 
254  /*
255  These commented out lines use
256  64GeV*fraction of the TT overlapping the dead FE
257 
258  int count = 0;
259  for (std::vector<DetId>::const_iterator idsit = v.begin(); idsit != v.end(); ++ idsit){
260  std::set<DetId>::const_iterator itFind = eeC.find(*idsit);
261  if (itFind != eeC.end())
262  ++count;
263  }
264  //std::cout << count << ", " << v.size() << std::endl;
265  totE+=((float)count/(float)v.size())* ((it->ietaAbs()>26)?2*ecalScale_.getTPGInGeV( itTP->compressedEt(), itTP->id() ):ecalScale_.getTPGInGeV( itTP->compressedEt(), itTP->id() ));*/
266  }
267  else {totE += ((it->ietaAbs()>26)?2:1)*ecalScale_.getTPGInGeV( itTP->compressedEt(), itTP->id() );}
268 
269 
270  // get the trigger tower constituents
271 
272  if (itTP->compressedEt() == 0){ // If there's no energy in TT, the constituents are removed from the recovery.
273  for (size_t i = 0 ; i < v.size(); ++i)
274  eeC.erase(v[i]);
275  }
276  else if (itTP->compressedEt()!=0xFF){ //If it's saturated the energy has already been determined, so we do not want to subtract any channels
277  for ( size_t j = 0; j < v.size(); ++j ) {
278  aTTC.insert( v[j] );
279  }
280  }
281 
282  }
283  }
284  // remove crystals of dead SC
285  // (this step is not needed if sure that SC crystals are not
286  // in the recHit collection)
287 
288  for ( std::set<DetId>::const_iterator it = eeC.begin(); it != eeC.end(); ++it ) {
289  aTTC.erase(*it);
290  }
291  // compute the total energy for the dead SC
292  const EcalRecHitCollection * hits = &result;
293  for ( std::set<DetId>::const_iterator it = aTTC.begin(); it != aTTC.end(); ++it ) {
294  EcalRecHitCollection::const_iterator jt = hits->find( *it );
295  if ( jt != hits->end() ) {
296  float energy = jt->energy(); // Correct conversion to Et
297  float eta = geo_->getPosition(jt->id()).eta();
298  float pf = 1.0/cosh(eta);
299  //float theta = eeGeom_->getGeometry( *it )->getPosition().theta();
300  // use Et instead of E, consistent with the Et estimation of the associated TT
301  totE -= energy*pf;
302  }
303  }
304 
305 
306  float scEt = totE;
307  float scEtThreshEE = logWarningEtThreshold_EE_FE_;
308  if(scEt>scEtThreshEE){
309  edm::LogWarning("EnergyInDeadEE_FE")<<"TP energy in the dead TT = "<<scEt<<" at "<<sc;
310  }
311 
312  // assign the energy to the SC crystals
313  if ( !killDeadChannels_ || recoverEEFE_ ) { // if eeC is empty, i.e. there are no hits
314  // in the tower, nothing is returned. No negative values from noise.
315  for ( std::set<DetId>::const_iterator it = eeC.begin(); it != eeC.end(); ++it ) {
316  EcalRecHit hit( *it, 0., 0., EcalRecHit::kDead );
317  hit.setFlagBits( (0x1 << EcalRecHit::kDead) ) ;
318  float eta = geo_->getPosition(*it).eta(); //Convert back to E from Et for the recovered hits
319  float pf = 1.0/cosh(eta);
320  hit = EcalRecHit( *it, totE / ((float)eeC.size()*pf), 0., EcalRecHit::kTowerRecovered );
321  if (atLeastOneTPSaturated) hit.setFlagBits( (0x1 << EcalRecHit::kTPSaturated) );
322 
323  insertRecHit( hit, result );
324  }
325  }
326  }
327  return true;
328 }
int i
Definition: DBlmapReader.cc:9
bool alreadyInserted(const DetId &id)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< T >::const_iterator const_iterator
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
Geom::Theta< T > theta() const
edm::ESHandle< CaloTopology > caloTopology_
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
Definition: EcalTPGScale.cc:24
T eta() const
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.cc:562
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
Geom::Theta< T > theta() const
Definition: PV3DBase.h:69
void insertRecHit(const EcalRecHit &hit, EcalRecHitCollection &collection)
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:68
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
const CaloSubdetectorGeometry * ebGeom_
std::vector< T >::iterator iterator
const_iterator end() const
float estimateEnergy(int ieta, EcalRecHitCollection *hits, std::set< DetId > sId, std::vector< DetId > vId)
Definition: DetId.h:20
T const * product() const
Definition: ESHandle.h:62
int zside() const
Definition: EcalScDetId.h:66
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:25
T eta() const
Definition: PV3DBase.h:70
iterator find(key_type k)
void setFlagBits(uint32_t flagBits)
Definition: EcalRecHit.h:94
const GlobalPoint & getPosition() const
std::string const & instance() const
Definition: InputTag.h:26
mathSSE::Vec4< T > v
void EcalRecHitWorkerRecover::set ( const edm::EventSetup es)
virtual

Implements EcalRecHitWorkerBaseClass.

Definition at line 43 of file EcalRecHitWorkerRecover.cc.

References caloGeometry_, caloTopology_, ebGeom_, ecalMapping_, ecalScale_, eeGeom_, geo_, edm::EventSetup::get(), laser, pEBGeom_, pEcalMapping_, pEEGeom_, edm::ESHandle< class >::product(), recoveredDetIds_EB_, recoveredDetIds_EE_, EcalTPGScale::setEventSetup(), and ttMap_.

44 {
45 
46  es.get<EcalLaserDbRecord>().get(laser);
49  es.get<EcalMappingRcd>().get(pEcalMapping_);
51  // geometry...
52  es.get<EcalBarrelGeometryRecord>().get("EcalBarrel",pEBGeom_);
53  es.get<EcalEndcapGeometryRecord>().get("EcalEndcap",pEEGeom_);
58  es.get<IdealGeometryRecord>().get(ttMap_);
59  recoveredDetIds_EB_.clear();
60  recoveredDetIds_EE_.clear();
61 }
void setEventSetup(const edm::EventSetup &evtSetup)
Definition: EcalTPGScale.cc:19
edm::ESHandle< CaloTopology > caloTopology_
const CaloSubdetectorGeometry * eeGeom_
edm::ESHandle< CaloSubdetectorGeometry > pEEGeom_
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
edm::ESHandle< CaloSubdetectorGeometry > pEBGeom_
const CaloSubdetectorGeometry * ebGeom_
const T & get() const
Definition: EventSetup.h:55
std::set< DetId > recoveredDetIds_EE_
T const * product() const
Definition: ESHandle.h:62
edm::ESHandle< CaloGeometry > caloGeometry_
edm::ESHandle< EcalLaserDbService > laser
const EcalElectronicsMapping * ecalMapping_
edm::ESHandle< EcalElectronicsMapping > pEcalMapping_
std::set< DetId > recoveredDetIds_EB_

Member Data Documentation

edm::ESHandle<CaloGeometry> EcalRecHitWorkerRecover::caloGeometry_
protected

Definition at line 50 of file EcalRecHitWorkerRecover.h.

Referenced by set().

edm::ESHandle<CaloTopology> EcalRecHitWorkerRecover::caloTopology_
protected

Definition at line 49 of file EcalRecHitWorkerRecover.h.

Referenced by run(), and set().

const CaloSubdetectorGeometry* EcalRecHitWorkerRecover::ebGeom_
protected

Definition at line 74 of file EcalRecHitWorkerRecover.h.

Referenced by run(), and set().

const EcalElectronicsMapping* EcalRecHitWorkerRecover::ecalMapping_
protected

Definition at line 66 of file EcalRecHitWorkerRecover.h.

Referenced by set().

EcalTPGScale EcalRecHitWorkerRecover::ecalScale_
protected

Definition at line 63 of file EcalRecHitWorkerRecover.h.

Referenced by run(), and set().

const CaloSubdetectorGeometry* EcalRecHitWorkerRecover::eeGeom_
protected

Definition at line 75 of file EcalRecHitWorkerRecover.h.

Referenced by set().

const CaloGeometry* EcalRecHitWorkerRecover::geo_
protected

Definition at line 76 of file EcalRecHitWorkerRecover.h.

Referenced by estimateEnergy(), run(), and set().

bool EcalRecHitWorkerRecover::killDeadChannels_
protected

Definition at line 53 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

edm::ESHandle<EcalLaserDbService> EcalRecHitWorkerRecover::laser
protected

Definition at line 46 of file EcalRecHitWorkerRecover.h.

Referenced by set().

double EcalRecHitWorkerRecover::logWarningEtThreshold_EB_FE_
protected

Definition at line 67 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

double EcalRecHitWorkerRecover::logWarningEtThreshold_EE_FE_
protected

Definition at line 68 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

edm::ESHandle<CaloSubdetectorGeometry> EcalRecHitWorkerRecover::pEBGeom_
protected

Definition at line 72 of file EcalRecHitWorkerRecover.h.

Referenced by set().

edm::ESHandle< EcalElectronicsMapping > EcalRecHitWorkerRecover::pEcalMapping_
protected

Definition at line 65 of file EcalRecHitWorkerRecover.h.

Referenced by set().

edm::ESHandle<CaloSubdetectorGeometry> EcalRecHitWorkerRecover::pEEGeom_
protected

Definition at line 73 of file EcalRecHitWorkerRecover.h.

Referenced by set().

EcalRecHitSimpleAlgo* EcalRecHitWorkerRecover::rechitMaker_
protected

Definition at line 78 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover().

bool EcalRecHitWorkerRecover::recoverEBFE_
protected

Definition at line 59 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

bool EcalRecHitWorkerRecover::recoverEBIsolatedChannels_
protected

Definition at line 55 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

bool EcalRecHitWorkerRecover::recoverEBVFE_
protected

Definition at line 57 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

std::set<DetId> EcalRecHitWorkerRecover::recoveredDetIds_EB_
protected

Definition at line 80 of file EcalRecHitWorkerRecover.h.

Referenced by alreadyInserted(), insertRecHit(), and set().

std::set<DetId> EcalRecHitWorkerRecover::recoveredDetIds_EE_
protected

Definition at line 81 of file EcalRecHitWorkerRecover.h.

Referenced by alreadyInserted(), insertRecHit(), and set().

bool EcalRecHitWorkerRecover::recoverEEFE_
protected

Definition at line 60 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

bool EcalRecHitWorkerRecover::recoverEEIsolatedChannels_
protected

Definition at line 56 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

bool EcalRecHitWorkerRecover::recoverEEVFE_
protected

Definition at line 58 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

std::string EcalRecHitWorkerRecover::singleRecoveryMethod_
protected

Definition at line 52 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

double EcalRecHitWorkerRecover::singleRecoveryThreshold_
protected

Definition at line 51 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

edm::InputTag EcalRecHitWorkerRecover::tpDigiCollection_
protected

Definition at line 64 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

edm::ESHandle<EcalTrigTowerConstituentsMap> EcalRecHitWorkerRecover::ttMap_
protected

Definition at line 70 of file EcalRecHitWorkerRecover.h.

Referenced by run(), and set().