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 Member Functions | Private Attributes
HcalTimeSlewSim Class Reference

#include <HcalTimeSlewSim.h>

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.

12  : theParameterMap(parameterMap),theRandGaussQ(0)
13 {
14 }
const CaloVSimParameterMap * theParameterMap
CLHEP::RandGaussQ * theRandGaussQ

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

19 {
20  double totalCharge = 0.;
21  for(int i = 0; i < 4; ++i) {
22  int bin = i + samples.presamples();
23  if(bin < samples.size()) {
24  totalCharge += samples[bin];
25  }
26  }
27  return totalCharge;
28 }
int i
Definition: DBlmapReader.cc:9
int presamples() const
access presample information
Definition: CaloSamples.h:31
int size() const
get the size
Definition: CaloSamples.h:24
void HcalTimeSlewSim::delay ( CaloSamples samples) const

Definition at line 31 of file HcalTimeSlewSim.cc.

References DetId::Calo, charge(), HcalTimeSlew::delay(), 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().

32 {
33  // HO goes slow, HF shouldn't be used at all
34  //ZDC not used for the moment
35 
36  DetId detId(samples.id());
37  if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId) return;
38  HcalDetId hcalDetId(detId);
39 
40  if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter ) {
41 
42  HcalTimeSlew::BiasSetting biasSetting = (hcalDetId.subdet() == HcalOuter) ?
45 
46  double totalCharge = charge(samples);
47  double delay = HcalTimeSlew::delay(totalCharge, biasSetting);
48  // now, the smearing
49  const HcalSimParameters& params=static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId));
50  if (params.doTimeSmear() && theRandGaussQ!=0) {
51  double rms=params.timeSmearRMS(totalCharge);
52  double smearns=theRandGaussQ->fire()*rms;
53 
54  LogDebug("HcalTimeSlewSim") << "TimeSmear charge " << totalCharge << " rms " << rms << " delay " << delay << " smearns " << smearns;
55  delay+=smearns;
56  }
57 
58  samples.offsetTime(delay);
59  }
60 }
#define LogDebug(id)
bool doTimeSmear() const
double timeSmearRMS(double ampl) const
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
const CaloVSimParameterMap * theParameterMap
Definition: DetId.h:20
static const int SubdetectorId
Definition: HcalZDCDetId.h:22
CLHEP::RandGaussQ * theRandGaussQ
CaloSamples & offsetTime(double offset)
shift all the samples by a time, in ns, interpolating
Definition: CaloSamples.cc:35
void delay(CaloSamples &samples) const
double charge(const CaloSamples &samples) const
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
static double delay(double fC, BiasSetting bias=Medium)
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
Definition: HcalTimeSlew.cc:8
void HcalTimeSlewSim::setRandomEngine ( CLHEP::HepRandomEngine &  engine)

Definition at line 63 of file HcalTimeSlewSim.cc.

References theRandGaussQ.

Referenced by HcalDigitizer::HcalDigitizer().

63  {
64  if (theRandGaussQ==0) {
65  theRandGaussQ=new CLHEP::RandGaussQ(engine);
66  }
67 }
CLHEP::RandGaussQ * theRandGaussQ

Member Data Documentation

const CaloVSimParameterMap* HcalTimeSlewSim::theParameterMap
private

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