test
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 &, edm::ConsumesCollector &c)
 
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 &, edm::ConsumesCollector &c)
 
 EcalRecHitWorkerBaseClass (const edm::ParameterSet &)
 
virtual ~EcalRecHitWorkerBaseClass ()
 

Protected Member Functions

bool alreadyInserted (const DetId &id)
 
bool checkChannelStatus (const DetId &id, const std::vector< int > &statusestoexclude)
 
float estimateEnergy (int ieta, EcalRecHitCollection *hits, const std::set< DetId > &sId, const 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_
 
edm::ESHandle< EcalChannelStatuschStatus_
 
std::vector< int > dbStatusToBeExcludedEB_
 
std::vector< int > dbStatusToBeExcludedEE_
 
EcalDeadChannelRecoveryAlgos
< EBDetId
ebDeadChannelCorrector
 
const CaloSubdetectorGeometryebGeom_
 
const EcalElectronicsMappingecalMapping_
 
EcalTPGScale ecalScale_
 
EcalDeadChannelRecoveryAlgos
< EEDetId
eeDeadChannelCorrector
 
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::EDGetTokenT
< EcalTrigPrimDigiCollection
tpDigiToken_
 
EcalTPGScale tpgscale_
 
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

Definition at line 30 of file EcalRecHitWorkerRecover.h.

Constructor & Destructor Documentation

EcalRecHitWorkerRecover::EcalRecHitWorkerRecover ( const edm::ParameterSet ps,
edm::ConsumesCollector c 
)

Definition at line 22 of file EcalRecHitWorkerRecover.cc.

References edm::ConsumesCollector::consumes(), dbStatusToBeExcludedEB_, dbStatusToBeExcludedEE_, edm::ParameterSet::getParameter(), killDeadChannels_, logWarningEtThreshold_EB_FE_, logWarningEtThreshold_EE_FE_, rechitMaker_, recoverEBFE_, recoverEBIsolatedChannels_, recoverEBVFE_, recoverEEFE_, recoverEEIsolatedChannels_, recoverEEVFE_, singleRecoveryMethod_, singleRecoveryThreshold_, AlCaHLTBitMon_QueryRunRegistry::string, and tpDigiToken_.

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  dbStatusToBeExcludedEE_ = ps.getParameter<std::vector<int> >("dbStatusToBeExcludedEE");
38  dbStatusToBeExcludedEB_ = ps.getParameter<std::vector<int> >("dbStatusToBeExcludedEB");
39 
40  logWarningEtThreshold_EB_FE_ = ps.getParameter<double>("logWarningEtThreshold_EB_FE");
41  logWarningEtThreshold_EE_FE_ = ps.getParameter<double>("logWarningEtThreshold_EE_FE");
42 
43  tpDigiToken_ =
44  c.consumes<EcalTrigPrimDigiCollection>(ps.getParameter<edm::InputTag>("triggerPrimitiveDigiCollection"));
45 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< int > dbStatusToBeExcludedEE_
EcalRecHitWorkerBaseClass(const edm::ParameterSet &, edm::ConsumesCollector &c)
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpDigiToken_
EcalRecHitSimpleAlgo * rechitMaker_
std::vector< int > dbStatusToBeExcludedEB_
virtual EcalRecHitWorkerRecover::~EcalRecHitWorkerRecover ( )
inlinevirtual

Definition at line 33 of file EcalRecHitWorkerRecover.h.

33 {};

Member Function Documentation

bool EcalRecHitWorkerRecover::alreadyInserted ( const DetId id)
protected

Definition at line 410 of file EcalRecHitWorkerRecover.cc.

References EcalBarrel, EcalEndcap, recoveredDetIds_EB_, and recoveredDetIds_EE_.

Referenced by insertRecHit(), and run().

411 {
412  bool res = false;
413  if ( id.subdetId() == EcalBarrel ) {
414  res = ( recoveredDetIds_EB_.find( id ) != recoveredDetIds_EB_.end() );
415  } else if ( id.subdetId() == EcalEndcap ) {
416  res = ( recoveredDetIds_EE_.find( id ) != recoveredDetIds_EE_.end() );
417  } else {
418  edm::LogError("EcalRecHitWorkerRecover::InvalidDetId") << "Invalid DetId " << id.rawId();
419  }
420  return res;
421 }
std::set< DetId > recoveredDetIds_EE_
std::set< DetId > recoveredDetIds_EB_
bool EcalRecHitWorkerRecover::checkChannelStatus ( const DetId id,
const std::vector< int > &  statusestoexclude 
)
protected

Definition at line 434 of file EcalRecHitWorkerRecover.cc.

References chStatus_, and mps_update::status.

Referenced by run().

435  {
436 
437 
438  if (!chStatus_.isValid())
439  edm::LogError("ObjectNotFound") << "Channel Status not set";
440 
441 
442  EcalChannelStatus::const_iterator chIt = chStatus_->find( id );
443  uint16_t dbStatus = 0;
444  if ( chIt != chStatus_->end() ) {
445  dbStatus = chIt->getEncodedStatusCode();
446  } else {
447  edm::LogError("ObjectNotFound") << "No channel status found for xtal "
448  << id.rawId()
449  << "! something wrong with EcalChannelStatus in your DB? ";
450  }
451 
452  for (std::vector<int>::const_iterator status = statusestoexclude.begin();
453  status!= statusestoexclude.end(); ++status){
454 
455  if ( *status == dbStatus) return false;
456 
457  }
458 
459  return true;
460 }
std::vector< Item >::const_iterator const_iterator
edm::ESHandle< EcalChannelStatus > chStatus_
tuple status
Definition: mps_update.py:57
float EcalRecHitWorkerRecover::estimateEnergy ( int  ieta,
EcalRecHitCollection hits,
const std::set< DetId > &  sId,
const std::vector< DetId > &  vId 
)
protected

Definition at line 356 of file EcalRecHitWorkerRecover.cc.

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

Referenced by run().

356  {
357 
358  float xtalE=0;
359  int count = 0;
360  for (std::vector<DetId>::const_iterator vIdit = vId.begin(); vIdit != vId.end(); ++ vIdit){
361  std::set<DetId>::const_iterator sIdit = sId.find(*vIdit);
362  if (sIdit==sId.end()){
363  float energy = hits->find(*vIdit)->energy();
364  float eta = geo_->getPosition(*vIdit).eta();
365  float pf = 1.0/cosh(eta);
366  xtalE += energy*pf;
367  count++;
368  }
369  }
370 
371  if (count==0) { // If there are no overlapping crystals return saturated value.
372 
373  double etsat = tpgscale_.getTPGInGeV(0xFF,
374  ttMap_->towerOf(*vId.begin())); // get saturation value for the first
375  // constituent, for the others it's the same
376 
377  return etsat/cosh(ieta)*(ieta>26?2:1); // account for duplicated TT in EE for ieta>26
378  }
379  else return xtalE*((vId.size()/(float)count) - 1)*(ieta>26?2:1);
380 
381 
382 }
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
Definition: EcalTPGScale.cc:24
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
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:76
iterator find(key_type k)
void EcalRecHitWorkerRecover::insertRecHit ( const EcalRecHit hit,
EcalRecHitCollection collection 
)
protected

Definition at line 385 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().

386 {
387  // skip already inserted DetId's and raise a log warning
388  if ( alreadyInserted( hit.id() ) ) {
389  edm::LogWarning("EcalRecHitWorkerRecover") << "DetId already recovered! Skipping...";
390  return;
391  }
392  EcalRecHitCollection::iterator it = collection.find( hit.id() );
393  if ( it == collection.end() ) {
394  // insert the hit in the collection
395  collection.push_back( hit );
396  } else {
397  // overwrite existing recHit
398  *it = hit;
399  }
400  if ( hit.id().subdetId() == EcalBarrel ) {
401  recoveredDetIds_EB_.insert( hit.id() );
402  } else if ( hit.id().subdetId() == EcalEndcap ) {
403  recoveredDetIds_EE_.insert( hit.id() );
404  } else {
405  edm::LogError("EcalRecHitWorkerRecover::InvalidDetId") << "Invalid DetId " << hit.id().rawId();
406  }
407 }
bool alreadyInserted(const DetId &id)
void push_back(T const &t)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
std::vector< EcalRecHit >::iterator iterator
const_iterator end() const
DetId id() const
get the id
Definition: EcalRecHit.h:76
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 425 of file EcalRecHitWorkerRecover.cc.

425  {
426 
427  return eTT;
428 
429 }
bool EcalRecHitWorkerRecover::run ( const edm::Event evt,
const EcalUncalibratedRecHit uncalibRH,
EcalRecHitCollection result 
)
virtual

Implements EcalRecHitWorkerBaseClass.

Definition at line 72 of file EcalRecHitWorkerRecover.cc.

References alreadyInserted(), caloTopology_, checkChannelStatus(), EcalDeadChannelRecoveryAlgos< DetIdT >::correct(), dbStatusToBeExcludedEB_, dbStatusToBeExcludedEE_, EcalRecHitWorkerBaseClass::EB_FE, EcalRecHitWorkerBaseClass::EB_single, EcalRecHitWorkerBaseClass::EB_VFE, ebDeadChannelCorrector, ebGeom_, ecalScale_, EcalRecHitWorkerBaseClass::EE_FE, EcalRecHitWorkerBaseClass::EE_single, EcalRecHitWorkerBaseClass::EE_VFE, eeDeadChannelCorrector, edm::SortedCollection< T, SORT >::end(), relval_parameters_module::energy, EcalRecHit::energy(), estimateEnergy(), eta, PV3DBase< T, PVType, FrameType >::eta(), edm::SortedCollection< T, SORT >::find(), EcalUncalibratedRecHit::flags(), flags, geo_, edm::Event::getByToken(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getPosition(), CaloCellGeometry::getPosition(), EcalTPGScale::getTPGInGeV(), i, EcalUncalibratedRecHit::id(), insertRecHit(), EcalScDetId::ix(), EEDetId::ix(), EcalScDetId::iy(), EEDetId::iy(), j, EcalRecHit::kDead, killDeadChannels_, EcalRecHit::kL1SpikeFlag, EcalRecHit::kNeighboursRecovered, EcalRecHit::kTowerRecovered, EcalRecHit::kTPSaturated, logWarningEtThreshold_EB_FE_, logWarningEtThreshold_EE_FE_, edm::Handle< T >::product(), edm::ESHandle< class >::product(), recoverEBFE_, recoverEBIsolatedChannels_, recoverEBVFE_, recoverEEFE_, recoverEEIsolatedChannels_, recoverEEVFE_, mps_fire::result, EcalDeadChannelRecoveryAlgos< DetIdT >::setCaloTopology(), EcalRecHit::setFlag(), funct::sin(), singleRecoveryMethod_, singleRecoveryThreshold_, PV3DBase< T, PVType, FrameType >::theta(), theta(), tpDigiToken_, funct::true, ttMap_, findQualityFiles::v, EEDetId::validDetId(), EcalScDetId::zside(), EEDetId::zside(), and ecaldqm::zside().

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

Implements EcalRecHitWorkerBaseClass.

Definition at line 48 of file EcalRecHitWorkerRecover.cc.

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

49 {
50 
51  es.get<EcalLaserDbRecord>().get(laser);
54  es.get<EcalMappingRcd>().get(pEcalMapping_);
56  // geometry...
57  es.get<EcalBarrelGeometryRecord>().get("EcalBarrel",pEBGeom_);
58  es.get<EcalEndcapGeometryRecord>().get("EcalEndcap",pEEGeom_);
64  es.get<IdealGeometryRecord>().get(ttMap_);
65  recoveredDetIds_EB_.clear();
66  recoveredDetIds_EE_.clear();
68 }
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:56
std::set< DetId > recoveredDetIds_EE_
T const * product() const
Definition: ESHandle.h:86
edm::ESHandle< CaloGeometry > caloGeometry_
edm::ESHandle< EcalChannelStatus > chStatus_
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 53 of file EcalRecHitWorkerRecover.h.

Referenced by set().

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

Definition at line 52 of file EcalRecHitWorkerRecover.h.

Referenced by run(), and set().

edm::ESHandle<EcalChannelStatus> EcalRecHitWorkerRecover::chStatus_
protected

Definition at line 54 of file EcalRecHitWorkerRecover.h.

Referenced by checkChannelStatus(), and set().

std::vector<int> EcalRecHitWorkerRecover::dbStatusToBeExcludedEB_
protected

Definition at line 71 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

std::vector<int> EcalRecHitWorkerRecover::dbStatusToBeExcludedEE_
protected

Definition at line 70 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

EcalDeadChannelRecoveryAlgos<EBDetId> EcalRecHitWorkerRecover::ebDeadChannelCorrector
protected

Definition at line 96 of file EcalRecHitWorkerRecover.h.

Referenced by run().

const CaloSubdetectorGeometry* EcalRecHitWorkerRecover::ebGeom_
protected

Definition at line 85 of file EcalRecHitWorkerRecover.h.

Referenced by run(), and set().

const EcalElectronicsMapping* EcalRecHitWorkerRecover::ecalMapping_
protected

Definition at line 77 of file EcalRecHitWorkerRecover.h.

Referenced by set().

EcalTPGScale EcalRecHitWorkerRecover::ecalScale_
protected

Definition at line 74 of file EcalRecHitWorkerRecover.h.

Referenced by run(), and set().

EcalDeadChannelRecoveryAlgos<EEDetId> EcalRecHitWorkerRecover::eeDeadChannelCorrector
protected

Definition at line 97 of file EcalRecHitWorkerRecover.h.

Referenced by run().

const CaloSubdetectorGeometry* EcalRecHitWorkerRecover::eeGeom_
protected

Definition at line 86 of file EcalRecHitWorkerRecover.h.

Referenced by set().

const CaloGeometry* EcalRecHitWorkerRecover::geo_
protected

Definition at line 87 of file EcalRecHitWorkerRecover.h.

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

bool EcalRecHitWorkerRecover::killDeadChannels_
protected

Definition at line 59 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

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

Definition at line 49 of file EcalRecHitWorkerRecover.h.

Referenced by set().

double EcalRecHitWorkerRecover::logWarningEtThreshold_EB_FE_
protected

Definition at line 78 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

double EcalRecHitWorkerRecover::logWarningEtThreshold_EE_FE_
protected

Definition at line 79 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

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

Definition at line 83 of file EcalRecHitWorkerRecover.h.

Referenced by set().

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

Definition at line 76 of file EcalRecHitWorkerRecover.h.

Referenced by set().

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

Definition at line 84 of file EcalRecHitWorkerRecover.h.

Referenced by set().

EcalRecHitSimpleAlgo* EcalRecHitWorkerRecover::rechitMaker_
protected

Definition at line 89 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover().

bool EcalRecHitWorkerRecover::recoverEBFE_
protected

Definition at line 65 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

bool EcalRecHitWorkerRecover::recoverEBIsolatedChannels_
protected

Definition at line 61 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

bool EcalRecHitWorkerRecover::recoverEBVFE_
protected

Definition at line 63 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

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

Definition at line 91 of file EcalRecHitWorkerRecover.h.

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

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

Definition at line 92 of file EcalRecHitWorkerRecover.h.

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

bool EcalRecHitWorkerRecover::recoverEEFE_
protected

Definition at line 66 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

bool EcalRecHitWorkerRecover::recoverEEIsolatedChannels_
protected

Definition at line 62 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

bool EcalRecHitWorkerRecover::recoverEEVFE_
protected

Definition at line 64 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

std::string EcalRecHitWorkerRecover::singleRecoveryMethod_
protected

Definition at line 58 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

double EcalRecHitWorkerRecover::singleRecoveryThreshold_
protected

Definition at line 57 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

edm::EDGetTokenT<EcalTrigPrimDigiCollection> EcalRecHitWorkerRecover::tpDigiToken_
protected

Definition at line 75 of file EcalRecHitWorkerRecover.h.

Referenced by EcalRecHitWorkerRecover(), and run().

EcalTPGScale EcalRecHitWorkerRecover::tpgscale_
protected

Definition at line 94 of file EcalRecHitWorkerRecover.h.

Referenced by estimateEnergy(), and set().

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

Definition at line 81 of file EcalRecHitWorkerRecover.h.

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