CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
EcalUncalibRecHitWorkerRatio Class Reference
Inheritance diagram for EcalUncalibRecHitWorkerRatio:
EcalUncalibRecHitWorkerRunOneDigiBase EcalUncalibRecHitWorkerBaseClass

Public Member Functions

 EcalUncalibRecHitWorkerRatio (const edm::ParameterSet &, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerRatio ()
 
edm::ParameterSetDescription getAlgoDescription () override
 
bool run (const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result) override
 
void set (const edm::EventSetup &es) override
 
- Public Member Functions inherited from EcalUncalibRecHitWorkerRunOneDigiBase
 EcalUncalibRecHitWorkerRunOneDigiBase (const edm::ParameterSet &p, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerRunOneDigiBase (const edm::ParameterSet &p)
 
 EcalUncalibRecHitWorkerRunOneDigiBase ()
 
void run (const edm::Event &evt, const EcalDigiCollection &digis, EcalUncalibratedRecHitCollection &result) override
 
 ~EcalUncalibRecHitWorkerRunOneDigiBase () override
 
- Public Member Functions inherited from EcalUncalibRecHitWorkerBaseClass
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &)
 
 EcalUncalibRecHitWorkerBaseClass ()
 
virtual void set (const edm::Event &evt)
 
virtual ~EcalUncalibRecHitWorkerBaseClass ()
 

Protected Attributes

std::vector< double > EBamplitudeFitParameters_
 
double EBtimeConstantTerm_
 
std::pair< double, double > EBtimeFitLimits_
 
std::vector< double > EBtimeFitParameters_
 
std::vector< double > EEamplitudeFitParameters_
 
double EEtimeConstantTerm_
 
std::pair< double, double > EEtimeFitLimits_
 
std::vector< double > EEtimeFitParameters_
 
double gainRatios [3]
 
edm::ESHandle< EcalGainRatiosgains
 
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcdgainsToken_
 
double pedRMSVec [3]
 
edm::ESHandle< EcalPedestalspeds
 
edm::ESGetToken< EcalPedestals, EcalPedestalsRcdpedsToken_
 
double pedVec [3]
 
edm::ESHandle< EcalSampleMasksampleMaskHand_
 
edm::ESGetToken< EcalSampleMask, EcalSampleMaskRcdsampleMaskToken_
 
EcalUncalibRecHitRatioMethodAlgo< EBDataFrameuncalibMaker_barrel_
 
EcalUncalibRecHitRatioMethodAlgo< EEDataFrameuncalibMaker_endcap_
 

Detailed Description

Definition at line 25 of file EcalUncalibRecHitWorkerRatio.cc.

Constructor & Destructor Documentation

◆ EcalUncalibRecHitWorkerRatio() [1/2]

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

Definition at line 67 of file EcalUncalibRecHitWorkerRatio.cc.

References HltBtagPostValidation_cff::c, EBamplitudeFitParameters_, EBtimeConstantTerm_, EBtimeFitLimits_, EBtimeFitParameters_, EEamplitudeFitParameters_, EEtimeConstantTerm_, EEtimeFitLimits_, EEtimeFitParameters_, gainsToken_, edm::ParameterSet::getParameter(), pedsToken_, and sampleMaskToken_.

69  EBtimeFitParameters_ = ps.getParameter<std::vector<double>>("EBtimeFitParameters");
70  EEtimeFitParameters_ = ps.getParameter<std::vector<double>>("EEtimeFitParameters");
71 
72  EBamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EBamplitudeFitParameters");
73  EEamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EEamplitudeFitParameters");
74 
75  EBtimeFitLimits_.first = ps.getParameter<double>("EBtimeFitLimits_Lower");
76  EBtimeFitLimits_.second = ps.getParameter<double>("EBtimeFitLimits_Upper");
77 
78  EEtimeFitLimits_.first = ps.getParameter<double>("EEtimeFitLimits_Lower");
79  EEtimeFitLimits_.second = ps.getParameter<double>("EEtimeFitLimits_Upper");
80 
81  EBtimeConstantTerm_ = ps.getParameter<double>("EBtimeConstantTerm");
82  EEtimeConstantTerm_ = ps.getParameter<double>("EEtimeConstantTerm");
83 
84  pedsToken_ = c.esConsumes<EcalPedestals, EcalPedestalsRcd>();
87 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< EcalSampleMask, EcalSampleMaskRcd > sampleMaskToken_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > gainsToken_
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedsToken_
EcalGainRatioMap EcalGainRatios
EcalPedestalsMap EcalPedestals
Definition: EcalPedestals.h:50
std::pair< double, double > EBtimeFitLimits_
std::pair< double, double > EEtimeFitLimits_

◆ EcalUncalibRecHitWorkerRatio() [2/2]

EcalUncalibRecHitWorkerRatio::EcalUncalibRecHitWorkerRatio ( )
inline

Definition at line 28 of file EcalUncalibRecHitWorkerRatio.cc.

28 {};

Member Function Documentation

◆ getAlgoDescription()

edm::ParameterSetDescription EcalUncalibRecHitWorkerRatio::getAlgoDescription ( )
overridevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 175 of file EcalUncalibRecHitWorkerRatio.cc.

References edm::ParameterSetDescription::addNode().

175  {
177  std::vector<double> dSet1 = {-2.390548, 3.553628, -17.62341, 67.67538, -133.213, 140.7432, -75.41106, 16.20277};
178  std::vector<double> dSet2 = {-2.015452, 3.130702, -12.3473, 41.88921, -82.83944, 91.01147, -50.35761, 11.05621};
179 
180  psd.addNode(edm::ParameterDescription<double>("EEtimeFitLimits_Upper", 1.4, true) and
181  edm::ParameterDescription<double>("EEtimeConstantTerm", 0.18, true) and
182  edm::ParameterDescription<double>("EBtimeFitLimits_Lower", 0.2, true) and
183  edm::ParameterDescription<double>("EBtimeConstantTerm", 0.26, true) and
184  edm::ParameterDescription<double>("EEtimeFitLimits_Lower", 0.2, true) and
185  edm::ParameterDescription<std::vector<double>>("EEtimeFitParameters", dSet1, true) and
186  edm::ParameterDescription<std::vector<double>>("EEamplitudeFitParameters", {1.89, 1.4}, true) and
187  edm::ParameterDescription<double>("EBtimeFitLimits_Upper", 1.4, true) and
188  edm::ParameterDescription<std::vector<double>>("EBamplitudeFitParameters", {1.138, 1.652}, true) and
189  edm::ParameterDescription<std::vector<double>>("EBtimeFitParameters", dSet2, true));
190 
191  return psd;
192 }
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)

