CMS 3D CMS Logo

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, HcalTimeSlewRecorddelayToken_
 
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< HcalDeterministicFithltOOTpuCorr_
 
std::unique_ptr< MahiFitmahiOOTpuCorr_
 
float phaseNS_
 
std::unique_ptr< PulseShapeFitOOTPileupCorrectionpsFitOOTpuCorr_
 
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::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),
37  phaseNS_(phaseNS),
39  runnum_(0),
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_
std::unique_ptr< MahiFit > mahiOOTpuCorr_
std::unique_ptr< PulseShapeFitOOTPileupCorrection > psFitOOTpuCorr_
def move(src, dest)
Definition: eostools.py:511

◆ ~SimpleHBHEPhase1Algo()

SimpleHBHEPhase1Algo::~SimpleHBHEPhase1Algo ( )
inlineoverride

Definition at line 54 of file SimpleHBHEPhase1Algo.h.

54 {}

Member Function Documentation

◆ beginRun()

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_, alignCSCRings::r, and runnum_.

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

◆ endRun()

void SimpleHBHEPhase1Algo::endRun ( )
overridevirtual

Reimplemented from AbsHBHEPhase1Algo.

Definition at line 55 of file SimpleHBHEPhase1Algo.cc.

References runnum_.

◆ getFirstSampleShift()

int SimpleHBHEPhase1Algo::getFirstSampleShift ( ) const
inline

Definition at line 67 of file SimpleHBHEPhase1Algo.h.

References firstSampleShift_.

◆ getPhaseNS()

float SimpleHBHEPhase1Algo::getPhaseNS ( ) const
inline

Definition at line 69 of file SimpleHBHEPhase1Algo.h.

References phaseNS_.

69 { return phaseNS_; }

◆ getRunNumber()

int SimpleHBHEPhase1Algo::getRunNumber ( ) const
inline

Definition at line 72 of file SimpleHBHEPhase1Algo.h.

References runnum_.

◆ getSamplesToAdd()

int SimpleHBHEPhase1Algo::getSamplesToAdd ( ) const
inline

Definition at line 68 of file SimpleHBHEPhase1Algo.h.

References samplesToAdd_.

◆ getTimeShift()

float SimpleHBHEPhase1Algo::getTimeShift ( ) const
inline

Definition at line 70 of file SimpleHBHEPhase1Algo.h.

References timeShift_.

70 { return timeShift_; }

◆ hbminusCorrectionFactor()

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

Definition at line 155 of file SimpleHBHEPhase1Algo.cc.

References applyLegacyHBMCorrection_, alignCSCRings::corr, HCALHighEnergyHPDFilter_cfi::energy, hbminus_special_ecorr(), HcalBarrel, LEDCalibrationChannels::ieta, HcalDetId::ieta(), LEDCalibrationChannels::iphi, 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();
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
dictionary corr
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157

◆ isConfigurable()

bool SimpleHBHEPhase1Algo::isConfigurable ( ) const
inlineoverridevirtual

Implements AbsHBHEPhase1Algo.

Definition at line 60 of file SimpleHBHEPhase1Algo.h.

60 { return false; }

◆ isCorrectingForPhaseContainment()

bool SimpleHBHEPhase1Algo::isCorrectingForPhaseContainment ( ) const
inline

Definition at line 71 of file SimpleHBHEPhase1Algo.h.

References corrFPC_.

71 { return corrFPC_; }

◆ m0Energy()

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

Definition at line 168 of file SimpleHBHEPhase1Algo.cc.

References MillePedeFileConverter_cfg::e, firstSampleShift_, HcalPulseContainmentManager::get(), info(), and pulseCorr_.

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 }
static const TGPicture * info(bool iBackgroundIsBlack)
const HcalPulseContainmentCorrection * get(const HcalDetId &detId, int toAdd, float fixedphase_ns)
HcalPulseContainmentManager pulseCorr_

◆ m0Time()

float SimpleHBHEPhase1Algo::m0Time ( const HBHEChannelInfo info,
double  reconstructedCharge,
int  nSamplesToExamine 
) const
protected

Definition at line 189 of file SimpleHBHEPhase1Algo.cc.

