78 art::ServiceHandle<geo::Geometry> geo;
79 art::ServiceHandle<util::SignalShapingServiceSBND> sss;
80 art::ServiceHandle<util::LArFFT> fFFT;
83 size_t view = (size_t)geo->View(chan);
86 auto tempNoiseVec = sss->GetNoiseFactVec();
87 double shapingTime = 2.0;
88 double asicGain = sss->GetASICGain(chan);
90 size_t fNTicks = fFFT->FFTSize();
94 noise_factor = tempNoiseVec[view].at(
fShapingTimeOrder.find( shapingTime )->second );
95 noise_factor *= asicGain/4.7;
98 throw cet::exception(
"SBNDThermalNoiseServiceInFreq_service.cc")
100 <<
"Shaping Time recieved from signalshapingservices_sbnd.fcl is not one of the allowed values"
102 <<
"Allowed values: 0.5, 1.0, 2.0, 3.0 us"
111 if (sigs.size() != fNTicks)
112 throw cet::exception(
"SBNDThermalNoiseServiceInFreq_service.cc")
114 <<
"Frequency noise vector length must match fNTicks (FFT size)"
115 <<
" ... " << sigs.size() <<
" != " << fNTicks
120 std::vector<TComplex> noiseFrequency(fNTicks / 2 + 1, 0.);
123 double lofilter = 0.;
125 double rnd[2] = {0.};
128 double binWidth = 1.0 / (fNTicks *
fSampleRate * 1.0e-6);
130 for (
size_t i = 0; i < fNTicks / 2 + 1; ++i) {
132 flat.fireArray(2, rnd, 0, 1);
133 std::cout <<
"rnd[0]: " << rnd[0] << std::endl;
134 std::cout <<
"rnd[1]: " << rnd[1] << std::endl;
138 lofilter = 1.0 / (1.0 +
exp(-(i -
fLowCutoff / binWidth) / 0.5));
162 phase = rnd[1] * 2.*TMath::Pi();
163 TComplex tc(pval * cos(phase), pval * sin(phase));
164 noiseFrequency.at(i) += tc;
169 fFFT->DoInvFFT(noiseFrequency, sigs);
171 noiseFrequency.clear();
176 for (
unsigned int i = 0; i < sigs.size(); ++i) {
177 sigs.at(i) *= 1.*fNTicks;
double fNoiseRand
fraction of random "wiggle" in noise in freq. spectrum
CLHEP::HepRandomEngine * fNoiseEngine
double fLowCutoff
low frequency filter cutoff (kHz)
double fNoiseWidth
exponential noise width (kHz)
std::map< double, int > fShapingTimeOrder
BEGIN_PROLOG could also be cout