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_
 
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::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 24 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_.

24  :
26 {
28  // isolated channel recovery
29  singleRecoveryMethod_ = ps.getParameter<std::string>("singleChannelRecoveryMethod");
30  singleRecoveryThreshold_ = ps.getParameter<double>("singleChannelRecoveryThreshold");
31  killDeadChannels_ = ps.getParameter<bool>("killDeadChannels");
32  recoverEBIsolatedChannels_ = ps.getParameter<bool>("recoverEBIsolatedChannels");
33  recoverEEIsolatedChannels_ = ps.getParameter<bool>("recoverEEIsolatedChannels");
34  recoverEBVFE_ = ps.getParameter<bool>("recoverEBVFE");
35  recoverEEVFE_ = ps.getParameter<bool>("recoverEEVFE");
36  recoverEBFE_ = ps.getParameter<bool>("recoverEBFE");
37  recoverEEFE_ = ps.getParameter<bool>("recoverEEFE");
38 
39  dbStatusToBeExcludedEE_ = ps.getParameter<std::vector<int> >("dbStatusToBeExcludedEE");
40  dbStatusToBeExcludedEB_ = ps.getParameter<std::vector<int> >("dbStatusToBeExcludedEB");
41 
42  tpDigiToken_ =
43  c.consumes<EcalTrigPrimDigiCollection>(ps.getParameter<edm::InputTag>("triggerPrimitiveDigiCollection"));
44  logWarningEtThreshold_EB_FE_ = ps.getParameter<double>("logWarningEtThreshold_EB_FE");
45  logWarningEtThreshold_EE_FE_ = ps.getParameter<double>("logWarningEtThreshold_EE_FE");
46 }
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 394 of file EcalRecHitWorkerRecover.cc.

References EcalBarrel, EcalEndcap, recoveredDetIds_EB_, and recoveredDetIds_EE_.

Referenced by insertRecHit(), and run().

395 {
396  bool res = false;
397  if ( id.subdetId() == EcalBarrel ) {
398  res = ( recoveredDetIds_EB_.find( id ) != recoveredDetIds_EB_.end() );
399  } else if ( id.subdetId() == EcalEndcap ) {
400  res = ( recoveredDetIds_EE_.find( id ) != recoveredDetIds_EE_.end() );
401  } else {
402  edm::LogError("EcalRecHitWorkerRecover::InvalidDetId") << "Invalid DetId " << id.rawId();
403  }
404  return res;
405 }
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 417 of file EcalRecHitWorkerRecover.cc.

References chStatus_, and ntuplemaker::status.

Referenced by run().

418  {
419 
420 
421  if (!chStatus_.isValid())
422  edm::LogError("ObjectNotFound") << "Channel Status not set";
423 
424 
425  EcalChannelStatus::const_iterator chIt = chStatus_->find( id );
426  uint16_t dbStatus = 0;
427  if ( chIt != chStatus_->end() ) {
428  dbStatus = chIt->getStatusCode();
429  } else {
430  edm::LogError("ObjectNotFound") << "No channel status found for xtal "
431  << id.rawId()
432  << "! something wrong with EcalChannelStatus in your DB? ";
433  }
434 
435  for (std::vector<int>::const_iterator status = statusestoexclude.begin();
436  status!= statusestoexclude.end(); ++status){
437 
438  if ( *status == dbStatus) return false;
439 
440  }
441 
442  return true;
443 }
std::vector< Item >::const_iterator const_iterator
tuple status
Definition: ntuplemaker.py:245
edm::ESHandle< EcalChannelStatus > chStatus_
float EcalRecHitWorkerRecover::estimateEnergy ( int  ieta,
EcalRecHitCollection hits,
const std::set< DetId > &  sId,
const std::vector< DetId > &  vId 
)
protected

Definition at line 340 of file EcalRecHitWorkerRecover.cc.

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

Referenced by run().

340  {
341 
342  float xtalE=0;
343  int count = 0;
344  for (std::vector<DetId>::const_iterator vIdit = vId.begin(); vIdit != vId.end(); ++ vIdit){
345  std::set<DetId>::const_iterator sIdit = sId.find(*vIdit);
346  if (sIdit==sId.end()){
347  float energy = hits->find(*vIdit)->energy();
348  float eta = geo_->getPosition(*vIdit).eta();
349  float pf = 1.0/cosh(eta);
350  xtalE += energy*pf;
351  count++;
352  }
353  }
354 
355  if (count==0) { // If there are no overlapping crystals return saturated value.
356 
357  double etsat = tpgscale_.getTPGInGeV(0xFF,
358  ttMap_->towerOf(*vId.begin())); // get saturation value for the first
359  // constituent, for the others it's the same
360 
361  return etsat/cosh(ieta)*(ieta>26?2:1); // account for duplicated TT in EE for ieta>26
362  }
363  else return xtalE*((vId.size()/(float)count) - 1)*(ieta>26?2:1);
364 
365 
366 }
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
Definition: EcalTPGScale.cc:24
T eta() const
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 369 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().

370 {
371  // skip already inserted DetId's and raise a log warning
372  if ( alreadyInserted( hit.id() ) ) {
373  edm::LogWarning("EcalRecHitWorkerRecover") << "DetId already recovered! Skipping...";
374  return;
375  }
376  EcalRecHitCollection::iterator it = collection.find( hit.id() );
377  if ( it == collection.end() ) {
378  // insert the hit in the collection
379  collection.push_back( hit );
380  } else {
381  // overwrite existing recHit
382  *it = hit;
383  }
384  if ( hit.id().subdetId() == EcalBarrel ) {
385  recoveredDetIds_EB_.insert( hit.id() );
386  } else if ( hit.id().subdetId() == EcalEndcap ) {
387  recoveredDetIds_EE_.insert( hit.id() );
388  } else {
389  edm::LogError("EcalRecHitWorkerRecover::InvalidDetId") << "Invalid DetId " << hit.id().rawId();
390  }
391 }
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:80
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 409 of file EcalRecHitWorkerRecover.cc.

409  {
410 
411  return eTT;
412 
413 }
bool EcalRecHitWorkerRecover::run ( const edm::Event evt,
const EcalUncalibratedRecHit uncalibRH,
EcalRecHitCollection result 
)
virtual

Implements EcalRecHitWorkerBaseClass.

Definition at line 73 of file EcalRecHitWorkerRecover.cc.

References alreadyInserted(), caloTopology_, checkChannelStatus(), dbStatusToBeExcludedEB_, dbStatusToBeExcludedEE_, 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(), 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_, query::result, EcalRecHit::setFlag(), funct::sin(), singleRecoveryMethod_, singleRecoveryThreshold_, PV3DBase< T, PVType, FrameType >::theta(), theta(), tpDigiToken_, ttMap_, findQualityFiles::v, EEDetId::validDetId(), EcalScDetId::zside(), and EEDetId::zside().

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

Implements EcalRecHitWorkerBaseClass.

Definition at line 49 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_.

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

50 {
51 
52  es.get<EcalLaserDbRecord>().get(laser);
55  es.get<EcalMappingRcd>().get(pEcalMapping_);
57  // geometry...
58  es.get<EcalBarrelGeometryRecord>().get("EcalBarrel",pEBGeom_);
59  es.get<EcalEndcapGeometryRecord>().get("EcalEndcap",pEEGeom_);
65  es.get<IdealGeometryRecord>().get(ttMap_);
66  recoveredDetIds_EB_.clear();
67  recoveredDetIds_EE_.clear();
69 }
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< 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().

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().

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().