CMS 3D CMS Logo

HFSimParameters.cc
Go to the documentation of this file.
8 #include "CLHEP/Random/RandGaussQ.h"
9 
12  double samplingFactor,
13  double timePhase,
14  bool syncPhase)
16  simHitToPhotoelectrons, photoelectronsToAnalog, samplingFactor, timePhase, 6, 4, false, syncPhase),
17  theDbService(nullptr),
18  theSamplingFactor(samplingFactor) {}
19 
21  : CaloSimParameters(p), theDbService(nullptr), theSamplingFactor(p.getParameter<double>("samplingFactor")) {}
22 
23 double HFSimParameters::photoelectronsToAnalog(const DetId& detId) const {
24  // pe/fC = pe/GeV * GeV/fC = (0.24 pe/GeV * 6 for photomult * 0.2146GeV/fC)
25  return 1. / (theSamplingFactor * simHitToPhotoelectrons(detId) * fCtoGeV(detId));
26 }
27 
28 double HFSimParameters::fCtoGeV(const DetId& detId) const {
29  assert(theDbService != nullptr);
30  HcalGenericDetId hcalGenDetId(detId);
31  const HcalGain* gains = theDbService->getGain(hcalGenDetId);
32  const HcalGainWidth* gwidths = theDbService->getGainWidth(hcalGenDetId);
33  double result = 0.0;
34  if (!gains || !gwidths) {
35  edm::LogError("HcalAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
36  } else {
37  // only one gain will be recorded per channel, so just use capID 0 for now
38  result = gains->getValue(0);
39  // if(doNoise_)
41  // result += CLHEP::RandGaussQ::shoot(0., gwidths->getValue(0));
42  // }
43  }
44  return result;
45 }
46 
const HcalGainWidth * getGainWidth(const HcalGenericDetId &fId) const
#define nullptr
double fCtoGeV(const DetId &detId) const
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGain.h:21
Main class for Parameters in different subdetectors.
double simHitToPhotoelectrons() const
HFSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, double samplingFactor, double timePhase, bool syncPhase)
Definition: DetId.h:17
const HcalDbService * theDbService
double theSamplingFactor
const HcalGain * getGain(const HcalGenericDetId &fId) const
double samplingFactor() const
double photoelectronsToAnalog() const
the factor which goes from photoelectrons to whatever gets read by ADCs