CMS 3D CMS Logo

Public Member Functions | Private Attributes

CastorAmplifier Class Reference

#include <CastorAmplifier.h>

List of all members.

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 CastorDbServicetheDbService
const CaloVSimParameterMaptheParameterMap
CLHEP::RandGaussQ * theRandGaussQ
unsigned theStartingCapId

Detailed Description

Definition at line 10 of file CastorAmplifier.h.


Constructor & Destructor Documentation

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; }

Member Function Documentation

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;}

Member Data Documentation

Definition at line 32 of file CastorAmplifier.h.

Referenced by amplify().

Definition at line 27 of file CastorAmplifier.h.

Referenced by amplify(), and setDbService().

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

Definition at line 31 of file CastorAmplifier.h.

Referenced by amplify(), and setStartingCapId().