16 #include "TTimeStamp.h" 17 #include "hep_hpc/hdf5/Ntuple.hpp" 18 #include "hep_hpc/hdf5/make_ntuple.hpp" 47 static Ntuple<unsigned int, unsigned int, unsigned int, double> evtids(
48 hdffile,
"evtids", {
"run",
"subrun",
"event",
"evttime"});
51 make_ntuple({hdffile,
"image", 1000},
52 make_scalar_column<unsigned short>(
"label"),
53 make_column<float, 2>(
56 1024 * 1024 / (2500 *
sizeof(float)),
57 {PropertyList{H5P_DATASET_CREATE}(&H5Pset_shuffle)(&H5Pset_deflate, 6u)}));
65 evttime = tts.AsDouble();
69 evttime = tts.AsDouble();
84 unsigned short flag = 999;
85 if (!mclist.empty()) {
86 auto particle = mclist[0].GetParticle(0);
87 if (
std::abs(particle.PdgCode()) == 13) flag = 0;
88 if (
std::abs(particle.PdgCode()) == 211) flag = 1;
91 if (!tracks.empty()) {
92 auto trkend = tracks[0].End();
93 if (trkend.X() > -360 + 50 && trkend.X() < 360 - 50 && trkend.Y() > 50 &&
94 trkend.Y() < 610 - 50 && trkend.Z() > 50 && trkend.Z() < 710 - 50) {
95 if (fmthm.isValid()) {
96 auto vhit = fmthm.at(0);
97 auto vmeta = fmthm.data(0);
100 for (
size_t i = 0; i < vhit.size(); ++i) {
101 if (static_cast<int>(vmeta[i]->Index()) == std::numeric_limits<int>::max()) {
104 if (vhit[i]->
WireID().Plane == 2) {
105 if (
int(vmeta[i]->Index()) > maxindex) {
106 maxindex = vmeta[i]->Index();
112 auto endwire = vhit[ihit]->WireID();
113 float endtime = vhit[ihit]->PeakTime();
114 float adc[50][50] = {{0.}};
115 for (
auto& wire : wires) {
116 int channel = wire.Channel();
118 if (wireids[0].
Plane == 2 && wireids[0].TPC == endwire.TPC &&
119 wireids[0].Wire >= endwire.Wire - 25 && wireids[0].Wire < endwire.Wire + 25) {
120 int idx = wireids[0].Wire - endwire.Wire + 25;
123 for (
const auto& range : signalROI.
get_ranges()) {
124 const auto& waveform = range.data();
127 for (
int i = lasttick; i < roiFirstBinTick; ++i) {
128 if (i >=
int(endtime) - 25 && i <
int(endtime) + 25) {
129 adc[idx][i - int(endtime) - 25] = 0;
132 lasttick = roiFirstBinTick;
133 for (
size_t i = 0; i < waveform.size(); ++i) {
134 if (lasttick >=
int(endtime) - 25 && lasttick < int(endtime) + 25) {
135 adc[idx][lasttick - int(endtime) + 25] = waveform[i];
140 for (
int i = lasttick; i < 6000; ++i) {
141 if (i >=
int(endtime) - 25 && i <
int(endtime) + 25) {
142 adc[idx][i - int(endtime) + 25] = 0;
148 image.insert(flag, &adc[0][0]);
SubRunNumber_t subRun() const
constexpr std::uint32_t timeLow() const
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
art::InputTag fTrackModuleLabel
void saveImage(art::Event const &e, hep_hpc::hdf5::File &hdffile) override
art::InputTag fMCTruthLabel
Declaration of signal hit object.
constexpr std::uint32_t timeHigh() const
constexpr auto abs(T v)
Returns the absolute value of the argument.
const range_list_t & get_ranges() const
Returns the internal list of non-void ranges.
art::InputTag fWireModuleLabel
int TDCtick_t
Type representing a TDC tick.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
T get(std::string const &key) const
Provides recob::Track data product.
Handle< PROD > getHandle(SelectorBase const &) const
EventNumber_t event() const
Declaration of basic channel signal object.
recob::tracking::Plane Plane
PROD const & getProduct(InputTag const &tag) const
art framework interface to geometry description