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, CLHEP::HepRandomEngine *) const
 
 HcalTimeSlewSim (const CaloVSimParameterMap *parameterMap)
 

Private Member Functions

double charge (const CaloSamples &samples) const
 

Private Attributes

const CaloVSimParameterMaptheParameterMap
 

Detailed Description

Definition at line 18 of file HcalTimeSlewSim.h.

Constructor & Destructor Documentation

HcalTimeSlewSim::HcalTimeSlewSim ( const CaloVSimParameterMap parameterMap)

Definition at line 13 of file HcalTimeSlewSim.cc.

14  : theParameterMap(parameterMap)
15 {
16 }
const CaloVSimParameterMap * theParameterMap

Member Function Documentation

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

Definition at line 20 of file HcalTimeSlewSim.cc.

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

Referenced by delay().

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

Definition at line 33 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, and HcalSimParameters::timeSmearRMS().

Referenced by HcalAmplifier::amplify().

34 {
35  // HO goes slow, HF shouldn't be used at all
36  //ZDC not used for the moment
37 
38  DetId detId(samples.id());
39  if(detId.det()==DetId::Calo && detId.subdetId()==HcalZDCDetId::SubdetectorId) return;
40  HcalDetId hcalDetId(detId);
41 
42  if(hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter ) {
43 
44  HcalTimeSlew::BiasSetting biasSetting = (hcalDetId.subdet() == HcalOuter) ?
47 
48  double totalCharge = charge(samples);
49  if(totalCharge <= 0.) totalCharge = 1.e-6; // protecion against negaive v.
50  double delay = HcalTimeSlew::delay(totalCharge, biasSetting);
51  // now, the smearing
52  const HcalSimParameters& params=static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId));
53  if (params.doTimeSmear()) {
54  double rms=params.timeSmearRMS(totalCharge);
55  double smearns=CLHEP::RandGaussQ::shoot(engine)*rms;
56 
57  LogDebug("HcalTimeSlewSim") << "TimeSmear charge " << totalCharge << " rms " << rms << " delay " << delay << " smearns " << smearns;
58  delay+=smearns;
59  }
60 
61  samples.offsetTime(delay);
62  }
63 }
#define LogDebug(id)
void delay(CaloSamples &samples, CLHEP::HepRandomEngine *) const
bool doTimeSmear() const
double timeSmearRMS(double ampl) const
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
const CaloVSimParameterMap * theParameterMap
Definition: DetId.h:18
static const int SubdetectorId
Definition: HcalZDCDetId.h:20
CaloSamples & offsetTime(double offset)
shift all the samples by a time, in ns, interpolating
Definition: CaloSamples.cc:67
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

Member Data Documentation

const CaloVSimParameterMap* HcalTimeSlewSim::theParameterMap
private

Definition at line 28 of file HcalTimeSlewSim.h.

Referenced by delay().