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
 
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:
2011/11/23 13:53:17
Revision:
1.17
Author
J. Mans - Minnesota

Definition at line 32 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 11 of file HcalSimpleRecAlgo.cc.

References MaximumFractionalError, and pulseCorr_.

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

Simple constructor for PMT-based detectors

Definition at line 23 of file HcalSimpleRecAlgo.cc.

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

Member Function Documentation

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

Definition at line 27 of file HcalSimpleRecAlgo.cc.

References pulseCorr_.

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

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

Definition at line 33 of file HcalSimpleRecAlgo.cc.

References pulseCorr_.

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

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

Definition at line 39 of file HcalSimpleRecAlgo.cc.

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

Definition at line 161 of file HcalSimpleRecAlgo.cc.

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

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

161  {
162  return HcalSimpleRecAlgoImpl::reco<HBHEDataFrame,HBHERecHit>(digi,coder,calibs,
164  pulseCorr_->get(digi.id(), toadd, phaseNS_),
167 }
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 185 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(), cond::rpcobgas::time, HcalCalibrations::timecorr(), and timeshift_ns_hf().

185  {
186 
187  const HcalPulseContainmentCorrection* corr = pulseCorr_->get(digi.id(), toadd, phaseNS_);
188 
189  CaloSamples tool;
190  coder.adc2fC(digi,tool);
191 
192  double ampl=0; int maxI = -1; double maxA = -1e10; float ta=0; float amp_fC=0;
193  for (int i=first; i<tool.size() && i<first+toadd; i++) {
194  int capid=digi[i].capid();
195  ta = (tool[i]-calibs.pedestal(capid))*calibs.respcorrgain(capid);
196  ampl+=ta;
197  amp_fC += tool[i]-calibs.pedestal(capid);
198  if(ta>maxA){
199  maxA=ta;
200  maxI=i;
201  }
202  }
203 
204  float time=-9999.0;
206  if(maxI==0 || maxI==(tool.size()-1)) {
207  LogDebug("HCAL Pulse") << "HcalSimpleRecAlgo::reconstruct :"
208  << " Invalid max amplitude position, "
209  << " max Amplitude: "<< maxI
210  << " first: "<< first
211  << " last: "<<(tool.size()-1)
212  << std::endl;
213  } else {
214  int capid=digi[maxI-1].capid();
215  float t0 = (tool[maxI-1]-calibs.pedestal(capid))*calibs.respcorrgain(capid);
216  capid=digi[maxI+1].capid();
217  float t2 = (tool[maxI+1]-calibs.pedestal(capid))*calibs.respcorrgain(capid);
218 
219  // Handle negative excursions by moving "zero":
220  float zerocorr=std::min(t0,t2);
221  if (zerocorr<0.f) {
222  t0 -= zerocorr;
223  t2 -= zerocorr;
224  maxA -= zerocorr;
225  }
226 
227  // pair the peak with the larger of the two neighboring time samples
228  float wpksamp=0.f;
229  if (t0>t2) {
230  wpksamp = t0+maxA;
231  if (wpksamp != 0.f) wpksamp = maxA/wpksamp;
232  } else {
233  wpksamp = maxA+t2;
234  if (wpksamp != 0.f) wpksamp = 1.+(t2/wpksamp);
235  }
236 
237  time = (maxI - digi.presamples())*25.0 + timeshift_ns_hf(wpksamp);
238 
239  if (corr!=0 && correctForPulse_) {
240 
241  // Apply phase-based amplitude correction:
242 
243  /*
244  HcalDetId cell(digi.id());
245  int ieta = cell.ieta();
246  int iphi = cell.iphi();
247  int depth = cell.depth();
248  std::cout << "*** ieta, iphi, depth = " << ieta << ", " << iphi
249  << ", " << depth
250  << " first, toadd = " << ifirst << ", " << n << std::endl
251  << " ampl, corr, ampl_after_corr = "
252  << ampl << ", " << corr->getCorrection(fc_ampl)
253  << ", "
254  << ampl * corr->getCorrection(fc_ampl) << std::endl;
255  */
256 
257  ampl *= corr->getCorrection(amp_fC);
258  }
259 
260  if (correctForTimeslew_ && (amp_fC>0)) {
261  // -5.12327 - put in calibs.timecorr()
262  double tslew=exp(0.337681-5.94689e-4*amp_fC)+exp(2.44628-1.34888e-2*amp_fC);
263  time -= (float)tslew;
264  }
265 
266  time=time-calibs.timecorr();
267  }
268 
269  return HFRecHit(digi.id(),ampl,time);
270 }
#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
double f[11][100]
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
bool first
Definition: L1TdeRCT.cc:94
JetCorrectorParameters corr
Definition: classes.h:9
int size() const
get the size
Definition: CaloSamples.h:24
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 169 of file HcalSimpleRecAlgo.cc.

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

169  {
170  return HcalSimpleRecAlgoImpl::reco<HODataFrame,HORecHit>(digi,coder,calibs,
172  pulseCorr_->get(digi.id(), toadd, phaseNS_),
174  setForData_, false);
175 }
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 177 of file HcalSimpleRecAlgo.cc.

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

177  {
178  return HcalSimpleRecAlgoImpl::reco<HcalCalibDataFrame,HcalCalibRecHit>(digi,coder,calibs,
180  pulseCorr_->get(digi.id(), toadd, phaseNS_),
182  setForData_, false );
183 }
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
bool first
Definition: L1TdeRCT.cc:94
void HcalSimpleRecAlgo::setForData ( )
void HcalSimpleRecAlgo::setLeakCorrection ( )

Definition at line 52 of file HcalSimpleRecAlgo.cc.

References setLeakCorrection_.

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

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

Member Data Documentation

bool HcalSimpleRecAlgo::correctForPulse_
private

Definition at line 58 of file HcalSimpleRecAlgo.h.

Referenced by reconstruct(), and setRecoParams().

bool HcalSimpleRecAlgo::correctForTimeslew_
private

Definition at line 57 of file HcalSimpleRecAlgo.h.

Referenced by reconstruct(), and setRecoParams().

float HcalSimpleRecAlgo::phaseNS_
private

Definition at line 59 of file HcalSimpleRecAlgo.h.

Referenced by reconstruct(), and setRecoParams().

int HcalSimpleRecAlgo::pileupCleaningID_
private

Definition at line 63 of file HcalSimpleRecAlgo.h.

Referenced by setRecoParams().

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

Definition at line 60 of file HcalSimpleRecAlgo.h.

Referenced by beginRun(), endRun(), HcalSimpleRecAlgo(), and reconstruct().

bool HcalSimpleRecAlgo::setForData_
private

Definition at line 61 of file HcalSimpleRecAlgo.h.

Referenced by reconstruct(), and setForData().

bool HcalSimpleRecAlgo::setLeakCorrection_
private

Definition at line 62 of file HcalSimpleRecAlgo.h.

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