#include <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.
: theDbService(0), theRandGaussQ(0), theParameterMap(parameters), theStartingCapId(0), addNoise_(addNoise) { }
virtual CastorAmplifier::~CastorAmplifier | ( | ) | [inline, virtual] |
Definition at line 13 of file CastorAmplifier.h.
References theRandGaussQ.
{ delete theRandGaussQ; }
void CastorAmplifier::amplify | ( | CaloSamples & | linearFrame | ) | const [virtual] |
Definition at line 29 of file CastorAmplifier.cc.
References addNoise_, CastorDbService::getPedestal(), CastorDbService::getPedestalWidth(), i, CaloSamples::id(), LogDebug, CastorPedestalWidth::makeNoise(), Parameters::parameters, CaloSimParameters::photoelectronsToAnalog(), CaloVSimParameterMap::simParameters(), CaloSamples::size(), theDbService, theParameterMap, theRandGaussQ, and theStartingCapId.
Referenced by CastorElectronicsSim::convert().
{ const CaloSimParameters & parameters = theParameterMap->simParameters(frame.id()); assert(theDbService != 0); HcalGenericDetId hcalGenDetId(frame.id()); const CastorPedestal* peds = theDbService->getPedestal(hcalGenDetId); const CastorPedestalWidth* pwidths = theDbService->getPedestalWidth(hcalGenDetId); if (!peds || !pwidths ) { edm::LogError("CastorAmplifier") << "Could not fetch HCAL/CASTOR conditions for channel " << hcalGenDetId; } double gauss [32]; //big enough double noise [32]; //big enough double fCperPE = parameters.photoelectronsToAnalog(); for (int i = 0; i < frame.size(); i++) gauss[i] = theRandGaussQ->fire(0., 1.); pwidths->makeNoise (frame.size(), gauss, noise); for(int tbin = 0; tbin < frame.size(); ++tbin) { int capId = (theStartingCapId + tbin)%4; double pedestal = peds->getValue (capId); if(addNoise_) { pedestal += noise [tbin]; } frame[tbin] *= fCperPE; frame[tbin] += pedestal; } LogDebug("CastorAmplifier") << frame; }
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().
{ theDbService = service; }
void CastorAmplifier::setRandomEngine | ( | CLHEP::HepRandomEngine & | engine | ) |
Definition at line 24 of file CastorAmplifier.cc.
References theRandGaussQ.
{ theRandGaussQ = new CLHEP::RandGaussQ(engine); }
void CastorAmplifier::setStartingCapId | ( | int | capId | ) | [inline] |
Definition at line 24 of file CastorAmplifier.h.
References theStartingCapId.
Referenced by CastorElectronicsSim::newEvent().
{theStartingCapId = capId;}
bool CastorAmplifier::addNoise_ [private] |
Definition at line 32 of file CastorAmplifier.h.
Referenced by amplify().
const CastorDbService* CastorAmplifier::theDbService [private] |
Definition at line 27 of file CastorAmplifier.h.
Referenced by amplify(), and setDbService().
const CaloVSimParameterMap* CastorAmplifier::theParameterMap [private] |
Definition at line 29 of file CastorAmplifier.h.
Referenced by amplify().
CLHEP::RandGaussQ* CastorAmplifier::theRandGaussQ [private] |
Definition at line 28 of file CastorAmplifier.h.
Referenced by amplify(), setRandomEngine(), and ~CastorAmplifier().
unsigned CastorAmplifier::theStartingCapId [private] |
Definition at line 31 of file CastorAmplifier.h.
Referenced by amplify(), and setStartingCapId().