CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CastorSimParameters.cc
Go to the documentation of this file.
1 #include "CLHEP/Random/RandGaussQ.h"
9 #include <cassert>
10 
11 CastorSimParameters::CastorSimParameters(double simHitToPhotoelectrons,
12  double photoelectronsToAnalog,
13  double samplingFactor,
14  double timePhase,
15  bool syncPhase)
17  simHitToPhotoelectrons, photoelectronsToAnalog, samplingFactor, timePhase, 6, 4, false, syncPhase),
18  theDbService(nullptr),
19  theSamplingFactor(samplingFactor),
20  nominalfCperPE(1) {}
21 
23  : CaloSimParameters(p),
24  theDbService(nullptr),
25  theSamplingFactor(p.getParameter<double>("samplingFactor")),
26  nominalfCperPE(p.getParameter<double>("photoelectronsToAnalog")) {}
27 
29  // return the nominal PMT gain value of CASTOR from the config file.
30  return nominalfCperPE;
31 }
32 
34  // calculate factor (PMT gain) using sampling factor value & available
35  // electron gain
36  return theSamplingFactor / fCtoGeV(detId);
37 }
38 
39 double CastorSimParameters::fCtoGeV(const DetId &detId) const {
40  assert(theDbService != nullptr);
41  HcalGenericDetId hcalGenDetId(detId);
42  const CastorGain *gains = theDbService->getGain(hcalGenDetId);
43  const CastorGainWidth *gwidths = theDbService->getGainWidth(hcalGenDetId);
44  double result = 0.0;
45  if (!gains || !gwidths) {
46  edm::LogError("CastorAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
47  } else {
48  // only one gain will be recorded per channel, so just use capID 0 for now
49  result = gains->getValue(0);
50  }
51  return result;
52 }
double getNominalfCperPE() const
const CastorDbService * theDbService
Log< level::Error, false > LogError
assert(be >=bs)
Main class for Parameters in different subdetectors.
CastorSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, double samplingFactor, double timePhase, bool syncPhase)
tuple result
Definition: mps_fire.py:311
const CastorGain * getGain(const HcalGenericDetId &fId) const
double fCtoGeV(const DetId &detId) const
Definition: DetId.h:17
const CastorGainWidth * getGainWidth(const HcalGenericDetId &fId) const
float getValue(int fCapId) const
get value for capId = 0..3
Definition: CastorGain.h:18
double photoelectronsToAnalog() const
the factor which goes from photoelectrons to whatever gets read by ADCs