7 #include "nurandom/RandomUtils/NuRandomService.h" 8 #include "art_root_io/TFileService.h" 9 #include "CLHEP/Random/JamesRandom.h" 10 #include "CLHEP/Random/RandGaussQ.h" 17 using rndm::NuRandomService;
18 using CLHEP::HepJamesRandom;
24 : m_RandomSeed(0), m_LogLevel(1),
25 m_PedNoiseHist(nullptr),
27 m_PedestalProvider(
art::ServiceHandle<
lariov::DetPedestalService>()->GetPedestalProvider()) {
28 const string myname =
"ProvidedPedestalAdditionService::ctor: ";
34 if (
m_LogLevel > 0 ) cout << myname <<
"WARNING: Using hardwired seed." <<
endl;
37 string rname =
"ProvidedPedestalAdditionService";
38 if (
m_LogLevel > 0 ) cout << myname <<
"Using NuRandomService." <<
endl;
40 m_pran =
new HepJamesRandom;
42 seedSvc->registerEngine(NuRandomService::CLHEPengineSeeder(
m_pran), rname);
46 m_PedNoiseHist = tfs->make<TH1F>(
"PedNoise",
";Pedestal noise (ADC);", 1000, -10., 10.);
52 const string myname =
"ProvidedPedestalAdditionService::dtor: ";
54 cout << myname <<
"Deleting random engine with seed " <<
m_pran->getSeed() <<
endl;
66 for (
unsigned int itck=0; itck<sigs.size(); ++itck ) {
67 sigs[itck] += ped_mean;
71 for (
unsigned int itck=0; itck<sigs.size(); ++itck ) {
72 double ped_variation = rGauss_Ped.fire();
74 sigs[itck] += ped_variation;
85 out << prefix <<
"ProvidedPedestalAdditionService:" <<
endl;
virtual float PedRms(raw::ChannelID_t ch) const =0
TH1 * m_PedNoiseHist
Histogram of pedestal noise counts.
virtual std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const
const lariov::DetPedestalProvider & m_PedestalProvider
T get(std::string const &key) const
Filters for channels, events, etc.
CLHEP::HepRandomEngine * m_pran
int addPedestal(Channel chan, AdcSignalVector &sigs, float &ped, float &pedrms) const
std::optional< T > get_if_present(std::string const &key) const
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
std::vector< AdcSignal > AdcSignalVector
~ProvidedPedestalAdditionService()
ProvidedPedestalAdditionService(fhicl::ParameterSet const &pset, art::ActivityRegistry &)
QTextStream & endl(QTextStream &s)
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)