Definition at line 36 of file NoiseFromHist_tool.cc.
icarus_tool::NoiseFromHist::NoiseFromHist |
( |
const fhicl::ParameterSet & |
pset | ) |
|
|
explicit |
icarus_tool::NoiseFromHist::~NoiseFromHist |
( |
| ) |
|
void icarus_tool::NoiseFromHist::configure |
( |
const fhicl::ParameterSet & |
pset | ) |
|
|
overridevirtual |
Implements icarus_tool::IGenNoise.
Definition at line 81 of file NoiseFromHist_tool.cc.
89 std::string fullFileName;
90 cet::search_path searchPath(
"FW_SEARCH_PATH");
91 searchPath.find_file(fInputNoiseHistFileName, fullFileName);
93 TFile inputFile(fullFileName.c_str(),
"READ");
95 if (!inputFile.IsOpen())
96 throw cet::exception(
"NoiseFromHist::configure") <<
"Unable to open input file: " << fInputNoiseHistFileName << std::endl;
98 TH1D* histPtr = (TH1D*)inputFile.Get(fHistogramName.c_str());
101 throw cet::exception(
"NoiseFromHist::configure") <<
"Unable to recover desired histogram: " << fHistogramName << std::endl;
105 for(
size_t histIdx = 0; histIdx < size_t(histPtr->GetNbinsX()); histIdx++)
112 auto const clockData = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataForJob();
113 int numberTimeSamples = clockData.NumberTimeSamples();
115 fFFT = std::make_unique<icarus_signal_processing::ICARUSFFT<double>>(numberTimeSamples);
Implements icarus_tool::IGenNoise.
Definition at line 120 of file NoiseFromHist_tool.cc.
128 CLHEP::RandFlat flat(engine,-1,1);
130 size_t nFFTTicks =
detProp.NumberTimeSamples();
132 if(noise.size() != nFFTTicks)
133 throw cet::exception(
"SimWireICARUS")
135 <<
"Frequency noise vector length must match FFT Ticks (FFT size)"
136 <<
" ... " << noise.size() <<
" != " << nFFTTicks
141 std::vector<std::complex<double>> noiseFrequency(nFFTTicks/2+1, 0.);
145 double rnd[2] = {0.};
150 for(
size_t i=0; i< nFFTTicks/2 + 1; ++i)
153 flat.fireArray(2,rnd,0,1);
157 phase = rnd[1] * 2. * M_PI;
159 std::complex<double> tc(pval*cos(phase),pval*sin(phase));
161 noiseFrequency.at(i) += tc;
165 fFFT->inverseFFT(noiseFrequency, noise);
167 noiseFrequency.clear();
void icarus_tool::NoiseFromHist::nextEvent |
( |
| ) |
|
|
inlineoverridevirtual |
std::unique_ptr<icarus_signal_processing::ICARUSFFT<double> > icarus_tool::NoiseFromHist::fFFT |
|
private |
double icarus_tool::NoiseFromHist::fHistNormFactor |
|
private |
std::string icarus_tool::NoiseFromHist::fHistogramName |
|
private |
std::string icarus_tool::NoiseFromHist::fInputNoiseHistFileName |
|
private |
std::vector<double> icarus_tool::NoiseFromHist::fNoiseHistVec |
|
private |
double icarus_tool::NoiseFromHist::fNoiseRand |
|
private |
The documentation for this class was generated from the following file: