CMS 3D CMS Logo

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 HcalTimeSlew *hcalTimeSlew_delay) const
 
 HcalTimeSlewSim (const CaloVSimParameterMap *parameterMap, double minFCToDelay)
 

Private Member Functions

double charge (const CaloSamples &samples) const
 

Private Attributes

double minFCToDelay_
 
const CaloVSimParameterMaptheParameterMap
 

Detailed Description

Definition at line 19 of file HcalTimeSlewSim.h.

Constructor & Destructor Documentation

◆ HcalTimeSlewSim()

HcalTimeSlewSim::HcalTimeSlewSim ( const CaloVSimParameterMap parameterMap,
double  minFCToDelay 
)

Definition at line 13 of file HcalTimeSlewSim.cc.

14  : theParameterMap(parameterMap), minFCToDelay_(minFCToDelay) {}

Member Function Documentation

◆ charge()

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

Definition at line 17 of file HcalTimeSlewSim.cc.

17  {
18  double totalCharge = 0.;
19  for (int i = 0; i < 4; ++i) {
20  int bin = i + samples.presamples();
21  if (bin < samples.size()) {
22  totalCharge += samples[bin];
23  }
24  }
25  return totalCharge;
26 }

References newFWLiteAna::bin, mps_fire::i, and EgammaValidation_cff::samples.

◆ delay()

void HcalTimeSlewSim::delay ( CaloSamples samples,
CLHEP::HepRandomEngine *  engine,
const HcalTimeSlew hcalTimeSlew_delay 
) const

Definition at line 28 of file HcalTimeSlewSim.cc.

30  {
31  // HO goes slow, HF shouldn't be used at all
32  //ZDC not used for the moment
33 
34  DetId detId(cs.id());
35  if (detId.det() == DetId::Calo && detId.subdetId() == HcalZDCDetId::SubdetectorId)
36  return;
37  HcalDetId hcalDetId(detId);
38 
39  if (hcalDetId.subdet() == HcalBarrel || hcalDetId.subdet() == HcalEndcap || hcalDetId.subdet() == HcalOuter) {
40  HcalTimeSlew::BiasSetting biasSetting =
41  (hcalDetId.subdet() == HcalOuter) ? HcalTimeSlew::Slow : HcalTimeSlew::Medium;
42 
43  // double totalCharge = charge(cs); // old TS...
44 
45  int maxbin = cs.size();
46  CaloSamples data(detId, maxbin); // for a temporary copy
47  data = cs;
48 
49  // smearing
50  int soi = cs.presamples();
51  double eps = 1.e-6;
52  double scale_factor = 0.6;
53  double scale = cs[soi] / scale_factor;
54  double smearns = 0.;
55  double cut = minFCToDelay_; //5. fC (above mean) for signal to be delayed
56 
57  const HcalSimParameters& params = static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId));
58  if (params.doTimeSmear()) {
59  double rms = params.timeSmearRMS(scale);
60  smearns = CLHEP::RandGaussQ::shoot(engine) * rms;
61  LogDebug("HcalTimeSlewSim") << "TimeSmear charge " << scale << " rms " << rms << " smearns " << smearns;
62  }
63 
64  // cycle over TS', it - current TS index
65  for (int it = 0; it < maxbin - 1;) {
66  double datai = cs[it];
67  int nts = 0;
68  double tshift = smearns;
69  double totalCharge = datai / scale_factor;
70 
71  // until we get more precise/reliable QIE8 simulation...
72  if (totalCharge <= 0.)
73  totalCharge = eps; // protecion against negaive v.
74  tshift += hcalTimeSlew_delay->delay(totalCharge, biasSetting);
75  if (tshift <= 0.)
76  tshift = eps;
77 
78  if (cut > -999.) { //preserve compatibility
79  if ((datai > cut) && (it == 0 || (datai > cs[it - 1]))) {
80  // number of TS affected by current move depends on the signal shape:
81  // rising or peaking
82  nts = 2; // rising
83  if (datai > cs[it + 1])
84  nts = 3; // peaking
85 
86  // 1 or 2 TS to move from here,
87  // 2d or 3d TS gets leftovers to preserve the sum
88  for (int j = it; j < it + nts && j < maxbin; ++j) {
89  // snippet borrowed from CaloSamples::offsetTime(offset)
90  // CalibFormats/CaloObjects/src/CaloSamples.cc
91  double t = j * 25. - tshift;
92  int firstbin = floor(t / 25.);
93  double f = t / 25. - firstbin;
94  int nextbin = firstbin + 1;
95  double v1 = (firstbin < 0 || firstbin >= maxbin) ? 0. : cs[firstbin];
96  double v2 = (nextbin < 0 || nextbin >= maxbin) ? 0. : cs[nextbin];
97 
98  // Keeping the overal sum intact
99  if (nts == 2) {
100  if (j == it)
101  data[j] = v2 * f;
102  else
103  data[j] = v1 * (1. - f) + v2;
104  } else { // nts = 3
105  if (j == it)
106  data[j] = v2 * f;
107  if (j == it + 1)
108  data[j] = v1 * (1. - f) + v2 * f;
109  if (j == it + nts - 1)
110  data[j] = v1 * (1. - f) + v2;
111  }
112 
113  } // end of local move of TS', now update...
114  cs = data;
115 
116  } // end of rising edge or peak finding
117  } else {
118  double t = it * 25. - tshift;
119  int firstbin = floor(t / 25.);
120  double f = t / 25. - firstbin;
121  int nextbin = firstbin + 1;
122  double v2 = (nextbin < 0 || nextbin >= maxbin) ? 0. : data[nextbin];
123  data[it] = v2 * f;
124  data[it + 1] += (v2 - data[it]);
125  cs = data;
126  }
127 
128  if (nts < 3)
129  it++;
130  else
131  it += 2;
132  }
133 
134  // final update of the shifted TS array
135  cs = data;
136  }
137 }

