test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorSimParameters.cc
Go to the documentation of this file.
8 #include "CLHEP/Random/RandGaussQ.h"
9 
10 
11 CastorSimParameters::CastorSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog,double samplingFactor, double timePhase, bool syncPhase)
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  if (!gains || !gwidths )
57  {
58  edm::LogError("CastorAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
59  }
60  // only one gain will be recorded per channel, so just use capID 0 for now
61 
62  double result = gains->getValue(0);
63 // if(doNoise_)
65 // result += CLHEP::RandGaussQ::shoot(0., gwidths->getValue(0));
66 // }
67  return result;
68 }
69 /*
70 double CastorSimParameters::samplingFactor(const DetId & detId) const {
71 HcalDetId hcalDetId(detId);
72 return theSamplingFactors[hcalDetId.ietaAbs()-theFirstRing];
73 }
74 */
const CastorDbService * theDbService
assert(m_qm.get())
Main class for Parameters in different subdetectors.
CastorSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, double samplingFactor, double timePhase, bool syncPhase)
tuple result
Definition: mps_fire.py:83
const CastorGain * getGain(const HcalGenericDetId &fId) const
double fCtoGeV(const DetId &detId) const
Definition: DetId.h:18
const CastorGainWidth * getGainWidth(const HcalGenericDetId &fId) const
volatile std::atomic< bool > shutdown_flag false
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