CMS 3D CMS Logo

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

#include <HcalSimpleRecAlgo.h>

Public Member Functions

void beginRun (edm::EventSetup const &es)
 
void endRun ()
 
 HcalSimpleRecAlgo (bool correctForTimeslew, bool correctForContainment, float fixedPhaseNs)
 
 HcalSimpleRecAlgo ()
 
void initPulseCorr (int toadd)
 
HBHERecHit reconstruct (const HBHEDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
 
HFRecHit reconstruct (const HFDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
 
HORecHit reconstruct (const HODataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
 
HcalCalibRecHit reconstruct (const HcalCalibDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
 
HBHERecHit reconstructHBHEUpgrade (const HcalUpgradeDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
 
HFRecHit reconstructHFUpgrade (const HcalUpgradeDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
 
void setForData ()
 
void setLeakCorrection ()
 
void setRecoParams (bool correctForTimeslew, bool correctForPulse, bool setLeakCorrection, int pileupCleaningID, float phaseNS)
 

Private Attributes

bool correctForPulse_
 
bool correctForTimeslew_
 
float phaseNS_
 
int pileupCleaningID_
 
std::auto_ptr
< HcalPulseContainmentManager
pulseCorr_
 
bool setForData_
 
bool setLeakCorrection_
 

Detailed Description

This class reconstructs RecHits from Digis for HBHE, HF, and HO by addition of selected time samples, pedestal subtraction, and gain application. The time of the hit is reconstructed using a weighted peak bin calculation supplemented by precise time lookup table. A consumer of this class also has the option of correcting the reconstructed time for energy-dependent time slew associated with the QIE.

Date:
2013/04/26 15:49:44
Revision:
1.18
Author
J. Mans - Minnesota

Definition at line 33 of file HcalSimpleRecAlgo.h.

Constructor & Destructor Documentation

HcalSimpleRecAlgo::HcalSimpleRecAlgo ( bool  correctForTimeslew,
bool  correctForContainment,
float  fixedPhaseNs 
)

Full featured constructor for HB/HE and HO (HPD-based detectors)

Definition at line 12 of file HcalSimpleRecAlgo.cc.

References MaximumFractionalError, and pulseCorr_.

12  :
13  correctForTimeslew_(correctForTimeslew),
14  correctForPulse_(correctForPulse),
15  phaseNS_(phaseNS), setForData_(false), setLeakCorrection_(false)
16 {
17 
18  pulseCorr_ = std::auto_ptr<HcalPulseContainmentManager>(
20  );
21 }
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
constexpr double MaximumFractionalError
HcalSimpleRecAlgo::HcalSimpleRecAlgo ( )

Simple constructor for PMT-based detectors

Definition at line 24 of file HcalSimpleRecAlgo.cc.

24  :
25  correctForTimeslew_(false), setForData_(false) { }

Member Function Documentation

void HcalSimpleRecAlgo::beginRun ( edm::EventSetup const &  es)

Definition at line 28 of file HcalSimpleRecAlgo.cc.

References pulseCorr_.

Referenced by HcalSimpleReconstructor::beginRun(), and HcalHitReconstructor::beginRun().

29 {
30  pulseCorr_->beginRun(es);
31 }
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
void HcalSimpleRecAlgo::endRun ( void  )

Definition at line 34 of file HcalSimpleRecAlgo.cc.

References pulseCorr_.

Referenced by HcalSimpleReconstructor::endRun(), and HcalHitReconstructor::endRun().

35 {
36  pulseCorr_->endRun();
37 }
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
void HcalSimpleRecAlgo::initPulseCorr ( int  toadd)

Definition at line 40 of file HcalSimpleRecAlgo.cc.

40  {
41 }
HBHERecHit HcalSimpleRecAlgo::reconstruct ( const HBHEDataFrame digi,
int  first,
int  toadd,
const HcalCoder coder,
const HcalCalibrations calibs 
) const

Definition at line 162 of file HcalSimpleRecAlgo.cc.

References correctForPulse_, correctForTimeslew_, first, HcalTimeSlew::Medium, phaseNS_, pulseCorr_, setForData_, and setLeakCorrection_.

Referenced by HcalSimpleReconstructor::process(), and HcalHitReconstructor::produce().

162  {
163  return HcalSimpleRecAlgoImpl::reco<HBHEDataFrame,HBHERecHit>(digi,coder,calibs,
165  pulseCorr_->get(digi.id(), toadd, phaseNS_),
168 }
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
bool first
Definition: L1TdeRCT.cc:94
HFRecHit HcalSimpleRecAlgo::reconstruct ( const HFDataFrame digi,
int  first,
int  toadd,
const HcalCoder coder,
const HcalCalibrations calibs 
) const

Definition at line 205 of file HcalSimpleRecAlgo.cc.

References HcalCoder::adc2fC(), corr, correctForPulse_, correctForTimeslew_, alignCSCRings::e, create_public_lumi_plots::exp, f, HcalPulseContainmentCorrection::getCorrection(), i, HFDataFrame::id(), LogDebug, findQualityFiles::maxI, min, HcalCalibrations::pedestal(), phaseNS_, HFDataFrame::presamples(), pulseCorr_, HcalCalibrations::respcorrgain(), CaloSamples::size(), reco::t2, cond::rpcobgas::time, HcalCalibrations::timecorr(), and timeshift_ns_hf().

205  {
206 
207  const HcalPulseContainmentCorrection* corr = pulseCorr_->get(digi.id(), toadd, phaseNS_);
208 
209  CaloSamples tool;
210  coder.adc2fC(digi,tool);
211 
212  double ampl=0; int maxI = -1; double maxA = -1e10; float ta=0; float amp_fC=0;
213  for (int i=first; i<tool.size() && i<first+toadd; i++) {
214  int capid=digi[i].capid();
215  ta = (tool[i]-calibs.pedestal(capid))*calibs.respcorrgain(capid);
216  ampl+=ta;
217  amp_fC += tool[i]-calibs.pedestal(capid);
218  if(ta>maxA){
219  maxA=ta;
220  maxI=i;
221  }
222  }
223 
224  float time=-9999.0;
226  if(maxI==0 || maxI==(tool.size()-1)) {
227  LogDebug("HCAL Pulse") << "HcalSimpleRecAlgo::reconstruct :"
228  << " Invalid max amplitude position, "
229  << " max Amplitude: "<< maxI
230  << " first: "<< first
231  << " last: "<<(tool.size()-1)
232  << std::endl;
233  } else {
234  int capid=digi[maxI-1].capid();
235  float t0 = (tool[maxI-1]-calibs.pedestal(capid))*calibs.respcorrgain(capid);
236  capid=digi[maxI+1].capid();
237  float t2 = (tool[maxI+1]-calibs.pedestal(capid))*calibs.respcorrgain(capid);
238 
239  // Handle negative excursions by moving "zero":
240  float zerocorr=std::min(t0,t2);
241  if (zerocorr<0.f) {
242  t0 -= zerocorr;
243  t2 -= zerocorr;
244  maxA -= zerocorr;
245  }
246 
247  // pair the peak with the larger of the two neighboring time samples
248  float wpksamp=0.f;
249  if (t0>t2) {
250  wpksamp = t0+maxA;
251  if (wpksamp != 0.f) wpksamp = maxA/wpksamp;
252  } else {
253  wpksamp = maxA+t2;
254  if (wpksamp != 0.f) wpksamp = 1.+(t2/wpksamp);
255  }
256 
257  time = (maxI - digi.presamples())*25.0 + timeshift_ns_hf(wpksamp);
258 
259  if (corr!=0 && correctForPulse_) {
260 
261  // Apply phase-based amplitude correction:
262 
263  /*
264  HcalDetId cell(digi.id());
265  int ieta = cell.ieta();
266  int iphi = cell.iphi();
267  int depth = cell.depth();
268  std::cout << "*** ieta, iphi, depth = " << ieta << ", " << iphi
269  << ", " << depth
270  << " first, toadd = " << ifirst << ", " << n << std::endl
271  << " ampl, corr, ampl_after_corr = "
272  << ampl << ", " << corr->getCorrection(fc_ampl)
273  << ", "
274  << ampl * corr->getCorrection(fc_ampl) << std::endl;
275  */
276 
277  ampl *= corr->getCorrection(amp_fC);
278  }
279 
280  if (correctForTimeslew_ && (amp_fC>0)) {
281  // -5.12327 - put in calibs.timecorr()
282  double tslew=exp(0.337681-5.94689e-4*amp_fC)+exp(2.44628-1.34888e-2*amp_fC);
283  time -= (float)tslew;
284  }
285 
286  time=time-calibs.timecorr();
287  }
288 
289  return HFRecHit(digi.id(),ampl,time);
290 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
static float timeshift_ns_hf(float wpksamp)
Same as above, but for the HF PMTs.
double getCorrection(double fc_ampl) const
#define min(a, b)
Definition: mlp_lapack.h:161
double pedestal(int fCapId) const
get pedestal for capid=0..3
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:18
double f[11][100]
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
bool first
Definition: L1TdeRCT.cc:94
JetCorrectorParameters corr
Definition: classes.h:11
int size() const
get the size
Definition: CaloSamples.h:26
double timecorr() const
get time correction factor
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
int presamples() const
number of samples before the sample from the triggered beam crossing (according to the hardware) ...
Definition: HFDataFrame.h:28
const HcalDetId & id() const
Definition: HFDataFrame.h:22
HORecHit HcalSimpleRecAlgo::reconstruct ( const HODataFrame digi,
int  first,
int  toadd,
const HcalCoder coder,
const HcalCalibrations calibs 
) const

Definition at line 170 of file HcalSimpleRecAlgo.cc.

References correctForPulse_, correctForTimeslew_, first, phaseNS_, pulseCorr_, setForData_, and HcalTimeSlew::Slow.

170  {
171  return HcalSimpleRecAlgoImpl::reco<HODataFrame,HORecHit>(digi,coder,calibs,
173  pulseCorr_->get(digi.id(), toadd, phaseNS_),
175  setForData_, false);
176 }
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
bool first
Definition: L1TdeRCT.cc:94
HcalCalibRecHit HcalSimpleRecAlgo::reconstruct ( const HcalCalibDataFrame digi,
int  first,
int  toadd,
const HcalCoder coder,
const HcalCalibrations calibs 
) const

Definition at line 178 of file HcalSimpleRecAlgo.cc.

References correctForPulse_, correctForTimeslew_, HcalTimeSlew::Fast, first, phaseNS_, pulseCorr_, and setForData_.

178  {
179  return HcalSimpleRecAlgoImpl::reco<HcalCalibDataFrame,HcalCalibRecHit>(digi,coder,calibs,
181  pulseCorr_->get(digi.id(), toadd, phaseNS_),
183  setForData_, false );
184 }
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
bool first
Definition: L1TdeRCT.cc:94
HBHERecHit HcalSimpleRecAlgo::reconstructHBHEUpgrade ( const HcalUpgradeDataFrame digi,
int  first,
int  toadd,
const HcalCoder coder,
const HcalCalibrations calibs 
) const

Definition at line 197 of file HcalSimpleRecAlgo.cc.

References correctForPulse_, correctForTimeslew_, first, HcalTimeSlew::Medium, phaseNS_, pulseCorr_, HcalTDCReco::reconstruct(), query::result, and EcalTBTDCReconstructor_cfi::tdcReco.

Referenced by HcalSimpleReconstructor::processUpgrade().

197  {
198  HBHERecHit result = HcalSimpleRecAlgoImpl::reco<HcalUpgradeDataFrame,HBHERecHit>( digi, coder, calibs, first, toadd, correctForTimeslew_, correctForPulse_, pulseCorr_->get(digi.id(), toadd, phaseNS_), HcalTimeSlew::Medium, false, false);
200  tdcReco.reconstruct(digi, result);
201  return result;
202 }
tuple result
Definition: query.py:137
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
bool first
Definition: L1TdeRCT.cc:94
void reconstruct(const HcalUpgradeDataFrame &digi, HBHERecHit &recHit) const
Definition: HcalTDCReco.cc:8
HFRecHit HcalSimpleRecAlgo::reconstructHFUpgrade ( const HcalUpgradeDataFrame digi,
int  first,
int  toadd,
const HcalCoder coder,
const HcalCalibrations calibs 
) const

Definition at line 294 of file HcalSimpleRecAlgo.cc.

References HcalCoder::adc2fC(), corr, correctForPulse_, correctForTimeslew_, alignCSCRings::e, create_public_lumi_plots::exp, f, HcalPulseContainmentCorrection::getCorrection(), i, HcalUpgradeDataFrame::id(), LogDebug, findQualityFiles::maxI, min, HcalCalibrations::pedestal(), phaseNS_, HcalUpgradeDataFrame::presamples(), pulseCorr_, HcalCalibrations::respcorrgain(), CaloSamples::size(), reco::t2, cond::rpcobgas::time, HcalCalibrations::timecorr(), and timeshift_ns_hf().

Referenced by HcalSimpleReconstructor::processUpgrade().

294  {
295 
296  const HcalPulseContainmentCorrection* corr = pulseCorr_->get(digi.id(), toadd, phaseNS_);
297 
298  CaloSamples tool;
299  coder.adc2fC(digi,tool);
300 
301  double ampl=0; int maxI = -1; double maxA = -1e10; float ta=0; float amp_fC=0;
302  for (int i=first; i<tool.size() && i<first+toadd; i++) {
303  int capid=digi[i].capid();
304  ta = (tool[i]-calibs.pedestal(capid))*calibs.respcorrgain(capid);
305  ampl+=ta;
306  amp_fC += tool[i]-calibs.pedestal(capid);
307  if(ta>maxA){
308  maxA=ta;
309  maxI=i;
310  }
311  }
312 
313  float time=-9999.0;
315  if(maxI==0 || maxI==(tool.size()-1)) {
316  LogDebug("HCAL Pulse") << "HcalSimpleRecAlgo::reconstruct :"
317  << " Invalid max amplitude position, "
318  << " max Amplitude: "<< maxI
319  << " first: "<< first
320  << " last: "<<(tool.size()-1)
321  << std::endl;
322  } else {
323  int capid=digi[maxI-1].capid();
324  float t0 = (tool[maxI-1]-calibs.pedestal(capid))*calibs.respcorrgain(capid);
325  capid=digi[maxI+1].capid();
326  float t2 = (tool[maxI+1]-calibs.pedestal(capid))*calibs.respcorrgain(capid);
327 
328  // Handle negative excursions by moving "zero":
329  float zerocorr=std::min(t0,t2);
330  if (zerocorr<0.f) {
331  t0 -= zerocorr;
332  t2 -= zerocorr;
333  maxA -= zerocorr;
334  }
335 
336  // pair the peak with the larger of the two neighboring time samples
337  float wpksamp=0.f;
338  if (t0>t2) {
339  wpksamp = t0+maxA;
340  if (wpksamp != 0.f) wpksamp = maxA/wpksamp;
341  } else {
342  wpksamp = maxA+t2;
343  if (wpksamp != 0.f) wpksamp = 1.+(t2/wpksamp);
344  }
345 
346  time = (maxI - digi.presamples())*25.0 + timeshift_ns_hf(wpksamp);
347 
348  if (corr!=0 && correctForPulse_) {
349 
350  // Apply phase-based amplitude correction:
351 
352  /*
353  HcalDetId cell(digi.id());
354  int ieta = cell.ieta();
355  int iphi = cell.iphi();
356  int depth = cell.depth();
357  std::cout << "*** ieta, iphi, depth = " << ieta << ", " << iphi
358  << ", " << depth
359  << " first, toadd = " << ifirst << ", " << n << std::endl
360  << " ampl, corr, ampl_after_corr = "
361  << ampl << ", " << corr->getCorrection(fc_ampl)
362  << ", "
363  << ampl * corr->getCorrection(fc_ampl) << std::endl;
364  */
365 
366  ampl *= corr->getCorrection(amp_fC);
367  }
368 
369  if (correctForTimeslew_ && (amp_fC>0)) {
370  // -5.12327 - put in calibs.timecorr()
371  double tslew=exp(0.337681-5.94689e-4*amp_fC)+exp(2.44628-1.34888e-2*amp_fC);
372  time -= (float)tslew;
373  }
374 
375  time=time-calibs.timecorr();
376  }
377 
378  return HFRecHit(digi.id(),ampl,time); // new RecHit gets second time = 0.
379 
380 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
static float timeshift_ns_hf(float wpksamp)
Same as above, but for the HF PMTs.
double getCorrection(double fc_ampl) const
#define min(a, b)
Definition: mlp_lapack.h:161
double pedestal(int fCapId) const
get pedestal for capid=0..3
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:18
double f[11][100]
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
bool first
Definition: L1TdeRCT.cc:94
JetCorrectorParameters corr
Definition: classes.h:11
int size() const
get the size
Definition: CaloSamples.h:26
double timecorr() const
get time correction factor
const HcalDetId & id() const
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
void HcalSimpleRecAlgo::setForData ( )

Definition at line 51 of file HcalSimpleRecAlgo.cc.

References setForData_.

Referenced by HcalSimpleReconstructor::produce(), and HcalHitReconstructor::produce().

51 { setForData_ = true;}
void HcalSimpleRecAlgo::setLeakCorrection ( )

Definition at line 53 of file HcalSimpleRecAlgo.cc.

References setLeakCorrection_.

Referenced by HcalHitReconstructor::produce(), and setRecoParams().

53 { setLeakCorrection_ = true;}
void HcalSimpleRecAlgo::setRecoParams ( bool  correctForTimeslew,
bool  correctForPulse,
bool  setLeakCorrection,
int  pileupCleaningID,
float  phaseNS 
)

Member Data Documentation

bool HcalSimpleRecAlgo::correctForPulse_
private
bool HcalSimpleRecAlgo::correctForTimeslew_
private
float HcalSimpleRecAlgo::phaseNS_
private
int HcalSimpleRecAlgo::pileupCleaningID_
private

Definition at line 71 of file HcalSimpleRecAlgo.h.

Referenced by setRecoParams().

std::auto_ptr<HcalPulseContainmentManager> HcalSimpleRecAlgo::pulseCorr_
private
bool HcalSimpleRecAlgo::setForData_
private

Definition at line 69 of file HcalSimpleRecAlgo.h.

Referenced by reconstruct(), and setForData().

bool HcalSimpleRecAlgo::setLeakCorrection_
private

Definition at line 70 of file HcalSimpleRecAlgo.h.

Referenced by reconstruct(), setLeakCorrection(), and setRecoParams().