CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ESRecHitWorker.cc
Go to the documentation of this file.
2 
17 
18 #include <cmath>
19 #include <iomanip>
20 #include <iostream>
21 
24 {
25  recoAlgo_ = ps.getParameter<int>("ESRecoAlgo");
26 
27  if (recoAlgo_ == 0)
28  algoW_ = new ESRecHitSimAlgo();
29  else if (recoAlgo_ == 1)
30  algoF_ = new ESRecHitFitAlgo();
31  else
33 }
34 
36  if (recoAlgo_ == 0)
37  delete algoW_;
38  else if (recoAlgo_ == 1)
39  delete algoF_;
40  else
41  delete algoA_;
42 }
43 
45 
46  es.get<ESGainRcd>().get(esgain_);
47  const ESGain *gain = esgain_.product();
48 
50  const ESMIPToGeVConstant *mipToGeV = esMIPToGeV_.product();
51 
52  double ESGain = gain->getESGain();
53  double ESMIPToGeV = (ESGain == 1) ? mipToGeV->getESValueLow() : mipToGeV->getESValueHigh();
54 
56  const ESTimeSampleWeights *wgts = esWeights_.product();
57 
58  float w0 = wgts->getWeightForTS0();
59  float w1 = wgts->getWeightForTS1();
60  float w2 = wgts->getWeightForTS2();
61 
62  es.get<ESPedestalsRcd>().get(esPedestals_);
63  const ESPedestals *peds = esPedestals_.product();
64 
66  const ESIntercalibConstants *mips = esMIPs_.product();
67 
69  const ESAngleCorrectionFactors *ang = esAngleCorrFactors_.product();
70 
72  const ESChannelStatus *channelStatus = esChannelStatus_.product();
73 
75  const ESRecHitRatioCuts *ratioCuts = esRatioCuts_.product();
76 
77  if (recoAlgo_ == 0) {
78  algoW_->setESGain(ESGain);
79  algoW_->setMIPGeV(ESMIPToGeV);
80  algoW_->setW0(w0);
81  algoW_->setW1(w1);
82  algoW_->setW2(w2);
83  algoW_->setPedestals(peds);
85  algoW_->setChannelStatus(channelStatus);
86  algoW_->setRatioCuts(ratioCuts);
88  } else if (recoAlgo_ == 1) {
89  algoF_->setESGain(ESGain);
90  algoF_->setMIPGeV(ESMIPToGeV);
91  algoF_->setPedestals(peds);
93  algoF_->setChannelStatus(channelStatus);
94  algoF_->setRatioCuts(ratioCuts);
96  } else {
97  algoA_->setESGain(ESGain);
98  algoA_->setMIPGeV(ESMIPToGeV);
99  algoA_->setPedestals(peds);
101  algoA_->setChannelStatus(channelStatus);
102  algoA_->setRatioCuts(ratioCuts);
104  }
105 }
106 
107 bool
109  const ESDigiCollection::const_iterator & itdg,
111 {
112  if (recoAlgo_ == 0)
113  result.push_back( algoW_->reconstruct(*itdg) );
114  else if (recoAlgo_ == 1)
115  result.push_back( algoF_->reconstruct(*itdg) );
116  else
117  result.push_back( algoA_->reconstruct(*itdg) );
118  return true;
119 }
120 
T getParameter(std::string const &) const
void setIntercalibConstants(const ESIntercalibConstants *mips)
edm::ESHandle< ESGain > esgain_
ESRecHitWorker(const edm::ParameterSet &ps)
bool run(const edm::Event &evt, const ESDigiCollection::const_iterator &digi, ESRecHitCollection &result)
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
EcalRecHit reconstruct(const ESDataFrame &digi) const
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
Definition: ESGain.h:5
void setPedestals(const ESPedestals *peds)
void setRatioCuts(const ESRecHitRatioCuts *ratioCuts)
float getWeightForTS1() const
float getESValueLow() const
void push_back(T const &t)
void setW1(const double &value)
void setESGain(const double &value)
ESRecHitSimAlgo * algoW_
void setPedestals(const ESPedestals *peds)
void setW0(const double &value)
void setPedestals(const ESPedestals *peds)
edm::ESHandle< ESRecHitRatioCuts > esRatioCuts_
void setIntercalibConstants(const ESIntercalibConstants *mips)
float getWeightForTS2() const
void setRatioCuts(const ESRecHitRatioCuts *ratioCuts)
void set(const edm::EventSetup &es)
ESRecHitFitAlgo * algoF_
void setW2(const double &value)
float getWeightForTS0() const
tuple result
Definition: query.py:137
EcalRecHit reconstruct(const ESDataFrame &digi) const
void setMIPGeV(const double &value)
edm::ESHandle< ESPedestals > esPedestals_
void setMIPGeV(const double &value)
edm::ESHandle< ESChannelStatus > esChannelStatus_
void setRatioCuts(const ESRecHitRatioCuts *ratioCuts)
edm::ESHandle< ESTimeSampleWeights > esWeights_
void setESGain(const double &value)
edm::ESHandle< ESMIPToGeVConstant > esMIPToGeV_
edm::ESHandle< ESAngleCorrectionFactors > esAngleCorrFactors_
EcalRecHit reconstruct(const ESDataFrame &digi) const
float getESGain() const
Definition: ESGain.h:11
void setIntercalibConstants(const ESIntercalibConstants *mips)
void setAngleCorrectionFactors(const ESAngleCorrectionFactors *ang)
const T & get() const
Definition: EventSetup.h:55
void setChannelStatus(const ESChannelStatus *status)
T const * product() const
Definition: ESHandle.h:62
void setAngleCorrectionFactors(const ESAngleCorrectionFactors *ang)
void setAngleCorrectionFactors(const ESAngleCorrectionFactors *ang)
void setMIPGeV(const double &value)
void setChannelStatus(const ESChannelStatus *status)
void setESGain(const double &value)
void setChannelStatus(const ESChannelStatus *status)
#define DEFINE_EDM_PLUGIN(factory, type, name)
ESRecHitAnalyticAlgo * algoA_
edm::ESHandle< ESIntercalibConstants > esMIPs_
float getESValueHigh() const