CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
SimpleHBHEPhase1Algo Class Reference

#include <SimpleHBHEPhase1Algo.h>

Inheritance diagram for SimpleHBHEPhase1Algo:
AbsHBHEPhase1Algo

Public Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void endRun () override
 
int getFirstSampleShift () const
 
float getPhaseNS () const
 
int getRunNumber () const
 
int getSamplesToAdd () const
 
float getTimeShift () const
 
virtual bool isConfigurable () const override
 
bool isCorrectingForPhaseContainment () const
 
virtual HBHERecHit reconstruct (const HBHEChannelInfo &info, const HcalRecoParam *params, const HcalCalibrations &calibs, bool isRealData) override
 
 SimpleHBHEPhase1Algo (int firstSampleShift, int samplesToAdd, float phaseNS, float timeShift, bool correctForPhaseContainment, std::unique_ptr< PulseShapeFitOOTPileupCorrection > m2, std::unique_ptr< HcalDeterministicFit > detFit)
 
virtual ~SimpleHBHEPhase1Algo ()
 
- Public Member Functions inherited from AbsHBHEPhase1Algo
virtual bool configure (const AbsHcalAlgoData *)
 
virtual ~AbsHBHEPhase1Algo ()
 

Protected Member Functions

float hbminusCorrectionFactor (const HcalDetId &cell, float energy, bool isRealData) const
 
float m0Energy (const HBHEChannelInfo &info, double reconstructedCharge, bool applyContainmentCorrection, double phaseNS, int nSamplesToAdd)
 
float m0Time (const HBHEChannelInfo &info, double reconstructedCharge, const HcalCalibrations &calibs, int nSamplesToExamine) const
 

Private Attributes

bool corrFPC_
 
int firstSampleShift_
 
std::unique_ptr< HcalDeterministicFithltOOTpuCorr_
 
float phaseNS_
 
std::unique_ptr< PulseShapeFitOOTPileupCorrectionpsFitOOTpuCorr_
 
HcalPulseContainmentManager pulseCorr_
 
int runnum_
 
int samplesToAdd_
 
HcalPulseShapes theHcalPulseShapes_
 
float timeShift_
 

Detailed Description

Definition at line 17 of file SimpleHBHEPhase1Algo.h.

Constructor & Destructor Documentation

SimpleHBHEPhase1Algo::SimpleHBHEPhase1Algo ( int  firstSampleShift,
int  samplesToAdd,
float  phaseNS,
float  timeShift,
bool  correctForPhaseContainment,
std::unique_ptr< PulseShapeFitOOTPileupCorrection m2,
std::unique_ptr< HcalDeterministicFit detFit 
)

Definition at line 18 of file SimpleHBHEPhase1Algo.cc.

29  phaseNS_(phaseNS),
31  runnum_(0),
34  hltOOTpuCorr_(std::move(detFit))
35 {
36 }
std::unique_ptr< HcalDeterministicFit > hltOOTpuCorr_
float PulseContainmentFractionalError
HcalPulseContainmentManager pulseCorr_
std::unique_ptr< PulseShapeFitOOTPileupCorrection > psFitOOTpuCorr_
def move(src, dest)
Definition: eostools.py:510
virtual SimpleHBHEPhase1Algo::~SimpleHBHEPhase1Algo ( )
inlinevirtual

Definition at line 50 of file SimpleHBHEPhase1Algo.h.

References beginRun(), and endRun().

50 {}

Member Function Documentation

void SimpleHBHEPhase1Algo::beginRun ( const edm::Run r,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from AbsHBHEPhase1Algo.

Definition at line 38 of file SimpleHBHEPhase1Algo.cc.

References HcalPulseContainmentManager::beginRun(), pulseCorr_, edm::RunBase::run(), and runnum_.

Referenced by ~SimpleHBHEPhase1Algo().

40 {
41  runnum_ = r.run();
42  pulseCorr_.beginRun(es);
43 }
RunNumber_t run() const
Definition: RunBase.h:40
HcalPulseContainmentManager pulseCorr_
void beginRun(edm::EventSetup const &es)
void SimpleHBHEPhase1Algo::endRun ( )
overridevirtual

Reimplemented from AbsHBHEPhase1Algo.

Definition at line 45 of file SimpleHBHEPhase1Algo.cc.

References HcalPulseContainmentManager::endRun(), pulseCorr_, and runnum_.

Referenced by ~SimpleHBHEPhase1Algo().

int SimpleHBHEPhase1Algo::getFirstSampleShift ( ) const
inline

Definition at line 63 of file SimpleHBHEPhase1Algo.h.

References firstSampleShift_.

float SimpleHBHEPhase1Algo::getPhaseNS ( ) const
inline

Definition at line 65 of file SimpleHBHEPhase1Algo.h.

References phaseNS_.

65 {return phaseNS_;}
int SimpleHBHEPhase1Algo::getRunNumber ( ) const
inline

Definition at line 68 of file SimpleHBHEPhase1Algo.h.

References hbminusCorrectionFactor(), m0Energy(), m0Time(), and runnum_.

int SimpleHBHEPhase1Algo::getSamplesToAdd ( ) const
inline

Definition at line 64 of file SimpleHBHEPhase1Algo.h.

References samplesToAdd_.

float SimpleHBHEPhase1Algo::getTimeShift ( ) const
inline

Definition at line 66 of file SimpleHBHEPhase1Algo.h.

References timeShift_.

float SimpleHBHEPhase1Algo::hbminusCorrectionFactor ( const HcalDetId cell,
float  energy,
bool  isRealData 
) const
protected

Definition at line 130 of file SimpleHBHEPhase1Algo.cc.

References corr, hbminus_special_ecorr(), HcalBarrel, HcalDetId::ieta(), HcalDetId::iphi(), runnum_, and HcalDetId::subdet().

Referenced by getRunNumber(), and reconstruct().

133 {
134  float corr = 1.f;
135  if (isRealData && runnum_ > 0)
136  if (cell.subdet() == HcalBarrel)
137  {
138  const int ieta = cell.ieta();
139  const int iphi = cell.iphi();
140  corr = hbminus_special_ecorr(ieta, iphi, energy, runnum_);
141  }
142  return corr;
143 }
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
float hbminus_special_ecorr(int ieta, int iphi, double energy, int runnum)
Special energy correction for some HB- cells.
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
JetCorrectorParameters corr
Definition: classes.h:5
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:103
virtual bool SimpleHBHEPhase1Algo::isConfigurable ( ) const
inlineoverridevirtual

Implements AbsHBHEPhase1Algo.

Definition at line 56 of file SimpleHBHEPhase1Algo.h.

References info(), and reconstruct().

56 {return false;}
bool SimpleHBHEPhase1Algo::isCorrectingForPhaseContainment ( ) const
inline

Definition at line 67 of file SimpleHBHEPhase1Algo.h.

References corrFPC_.

float SimpleHBHEPhase1Algo::m0Energy ( const HBHEChannelInfo info,
double  reconstructedCharge,
bool  applyContainmentCorrection,
double  phaseNS,
int  nSamplesToAdd 
)
protected

Definition at line 145 of file SimpleHBHEPhase1Algo.cc.

References MillePedeFileConverter_cfg::e, HBHEChannelInfo::energyInWindow(), firstSampleShift_, HcalPulseContainmentManager::get(), HBHEChannelInfo::id(), pulseCorr_, and HBHEChannelInfo::soi().

Referenced by getRunNumber(), and reconstruct().

150 {
151  int ibeg = static_cast<int>(info.soi()) + firstSampleShift_;
152  if (ibeg < 0)
153  ibeg = 0;
154  double e = info.energyInWindow(ibeg, ibeg + nSamplesToAdd);
155 
156  // Pulse containment correction
157  {
158  double corrFactor = 1.0;
159  if (applyContainmentCorrection)
160  corrFactor = pulseCorr_.get(info.id(), nSamplesToAdd, phaseNs)->getCorrection(fc_ampl);
161  e *= corrFactor;
162  }
163 
164  return e;
165 }
const HcalPulseContainmentCorrection * get(const HcalDetId &detId, int toAdd, float fixedphase_ns)
unsigned soi() const
HcalPulseContainmentManager pulseCorr_
HcalDetId id() const
double energyInWindow(const unsigned begin, const unsigned end) const
float SimpleHBHEPhase1Algo::m0Time ( const HBHEChannelInfo info,
double  reconstructedCharge,
const HcalCalibrations calibs,
int  nSamplesToExamine 
) const
protected

Definition at line 167 of file SimpleHBHEPhase1Algo.cc.

References HcalTimeSlew::delay(), f, firstSampleShift_, hpstanc_transforms::max, findQualityFiles::maxI, HBHEChannelInfo::MAXSAMPLES, HcalTimeSlew::Medium, hgc_digi::nSamples, HBHEChannelInfo::nSamples(), HBHEChannelInfo::peakEnergyTS(), HBHEChannelInfo::soi(), cscNeutronWriter_cfi::t0, reco::t2, ntuplemaker::time, HcalCalibrations::timecorr(), timeshift_ns_hbheho(), HBHEChannelInfo::tsEnergy(), and mitigatedMETSequence_cff::U.

Referenced by getRunNumber(), and reconstruct().

171 {
172  float time = -9999.f; // historic value
173 
174  const unsigned nSamples = info.nSamples();
175  if (nSamples > 2U)
176  {
177  const int soi = info.soi();
178  int ibeg = soi + firstSampleShift_;
179  if (ibeg < 0)
180  ibeg = 0;
181  const int iend = ibeg + nSamplesToExamine;
182  unsigned maxI = info.peakEnergyTS(ibeg, iend);
183  if (maxI < HBHEChannelInfo::MAXSAMPLES)
184  {
185  if (!maxI)
186  maxI = 1U;
187  else if (maxI >= nSamples - 1U)
188  maxI = nSamples - 2U;
189 
190  // The remaining code in this scope emulates
191  // the historic algorithm
192  float t0 = info.tsEnergy(maxI - 1U);
193  float maxA = info.tsEnergy(maxI);
194  float t2 = info.tsEnergy(maxI + 1U);
195 
196  // Handle negative excursions by moving "zero"
197  float minA = t0;
198  if (maxA < minA) minA = maxA;
199  if (t2 < minA) minA=t2;
200  if (minA < 0.f) { maxA-=minA; t0-=minA; t2-=minA; }
201  float wpksamp = (t0 + maxA + t2);
202  if (wpksamp) wpksamp = (maxA + 2.f*t2) / wpksamp;
203  time = (maxI - soi)*25.f + timeshift_ns_hbheho(wpksamp);
204 
205  // Legacy QIE8 timing correction
206  time -= HcalTimeSlew::delay(std::max(1.0, fc_ampl),
208  // Time calibration
209  time -= calibs.timecorr();
210  }
211  }
212  return time;
213 }
float timeshift_ns_hbheho(float wpksamp)
unsigned soi() const
static const unsigned MAXSAMPLES
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:16
double f[11][100]
constexpr size_t nSamples
double tsEnergy(const unsigned ts) const
double timecorr() const
get time correction factor
unsigned nSamples() const
unsigned peakEnergyTS(const unsigned begin, const unsigned end) const
static double delay(double fC, BiasSetting bias=Medium)
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
Definition: HcalTimeSlew.cc:16
HBHERecHit SimpleHBHEPhase1Algo::reconstruct ( const HBHEChannelInfo info,
const HcalRecoParam params,
const HcalCalibrations calibs,
bool  isRealData 
)
overridevirtual

Implements AbsHBHEPhase1Algo.

Definition at line 51 of file SimpleHBHEPhase1Algo.cc.

References HBHEChannelInfo::chargeInWindow(), HiEvtPlane_cfi::chi2, HcalRecoParam::correctForPhaseContainment(), HcalRecoParam::correctionPhaseNS(), corrFPC_, firstSampleShift_, HcalPulseShapes::getShape(), HBHEChannelInfo::hasTimeInfo(), HcalPhase1FlagLabels::HBHEPulseFitBit, hbminusCorrectionFactor(), hltOOTpuCorr_, HBHEChannelInfo::id(), HcalSpecialTimes::isSpecial(), m0Energy(), m0Time(), HcalDeterministicFit::phase1Apply(), PulseShapeFitOOTPileupCorrection::phase1Apply(), phaseNS_, psFitOOTpuCorr_, HBHEChannelInfo::recoShape(), HcalRecoParam::samplesToAdd(), samplesToAdd_, HBHERecHitAuxSetter::setAux(), HBHERecHit::setAuxEnergy(), HBHERecHit::setChiSquared(), CaloRecHit::setFlagField(), HBHERecHit::setRawEnergy(), HBHEChannelInfo::soi(), HBHEChannelInfo::soiRiseTime(), theHcalPulseShapes_, and timeShift_.

Referenced by isConfigurable().

55 {
56  HBHERecHit rh;
57 
58  const HcalDetId channelId(info.id());
59 
60  // Calculate "Method 0" quantities
61  float m0t = 0.f, m0E = 0.f;
62  {
63  int ibeg = static_cast<int>(info.soi()) + firstSampleShift_;
64  if (ibeg < 0)
65  ibeg = 0;
66  const int nSamplesToAdd = params ? params->samplesToAdd() : samplesToAdd_;
67  const double fc_ampl = info.chargeInWindow(ibeg, ibeg + nSamplesToAdd);
68  const bool applyContainment = params ? params->correctForPhaseContainment() : corrFPC_;
69  const float phasens = params ? params->correctionPhaseNS() : phaseNS_;
70  m0E = m0Energy(info, fc_ampl, applyContainment, phasens, nSamplesToAdd);
71  m0E *= hbminusCorrectionFactor(channelId, m0E, isData);
72  m0t = m0Time(info, fc_ampl, calibs, nSamplesToAdd);
73  }
74 
75  // Run "Method 2"
76  float m2t = 0.f, m2E = 0.f, chi2 = -1.f;
77  bool useTriple = false;
79  if (method2)
80  {
81  psFitOOTpuCorr_->setPulseShapeTemplate(theHcalPulseShapes_.getShape(info.recoShape()),
82  !info.hasTimeInfo());
83  // "phase1Apply" call below sets m2E, m2t, useTriple, and chi2.
84  // These parameters are pased by non-const reference.
85  method2->phase1Apply(info, m2E, m2t, useTriple, chi2);
86  m2E *= hbminusCorrectionFactor(channelId, m2E, isData);
87  }
88 
89  // Run "Method 3"
90  float m3t = 0.f, m3E = 0.f;
91  const HcalDeterministicFit* method3 = hltOOTpuCorr_.get();
92  if (method3)
93  {
94  // "phase1Apply" sets m3E and m3t (pased by non-const reference)
95  method3->phase1Apply(info, m3E, m3t);
96  m3E *= hbminusCorrectionFactor(channelId, m3E, isData);
97  }
98 
99  // Finally, construct the rechit
100  float rhE = m0E;
101  float rht = m0t;
102  if (method2)
103  {
104  rhE = m2E;
105  rht = m2t;
106  }
107  else if (method3)
108  {
109  rhE = m3E;
110  rht = m3t;
111  }
112  float tdcTime = info.soiRiseTime();
113  if (!HcalSpecialTimes::isSpecial(tdcTime))
114  tdcTime += timeShift_;
115  rh = HBHERecHit(channelId, rhE, rht, tdcTime);
116  rh.setRawEnergy(m0E);
117  rh.setAuxEnergy(m3E);
118  rh.setChiSquared(chi2);
119 
120  // Set rechit aux words
121  HBHERecHitAuxSetter::setAux(info, &rh);
122 
123  // Set some rechit flags (here, for Method 2)
124  if (useTriple)
126 
127  return rh;
128 }
const Shape & getShape(int shapeType) const
bool hasTimeInfo() const
std::unique_ptr< HcalDeterministicFit > hltOOTpuCorr_
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &reconstructedTime) const
bool correctForPhaseContainment() const
Definition: HcalRecoParam.h:29
void setFlagField(uint32_t value, int base, int width=1)
Definition: CaloRecHit.cc:20
unsigned soi() const
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &reconstructedTime, bool &useTriple, float &chi2) const
HcalDetId id() const
bool isSpecial(const float t)
float m0Time(const HBHEChannelInfo &info, double reconstructedCharge, const HcalCalibrations &calibs, int nSamplesToExamine) const
float soiRiseTime() const
double chargeInWindow(const unsigned begin, const unsigned end) const
int recoShape() const
unsigned int samplesToAdd() const
Definition: HcalRecoParam.h:33
float hbminusCorrectionFactor(const HcalDetId &cell, float energy, bool isRealData) const
float correctionPhaseNS() const
Definition: HcalRecoParam.h:31
HcalPulseShapes theHcalPulseShapes_
float m0Energy(const HBHEChannelInfo &info, double reconstructedCharge, bool applyContainmentCorrection, double phaseNS, int nSamplesToAdd)
static void setAux(const HBHEChannelInfo &info, HBHERecHit *rechit)
void setAuxEnergy(const float en)
Definition: HBHERecHit.h:33
void setChiSquared(const float chi2)
Definition: HBHERecHit.h:27
std::unique_ptr< PulseShapeFitOOTPileupCorrection > psFitOOTpuCorr_
void setRawEnergy(const float en)
Definition: HBHERecHit.h:30

