20 class DetectorClocksData;
21 class DetectorPropertiesData;
42 #include <unordered_map> 47 class KerasModelInterface;
48 class TfModelInterface;
50 class TrainingDataAlg;
60 virtual std::vector<float> Run(
std::vector<std::vector<float>>
const& inp2d) = 0;
61 virtual std::vector<std::vector<float>> Run(
66 std::string findFile(
const char* fileName)
const;
74 std::vector<float> Run(
std::vector<std::vector<float>>
const& inp2d)
override;
86 int samples = -1)
override;
87 std::vector<float> Run(
std::vector<std::vector<float>>
const& inp2d)
override;
90 std::unique_ptr<tf::Graph>
g;
101 Comment(
"Neural net model to apply.")};
103 Comment(
"Labels of the network outputs.")};
107 Comment(
"How many downsampled ADC entries in patch")};
117 std::vector<std::string>
const&
outputLabels()
const {
return fNNetOutputs; }
120 float predictIdValue(
unsigned int wire,
float drift,
size_t outIdx = 0)
const;
123 std::vector<float> predictIdVector(
unsigned int wire,
float drift)
const;
125 std::vector<std::vector<float>> predictIdVectors(
126 std::vector<std::pair<unsigned int, float>> points)
const;
128 static std::vector<float> flattenData2D(
std::vector<std::vector<float>>
const& patch);
130 std::vector<std::vector<float>>
const&
patchData2D()
const {
return fWireDriftPatch; }
133 return flattenData2D(fWireDriftPatch);
136 bool isInsideFiducialRegion(
unsigned int wire,
float drift)
const;
140 bool isCurrentPatch(
unsigned int wire,
float drift)
const;
143 bool isSamePatch(
unsigned int wire1,
float drift1,
unsigned int wire2,
float drift2)
const;
156 if (fDownscaleFullView) {
157 size_t sd = (size_t)(drift / fDriftWindow);
158 if ((fCurrentWireIdx == wire) && (fCurrentScaledDrift == sd))
161 fCurrentWireIdx = wire;
162 fCurrentScaledDrift = sd;
164 return patchFromDownsampledView(wire, drift, fPatchSizeW, fPatchSizeD, patch);
167 if ((fCurrentWireIdx == wire) && (fCurrentScaledDrift == drift))
170 fCurrentWireIdx = wire;
171 fCurrentScaledDrift = drift;
173 return patchFromOriginalView(wire, drift, fPatchSizeW, fPatchSizeD, patch);
178 return bufferPatch(wire, drift, fWireDriftPatch);
184 if (fNNet)
delete fNNet;
196 kPdgMask = 0x00000FFF,
197 kTypeMask = 0x0000F000,
198 kVtxMask = 0xFFFF0000
219 kElectronEnd = 0x10000000,
220 kElastic = 0x20000000,
221 kInelastic = 0x40000000
235 Comment(
"Tag of simulation producer.")};
238 Comment(
"Tag of sim::SimChannel producer.")};
241 Comment(
"Include (or not) vertex info in PDG map.")};
244 Name(
"AdcDelayTicks"),
245 Comment(
"ADC pulse peak delay in ticks (non-zero for not deconvoluted waveforms).")};
256 void reconfigure(
const Config& config);
268 bool setDataEventData(
276 bool findCrop(
float max_e_cut,
280 unsigned int& d1)
const;
283 std::vector<float>
const&
wireEdep(
size_t widx)
const {
return fWireDriftEdep[widx]; }
284 std::vector<int>
const&
wirePdg(
size_t widx)
const {
return fWireDriftPdg[widx]; }
290 size_t drifts)
override;
303 const TLorentzVector& tvec,
304 unsigned int plane)
const;
306 bool setWireEdepsAndLabels(std::vector<float>
const& edeps,
307 std::vector<int>
const& pdgs,
310 void collectVtxFlags(
311 std::unordered_map<
size_t, std::unordered_map<int, int>>& wireToDriftToVtxFlags,
314 const std::unordered_map<int, const simb::MCParticle*>& particleMap,
315 unsigned int plane)
const;
319 float dx = particle.
EndX() - particle.
Vx();
320 float dy = particle.
EndY() - particle.
Vy();
321 float dz = particle.
EndZ() - particle.
Vz();
322 return dx * dx + dy * dy + dz * dz;
325 const std::unordered_map<int, const simb::MCParticle*>& particleMap)
const;
328 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
double getEdepTot() const
std::vector< std::string > fNNetOutputs
std::vector< float > patchData1D() const
virtual ~ModelInterface()
art::InputTag fWireProducerLabel
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< std::vector< float > > const & patchData2D() const
std::vector< size_t > fEventsPerBin
art::InputTag fSimChannelProducerLabel
General LArSoft Utilities.
std::vector< std::vector< int > > fWireDriftPdg
double Vx(const int i=0) const
std::vector< std::vector< float > > fWireDriftEdep
Contains all timing reference information for the detector.
static float particleRange2(const simb::MCParticle &particle)
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)
map< int, array< map< int, double >, 2 >> Table
PointIdAlg(const fhicl::ParameterSet &pset)