214 fEvent =
event.id().event();
223 std::ostringstream os;
225 std::cout <<
"analyze " << os.str() <<
std::endl;
228 size_t plane_align0[3] = { 1, 0, 2 };
229 size_t plane_align1[3] = { 2, 1, 0 };
230 size_t max_align = 0;
231 for (
size_t i = 0; i < 3; ++i)
233 if (plane_align0[i] > max_align) max_align = plane_align0[i];
234 if (plane_align1[i] > max_align) max_align = plane_align1[i];
237 size_t weff[3] = { 404, 404, 485 };
238 size_t tpcs[3] = { 2, 2, 6 };
242 bool goodEvent =
false;
243 unsigned int gd0 = 0, gd1 = 0;
244 for (
int p = 2;
p >= 0; --
p)
248 size_t max_offset = (
p < 2) ? 752 : 0;
250 size_t ntotw = (tpcs[2] - 1) * weff[
p] + wire_size + tpcs[1] * max_offset;
251 size_t ntotd = tpcs[0] * drift_size + (apa_gap + max_align) * (tpcs[0] / 2);
253 std::cout <<
"Plane: " <<
p <<
", wires: " << ntotw <<
" drift: " << ntotd <<
std::endl;
256 size_t a, maxArea = 0;
259 size_t tpc_z =
t / (tpcs[0] * tpcs[1]);
260 size_t tpc_y = (
t / tpcs[0]) % tpcs[1];
261 size_t tpc_x =
t % tpcs[0];
264 bool flip_d = (dir > 0);
273 if ((
t % 4 == 0) || (
t % 4 == 2))
275 eff_p = (
p == 1) ? 0 : 1;
278 if ((
t % 4 == 0) || (
t % 4 == 1))
280 flip_w = (dir > 0) ? (eff_p == 1) : (eff_p == 0);
284 flip_w = (dir < 0) ? (eff_p == 1) : (eff_p == 0);
287 offset = (
p == 0) ? 48 : 752;
290 if ((
t % 4 == 0) || (
t % 4 == 2))
292 p_align = plane_align0[
p];
296 p_align = plane_align1[
p];
299 size_t gw = tpc_z * weff[
p] + tpc_y * offset;
300 size_t gd = tpc_x * drift_size + apa_gap * (1 + tpc_x) / 2 + p_align;
311 fullimg.setProjXY(
fTrainingDataAlg, vtxProj.X(), vtxProj.Y(), gw, flip_w, gd, flip_d);
317 std::cout <<
" find crop..." <<
std::endl;
318 unsigned int w0, w1, d0, d1;
319 if (fullimg.findCrop(80, w0, w1, d0, d1))
330 std::cout <<
" crop: " << w0 <<
" " << w1 <<
" " << d0 <<
" " << d1 <<
std::endl;
332 else { std::cout <<
" skip empty event" <<
std::endl;
break; }
334 std::ostringstream ss1;
335 ss1 << os.str() <<
"_plane_" <<
p;
338 TH2C* rawHist = tfs->make<TH2C>((ss1.str() +
"_raw").c_str(),
"ADC",
339 (
int)(w1 - w0), (double)w0, (
double)w1, (
int)(d1 - d0), (double)d0, (
double)d1);
342 for (
size_t w = w0;
w < w1; ++
w)
344 auto const &
raw = fullimg.wireAdc(
w);
345 for (
size_t d = d0;
d < d1; ++
d)
347 rawHist->Fill(
w,
d, (
char)(
raw[
d] + zero));
353 TH2F* depHist = tfs->make<TH2F>((ss1.str() +
"_deposit").c_str(),
"Deposit",
354 (
int)(w1 - w0), (double)w0, (
double)w1, (
int)(d1 - d0), (double)d0, (
double)d1);
355 for (
size_t w = w0;
w < w1; ++
w)
357 auto const & edep = fullimg.wireDep(
w);
358 for (
size_t d = d0;
d < d1; ++
d) { depHist->Fill(
w,
d, edep[
d]); }
364 TH2I* pdgHist = tfs->make<TH2I>((ss1.str() +
"_pdg").c_str(),
"PDG",
365 (
int)(w1 - w0), (double)w0, (
double)w1, (
int)(d1 - d0), (double)d0, (
double)d1);
366 for (
size_t w = w0;
w < w1; ++
w)
368 auto const &
pdg = fullimg.wirePdg(
w);
369 for (
size_t d = d0;
d < d1; ++
d) { pdgHist->Fill(
w,
d,
pdg[
d]); }
377 if (fullimg.getVtxX() > -9999)
fPixX = fullimg.getVtxX() - w0;
378 if (fullimg.getVtxY() > -9999)
fPixY = fullimg.getVtxY() - d0;
380 if (fullimg.getProjX() > -9999)
fPosX = fullimg.getProjX() - w0;
381 if (fullimg.getProjY() > -9999)
fPosY = fullimg.getProjY() - d0;
384 std::cout <<
" *** w0:" << w0 <<
", w1:" << w1 <<
std::endl;
385 std::cout <<
" *** d0:" << d0 <<
", d1:" << d1 <<
std::endl;
388 std::cout <<
" *** zero:" << zero <<
std::endl;
int fEvent
number of the event being processed
geo::GeometryCore const * fGeometry
bool setEventData(const art::Event &event, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, unsigned int plane, unsigned int tpc, unsigned int cryo)
unsigned int DriftWindow() const
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
nnet::TrainingDataAlg fTrainingDataAlg
unsigned int NWires() const
bool prepareEv(const art::Event &event, detinfo::DetectorPropertiesData const &detProp)
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
int fSubRun
number of the sub-run being processed
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
int fRun
number of the run being processed
float ZeroLevel() const
Level of zero ADC after scaling.
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
size_t getAdcArea() const
TVector2 GetProjVtx(detinfo::DetectorPropertiesData const &detProp, TVector3 const &vtx3d, const size_t cryo, const size_t tpc, const size_t plane) const
QTextStream & endl(QTextStream &s)