CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
CastorAmplifier Class Reference

#include <CastorAmplifier.h>

Public Member Functions

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

Private Attributes

bool addNoise_
 
const CastorDbServicetheDbService
 
const CastorSimParameterMaptheParameterMap
 
CLHEP::RandGaussQ * theRandGaussQ
 
unsigned theStartingCapId
 

Detailed Description

Definition at line 10 of file CastorAmplifier.h.

Constructor & Destructor Documentation

CastorAmplifier::CastorAmplifier ( const CastorSimParameterMap parameters,
bool  addNoise 
)

Definition at line 14 of file CastorAmplifier.cc.

14  :
15  theDbService(0),
16  theRandGaussQ(0),
17  theParameterMap(parameters),
18  theStartingCapId(0),
19  addNoise_(addNoise)
20 {
21 }
unsigned theStartingCapId
const CastorSimParameterMap * theParameterMap
const CastorDbService * theDbService
CLHEP::RandGaussQ * theRandGaussQ
virtual CastorAmplifier::~CastorAmplifier ( )
inlinevirtual

Definition at line 13 of file CastorAmplifier.h.

References theRandGaussQ.

13 { delete theRandGaussQ; }
CLHEP::RandGaussQ * theRandGaussQ

Member Function Documentation

void CastorAmplifier::amplify ( CaloSamples linearFrame) const
virtual

Definition at line 29 of file CastorAmplifier.cc.

References addNoise_, CastorSimParameterMap::castorParameters(), CastorDbService::getPedestal(), CastorDbService::getPedestalWidth(), i, CaloSamples::id(), LogDebug, CastorPedestalWidth::makeNoise(), Parameters::parameters, CastorSimParameters::photoelectronsToAnalog(), CaloSamples::size(), theDbService, theParameterMap, theRandGaussQ, and theStartingCapId.

Referenced by CastorElectronicsSim::convert().

29  {
31  assert(theDbService != 0);
32  HcalGenericDetId hcalGenDetId(frame.id());
33  const CastorPedestal* peds = theDbService->getPedestal(hcalGenDetId);
34  const CastorPedestalWidth* pwidths = theDbService->getPedestalWidth(hcalGenDetId);
35  if (!peds || !pwidths )
36  {
37  edm::LogError("CastorAmplifier") << "Could not fetch HCAL/CASTOR conditions for channel " << hcalGenDetId;
38  }
39 
40  double gauss [32]; //big enough
41  double noise [32]; //big enough
42  double fCperPE = parameters.photoelectronsToAnalog(frame.id());
43 
44  for (int i = 0; i < frame.size(); i++) gauss[i] = theRandGaussQ->fire(0., 1.);
45  pwidths->makeNoise (frame.size(), gauss, noise);
46  for(int tbin = 0; tbin < frame.size(); ++tbin) {
47  int capId = (theStartingCapId + tbin)%4;
48  double pedestal = peds->getValue (capId);
49  if(addNoise_) {
50  pedestal += noise [tbin];
51  }
52  frame[tbin] *= fCperPE;
53  frame[tbin] += pedestal;
54  }
55  LogDebug("CastorAmplifier") << frame;
56 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
unsigned theStartingCapId
const CastorPedestal * getPedestal(const HcalGenericDetId &fId) const
const CastorSimParameterMap * theParameterMap
const CastorDbService * theDbService
void makeNoise(unsigned fFrames, const double *fGauss, double *fNoise) const
CastorSimParameters castorParameters() const
accessors
const CastorPedestalWidth * getPedestalWidth(const HcalGenericDetId &fId) const
CLHEP::RandGaussQ * theRandGaussQ
virtual double photoelectronsToAnalog(const DetId &detId) const
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::initializeEvent().

16  {
17  theDbService = service;
18  }
const CastorDbService * theDbService
void CastorAmplifier::setRandomEngine ( CLHEP::HepRandomEngine &  engine)

Definition at line 24 of file CastorAmplifier.cc.

References theRandGaussQ.

25 {
26  theRandGaussQ = new CLHEP::RandGaussQ(engine);
27 }
CLHEP::RandGaussQ * theRandGaussQ
void CastorAmplifier::setStartingCapId ( int  capId)
inline

Definition at line 24 of file CastorAmplifier.h.

References theStartingCapId.

Referenced by CastorElectronicsSim::newEvent().

24 {theStartingCapId = capId;}
unsigned theStartingCapId

Member Data Documentation

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 CastorSimParameterMap* 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().