CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
EcalRecHitWorkerSimple Class Reference
Inheritance diagram for EcalRecHitWorkerSimple:
EcalRecHitWorkerBaseClass

Public Member Functions

 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 &, edm::ConsumesCollector &c)
 
 EcalRecHitWorkerBaseClass (const edm::ParameterSet &)
 
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::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcdagcToken_
 
edm::ESHandle< EcalChannelStatuschStatus
 
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcdchStatusToken_
 
double EBLaserMAX_
 
double EBLaserMIN_
 
double EELaserMAX_
 
double EELaserMIN_
 
uint32_t flagmask_
 
edm::ESHandle< EcalIntercalibConstantsical
 
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcdicalToken_
 
edm::ESHandle< EcalTimeCalibConstantsitime
 
edm::ESGetToken< EcalTimeCalibConstants, EcalTimeCalibConstantsRcditimeToken_
 
bool killDeadChannels_
 
edm::ESHandle< EcalLaserDbServicelaser
 
bool laserCorrection_
 
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecordlaserToken_
 
edm::ESHandle< EcalTimeOffsetConstantofftime
 
edm::ESGetToken< EcalTimeOffsetConstant, EcalTimeOffsetConstantRcdofftimeToken_
 
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 30 of file EcalRecHitWorkerSimple.cc.

Constructor & Destructor Documentation

◆ EcalRecHitWorkerSimple()

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

Definition at line 72 of file EcalRecHitWorkerSimple.cc.

References agcToken_, HltBtagPostValidation_cff::c, chStatusToken_, EBLaserMAX_, EBLaserMIN_, ecal_dqm_sourceclient-live_cfg::EcalLaserDbService, EELaserMAX_, EELaserMIN_, flagmask_, edm::ParameterSet::getParameter(), mps_fire::i, icalToken_, itimeToken_, dqmiolumiharvest::j, EcalRecHit::kDead, killDeadChannels_, EcalRecHit::kKilled, EcalRecHit::kL1SpikeFlag, EcalRecHit::kNeighboursRecovered, EcalRecHit::kTowerRecovered, EcalRecHit::kTPSaturated, laserCorrection_, laserToken_, offtimeToken_, AlCaHLTBitMon_ParallelJobs::p, rechitMaker_, skipTimeCalib_, v_chstatus_, and v_DB_reco_flags_.

75  v_chstatus_ = StringToEnumValue<EcalChannelStatusCode::Code>(
76  ps.getParameter<std::vector<std::string> >("ChannelStatusToBeExcluded"));
77  killDeadChannels_ = ps.getParameter<bool>("killDeadChannels");
78  laserCorrection_ = ps.getParameter<bool>("laserCorrection");
79  EBLaserMIN_ = ps.getParameter<double>("EBLaserMIN");
80  EELaserMIN_ = ps.getParameter<double>("EELaserMIN");
81  EBLaserMAX_ = ps.getParameter<double>("EBLaserMAX");
82  EELaserMAX_ = ps.getParameter<double>("EELaserMAX");
83 
84  skipTimeCalib_ = ps.getParameter<bool>("skipTimeCalib");
85 
87  if (!skipTimeCalib_) {
89  ps.getParameter<edm::ESInputTag>("timeCalibTag"));
91  ps.getParameter<edm::ESInputTag>("timeOffsetTag"));
92  }
95  if (laserCorrection_)
97 
98  // Traslate string representation of flagsMapDBReco into enum values
99  const edm::ParameterSet& p = ps.getParameter<edm::ParameterSet>("flagsMapDBReco");
100  std::vector<std::string> recoflagbitsStrings = p.getParameterNames();
101  v_DB_reco_flags_.resize(32);
102 
103  for (unsigned int i = 0; i != recoflagbitsStrings.size(); ++i) {
104  EcalRecHit::Flags recoflagbit = (EcalRecHit::Flags)StringToEnumValue<EcalRecHit::Flags>(recoflagbitsStrings[i]);
105  std::vector<std::string> dbstatus_s = p.getParameter<std::vector<std::string> >(recoflagbitsStrings[i]);
106  std::vector<uint32_t> dbstatuses;
107  for (unsigned int j = 0; j != dbstatus_s.size(); ++j) {
108  EcalChannelStatusCode::Code dbstatus =
109  (EcalChannelStatusCode::Code)StringToEnumValue<EcalChannelStatusCode::Code>(dbstatus_s[j]);
110  dbstatuses.push_back(dbstatus);
111  }
112 
113  v_DB_reco_flags_[recoflagbit] = dbstatuses;
114  }
115 
116  flagmask_ = 0;
119  flagmask_ |= 0x1 << EcalRecHit::kDead;
120  flagmask_ |= 0x1 << EcalRecHit::kKilled;
123 }
edm::ESGetToken< EcalTimeCalibConstants, EcalTimeCalibConstantsRcd > itimeToken_
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > laserToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< std::vector< uint32_t > > v_DB_reco_flags_
edm::ESGetToken< EcalTimeOffsetConstant, EcalTimeOffsetConstantRcd > offtimeToken_
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > icalToken_
EcalChannelStatusMap EcalChannelStatus
EcalRecHitWorkerBaseClass(const edm::ParameterSet &, edm::ConsumesCollector &c)
EcalRecHitSimpleAlgo * rechitMaker_
std::vector< int > v_chstatus_
EcalTimeCalibConstantMap EcalTimeCalibConstants
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > agcToken_
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > chStatusToken_
EcalIntercalibConstantMap EcalIntercalibConstants

