CMS 3D CMS Logo

Public Member Functions | Private Attributes

HcalSimpleRecAlgo Class Reference

#include <HcalSimpleRecAlgo.h>

List of all members.

Public Member Functions

void beginRun (edm::EventSetup const &es)
void endRun ()
 HcalSimpleRecAlgo ()
 HcalSimpleRecAlgo (bool correctForTimeslew, bool correctForContainment, float fixedPhaseNs)
void initPulseCorr (int toadd)
HBHERecHit reconstruct (const HBHEDataFrame &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
HFRecHit reconstruct (const HFDataFrame &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_.

                                                                                                 : 
  correctForTimeslew_(correctForTimeslew),
  correctForPulse_(correctForPulse),
  phaseNS_(phaseNS), setForData_(false), setLeakCorrection_(false)
{ 
  
  pulseCorr_ = std::auto_ptr<HcalPulseContainmentManager>(
               new HcalPulseContainmentManager(MaximumFractionalError)
                                                          );
}
HcalSimpleRecAlgo::HcalSimpleRecAlgo ( )

Simple constructor for PMT-based detectors

Definition at line 23 of file HcalSimpleRecAlgo.cc.

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

{
  pulseCorr_->beginRun(es);
}
void HcalSimpleRecAlgo::endRun ( void  )

Definition at line 33 of file HcalSimpleRecAlgo.cc.

References pulseCorr_.

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

{
  pulseCorr_->endRun();
}
void HcalSimpleRecAlgo::initPulseCorr ( int  toadd)

Definition at line 39 of file HcalSimpleRecAlgo.cc.

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

                                                                                                                                                   {

  const HcalPulseContainmentCorrection* corr = pulseCorr_->get(digi.id(), toadd, phaseNS_);

  CaloSamples tool;
  coder.adc2fC(digi,tool);
  
  double ampl=0; int maxI = -1; double maxA = -1e10; float ta=0; float amp_fC=0;
  for (int i=first; i<tool.size() && i<first+toadd; i++) {
    int capid=digi[i].capid();
    ta = (tool[i]-calibs.pedestal(capid))*calibs.respcorrgain(capid);
    ampl+=ta;
    amp_fC += tool[i]-calibs.pedestal(capid);
    if(ta>maxA){
      maxA=ta;
      maxI=i;
    }
  }

  float time=-9999.0;
  if(maxI==0 || maxI==(tool.size()-1)) {
      LogDebug("HCAL Pulse") << "HcalSimpleRecAlgo::reconstruct :" 
                                               << " Invalid max amplitude position, " 
                                               << " max Amplitude: "<< maxI
                                               << " first: "<< first
                                               << " last: "<<(tool.size()-1)
                                               << std::endl;
  } else {
    int capid=digi[maxI-1].capid();
    float t0 = (tool[maxI-1]-calibs.pedestal(capid))*calibs.respcorrgain(capid);
    capid=digi[maxI+1].capid();
    float t2 = (tool[maxI+1]-calibs.pedestal(capid))*calibs.respcorrgain(capid);

    // Handle negative excursions by moving "zero":
    float zerocorr=std::min(t0,t2);
    if (zerocorr<0.f) {
      t0   -= zerocorr;
      t2   -= zerocorr;
      maxA -= zerocorr;
    }
    
    // pair the peak with the larger of the two neighboring time samples
    float wpksamp=0.f;
    if (t0>t2) {
      wpksamp = t0+maxA;
      if (wpksamp != 0.f) wpksamp = maxA/wpksamp;
    } else {
      wpksamp = maxA+t2;
      if (wpksamp != 0.f) wpksamp = 1.+(t2/wpksamp);
    }

    time = (maxI - digi.presamples())*25.0 + timeshift_ns_hf(wpksamp);

    if (corr!=0 && correctForPulse_) { 
      
      // Apply phase-based amplitude correction:
      
      /*
        HcalDetId cell(digi.id());
        int ieta  = cell.ieta();
        int iphi  = cell.iphi();
        int depth = cell.depth();
        std::cout << "*** ieta, iphi, depth =  " << ieta << ", " << iphi
        << ", " << depth 
                  << "    first, toadd = " << ifirst << ", " << n << std::endl
                  << "    ampl,  corr,  ampl_after_corr = "
                  << ampl << ",   " << corr->getCorrection(fc_ampl)
                  << ",   "
                  << ampl * corr->getCorrection(fc_ampl) << std::endl;
        */
      
      ampl *= corr->getCorrection(amp_fC);
    }

    if (correctForTimeslew_ && (amp_fC>0)) {
      // -5.12327 - put in calibs.timecorr()
      double tslew=exp(0.337681-5.94689e-4*amp_fC)+exp(2.44628-1.34888e-2*amp_fC);
      time -= (float)tslew;
    }

    time=time-calibs.timecorr();
  }

  return HFRecHit(digi.id(),ampl,time); 
}
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.

                                                                                                                                                   {
  return HcalSimpleRecAlgoImpl::reco<HODataFrame,HORecHit>(digi,coder,calibs,
                                                           first,toadd,correctForTimeslew_,correctForPulse_,
                                                           pulseCorr_->get(digi.id(), toadd, phaseNS_),
                                                           HcalTimeSlew::Slow,
                                                           setForData_, false);
}
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_.

                                                                                                                                                                 {
  return HcalSimpleRecAlgoImpl::reco<HcalCalibDataFrame,HcalCalibRecHit>(digi,coder,calibs,
                                                                         first,toadd,correctForTimeslew_,correctForPulse_,
                                                                         pulseCorr_->get(digi.id(), toadd, phaseNS_),
                                                                         HcalTimeSlew::Fast,
                                                                         setForData_, false );
}
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().

                                                                                                                                                       {
  return HcalSimpleRecAlgoImpl::reco<HBHEDataFrame,HBHERecHit>(digi,coder,calibs,
                                                               first,toadd,correctForTimeslew_, correctForPulse_,
                                                               pulseCorr_->get(digi.id(), toadd, phaseNS_),
                                                               HcalTimeSlew::Medium,
                                                               setForData_, setLeakCorrection_);
}
void HcalSimpleRecAlgo::setForData ( )
void HcalSimpleRecAlgo::setLeakCorrection ( )

Definition at line 52 of file HcalSimpleRecAlgo.cc.

References setLeakCorrection_.

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

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

Member Data Documentation

Definition at line 58 of file HcalSimpleRecAlgo.h.

Referenced by reconstruct(), and setRecoParams().

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

Definition at line 63 of file HcalSimpleRecAlgo.h.

Referenced by setRecoParams().

Definition at line 60 of file HcalSimpleRecAlgo.h.

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

Definition at line 61 of file HcalSimpleRecAlgo.h.

Referenced by reconstruct(), and setForData().

Definition at line 62 of file HcalSimpleRecAlgo.h.

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