#include <SimCalorimetry/CastorSim/src/CastorAmplifier.h>
Public Member Functions | |
virtual void | amplify (CaloSamples &linearFrame) const |
CastorAmplifier (const CaloVSimParameterMap *parameters, bool addNoise) | |
void | setDbService (const CastorDbService *service) |
the Producer will probably update this every event | |
void | setRandomEngine (CLHEP::HepRandomEngine &engine) |
void | setStartingCapId (int capId) |
virtual | ~CastorAmplifier () |
Private Attributes | |
bool | addNoise_ |
const CastorDbService * | theDbService |
const CaloVSimParameterMap * | theParameterMap |
CLHEP::RandGaussQ * | theRandGaussQ |
unsigned | theStartingCapId |
Definition at line 10 of file CastorAmplifier.h.
CastorAmplifier::CastorAmplifier | ( | const CaloVSimParameterMap * | parameters, | |
bool | addNoise | |||
) |
Definition at line 14 of file CastorAmplifier.cc.
00014 : 00015 theDbService(0), 00016 theRandGaussQ(0), 00017 theParameterMap(parameters), 00018 theStartingCapId(0), 00019 addNoise_(addNoise) 00020 { 00021 }
virtual CastorAmplifier::~CastorAmplifier | ( | ) | [inline, virtual] |
Definition at line 13 of file CastorAmplifier.h.
References theRandGaussQ.
00013 { delete theRandGaussQ; }
void CastorAmplifier::amplify | ( | CaloSamples & | linearFrame | ) | const [virtual] |
Definition at line 29 of file CastorAmplifier.cc.
References addNoise_, capId(), CastorDbService::getPedestal(), CastorDbService::getPedestalWidth(), i, CaloSamples::id(), LogDebug, CastorPedestalWidth::makeNoise(), python::trackProbabilityAnalysis_cff::parameters, pedestal, CaloSimParameters::photoelectronsToAnalog(), CaloVSimParameterMap::simParameters(), CaloSamples::size(), theDbService, theParameterMap, theRandGaussQ, and theStartingCapId.
Referenced by CastorElectronicsSim::convert().
00029 { 00030 const CaloSimParameters & parameters = theParameterMap->simParameters(frame.id()); 00031 assert(theDbService != 0); 00032 HcalGenericDetId hcalGenDetId(frame.id()); 00033 const CastorPedestal* peds = theDbService->getPedestal(hcalGenDetId); 00034 const CastorPedestalWidth* pwidths = theDbService->getPedestalWidth(hcalGenDetId); 00035 if (!peds || !pwidths ) 00036 { 00037 edm::LogError("CastorAmplifier") << "Could not fetch HCAL/CASTOR conditions for channel " << hcalGenDetId; 00038 } 00039 00040 double gauss [32]; //big enough 00041 double noise [32]; //big enough 00042 double fCperPE = parameters.photoelectronsToAnalog(); 00043 00044 for (int i = 0; i < frame.size(); i++) gauss[i] = theRandGaussQ->fire(0., 1.); 00045 pwidths->makeNoise (frame.size(), gauss, noise); 00046 for(int tbin = 0; tbin < frame.size(); ++tbin) { 00047 int capId = (theStartingCapId + tbin)%4; 00048 double pedestal = peds->getValue (capId); 00049 if(addNoise_) { 00050 pedestal += noise [tbin]; 00051 } 00052 frame[tbin] *= fCperPE; 00053 frame[tbin] += pedestal; 00054 } 00055 LogDebug("CastorAmplifier") << frame; 00056 }
void CastorAmplifier::setDbService | ( | const CastorDbService * | service | ) | [inline] |
the Producer will probably update this every event
Definition at line 16 of file CastorAmplifier.h.
References theDbService.
Referenced by CastorDigiProducer::produce().
00016 { 00017 theDbService = service; 00018 }
void CastorAmplifier::setRandomEngine | ( | CLHEP::HepRandomEngine & | engine | ) |
Definition at line 24 of file CastorAmplifier.cc.
References theRandGaussQ.
00025 { 00026 theRandGaussQ = new CLHEP::RandGaussQ(engine); 00027 }
Definition at line 24 of file CastorAmplifier.h.
References theStartingCapId.
Referenced by CastorElectronicsSim::newEvent().
00024 {theStartingCapId = capId;}
bool CastorAmplifier::addNoise_ [private] |
const CastorDbService* CastorAmplifier::theDbService [private] |
const CaloVSimParameterMap* CastorAmplifier::theParameterMap [private] |
CLHEP::RandGaussQ* CastorAmplifier::theRandGaussQ [private] |
Definition at line 28 of file CastorAmplifier.h.
Referenced by amplify(), setRandomEngine(), and ~CastorAmplifier().
unsigned CastorAmplifier::theStartingCapId [private] |