◆ ~EcalRecHitWorkerSimple()

EcalRecHitWorkerSimple::~EcalRecHitWorkerSimple ( )
override

Definition at line 226 of file EcalRecHitWorkerSimple.cc.

References rechitMaker_.

226 { delete rechitMaker_; }
EcalRecHitSimpleAlgo * rechitMaker_

Member Function Documentation

◆ run()

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

Implements EcalRecHitWorkerBaseClass.

Definition at line 139 of file EcalRecHitWorkerSimple.cc.

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

141  {
142  DetId detid = uncalibRH.id();
143 
145  EcalChannelStatusCode::Code dbstatus = chit->getStatusCode();
146 
147  // check for channels to be excluded from reconstruction
148  if (!v_chstatus_.empty()) {
149  std::vector<int>::const_iterator res = std::find(v_chstatus_.begin(), v_chstatus_.end(), dbstatus);
150  if (res != v_chstatus_.end())
151  return false;
152  }
153 
154  uint32_t flagBits = setFlagBits(v_DB_reco_flags_, dbstatus);
155 
156  float offsetTime = 0; // the global time phase
157  const EcalIntercalibConstantMap& icalMap = ical->getMap();
158  if (detid.subdetId() == EcalEndcap) {
160  if (!skipTimeCalib_)
161  offsetTime = offtime->getEEValue();
162  } else {
164  if (!skipTimeCalib_)
165  offsetTime = offtime->getEBValue();
166  }
167 
168  // first intercalibration constants
169  EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(detid);
170  EcalIntercalibConstant icalconst = 1;
171  if (icalit != icalMap.end()) {
172  icalconst = (*icalit);
173  } else {
174  edm::LogError("EcalRecHitError") << "No intercalib const found for xtal " << detid.rawId()
175  << "! something wrong with EcalIntercalibConstants in your DB? ";
176  }
177 
178  // get laser coefficient
179  float lasercalib = 1.;
180  if (laserCorrection_)
181  lasercalib = laser->getLaserCorrection(detid, evt.time());
182 
183  // get time calibration coefficient
184  EcalTimeCalibConstant itimeconst = 0;
185 
186  if (!skipTimeCalib_) {
187  const EcalTimeCalibConstantMap& itimeMap = itime->getMap();
189 
190  if (itime != itimeMap.end()) {
191  itimeconst = (*itime);
192  } else {
193  edm::LogError("EcalRecHitError") << "No time calib const found for xtal " << detid.rawId()
194  << "! something wrong with EcalTimeCalibConstants in your DB? ";
195  }
196  }
197 
198  // make the rechit and put in the output collection, unless recovery has to take care of it
199  if (!(flagmask_ & flagBits) || !killDeadChannels_) {
200  EcalRecHit myrechit(rechitMaker_->makeRecHit(uncalibRH,
201  icalconst * lasercalib,
202  (itimeconst + offsetTime),
203  /*recoflags_ 0*/
204  flagBits));
205 
206  if (detid.subdetId() == EcalBarrel && (lasercalib < EBLaserMIN_ || lasercalib > EBLaserMAX_))
208  if (detid.subdetId() == EcalEndcap && (lasercalib < EELaserMIN_ || lasercalib > EELaserMAX_))
209  myrechit.setFlag(EcalRecHit::kPoorCalib);
210  result.push_back(myrechit);
211  }
212 
213  return true;
214 }
edm::ESHandle< EcalADCToGeVConstant > agc
std::vector< std::vector< uint32_t > > v_DB_reco_flags_
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: EcalRecHit.h:184
edm::ESHandle< EcalChannelStatus > chStatus
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Definition: Electron.h:6
edm::ESHandle< EcalTimeCalibConstants > itime
edm::Timestamp time() const
Definition: EventBase.h:64
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
EcalRecHitSimpleAlgo * rechitMaker_
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
std::vector< int > v_chstatus_
const_iterator find(uint32_t rawId) const
void setADCToGeVConstant(const float &value) override
make rechits from dataframes
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< Item >::const_iterator const_iterator
uint32_t setFlagBits(const std::vector< std::vector< uint32_t > > &map, const uint32_t &status)
EcalRecHit makeRecHit(const EcalUncalibratedRecHit &uncalibRH, const float &intercalibConstant, const float &timeIntercalib=0, const uint32_t &flags=0) const override
Compute parameters.
edm::ESHandle< EcalTimeOffsetConstant > offtime
float EcalTimeCalibConstant
const_iterator end() const
edm::ESHandle< EcalIntercalibConstants > ical
float EcalIntercalibConstant
edm::ESHandle< EcalLaserDbService > laser

◆ set()

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

Implements EcalRecHitWorkerBaseClass.

Definition at line 125 of file EcalRecHitWorkerSimple.cc.

