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:36
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  if(totalCharge <= 0.) totalCharge = 1.e-6; // protecion against negaive v.
48  double delay = HcalTimeSlew::delay(totalCharge, biasSetting);
49  // now, the smearing
50  const HcalSimParameters& params=static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId));
51  if (params.doTimeSmear() && theRandGaussQ!=0) {
52  double rms=params.timeSmearRMS(totalCharge);
53  double smearns=theRandGaussQ->fire()*rms;
54 
55  LogDebug("HcalTimeSlewSim") << "TimeSmear charge " << totalCharge << " rms " << rms << " delay " << delay << " smearns " << smearns;
56  delay+=smearns;
57  }
58 
59  samples.offsetTime(delay);
60  }
61 }
#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:18
static const int SubdetectorId
Definition: HcalZDCDetId.h:20
CLHEP::RandGaussQ * theRandGaussQ
CaloSamples & offsetTime(double offset)
shift all the samples by a time, in ns, interpolating
Definition: CaloSamples.cc:67
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 64 of file HcalTimeSlewSim.cc.

References theRandGaussQ.

Referenced by HcalDigitizer::HcalDigitizer().

64  {
65  if (theRandGaussQ==0) {
66  theRandGaussQ=new CLHEP::RandGaussQ(engine);
67  }
68 }
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().