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 &, edm::ConsumesCollector &c)
 
 EcalRecHitWorkerSimple (const edm::ParameterSet &)
 
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::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::EcalRecHitWorkerSimple ( const edm::ParameterSet ps,
edm::ConsumesCollector c 
)

Definition at line 15 of file EcalRecHitWorkerSimple.cc.

References EBLaserMAX_, EBLaserMIN_, EELaserMAX_, EELaserMIN_, flagmask_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), mps_fire::i, 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_.

15  :
17 {
19  v_chstatus_ =
20  StringToEnumValue<EcalChannelStatusCode::Code>(ps.getParameter<std::vector<std::string> >("ChannelStatusToBeExcluded"));
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  skipTimeCalib_=ps.getParameter<bool>("skipTimeCalib");
29 
30  // Traslate string representation of flagsMapDBReco into enum values
31  const edm::ParameterSet & p=ps.getParameter< edm::ParameterSet >("flagsMapDBReco");
32  std::vector<std::string> recoflagbitsStrings = p.getParameterNames();
33  v_DB_reco_flags_.resize(32);
34 
35  for (unsigned int i=0;i!=recoflagbitsStrings.size();++i){
36  EcalRecHit::Flags recoflagbit = (EcalRecHit::Flags)
37  StringToEnumValue<EcalRecHit::Flags>(recoflagbitsStrings[i]);
38  std::vector<std::string> dbstatus_s =
39  p.getParameter<std::vector<std::string> >(recoflagbitsStrings[i]);
40  std::vector<uint32_t> dbstatuses;
41  for (unsigned int j=0; j!= dbstatus_s.size(); ++j){
43  StringToEnumValue<EcalChannelStatusCode::Code>(dbstatus_s[j]);
44  dbstatuses.push_back(dbstatus);
45  }
46 
47  v_DB_reco_flags_[recoflagbit]=dbstatuses;
48  }
49 
50  flagmask_=0;
57 }
T getParameter(std::string const &) const
std::vector< std::vector< uint32_t > > v_DB_reco_flags_
EcalRecHitWorkerBaseClass(const edm::ParameterSet &, edm::ConsumesCollector &c)
EcalRecHitSimpleAlgo * rechitMaker_
std::vector< int > v_chstatus_
EcalRecHitWorkerSimple::EcalRecHitWorkerSimple ( const edm::ParameterSet )
EcalRecHitWorkerSimple::~EcalRecHitWorkerSimple ( )
override

Definition at line 170 of file EcalRecHitWorkerSimple.cc.

References DEFINE_EDM_PLUGIN, and rechitMaker_.

170  {
171 
172  delete rechitMaker_;
173 }
EcalRecHitSimpleAlgo * rechitMaker_

Member Function Documentation

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

Implements EcalRecHitWorkerBaseClass.

Definition at line 76 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, edm::SortedCollection< T, SORT >::push_back(), DetId::rawId(), rechitMaker_, EcalRecHitSimpleAlgo::setADCToGeVConstant(), EcalRecHit::setFlag(), setFlagBits(), skipTimeCalib_, DetId::subdetId(), edm::EventBase::time(), v_chstatus_, and v_DB_reco_flags_.