References agc, agcToken_, chStatus, chStatusToken_, edm::EventSetup::getHandle(), ical, icalToken_, itime, itimeToken_, laser, laserCorrection_, laserToken_, offtime, offtimeToken_, and skipTimeCalib_.

125  {
126  ical = es.getHandle(icalToken_);
127 
128  if (!skipTimeCalib_) {
131  }
132 
133  agc = es.getHandle(agcToken_);
135  if (laserCorrection_)
137 }
edm::ESGetToken< EcalTimeCalibConstants, EcalTimeCalibConstantsRcd > itimeToken_
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > laserToken_
edm::ESHandle< EcalADCToGeVConstant > agc
edm::ESGetToken< EcalTimeOffsetConstant, EcalTimeOffsetConstantRcd > offtimeToken_
edm::ESHandle< EcalChannelStatus > chStatus
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > icalToken_
edm::ESHandle< EcalTimeCalibConstants > itime
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
edm::ESHandle< EcalTimeOffsetConstant > offtime
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > agcToken_
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > chStatusToken_
edm::ESHandle< EcalIntercalibConstants > ical
edm::ESHandle< EcalLaserDbService > laser

◆ setFlagBits()

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

Definition at line 217 of file EcalRecHitWorkerSimple.cc.

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

Referenced by run().

217  {
218  for (unsigned int i = 0; i != map.size(); ++i) {
219  if (std::find(map[i].begin(), map[i].end(), status) != map[i].end())
220  return 0x1 << i;
221  }
222 
223  return 0;
224 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

Member Data Documentation

◆ agc

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

Definition at line 47 of file EcalRecHitWorkerSimple.cc.

Referenced by run(), and set().

◆ agcToken_

edm::ESGetToken<EcalADCToGeVConstant, EcalADCToGeVConstantRcd> EcalRecHitWorkerSimple::agcToken_
protected

Definition at line 54 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and set().

◆ chStatus

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

Definition at line 48 of file EcalRecHitWorkerSimple.cc.

Referenced by run(), and set().

◆ chStatusToken_

edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> EcalRecHitWorkerSimple::chStatusToken_
protected

Definition at line 55 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and set().

◆ EBLaserMAX_

double EcalRecHitWorkerSimple::EBLaserMAX_
protected

Definition at line 41 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and run().

◆ EBLaserMIN_

double EcalRecHitWorkerSimple::EBLaserMIN_
protected

Definition at line 39 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple().

◆ EELaserMAX_

double EcalRecHitWorkerSimple::EELaserMAX_
protected

Definition at line 42 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and run().

◆ EELaserMIN_

double EcalRecHitWorkerSimple::EELaserMIN_
protected

Definition at line 40 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple().

◆ flagmask_

uint32_t EcalRecHitWorkerSimple::flagmask_
protected

Definition at line 63 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and run().

◆ ical

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

Definition at line 44 of file EcalRecHitWorkerSimple.cc.

Referenced by run(), and set().

◆ icalToken_

edm::ESGetToken<EcalIntercalibConstants, EcalIntercalibConstantsRcd> EcalRecHitWorkerSimple::icalToken_
protected

Definition at line 51 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and set().

◆ itime

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

Definition at line 45 of file EcalRecHitWorkerSimple.cc.

Referenced by run(), and set().

◆ itimeToken_

edm::ESGetToken<EcalTimeCalibConstants, EcalTimeCalibConstantsRcd> EcalRecHitWorkerSimple::itimeToken_
protected

Definition at line 52 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and set().

◆ killDeadChannels_

bool EcalRecHitWorkerSimple::killDeadChannels_
protected

Definition at line 65 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and run().

◆ laser

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

Definition at line 50 of file EcalRecHitWorkerSimple.cc.

Referenced by run(), and set().

◆ laserCorrection_

bool EcalRecHitWorkerSimple::laserCorrection_
protected

Definition at line 66 of file EcalRecHitWorkerSimple.cc.

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

◆ laserToken_

edm::ESGetToken<EcalLaserDbService, EcalLaserDbRecord> EcalRecHitWorkerSimple::laserToken_
protected

Definition at line 56 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and set().

◆ offtime

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

Definition at line 46 of file EcalRecHitWorkerSimple.cc.

Referenced by run(), and set().

◆ offtimeToken_

edm::ESGetToken<EcalTimeOffsetConstant, EcalTimeOffsetConstantRcd> EcalRecHitWorkerSimple::offtimeToken_
protected

Definition at line 53 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and set().

◆ rechitMaker_

EcalRecHitSimpleAlgo* EcalRecHitWorkerSimple::rechitMaker_
protected

Definition at line 69 of file EcalRecHitWorkerSimple.cc.

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

◆ skipTimeCalib_

bool EcalRecHitWorkerSimple::skipTimeCalib_
protected

Definition at line 67 of file EcalRecHitWorkerSimple.cc.

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

◆ v_chstatus_

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

Definition at line 49 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and run().

◆ v_DB_reco_flags_

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

Definition at line 59 of file EcalRecHitWorkerSimple.cc.

Referenced by EcalRecHitWorkerSimple(), and run().