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

Protected Attributes

edm::ESHandle
< EcalADCToGeVConstant
agc
 
edm::ESHandle< EcalChannelStatuschStatus
 
double EBLaserMAX_
 
double EBLaserMIN_
 
double EELaserMAX_
 
double EELaserMIN_
 
edm::ESHandle
< EcalIntercalibConstants
ical
 
edm::ESHandle
< EcalTimeCalibConstants
itime
 
bool killDeadChannels_
 
edm::ESHandle< EcalLaserDbServicelaser
 
bool laserCorrection_
 
edm::ESHandle
< EcalTimeOffsetConstant
offtime
 
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 23 of file EcalRecHitWorkerSimple.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file EcalRecHitWorkerSimple.cc.

References EBLaserMAX_, EBLaserMIN_, EELaserMAX_, EELaserMIN_, edm::ParameterSet::getParameter(), killDeadChannels_, laserCorrection_, rechitMaker_, v_chstatus_, and v_DB_reco_flags_.

15  :
17 {
19  v_chstatus_ = ps.getParameter<std::vector<int> >("ChannelStatusToBeExcluded");
20  v_DB_reco_flags_ = ps.getParameter<std::vector<int> >("flagsMapDBReco");
21  killDeadChannels_ = ps.getParameter<bool>("killDeadChannels");
22  laserCorrection_ = ps.getParameter<bool>("laserCorrection");
23  EBLaserMIN_ = ps.getParameter<double>("EBLaserMIN");
24  EELaserMIN_ = ps.getParameter<double>("EELaserMIN");
25  EBLaserMAX_ = ps.getParameter<double>("EBLaserMAX");
26  EELaserMAX_ = ps.getParameter<double>("EELaserMAX");
27 
28 }
T getParameter(std::string const &) const
std::vector< int > v_DB_reco_flags_
EcalRecHitWorkerBaseClass(const edm::ParameterSet &, edm::ConsumesCollector &c)
EcalRecHitSimpleAlgo * rechitMaker_
std::vector< int > v_chstatus_
EcalRecHitWorkerSimple::EcalRecHitWorkerSimple ( const edm::ParameterSet ps)

Definition at line 31 of file EcalRecHitWorkerSimple.cc.

References EBLaserMAX_, EBLaserMIN_, EELaserMAX_, EELaserMIN_, edm::ParameterSet::getParameter(), killDeadChannels_, laserCorrection_, rechitMaker_, v_chstatus_, and v_DB_reco_flags_.

31  :
33 {
35  v_chstatus_ = ps.getParameter<std::vector<int> >("ChannelStatusToBeExcluded");
36  v_DB_reco_flags_ = ps.getParameter<std::vector<int> >("flagsMapDBReco");
37  killDeadChannels_ = ps.getParameter<bool>("killDeadChannels");
38  laserCorrection_ = ps.getParameter<bool>("laserCorrection");
39  EBLaserMIN_ = ps.getParameter<double>("EBLaserMIN");
40  EELaserMIN_ = ps.getParameter<double>("EELaserMIN");
41  EBLaserMAX_ = ps.getParameter<double>("EBLaserMAX");
42  EELaserMAX_ = ps.getParameter<double>("EELaserMAX");
43 
44 }
T getParameter(std::string const &) const
std::vector< int > v_DB_reco_flags_
EcalRecHitWorkerBaseClass(const edm::ParameterSet &, edm::ConsumesCollector &c)
EcalRecHitSimpleAlgo * rechitMaker_
std::vector< int > v_chstatus_
EcalRecHitWorkerSimple::~EcalRecHitWorkerSimple ( )
virtual

Definition at line 145 of file EcalRecHitWorkerSimple.cc.

References rechitMaker_.

145  {
146 
147  delete rechitMaker_;
148 }
EcalRecHitSimpleAlgo * rechitMaker_

Member Function Documentation

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

Implements EcalRecHitWorkerBaseClass.

Definition at line 59 of file EcalRecHitWorkerSimple.cc.

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

