CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes
SimpleHBHEPhase1Algo Class Reference

#include <SimpleHBHEPhase1Algo.h>

Inheritance diagram for SimpleHBHEPhase1Algo:
AbsHBHEPhase1Algo

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endRun () override
 
int getFirstSampleShift () const
 
float getPhaseNS () const
 
int getRunNumber () const
 
int getSamplesToAdd () const
 
float getTimeShift () const
 
bool isConfigurable () const override
 
bool isCorrectingForPhaseContainment () const
 
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, bool applyLegacyHBMCorrection, bool applyFixPCC, std::unique_ptr< PulseShapeFitOOTPileupCorrection > m2, std::unique_ptr< HcalDeterministicFit > detFit, std::unique_ptr< MahiFit > mahi, edm::ConsumesCollector iC)
 
 ~SimpleHBHEPhase1Algo () override
 
- Public Member Functions inherited from AbsHBHEPhase1Algo
virtual bool configure (const AbsHcalAlgoData *)
 
virtual ~AbsHBHEPhase1Algo ()
 

Public Attributes

edm::ESGetToken< HcalTimeSlew,
HcalTimeSlewRecord
delayToken_
 
const HcalTimeSlewhcalTimeSlew_delay_
 

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, int nSamplesToExamine) const
 

Private Attributes

bool applyLegacyHBMCorrection_
 
bool corrFPC_
 
int firstSampleShift_
 
std::unique_ptr
< HcalDeterministicFit
hltOOTpuCorr_
 
std::unique_ptr< MahiFitmahiOOTpuCorr_
 
float phaseNS_
 
std::unique_ptr
< PulseShapeFitOOTPileupCorrection
psFitOOTpuCorr_
 
HcalPulseContainmentManager pulseCorr_
 
int runnum_
 
int samplesToAdd_
 
HcalPulseShapes theHcalPulseShapes_
 
float timeShift_
 

Detailed Description

Definition at line 18 of file SimpleHBHEPhase1Algo.h.

Constructor & Destructor Documentation

SimpleHBHEPhase1Algo::SimpleHBHEPhase1Algo ( int  firstSampleShift,
int  samplesToAdd,
float  phaseNS,
float  timeShift,
bool  correctForPhaseContainment,
bool  applyLegacyHBMCorrection,
bool  applyFixPCC,
std::unique_ptr< PulseShapeFitOOTPileupCorrection m2,
std::unique_ptr< HcalDeterministicFit detFit,
std::unique_ptr< MahiFit mahi,
edm::ConsumesCollector  iC 
)

Definition at line 22 of file SimpleHBHEPhase1Algo.cc.

References hcalTimeSlew_delay_.

34  pulseCorr_(PulseContainmentFractionalError, applyFixPCC, iC),
35  firstSampleShift_(firstSampleShift),
37  phaseNS_(phaseNS),
38  timeShift_(timeShift),
39  runnum_(0),
41  applyLegacyHBMCorrection_(applyLegacyHBMCorrection),
43  hltOOTpuCorr_(std::move(detFit)),
44  mahiOOTpuCorr_(std::move(mahi)) {
45  hcalTimeSlew_delay_ = nullptr;
46 }
const HcalTimeSlew * hcalTimeSlew_delay_
std::unique_ptr< HcalDeterministicFit > hltOOTpuCorr_
HcalPulseContainmentManager pulseCorr_
edm::ESGetToken< HcalTimeSlew, HcalTimeSlewRecord > delayToken_
tuple m2
Definition: callgraph.py:57
def move
Definition: eostools.py:511
std::unique_ptr< MahiFit > mahiOOTpuCorr_
std::unique_ptr< PulseShapeFitOOTPileupCorrection > psFitOOTpuCorr_
SimpleHBHEPhase1Algo::~SimpleHBHEPhase1Algo ( )
inlineoverride

Definition at line 54 of file SimpleHBHEPhase1Algo.h.

54 {}

Member Function Documentation

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

Reimplemented from AbsHBHEPhase1Algo.

Definition at line 48 of file SimpleHBHEPhase1Algo.cc.

References HcalPulseContainmentManager::beginRun(), delayToken_, edm::EventSetup::getData(), hcalTimeSlew_delay_, pulseCorr_, edm::RunBase::run(), and runnum_.

