CMS 3D CMS Logo

HcalAmplifier Class Reference

#include <SimCalorimetry/HcalSimAlgos/interface/HcalAmplifier.h>

List of all members.

Public Member Functions

virtual void amplify (CaloSamples &linearFrame) const
 HcalAmplifier (const CaloVSimParameterMap *parameters, bool addNoise)
void setDbService (const HcalDbService *service)
 the Producer will probably update this every event
void setRandomEngine (CLHEP::HepRandomEngine &engine)
void setStartingCapId (int capId)
virtual ~HcalAmplifier ()

Private Attributes

bool addNoise_
const HcalDbServicetheDbService
const CaloVSimParameterMaptheParameterMap
CLHEP::RandGaussQ * theRandGaussQ
unsigned theStartingCapId


Detailed Description

Definition at line 10 of file HcalAmplifier.h.


Constructor & Destructor Documentation

HcalAmplifier::HcalAmplifier ( const CaloVSimParameterMap parameters,
bool  addNoise 
)

Definition at line 14 of file HcalAmplifier.cc.

00014                                                                                    :
00015   theDbService(0), 
00016   theRandGaussQ(0),
00017   theParameterMap(parameters),
00018   theStartingCapId(0), 
00019   addNoise_(addNoise)
00020 {
00021 }

virtual HcalAmplifier::~HcalAmplifier (  )  [inline, virtual]

Definition at line 13 of file HcalAmplifier.h.

References theRandGaussQ.

00013 { delete theRandGaussQ; }


Member Function Documentation

void HcalAmplifier::amplify ( CaloSamples linearFrame  )  const [virtual]

Definition at line 29 of file HcalAmplifier.cc.

References addNoise_, capId(), HcalDbService::getPedestal(), HcalDbService::getPedestalWidth(), i, CaloSamples::id(), LogDebug, HcalPedestalWidth::makeNoise(), python::trackProbabilityAnalysis_cff::parameters, pedestal, CaloSimParameters::photoelectronsToAnalog(), CaloVSimParameterMap::simParameters(), CaloSamples::size(), theDbService, theParameterMap, theRandGaussQ, and theStartingCapId.

Referenced by HcalElectronicsSim::convert().

00029                                                      {
00030   const CaloSimParameters & parameters = theParameterMap->simParameters(frame.id());
00031   assert(theDbService != 0);
00032   HcalGenericDetId hcalGenDetId(frame.id());
00033   const HcalPedestal* peds = theDbService->getPedestal(hcalGenDetId);
00034   const HcalPedestalWidth* pwidths = theDbService->getPedestalWidth(hcalGenDetId);
00035   if (!peds || !pwidths )
00036   {
00037     edm::LogError("HcalAmplifier") << "Could not fetch HCAL conditions for channel " << hcalGenDetId;
00038   }
00039 
00040   double gauss [32]; //big enough
00041   double noise [32]; //big enough
00042   double fCperPE = parameters.photoelectronsToAnalog(frame.id());
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("HcalAmplifier") << frame;
00056 }

void HcalAmplifier::setDbService ( const HcalDbService service  )  [inline]

the Producer will probably update this every event

Definition at line 16 of file HcalAmplifier.h.

References theDbService.

Referenced by HcalDigiProducer::produce(), and HcalTBDigiProducer::produce().

00016                                                    {
00017     theDbService = service;
00018    }

void HcalAmplifier::setRandomEngine ( CLHEP::HepRandomEngine &  engine  ) 

Definition at line 24 of file HcalAmplifier.cc.

References theRandGaussQ.

00025 {
00026   theRandGaussQ = new CLHEP::RandGaussQ(engine);
00027 }

void HcalAmplifier::setStartingCapId ( int  capId  )  [inline]

Definition at line 24 of file HcalAmplifier.h.

References theStartingCapId.

Referenced by HcalElectronicsSim::newEvent().


Member Data Documentation

bool HcalAmplifier::addNoise_ [private]

Definition at line 32 of file HcalAmplifier.h.

Referenced by amplify().

const HcalDbService* HcalAmplifier::theDbService [private]

Definition at line 27 of file HcalAmplifier.h.

Referenced by amplify(), and setDbService().

const CaloVSimParameterMap* HcalAmplifier::theParameterMap [private]

Definition at line 29 of file HcalAmplifier.h.

Referenced by amplify().

CLHEP::RandGaussQ* HcalAmplifier::theRandGaussQ [private]

Definition at line 28 of file HcalAmplifier.h.

Referenced by amplify(), setRandomEngine(), and ~HcalAmplifier().

unsigned HcalAmplifier::theStartingCapId [private]

Definition at line 31 of file HcalAmplifier.h.

Referenced by amplify(), and setStartingCapId().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:23:28 2009 for CMSSW by  doxygen 1.5.4