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, CLHEP::HepRandomEngine *) const
 
 CastorAmplifier (const CastorSimParameterMap *parameters, bool addNoise)
 
void setDbService (const CastorDbService *service)
 the Producer will probably update this every event More...
 
void setStartingCapId (int capId)
 
virtual ~CastorAmplifier ()
 

Private Attributes

bool addNoise_
 
const CastorDbServicetheDbService
 
const CastorSimParameterMaptheParameterMap
 
unsigned theStartingCapId
 

Detailed Description

Definition at line 13 of file CastorAmplifier.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file CastorAmplifier.cc.

16  :
17  theDbService(nullptr),
18  theParameterMap(parameters),
20  addNoise_(addNoise)
21 {
22 }
unsigned theStartingCapId
const CastorSimParameterMap * theParameterMap
const CastorDbService * theDbService
virtual CastorAmplifier::~CastorAmplifier ( )
inlinevirtual

Definition at line 16 of file CastorAmplifier.h.

16 { }

Member Function Documentation

void CastorAmplifier::amplify ( CaloSamples linearFrame,
CLHEP::HepRandomEngine *  engine 
) const
virtual

Definition at line 24 of file CastorAmplifier.cc.

References addNoise_, assert(), CastorSimParameterMap::castorParameters(), CastorSimParameters::doDynamicNoise(), CastorSimParameters::getNominalfCperPE(), CastorDbService::getPedestal(), CastorDbService::getPedestalWidth(), i, CaloSamples::id(), LogDebug, CastorPedestalWidth::makeNoise(), HLT_25ns14e33_v1_cff::noise, Parameters::parameters, EcalCondDBWriter_cfi::pedestal, CastorSimParameters::photoelectronsToAnalog(), CaloSamples::size(), theDbService, theParameterMap, and theStartingCapId.

Referenced by CastorElectronicsSim::convert().

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

References theDbService.

Referenced by CastorDigiProducer::initializeEvent().

19  {
20  theDbService = service;
21  }
const CastorDbService * theDbService
void CastorAmplifier::setStartingCapId ( int  capId)
inline

Definition at line 25 of file CastorAmplifier.h.

References theStartingCapId.

Referenced by CastorElectronicsSim::newEvent().

25 {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 28 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().

unsigned CastorAmplifier::theStartingCapId
private

Definition at line 31 of file CastorAmplifier.h.

Referenced by amplify(), and setStartingCapId().