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 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 Member Functions

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

Protected Attributes

edm::ESHandle
< EcalADCToGeVConstant
agc
 
edm::ESHandle< EcalChannelStatuschStatus
 
double EBLaserMAX_
 
double EBLaserMIN_
 
double EELaserMAX_
 
double EELaserMIN_
 
uint32_t flagmask_
 
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< 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(), i, j, EcalRecHit::kDead, killDeadChannels_, EcalRecHit::kKilled, EcalRecHit::kL1SpikeFlag, EcalRecHit::kNeighboursRecovered, EcalRecHit::kTowerRecovered, EcalRecHit::kTPSaturated, laserCorrection_, AlCaHLTBitMon_ParallelJobs::p, rechitMaker_, 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 
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)
36  StringToEnumValue<EcalRecHit::Flags>(recoflagbitsStrings[i]);
37  std::vector<std::string> dbstatus_s =
38  p.getParameter<std::vector<std::string> >(recoflagbitsStrings[i]);
39  std::vector<uint32_t> dbstatuses;
40  for (unsigned int j=0; j!= dbstatus_s.size(); ++j){
42  StringToEnumValue<EcalChannelStatusCode::Code>(dbstatus_s[j]);
43  dbstatuses.push_back(dbstatus);
44  }
45 
46  v_DB_reco_flags_[recoflagbit]=dbstatuses;
47  }
48 
49  flagmask_=0;
56 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< std::vector< uint32_t > > v_DB_reco_flags_
EcalRecHitWorkerBaseClass(const edm::ParameterSet &, edm::ConsumesCollector &c)
int j
Definition: DBlmapReader.cc:9
EcalRecHitSimpleAlgo * rechitMaker_
std::vector< int > v_chstatus_
EcalRecHitWorkerSimple::EcalRecHitWorkerSimple ( const edm::ParameterSet )
EcalRecHitWorkerSimple::~EcalRecHitWorkerSimple ( )
virtual

Definition at line 161 of file EcalRecHitWorkerSimple.cc.

References rechitMaker_.

161  {
162 
163  delete rechitMaker_;
164 }
EcalRecHitSimpleAlgo * rechitMaker_

Member Function Documentation

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

Implements EcalRecHitWorkerBaseClass.

Definition at line 71 of file EcalRecHitWorkerSimple.cc.

References agc, chStatus, cond::rpcobgas::detid, EBLaserMAX_, EcalBarrel, EcalEndcap, EELaserMAX_, EcalCondObjectContainer< T >::end(), spr::find(), EcalCondObjectContainer< T >::find(), flagmask_, 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(), DetId::subdetId(), edm::EventBase::time(), v_chstatus_, and v_DB_reco_flags_.

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

Implements EcalRecHitWorkerBaseClass.

Definition at line 59 of file EcalRecHitWorkerSimple.cc.

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

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

60 {
64  es.get<EcalADCToGeVConstantRcd>().get(agc);
66  if ( laserCorrection_ ) es.get<EcalLaserDbRecord>().get(laser);
67 }
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 149 of file EcalRecHitWorkerSimple.cc.

References begin, end, spr::find(), i, and python.multivaluedict::map().

Referenced by run().

150  {
151 
152  for (unsigned int i = 0; i!=map.size(); ++i){
153  if (std::find(map[i].begin(), map[i].end(),status)!= map[i].end())
154  return 0x1 << i;
155  }
156 
157  return 0;
158 }
int i
Definition: DBlmapReader.cc:9
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
tuple status
Definition: ntuplemaker.py:245

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 61 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<std::vector<uint32_t> > EcalRecHitWorkerSimple::v_DB_reco_flags_
protected

Definition at line 51 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().