CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/SimCalorimetry/HcalSimAlgos/src/HFSimParameters.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/HcalSimAlgos/interface/HFSimParameters.h"
00002 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00003 #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
00004 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 #include "CondFormats/HcalObjects/interface/HcalGain.h"
00007 #include "CondFormats/HcalObjects/interface/HcalGainWidth.h"
00008 #include "CLHEP/Random/RandGaussQ.h"
00009 
00010 
00011 HFSimParameters::HFSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, 
00012                                  double samplingFactor, double timePhase, bool syncPhase)
00013 : CaloSimParameters(simHitToPhotoelectrons, photoelectronsToAnalog, samplingFactor, timePhase,
00014                     6, 4, false, syncPhase),
00015   theDbService(0),
00016   theSamplingFactor( samplingFactor )
00017 {
00018 }
00019 
00020 HFSimParameters::HFSimParameters(const edm::ParameterSet & p)
00021 :  CaloSimParameters(p),
00022    theDbService(0),
00023    theSamplingFactor( p.getParameter<double>("samplingFactor") )
00024 {
00025 }
00026 
00027 
00028 double HFSimParameters::photoelectronsToAnalog(const DetId & detId) const
00029 {
00030   // pe/fC = pe/GeV * GeV/fC  = (0.24 pe/GeV * 6 for photomult * 0.2146GeV/fC)
00031   return 1./(theSamplingFactor * simHitToPhotoelectrons(detId) * fCtoGeV(detId));
00032 }
00033 
00034 double HFSimParameters::fCtoGeV(const DetId & detId) const
00035 {
00036   assert(theDbService != 0);
00037   HcalGenericDetId hcalGenDetId(detId);
00038   const HcalGain* gains = theDbService->getGain(hcalGenDetId);
00039   const HcalGainWidth* gwidths = theDbService->getGainWidth(hcalGenDetId);
00040   if (!gains || !gwidths )
00041   {
00042     edm::LogError("HcalAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
00043   }
00044   // only one gain will be recorded per channel, so just use capID 0 for now
00045   
00046   double result = gains->getValue(0);
00047 //  if(doNoise_)
00049 //    result += CLHEP::RandGaussQ::shoot(0.,  gwidths->getValue(0));
00050 //  }
00051   return result;
00052 }
00053 
00054