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
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 CastorSimParameters::CastorSimParameters(const edm::ParameterSet & p)
00034 : CaloSimParameters(p),
00035 theDbService(0),
00036 theSamplingFactor( p.getParameter<double>("samplingFactor") )
00037 {
00038 }
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 double CastorSimParameters::photoelectronsToAnalog(const DetId & detId) const
00064 {
00065
00066 return 1./(theSamplingFactor * simHitToPhotoelectrons(detId) * fCtoGeV(detId));
00067 }
00068
00069
00070
00071 double CastorSimParameters::fCtoGeV(const DetId & detId) const
00072 {
00073 assert(theDbService != 0);
00074 HcalGenericDetId hcalGenDetId(detId);
00075 const CastorGain* gains = theDbService->getGain(hcalGenDetId);
00076 const CastorGainWidth* gwidths = theDbService->getGainWidth(hcalGenDetId);
00077 if (!gains || !gwidths )
00078 {
00079 edm::LogError("CastorAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
00080 }
00081
00082
00083 double result = gains->getValue(0);
00084
00086
00087
00088 return result;
00089 }
00090
00091
00092
00093
00094
00095