9 #include "nurandom/RandomUtils/NuRandomService.h" 13 #include "nurandom/RandomUtils/NuRandomService.h" 15 #include "CLHEP/Random/RandFlat.h" 16 #include "CLHEP/Random/RandGauss.h" 17 #include "CLHEP/Random/RandGaussQ.h" 22 m_pran =
new CLHEP::HepJamesRandom();
23 seedSvc->registerEngine(rndm::NuRandomService::CLHEPengineSeeder(
m_pran),
"ShapedCohProtoDUNENoiseService_rand");
25 std::cout <<
"Initialising ShapedCohProtoDUNENoiseService\n";
26 double amplitude_col = pset.
get<
double>(
"amplitude_multiplicator_collection");
27 double amplitude_ind = pset.
get<
double>(
"amplitude_multiplicator_induction");
38 assert(m_FEMBCo_Frq_nominal.size() ==
m_n_femb);
39 assert(m_FEMBCo_Amp_nominal.size() ==
m_n_femb);
40 assert(m_FEMBCo_Phs_nominal.size() ==
m_n_femb);
42 for (
size_t femb=0; femb<
m_n_femb; ++femb) {
61 std::map<size_t,std::vector<size_t>> femb_se;
67 femb_se[femb+slot*4].push_back(chan);
71 std::cout <<
"ShapedCohProtoDUNENoiseService initialised!\n";
93 CLHEP::HepRandomEngine& engine = *
m_pran;
109 CLHEP::RandGauss rgauss(engine, 0, ampl);
111 std::vector<double> noise_vec;
113 noise_vec.push_back(rgauss.fire());
118 std::transform(adcs.begin(), adcs.end(), noise_vec.begin(), adcs.begin(), std::plus<double>());
127 for (
size_t sample=0; sample<adcs.size(); ++sample)
135 for (
size_t sample=0; sample<adcs.size(); ++sample)
148 const double two_pi_tick_period = 6.2831853072/2000000;
165 phs = flat.fire(0, 6.2831853072);
167 throw std::runtime_error(
"ShapedCohProtoDUNENoiseService::newEvent(): Non random phases are not implemented yet");
171 for (
size_t sample=0; sample<
m_n_tick; ++sample){
172 double two_pi_t_f = two_pi_tick_period*sample*frq;
176 for (
size_t sample=0; sample<
m_n_tick; ++sample){
177 double two_pi_t_f = two_pi_tick_period*sample*frq;
198 phs = flat.fire(0, 6.2831853072);
200 throw std::runtime_error(
"ShaoedCohProtoDUNENoise::newEvent(): Non random phases are not implemented yet");
204 for (
size_t sample=0; sample<
m_n_tick; ++sample){
205 double two_pi_t_f = two_pi_tick_period*sample*frq;
209 for (
size_t sample=0; sample<
m_n_tick; ++sample){
210 double two_pi_t_f = two_pi_tick_period*sample*frq;
~ShapedCohProtoDUNENoiseService()
double m_collection_plane_noise_rms
static const size_t m_n_apa
static const size_t m_n_max_coh_noise
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::vector< std::vector< double > > m_FEMBCo_Phs_nominal
std::vector< std::vector< double > > m_FEMBCo_Amp_nominal
std::ostream & print(std::ostream &, std::string) const
double m_HV1_Wfm_this_event_vec[m_n_tick]
double m_collection_plane_noise
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
double m_induction_plane_noise_rms
int addHVNoise(const Channel, AdcSignalVector &, detinfo::DetectorClocksData const &) const
unsigned int SlotIdFromOfflineChannel(unsigned int offlineChannel) const
Returns global slot ID.
std::vector< double > m_HV1_Frq_nominal
T gaus(T x, T amplitude, T mean, T sigma)
Tests GausssianFit object with a known input.
ShapedCohProtoDUNENoiseService(fhicl::ParameterSet const &)
std::vector< double > m_HV1_Phs_nominal
T get(std::string const &key) const
double m_induction_plane_noise
static const size_t m_n_femb
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
void ConvoluteElectronicResponse(detinfo::DetectorClocksData const &clockData, Channel channel, std::vector< T > &func) const
int addNoise(detinfo::DetectorClocksData const &, detinfo::DetectorPropertiesData const &, Channel, AdcSignalVector &) const
Contains all timing reference information for the detector.
unsigned int FEMBFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB/fiber.
CLHEP::HepRandomEngine * m_pran
std::vector< std::vector< double > > m_FEMBCo_Frq_nominal
std::vector< AdcSignal > AdcSignalVector
std::map< size_t, size_t > m_channel_femb
int addFEMBNoise(const Channel, AdcSignalVector &, detinfo::DetectorClocksData const &) const
static const size_t m_n_wire_per_apa
LArSoft geometry interface.
static const size_t m_n_tick
std::vector< double > m_HV1_Amp_nominal
double m_FEMBCo_Wfm_this_event_vec[m_n_apa][m_n_femb][m_n_tick]
int addShapedNoise(const Channel, AdcSignalVector &, detinfo::DetectorClocksData const &) const
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)