Go to the documentation of this file.00001 #include "SimCalorimetry/CastorSim/src/CastorSimParameters.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/CastorObjects/interface/CastorGain.h"
00007 #include "CondFormats/CastorObjects/interface/CastorGainWidth.h"
00008 #include "CLHEP/Random/RandGaussQ.h"
00009
00010
00011 CastorSimParameters::CastorSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog,double samplingFactor, double timePhase, bool syncPhase)
00012 : CaloSimParameters(simHitToPhotoelectrons, photoelectronsToAnalog, samplingFactor, timePhase, 6, 4, false, syncPhase),
00013 theDbService(0),
00014 theSamplingFactor( samplingFactor )
00015 {
00016 }
00017
00018
00019 CastorSimParameters::CastorSimParameters(const edm::ParameterSet & p)
00020 : CaloSimParameters(p),
00021 theDbService(0),
00022 theSamplingFactor( p.getParameter<double>("samplingFactor") )
00023 {
00024 }
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 double CastorSimParameters::photoelectronsToAnalog(const DetId & detId) const
00042 {
00043
00044
00045 return theSamplingFactor/fCtoGeV(detId);
00046 }
00047
00048
00049
00050 double CastorSimParameters::fCtoGeV(const DetId & detId) const
00051 {
00052 assert(theDbService != 0);
00053 HcalGenericDetId hcalGenDetId(detId);
00054 const CastorGain* gains = theDbService->getGain(hcalGenDetId);
00055 const CastorGainWidth* gwidths = theDbService->getGainWidth(hcalGenDetId);
00056 if (!gains || !gwidths )
00057 {
00058 edm::LogError("CastorAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
00059 }
00060
00061
00062 double result = gains->getValue(0);
00063
00065
00066
00067 return result;
00068 }
00069
00070
00071
00072
00073
00074