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, std::unique_ptr< PulseShapeFitOOTPileupCorrection > m2, std::unique_ptr< HcalDeterministicFit > detFit, std::unique_ptr< MahiFit > mahi)
 
 ~SimpleHBHEPhase1Algo () override
 
- Public Member Functions inherited from AbsHBHEPhase1Algo
virtual bool configure (const AbsHcalAlgoData *)
 
virtual ~AbsHBHEPhase1Algo ()
 

Public Attributes

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, const HcalCalibrations &calibs, 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 ( int  firstSampleShift,
int  samplesToAdd,
float  phaseNS,
float  timeShift,
bool  correctForPhaseContainment,
bool  applyLegacyHBMCorrection,
std::unique_ptr< PulseShapeFitOOTPileupCorrection m2,
std::unique_ptr< HcalDeterministicFit detFit,
std::unique_ptr< MahiFit mahi 
)

Definition at line 20 of file SimpleHBHEPhase1Algo.cc.

References hcalTimeSlew_delay_.

33  phaseNS_(phaseNS),
35  runnum_(0),
39  hltOOTpuCorr_(std::move(detFit)),
41 {
42  hcalTimeSlew_delay_ = nullptr;
43 }
const HcalTimeSlew * hcalTimeSlew_delay_
std::unique_ptr< HcalDeterministicFit > hltOOTpuCorr_
float PulseContainmentFractionalError
HcalPulseContainmentManager pulseCorr_
std::unique_ptr< MahiFit > mahiOOTpuCorr_
std::unique_ptr< PulseShapeFitOOTPileupCorrection > psFitOOTpuCorr_
def move(src, dest)
Definition: eostools.py:511
SimpleHBHEPhase1Algo::~SimpleHBHEPhase1Algo ( )
inlineoverride

Definition at line 53 of file SimpleHBHEPhase1Algo.h.

References beginRun(), and endRun().

53 {}

Member Function Documentation

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

Reimplemented from AbsHBHEPhase1Algo.

Definition at line 45 of file SimpleHBHEPhase1Algo.cc.

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

Referenced by ~SimpleHBHEPhase1Algo().

47 {
49  es.get<HcalTimeSlewRecord>().get("HBHE", delay);
50  hcalTimeSlew_delay_ = &*delay;
51 
52  runnum_ = r.run();
53  pulseCorr_.beginRun(es);
54 }
const HcalTimeSlew * hcalTimeSlew_delay_
RunNumber_t run() const
Definition: RunBase.h:40
HcalPulseContainmentManager pulseCorr_
void beginRun(edm::EventSetup const &es)
T get() const
Definition: EventSetup.h:71
void SimpleHBHEPhase1Algo::endRun ( )
overridevirtual

Reimplemented from AbsHBHEPhase1Algo.

Definition at line 56 of file SimpleHBHEPhase1Algo.cc.

References runnum_.

Referenced by ~SimpleHBHEPhase1Algo().

57 {
58  runnum_ = 0;
59 }
int SimpleHBHEPhase1Algo::getFirstSampleShift ( ) const
inline

Definition at line 66 of file SimpleHBHEPhase1Algo.h.

References firstSampleShift_.

float SimpleHBHEPhase1Algo::getPhaseNS ( ) const
inline

Definition at line 68 of file SimpleHBHEPhase1Algo.h.

References phaseNS_.

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

Definition at line 71 of file SimpleHBHEPhase1Algo.h.

References runnum_.

int SimpleHBHEPhase1Algo::getSamplesToAdd ( ) const
inline

Definition at line 67 of file SimpleHBHEPhase1Algo.h.

References samplesToAdd_.

float SimpleHBHEPhase1Algo::getTimeShift ( ) const
inline

Definition at line 69 of file SimpleHBHEPhase1Algo.h.

References timeShift_.

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

Definition at line 161 of file SimpleHBHEPhase1Algo.cc.

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

Referenced by reconstruct().

164 {
165  float corr = 1.f;
166  if (applyLegacyHBMCorrection_ && isRealData && runnum_ > 0)
167  if (cell.subdet() == HcalBarrel)
168  {
169  const int ieta = cell.ieta();
170  const int iphi = cell.iphi();
171  corr = hbminus_special_ecorr(ieta, iphi, energy, runnum_);
172  }
173  return corr;
174 }
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:146
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:159
JetCorrectorParameters corr
Definition: classes.h:5
int iphi() const
get the cell iphi
Definition: HcalDetId.h:161
bool SimpleHBHEPhase1Algo::isConfigurable ( ) const
inlineoverridevirtual

Implements AbsHBHEPhase1Algo.

Definition at line 59 of file SimpleHBHEPhase1Algo.h.

References info(), and reconstruct().

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

Definition at line 70 of file SimpleHBHEPhase1Algo.h.

References corrFPC_.

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

Definition at line 176 of file SimpleHBHEPhase1Algo.cc.

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

Referenced by reconstruct().

181 {
182  int ibeg = static_cast<int>(info.soi()) + firstSampleShift_;
183  if (ibeg < 0)
184  ibeg = 0;
185  double e = info.energyInWindow(ibeg, ibeg + nSamplesToAdd);
186 
187  // Pulse containment correction
188  {
189  double corrFactor = 1.0;
190  if (applyContainmentCorrection)
191  corrFactor = pulseCorr_.get(info.id(), nSamplesToAdd, phaseNs)->getCorrection(fc_ampl);
192  e *= corrFactor;
193  }
194 
195  return e;
196 }
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 198 of file SimpleHBHEPhase1Algo.cc.

References HcalTimeSlew::delay(), f, firstSampleShift_, objects.autophobj::float, hcalTimeSlew_delay_, createfilelist::int, SiStripPI::max, findQualityFiles::maxI, HBHEChannelInfo::MAXSAMPLES, HcalTimeSlew::Medium, min(), hgc_digi::nSamples, HBHEChannelInfo::nSamples(), HBHEChannelInfo::peakEnergyTS(), position, HBHEChannelInfo::soi(), ntuplemaker::time, HBHEChannelInfo::tsEnergy(), and mitigatedMETSequence_cff::U.

Referenced by reconstruct().

202 {
203  float time = -9999.f; // historic value
204 
205  const unsigned nSamples = info.nSamples();
206  if (nSamples > 2U)
207  {
208  const int soi = info.soi();
209  int ibeg = soi + firstSampleShift_;
210  if (ibeg < 0)
211  ibeg = 0;
212  const int iend = std::min(ibeg + nSamplesToExamine, (int)nSamples - 1); // actual array
213 
214  unsigned maxI = info.peakEnergyTS((unsigned)ibeg, (unsigned)iend); // requires unsigned params
215  if (maxI < HBHEChannelInfo::MAXSAMPLES)
216  {
217 
218  if(maxI >= nSamples) maxI = nSamples - 1U; // just in case
219 
220  // Simplified evaluation for Phase1
221  float emax0 = info.tsEnergy(maxI);
222  float emax1 = 0.f;
223  if(maxI < (nSamples - 1U)) emax1 = info.tsEnergy(maxI + 1U);
224 
225  // consider soi reference for collisions
226  int position = (int)maxI;
227  if(nSamplesToExamine < (int)nSamples) position -= soi;
228 
229  time = 25.f * (float)position;
230  if(emax0 > 0.f && emax1 > 0.f) time += 25.f * emax1/(emax0+emax1); // 1st order corr.
231 
232  // TimeSlew correction
233  time -= hcalTimeSlew_delay_->delay(std::max(1.0, fc_ampl), HcalTimeSlew::Medium);
234 
235  }
236  }
237  return time;
238 }
const HcalTimeSlew * hcalTimeSlew_delay_
unsigned soi() const
static const unsigned MAXSAMPLES
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
constexpr size_t nSamples
double tsEnergy(const unsigned ts) const
static int position[264][3]
Definition: ReadPGInfo.cc:509
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:14
unsigned nSamples() const
unsigned peakEnergyTS(const unsigned begin, const unsigned end) const
HBHERecHit SimpleHBHEPhase1Algo::reconstruct ( const HBHEChannelInfo info,
const HcalRecoParam params,
const HcalCalibrations calibs,
bool  isRealData 
)
overridevirtual

Implements AbsHBHEPhase1Algo.

Definition at line 61 of file SimpleHBHEPhase1Algo.cc.

References HBHEChannelInfo::chargeInWindow(), vertices_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_.

Referenced by isConfigurable().

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

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().

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 73 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().