References DetId::Calo, fwrapper::cs, TkAlMuonSelectors_cfi::cut, data, HcalTimeSlew::delay(), f, HcalBarrel, HcalEndcap, HcalOuter, dqmiolumiharvest::j, LogDebug, HcalTimeSlew::Medium, minFCToDelay_, CalibrationSummaryClient_cfi::params, SiStripPI::rms, Scenarios_cff::scale, CaloVSimParameterMap::simParameters(), HcalTimeSlew::Slow, HcalDetId::subdet(), HcalZDCDetId::SubdetectorId, OrderedSet::t, and theParameterMap.

Referenced by HcalAmplifier::amplify().

Member Data Documentation

◆ minFCToDelay_

double HcalTimeSlewSim::minFCToDelay_
private

Definition at line 29 of file HcalTimeSlewSim.h.

Referenced by delay().

◆ theParameterMap

const CaloVSimParameterMap* HcalTimeSlewSim::theParameterMap
private

Definition at line 28 of file HcalTimeSlewSim.h.

Referenced by delay().

mps_fire.i
i
Definition: mps_fire.py:355
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HcalTimeSlew::Medium
Definition: HcalTimeSlew.h:71
fwrapper::cs
unique_ptr< ClusterSequence > cs
Definition: fastjetfortran_madfks.cc:45
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
HcalBarrel
Definition: HcalAssistant.h:33
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
DetId::Calo
Definition: DetId.h:29
HcalTimeSlew::BiasSetting
BiasSetting
Definition: HcalTimeSlew.h:71
HcalTimeSlew::delay
float delay(float fC, BiasSetting bias=Medium) const
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
Definition: HcalTimeSlew.cc:20
EgammaValidation_cff.samples
samples
Definition: EgammaValidation_cff.py:19
DetId
Definition: DetId.h:17
CaloVSimParameterMap::simParameters
virtual const CaloSimParameters & simParameters(const DetId &id) const =0
HcalOuter
Definition: HcalAssistant.h:35
HcalZDCDetId::SubdetectorId
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
HcalTimeSlew::Slow
Definition: HcalTimeSlew.h:71
OrderedSet.t
t
Definition: OrderedSet.py:90
HcalTimeSlewSim::minFCToDelay_
double minFCToDelay_
Definition: HcalTimeSlewSim.h:29
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
HcalDetId
Definition: HcalDetId.h:12
CaloSamples
Definition: CaloSamples.h:14
HcalTimeSlewSim::theParameterMap
const CaloVSimParameterMap * theParameterMap
Definition: HcalTimeSlewSim.h:28
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
HcalSimParameters
Definition: HcalSimParameters.h:10
HcalEndcap
Definition: HcalAssistant.h:34
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
hcalUnsuppressedDigis_cfi.minFCToDelay
minFCToDelay
Definition: hcalUnsuppressedDigis_cfi.py:29
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66