CMS 3D CMS Logo

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::CastorAmplifier ( const CastorSimParameterMap parameters,
bool  addNoise 
)

Definition at line 16 of file CastorAmplifier.cc.

◆ ~CastorAmplifier()

virtual CastorAmplifier::~CastorAmplifier ( )
inlinevirtual

Definition at line 16 of file CastorAmplifier.h.

16 {}

Member Function Documentation

◆ amplify()

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

Definition at line 19 of file CastorAmplifier.cc.

19  {
21  assert(theDbService != nullptr);
22  HcalGenericDetId hcalGenDetId(frame.id());
23  const CastorPedestal *peds = theDbService->getPedestal(hcalGenDetId);
24  const CastorPedestalWidth *pwidths = theDbService->getPedestalWidth(hcalGenDetId);
25  if (!peds || !pwidths) {
26  edm::LogError("CastorAmplifier") << "Could not fetch HCAL/CASTOR conditions for channel " << hcalGenDetId;
27  } else {
28  double gauss[32]; // big enough
29  double noise[32]; // big enough
30  double fCperPE = parameters.photoelectronsToAnalog(frame.id());
31  double nominalfCperPE = parameters.getNominalfCperPE();
32 
33  for (int i = 0; i < frame.size(); i++) {
34  gauss[i] = CLHEP::RandGaussQ::shoot(engine, 0., 1.);
35  }
36  if (addNoise_) {
37  pwidths->makeNoise(frame.size(), gauss, noise);
38  }
39  for (int tbin = 0; tbin < frame.size(); ++tbin) {
40  int capId = (theStartingCapId + tbin) % 4;
41  double pedestal = peds->getValue(capId);
42  if (addNoise_) {
43  pedestal += noise[tbin] * (fCperPE / nominalfCperPE);
44  }
45  frame[tbin] *= fCperPE;
46  frame[tbin] += pedestal;
47  }
48  }
49  LogDebug("CastorAmplifier") << frame;
50 }

References addNoise_, cms::cuda::assert(), CastorSimParameterMap::castorParameters(), amptDefault_cfi::frame, CastorDbService::getPedestal(), CastorDbService::getPedestalWidth(), mps_fire::i, LogDebug, CastorPedestalWidth::makeNoise(), hgchebackDigitizer_cfi::noise, EcalCondDBWriter_cfi::pedestal, theDbService, theParameterMap, and theStartingCapId.

Referenced by CastorElectronicsSim::convert().

◆ setDbService()

void CastorAmplifier::setDbService ( const CastorDbService service)
inline

the Producer will probably update this every event

Definition at line 19 of file CastorAmplifier.h.

19 { theDbService = service; }

References theDbService.

Referenced by CastorDigiProducer::initializeEvent().

◆ setStartingCapId()

void CastorAmplifier::setStartingCapId ( int  capId)
inline

Definition at line 23 of file CastorAmplifier.h.

23 { theStartingCapId = capId; }

References theStartingCapId.

Referenced by CastorElectronicsSim::newEvent().

Member Data Documentation

◆ addNoise_

bool CastorAmplifier::addNoise_
private

Definition at line 30 of file CastorAmplifier.h.

Referenced by amplify().

◆ theDbService

const CastorDbService* CastorAmplifier::theDbService
private

Definition at line 26 of file CastorAmplifier.h.

Referenced by amplify(), and setDbService().

◆ theParameterMap

const CastorSimParameterMap* CastorAmplifier::theParameterMap
private

Definition at line 27 of file CastorAmplifier.h.

Referenced by amplify().

◆ theStartingCapId

unsigned CastorAmplifier::theStartingCapId
private

Definition at line 29 of file CastorAmplifier.h.

Referenced by amplify(), and setStartingCapId().

service
Definition: service.py:1
mps_fire.i
i
Definition: mps_fire.py:355
HcalGenericDetId
Definition: HcalGenericDetId.h:15
CastorAmplifier::addNoise_
bool addNoise_
Definition: CastorAmplifier.h:30
CastorDbService::getPedestalWidth
const CastorPedestalWidth * getPedestalWidth(const HcalGenericDetId &fId) const
Definition: CastorDbService.cc:148
cms::cuda::assert
assert(be >=bs)
CastorPedestal
Definition: CastorPedestal.h:16
CastorPedestalWidth
Definition: CastorPedestalWidth.h:16
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
CastorDbService::getPedestal
const CastorPedestal * getPedestal(const HcalGenericDetId &fId) const
Definition: CastorDbService.cc:141
CastorAmplifier::theParameterMap
const CastorSimParameterMap * theParameterMap
Definition: CastorAmplifier.h:27
CastorPedestalWidth::makeNoise
void makeNoise(unsigned fFrames, const double *fGauss, double *fNoise) const
Definition: CastorPedestalWidth.cc:43
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::LogError
Definition: MessageLogger.h:183
CastorAmplifier::theStartingCapId
unsigned theStartingCapId
Definition: CastorAmplifier.h:29
CastorSimParameterMap::castorParameters
CastorSimParameters castorParameters() const
accessors
Definition: CastorSimParameterMap.h:22
EcalCondDBWriter_cfi.pedestal
pedestal
Definition: EcalCondDBWriter_cfi.py:49
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
hgchebackDigitizer_cfi.noise
noise
Definition: hgchebackDigitizer_cfi.py:42
CastorSimParameters
Definition: CastorSimParameters.h:8
CastorAmplifier::theDbService
const CastorDbService * theDbService
Definition: CastorAmplifier.h:26