48  {
50 
51  runnum_ = r.run();
52  pulseCorr_.beginRun(es);
53 }
const HcalTimeSlew * hcalTimeSlew_delay_
RunNumber_t run() const
Definition: RunBase.h:40
HcalPulseContainmentManager pulseCorr_
edm::ESGetToken< HcalTimeSlew, HcalTimeSlewRecord > delayToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
void beginRun(edm::EventSetup const &es)
void SimpleHBHEPhase1Algo::endRun ( )
overridevirtual

Reimplemented from AbsHBHEPhase1Algo.

Definition at line 55 of file SimpleHBHEPhase1Algo.cc.

References runnum_.

int SimpleHBHEPhase1Algo::getFirstSampleShift ( ) const
inline

Definition at line 67 of file SimpleHBHEPhase1Algo.h.

References firstSampleShift_.

float SimpleHBHEPhase1Algo::getPhaseNS ( ) const
inline

Definition at line 69 of file SimpleHBHEPhase1Algo.h.

References phaseNS_.

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

Definition at line 72 of file SimpleHBHEPhase1Algo.h.

References runnum_.

72 { return runnum_; }
int SimpleHBHEPhase1Algo::getSamplesToAdd ( ) const
inline

Definition at line 68 of file SimpleHBHEPhase1Algo.h.

References samplesToAdd_.

float SimpleHBHEPhase1Algo::getTimeShift ( ) const
inline

Definition at line 70 of file SimpleHBHEPhase1Algo.h.

References timeShift_.

70 { return timeShift_; }
float SimpleHBHEPhase1Algo::hbminusCorrectionFactor ( const HcalDetId cell,
float  energy,
bool  isRealData 
) const
protected

Definition at line 155 of file SimpleHBHEPhase1Algo.cc.

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

Referenced by reconstruct().

157  {
158  float corr = 1.f;
159  if (applyLegacyHBMCorrection_ && isRealData && runnum_ > 0)
160  if (cell.subdet() == HcalBarrel) {
161  const int ieta = cell.ieta();
162  const int iphi = cell.iphi();
163  corr = hbminus_special_ecorr(ieta, iphi, energy, runnum_);
164  }
165  return corr;
166 }
float hbminus_special_ecorr(int ieta, int iphi, double energy, int runnum)
Special energy correction for some HB- cells.
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
bool SimpleHBHEPhase1Algo::isConfigurable ( ) const
inlineoverridevirtual

Implements AbsHBHEPhase1Algo.

Definition at line 60 of file SimpleHBHEPhase1Algo.h.

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

Definition at line 71 of file SimpleHBHEPhase1Algo.h.

References corrFPC_.

71 { return corrFPC_; }
float SimpleHBHEPhase1Algo::m0Energy ( const HBHEChannelInfo info,
double  reconstructedCharge,
bool  applyContainmentCorrection,
double  phaseNS,
int  nSamplesToAdd 
)
protected

Definition at line 168 of file SimpleHBHEPhase1Algo.cc.

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

Referenced by reconstruct().

172  {
173  int ibeg = static_cast<int>(info.soi()) + firstSampleShift_;
174  if (ibeg < 0)
175  ibeg = 0;
176  double e = info.energyInWindow(ibeg, ibeg + nSamplesToAdd);
177 
178  // Pulse containment correction
179  {
180  double corrFactor = 1.0;
181  if (applyContainmentCorrection)
182  corrFactor = pulseCorr_.get(info.id(), nSamplesToAdd, phaseNs)->getCorrection(fc_ampl);
183  e *= corrFactor;
184  }
185 
186  return e;
187 }
const HcalPulseContainmentCorrection * get(const HcalDetId &detId, int toAdd, float fixedphase_ns)
HcalPulseContainmentManager pulseCorr_
constexpr HcalDetId id() const
constexpr unsigned soi() const
constexpr double energyInWindow(const unsigned begin, const unsigned end) const
float SimpleHBHEPhase1Algo::m0Time ( const HBHEChannelInfo info,
double  reconstructedCharge,
int  nSamplesToExamine 
) const
protected

