CMS 3D CMS Logo

ESRecHitWorker.cc
Go to the documentation of this file.
1 #include "ESRecHitWorker.h"
2 
9 
10 #include <cmath>
11 #include <iomanip>
12 #include <iostream>
13 
15  recoAlgo_ = ps.getParameter<int>("ESRecoAlgo");
16  esgainToken_ = cc.esConsumes<ESGain, ESGainRcd>();
24 
25  if (recoAlgo_ == 0)
26  algoW_ = new ESRecHitSimAlgo();
27  else if (recoAlgo_ == 1)
28  algoF_ = new ESRecHitFitAlgo();
29  else
31 }
32 
34  if (recoAlgo_ == 0)
35  delete algoW_;
36  else if (recoAlgo_ == 1)
37  delete algoF_;
38  else
39  delete algoA_;
40 }
41 
44  const ESGain *gain = esgain_.product();
45 
47  const ESMIPToGeVConstant *mipToGeV = esMIPToGeV_.product();
48 
49  double ESGain = gain->getESGain();
50  double ESMIPToGeV = (ESGain == 1) ? mipToGeV->getESValueLow() : mipToGeV->getESValueHigh();
51 
53  const ESTimeSampleWeights *wgts = esWeights_.product();
54 
55  float w0 = wgts->getWeightForTS0();
56  float w1 = wgts->getWeightForTS1();
57  float w2 = wgts->getWeightForTS2();
58 
60  const ESPedestals *peds = esPedestals_.product();
61 
63  const ESIntercalibConstants *mips = esMIPs_.product();
64 
66  const ESAngleCorrectionFactors *ang = esAngleCorrFactors_.product();
67 
69  const ESChannelStatus *channelStatus = esChannelStatus_.product();
70 
72  const ESRecHitRatioCuts *ratioCuts = esRatioCuts_.product();
73 
74  if (recoAlgo_ == 0) {
76  algoW_->setMIPGeV(ESMIPToGeV);
77  algoW_->setW0(w0);
78  algoW_->setW1(w1);
79  algoW_->setW2(w2);
80  algoW_->setPedestals(peds);
82  algoW_->setChannelStatus(channelStatus);
83  algoW_->setRatioCuts(ratioCuts);
85  } else if (recoAlgo_ == 1) {
87  algoF_->setMIPGeV(ESMIPToGeV);
88  algoF_->setPedestals(peds);
90  algoF_->setChannelStatus(channelStatus);
91  algoF_->setRatioCuts(ratioCuts);
93  } else {
95  algoA_->setMIPGeV(ESMIPToGeV);
96  algoA_->setPedestals(peds);
98  algoA_->setChannelStatus(channelStatus);
99  algoA_->setRatioCuts(ratioCuts);
101  }
102 }
103 
105  if (recoAlgo_ == 0)
106  result.push_back(algoW_->reconstruct(*itdg));
107  else if (recoAlgo_ == 1)
108  result.push_back(algoF_->reconstruct(*itdg));
109  else
110  result.push_back(algoA_->reconstruct(*itdg));
111  return true;
112 }
113 
void setIntercalibConstants(const ESIntercalibConstants *mips)
edm::ESHandle< ESGain > esgain_
float getWeightForTS0() const
EcalRecHit reconstruct(const ESDataFrame &digi) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
float getESValueHigh() const
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
Definition: ESGain.h:7
void setPedestals(const ESPedestals *peds)
void setRatioCuts(const ESRecHitRatioCuts *ratioCuts)
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
void setW0(float value)
EcalRecHit reconstruct(const ESDataFrame &digi) const
void setESGain(const double &value)
ESRecHitSimAlgo * algoW_
void setPedestals(const ESPedestals *peds)
ESPedestalsMap ESPedestals
Definition: ESPedestals.h:29
void setMIPGeV(float value)
void setPedestals(const ESPedestals *peds)
ESChannelStatusMap ESChannelStatus
edm::ESGetToken< ESAngleCorrectionFactors, ESAngleCorrectionFactorsRcd > esAngleCorrFactorsToken_
edm::ESHandle< ESRecHitRatioCuts > esRatioCuts_
void setW1(float value)
void setIntercalibConstants(const ESIntercalibConstants *mips)
T const * product() const
Definition: ESHandle.h:86
void setRatioCuts(const ESRecHitRatioCuts *ratioCuts)
ESRecHitFitAlgo * algoF_
ESAngleCorrectionFactorMap ESAngleCorrectionFactors
edm::ESGetToken< ESPedestals, ESPedestalsRcd > esPedestalsToken_
edm::ESGetToken< ESRecHitRatioCuts, ESRecHitRatioCutsRcd > esRatioCutsToken_
void setMIPGeV(const double &value)
edm::ESHandle< ESPedestals > esPedestals_
void setMIPGeV(const double &value)
edm::ESHandle< ESChannelStatus > esChannelStatus_
bool run(const ESDigiCollection::const_iterator &digi, ESRecHitCollection &result) override
float getWeightForTS2() const
float getESValueLow() const
EcalRecHit reconstruct(const ESDataFrame &digi) const
ESRecHitWorker(const edm::ParameterSet &ps, edm::ConsumesCollector cc)
void setRatioCuts(const ESRecHitRatioCuts *ratioCuts)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
void setESGain(float value)
edm::ESHandle< ESTimeSampleWeights > esWeights_
edm::ESHandle< ESMIPToGeVConstant > esMIPToGeV_
edm::ESHandle< ESAngleCorrectionFactors > esAngleCorrFactors_
edm::ESGetToken< ESTimeSampleWeights, ESTimeSampleWeightsRcd > esWeightsToken_
ESIntercalibConstantMap ESIntercalibConstants
void setIntercalibConstants(const ESIntercalibConstants *mips)
void setAngleCorrectionFactors(const ESAngleCorrectionFactors *ang)
void setChannelStatus(const ESChannelStatus *status)
void setAngleCorrectionFactors(const ESAngleCorrectionFactors *ang)
void setAngleCorrectionFactors(const ESAngleCorrectionFactors *ang)
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
void setW2(float value)
void setChannelStatus(const ESChannelStatus *status)
void setESGain(const double &value)
void setChannelStatus(const ESChannelStatus *status)
void set(const edm::EventSetup &es) override
#define DEFINE_EDM_PLUGIN(factory, type, name)
ESRecHitAnalyticAlgo * algoA_
edm::ESGetToken< ESGain, ESGainRcd > esgainToken_
edm::ESHandle< ESIntercalibConstants > esMIPs_
~ESRecHitWorker() override
edm::ESGetToken< ESMIPToGeVConstant, ESMIPToGeVConstantRcd > esMIPToGeVToken_
float getWeightForTS1() const
edm::ESGetToken< ESChannelStatus, ESChannelStatusRcd > esChannelStatusToken_
edm::ESGetToken< ESIntercalibConstants, ESIntercalibConstantsRcd > esMIPsToken_