54 virtual std::vector<float>
Run(
std::vector< std::vector<float> >
const & inp2d) = 0;
55 virtual std::vector< std::vector<float> >
Run(
std::vector<
std::vector< std::vector<float> > >
const & inps,
int samples = -1);
60 std::string
findFile(
const char* fileName)
const;
69 std::vector<float>
Run(
std::vector< std::vector<float> >
const & inp2d)
override;
81 std::vector< std::vector<float> >
Run(
std::vector<
std::vector< std::vector<float> > >
const & inps,
int samples = -1)
override;
82 std::vector<float>
Run(
std::vector< std::vector<float> >
const & inp2d)
override;
85 std::unique_ptr<tf::Graph>
g;
99 Name(
"NNetModelFile"),
Comment(
"Neural net model to apply.")
102 Name(
"NNetOutputs"),
Comment(
"Labels of the network outputs.")
106 Name(
"PatchSizeW"),
Comment(
"How many wires in patch.")
110 Name(
"PatchSizeD"),
Comment(
"How many downsampled ADC entries in patch")
123 std::vector< std::string >
const &
outputLabels(
void)
const {
return fNNetOutputs; }
126 float predictIdValue(
unsigned int wire,
float drift,
size_t outIdx = 0)
const;
129 std::vector<float> predictIdVector(
unsigned int wire,
float drift)
const;
131 std::vector< std::vector<float> > predictIdVectors(
std::vector< std::pair<unsigned int, float> > points)
const;
133 static std::vector<float> flattenData2D(
std::vector< std::vector<float> >
const & patch);
135 std::vector< std::vector<float> >
const &
patchData2D(
void)
const {
return fWireDriftPatch; }
136 std::vector<float>
patchData1D(
void)
const {
return flattenData2D(fWireDriftPatch); }
138 bool isInsideFiducialRegion(
unsigned int wire,
float drift)
const;
142 bool isCurrentPatch(
unsigned int wire,
float drift)
const;
145 bool isSamePatch(
unsigned int wire1,
float drift1,
unsigned int wire2,
float drift2)
const;
158 if (fDownscaleFullView)
160 size_t sd = (size_t)(drift / fDriftWindow);
161 if ((fCurrentWireIdx == wire) && (fCurrentScaledDrift == sd))
164 fCurrentWireIdx = wire; fCurrentScaledDrift = sd;
166 return patchFromDownsampledView(wire, drift, fPatchSizeW, fPatchSizeD, patch);
170 if ((fCurrentWireIdx == wire) && (fCurrentScaledDrift == drift))
173 fCurrentWireIdx = wire; fCurrentScaledDrift = drift;
175 return patchFromOriginalView(wire, drift, fPatchSizeW, fPatchSizeD, patch);
179 void resizePatch(
void);
181 void deleteNNet(
void) {
if (fNNet)
delete fNNet; fNNet = 0; }
194 kPdgMask = 0x00000FFF,
195 kTypeMask = 0x0000F000,
196 kVtxMask = 0xFFFF0000
209 kNuNC = 0x0010000, kNuCC = 0x0020000, kNuPri = 0x0040000,
215 kElectronEnd = 0x10000000
235 Comment(
"Tag of recob::Track.")
239 Name(
"SimulationLabel"),
240 Comment(
"Tag of simulation producer.")
244 Name(
"SaveVtxFlags"),
245 Comment(
"Include (or not) vertex info in PDG map.")
249 Name(
"AdcDelayTicks"),
250 Comment(
"ADC pulse peak delay in ticks (non-zero for not deconvoluted waveforms).")
262 void reconfigure(
const Config& config);
267 unsigned int plane,
unsigned int tpc,
unsigned int cryo);
269 bool setDataEventData(
const art::Event& event,
270 unsigned int plane,
unsigned int tpc,
unsigned int cryo);
273 bool findCrop(
float max_e_cut,
unsigned int & w0,
unsigned int & w1,
unsigned int & d0,
unsigned int & d1)
const;
276 std::vector<float>
const &
wireEdep(
size_t widx)
const {
return fWireDriftEdep[widx]; }
277 std::vector<int>
const &
wirePdg(
size_t widx)
const {
return fWireDriftPdg[widx]; }
281 void resizeView(
size_t wires,
size_t drifts)
override;
293 WireDrift getProjection(
const TLorentzVector& tvec,
unsigned int plane)
const;
295 bool setWireEdepsAndLabels(
296 std::vector<float>
const & edeps,
297 std::vector<int>
const & pdgs,
300 void collectVtxFlags(
301 std::unordered_map<
size_t, std::unordered_map< int, int > > & wireToDriftToVtxFlags,
302 const std::unordered_map< int, const simb::MCParticle* > & particleMap,
303 unsigned int plane)
const;
307 float dx = particle.
EndX() - particle.
Vx();
308 float dy = particle.
EndY() - particle.
Vy();
309 float dz = particle.
EndZ() - particle.
Vz();
310 return dx*dx + dy*dy + dz*dz;
314 const std::unordered_map< int, const simb::MCParticle* > & particleMap)
const;
318 const std::unordered_map< int, const simb::MCParticle* > & particleMap)
const;
bool bufferPatch(size_t wire, float drift, std::vector< std::vector< float > > &patch) const
std::vector< float > const & wireEdep(size_t widx) const
std::vector< float > patchData1D(void) const
std::vector< std::vector< int > > fWireDriftPdg
std::vector< std::vector< float > > const & patchData2D(void) const
bool bufferPatch(size_t wire, float drift) const
art::InputTag fTrackModuleLabel
Declaration of signal hit object.
virtual std::vector< float > Run(std::vector< std::vector< float > > const &inp2d)=0
std::vector< std::string > fNNetOutputs
art::InputTag fWireProducerLabel
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< std::string > const & outputLabels(void) const
network output labels
std::vector< std::vector< float > > fWireDriftPatch
Provides recob::Track data product.
std::vector< size_t > fEventsPerBin
double getEdepTot(void) const
double Vx(const int i=0) const
virtual ~ModelInterface(void)
std::string findFile(const char *fileName) const
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
std::vector< std::vector< float > > fWireDriftEdep
art::InputTag fHitProducerLabel
double Vy(const int i=0) const
Event finding and building.
TrainingDataAlg(const fhicl::ParameterSet &pset)
PointIdAlg(const fhicl::ParameterSet &pset)