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(0),
14  theSamplingFactor( samplingFactor )
15 {
16 }
17 
18 
21  theDbService(0),
22  theSamplingFactor( p.getParameter<double>("samplingFactor") )
23 {
24 }
25 
26 /*
27 double CastorSimParameters::simHitToPhotoelectrons(const DetId & detId) const
28 {
29  // the gain is in units of GeV/fC. We want a constant with pe/dGeV
30  // pe/dGeV = (GeV/dGeV) / (GeV/fC) / (fC/pe)
31  double result = CaloSimParameters::simHitToPhotoelectrons(detId);
32  if(HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenForward
33  || HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenCastor)
34  {
35  result = samplingFactor(detId) / fCtoGeV(detId) / photoelectronsToAnalog();
36  }
37  return result;
38 }
39 */
40 
42 {
43  // calculate factor (PMT gain) using sampling factor value & available electron gain
44  //std::cout << " sampling factor = " << theSamplingFactor << " fCtoGeV = " << fCtoGeV(detId) << " and photoelectronsToAnalog = " << theSamplingFactor/fCtoGeV(detId) << std::endl;
45  return theSamplingFactor/fCtoGeV(detId);
46 }
47 
48 
49 
50 double CastorSimParameters::fCtoGeV(const DetId & detId) const
51 {
52  assert(theDbService != 0);
53  HcalGenericDetId hcalGenDetId(detId);
54  const CastorGain* gains = theDbService->getGain(hcalGenDetId);
55  const CastorGainWidth* gwidths = theDbService->getGainWidth(hcalGenDetId);
56  double result = 0.0;
57  if (!gains || !gwidths )
58  {
59  edm::LogError("CastorAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
60  }
61  else
62  {
63  // only one gain will be recorded per channel, so just use capID 0 for now
64  result = gains->getValue(0);
65  // if(doNoise_)
67  // result += CLHEP::RandGaussQ::shoot(0., gwidths->getValue(0));
68  // }
69  }
70  return result;
71 }
72 /*
73 double CastorSimParameters::samplingFactor(const DetId & detId) const {
74 HcalDetId hcalDetId(detId);
75 return theSamplingFactors[hcalDetId.ietaAbs()-theFirstRing];
76 }
77 */
const CastorDbService * theDbService
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