14 #include "art_root_io/TFileService.h" 30 void vector_to_hist(
const std::vector<double>& v, TH1D*
h)
34 int nbins = h->GetNbinsX();
36 h->SetBinContent(0, 0.);
37 int zerobin = h->GetXaxis()->FindBin(0.);
38 for(
int i=1; i<=nfill; ++i) {
40 h->SetBinContent(i, v[i - zerobin]);
42 h->SetBinContent(i, v[i - zerobin + nvec]);
44 for(
int i=nfill+1; i<=nbins+1; ++i)
45 h->SetBinContent(i, 0.);
50 void fill_delta(std::vector<double>& v,
int d)
53 assert(d >= 0 && d < n);
54 for(
int i=0; i<
n; ++i)
93 std::cout <<
"Number of ticks = " << nticks <<
std::endl;
97 art::TFileDirectory dirc = tfs->mkdir(
"Collection",
"Collection");
99 int nfilt =
std::min(5000, nticks/2);
100 int nkern = nticks/2;
104 std::vector<double> tinc(nticks, 0.);
105 fill_delta(tinc, nhist/2);
106 TH1D* hinc = dirc.make<TH1D>(
"input",
"Collection Input", nhist+1, -0.5, nhist+0.5);
107 vector_to_hist(tinc, hinc);
111 std::vector<double> tconvc(tinc);
113 TH1D* hconvc = dirc.make<TH1D>(
"conv",
"Collection Convoluted", nhist+1, -0.5, nhist+0.5);
114 vector_to_hist(tconvc, hconvc);
118 std::vector<double> tdeconvc(tconvc);
120 TH1D* hdeconvc = dirc.make<TH1D>(
"deconv",
"Collection Deconvoluted", nhist+1, -0.5, nhist+0.5);
121 vector_to_hist(tdeconvc, hdeconvc);
126 TH1D* hrfc = dirc.make<TH1D>(
"resp",
"Collection Response", nhist+1, -nhist/2-0.5, nhist/2+0.5);
127 vector_to_hist(respc, hrfc);
132 std::vector<double> kernrc(kernc.size());
133 for(
unsigned int i=0; i<kernrc.size(); ++i)
134 kernrc[i] = kernc[i].
Rho();
135 TH1D* hkernc = dirc.make<TH1D>(
"kern",
"Collection Convolution Kernel", nkern+1, -0.5, nkern+0.5);
136 hkernc->SetMinimum(0.);
137 vector_to_hist(kernrc, hkernc);
142 std::vector<double> filtrc(filtc.size());
143 for(
unsigned int i=0; i<filtrc.size(); ++i)
144 filtrc[i] = filtc[i].Re();
145 TH1D* hffc = dirc.make<TH1D>(
"filt",
"Collection Filter", nfilt+1, -0.5, nfilt+0.5);
146 vector_to_hist(filtrc, hffc);
150 art::TFileDirectory diri = tfs->mkdir(
"Induction",
"Induction");
154 std::vector<double> tini(nticks, 0.);
155 fill_delta(tini, nhist/2);
156 TH1D* hini = diri.make<TH1D>(
"input",
"Induction Input", nhist+1, -0.5, nhist+0.5);
157 vector_to_hist(tini, hini);
161 std::vector<double> tconvi(tini);
163 TH1D* hconvi = diri.make<TH1D>(
"conv",
"Induction Convoluted", nhist+1, -0.5, nhist+0.5);
164 vector_to_hist(tconvi, hconvi);
168 std::vector<double> tdeconvi(tconvi);
170 TH1D* hdeconvi = diri.make<TH1D>(
"deconv",
"Induction Deconvoluted", nhist+1, -0.5, nhist+0.5);
171 vector_to_hist(tdeconvi, hdeconvi);
176 TH1D* hrfi = diri.make<TH1D>(
"resp",
"Induction Response", nhist+1, -nhist/2-0.5, nhist/2+0.5);
177 vector_to_hist(respi, hrfi);
182 std::vector<double> kernri(kerni.size());
183 for(
unsigned int i=0; i<kernri.size(); ++i)
184 kernri[i] = kerni[i].
Rho();
185 TH1D* hkerni = diri.make<TH1D>(
"kern",
"Induction Convolution Kernel", nkern+1, -0.5, nkern+0.5);
186 hkerni->SetMinimum(0.);
187 vector_to_hist(kernri, hkerni);
192 std::vector<double> filtri(filti.size());
193 for(
unsigned int i=0; i<filtri.size(); ++i)
194 filtri[i] = filti[i].Re();
195 TH1D* hffi = diri.make<TH1D>(
"filt",
"Induction Filter", nfilt+1, -0.5, nfilt+0.5);
196 vector_to_hist(filtri, hffi);
Namespace for general, non-LArSoft-specific utilities.
Service to provide microboone-specific signal shaping for simulation (convolution) and reconstruction...
const std::vector< double > & Response() const
EDAnalyzer(fhicl::ParameterSet const &pset)
void analyze(const art::Event &evt)
virtual ~SignalShapingDUNE10ktTest()
#define DEFINE_ART_MODULE(klass)
const std::vector< TComplex > & Filter() const
SignalShapingDUNE10ktTest(fhicl::ParameterSet const &pset)
void Deconvolute(detinfo::DetectorClocksData const &clockData, unsigned int channel, std::vector< T > &func) const
const util::SignalShaping & SignalShaping(unsigned int channel) const
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
void Convolute(detinfo::DetectorClocksData const &clockData, unsigned int channel, std::vector< T > &func) const
const std::vector< TComplex > & ConvKernel() const
QTextStream & endl(QTextStream &s)