CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
EcalRecHitWorkerSimple Class Reference

#include <EcalRecHitWorkerSimple.h>

Inheritance diagram for EcalRecHitWorkerSimple:
EcalRecHitWorkerBaseClass

Public Member Functions

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

Protected Member Functions

uint32_t setFlagBits (const std::vector< std::vector< uint32_t > > &map, const uint32_t &status)
 

Protected Attributes

edm::ESHandle< EcalADCToGeVConstantagc
 
edm::ESHandle< EcalChannelStatuschStatus
 
double EBLaserMAX_
 
double EBLaserMIN_
 
double EELaserMAX_
 
double EELaserMIN_
 
uint32_t flagmask_
 
edm::ESHandle< EcalIntercalibConstantsical
 
edm::ESHandle< EcalTimeCalibConstantsitime
 
bool killDeadChannels_
 
edm::ESHandle< EcalLaserDbServicelaser
 
bool laserCorrection_
 
edm::ESHandle< EcalTimeOffsetConstantofftime
 
EcalRecHitSimpleAlgorechitMaker_
 
bool skipTimeCalib_
 
std::vector< int > v_chstatus_
 
std::vector< std::vector< uint32_t > > 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() [1/2]

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

Definition at line 15 of file EcalRecHitWorkerSimple.cc.

18  v_chstatus_ = StringToEnumValue<EcalChannelStatusCode::Code>(
19  ps.getParameter<std::vector<std::string> >("ChannelStatusToBeExcluded"));
20  killDeadChannels_ = ps.getParameter<bool>("killDeadChannels");
21  laserCorrection_ = ps.getParameter<bool>("laserCorrection");
22  EBLaserMIN_ = ps.getParameter<double>("EBLaserMIN");
23  EELaserMIN_ = ps.getParameter<double>("EELaserMIN");
24  EBLaserMAX_ = ps.getParameter<double>("EBLaserMAX");
25  EELaserMAX_ = ps.getParameter<double>("EELaserMAX");
26 
27  skipTimeCalib_ = ps.getParameter<bool>("skipTimeCalib");
28 
29  // Traslate string representation of flagsMapDBReco into enum values
30  const edm::ParameterSet& p = ps.getParameter<edm::ParameterSet>("flagsMapDBReco");
31  std::vector<std::string> recoflagbitsStrings = p.getParameterNames();
32  v_DB_reco_flags_.resize(32);
33 
34  for (unsigned int i = 0; i != recoflagbitsStrings.size(); ++i) {
35  EcalRecHit::Flags recoflagbit = (EcalRecHit::Flags)StringToEnumValue<EcalRecHit::Flags>(recoflagbitsStrings[i]);
36  std::vector<std::string> dbstatus_s = p.getParameter<std::vector<std::string> >(recoflagbitsStrings[i]);
37  std::vector<uint32_t> dbstatuses;
38  for (unsigned int j = 0; j != dbstatus_s.size(); ++j) {
40  (EcalChannelStatusCode::Code)StringToEnumValue<EcalChannelStatusCode::Code>(dbstatus_s[j]);
41  dbstatuses.push_back(dbstatus);
42  }
43 
44  v_DB_reco_flags_[recoflagbit] = dbstatuses;
45  }
46 
47  flagmask_ = 0;
50  flagmask_ |= 0x1 << EcalRecHit::kDead;
54 }

References EBLaserMAX_, EBLaserMIN_, EELaserMAX_, EELaserMIN_, flagmask_, edm::ParameterSet::getParameter(), mps_fire::i, dqmiolumiharvest::j, EcalRecHit::kDead, killDeadChannels_, EcalRecHit::kKilled, EcalRecHit::kL1SpikeFlag, EcalRecHit::kNeighboursRecovered, EcalRecHit::kTowerRecovered, EcalRecHit::kTPSaturated, laserCorrection_, AlCaHLTBitMon_ParallelJobs::p, rechitMaker_, skipTimeCalib_, v_chstatus_, and v_DB_reco_flags_.

◆ EcalRecHitWorkerSimple() [2/2]

EcalRecHitWorkerSimple::EcalRecHitWorkerSimple ( const edm::ParameterSet )

◆ ~EcalRecHitWorkerSimple()

EcalRecHitWorkerSimple::~EcalRecHitWorkerSimple ( )
override

Definition at line 157 of file EcalRecHitWorkerSimple.cc.

157 { delete rechitMaker_; }

References rechitMaker_.

Member Function Documentation

◆ run()

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

Implements EcalRecHitWorkerBaseClass.

Definition at line 70 of file EcalRecHitWorkerSimple.cc.

72  {
73  DetId detid = uncalibRH.id();
74 
76  EcalChannelStatusCode::Code dbstatus = chit->getStatusCode();
77 
78  // check for channels to be excluded from reconstruction
79  if (!v_chstatus_.empty()) {
80  std::vector<int>::const_iterator res = std::find(v_chstatus_.begin(), v_chstatus_.end(), dbstatus);
81  if (res != v_chstatus_.end())
82  return false;
83  }
84 
85  uint32_t flagBits = setFlagBits(v_DB_reco_flags_, dbstatus);
86 
87  float offsetTime = 0; // the global time phase
88  const EcalIntercalibConstantMap& icalMap = ical->getMap();
89  if (detid.subdetId() == EcalEndcap) {
91  if (!skipTimeCalib_)
92  offsetTime = offtime->getEEValue();
93  } else {
95  if (!skipTimeCalib_)
96  offsetTime = offtime->getEBValue();
97  }
98 
99  // first intercalibration constants
100  EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(detid);
101  EcalIntercalibConstant icalconst = 1;
102  if (icalit != icalMap.end()) {
103  icalconst = (*icalit);
104  } else {
105  edm::LogError("EcalRecHitError") << "No intercalib const found for xtal " << detid.rawId()
106  << "! something wrong with EcalIntercalibConstants in your DB? ";
107  }
108 
109  // get laser coefficient
110  float lasercalib = 1.;
111  if (laserCorrection_)
112  lasercalib = laser->getLaserCorrection(detid, evt.time());
113 
114  // get time calibration coefficient
115  EcalTimeCalibConstant itimeconst = 0;
116 
117  if (!skipTimeCalib_) {
118  const EcalTimeCalibConstantMap& itimeMap = itime->getMap();
120 
121  if (itime != itimeMap.end()) {
122  itimeconst = (*itime);
123  } else {
124  edm::LogError("EcalRecHitError") << "No time calib const found for xtal " << detid.rawId()
125  << "! something wrong with EcalTimeCalibConstants in your DB? ";
126  }
127  }
128 
129  // make the rechit and put in the output collection, unless recovery has to take care of it
130  if (!(flagmask_ & flagBits) || !killDeadChannels_) {
131  EcalRecHit myrechit(rechitMaker_->makeRecHit(uncalibRH,
132  icalconst * lasercalib,
133  (itimeconst + offsetTime),
134  /*recoflags_ 0*/
135  flagBits));
136 
137  if (detid.subdetId() == EcalBarrel && (lasercalib < EBLaserMIN_ || lasercalib > EBLaserMAX_))
139  if (detid.subdetId() == EcalEndcap && (lasercalib < EELaserMIN_ || lasercalib > EELaserMAX_))
140  myrechit.setFlag(EcalRecHit::kPoorCalib);
141  result.push_back(myrechit);
142  }
143 
144  return true;
145 }

References agc, chStatus, EBLaserMAX_, EcalBarrel, EcalEndcap, EELaserMAX_, EcalCondObjectContainer< T >::end(), spr::find(), EcalCondObjectContainer< T >::find(), flagmask_, EcalADCToGeVConstant::getEBValue(), EcalTimeOffsetConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), EcalTimeOffsetConstant::getEEValue(), EcalLaserDbService::getLaserCorrection(), ical, EcalUncalibratedRecHit::id(), itime, killDeadChannels_, EcalRecHit::kPoorCalib, laser, laserCorrection_, EcalRecHitSimpleAlgo::makeRecHit(), offtime, DetId::rawId(), rechitMaker_, mps_fire::result, EcalRecHitSimpleAlgo::setADCToGeVConstant(), EcalRecHit::setFlag(), setFlagBits(), skipTimeCalib_, DetId::subdetId(), edm::EventBase::time(), v_chstatus_, and v_DB_reco_flags_.

◆ set()

void EcalRecHitWorkerSimple::set ( const edm::EventSetup es)
overridevirtual

◆ setFlagBits()

uint32_t EcalRecHitWorkerSimple::setFlagBits ( const std::vector< std::vector< uint32_t > > &  map,
const uint32_t &  status 
)
protected

Definition at line 148 of file EcalRecHitWorkerSimple.cc.

148  {
149  for (unsigned int i = 0; i != map.size(); ++i) {
150  if (std::find(map[i].begin(), map[i].end(), status) != map[i].end())
151  return 0x1 << i;
152  }
153 
154  return 0;
155 }