References HcalTimeSlew::delay(), f, firstSampleShift_, dqmMemoryStats::float, hcalTimeSlew_delay_, info(), createfilelist::int, SiStripPI::max, findQualityFiles::maxI, HBHEChannelInfo::MAXSAMPLES, HcalTimeSlew::Medium, SiStripPI::min, PresampleTask_cfi::nSamples, position, protons_cff::time, and mitigatedMETSequence_cff::U.

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
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
224  }
225  }
226  return time;
227 }
const HcalTimeSlew * hcalTimeSlew_delay_
static const TGPicture * info(bool iBackgroundIsBlack)
static const unsigned MAXSAMPLES
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
double f[11][100]
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ reconstruct()

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 hltPixelTracks_cff::chi2, corrFPC_, firstSampleShift_, HcalPulseShapes::getShape(), HcalPhase1FlagLabels::HBHEPulseFitBit, hbminusCorrectionFactor(), hcalTimeSlew_delay_, hltOOTpuCorr_, info(), HLTBitAnalyser_cfi::isData, HcalSpecialTimes::isSpecial(), m0Energy(), m0Time(), mahiOOTpuCorr_, submitPVValidationJobs::params, HcalDeterministicFit::phase1Apply(), PulseShapeFitOOTPileupCorrection::phase1Apply(), MahiFit::phase1Apply(), phaseNS_, psFitOOTpuCorr_, samplesToAdd_, HBHERecHitAuxSetter::setAux(), HBHERecHit::setAuxEnergy(), HBHERecHit::setChiSquared(), CaloRecHit::setFlagField(), HBHERecHit::setRawEnergy(), 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(
84  theHcalPulseShapes_.getShape(info.recoShape()), !info.hasTimeInfo(), info.nSamples(), hcalTimeSlew_delay_);
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(
109  info.recoShape(), theHcalPulseShapes_, info.hasTimeInfo(), hcalTimeSlew_delay_, info.nSamples(), info.tsGain(0));
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
147 
148  // Set some rechit flags (here, for Method 2/Mahi)
149  if (useTriple || m4UseTriple)
151 
152  return rh;
153 }
const HcalTimeSlew * hcalTimeSlew_delay_
static const TGPicture * info(bool iBackgroundIsBlack)
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &reconstructedTime, const HcalTimeSlew *hcalTimeSlew_delay) const
std::unique_ptr< HcalDeterministicFit > hltOOTpuCorr_
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
float hbminusCorrectionFactor(const HcalDetId &cell, float energy, bool isRealData) const
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &soiPlusOneEnergy, float &reconstructedTime, bool &useTriple, float &chi2) const
Definition: MahiFit.cc:50
float m0Time(const HBHEChannelInfo &info, double reconstructedCharge, int nSamplesToExamine) const
constexpr bool isSpecial(const float t)
std::unique_ptr< MahiFit > mahiOOTpuCorr_
const Shape & getShape(int shapeType) const
HcalPulseShapes theHcalPulseShapes_
float m0Energy(const HBHEChannelInfo &info, double reconstructedCharge, bool applyContainmentCorrection, double phaseNS, int nSamplesToAdd)
std::unique_ptr< PulseShapeFitOOTPileupCorrection > psFitOOTpuCorr_
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &reconstructedTime, bool &useTriple, float &chi2) const
constexpr void setRawEnergy(const float en)
Definition: HBHERecHit.h:46

Member Data Documentation

◆ applyLegacyHBMCorrection_

bool SimpleHBHEPhase1Algo::applyLegacyHBMCorrection_
private

Definition at line 102 of file SimpleHBHEPhase1Algo.h.

Referenced by hbminusCorrectionFactor().

◆ corrFPC_

bool SimpleHBHEPhase1Algo::corrFPC_
private

Definition at line 101 of file SimpleHBHEPhase1Algo.h.

Referenced by isCorrectingForPhaseContainment(), and reconstruct().

◆ delayToken_

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

Definition at line 74 of file SimpleHBHEPhase1Algo.h.

Referenced by beginRun().

◆ firstSampleShift_

int SimpleHBHEPhase1Algo::firstSampleShift_
private

Definition at line 96 of file SimpleHBHEPhase1Algo.h.

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

◆ hcalTimeSlew_delay_

const HcalTimeSlew* SimpleHBHEPhase1Algo::hcalTimeSlew_delay_

Definition at line 75 of file SimpleHBHEPhase1Algo.h.

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

◆ hltOOTpuCorr_

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

Definition at line 108 of file SimpleHBHEPhase1Algo.h.

Referenced by reconstruct().

◆ mahiOOTpuCorr_

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

Definition at line 111 of file SimpleHBHEPhase1Algo.h.

Referenced by reconstruct().

◆ phaseNS_

float SimpleHBHEPhase1Algo::phaseNS_
private

Definition at line 98 of file SimpleHBHEPhase1Algo.h.

Referenced by getPhaseNS(), and reconstruct().

◆ psFitOOTpuCorr_

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

Definition at line 105 of file SimpleHBHEPhase1Algo.h.

Referenced by reconstruct().

◆ pulseCorr_

HcalPulseContainmentManager SimpleHBHEPhase1Algo::pulseCorr_
private

Definition at line 94 of file SimpleHBHEPhase1Algo.h.

Referenced by beginRun(), and m0Energy().

◆ runnum_

int SimpleHBHEPhase1Algo::runnum_
private

Definition at line 100 of file SimpleHBHEPhase1Algo.h.

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

◆ samplesToAdd_

int SimpleHBHEPhase1Algo::samplesToAdd_
private

Definition at line 97 of file SimpleHBHEPhase1Algo.h.

Referenced by getSamplesToAdd(), and reconstruct().

◆ theHcalPulseShapes_

HcalPulseShapes SimpleHBHEPhase1Algo::theHcalPulseShapes_
private

Definition at line 113 of file SimpleHBHEPhase1Algo.h.

Referenced by reconstruct().

◆ timeShift_

float SimpleHBHEPhase1Algo::timeShift_
private

Definition at line 99 of file SimpleHBHEPhase1Algo.h.

Referenced by getTimeShift(), and reconstruct().