◆ run()

bool EcalUncalibRecHitWorkerRatio::run ( const edm::Event evt,
const EcalDigiCollection::const_iterator digi,
EcalUncalibratedRecHitCollection result 
)
overridevirtual

Implements EcalUncalibRecHitWorkerRunOneDigiBase.

Definition at line 97 of file EcalUncalibRecHitWorkerRatio.cc.

References EBamplitudeFitParameters_, EBtimeConstantTerm_, EBtimeFitLimits_, EBtimeFitParameters_, EcalEndcap, EEamplitudeFitParameters_, EEtimeConstantTerm_, EEtimeFitLimits_, EEtimeFitParameters_, EcalUncalibRecHitRatioMethodAlgo< C >::fixMGPAslew(), EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), gainRatios, gains, EcalUncalibRecHitRatioMethodAlgo< C >::getCalculatedRecHit(), ecalpyutils::hashedIndex(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), EcalUncalibRecHitRatioMethodAlgo< C >::makeRecHit(), pedRMSVec, peds, pedVec, conifer::pow(), edm::ESHandle< T >::product(), mps_fire::result, sampleMaskHand_, EcalUncalibratedRecHit::setAmplitude(), EcalUncalibratedRecHit::setJitter(), EcalUncalibratedRecHit::setJitterError(), mathSSE::sqrt(), uncalibMaker_barrel_, and uncalibMaker_endcap_.

