19 #include "art_root_io/TFileService.h" 80 auto const clock_data =
83 double sampfreq = 1. / samprate * 1e6;
85 unsigned int fNPlanes = geo->
Nplanes();
87 unsigned int fNTPC = geo->
NTPC();
89 for (
unsigned int icstat = 0; icstat < fNCryostats; icstat++) {
90 for (
unsigned int itpc = 0; itpc < fNTPC; itpc++) {
91 for (
unsigned int iplane = 0; iplane < fNPlanes; iplane++) {
93 tfs->make<TH1F>(Form(
"fft_noise_%d_%d_%d", icstat, itpc, iplane),
94 Form(
"fft_of_unfiltered_noise_%d_%d_%d", icstat, itpc, iplane),
99 fCsignal[icstat][itpc][iplane] = tfs->make<TH1F>(
100 Form(
"fft_signal_%d_%d_%d", icstat, itpc, iplane),
101 Form(
"fft_of_unfiltered_noise_and_signal_%d_%d_%d", icstat, itpc, iplane),
107 tfs->make<TH1F>(Form(
"fft_noise_%d_%d_%d_av", icstat, itpc, iplane),
108 Form(
"fft_of_unfiltered_noise_%d_%d_%d_av", icstat, itpc, iplane),
112 fCsignal_av[icstat][itpc][iplane] = tfs->make<TH1F>(
113 Form(
"fft_signal_%d_%d_%d_av", icstat, itpc, iplane),
114 Form(
"fft_of_unfiltered_noise_and_signal_%d_%d_%d_av", icstat, itpc, iplane),
120 tfs->make<TH1F>(Form(
"fft_filter_%d_%d_%d_av", icstat, itpc, iplane),
121 Form(
"fft_filter_%d_%d_%d_av", icstat, itpc, iplane),
130 hh = tfs->make<TH1F>(Form(
"waveform"), Form(
"waveform"), fNTicks, 0, fNTicks);
141 unsigned int nplanes = geom->
Nplanes();
142 unsigned int fNCryostats = geom->
Ncryostats();
143 unsigned int fNTPC = geom->
NTPC();
147 for (
unsigned int icstat = 0; icstat < fNCryostats; icstat++) {
148 for (
unsigned int itpc = 0; itpc < fNTPC; itpc++) {
149 for (
unsigned int pp = 0; pp < nplanes; pp++) {
151 for (
int ii = 1; ii <
fCsignal_av[icstat][itpc][pp]->GetNbinsX(); ii++) {
153 double diff = ((
fCsignal_av[icstat][itpc][pp]->GetBinContent(ii) *
155 fCnoise_av[icstat][itpc][pp]->GetBinContent(ii) *
156 fCnoise_av[icstat][itpc][pp]->GetBinContent(ii)) >= 0) ?
159 fCnoise_av[icstat][itpc][pp]->GetBinContent(ii) *
160 fCnoise_av[icstat][itpc][pp]->GetBinContent(ii) :
163 if (
fCsignal_av[icstat][itpc][pp]->GetBinContent(ii) > 0)
166 (
double)((diff) / (
fCsignal_av[icstat][itpc][pp]->GetBinContent(ii) *
167 fCsignal_av[icstat][itpc][pp]->GetBinContent(ii))));
169 fFilter_av[icstat][itpc][pp]->SetBinContent(ii, 0);
188 if (!rdHandle->size())
return;
190 <<
"WienerFilterMicroBooNE:: rdHandle size is " << rdHandle->size();
196 for (
unsigned int i = 0; i < rdHandle->size(); ++i) {
205 for (
unsigned int rd = 0; rd < rdvec.
size(); ++rd) {
209 for (
unsigned int t = 1;
t < rdvec[rd]->Samples();
t++) {
210 adc[
t - 1] = rdvec[rd]->ADC(
t - 1);
211 hh->SetBinContent(
t, rdvec[rd]->ADC(
t));
217 unsigned int plane = wireid.
Plane;
219 unsigned int wire = wireid.
Wire;
220 unsigned int cstat = wireid.
Cryostat;
221 unsigned int tpc = wireid.
TPC;
222 ff =
hh->FFT(NULL,
"MAG M");
223 if (wire >= 50 && wire < 250) {
224 for (
int ii = 0; ii <
fNBins; ii++) {
225 fCnoise_av[cstat][tpc][plane]->AddBinContent(ii,
ff->GetBinContent(ii));
226 if (wire == 150)
fCnoise[cstat][tpc][plane]->SetBinContent(ii,
ff->GetBinContent(ii));
229 else if (wire >= 700 && wire < 900) {
230 for (
int ii = 0; ii <
fNBins; ii++) {
231 fCsignal_av[cstat][tpc][plane]->AddBinContent(ii,
ff->GetBinContent(ii));
232 if (wire == 800)
fCsignal[cstat][tpc][plane]->SetBinContent(ii,
ff->GetBinContent(ii));
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Detector simulation of raw signals on wires.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
CryostatID_t Cryostat
Index of cryostat.
WireID_t Wire
Index of the wire within its plane.
EDAnalyzer(fhicl::ParameterSet const &pset)
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
art framework interface to geometry description
std::string fDetSimModuleLabel
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
#define DEFINE_ART_MODULE(klass)
void push_back(Ptr< U > const &p)
TH1F * fCnoise[10][10][5]
Base class for creation of raw signals on wires.
PlaneID_t Plane
Index of the plane within its TPC.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
TH1F * fCnoise_av[10][10][5]
TH1F * fFilter_av[10][10][5]
void analyze(const art::Event &evt)
read/write access to event
auto const & get(AssnsNode< L, R, D > const &r)
WienerFilterAna(fhicl::ParameterSet const &pset)
TPCID_t TPC
Index of the TPC within its cryostat.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
LArSoft geometry interface.
QTextStream & endl(QTextStream &s)
TH1F * fCsignal_av[10][10][5]
TH1F * fCsignal[10][10][5]