Definition at line 189 of file SimpleHBHEPhase1Algo.cc.

References HcalTimeSlew::delay(), validate-o2o-wbm::f, firstSampleShift_, hcalTimeSlew_delay_, SiStripPI::max, findQualityFiles::maxI, HBHEChannelInfo::MAXSAMPLES, HcalTimeSlew::Medium, SiStripPI::min, hgc_digi::nSamples, HBHEChannelInfo::nSamples(), HBHEChannelInfo::peakEnergyTS(), position, HBHEChannelInfo::soi(), and HBHEChannelInfo::tsEnergy().

Referenced by reconstruct().

191  {
192  float time = -9999.f; // historic value
193 
194  const unsigned nSamples = info.nSamples();
195  if (nSamples > 2U) {
196  const int soi = info.soi();
197  int ibeg = soi + firstSampleShift_;
198  if (ibeg < 0)
199  ibeg = 0;
200  const int iend = std::min(ibeg + nSamplesToExamine, (int)nSamples - 1); // actual array
201 
202  unsigned maxI = info.peakEnergyTS((unsigned)ibeg, (unsigned)iend); // requires unsigned params
203  if (maxI < HBHEChannelInfo::MAXSAMPLES) {
204  if (maxI >= nSamples)
205  maxI = nSamples - 1U; // just in case
206 
207  // Simplified evaluation for Phase1
208  float emax0 = info.tsEnergy(maxI);
209  float emax1 = 0.f;
210  if (maxI < (nSamples - 1U))
211  emax1 = info.tsEnergy(maxI + 1U);
212 
213  // consider soi reference for collisions
214  int position = (int)maxI;
215  if (nSamplesToExamine < (int)nSamples)
216  position -= soi;
217 
218  time = 25.f * (float)position;
219  if (emax0 > 0.f && emax1 > 0.f)
220  time += 25.f * emax1 / (emax0 + emax1); // 1st order corr.
221 
222  // TimeSlew correction
223  time -= hcalTimeSlew_delay_->delay(std::max(1.0, fc_ampl), HcalTimeSlew::Medium);
224  }
225  }
226  return time;
227 }
constexpr unsigned nSamples() const
const HcalTimeSlew * hcalTimeSlew_delay_
constexpr double tsEnergy(const unsigned ts) const
constexpr unsigned peakEnergyTS(const unsigned begin, const unsigned end) const
static const unsigned MAXSAMPLES
constexpr size_t nSamples
constexpr unsigned soi() const
static int position[264][3]
Definition: ReadPGInfo.cc:289
float delay(float fC, BiasSetting bias=Medium) const
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
Definition: HcalTimeSlew.cc:20
HBHERecHit SimpleHBHEPhase1Algo::reconstruct ( const HBHEChannelInfo info,
const HcalRecoParam params,
const HcalCalibrations calibs,
bool  isRealData 
)
overridevirtual

Implements AbsHBHEPhase1Algo.

Definition at line 57 of file SimpleHBHEPhase1Algo.cc.

References HBHEChannelInfo::chargeInWindow(), HLT_FULL_cff::chi2, HcalRecoParam::correctForPhaseContainment(), HcalRecoParam::correctionPhaseNS(), corrFPC_, firstSampleShift_, HcalPulseShapes::getShape(), HBHEChannelInfo::hasTimeInfo(), HcalPhase1FlagLabels::HBHEPulseFitBit, hbminusCorrectionFactor(), hcalTimeSlew_delay_, hltOOTpuCorr_, HBHEChannelInfo::id(), HcalSpecialTimes::isSpecial(), m0Energy(), m0Time(), mahiOOTpuCorr_, HBHEChannelInfo::nSamples(), HcalDeterministicFit::phase1Apply(), PulseShapeFitOOTPileupCorrection::phase1Apply(), MahiFit::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_.