99  {
100  DetId detid(itdg->id());
101 
102  const EcalSampleMask* sampleMask_ = sampleMaskHand_.product();
103 
104  const EcalPedestals::Item* aped = nullptr;
105  const EcalMGPAGainRatio* aGain = nullptr;
106 
107  if (detid.subdetId() == EcalEndcap) {
108  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
109  aped = &peds->endcap(hashedIndex);
110  aGain = &gains->endcap(hashedIndex);
111  } else {
112  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
113  aped = &peds->barrel(hashedIndex);
114  aGain = &gains->barrel(hashedIndex);
115  }
116 
117  pedVec[0] = aped->mean_x12;
118  pedVec[1] = aped->mean_x6;
119  pedVec[2] = aped->mean_x1;
120  pedRMSVec[0] = aped->rms_x12;
121  pedRMSVec[1] = aped->rms_x6;
122  pedRMSVec[2] = aped->rms_x1;
123  gainRatios[0] = 1.;
124  gainRatios[1] = aGain->gain12Over6();
125  gainRatios[2] = aGain->gain6Over1() * aGain->gain12Over6();
126 
127  float clockToNsConstant = 25.;
128  EcalUncalibratedRecHit uncalibRecHit;
129 
130  if (detid.subdetId() == EcalEndcap) {
131  uncalibRecHit = uncalibMaker_endcap_.makeRecHit(*itdg,
132  *sampleMask_,
133  pedVec,
134  pedRMSVec,
135  gainRatios,
138  EEtimeFitLimits_); //GF pass mask here
139 
141  uncalibRecHit.setAmplitude(crh.amplitudeMax);
142  uncalibRecHit.setJitter(crh.timeMax - 5);
143  uncalibRecHit.setJitterError(
144  std::sqrt(pow(crh.timeError, 2) + std::pow(EEtimeConstantTerm_, 2) / std::pow(clockToNsConstant, 2)));
145 
146  } else {
147  bool gainSwitch = uncalibMaker_barrel_.fixMGPAslew(*itdg);
148 
149  uncalibRecHit = uncalibMaker_barrel_.makeRecHit(*itdg,
150  *sampleMask_,
151  pedVec,
152  pedRMSVec,
153  gainRatios,
156  EBtimeFitLimits_); //GF pass mask here
157 
159 
160  uncalibRecHit.setAmplitude(crh.amplitudeMax);
161  if (gainSwitch) {
162  // introduce additional 1ns shift
163  uncalibRecHit.setJitter(crh.timeMax - 5 - 0.04);
164  } else {
165  uncalibRecHit.setJitter(crh.timeMax - 5);
166  }
167  uncalibRecHit.setJitterError(
168  std::sqrt(pow(crh.timeError, 2) + std::pow(EBtimeConstantTerm_, 2) / std::pow(clockToNsConstant, 2)));
169  }
170  result.push_back(uncalibRecHit);
171 
172  return true;
173 }
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > uncalibMaker_barrel_
void setJitter(float jitter)
edm::ESHandle< EcalPedestals > peds
constexpr int pow(int x)
Definition: conifer.h:24
edm::ESHandle< EcalGainRatios > gains
void setJitterError(float jitterErr)
edm::ESHandle< EcalSampleMask > sampleMaskHand_
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:36
T const * product() const
Definition: ESHandle.h:86
T sqrt(T t)
Definition: SSEVec.h:19
EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const EcalSampleMask &sampleMask, const double *pedestals, const double *pedestalRMSes, const double *gainRatios, std::vector< double > &timeFitParameters, std::vector< double > &amplitudeFitParameters, std::pair< double, double > &timeFitLimits)
float gain12Over6() const
Definition: DetId.h:17
float gain6Over1() const
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > uncalibMaker_endcap_
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
std::pair< double, double > EBtimeFitLimits_
void setAmplitude(float amplitude)
int hashedIndex() const
Definition: EEDetId.h:183
std::pair< double, double > EEtimeFitLimits_

◆ set()

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

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 89 of file EcalUncalibRecHitWorkerRatio.cc.

References gains, gainsToken_, edm::EventSetup::getHandle(), peds, pedsToken_, sampleMaskHand_, and sampleMaskToken_.

89  {
90  // which of the samples need be used
92 
95 }
edm::ESHandle< EcalPedestals > peds
edm::ESGetToken< EcalSampleMask, EcalSampleMaskRcd > sampleMaskToken_
edm::ESHandle< EcalGainRatios > gains
edm::ESHandle< EcalSampleMask > sampleMaskHand_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > gainsToken_
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedsToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130

