test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HFSimParameters.cc
Go to the documentation of this file.
8 #include "CLHEP/Random/RandGaussQ.h"
9 
10 
11 HFSimParameters::HFSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog,
12  double samplingFactor, double timePhase, bool syncPhase)
13 : CaloSimParameters(simHitToPhotoelectrons, photoelectronsToAnalog, samplingFactor, timePhase,
14  6, 4, false, syncPhase),
15  theDbService(0),
16  theSamplingFactor( samplingFactor )
17 {
18 }
19 
22  theDbService(0),
23  theSamplingFactor( p.getParameter<double>("samplingFactor") )
24 {
25 }
26 
27 
29 {
30  // pe/fC = pe/GeV * GeV/fC = (0.24 pe/GeV * 6 for photomult * 0.2146GeV/fC)
31  return 1./(theSamplingFactor * simHitToPhotoelectrons(detId) * fCtoGeV(detId));
32 }
33 
34 double HFSimParameters::fCtoGeV(const DetId & detId) const
35 {
36  assert(theDbService != 0);
37  HcalGenericDetId hcalGenDetId(detId);
38  const HcalGain* gains = theDbService->getGain(hcalGenDetId);
39  const HcalGainWidth* gwidths = theDbService->getGainWidth(hcalGenDetId);
40  double result = 0.0;
41  if (!gains || !gwidths )
42  {
43  edm::LogError("HcalAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
44  }
45  else
46  {
47  // only one gain will be recorded per channel, so just use capID 0 for now
48  result = gains->getValue(0);
49  // if(doNoise_)
51  // result += CLHEP::RandGaussQ::shoot(0., gwidths->getValue(0));
52  // }
53  }
54  return result;
55 }
56 
57 
59 {
60  return theSamplingFactor;
61 }
const HcalGainWidth * getGainWidth(const HcalGenericDetId &fId) const
assert(m_qm.get())
double fCtoGeV(const DetId &detId) const
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGain.h:22
Main class for Parameters in different subdetectors.
tuple result
Definition: mps_fire.py:84
double simHitToPhotoelectrons() const
HFSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, double samplingFactor, double timePhase, bool syncPhase)
Definition: DetId.h:18
const HcalDbService * theDbService
double theSamplingFactor
const HcalGain * getGain(const HcalGenericDetId &fId) const
volatile std::atomic< bool > shutdown_flag false
double samplingFactor() const
double photoelectronsToAnalog() const
the factor which goes from photoelectrons to whatever gets read by ADCs