62 {
63  DetId detid=uncalibRH.id();
64 
66  EcalChannelStatusCode chStatusCode = 1;
67  if ( chit != chStatus->end() ) {
68  chStatusCode = *chit;
69  } else {
70  edm::LogError("EcalRecHitError") << "No channel status found for xtal "
71  << detid.rawId()
72  << "! something wrong with EcalChannelStatus in your DB? ";
73  }
74  if ( v_chstatus_.size() > 0) {
75  uint16_t code = chStatusCode.getStatusCode() & 0x001F;
76  std::vector<int>::const_iterator res = std::find( v_chstatus_.begin(), v_chstatus_.end(), code );
77  if ( res != v_chstatus_.end() ) {
78  return false;
79  }
80  }
81 
82  // find the proper flag for the recHit
83  // from a configurable vector
84  // (see cfg file for the association)
85  uint32_t recoFlag = 0;
86  uint16_t statusCode = chStatusCode.getStatusCode() & 0x001F;
87  if ( statusCode < v_DB_reco_flags_.size() ) {
88  // not very nice...
89  recoFlag = v_DB_reco_flags_[ statusCode ];
90  } else {
91  edm::LogError("EcalRecHitError") << "Flag " << statusCode
92  << " in DB exceed the allowed range of " << v_DB_reco_flags_.size();
93  }
94 
95  float offsetTime = 0; // the global time phase
96  const EcalIntercalibConstantMap& icalMap = ical->getMap();
97  if ( detid.subdetId() == EcalEndcap ) {
98  rechitMaker_->setADCToGeVConstant( float(agc->getEEValue()) );
99  offsetTime = offtime->getEEValue();
100  } else {
101  rechitMaker_->setADCToGeVConstant( float(agc->getEBValue()) );
102  offsetTime = offtime->getEBValue();
103  }
104 
105  // first intercalibration constants
106  EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(detid);
107  EcalIntercalibConstant icalconst = 1;
108  if( icalit!=icalMap.end() ) {
109  icalconst = (*icalit);
110  } else {
111  edm::LogError("EcalRecHitError") << "No intercalib const found for xtal "
112  << detid.rawId()
113  << "! something wrong with EcalIntercalibConstants in your DB? ";
114  }
115 
116  // get laser coefficient
117  float lasercalib = 1.;
118  if ( laserCorrection_ ) lasercalib = laser->getLaserCorrection( detid, evt.time());
119 
120 
121  // get time calibration coefficient
122  const EcalTimeCalibConstantMap & itimeMap = itime->getMap();
124  EcalTimeCalibConstant itimeconst = 0;
125  if( itime!=itimeMap.end() ) {
126  itimeconst = (*itime);
127  } else {
128  edm::LogError("EcalRecHitError") << "No time calib const found for xtal "
129  << detid.rawId()
130  << "! something wrong with EcalTimeCalibConstants in your DB? ";
131  }
132 
133 
134  // make the rechit and put in the output collection
136  EcalRecHit myrechit( rechitMaker_->makeRecHit(uncalibRH, icalconst * lasercalib, (itimeconst + offsetTime), /*recoflags_*/ 0) );
137  if (detid.subdetId() == EcalBarrel && (lasercalib < EBLaserMIN_ || lasercalib > EBLaserMAX_)) myrechit.setFlag(EcalRecHit::kPoorCalib);
138  if (detid.subdetId() == EcalEndcap && (lasercalib < EELaserMIN_ || lasercalib > EELaserMAX_)) myrechit.setFlag(EcalRecHit::kPoorCalib);
139  result.push_back(myrechit);
140  }
141 
142  return true;
143 }
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)
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: EcalRecHit.h:102
std::vector< int > v_DB_reco_flags_
edm::ESHandle< EcalChannelStatus > chStatus
virtual void setADCToGeVConstant(const float &value)
make rechits from dataframes
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:43
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:37
std::vector< int > v_chstatus_
Definition: DetId.h:18
std::vector< Item >::const_iterator const_iterator
edm::ESHandle< EcalTimeOffsetConstant > offtime
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 47 of file EcalRecHitWorkerSimple.cc.

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

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

48 {
52  es.get<EcalADCToGeVConstantRcd>().get(agc);
54  if ( laserCorrection_ ) es.get<EcalLaserDbRecord>().get(laser);
55 }
edm::ESHandle< EcalADCToGeVConstant > agc
edm::ESHandle< EcalChannelStatus > chStatus
edm::ESHandle< EcalTimeCalibConstants > itime
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< EcalTimeOffsetConstant > offtime
edm::ESHandle< EcalIntercalibConstants > ical
edm::ESHandle< EcalLaserDbService > laser

Member Data Documentation

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

Definition at line 45 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

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

Definition at line 46 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

double EcalRecHitWorkerSimple::EBLaserMAX_
protected

Definition at line 38 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

double EcalRecHitWorkerSimple::EBLaserMIN_
protected

Definition at line 36 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple().

double EcalRecHitWorkerSimple::EELaserMAX_
protected

Definition at line 39 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

double EcalRecHitWorkerSimple::EELaserMIN_
protected

Definition at line 37 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple().

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

Definition at line 42 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

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

Definition at line 43 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

bool EcalRecHitWorkerSimple::killDeadChannels_
protected

Definition at line 52 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

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

Definition at line 48 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

bool EcalRecHitWorkerSimple::laserCorrection_
protected

Definition at line 53 of file EcalRecHitWorkerSimple.h.

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

edm::ESHandle<EcalTimeOffsetConstant> EcalRecHitWorkerSimple::offtime
protected

Definition at line 44 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

EcalRecHitSimpleAlgo* EcalRecHitWorkerSimple::rechitMaker_
protected

Definition at line 55 of file EcalRecHitWorkerSimple.h.

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

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

Definition at line 47 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

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

Definition at line 50 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().