Member Data Documentation

◆ EBamplitudeFitParameters_

std::vector<double> EcalUncalibRecHitWorkerRatio::EBamplitudeFitParameters_
protected

Definition at line 54 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by EcalUncalibRecHitWorkerRatio(), and run().

◆ EBtimeConstantTerm_

double EcalUncalibRecHitWorkerRatio::EBtimeConstantTerm_
protected

Definition at line 60 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by EcalUncalibRecHitWorkerRatio(), and run().

◆ EBtimeFitLimits_

std::pair<double, double> EcalUncalibRecHitWorkerRatio::EBtimeFitLimits_
protected

Definition at line 57 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by EcalUncalibRecHitWorkerRatio(), and run().

◆ EBtimeFitParameters_

std::vector<double> EcalUncalibRecHitWorkerRatio::EBtimeFitParameters_
protected

Definition at line 51 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by EcalUncalibRecHitWorkerRatio(), and run().

◆ EEamplitudeFitParameters_

std::vector<double> EcalUncalibRecHitWorkerRatio::EEamplitudeFitParameters_
protected

Definition at line 55 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by EcalUncalibRecHitWorkerRatio(), and run().

◆ EEtimeConstantTerm_

double EcalUncalibRecHitWorkerRatio::EEtimeConstantTerm_
protected

Definition at line 61 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by EcalUncalibRecHitWorkerRatio(), and run().

◆ EEtimeFitLimits_

std::pair<double, double> EcalUncalibRecHitWorkerRatio::EEtimeFitLimits_
protected

Definition at line 58 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by EcalUncalibRecHitWorkerRatio(), and run().

◆ EEtimeFitParameters_

std::vector<double> EcalUncalibRecHitWorkerRatio::EEtimeFitParameters_
protected

Definition at line 52 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by EcalUncalibRecHitWorkerRatio(), and run().

◆ gainRatios

double EcalUncalibRecHitWorkerRatio::gainRatios[3]
protected

Definition at line 49 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by run().

◆ gains

edm::ESHandle<EcalGainRatios> EcalUncalibRecHitWorkerRatio::gains
protected

Definition at line 44 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by run(), and set().

◆ gainsToken_

edm::ESGetToken<EcalGainRatios, EcalGainRatiosRcd> EcalUncalibRecHitWorkerRatio::gainsToken_
protected

Definition at line 45 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by EcalUncalibRecHitWorkerRatio(), and set().

◆ pedRMSVec

double EcalUncalibRecHitWorkerRatio::pedRMSVec[3]
protected

Definition at line 48 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by run().

◆ peds

edm::ESHandle<EcalPedestals> EcalUncalibRecHitWorkerRatio::peds
protected

Definition at line 42 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by run(), and set().

◆ pedsToken_

edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> EcalUncalibRecHitWorkerRatio::pedsToken_
protected

Definition at line 43 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by EcalUncalibRecHitWorkerRatio(), and set().

◆ pedVec

double EcalUncalibRecHitWorkerRatio::pedVec[3]
protected

Definition at line 47 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by run().

◆ sampleMaskHand_

edm::ESHandle<EcalSampleMask> EcalUncalibRecHitWorkerRatio::sampleMaskHand_
protected

Definition at line 39 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by run(), and set().

◆ sampleMaskToken_

edm::ESGetToken<EcalSampleMask, EcalSampleMaskRcd> EcalUncalibRecHitWorkerRatio::sampleMaskToken_
protected

Definition at line 40 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by EcalUncalibRecHitWorkerRatio(), and set().

◆ uncalibMaker_barrel_

EcalUncalibRecHitRatioMethodAlgo<EBDataFrame> EcalUncalibRecHitWorkerRatio::uncalibMaker_barrel_
protected

Definition at line 63 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by run().

◆ uncalibMaker_endcap_

EcalUncalibRecHitRatioMethodAlgo<EEDataFrame> EcalUncalibRecHitWorkerRatio::uncalibMaker_endcap_
protected

Definition at line 64 of file EcalUncalibRecHitWorkerRatio.cc.

Referenced by run().