79 {
80  DetId detid=uncalibRH.id();
81 
83  EcalChannelStatusCode::Code dbstatus = chit->getStatusCode();
84 
85  // check for channels to be excluded from reconstruction
86  if ( !v_chstatus_.empty()) {
87 
88  std::vector<int>::const_iterator res =
89  std::find( v_chstatus_.begin(), v_chstatus_.end(), dbstatus );
90  if ( res != v_chstatus_.end() ) return false;
91 
92  }
93 
94  uint32_t flagBits = setFlagBits(v_DB_reco_flags_, dbstatus);
95 
96  float offsetTime = 0; // the global time phase
97  const EcalIntercalibConstantMap& icalMap = ical->getMap();
98  if ( detid.subdetId() == EcalEndcap ) {
100  if (!skipTimeCalib_) offsetTime = offtime->getEEValue();
101  } else {
103  if (!skipTimeCalib_) offsetTime = offtime->getEBValue();
104  }
105 
106  // first intercalibration constants
107  EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(detid);
108  EcalIntercalibConstant icalconst = 1;
109  if( icalit!=icalMap.end() ) {
110  icalconst = (*icalit);
111  } else {
112  edm::LogError("EcalRecHitError") << "No intercalib const found for xtal "
113  << detid.rawId()
114  << "! something wrong with EcalIntercalibConstants in your DB? ";
115  }
116 
117  // get laser coefficient
118  float lasercalib = 1.;
119  if ( laserCorrection_ ) lasercalib = laser->getLaserCorrection( detid, evt.time());
120 
121 
122  // get time calibration coefficient
123  EcalTimeCalibConstant itimeconst = 0;
124 
125  if (!skipTimeCalib_){
126  const EcalTimeCalibConstantMap & itimeMap = itime->getMap();
128 
129  if( itime!=itimeMap.end() ) {
130  itimeconst = (*itime);
131  } else {
132  edm::LogError("EcalRecHitError") << "No time calib const found for xtal "
133  << detid.rawId()
134  << "! something wrong with EcalTimeCalibConstants in your DB? ";
135  }
136 
137  }
138 
139  // make the rechit and put in the output collection, unless recovery has to take care of it
140  if (! (flagmask_ & flagBits ) || !killDeadChannels_) {
141  EcalRecHit myrechit( rechitMaker_->makeRecHit(uncalibRH,
142  icalconst * lasercalib,
143  (itimeconst + offsetTime),
144  /*recoflags_ 0*/
145  flagBits) );
146 
147  if (detid.subdetId() == EcalBarrel && (lasercalib < EBLaserMIN_ || lasercalib > EBLaserMAX_))
149  if (detid.subdetId() == EcalEndcap && (lasercalib < EELaserMIN_ || lasercalib > EELaserMAX_))
150  myrechit.setFlag(EcalRecHit::kPoorCalib);
151  result.push_back(myrechit);
152  }
153 
154  return true;
155 }
edm::ESHandle< EcalADCToGeVConstant > agc
std::vector< std::vector< uint32_t > > v_DB_reco_flags_
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
void push_back(T const &t)
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: EcalRecHit.h:185
edm::ESHandle< EcalChannelStatus > chStatus
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
Definition: Electron.h:4
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
edm::ESHandle< EcalTimeCalibConstants > itime
EcalRecHit makeRecHit(const EcalUncalibratedRecHit &uncalibRH, const float &intercalibConstant, const float &timeIntercalib=0, const uint32_t &flags=0) const override
Compute parameters.
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_
void setADCToGeVConstant(const float &value) override
make rechits from dataframes
Definition: DetId.h:18
std::vector< Item >::const_iterator const_iterator
uint32_t setFlagBits(const std::vector< std::vector< uint32_t > > &map, const uint32_t &status)
edm::ESHandle< EcalTimeOffsetConstant > offtime
float EcalTimeCalibConstant
const_iterator find(uint32_t rawId) const
const_iterator end() const
edm::Timestamp time() const
Definition: EventBase.h:61
edm::ESHandle< EcalIntercalibConstants > ical
float EcalIntercalibConstant
edm::ESHandle< EcalLaserDbService > laser
void EcalRecHitWorkerSimple::set ( const edm::EventSetup es)
overridevirtual

Implements EcalRecHitWorkerBaseClass.

Definition at line 60 of file EcalRecHitWorkerSimple.cc.

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

61 {
63 
64  if (!skipTimeCalib_){
67  }
68 
69  es.get<EcalADCToGeVConstantRcd>().get(agc);
71  if ( laserCorrection_ ) es.get<EcalLaserDbRecord>().get(laser);
72 }
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
uint32_t EcalRecHitWorkerSimple::setFlagBits ( const std::vector< std::vector< uint32_t > > &  map,
const uint32_t &  status 
)
protected

Definition at line 158 of file EcalRecHitWorkerSimple.cc.

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

Referenced by run().

159  {
160 
161  for (unsigned int i = 0; i!=map.size(); ++i){
162  if (std::find(map[i].begin(), map[i].end(),status)!= map[i].end())
163  return 0x1 << i;
164  }
165 
166  return 0;
167 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30

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().

uint32_t EcalRecHitWorkerSimple::flagmask_
protected

Definition at line 56 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

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 58 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 59 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 62 of file EcalRecHitWorkerSimple.h.

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

bool EcalRecHitWorkerSimple::skipTimeCalib_
protected

Definition at line 60 of file EcalRecHitWorkerSimple.h.

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

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

Definition at line 47 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

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

Definition at line 51 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().