60  {
61  const HcalDetId channelId(info.id());
62 
63  // Calculate "Method 0" quantities
64  float m0t = 0.f, m0E = 0.f;
65  {
66  int ibeg = static_cast<int>(info.soi()) + firstSampleShift_;
67  if (ibeg < 0)
68  ibeg = 0;
69  const int nSamplesToAdd = params ? params->samplesToAdd() : samplesToAdd_;
70  const double fc_ampl = info.chargeInWindow(ibeg, ibeg + nSamplesToAdd);
71  const bool applyContainment = params ? params->correctForPhaseContainment() : corrFPC_;
72  const float phasens = params ? params->correctionPhaseNS() : phaseNS_;
73  m0E = m0Energy(info, fc_ampl, applyContainment, phasens, nSamplesToAdd);
74  m0E *= hbminusCorrectionFactor(channelId, m0E, isData);
75  m0t = m0Time(info, fc_ampl, nSamplesToAdd);
76  }
77 
78  // Run "Method 2"
79  float m2t = 0.f, m2E = 0.f, chi2 = -1.f;
80  bool useTriple = false;
82  if (method2) {
83  psFitOOTpuCorr_->setPulseShapeTemplate(
85  // "phase1Apply" call below sets m2E, m2t, useTriple, and chi2.
86  // These parameters are pased by non-const reference.
87  method2->phase1Apply(info, m2E, m2t, useTriple, chi2);
88  m2E *= hbminusCorrectionFactor(channelId, m2E, isData);
89  }
90 
91  // Run "Method 3"
92  float m3t = 0.f, m3E = 0.f;
93  const HcalDeterministicFit* method3 = hltOOTpuCorr_.get();
94  if (method3) {
95  // "phase1Apply" sets m3E and m3t (pased by non-const reference)
96  method3->phase1Apply(info, m3E, m3t, hcalTimeSlew_delay_);
97  m3E *= hbminusCorrectionFactor(channelId, m3E, isData);
98  }
99 
100  // Run Mahi
101  float m4E = 0.f, m4ESOIPlusOne = 0.f, m4chi2 = -1.f;
102  float m4T = 0.f;
103  bool m4UseTriple = false;
104 
105  const MahiFit* mahi = mahiOOTpuCorr_.get();
106 
107  if (mahi) {
108  mahiOOTpuCorr_->setPulseShapeTemplate(
110  mahi->phase1Apply(info, m4E, m4ESOIPlusOne, m4T, m4UseTriple, m4chi2);
111  m4E *= hbminusCorrectionFactor(channelId, m4E, isData);
112  m4ESOIPlusOne *= hbminusCorrectionFactor(channelId, m4ESOIPlusOne, isData);
113  }
114 
115  // Finally, construct the rechit
116  HBHERecHit rh;
117 
118  float rhE = m0E;
119  float rht = m0t;
120  float rhX = -1.f;
121  if (mahi) {
122  rhE = m4E;
123  rht = m4T;
124  rhX = m4chi2;
125  } else if (method2) {
126  rhE = m2E;
127  rht = m2t;
128  rhX = chi2;
129  } else if (method3) {
130  rhE = m3E;
131  rht = m3t;
132  }
133  float tdcTime = info.soiRiseTime();
134  if (!HcalSpecialTimes::isSpecial(tdcTime))
135  tdcTime += timeShift_;
136  rh = HBHERecHit(channelId, rhE, rht, tdcTime);
137  rh.setRawEnergy(m0E);
138  if (method3) {
139  rh.setAuxEnergy(m3E);
140  } else {
141  rh.setAuxEnergy(m4ESOIPlusOne);
142  }
143  rh.setChiSquared(rhX);
144 
145  // Set rechit aux words
146  HBHERecHitAuxSetter::setAux(info, &rh);
147 
148  // Set some rechit flags (here, for Method 2/Mahi)
149  if (useTriple || m4UseTriple)
151 
152  return rh;
153 }
constexpr unsigned nSamples() const
const Shape & getShape(int shapeType) const
const HcalTimeSlew * hcalTimeSlew_delay_
constexpr unsigned int samplesToAdd() const
Definition: HcalRecoParam.h:32
constexpr bool hasTimeInfo() const
constexpr int recoShape() const
std::unique_ptr< HcalDeterministicFit > hltOOTpuCorr_
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &soiPlusOneEnergy, float &reconstructedTime, bool &useTriple, float &chi2) const
Definition: MahiFit.cc:46
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &reconstructedTime, bool &useTriple, float &chi2) const
static constexpr void setAux(const HBHEChannelInfo &info, HBHERecHit *rechit)
constexpr void setFlagField(uint32_t value, int base, int width=1)
Definition: CaloRecHit.h:36
constexpr void setChiSquared(const float chi2)
Definition: HBHERecHit.h:43
constexpr void setAuxEnergy(const float en)
Definition: HBHERecHit.h:49
constexpr float soiRiseTime() const
constexpr float correctionPhaseNS() const
Definition: HcalRecoParam.h:30
constexpr HcalDetId id() const
constexpr bool isSpecial(const float t)
float hbminusCorrectionFactor(const HcalDetId &cell, float energy, bool isRealData) const
std::unique_ptr< MahiFit > mahiOOTpuCorr_
constexpr unsigned soi() const
constexpr bool correctForPhaseContainment() const
Definition: HcalRecoParam.h:28
HcalPulseShapes theHcalPulseShapes_
float m0Energy(const HBHEChannelInfo &info, double reconstructedCharge, bool applyContainmentCorrection, double phaseNS, int nSamplesToAdd)
constexpr double chargeInWindow(const unsigned begin, const unsigned end) const
float m0Time(const HBHEChannelInfo &info, double reconstructedCharge, int nSamplesToExamine) const
std::unique_ptr< PulseShapeFitOOTPileupCorrection > psFitOOTpuCorr_
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &reconstructedTime, const HcalTimeSlew *hcalTimeSlew_delay) const
constexpr void setRawEnergy(const float en)
Definition: HBHERecHit.h:46

