CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HcalTimeSlewSim Class Reference

#include <HcalTimeSlewSim.h>

List of all members.

Public Member Functions

void delay (CaloSamples &samples) const
 HcalTimeSlewSim (const CaloVSimParameterMap *parameterMap)
void setRandomEngine (CLHEP::HepRandomEngine &engine)

Private Member Functions

double charge (const CaloSamples &samples) const

Private Attributes

const CaloVSimParameterMaptheParameterMap
CLHEP::RandGaussQ * theRandGaussQ

Detailed Description

Applies a correction for time slewing Makes bigger signals come at a delayed time

Rick Wilkinson

Definition at line 15 of file HcalTimeSlewSim.h.


Constructor & Destructor Documentation

HcalTimeSlewSim::HcalTimeSlewSim ( const CaloVSimParameterMap parameterMap)

Definition at line 11 of file HcalTimeSlewSim.cc.

  : theParameterMap(parameterMap),theRandGaussQ(0) 
{
}

Member Function Documentation

double HcalTimeSlewSim::charge ( const CaloSamples samples) const [private]

Definition at line 18 of file HcalTimeSlewSim.cc.

References newFWLiteAna::bin, i, CaloSamples::presamples(), and CaloSamples::size().

Referenced by delay().

{
  double totalCharge = 0.;
  for(int i = 0; i < 4; ++i) {
    int bin = i + samples.presamples();
    if(bin < samples.size()) {
      totalCharge += samples[bin];
    }
  }
  return totalCharge;
}
void HcalTimeSlewSim::delay ( CaloSamples samples) const

Definition at line 31 of file HcalTimeSlewSim.cc.

References DetId::Calo, charge(), HcalSimParameters::doTimeSmear(), HcalBarrel, HcalEndcap, HcalOuter, CaloSamples::id(), LogDebug, HcalTimeSlew::Medium, CaloSamples::offsetTime(), plotscripts::rms(), CaloVSimParameterMap::simParameters(), HcalTimeSlew::Slow, HcalDetId::subdet(), HcalZDCDetId::SubdetectorId, theParameterMap, theRandGaussQ, and HcalSimParameters::timeSmearRMS().

Referenced by HcalAmplifier::amplify().

{
  // HO goes slow, HF shouldn't be used at all
  //ZDC not used for the moment

  DetId detId(samples.id());
  if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId) return;
  HcalDetId hcalDetId(detId);

  if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter ) {

    HcalTimeSlew::BiasSetting biasSetting = (hcalDetId.subdet() == HcalOuter) ?
      HcalTimeSlew::Slow :
      HcalTimeSlew::Medium;

    double totalCharge = charge(samples);
    double delay = HcalTimeSlew::delay(totalCharge, biasSetting);
    // now, the smearing
    const HcalSimParameters& params=static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId));
    if (params.doTimeSmear() && theRandGaussQ!=0) {
      double rms=params.timeSmearRMS(totalCharge);
      double smearns=theRandGaussQ->fire()*rms;

      LogDebug("HcalTimeSlewSim") << "TimeSmear charge " << totalCharge << " rms " << rms << " delay " << delay << " smearns " << smearns;
      delay+=smearns;
    }

    samples.offsetTime(delay);
  }
}
void HcalTimeSlewSim::setRandomEngine ( CLHEP::HepRandomEngine &  engine)

Definition at line 63 of file HcalTimeSlewSim.cc.

References theRandGaussQ.

Referenced by HcalDigitizer::HcalDigitizer().

                                                                   {
  if (theRandGaussQ==0) {
    theRandGaussQ=new CLHEP::RandGaussQ(engine);
  }
}

Member Data Documentation

Definition at line 27 of file HcalTimeSlewSim.h.

Referenced by delay().

CLHEP::RandGaussQ* HcalTimeSlewSim::theRandGaussQ [private]

Definition at line 28 of file HcalTimeSlewSim.h.

Referenced by delay(), and setRandomEngine().