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 Attributes
EcalRecHitWorkerSimple Class Reference

#include <EcalRecHitWorkerSimple.h>

Inheritance diagram for EcalRecHitWorkerSimple:
EcalRecHitWorkerBaseClass

Public Member Functions

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

Protected Attributes

edm::ESHandle
< EcalADCToGeVConstant
agc
 
edm::ESHandle< EcalChannelStatuschStatus
 
edm::ESHandle
< EcalIntercalibConstants
ical
 
edm::ESHandle
< EcalTimeCalibConstants
itime
 
bool killDeadChannels_
 
edm::ESHandle< EcalLaserDbServicelaser
 
bool laserCorrection_
 
EcalRecHitSimpleAlgorechitMaker_
 
std::vector< int > v_chstatus_
 
std::vector< int > v_DB_reco_flags_
 

Additional Inherited Members

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

Detailed Description

Definition at line 25 of file EcalRecHitWorkerSimple.h.

Constructor & Destructor Documentation

EcalRecHitWorkerSimple::EcalRecHitWorkerSimple ( const edm::ParameterSet ps)

Definition at line 14 of file EcalRecHitWorkerSimple.cc.

References edm::ParameterSet::getParameter(), killDeadChannels_, laserCorrection_, rechitMaker_, v_chstatus_, and v_DB_reco_flags_.

14  :
16 {
18  v_chstatus_ = ps.getParameter<std::vector<int> >("ChannelStatusToBeExcluded");
19  v_DB_reco_flags_ = ps.getParameter<std::vector<int> >("flagsMapDBReco");
20  killDeadChannels_ = ps.getParameter<bool>("killDeadChannels");
21  laserCorrection_ = ps.getParameter<bool>("laserCorrection");
22 }
T getParameter(std::string const &) const
std::vector< int > v_DB_reco_flags_
EcalRecHitWorkerBaseClass(const edm::ParameterSet &)
EcalRecHitSimpleAlgo * rechitMaker_
std::vector< int > v_chstatus_
virtual EcalRecHitWorkerSimple::~EcalRecHitWorkerSimple ( )
inlinevirtual

Definition at line 28 of file EcalRecHitWorkerSimple.h.

28 {};

Member Function Documentation

bool EcalRecHitWorkerSimple::run ( const edm::Event evt,
const EcalUncalibratedRecHit uncalibRH,
EcalRecHitCollection result 
)
virtual

Implements EcalRecHitWorkerBaseClass.

Definition at line 36 of file EcalRecHitWorkerSimple.cc.

References agc, chStatus, cond::rpcobgas::detid, EcalEndcap, EcalCondObjectContainer< T >::end(), spr::find(), EcalCondObjectContainer< T >::find(), EcalChannelStatusCode::getStatusCode(), ical, EcalUncalibratedRecHit::id(), itime, killDeadChannels_, EcalRecHit::kLeadingEdgeRecovered, laser, laserCorrection_, EcalRecHitSimpleAlgo::makeRecHit(), edm::SortedCollection< T, SORT >::push_back(), DetId::rawId(), rechitMaker_, EcalRecHitSimpleAlgo::setADCToGeVConstant(), DetId::subdetId(), edm::EventBase::time(), v_chstatus_, and v_DB_reco_flags_.

