6 #include "nurandom/RandomUtils/NuRandomService.h" 7 #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),
27 const string myname =
"WhiteChannelNoiseService::ctor: ";
34 if (
m_LogLevel > 0 ) cout << myname <<
"WARNING: Using hardwired seed." <<
endl;
37 string rname =
"WhiteChannelNoiseService";
38 if (
m_LogLevel > 0 ) cout << myname <<
"Using NuRandomService." <<
endl;
40 m_pran =
new HepJamesRandom;
42 seedSvc->registerEngine(NuRandomService::CLHEPengineSeeder(
m_pran), rname);
46 fNoiseHist = tfs->make<TH1F>(
"Noise",
";Noise (ADC);", 1000, -10., 10.);
52 const string myname =
"WhiteChannelNoiseService::dtor: ";
54 cout << myname <<
"Deleting random engine with seed " <<
m_pran->getSeed() <<
endl;
67 std::map< double, int > fShapingTimeOrder;
68 fShapingTimeOrder = { {0.5, 0}, {1.0, 1}, {2.0, 2}, {3.0, 3} };
71 if ( fShapingTimeOrder.find(fShapingTime) != fShapingTimeOrder.end() ) {
73 fNoiseFactVec.resize(2);
74 for (
auto& item : tempNoiseVec ) {
75 fNoiseFactVec[i] = item.at(fShapingTimeOrder.find( fShapingTime )->second);
76 fNoiseFactVec[i] *= fASICGain/4.7;
82 <<
"Shaping Time received from signalservices_dune.fcl is not one of allowed values" 84 <<
"Allowed values: 0.5, 1.0, 2.0, 3.0 usec" 90 CLHEP::HepRandomEngine& engine = *
m_pran;
91 CLHEP::RandGaussQ rGauss_Ind(engine, 0.0, fNoiseFactVec[0]);
92 CLHEP::RandGaussQ rGauss_Col(engine, 0.0, fNoiseFactVec[1]);
95 if ( view==
geo::kU ) tnoise = rGauss_Ind.fire();
96 else if ( view==
geo::kV ) tnoise = rGauss_Ind.fire();
97 else tnoise = rGauss_Col.fire();
106 string myprefix = prefix +
" ";
107 out << myprefix <<
" Random seed: " <<
m_pran->getSeed() <<
endl;
double GetShapingTime(Channel channel) const override
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::vector< DoubleVec > GetNoiseFactVec() const override
TH1 * fNoiseHist
distribution of noise counts
Service to provide microboone-specific signal shaping for simulation (convolution) and reconstruction...
art framework interface to geometry description
int addNoise(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, Channel chan, AdcSignalVector &sigs) const
WhiteChannelNoiseService(fhicl::ParameterSet const &pset, art::ActivityRegistry &)
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
Contains all timing reference information for the detector.
std::optional< T > get_if_present(std::string const &key) const
std::vector< AdcSignal > AdcSignalVector
~WhiteChannelNoiseService()
CLHEP::HepRandomEngine * m_pran
double GetASICGain(Channel channel) const override
LArSoft geometry interface.
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
std::vector< double > DoubleVec
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)