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
 
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 26 of file EcalRecHitWorkerSimple.h.

Constructor & Destructor Documentation

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

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 &)
EcalRecHitSimpleAlgo * rechitMaker_
std::vector< int > v_chstatus_
EcalRecHitWorkerSimple::~EcalRecHitWorkerSimple ( )
virtual

Definition at line 130 of file EcalRecHitWorkerSimple.cc.

References rechitMaker_.

130  {
131 
132  delete rechitMaker_;
133 }
EcalRecHitSimpleAlgo * rechitMaker_

Member Function Documentation

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

Implements EcalRecHitWorkerBaseClass.

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

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

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

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

33 {
37  es.get<EcalADCToGeVConstantRcd>().get(agc);
39  if ( laserCorrection_ ) es.get<EcalLaserDbRecord>().get(laser);
40 }
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 47 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

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

Definition at line 48 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

double EcalRecHitWorkerSimple::EBLaserMAX_
protected

Definition at line 40 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

double EcalRecHitWorkerSimple::EBLaserMIN_
protected

Definition at line 38 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple().

double EcalRecHitWorkerSimple::EELaserMAX_
protected

Definition at line 41 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

double EcalRecHitWorkerSimple::EELaserMIN_
protected

Definition at line 39 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple().

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

Definition at line 44 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

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

Definition at line 45 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

bool EcalRecHitWorkerSimple::killDeadChannels_
protected

Definition at line 54 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

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

Definition at line 50 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

bool EcalRecHitWorkerSimple::laserCorrection_
protected

Definition at line 55 of file EcalRecHitWorkerSimple.h.

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

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

Definition at line 46 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

EcalRecHitSimpleAlgo* EcalRecHitWorkerSimple::rechitMaker_
protected

Definition at line 57 of file EcalRecHitWorkerSimple.h.

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

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

Definition at line 49 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

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

Definition at line 52 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().