References begin, end, spr::find(), mps_fire::i, genParticles_cff::map, mps_update::status, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by run().

Member Data Documentation

◆ agc

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

Definition at line 41 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

◆ chStatus

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

Definition at line 42 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

◆ EBLaserMAX_

double EcalRecHitWorkerSimple::EBLaserMAX_
protected

Definition at line 35 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

◆ EBLaserMIN_

double EcalRecHitWorkerSimple::EBLaserMIN_
protected

Definition at line 33 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple().

◆ EELaserMAX_

double EcalRecHitWorkerSimple::EELaserMAX_
protected

Definition at line 36 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

◆ EELaserMIN_

double EcalRecHitWorkerSimple::EELaserMIN_
protected

Definition at line 34 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple().

◆ flagmask_

uint32_t EcalRecHitWorkerSimple::flagmask_
protected

Definition at line 51 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

◆ ical

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

Definition at line 38 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

◆ itime

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

Definition at line 39 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

◆ killDeadChannels_

bool EcalRecHitWorkerSimple::killDeadChannels_
protected

Definition at line 53 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

◆ laser

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

Definition at line 44 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

◆ laserCorrection_

bool EcalRecHitWorkerSimple::laserCorrection_
protected

Definition at line 54 of file EcalRecHitWorkerSimple.h.

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

◆ offtime

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

Definition at line 40 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

◆ rechitMaker_

EcalRecHitSimpleAlgo* EcalRecHitWorkerSimple::rechitMaker_
protected

Definition at line 57 of file EcalRecHitWorkerSimple.h.

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

◆ skipTimeCalib_

bool EcalRecHitWorkerSimple::skipTimeCalib_
protected

Definition at line 55 of file EcalRecHitWorkerSimple.h.

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

◆ v_chstatus_

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

Definition at line 43 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

◆ v_DB_reco_flags_

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