39 {
40  DetId detid=uncalibRH.id();
41 
43  EcalChannelStatusCode chStatusCode = 1;
44  if ( chit != chStatus->end() ) {
45  chStatusCode = *chit;
46  } else {
47  edm::LogError("EcalRecHitError") << "No channel status found for xtal "
48  << detid.rawId()
49  << "! something wrong with EcalChannelStatus in your DB? ";
50  }
51  if ( v_chstatus_.size() > 0) {
52  uint16_t code = chStatusCode.getStatusCode() & 0x001F;
53  std::vector<int>::const_iterator res = std::find( v_chstatus_.begin(), v_chstatus_.end(), code );
54  if ( res != v_chstatus_.end() ) {
55  return false;
56  }
57  }
58 
59  // find the proper flag for the recHit
60  // from a configurable vector
61  // (see cfg file for the association)
62  uint32_t recoFlag = 0;
63  uint16_t statusCode = chStatusCode.getStatusCode() & 0x001F;
64  if ( statusCode < v_DB_reco_flags_.size() ) {
65  // not very nice...
66  recoFlag = v_DB_reco_flags_[ statusCode ];
67  } else {
68  edm::LogError("EcalRecHitError") << "Flag " << statusCode
69  << " in DB exceed the allowed range of " << v_DB_reco_flags_.size();
70  }
71 
72  const EcalIntercalibConstantMap& icalMap = ical->getMap();
73  if ( detid.subdetId() == EcalEndcap ) {
74  rechitMaker_->setADCToGeVConstant( float(agc->getEEValue()) );
75  } else {
76  rechitMaker_->setADCToGeVConstant( float(agc->getEBValue()) );
77  }
78 
79  // first intercalibration constants
80  EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(detid);
81  EcalIntercalibConstant icalconst = 1;
82  if( icalit!=icalMap.end() ) {
83  icalconst = (*icalit);
84  } else {
85  edm::LogError("EcalRecHitError") << "No intercalib const found for xtal "
86  << detid.rawId()
87  << "! something wrong with EcalIntercalibConstants in your DB? ";
88  }
89 
90  // get laser coefficient
91  float lasercalib = 1.;
92  if ( laserCorrection_ ) lasercalib = laser->getLaserCorrection( detid, evt.time());
93 
94  // get time calibration coefficient
95  const EcalTimeCalibConstantMap & itimeMap = itime->getMap();
97  EcalTimeCalibConstant itimeconst = 0;
98  if( itime!=itimeMap.end() ) {
99  itimeconst = (*itime);
100  } else {
101  edm::LogError("EcalRecHitError") << "No time calib const found for xtal "
102  << detid.rawId()
103  << "! something wrong with EcalTimeCalibConstants in your DB? ";
104  }
105 
106  // make the rechit and put in the output collection
108  result.push_back(EcalRecHit( rechitMaker_->makeRecHit(uncalibRH, icalconst * lasercalib, itimeconst, recoFlag) ));
109  }
110  return true;
111 }
edm::ESHandle< EcalADCToGeVConstant > agc
virtual EcalRecHit makeRecHit(const EcalUncalibratedRecHit &uncalibRH, const float &intercalibConstant, const float &timeIntercalib=0, const uint32_t &flags=0) const
Compute parameters.
void push_back(T const &t)
std::vector< int > v_DB_reco_flags_
edm::ESHandle< EcalChannelStatus > chStatus
virtual void setADCToGeVConstant(const float &value)
Constructor.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
edm::ESHandle< EcalTimeCalibConstants > itime
uint16_t getStatusCode() const
EcalRecHitSimpleAlgo * rechitMaker_
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< int > v_chstatus_
Definition: DetId.h:20
std::vector< Item >::const_iterator const_iterator
float EcalTimeCalibConstant
const_iterator find(uint32_t rawId) const
const_iterator end() const
edm::Timestamp time() const
Definition: EventBase.h:57
edm::ESHandle< EcalIntercalibConstants > ical
float EcalIntercalibConstant
edm::ESHandle< EcalLaserDbService > laser
void EcalRecHitWorkerSimple::set ( const edm::EventSetup es)
virtual

Implements EcalRecHitWorkerBaseClass.

Definition at line 25 of file EcalRecHitWorkerSimple.cc.

References agc, chStatus, edm::EventSetup::get(), ical, itime, laser, and laserCorrection_.

26 {
29  es.get<EcalADCToGeVConstantRcd>().get(agc);
31  if ( laserCorrection_ ) es.get<EcalLaserDbRecord>().get(laser);
32 }
edm::ESHandle< EcalADCToGeVConstant > agc
edm::ESHandle< EcalChannelStatus > chStatus
edm::ESHandle< EcalTimeCalibConstants > itime
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< EcalIntercalibConstants > ical
edm::ESHandle< EcalLaserDbService > laser

Member Data Documentation

edm::ESHandle<EcalADCToGeVConstant> EcalRecHitWorkerSimple::agc
protected

Definition at line 37 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

edm::ESHandle<EcalChannelStatus> EcalRecHitWorkerSimple::chStatus
protected

Definition at line 38 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

edm::ESHandle<EcalIntercalibConstants> EcalRecHitWorkerSimple::ical
protected

Definition at line 35 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

edm::ESHandle<EcalTimeCalibConstants> EcalRecHitWorkerSimple::itime
protected

Definition at line 36 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

bool EcalRecHitWorkerSimple::killDeadChannels_
protected

Definition at line 42 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

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

Definition at line 40 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

bool EcalRecHitWorkerSimple::laserCorrection_
protected

Definition at line 43 of file EcalRecHitWorkerSimple.h.

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

EcalRecHitSimpleAlgo* EcalRecHitWorkerSimple::rechitMaker_
protected

Definition at line 45 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

std::vector<int> EcalRecHitWorkerSimple::v_chstatus_
protected

Definition at line 39 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

std::vector<int> EcalRecHitWorkerSimple::v_DB_reco_flags_
protected

Definition at line 41 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().