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

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, data, HcalTimeSlew::delay(), HcalSimParameters::doTimeSmear(), f, HcalBarrel, HcalEndcap, HcalOuter, i, CaloSamples::id(), LogDebug, HcalTimeSlew::Medium, plotscripts::rms(), pileupReCalc_HLTpaths::scale, CaloVSimParameterMap::simParameters(), CaloSamples::size(), HcalTimeSlew::Slow, HcalDetId::subdet(), HcalZDCDetId::SubdetectorId, edmStreamStallGrapher::t, 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 
50  int maxbin = samples.size();
51  CaloSamples data(detId, maxbin); // for a temporary copy
52  data = samples;
53 
54  // smearing
55  double eps = 1.e-6;
56  double scale_factor = 0.6;
57  double scale = data[4] / scale_factor;
58  double smearns = 0.;
59 
60  const HcalSimParameters& params =
61  static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId));
62  if (params.doTimeSmear()) {
63  double rms = params.timeSmearRMS(scale);
64  smearns = CLHEP::RandGaussQ::shoot(engine)*rms;
65  LogDebug("HcalTimeSlewSim") << "TimeSmear charge "
66  << scale << " rms " << rms
67  << " smearns " << smearns;
68  }
69 
70  for(int i = 0; i < samples.size()-1; ++i) {
71  double totalCharge = data[i]/scale_factor;
72  // until we get more precise/reliable QIE8 simulation...
73 
74  double delay = smearns;
75  if(totalCharge <= 0.) totalCharge = eps; // protecion against negaive v.
76  delay += HcalTimeSlew::delay(totalCharge, biasSetting);
77  if(delay <= 0.) delay = eps;
78 
79  double t = i*25. - delay;
80  int firstbin = floor(t/25.);
81  double f = t/25. - firstbin;
82  int nextbin = firstbin + 1;
83  double v2 = (nextbin < 0 || nextbin >= maxbin) ? 0. : data[nextbin];
84  data[i] = v2*f;
85  data[i+1] = data[i+1] + (v2 - data[i]);
86  }
87 
88  samples = data;
89  }
90 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
void delay(CaloSamples &samples, CLHEP::HepRandomEngine *) const
bool doTimeSmear() const
double timeSmearRMS(double ampl) const
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
double f[11][100]
const CaloVSimParameterMap * theParameterMap
Definition: DetId.h:18
static const int SubdetectorId
Definition: HcalZDCDetId.h:20
int size() const
get the size
Definition: CaloSamples.h:24
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
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().