32 #include "art_root_io/TFileService.h" 52 fVtxX(-9999), fVtxY(-9999),
53 fProjX(-9999), fProjY(-9999),
56 fAdc.resize(w, std::vector<float>(d, 0));
57 if (saveDep) {
fDeposit.resize(w, std::vector<float>(d, 0)); }
58 fPdg.resize(w, std::vector<int>(d, 0));
74 for (
size_t w = 0;
w < dataAlg.
NWires(); ++
w)
77 std::vector<float> & dstAdc =
fAdc[gw +
w];
78 std::vector<float> & dstDep =
fDeposit[gw +
w];
79 std::vector<int> & dstPdg =
fPdg[gw +
w];
80 const float* srcAdc = 0;
81 const float* srcDep = 0;
82 const int* srcPdg = 0;
97 for (
size_t d = 0;
d < drift_size; ++
d) { dstAdc[gd +
d] += srcAdc[drift_size -
d - 1] - zero; }
98 if (
fSaveDep) {
for (
size_t d = 0;
d < drift_size; ++
d) { dstDep[gd +
d] += srcDep[drift_size -
d - 1]; } }
99 for (
size_t d = 0;
d < drift_size; ++
d)
101 int code = srcPdg[drift_size -
d - 1];
104 dstPdg[gd +
d] = vtx_flags | best_pdg;
111 for (
size_t d = 0;
d < drift_size; ++
d) { dstAdc[gd +
d] += srcAdc[
d] - zero; }
112 if (
fSaveDep) {
for (
size_t d = 0;
d < drift_size; ++
d) { dstDep[gd +
d] += srcDep[
d]; } }
113 for (
size_t d = 0;
d < drift_size; ++
d)
115 int code = srcPdg[
d];
118 dstPdg[gd +
d] = vtx_flags | best_pdg;
128 size_t max_cut = max_area_cut / 4;
133 while (w0 <
fAdc.size())
135 for (
auto const d :
fAdc[w0]) {
if (
d > adcThr) cut++; }
136 if (cut < max_cut) w0++;
139 w1 =
fAdc.size() - 1;
143 for (
auto const d :
fAdc[w1]) {
if (
d > adcThr) cut++; }
144 if (cut < max_cut) w1--;
151 while (d0 <
fAdc.front().size())
153 for (
size_t i = w0; i < w1; ++i) {
if (
fAdc[i][d0] > adcThr) cut++; }
154 if (cut < max_cut) d0++;
157 d1 =
fAdc.front().size() - 1;
161 for (
size_t i = w0; i < w1; ++i) {
if (
fAdc[i][d1] > adcThr) cut++; }
162 if (cut < max_cut) d1--;
167 unsigned int margin = 32;
168 if ((w1 - w0 > 8) && (d1 - d0 > 8))
170 if (w0 < margin) w0 = 0;
173 if (w1 >
fAdc.size() - margin) w1 =
fAdc.size();
176 if (d0 < margin) d0 = 0;
179 if (d1 >
fAdc.front().size() - margin) d1 =
fAdc.front().size();
std::vector< std::vector< float > > fAdc
std::vector< float > const & wireEdep(size_t widx) const
unsigned int DriftWindow() const
bool findCrop(size_t max_area_cut, unsigned int &w0, unsigned int &w1, unsigned int &d0, unsigned int &d1) const
art framework interface to geometry description
std::vector< std::vector< float > > fDeposit
unsigned int NWires() const
std::vector< std::vector< int > > fPdg
EventImageData(size_t w, size_t d, bool saveDep)
CodeOutputInterface * code
Definition of data types for geometry description.
void setProjXY(const TrainingDataAlg &dataAlg, float x, float y, size_t gw, bool flipw, size_t gd, bool flipd)
Implementation of the Projection Matching Algorithm.
void addTpc(const TrainingDataAlg &dataAlg, size_t gw, bool flipw, size_t gd, bool flipd)
unsigned int NScaledDrifts() const
Access the description of detector geometry.
float ZeroLevel() const
Level of zero ADC after scaling.
std::vector< int > const & wirePdg(size_t widx) const
std::vector< float > const & wireData(size_t widx) const