CMS 3D CMS Logo

CastorSimParameters.cc
Go to the documentation of this file.
1 #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  nominalfCperPE(1) {}
20 
22  : CaloSimParameters(p),
24  theSamplingFactor(p.getParameter<double>("samplingFactor")),
25  nominalfCperPE(p.getParameter<double>("photoelectronsToAnalog")) {}
26 
28  // return the nominal PMT gain value of CASTOR from the config file.
29  return nominalfCperPE;
30 }
31 
33  // calculate factor (PMT gain) using sampling factor value & available
34  // electron gain
35  return theSamplingFactor / fCtoGeV(detId);
36 }
37 
38 double CastorSimParameters::fCtoGeV(const DetId &detId) const {
39  assert(theDbService != nullptr);
40  HcalGenericDetId hcalGenDetId(detId);
41  const CastorGain *gains = theDbService->getGain(hcalGenDetId);
42  const CastorGainWidth *gwidths = theDbService->getGainWidth(hcalGenDetId);
43  double result = 0.0;
44  if (!gains || !gwidths) {
45  edm::LogError("CastorAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
46  } else {
47  // only one gain will be recorded per channel, so just use capID 0 for now
48  result = gains->getValue(0);
49  }
50  return result;
51 }
double getNominalfCperPE() const
const CastorDbService * theDbService
#define nullptr
Main class for Parameters in different subdetectors.
CastorSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, double samplingFactor, double timePhase, bool syncPhase)
const CastorGain * getGain(const HcalGenericDetId &fId) const
double fCtoGeV(const DetId &detId) const
Definition: DetId.h:18
const CastorGainWidth * getGainWidth(const HcalGenericDetId &fId) const
float getValue(int fCapId) const
get value for capId = 0..3
Definition: CastorGain.h:19
double photoelectronsToAnalog() const
the factor which goes from photoelectrons to whatever gets read by ADCs