35 string filenames[3] = {
36 "microboone-noise-spectra-v2.json.bz2",
50 auto icfg = Factory::lookup<IConfigurable>(
"Random");
51 icfg->configure(icfg->default_configuration());
54 auto icfg = Factory::lookup<IConfigurable>(
"StaticChannelStatus");
55 auto cfg = icfg->default_configuration();
56 cfg[
"anode"] = anode_tns[0];
60 auto icfg = Factory::lookup<IConfigurable>(
"EmpiricalNoiseModel");
61 auto cfg = icfg->default_configuration();
62 cfg[
"spectra_file"] = filenames[0];
65 cfg[
"anode"] = anode_tns[0];
69 auto icfg = Factory::lookup<IConfigurable>(
"NoiseSource");
70 auto cfg = icfg->default_configuration();
71 cfg[
"anode"] = anode_tns[0];
72 cfg[
"model"] =
"EmpiricalNoiseModel";
73 cfg[
"rng"] =
"Random";
75 cfg[
"m_nsamples"] =
nticks;
79 em(
"configuration done");
81 auto noisesrc = Factory::lookup<IFrameSource>(
"NoiseSource");
85 bool ok = (*noisesrc)(frame);
86 em(
"got noise frame");
94 auto traces = frame->traces();
95 const int ntraces = traces->size();
97 std::cout << nticks <<
" " << traces->at(0)->charge().size() <<
std::endl;
99 Assert(nticks == traces->at(0)->charge().size());
101 string tfilename = Form(
"%s.root", argv[0]);
102 cerr << tfilename <<
endl;
103 TFile* rootfile = TFile::Open(tfilename.c_str(),
"recreate");
106 TH2F*
hist =
new TH2F(
"noise",
"Noise Frame",nticks,0,nticks,ntraces,0,ntraces);
107 for (
auto trace : *traces) {
108 int chid =
trace->channel();
109 const auto& qvec =
trace->charge();
110 for (
int ind=0; ind<
nticks; ++ind) {
112 hist->Fill(ind+0.5, chid+0.5, qvec[ind]/
units::mV * 4096/2000.);
115 em(
"filled histogram");
118 em(
"closed ROOT file");
120 cerr << em.summary() <<
endl;
std::vector< std::string > anode_loader(std::string detector)
int main(int argc, char *argv[])
const GenericPointer< typename T::ValueType > & pointer
QTextStream & endl(QTextStream &s)
const double readout_time