Member Data Documentation

bool SimpleHBHEPhase1Algo::corrFPC_
private

Definition at line 96 of file SimpleHBHEPhase1Algo.h.

Referenced by isCorrectingForPhaseContainment(), and reconstruct().

int SimpleHBHEPhase1Algo::firstSampleShift_
private

Definition at line 91 of file SimpleHBHEPhase1Algo.h.

Referenced by getFirstSampleShift(), m0Energy(), m0Time(), and reconstruct().

std::unique_ptr<HcalDeterministicFit> SimpleHBHEPhase1Algo::hltOOTpuCorr_
private

Definition at line 102 of file SimpleHBHEPhase1Algo.h.

Referenced by reconstruct().

float SimpleHBHEPhase1Algo::phaseNS_
private

Definition at line 93 of file SimpleHBHEPhase1Algo.h.

Referenced by getPhaseNS(), and reconstruct().

std::unique_ptr<PulseShapeFitOOTPileupCorrection> SimpleHBHEPhase1Algo::psFitOOTpuCorr_
private

Definition at line 99 of file SimpleHBHEPhase1Algo.h.

Referenced by reconstruct().

HcalPulseContainmentManager SimpleHBHEPhase1Algo::pulseCorr_
private

Definition at line 89 of file SimpleHBHEPhase1Algo.h.

Referenced by beginRun(), endRun(), and m0Energy().

int SimpleHBHEPhase1Algo::runnum_
private

Definition at line 95 of file SimpleHBHEPhase1Algo.h.

Referenced by beginRun(), endRun(), getRunNumber(), and hbminusCorrectionFactor().

int SimpleHBHEPhase1Algo::samplesToAdd_
private

Definition at line 92 of file SimpleHBHEPhase1Algo.h.

Referenced by getSamplesToAdd(), and reconstruct().

HcalPulseShapes SimpleHBHEPhase1Algo::theHcalPulseShapes_
private

Definition at line 104 of file SimpleHBHEPhase1Algo.h.

Referenced by reconstruct().

float SimpleHBHEPhase1Algo::timeShift_
private

Definition at line 94 of file SimpleHBHEPhase1Algo.h.

Referenced by getTimeShift(), and reconstruct().