Member Data Documentation

bool SimpleHBHEPhase1Algo::applyLegacyHBMCorrection_
private

Definition at line 102 of file SimpleHBHEPhase1Algo.h.

Referenced by hbminusCorrectionFactor().

bool SimpleHBHEPhase1Algo::corrFPC_
private

Definition at line 101 of file SimpleHBHEPhase1Algo.h.

Referenced by isCorrectingForPhaseContainment(), and reconstruct().

edm::ESGetToken<HcalTimeSlew, HcalTimeSlewRecord> SimpleHBHEPhase1Algo::delayToken_

Definition at line 74 of file SimpleHBHEPhase1Algo.h.

Referenced by beginRun().

int SimpleHBHEPhase1Algo::firstSampleShift_
private

Definition at line 96 of file SimpleHBHEPhase1Algo.h.

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

const HcalTimeSlew* SimpleHBHEPhase1Algo::hcalTimeSlew_delay_

Definition at line 75 of file SimpleHBHEPhase1Algo.h.

Referenced by beginRun(), m0Time(), reconstruct(), and SimpleHBHEPhase1Algo().

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

Definition at line 108 of file SimpleHBHEPhase1Algo.h.

Referenced by reconstruct().

std::unique_ptr<MahiFit> SimpleHBHEPhase1Algo::mahiOOTpuCorr_
private

Definition at line 111 of file SimpleHBHEPhase1Algo.h.

Referenced by reconstruct().

float SimpleHBHEPhase1Algo::phaseNS_
private

Definition at line 98 of file SimpleHBHEPhase1Algo.h.

Referenced by getPhaseNS(), and reconstruct().

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

Definition at line 105 of file SimpleHBHEPhase1Algo.h.

Referenced by reconstruct().

HcalPulseContainmentManager SimpleHBHEPhase1Algo::pulseCorr_
private

Definition at line 94 of file SimpleHBHEPhase1Algo.h.

Referenced by beginRun(), and m0Energy().

int SimpleHBHEPhase1Algo::runnum_
private

Definition at line 100 of file SimpleHBHEPhase1Algo.h.

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

int SimpleHBHEPhase1Algo::samplesToAdd_
private

Definition at line 97 of file SimpleHBHEPhase1Algo.h.

Referenced by getSamplesToAdd(), and reconstruct().

HcalPulseShapes SimpleHBHEPhase1Algo::theHcalPulseShapes_
private

Definition at line 113 of file SimpleHBHEPhase1Algo.h.

Referenced by reconstruct().

float SimpleHBHEPhase1Algo::timeShift_
private

Definition at line 99 of file SimpleHBHEPhase1Algo.h.

Referenced by getTimeShift(), and reconstruct().