CMS 3D CMS Logo

CastorSimParameters.cc
Go to the documentation of this file.
8 #include "CLHEP/Random/RandGaussQ.h"
9 
10 
12 : CaloSimParameters(simHitToPhotoelectrons, photoelectronsToAnalog, samplingFactor, timePhase, 6, 4, false, syncPhase),
13  theDbService(nullptr),
14  theSamplingFactor( samplingFactor ),
15  nominalfCperPE( 1)
16 {
17 }
18 
19 
23  theSamplingFactor( p.getParameter<double>("samplingFactor") ),
24  nominalfCperPE( p.getParameter<double>("photoelectronsToAnalog") )
25 {
26 }
27 
29 {
30  // return the nominal PMT gain value of CASTOR from the config file.
31  return nominalfCperPE;
32 }
33 
35 {
36  // calculate factor (PMT gain) using sampling factor value & available electron gain
37  return theSamplingFactor/fCtoGeV(detId);
38 }
39 
40 
41 
42 double CastorSimParameters::fCtoGeV(const DetId & detId) const
43 {
44  assert(theDbService != nullptr);
45  HcalGenericDetId hcalGenDetId(detId);
46  const CastorGain* gains = theDbService->getGain(hcalGenDetId);
47  const CastorGainWidth* gwidths = theDbService->getGainWidth(hcalGenDetId);
48  double result = 0.0;
49  if (!gains || !gwidths )
50  {
51  edm::LogError("CastorAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
52  }
53  else
54  {
55  // only one gain will be recorded per channel, so just use capID 0 for now
56  result = gains->getValue(0);
57  }
58  return result;
59 }
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