CMS 3D CMS Logo

HcalSimParameters.cc
Go to the documentation of this file.
9 #include "CLHEP/Random/RandGaussQ.h"
10 using namespace std;
11 
13  double samplingFactor,
14  double timePhase,
15  int readoutFrameSize,
16  int binOfMaximum,
17  bool doPhotostatistics,
18  bool syncPhase,
19  int firstRing,
20  const std::vector<double>& samplingFactors,
21  double sipmTau)
23  0.0,
25  timePhase,
29  syncPhase),
30  theDbService(nullptr),
31  theSiPMcharacteristics(nullptr),
32  theFirstRing(firstRing),
33  theSamplingFactors(samplingFactors),
34  theSiPMSmearing(false),
35  doTimeSmear_(true),
36  theSiPMTau(sipmTau) {
38 
39  edm::LogInfo("HcalSimParameters:") << " doSiPMsmearing = " << theSiPMSmearing;
40 }
41 
44  theDbService(nullptr),
45  theFirstRing(p.getParameter<int>("firstRing")),
46  theSamplingFactors(p.getParameter<std::vector<double> >("samplingFactors")),
47  theSiPMSmearing(p.getParameter<bool>("doSiPMSmearing")),
48  doTimeSmear_(p.getParameter<bool>("timeSmearing")),
49  theSiPMTau(p.getParameter<double>("sipmTau")),
50  threshold_currentTDC_(p.getParameter<double>("threshold_currentTDC")),
51  delayQIE_(p.getParameter<int>("delayQIE")) {
53 
54  edm::LogInfo("HcalSimParameters:") << " doSiPMsmearing = " << theSiPMSmearing;
55 }
56 
58  assert(service);
60  theSiPMcharacteristics = service->getHcalSiPMCharacteristics();
62 }
63 
65  // the gain is in units of GeV/fC. We want a constant with pe/dGeV
66  // pe/dGeV = (GeV/dGeV) / (GeV/fC) / (fC/pe)
68  if (HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenForward ||
69  HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenZDC) {
70  result = samplingFactor(detId) / fCtoGeV(detId) / photoelectronsToAnalog(detId);
71  }
72  return result;
73 }
74 
75 double HcalSimParameters::fCtoGeV(const DetId& detId) const {
76  assert(theDbService != nullptr);
77  HcalGenericDetId hcalGenDetId(detId);
78  const HcalGain* gains = theDbService->getGain(hcalGenDetId);
79  const HcalGainWidth* gwidths = theDbService->getGainWidth(hcalGenDetId);
80  double result = 0.0;
81  if (!gains || !gwidths) {
82  edm::LogError("HcalAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
83  } else {
84  // only one gain will be recorded per channel, so just use capID 0 for now
85  result = gains->getValue(0);
86  // if(doNoise_)
88  // result += CLHEP::RandGaussQ::shoot(0., gwidths->getValue(0));
89  // }
90  }
91  return result;
92 }
93 
94 double HcalSimParameters::samplingFactor(const DetId& detId) const {
95  HcalDetId hcalDetId(detId);
96  return theSamplingFactors.at(hcalDetId.ietaAbs() - theFirstRing);
97 }
98 
100  //now always taken from database for HPDs or SiPMs (HB, HE, HO)
102  return theDbService->getHcalSiPMParameter(detId)->getFCByPE();
103 }
104 
105 //static const double GeV2fC = 1.0/0.145;
106 static const double GeV2fC = 1.0 / 0.4;
107 
109  // GeV->ampl (fC), time (ns)
110  theSmearSettings.emplace_back(4.00 * GeV2fC, 4.050);
111  theSmearSettings.emplace_back(20.00 * GeV2fC, 3.300);
112  theSmearSettings.emplace_back(25.00 * GeV2fC, 2.925);
113  theSmearSettings.emplace_back(30.00 * GeV2fC, 2.714);
114  theSmearSettings.emplace_back(37.00 * GeV2fC, 2.496);
115  theSmearSettings.emplace_back(44.50 * GeV2fC, 2.278);
116  theSmearSettings.emplace_back(56.00 * GeV2fC, 2.138);
117  theSmearSettings.emplace_back(63.50 * GeV2fC, 2.022);
118  theSmearSettings.emplace_back(81.00 * GeV2fC, 1.788);
119  theSmearSettings.emplace_back(88.50 * GeV2fC, 1.695);
120  theSmearSettings.emplace_back(114.50 * GeV2fC, 1.716);
121  theSmearSettings.emplace_back(175.50 * GeV2fC, 1.070);
122  theSmearSettings.emplace_back(350.00 * GeV2fC, 1.564);
123  theSmearSettings.emplace_back(99999.00 * GeV2fC, 1.564);
124 }
125 
126 double HcalSimParameters::timeSmearRMS(double ampl) const {
128  double smearsigma = 0;
129 
130  for (i = 0; i < theSmearSettings.size(); i++)
131  if (theSmearSettings[i].first > ampl)
132  break;
133 
134  // Smearing occurs only within the envelope definitions.
135  if (i != 0 && (i < theSmearSettings.size())) {
136  double energy1 = theSmearSettings[i - 1].first;
137  double sigma1 = theSmearSettings[i - 1].second;
138  double energy2 = theSmearSettings[i].first;
139  double sigma2 = theSmearSettings[i].second;
140 
141  if (energy2 != energy1)
142  smearsigma = sigma1 + ((sigma2 - sigma1) * (ampl - energy1) / (energy2 - energy1));
143  else
144  smearsigma = (sigma2 + sigma1) / 2.;
145  }
146 
147  return smearsigma;
148 }
149 
150 int HcalSimParameters::pixels(const DetId& detId) const {
154 }
155 
156 double HcalSimParameters::sipmDarkCurrentuA(const DetId& detId) const {
159 }
160 
161 double HcalSimParameters::sipmCrossTalk(const DetId& detId) const {
165 }
166 std::vector<float> HcalSimParameters::sipmNonlinearity(const DetId& detId) const {
170 }
171 
172 unsigned int HcalSimParameters::signalShape(const DetId& detId) const {
174  return theDbService->getHcalMCParam(detId)->signalShape();
175 }
service
Definition: service.py:1
electrons_cff.bool
bool
Definition: electrons_cff.py:393
mps_fire.i
i
Definition: mps_fire.py:428
HcalSimParameters.h
MessageLogger.h
ecalSimParameterMap_cff.syncPhase
syncPhase
Definition: ecalSimParameterMap_cff.py:10
funct::false
false
Definition: Factorize.h:29
HcalDbService::getGainWidth
const HcalGainWidth * getGainWidth(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:312
HcalGain::getValue
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGain.h:21
HcalGenericDetId
Definition: HcalGenericDetId.h:15
HcalSimParameters::theFirstRing
int theFirstRing
Definition: HcalSimParameters.h:57
CaloSimParameters::photoelectronsToAnalog
double photoelectronsToAnalog() const
the factor which goes from photoelectrons to whatever gets read by ADCs
Definition: CaloSimParameters.h:38
HcalSimParameters::sipmNonlinearity
std::vector< float > sipmNonlinearity(const DetId &detId) const
Definition: HcalSimParameters.cc:166
hcalSimParameters_cfi.simHitToPhotoelectrons
simHitToPhotoelectrons
Definition: hcalSimParameters_cfi.py:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HcalSimParameters::theSiPMcharacteristics
const HcalSiPMCharacteristics * theSiPMcharacteristics
Definition: HcalSimParameters.h:56
ecalSimParameterMap_cff.samplingFactor
samplingFactor
Definition: ecalSimParameterMap_cff.py:7
HcalSimParameters::pixels
int pixels(const DetId &detId) const
Definition: HcalSimParameters.cc:150
hcalSimParameters_cfi.sipmTau
sipmTau
Definition: hcalSimParameters_cfi.py:23
HcalSiPMParameter::getFCByPE
float getFCByPE() const
get fcByPE
Definition: HcalSiPMParameter.h:12
HcalSiPMCharacteristics::getNonLinearities
std::vector< float > getNonLinearities(int type) const
get nonlinearity constants
Definition: HcalSiPMCharacteristics.cc:77
cms::cuda::assert
assert(be >=bs)
HcalSiPMParameter::getDarkCurrent
float getDarkCurrent() const
get dark current
Definition: HcalSiPMParameter.h:14
HcalDbService::getGain
const HcalGain * getGain(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:305
HcalGenericDetId.h
CaloSimParameters::simHitToPhotoelectrons
double simHitToPhotoelectrons() const
Definition: CaloSimParameters.h:34
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
hcalSimParameters_cfi.firstRing
firstRing
Definition: hcalSimParameters_cfi.py:43
HcalSiPMCharacteristics::getCrossTalk
float getCrossTalk(int type) const
get cross talk
Definition: HcalSiPMCharacteristics.cc:88
dqmdumpme.first
first
Definition: dqmdumpme.py:55
HcalSimParameters::sipmCrossTalk
double sipmCrossTalk(const DetId &detId) const
Definition: HcalSimParameters.cc:161
GeV2fC
static const double GeV2fC
Definition: HcalSimParameters.cc:106
HcalDbService::getHcalMCParam
const HcalMCParam * getHcalMCParam(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:398
HcalGenericDetId::HcalGenZDC
Definition: HcalGenericDetId.h:24
DetId
Definition: DetId.h:17
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
hcalSimParameters_cfi.readoutFrameSize
readoutFrameSize
Definition: hcalSimParameters_cfi.py:14
HcalGain.h
HcalSimParameters::signalShape
unsigned int signalShape(const DetId &detId) const
Definition: HcalSimParameters.cc:172
CaloSimParameters
Main class for Parameters in different subdetectors.
Definition: CaloSimParameters.h:14
HcalSimParameters::samplingFactor
virtual double samplingFactor(const DetId &detId) const
Definition: HcalSimParameters.cc:94
HcalSiPMType.h
HcalSimParameters::theSmearSettings
HcalTimeSmearSettings theSmearSettings
Definition: HcalSimParameters.h:61
HcalGain
Definition: HcalGain.h:16
HcalSimParameters::HcalSimParameters
HcalSimParameters(double simHitToPhotoelectrons, double samplingFactor, double timePhase, int readoutFrameSize, int binOfMaximum, bool doPhotostatistics, bool syncPhase, int firstRing, const std::vector< double > &samplingFactors, double sipmTau)
Definition: HcalSimParameters.cc:12
funct::true
true
Definition: Factorize.h:173
hcalSimParameters_cfi.samplingFactors
samplingFactors
Definition: hcalSimParameters_cfi.py:47
edm::ParameterSet
Definition: ParameterSet.h:47
HcalSimParameters::sipmDarkCurrentuA
double sipmDarkCurrentuA(const DetId &detId) const
Definition: HcalSimParameters.cc:156
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
HcalDetId.h
HcalSimParameters::theSamplingFactors
std::vector< double > theSamplingFactors
Definition: HcalSimParameters.h:58
HcalDetId
Definition: HcalDetId.h:12
createfilelist.int
int
Definition: createfilelist.py:10
ecalSimParameterMap_cff.timePhase
timePhase
Definition: ecalSimParameterMap_cff.py:8
HcalSiPMParameter::getType
int getType() const
get SiPM type
Definition: HcalSiPMParameter.h:10
HcalSimParameters::defaultTimeSmearing
void defaultTimeSmearing()
Definition: HcalSimParameters.cc:108
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
HcalSimParameters::theSiPMSmearing
bool theSiPMSmearing
Definition: HcalSimParameters.h:59
HcalSubdetector.h
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
ecalEBTriggerPrimitiveDigis_cfi.binOfMaximum
binOfMaximum
Definition: ecalEBTriggerPrimitiveDigis_cfi.py:9
HcalMCParam::signalShape
unsigned int signalShape() const
Definition: HcalMCParam.h:38
HcalDbService
Definition: HcalDbService.h:26
HcalSimParameters::timeSmearRMS
double timeSmearRMS(double ampl) const
Definition: HcalSimParameters.cc:126
HcalDbService::getHcalSiPMParameter
const HcalSiPMParameter * getHcalSiPMParameter(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:382
std
Definition: JetResolutionObject.h:76
ecalSimParameterMap_cff.doPhotostatistics
doPhotostatistics
Definition: ecalSimParameterMap_cff.py:11
HcalSimParameters::fCtoGeV
double fCtoGeV(const DetId &detId) const
Definition: HcalSimParameters.cc:75
mps_fire.result
result
Definition: mps_fire.py:311
HcalSimParameters::theDbService
const HcalDbService * theDbService
Definition: HcalSimParameters.h:55
HcalGainWidth.h
HcalDetId::ietaAbs
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
HcalGenericDetId::HcalGenForward
Definition: HcalGenericDetId.h:22
HcalSiPMCharacteristics::getPixels
int getPixels(int type) const
get # of pixels
Definition: HcalSiPMCharacteristics.cc:72
HcalSimParameters::setDbService
void setDbService(const HcalDbService *service)
Definition: HcalSimParameters.cc:57
HcalGainWidth
Definition: HcalGainWidth.h:15