20 #include "canvas/Persistency/Common/FindManyP.h" 32 class DetectorClocksData;
33 class DetectorPropertiesData;
41 class KerasModelInterface;
42 class TfModelInterface;
44 class TrainingDataAlg;
54 virtual std::vector<float> Run(
std::vector<std::vector<float>>
const& inp2d) = 0;
55 virtual std::vector<std::vector<float>> Run(
68 std::vector<float> Run(
std::vector<std::vector<float>>
const& inp2d)
override;
80 int samples = -1)
override;
81 std::vector<float> Run(
std::vector<std::vector<float>>
const& inp2d)
override;
84 std::unique_ptr<tf::Graph>
g;
95 Comment(
"Neural net model to apply.")};
97 Comment(
"Labels of the network outputs.")};
101 Comment(
"How many downsampled ADC entries in patch")};
111 std::vector<std::string>
const&
118 float predictIdValue(
unsigned int wire,
float drift,
size_t outIdx = 0)
const;
121 std::vector<float> predictIdVector(
unsigned int wire,
float drift)
const;
123 std::vector<std::vector<float>> predictIdVectors(
124 std::vector<std::pair<unsigned int, float>> points)
const;
126 static std::vector<float> flattenData2D(
std::vector<std::vector<float>>
const&
patch);
128 std::vector<std::vector<float>>
const&
131 return fWireDriftPatch;
136 return flattenData2D(fWireDriftPatch);
139 bool isInsideFiducialRegion(
unsigned int wire,
float drift)
const;
143 bool isCurrentPatch(
unsigned int wire,
float drift)
const;
146 bool isSamePatch(
unsigned int wire1,
float drift1,
unsigned int wire2,
float drift2)
const;
160 if (fDownscaleFullView) {
161 size_t sd = (size_t)(drift / fDriftWindow);
162 if ((fCurrentWireIdx == wire) && (fCurrentScaledDrift == sd))
165 fCurrentWireIdx = wire;
166 fCurrentScaledDrift = sd;
168 return patchFromDownsampledView(wire, drift, fPatchSizeW, fPatchSizeD,
patch);
171 if ((fCurrentWireIdx == wire) && (fCurrentScaledDrift == drift))
174 fCurrentWireIdx = wire;
175 fCurrentScaledDrift = drift;
177 return patchFromOriginalView(wire, drift, fPatchSizeW, fPatchSizeD,
patch);
183 return bufferPatch(wire, drift, fWireDriftPatch);
190 if (fNNet)
delete fNNet;
202 kPdgMask = 0x00000FFF,
203 kTypeMask = 0x0000F000,
204 kVtxMask = 0xFFFF0000
225 kElectronEnd = 0x10000000,
226 kElastic = 0x20000000,
227 kInelastic = 0x40000000
241 Comment(
"Tag of simulation producer.")};
244 Comment(
"Tag of sim::SimChannel producer.")};
247 Comment(
"Include (or not) vertex info in PDG map.")};
250 Name(
"AdcDelayTicks"),
251 Comment(
"ADC pulse peak delay in ticks (non-zero for not deconvoluted waveforms).")};
278 bool setDataEventData(
286 bool findCrop(
float max_e_cut,
290 unsigned int& d1)
const;
297 std::vector<float>
const&
300 return fWireDriftEdep[widx];
302 std::vector<int>
const&
305 return fWireDriftPdg[widx];
312 size_t drifts)
override;
325 const TLorentzVector& tvec,
326 unsigned int plane)
const;
328 bool setWireEdepsAndLabels(std::vector<float>
const& edeps,
329 std::vector<int>
const&
pdgs,
332 void collectVtxFlags(
333 std::unordered_map<
size_t, std::unordered_map<int, int>>& wireToDriftToVtxFlags,
336 const std::unordered_map<int, const simb::MCParticle*>& particleMap,
337 unsigned int plane)
const;
342 float dx = particle.
EndX() - particle.
Vx();
343 float dy = particle.
EndY() - particle.
Vy();
344 float dz = particle.
EndZ() - particle.
Vz();
345 return dx * dx + dy * dy + dz * dz;
348 const std::unordered_map<int, const simb::MCParticle*>& particleMap)
const;
351 const std::unordered_map<int, const simb::MCParticle*>& particleMap)
const;
std::vector< std::string > const & outputLabels() const
network output labels
std::vector< float > const & wireEdep(size_t widx) const
std::vector< std::vector< float > > fWireDriftPatch
bool bufferPatch(size_t wire, float drift) const
art::InputTag fTrackModuleLabel
bool bufferPatch(size_t wire, float drift, std::vector< std::vector< float >> &patch) const
ChannelGroupService::Name Name
double getEdepTot() const
std::vector< std::string > fNNetOutputs
std::vector< float > patchData1D() const
virtual ~ModelInterface()
static FILE * findFile(const char *fileName)
art::InputTag fWireProducerLabel
std::vector< std::vector< float > > const & patchData2D() const
virtual void reconfigure(fhicl::ParameterSet const &pset)
std::vector< size_t > fEventsPerBin
art::InputTag fSimChannelProducerLabel
General LArSoft Utilities.
std::vector< std::vector< int > > fWireDriftPdg
double Vx(const int i=0) const
Declaration of signal hit object.
std::vector< std::vector< float > > fWireDriftEdep
Contains all timing reference information for the detector.
static float particleRange2(const simb::MCParticle &particle)
Provides recob::Track data product.
double Vz(const int i=0) const
nnet::ModelInterface * fNNet
std::unique_ptr< tf::Graph > g
art::InputTag fSimulationProducerLabel
std::string fNNetModelFilePath
std::vector< int > const & wirePdg(size_t widx) const
art::InputTag fHitProducerLabel
double Vy(const int i=0) const
Event finding and building.
TrainingDataAlg(const fhicl::ParameterSet &pset)
PointIdAlg(const fhicl::ParameterSet &pset)