Definition at line 47 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:76
EcalRecHit::kNeighboursRecovered
Definition: EcalRecHit.h:29
EcalTimeOffsetConstantRcd
Definition: EcalTimeOffsetConstantRcd.h:5
EcalRecHit
Definition: EcalRecHit.h:15
EcalRecHit::kTPSaturated
Definition: EcalRecHit.h:33
mps_fire.i
i
Definition: mps_fire.py:355
EcalRecHitSimpleAlgo::setADCToGeVConstant
void setADCToGeVConstant(const float &value) override
make rechits from dataframes
Definition: EcalRecHitSimpleAlgo.h:23
EcalRecHitWorkerSimple::offtime
edm::ESHandle< EcalTimeOffsetConstant > offtime
Definition: EcalRecHitWorkerSimple.h:40
mps_update.status
status
Definition: mps_update.py:69
EcalRecHit::kL1SpikeFlag
Definition: EcalRecHit.h:34
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
EcalRecHit::Flags
Flags
Definition: EcalRecHit.h:20
EcalRecHitWorkerSimple::EELaserMIN_
double EELaserMIN_
Definition: EcalRecHitWorkerSimple.h:34
EcalRecHitWorkerSimple::laserCorrection_
bool laserCorrection_
Definition: EcalRecHitWorkerSimple.h:54
EcalTimeOffsetConstant::getEEValue
float getEEValue() const
Definition: EcalTimeOffsetConstant.h:21
EcalTimeOffsetConstant::getEBValue
float getEBValue() const
Definition: EcalTimeOffsetConstant.h:20
EcalRecHitWorkerSimple::laser
edm::ESHandle< EcalLaserDbService > laser
Definition: EcalRecHitWorkerSimple.h:44
edm::EventBase::time
edm::Timestamp time() const
Definition: EventBase.h:60
EcalRecHit::kTowerRecovered
Definition: EcalRecHit.h:30
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EcalCondObjectContainer< float >
EcalBarrel
Definition: EcalSubdetector.h:10
EcalIntercalibConstant
float EcalIntercalibConstant
Definition: EcalIntercalibConstants.h:10
end
#define end
Definition: vmac.h:39
EcalRecHitSimpleAlgo::makeRecHit
EcalRecHit makeRecHit(const EcalUncalibratedRecHit &uncalibRH, const float &intercalibConstant, const float &timeIntercalib=0, const uint32_t &flags=0) const override
Compute parameters.
Definition: EcalRecHitSimpleAlgo.h:32
DetId
Definition: DetId.h:17
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
EcalRecHitWorkerSimple::agc
edm::ESHandle< EcalADCToGeVConstant > agc
Definition: EcalRecHitWorkerSimple.h:41
EcalLaserDbRecord
Definition: EcalLaserDbRecord.h:19
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
EcalEndcap
Definition: EcalSubdetector.h:10
EcalRecHitWorkerSimple::EBLaserMAX_
double EBLaserMAX_
Definition: EcalRecHitWorkerSimple.h:35
edm::ParameterSet
Definition: ParameterSet.h:36
EcalADCToGeVConstant::getEEValue
float getEEValue() const
Definition: EcalADCToGeVConstant.h:21
edm::LogError
Definition: MessageLogger.h:183
EcalUncalibratedRecHit::id
DetId id() const
Definition: EcalUncalibratedRecHit.h:38
EcalChannelStatusRcd
Definition: EcalChannelStatusRcd.h:5
EcalRecHitWorkerSimple::EBLaserMIN_
double EBLaserMIN_
Definition: EcalRecHitWorkerSimple.h:33
EcalRecHitWorkerSimple::chStatus
edm::ESHandle< EcalChannelStatus > chStatus
Definition: EcalRecHitWorkerSimple.h:42
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
EcalRecHit::kDead
Definition: EcalRecHit.h:31
get
#define get
res
Definition: Electron.h:6
EcalRecHitWorkerSimple::ical
edm::ESHandle< EcalIntercalibConstants > ical
Definition: EcalRecHitWorkerSimple.h:38
EcalTimeCalibConstantsRcd
Definition: EcalTimeCalibConstantsRcd.h:5
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EcalLaserDbService::getLaserCorrection
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
Definition: EcalLaserDbService.cc:26
EcalChannelStatusCode::Code
Code
Definition: EcalChannelStatusCode.h:20
EcalRecHitWorkerSimple::skipTimeCalib_
bool skipTimeCalib_
Definition: EcalRecHitWorkerSimple.h:55
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalRecHitWorkerSimple::itime
edm::ESHandle< EcalTimeCalibConstants > itime
Definition: EcalRecHitWorkerSimple.h:39
EcalRecHitWorkerSimple::EELaserMAX_
double EELaserMAX_
Definition: EcalRecHitWorkerSimple.h:36
EcalRecHitWorkerBaseClass::EcalRecHitWorkerBaseClass
EcalRecHitWorkerBaseClass(const edm::ParameterSet &, edm::ConsumesCollector &c)
Definition: EcalRecHitWorkerBaseClass.h:17
EcalRecHitWorkerSimple::flagmask_
uint32_t flagmask_
Definition: EcalRecHitWorkerSimple.h:51
EcalRecHit::kPoorCalib
Definition: EcalRecHit.h:26
EcalRecHitSimpleAlgo
Definition: EcalRecHitSimpleAlgo.h:15
EcalRecHitWorkerSimple::v_chstatus_
std::vector< int > v_chstatus_
Definition: EcalRecHitWorkerSimple.h:43
EcalCondObjectContainer< EcalChannelStatusCode >::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
mps_fire.result
result
Definition: mps_fire.py:303
genParticles_cff.map
map
Definition: genParticles_cff.py:11
EcalRecHitWorkerSimple::v_DB_reco_flags_
std::vector< std::vector< uint32_t > > v_DB_reco_flags_
Definition: EcalRecHitWorkerSimple.h:47
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
EcalRecHit::setFlag
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: EcalRecHit.h:183
EcalRecHit::kKilled
Definition: EcalRecHit.h:32
EcalRecHitWorkerSimple::rechitMaker_
EcalRecHitSimpleAlgo * rechitMaker_
Definition: EcalRecHitWorkerSimple.h:57
EcalRecHitWorkerSimple::killDeadChannels_
bool killDeadChannels_
Definition: EcalRecHitWorkerSimple.h:53
EcalADCToGeVConstant::getEBValue
float getEBValue() const
Definition: EcalADCToGeVConstant.h:20
EcalIntercalibConstantsRcd
Definition: EcalIntercalibConstantsRcd.h:5
EcalADCToGeVConstantRcd
Definition: EcalADCToGeVConstantRcd.h:5
begin
#define begin
Definition: vmac.h:32
EcalTimeCalibConstant
float EcalTimeCalibConstant
Definition: EcalTimeCalibConstants.h:10
EcalRecHitWorkerSimple::setFlagBits
uint32_t setFlagBits(const std::vector< std::vector< uint32_t > > &map, const uint32_t &status)
Definition: EcalRecHitWorkerSimple.cc:148