Public Member Functions | Private Attributes | List of all members
ProvidedPedestalAdditionService Class Reference

#include <ProvidedPedestalAdditionService.h>

Inheritance diagram for ProvidedPedestalAdditionService:
PedestalAdditionService

Public Member Functions

 ProvidedPedestalAdditionService (fhicl::ParameterSet const &pset, art::ActivityRegistry &)
 
 ~ProvidedPedestalAdditionService ()
 
int addPedestal (Channel chan, AdcSignalVector &sigs, float &ped, float &pedrms) const
 
virtual std::ostream & print (std::ostream &out=std::cout, std::string prefix="") const
 
- Public Member Functions inherited from PedestalAdditionService
virtual ~PedestalAdditionService ()=default
 

Private Attributes

float m_NoiseScale
 
int m_RandomSeed
 
int m_LogLevel
 
TH1 * m_PedNoiseHist
 Histogram of pedestal noise counts. More...
 
CLHEP::HepRandomEngine * m_pran
 
const lariov::DetPedestalProviderm_PedestalProvider
 

Additional Inherited Members

- Public Types inherited from PedestalAdditionService
typedef unsigned int Channel
 

Detailed Description

Definition at line 29 of file ProvidedPedestalAdditionService.h.

Constructor & Destructor Documentation

ProvidedPedestalAdditionService::ProvidedPedestalAdditionService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry  
)

Definition at line 23 of file ProvidedPedestalAdditionService_service.cc.

24 : m_RandomSeed(0), m_LogLevel(1),
25  m_PedNoiseHist(nullptr),
26  m_pran(nullptr),
28  const string myname = "ProvidedPedestalAdditionService::ctor: ";
29  m_NoiseScale = pset.get<float>("NoiseScale");
30  bool haveSeed = pset.get_if_present<int>("RandomSeed", m_RandomSeed);
31  pset.get_if_present<int>("LogLevel", m_LogLevel);
32  if ( m_RandomSeed == 0 ) haveSeed = false;
33  if ( haveSeed ) {
34  if ( m_LogLevel > 0 ) cout << myname << "WARNING: Using hardwired seed." << endl;
35  m_pran = new HepJamesRandom(m_RandomSeed);
36  } else {
37  string rname = "ProvidedPedestalAdditionService";
38  if ( m_LogLevel > 0 ) cout << myname << "Using NuRandomService." << endl;
40  m_pran = new HepJamesRandom;
41  if ( m_LogLevel > 0 ) cout << myname << " Initial seed: " << m_pran->getSeed() << endl;
42  seedSvc->registerEngine(NuRandomService::CLHEPengineSeeder(m_pran), rname);
43  }
44  if ( m_LogLevel > 0 ) cout << myname << " Registered seed: " << m_pran->getSeed() << endl;
46  m_PedNoiseHist = tfs->make<TH1F>("PedNoise", ";Pedestal noise (ADC);", 1000, -10., 10.);
47 }
TH1 * m_PedNoiseHist
Histogram of pedestal noise counts.
const lariov::DetPedestalProvider & m_PedestalProvider
QTextStream & endl(QTextStream &s)
ProvidedPedestalAdditionService::~ProvidedPedestalAdditionService ( )

Definition at line 51 of file ProvidedPedestalAdditionService_service.cc.

51  {
52  const string myname = "ProvidedPedestalAdditionService::dtor: ";
53  if ( m_LogLevel > 0 ) {
54  cout << myname << "Deleting random engine with seed " << m_pran->getSeed() << endl;
55  }
56  delete m_pran;
57 }
QTextStream & endl(QTextStream &s)

Member Function Documentation

int ProvidedPedestalAdditionService::addPedestal ( Channel  chan,
AdcSignalVector sigs,
float &  ped,
float &  pedrms 
) const
virtual

Implements PedestalAdditionService.

Definition at line 62 of file ProvidedPedestalAdditionService_service.cc.

62  {
63  // Fetch the pedestal for this channel.
64  float ped_mean = m_PedestalProvider.PedMean(chan);
65  float ped_rms = m_PedestalProvider.PedRms(chan);
66  for ( unsigned int itck=0; itck<sigs.size(); ++itck ) {
67  sigs[itck] += ped_mean;
68  }
69  if ( ped_rms > 0 && m_NoiseScale > 0 ) {
70  CLHEP::RandGaussQ rGauss_Ped(*m_pran, 0.0, m_NoiseScale*ped_rms);
71  for ( unsigned int itck=0; itck<sigs.size(); ++itck ) {
72  double ped_variation = rGauss_Ped.fire();
73  m_PedNoiseHist->Fill(ped_variation);
74  sigs[itck] += ped_variation;
75  }
76  }
77  ped = ped_mean;
78  pedrms = ped_rms;
79  return 0;
80 }
virtual float PedRms(raw::ChannelID_t ch) const =0
TH1 * m_PedNoiseHist
Histogram of pedestal noise counts.
const lariov::DetPedestalProvider & m_PedestalProvider
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
ostream & ProvidedPedestalAdditionService::print ( std::ostream &  out = std::cout,
std::string  prefix = "" 
) const
virtual

Implements PedestalAdditionService.

Definition at line 84 of file ProvidedPedestalAdditionService_service.cc.

84  {
85  out << prefix << "ProvidedPedestalAdditionService:" << endl;
86  out << prefix << " Noise scale: " << m_NoiseScale;
87  return out;
88 }
QTextStream & endl(QTextStream &s)

Member Data Documentation

int ProvidedPedestalAdditionService::m_LogLevel
private

Definition at line 48 of file ProvidedPedestalAdditionService.h.

float ProvidedPedestalAdditionService::m_NoiseScale
private

Definition at line 46 of file ProvidedPedestalAdditionService.h.

const lariov::DetPedestalProvider& ProvidedPedestalAdditionService::m_PedestalProvider
private

Definition at line 54 of file ProvidedPedestalAdditionService.h.

TH1* ProvidedPedestalAdditionService::m_PedNoiseHist
private

Histogram of pedestal noise counts.

Definition at line 50 of file ProvidedPedestalAdditionService.h.

CLHEP::HepRandomEngine* ProvidedPedestalAdditionService::m_pran
private

Definition at line 52 of file ProvidedPedestalAdditionService.h.

int ProvidedPedestalAdditionService::m_RandomSeed
private

Definition at line 47 of file ProvidedPedestalAdditionService.h.


The documentation for this class was generated from the following files: