LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
nnet::TrainingDataAlg Class Reference

#include "PointIdAlg.h"

Inheritance diagram for nnet::TrainingDataAlg:
img::DataProviderAlg

Classes

struct  Config
 
struct  WireDrift
 

Public Types

enum  EMask { kNone = 0, kPdgMask = 0x00000FFF, kTypeMask = 0x0000F000, kVtxMask = 0xFFFF0000 }
 
enum  ETrkType { kDelta = 0x1000, kMichel = 0x2000, kPriEl = 0x4000, kPriMu = 0x8000 }
 
enum  EVtxId {
  kNuNC = 0x0010000, kNuCC = 0x0020000, kNuPri = 0x0040000, kNuE = 0x0100000,
  kNuMu = 0x0200000, kNuTau = 0x0400000, kHadr = 0x1000000, kPi0 = 0x2000000,
  kDecay = 0x4000000, kConv = 0x8000000, kElectronEnd = 0x10000000, kElastic = 0x20000000,
  kInelastic = 0x40000000
}
 
enum  EDownscaleMode { kMax = 1, kMaxMean = 2, kMean = 3 }
 

Public Member Functions

 TrainingDataAlg (const fhicl::ParameterSet &pset)
 
 TrainingDataAlg (const Config &config)
 
 ~TrainingDataAlg () override
 
void reconfigure (const Config &config)
 
bool saveSimInfo () const
 
bool setEventData (const art::Event &event, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, unsigned int plane, unsigned int tpc, unsigned int cryo)
 
bool setDataEventData (const art::Event &event, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, unsigned int plane, unsigned int tpc, unsigned int cryo)
 
bool findCrop (float max_e_cut, unsigned int &w0, unsigned int &w1, unsigned int &d0, unsigned int &d1) const
 
double getEdepTot () const
 
std::vector< float > const & wireEdep (size_t widx) const
 
std::vector< int > const & wirePdg (size_t widx) const
 
bool setWireDriftData (const detinfo::DetectorClocksData &clock_data, const detinfo::DetectorPropertiesData &det_prop, const std::vector< recob::Wire > &wires, unsigned int plane, unsigned int tpc, unsigned int cryo)
 
std::vector< float > const & wireData (size_t widx) const
 
std::vector< std::vector< float > > getPatch (size_t wire, float drift, size_t patchSizeW, size_t patchSizeD) const
 
float getPixelOrZero (int wire, int drift) const
 
double getAdcSum () const
 
size_t getAdcArea () const
 
float poolMax (int wire, int drift, size_t r=0) const
 Pool max value in a patch around the wire/drift pixel. More...
 
unsigned int Cryo () const
 Pool sum of pixels in a patch around the wire/drift pixel. More...
 
unsigned int TPC () const
 
unsigned int Plane () const
 
unsigned int NWires () const
 
unsigned int NScaledDrifts () const
 
unsigned int NCachedDrifts () const
 
unsigned int DriftWindow () const
 
float ZeroLevel () const
 Level of zero ADC after scaling. More...
 
double LifetimeCorrection (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double tick) const
 

Protected Member Functions

img::DataProviderAlgView resizeView (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, size_t wires, size_t drifts) override
 
std::vector< float > downscaleMax (std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const
 
std::vector< float > downscaleMaxMean (std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const
 
std::vector< float > downscaleMean (std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const
 
std::vector< float > downscale (std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const
 
size_t getDriftIndex (float drift) const
 
std::optional< std::vector< float > > setWireData (std::vector< float > const &adc, size_t wireIdx) const
 
bool patchFromDownsampledView (size_t wire, float drift, size_t size_w, size_t size_d, std::vector< std::vector< float >> &patch) const
 
bool patchFromOriginalView (size_t wire, float drift, size_t size_w, size_t size_d, std::vector< std::vector< float >> &patch) const
 

Protected Attributes

DataProviderAlgView fAlgView
 
EDownscaleMode fDownscaleMode
 
size_t fDriftWindow
 
bool fDownscaleFullView
 
float fDriftWindowInv
 
calo::CalorimetryAlg fCalorimetryAlg
 
geo::GeometryCore const * fGeometry
 

Private Member Functions

WireDrift getProjection (detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TLorentzVector &tvec, unsigned int plane) const
 
bool setWireEdepsAndLabels (std::vector< float > const &edeps, std::vector< int > const &pdgs, size_t wireIdx)
 
void collectVtxFlags (std::unordered_map< size_t, std::unordered_map< int, int >> &wireToDriftToVtxFlags, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const std::unordered_map< int, const simb::MCParticle * > &particleMap, unsigned int plane) const
 
bool isElectronEnd (const simb::MCParticle &particle, const std::unordered_map< int, const simb::MCParticle * > &particleMap) const
 
bool isMuonDecaying (const simb::MCParticle &particle, const std::unordered_map< int, const simb::MCParticle * > &particleMap) const
 

Static Private Member Functions

static float particleRange2 (const simb::MCParticle &particle)
 

Private Attributes

double fEdepTot
 
std::vector< std::vector< float > > fWireDriftEdep
 
std::vector< std::vector< int > > fWireDriftPdg
 
art::InputTag fWireProducerLabel
 
art::InputTag fHitProducerLabel
 
art::InputTag fTrackModuleLabel
 
art::InputTag fSimulationProducerLabel
 
art::InputTag fSimChannelProducerLabel
 
bool fSaveVtxFlags
 
bool fSaveSimInfo
 
unsigned int fAdcDelay
 
std::vector< size_t > fEventsPerBin
 

Detailed Description

Definition at line 196 of file PointIdAlg.h.

Member Enumeration Documentation

Enumerator
kMax 
kMaxMean 
kMean 

Definition at line 64 of file DataProviderAlg.h.

Enumerator
kNone 
kPdgMask 
kTypeMask 
kVtxMask 

Definition at line 198 of file PointIdAlg.h.

198  {
199  kNone = 0,
200  kPdgMask = 0x00000FFF, // pdg code mask
201  kTypeMask = 0x0000F000, // track type mask
202  kVtxMask = 0xFFFF0000 // vertex flags
203  };
Enumerator
kDelta 
kMichel 
kPriEl 
kPriMu 

Definition at line 205 of file PointIdAlg.h.

205  {
206  kDelta = 0x1000, // delta electron
207  kMichel = 0x2000, // Michel electron
208  kPriEl = 0x4000, // primary electron
209  kPriMu = 0x8000 // primary muon
210  };
Enumerator
kNuNC 
kNuCC 
kNuPri 
kNuE 
kNuMu 
kNuTau 
kHadr 
kPi0 
kDecay 
kConv 
kElectronEnd 
kElastic 
kInelastic 

Definition at line 212 of file PointIdAlg.h.

212  {
213  kNuNC = 0x0010000,
214  kNuCC = 0x0020000,
215  kNuPri = 0x0040000, // nu interaction type
216  kNuE = 0x0100000,
217  kNuMu = 0x0200000,
218  kNuTau = 0x0400000, // nu flavor
219  kHadr = 0x1000000, // hadronic inelastic scattering
220  kPi0 = 0x2000000, // pi0 produced in this vertex
221  kDecay = 0x4000000, // point of particle decay
222  kConv = 0x8000000, // gamma conversion
223  kElectronEnd = 0x10000000, // clear end of an electron
224  kElastic = 0x20000000, // Elastic scattering
225  kInelastic = 0x40000000 // Inelastic scattering
226  };

Constructor & Destructor Documentation

nnet::TrainingDataAlg::TrainingDataAlg ( const fhicl::ParameterSet pset)
inline

Definition at line 252 of file PointIdAlg.h.

254  {}
TrainingDataAlg(const fhicl::ParameterSet &pset)
Definition: PointIdAlg.h:252
nnet::TrainingDataAlg::TrainingDataAlg ( const Config config)

Definition at line 348 of file PointIdAlg.cxx.

References fSaveSimInfo, fSimChannelProducerLabel, fSimulationProducerLabel, art::InputTag::label(), and ~TrainingDataAlg().

349  : img::DataProviderAlg(config)
350  , fEdepTot(0)
351  , fWireProducerLabel(config.WireLabel())
352  , fHitProducerLabel(config.HitLabel())
353  , fTrackModuleLabel(config.TrackLabel())
354  , fSimulationProducerLabel(config.SimulationLabel())
355  , fSimChannelProducerLabel(config.SimChannelLabel())
356  , fSaveVtxFlags(config.SaveVtxFlags())
357  , fAdcDelay(config.AdcDelayTicks())
358  , fEventsPerBin(100, 0)
359 {
360  // If no sim channel producer is set then make it the same as the simulation label
362 
364 }
unsigned int fAdcDelay
Definition: PointIdAlg.h:346
art::InputTag fTrackModuleLabel
Definition: PointIdAlg.h:340
art::InputTag fWireProducerLabel
Definition: PointIdAlg.h:338
std::string const & label() const noexcept
Definition: InputTag.cc:79
std::vector< size_t > fEventsPerBin
Definition: PointIdAlg.h:348
art::InputTag fSimChannelProducerLabel
Definition: PointIdAlg.h:342
art::InputTag fSimulationProducerLabel
Definition: PointIdAlg.h:341
art::InputTag fHitProducerLabel
Definition: PointIdAlg.h:339
nnet::TrainingDataAlg::~TrainingDataAlg ( )
overridedefault

Referenced by TrainingDataAlg().

Member Function Documentation

void nnet::TrainingDataAlg::collectVtxFlags ( std::unordered_map< size_t, std::unordered_map< int, int >> &  wireToDriftToVtxFlags,
detinfo::DetectorClocksData const &  clockData,
detinfo::DetectorPropertiesData const &  detProp,
const std::unordered_map< int, const simb::MCParticle * > &  particleMap,
unsigned int  plane 
) const
private

Definition at line 564 of file PointIdAlg.cxx.

References util::abs(), simb::MCTrajectory::at(), img::DataProviderAlg::Cryo(), d, getProjection(), isElectronEnd(), isMuonDecaying(), kConv, kDecay, kElastic, kElectronEnd, simb::MCTrajectory::KeyToProcess(), kHadr, kInelastic, kNone, kNuPri, kPi0, img::DataProviderAlg::TPC(), and simb::MCTrajectory::TrajectoryProcesses().

Referenced by setEventData().

570 {
571  for (auto const& p : particleMap) {
572  auto const& particle = *p.second;
573 
574  double ekStart = 1000. * (particle.E() - particle.Mass());
575  double ekEnd = 1000. * (particle.EndE() - particle.Mass());
576  int pdg = abs(particle.PdgCode());
577  int flagsStart = nnet::TrainingDataAlg::kNone;
578  int flagsEnd = nnet::TrainingDataAlg::kNone;
579 
580  switch (pdg) {
581  case 22: // gamma
582  if ((particle.EndProcess() == "conv") && (ekStart > 40.0)) // conversion, gamma > 40MeV
583  {
584  flagsEnd = nnet::TrainingDataAlg::kConv;
585  }
586  break;
587 
588  case 11: // e+/-
589  if (isElectronEnd(particle, particleMap)) { flagsEnd = nnet::TrainingDataAlg::kElectronEnd; }
590  break;
591 
592  case 13: // mu+/-
593  if (isMuonDecaying(particle, particleMap)) { flagsEnd = nnet::TrainingDataAlg::kDecay; }
594  break;
595 
596  case 111: // pi0
597  flagsStart = nnet::TrainingDataAlg::kPi0;
598  break;
599 
600  case 321: // K+/-
601  case 211: // pi+/-
602  case 2212: // proton
603  if (ekStart > 50.0) {
604  if (particle.Mother() != 0) {
605  auto search = particleMap.find(particle.Mother());
606  if (search != particleMap.end()) {
607  auto const& mother = *((*search).second);
608  int m_pdg = abs(mother.PdgCode());
609  unsigned int nSec = mother.NumberDaughters();
610  unsigned int nVisible = 0;
611  if (nSec > 1) {
612  for (size_t d = 0; d < nSec; ++d) {
613  auto d_search = particleMap.find(mother.Daughter(d));
614  if (d_search != particleMap.end()) {
615  auto const& daughter = *((*d_search).second);
616  int d_pdg = abs(daughter.PdgCode());
617  if (((d_pdg == 2212) || (d_pdg == 211) || (d_pdg == 321)) &&
618  (1000. * (daughter.E() - daughter.Mass()) > 50.0)) {
619  ++nVisible;
620  }
621  }
622  }
623  }
624  // hadron with Ek > 50MeV (so well visible) and
625  // produced by another hadron (but not neutron, so not single track from nothing) or
626  // at least secondary hadrons with Ek > 50MeV (so this is a good kink or V-like)
627  if (((m_pdg != pdg) && (m_pdg != 2112)) || ((m_pdg != 2112) && (nVisible > 0)) ||
628  ((m_pdg == 2112) && (nVisible > 1))) {
629  flagsStart = nnet::TrainingDataAlg::kHadr;
630  }
631  }
632  }
633 
634  if (particle.EndProcess() == "FastScintillation") // potential decay at rest
635  {
636  unsigned int nSec = particle.NumberDaughters();
637  for (size_t d = 0; d < nSec; ++d) {
638  auto d_search = particleMap.find(particle.Daughter(d));
639  if (d_search != particleMap.end()) {
640  auto const& daughter = *((*d_search).second);
641  int d_pdg = abs(daughter.PdgCode());
642  if ((pdg == 321) && (d_pdg == 13)) {
644  break;
645  }
646  if ((pdg == 211) && (d_pdg == 13)) {
648  break;
649  }
650  }
651  }
652  }
653 
654  if ((particle.EndProcess() == "Decay") && (ekEnd > 200.0)) // decay in flight
655  {
656  unsigned int nSec = particle.NumberDaughters();
657  for (size_t d = 0; d < nSec; ++d) {
658  auto d_search = particleMap.find(particle.Daughter(d));
659  if (d_search != particleMap.end()) {
660  auto const& daughter = *((*d_search).second);
661  int d_pdg = abs(daughter.PdgCode());
662  if ((pdg == 321) && (d_pdg == 13)) {
663  flagsEnd = nnet::TrainingDataAlg::kHadr;
664  break;
665  }
666  if ((pdg == 211) && (d_pdg == 13)) {
667  flagsEnd = nnet::TrainingDataAlg::kHadr;
668  break;
669  }
670  }
671  }
672  }
673  }
674  break;
675 
676  default: continue;
677  }
678 
679  if (particle.Process() == "primary") { flagsStart |= nnet::TrainingDataAlg::kNuPri; }
680 
681  if (flagsStart != nnet::TrainingDataAlg::kNone) {
682  auto wd = getProjection(clockData, detProp, particle.Position(), plane);
683 
684  if ((wd.TPC == TPC()) && (wd.Cryo == Cryo())) {
685  wireToDriftToVtxFlags[wd.Wire][wd.Drift] |= flagsStart;
686  }
687  }
688  if (flagsEnd != nnet::TrainingDataAlg::kNone) {
689  auto wd = getProjection(clockData, detProp, particle.EndPosition(), plane);
690  if ((wd.TPC == TPC()) && (wd.Cryo == Cryo())) {
691  wireToDriftToVtxFlags[wd.Wire][wd.Drift] |= flagsEnd;
692  }
693  }
694 
695  //TY: check elastic/inelastic scattering
696  if (pdg == 321 || pdg == 211 || pdg == 2212) {
697  simb::MCTrajectory truetraj = particle.Trajectory();
698  auto thisTrajectoryProcessMap1 = truetraj.TrajectoryProcesses();
699  if (thisTrajectoryProcessMap1.size()) {
700  for (auto const& couple1 : thisTrajectoryProcessMap1) {
701  if ((truetraj.KeyToProcess(couple1.second)).find("Elastic") != std::string::npos) {
702  auto wd = getProjection(clockData, detProp, truetraj.at(couple1.first).first, plane);
703  if ((wd.TPC == TPC()) && (wd.Cryo == Cryo())) {
704  wireToDriftToVtxFlags[wd.Wire][wd.Drift] |= nnet::TrainingDataAlg::kElastic;
705  }
706  }
707  if ((truetraj.KeyToProcess(couple1.second)).find("Inelastic") != std::string::npos) {
708  auto wd = getProjection(clockData, detProp, truetraj.at(couple1.first).first, plane);
709  if ((wd.TPC == TPC()) && (wd.Cryo == Cryo())) {
710  wireToDriftToVtxFlags[wd.Wire][wd.Drift] |= nnet::TrainingDataAlg::kInelastic;
711  }
712  }
713  }
714  }
715  }
716  }
717 }
bool isMuonDecaying(const simb::MCParticle &particle, const std::unordered_map< int, const simb::MCParticle * > &particleMap) const
Definition: PointIdAlg.cxx:534
const value_type & at(const size_type i) const
Definition: MCTrajectory.h:175
std::string KeyToProcess(unsigned char const &key) const
constexpr auto abs(T v)
Returns the absolute value of the argument.
WireDrift getProjection(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TLorentzVector &tvec, unsigned int plane) const
Definition: PointIdAlg.cxx:436
bool isElectronEnd(const simb::MCParticle &particle, const std::unordered_map< int, const simb::MCParticle * > &particleMap) const
Definition: PointIdAlg.cxx:480
Float_t d
Definition: plot.C:235
ProcessMap const & TrajectoryProcesses() const
Definition: MCTrajectory.h:188
unsigned int Cryo() const
Pool sum of pixels in a patch around the wire/drift pixel.
unsigned int TPC() const
unsigned int img::DataProviderAlg::Cryo ( ) const
inlineinherited

Pool sum of pixels in a patch around the wire/drift pixel.

Definition at line 161 of file DataProviderAlg.h.

Referenced by collectVtxFlags().

161 { return fCryo; }
std::vector<float> img::DataProviderAlg::downscale ( std::size_t  dst_size,
std::vector< float > const &  adc,
size_t  tick0 
) const
inlineprotectedinherited

Definition at line 198 of file DataProviderAlg.h.

References img::DataProviderAlg::kMax, img::DataProviderAlg::kMaxMean, and img::DataProviderAlg::kMean.

Referenced by img::DataProviderAlg::patchFromOriginalView(), and img::DataProviderAlg::setWireData().

201  {
202  switch (fDownscaleMode) {
203  case img::DataProviderAlg::kMean: return downscaleMean(dst_size, adc, tick0);
204  case img::DataProviderAlg::kMaxMean: return downscaleMaxMean(dst_size, adc, tick0);
205  case img::DataProviderAlg::kMax: return downscaleMax(dst_size, adc, tick0);
206  }
207  throw cet::exception("img::DataProviderAlg") << "Downscale mode not supported." << std::endl;
208  }
std::vector< float > downscaleMaxMean(std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const
std::vector< float > downscaleMax(std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const
std::vector< float > downscaleMean(std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const
EDownscaleMode fDownscaleMode
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< float > img::DataProviderAlg::downscaleMax ( std::size_t  dst_size,
std::vector< float > const &  adc,
size_t  tick0 
) const
protectedinherited

Definition at line 196 of file DataProviderAlg.cxx.

References img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlgView::fLifetimeCorrFactors, and img::DataProviderAlg::scaleAdcSamples().

199 {
200  size_t kStop = dst_size;
201  std::vector<float> result(dst_size);
202  if (adc.size() < kStop) { kStop = adc.size(); }
203  for (size_t i = 0, k0 = 0; i < kStop; ++i, k0 += fDriftWindow) {
204  size_t k1 = k0 + fDriftWindow;
205 
206  float max_adc = adc[k0] * fAlgView.fLifetimeCorrFactors[k0 + tick0];
207  for (size_t k = k0 + 1; k < k1; ++k) {
208  float ak = adc[k] * fAlgView.fLifetimeCorrFactors[k + tick0];
209  if (ak > max_adc) max_adc = ak;
210  }
211  result[i] = max_adc;
212  }
213  scaleAdcSamples(result);
214  return result;
215 }
void scaleAdcSamples(std::vector< float > &values) const
DataProviderAlgView fAlgView
std::vector< float > fLifetimeCorrFactors
std::vector< float > img::DataProviderAlg::downscaleMaxMean ( std::size_t  dst_size,
std::vector< float > const &  adc,
size_t  tick0 
) const
protectedinherited

Definition at line 217 of file DataProviderAlg.cxx.

References img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlgView::fLifetimeCorrFactors, n, and img::DataProviderAlg::scaleAdcSamples().

220 {
221  size_t kStop = dst_size;
222  std::vector<float> result(dst_size);
223  if (adc.size() < kStop) { kStop = adc.size(); }
224  for (size_t i = 0, k0 = 0; i < kStop; ++i, k0 += fDriftWindow) {
225  size_t k1 = k0 + fDriftWindow;
226  size_t max_idx = k0;
227  float max_adc = adc[k0] * fAlgView.fLifetimeCorrFactors[k0 + tick0];
228  for (size_t k = k0 + 1; k < k1; ++k) {
229  float ak = adc[k] * fAlgView.fLifetimeCorrFactors[k + tick0];
230  if (ak > max_adc) {
231  max_adc = ak;
232  max_idx = k;
233  }
234  }
235 
236  size_t n = 1;
237  if (max_idx > 0) {
238  max_adc += adc[max_idx - 1] * fAlgView.fLifetimeCorrFactors[max_idx - 1 + tick0];
239  n++;
240  }
241  if (max_idx + 1 < adc.size()) {
242  max_adc += adc[max_idx + 1] * fAlgView.fLifetimeCorrFactors[max_idx + 1 + tick0];
243  n++;
244  }
245 
246  result[i] = max_adc / n;
247  }
248  scaleAdcSamples(result);
249  return result;
250 }
void scaleAdcSamples(std::vector< float > &values) const
DataProviderAlgView fAlgView
std::vector< float > fLifetimeCorrFactors
Char_t n[5]
std::vector< float > img::DataProviderAlg::downscaleMean ( std::size_t  dst_size,
std::vector< float > const &  adc,
size_t  tick0 
) const
protectedinherited

Definition at line 252 of file DataProviderAlg.cxx.

References img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlg::fDriftWindowInv, img::DataProviderAlgView::fLifetimeCorrFactors, and img::DataProviderAlg::scaleAdcSamples().

255 {
256  size_t kStop = dst_size;
257  std::vector<float> result(dst_size);
258  if (adc.size() < kStop) { kStop = adc.size(); }
259  for (size_t i = 0, k0 = 0; i < kStop; ++i, k0 += fDriftWindow) {
260  size_t k1 = k0 + fDriftWindow;
261 
262  float sum_adc = 0;
263  for (size_t k = k0; k < k1; ++k) {
264  if (k + tick0 < fAlgView.fLifetimeCorrFactors.size())
265  sum_adc += adc[k] * fAlgView.fLifetimeCorrFactors[k + tick0];
266  }
267  result[i] = sum_adc * fDriftWindowInv;
268  }
269  scaleAdcSamples(result);
270  return result;
271 }
void scaleAdcSamples(std::vector< float > &values) const
DataProviderAlgView fAlgView
std::vector< float > fLifetimeCorrFactors
unsigned int img::DataProviderAlg::DriftWindow ( ) const
inlineinherited

Definition at line 168 of file DataProviderAlg.h.

168 { return fDriftWindow; }
bool nnet::TrainingDataAlg::findCrop ( float  max_e_cut,
unsigned int &  w0,
unsigned int &  w1,
unsigned int &  d0,
unsigned int &  d1 
) const

Definition at line 1026 of file PointIdAlg.cxx.

References d, and fWireDriftEdep.

Referenced by nnet::PointIdTrainingData::analyze().

1031 {
1032  if (fWireDriftEdep.empty() || fWireDriftEdep.front().empty()) return false;
1033 
1034  float max_cut = 0.25 * max_e_cut;
1035 
1036  w0 = 0;
1037  float cut = 0;
1038  while (w0 < fWireDriftEdep.size()) {
1039  for (auto const d : fWireDriftEdep[w0])
1040  cut += d;
1041  if (cut < max_cut)
1042  w0++;
1043  else
1044  break;
1045  }
1046  w1 = fWireDriftEdep.size() - 1;
1047  cut = 0;
1048  while (w1 > w0) {
1049  for (auto const d : fWireDriftEdep[w1])
1050  cut += d;
1051  if (cut < max_cut)
1052  w1--;
1053  else
1054  break;
1055  }
1056  w1++;
1057 
1058  d0 = 0;
1059  cut = 0;
1060  while (d0 < fWireDriftEdep.front().size()) {
1061  for (size_t i = w0; i < w1; ++i)
1062  cut += fWireDriftEdep[i][d0];
1063  if (cut < max_cut)
1064  d0++;
1065  else
1066  break;
1067  }
1068  d1 = fWireDriftEdep.front().size() - 1;
1069  cut = 0;
1070  while (d1 > d0) {
1071  for (size_t i = w0; i < w1; ++i)
1072  cut += fWireDriftEdep[i][d1];
1073  if (cut < max_cut)
1074  d1--;
1075  else
1076  break;
1077  }
1078  d1++;
1079 
1080  unsigned int margin = 20;
1081  if ((w1 - w0 > 8) && (d1 - d0 > 8)) {
1082  if (w0 < margin)
1083  w0 = 0;
1084  else
1085  w0 -= margin;
1086 
1087  if (w1 > fWireDriftEdep.size() - margin)
1088  w1 = fWireDriftEdep.size();
1089  else
1090  w1 += margin;
1091 
1092  if (d0 < margin)
1093  d0 = 0;
1094  else
1095  d0 -= margin;
1096 
1097  if (d1 > fWireDriftEdep.front().size() - margin)
1098  d1 = fWireDriftEdep.front().size();
1099  else
1100  d1 += margin;
1101 
1102  return true;
1103  }
1104  else
1105  return false;
1106 }
Float_t d
Definition: plot.C:235
std::vector< std::vector< float > > fWireDriftEdep
Definition: PointIdAlg.h:335
size_t img::DataProviderAlg::getAdcArea ( ) const
inlineinherited

Definition at line 153 of file DataProviderAlg.h.

References r.

153 { return fAdcAreaOverThr; }
double img::DataProviderAlg::getAdcSum ( ) const
inlineinherited

Definition at line 152 of file DataProviderAlg.h.

152 { return fAdcSumOverThr; }
size_t img::DataProviderAlg::getDriftIndex ( float  drift) const
inlineprotectedinherited

Definition at line 210 of file DataProviderAlg.h.

References lar::dump::vector().

Referenced by img::DataProviderAlg::poolMax().

211  {
212  if (fDownscaleFullView)
213  return (size_t)(drift * fDriftWindowInv);
214  else
215  return (size_t)drift;
216  }
double nnet::TrainingDataAlg::getEdepTot ( ) const
inline

Definition at line 286 of file PointIdAlg.h.

286 { return fEdepTot; } // [GeV]
std::vector<std::vector<float> > img::DataProviderAlg::getPatch ( size_t  wire,
float  drift,
size_t  patchSizeW,
size_t  patchSizeD 
) const
inlineinherited

Return patch of data centered on the wire and drift, witht the size in (downscaled) pixels givent with patchSizeW and patchSizeD. Pad with the zero-level calue if patch extends beyond the event projection.

Definition at line 122 of file DataProviderAlg.h.

126  {
127  bool ok = false;
128  std::vector<std::vector<float>> patch;
129  if (fDownscaleFullView) {
130  ok = patchFromDownsampledView(wire, drift, patchSizeW, patchSizeD, patch);
131  }
132  else {
133  ok = patchFromOriginalView(wire, drift, patchSizeW, patchSizeD, patch);
134  }
135 
136  if (ok) return patch;
137  throw cet::exception("img::DataProviderAlg") << "Patch filling failed." << std::endl;
138  }
bool patchFromOriginalView(size_t wire, float drift, size_t size_w, size_t size_d, std::vector< std::vector< float >> &patch) const
bool patchFromDownsampledView(size_t wire, float drift, size_t size_w, size_t size_d, std::vector< std::vector< float >> &patch) const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
float img::DataProviderAlg::getPixelOrZero ( int  wire,
int  drift 
) const
inlineinherited

Return value from the ADC buffer, or zero if coordinates are out of the view; will scale the drift according to the downscale settings.

Definition at line 142 of file DataProviderAlg.h.

143  {
144  size_t didx = getDriftIndex(drift), widx = (size_t)wire;
145 
146  if ((widx < fAlgView.fWireDriftData.size()) && (didx < fAlgView.fNCachedDrifts)) {
147  return fAlgView.fWireDriftData[widx][didx];
148  }
149  return 0;
150  }
std::vector< std::vector< float > > fWireDriftData
DataProviderAlgView fAlgView
size_t getDriftIndex(float drift) const
nnet::TrainingDataAlg::WireDrift nnet::TrainingDataAlg::getProjection ( detinfo::DetectorClocksData const &  clockData,
detinfo::DetectorPropertiesData const &  detProp,
const TLorentzVector &  tvec,
unsigned int  plane 
) const
private

Definition at line 436 of file PointIdAlg.cxx.

References detinfo::DetectorPropertiesData::ConvertXToTicks(), nnet::TrainingDataAlg::WireDrift::Cryo, geo::CryostatID::Cryostat, geo::TPCGeo::DetectDriftDirection(), nnet::TrainingDataAlg::WireDrift::Drift, detinfo::DetectorPropertiesData::DriftVelocity(), e, img::DataProviderAlg::fGeometry, geo::GeometryCore::FindTPCAtPosition(), geo::CryostatID::isValid, geo::GeometryCore::NearestWireID(), nnet::TrainingDataAlg::WireDrift::TPC, geo::TPCID::TPC, geo::GeometryCore::TPC(), and nnet::TrainingDataAlg::WireDrift::Wire.

Referenced by collectVtxFlags().

441 {
443  wd.Wire = 0;
444  wd.Drift = 0;
445  wd.TPC = -1;
446  wd.Cryo = -1;
447 
448  try {
449  geo::Point_t vtx{tvec.X(), tvec.Y(), tvec.Z()};
450  if (fGeometry->FindTPCAtPosition(vtx).isValid) {
451  geo::TPCID tpcid = fGeometry->FindTPCAtPosition(vtx);
452  unsigned int tpc = tpcid.TPC, cryo = tpcid.Cryostat;
453 
454  // correct for the time offset
455  float dx = tvec.T() * 1.e-3 * detProp.DriftVelocity();
456  int driftDir = fGeometry->TPC(tpcid).DetectDriftDirection();
457  if (driftDir == 1) { dx *= -1; }
458  else if (driftDir != -1) {
459  throw cet::exception("nnet::TrainingDataAlg") << "drift direction is not X." << std::endl;
460  }
461  vtx.SetX(tvec.X() + dx);
462 
463  wd.Wire = fGeometry->NearestWireID(vtx, geo::PlaneID{tpcid, plane}).Wire;
464  wd.Drift = detProp.ConvertXToTicks(vtx.X(), plane, tpc, cryo);
465  wd.TPC = tpc;
466  wd.Cryo = cryo;
467  }
468  }
469  catch (const geo::InvalidWireError& e) {
470  mf::LogWarning("TrainingDataAlg")
471  << "Vertex projection out of wire planes, just skipping this vertex.";
472  }
473  catch (...) {
474  mf::LogWarning("TrainingDataAlg") << "Vertex projection out of wire planes, skip MC vertex.";
475  }
476  return wd;
477 }
geo::GeometryCore const * fGeometry
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:210
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:211
TPCGeo const & TPC(TPCID const &tpcid=tpc_zero) const
Returns the specified TPC.
Definition: GeometryCore.h:722
TPCID FindTPCAtPosition(Point_t const &point) const
Returns the ID of the TPC at specified location.
The data type to uniquely identify a TPC.
Definition: geo_types.h:381
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:180
WireID NearestWireID(Point_t const &point, PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.cxx:149
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Exception thrown on invalid wire number.
Definition: Exceptions.h:39
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:399
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
bool nnet::TrainingDataAlg::isElectronEnd ( const simb::MCParticle particle,
const std::unordered_map< int, const simb::MCParticle * > &  particleMap 
) const
private

Definition at line 480 of file PointIdAlg.cxx.

References util::abs(), d, simb::MCParticle::Daughter(), simb::MCParticle::NumberDaughters(), particleRange2(), and simb::MCParticle::PdgCode().

Referenced by collectVtxFlags().

483 {
484  const float minElectronLength2 = 2.5 * 2.5;
485  const float maxDeltaLength2 = 0.15 * 0.15;
486 
487  int pdg = abs(particle.PdgCode());
488  if (pdg != 11) return false; // should be applied only to electrons
489 
490  size_t nSec = particle.NumberDaughters();
491  for (size_t d = 0; d < nSec; ++d) {
492  auto d_search = particleMap.find(particle.Daughter(d));
493  if (d_search != particleMap.end()) {
494  auto const& daughter = *((*d_search).second);
495  int d_pdg = abs(daughter.PdgCode());
496  if (d_pdg != 22) { return false; } // not the end of the shower
497  }
498  }
499 
500  float trkLength2 = 0;
501  auto const* p = &particle;
502  bool branching = false;
503  while (!branching) {
504  trkLength2 += particleRange2(*p);
505  auto m_search = particleMap.find(p->Mother());
506  if (m_search != particleMap.end()) {
507  p = (*m_search).second;
508  int m_pdg = abs(p->PdgCode());
509  if (m_pdg == 11) {
510  nSec = p->NumberDaughters();
511  size_t ne = 0;
512  for (size_t d = 0; d < nSec; ++d) {
513  auto d_search = particleMap.find(p->Daughter(d));
514  if (d_search != particleMap.end()) {
515  auto const& daughter = *((*d_search).second);
516  int d_pdg = abs(daughter.PdgCode());
517  if (d_pdg == 11) {
518  if (particleRange2(daughter) > maxDeltaLength2) { ne++; }
519  }
520  }
521  }
522  if (ne > 1) { branching = true; }
523  }
524  else
525  break;
526  }
527  else
528  break;
529  }
530 
531  return (trkLength2 > minElectronLength2);
532 }
int PdgCode() const
Definition: MCParticle.h:213
constexpr auto abs(T v)
Returns the absolute value of the argument.
int NumberDaughters() const
Definition: MCParticle.h:218
int Daughter(const int i) const
Definition: MCParticle.cxx:118
Float_t d
Definition: plot.C:235
static float particleRange2(const simb::MCParticle &particle)
Definition: PointIdAlg.h:321
bool nnet::TrainingDataAlg::isMuonDecaying ( const simb::MCParticle particle,
const std::unordered_map< int, const simb::MCParticle * > &  particleMap 
) const
private

Definition at line 534 of file PointIdAlg.cxx.

References util::abs(), d, simb::MCParticle::Daughter(), simb::MCParticle::EndProcess(), simb::MCParticle::NumberDaughters(), and simb::MCParticle::PdgCode().

Referenced by collectVtxFlags().

537 {
538  bool hasElectron = false, hasNuMu = false, hasNuE = false;
539 
540  int pdg = abs(particle.PdgCode());
541  //if ((pdg == 13) && (particle.EndProcess() == "FastScintillation" || particle.EndProcess() == "Decay" || particle.EndProcess() == "muMinusCaptureAtRest")) // potential muon decay at rest
542  if ((pdg == 13) && (particle.EndProcess() == "FastScintillation" ||
543  particle.EndProcess() == "Decay")) // potential muon decay at rest
544  {
545  unsigned int nSec = particle.NumberDaughters();
546  for (size_t d = 0; d < nSec; ++d) {
547  auto d_search = particleMap.find(particle.Daughter(d));
548  if (d_search != particleMap.end()) {
549  auto const& daughter = *((*d_search).second);
550  int d_pdg = abs(daughter.PdgCode());
551  if (d_pdg == 11)
552  hasElectron = true;
553  else if (d_pdg == 14)
554  hasNuMu = true;
555  else if (d_pdg == 12)
556  hasNuE = true;
557  }
558  }
559  }
560 
561  return (hasElectron && hasNuMu && hasNuE);
562 }
int PdgCode() const
Definition: MCParticle.h:213
constexpr auto abs(T v)
Returns the absolute value of the argument.
int NumberDaughters() const
Definition: MCParticle.h:218
int Daughter(const int i) const
Definition: MCParticle.cxx:118
std::string EndProcess() const
Definition: MCParticle.h:217
Float_t d
Definition: plot.C:235
double img::DataProviderAlg::LifetimeCorrection ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
double  tick 
) const
inlineinherited

Definition at line 173 of file DataProviderAlg.h.

176  {
177  return fCalorimetryAlg.LifetimeCorrection(clock_data, det_prop, tick);
178  }
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
calo::CalorimetryAlg fCalorimetryAlg
double LifetimeCorrection(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double time, double T0=0) const
unsigned int img::DataProviderAlg::NCachedDrifts ( ) const
inlineinherited

Definition at line 167 of file DataProviderAlg.h.

167 { return fAlgView.fNCachedDrifts; }
DataProviderAlgView fAlgView
unsigned int img::DataProviderAlg::NScaledDrifts ( ) const
inlineinherited

Definition at line 166 of file DataProviderAlg.h.

Referenced by nnet::PointIdTrainingData::analyze().

166 { return fAlgView.fNScaledDrifts; }
DataProviderAlgView fAlgView
unsigned int img::DataProviderAlg::NWires ( ) const
inlineinherited

Definition at line 165 of file DataProviderAlg.h.

Referenced by nnet::PointIdTrainingData::analyze().

165 { return fAlgView.fNWires; }
DataProviderAlgView fAlgView
static float nnet::TrainingDataAlg::particleRange2 ( const simb::MCParticle particle)
inlinestaticprivate

Definition at line 321 of file PointIdAlg.h.

References simb::MCParticle::EndX(), simb::MCParticle::EndY(), simb::MCParticle::EndZ(), simb::MCParticle::Vx(), simb::MCParticle::Vy(), and simb::MCParticle::Vz().

Referenced by isElectronEnd().

322  {
323  float dx = particle.EndX() - particle.Vx();
324  float dy = particle.EndY() - particle.Vy();
325  float dz = particle.EndZ() - particle.Vz();
326  return dx * dx + dy * dy + dz * dz;
327  }
double EndZ() const
Definition: MCParticle.h:229
double EndY() const
Definition: MCParticle.h:228
double Vx(const int i=0) const
Definition: MCParticle.h:222
double Vz(const int i=0) const
Definition: MCParticle.h:224
double EndX() const
Definition: MCParticle.h:227
double Vy(const int i=0) const
Definition: MCParticle.h:223
bool img::DataProviderAlg::patchFromDownsampledView ( size_t  wire,
float  drift,
size_t  size_w,
size_t  size_d,
std::vector< std::vector< float >> &  patch 
) const
protectedinherited

Definition at line 439 of file DataProviderAlg.cxx.

References d, img::DataProviderAlg::fAdcZero, img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDriftWindow, trkf::fill(), img::DataProviderAlgView::fWireDriftData, and w.

444 {
445  int halfSizeW = size_w / 2;
446  int halfSizeD = size_d / 2;
447 
448  int w0 = wire - halfSizeW;
449  int w1 = wire + halfSizeW;
450 
451  size_t sd = (size_t)(drift / fDriftWindow);
452  int d0 = sd - halfSizeD;
453  int d1 = sd + halfSizeD;
454 
455  int wsize = fAlgView.fWireDriftData.size();
456  for (int w = w0, wpatch = 0; w < w1; ++w, ++wpatch) {
457  auto& dst = patch[wpatch];
458  if ((w >= 0) && (w < wsize)) {
459  auto& src = fAlgView.fWireDriftData[w];
460  int dsize = src.size();
461  for (int d = d0, dpatch = 0; d < d1; ++d, ++dpatch) {
462  if ((d >= 0) && (d < dsize)) { dst[dpatch] = src[d]; }
463  else {
464  dst[dpatch] = fAdcZero;
465  }
466  }
467  }
468  else {
469  std::fill(dst.begin(), dst.end(), fAdcZero);
470  }
471  }
472 
473  return true;
474 }
std::vector< std::vector< float > > fWireDriftData
Float_t d
Definition: plot.C:235
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
DataProviderAlgView fAlgView
Float_t w
Definition: plot.C:20
bool img::DataProviderAlg::patchFromOriginalView ( size_t  wire,
float  drift,
size_t  size_w,
size_t  size_d,
std::vector< std::vector< float >> &  patch 
) const
protectedinherited

Definition at line 476 of file DataProviderAlg.cxx.

References d, img::DataProviderAlg::downscale(), img::DataProviderAlg::fAdcZero, img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDriftWindow, trkf::fill(), img::DataProviderAlgView::fWireDriftData, util::size(), tmp, and w.

481 {
482  int dsize = fDriftWindow * size_d;
483  int halfSizeW = size_w / 2;
484  int halfSizeD = dsize / 2;
485 
486  int w0 = wire - halfSizeW;
487  int w1 = wire + halfSizeW;
488 
489  int d0 = int(drift) - halfSizeD;
490  int d1 = int(drift) + halfSizeD;
491 
492  if (d0 < 0) d0 = 0;
493 
494  std::vector<float> tmp(dsize);
495  int wsize = fAlgView.fWireDriftData.size();
496  for (int w = w0, wpatch = 0; w < w1; ++w, ++wpatch) {
497  if ((w >= 0) && (w < wsize)) {
498  auto& src = fAlgView.fWireDriftData[w];
499  int src_size = src.size();
500  for (int d = d0, dpatch = 0; d < d1; ++d, ++dpatch) {
501  if ((d >= 0) && (d < src_size)) { tmp[dpatch] = src[d]; }
502  else {
503  tmp[dpatch] = fAdcZero;
504  }
505  }
506  }
507  else {
508  std::fill(tmp.begin(), tmp.end(), fAdcZero);
509  }
510  patch[wpatch] = downscale(patch[wpatch].size(), tmp, d0);
511  }
512 
513  return true;
514 }
std::vector< std::vector< float > > fWireDriftData
std::vector< float > downscale(std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const
Float_t tmp
Definition: plot.C:35
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
Float_t d
Definition: plot.C:235
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
DataProviderAlgView fAlgView
Float_t w
Definition: plot.C:20
unsigned int img::DataProviderAlg::Plane ( ) const
inlineinherited
float img::DataProviderAlg::poolMax ( int  wire,
int  drift,
size_t  r = 0 
) const
inherited

Pool max value in a patch around the wire/drift pixel.

Definition at line 145 of file DataProviderAlg.cxx.

References col, d, img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDownscaleFullView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlgView::fNCachedDrifts, img::DataProviderAlgView::fNWires, img::DataProviderAlgView::fWireDriftData, img::DataProviderAlg::getDriftIndex(), r, and w.

Referenced by pma::ProjectionMatchingAlg::validate_on_adc(), and pma::ProjectionMatchingAlg::validate_on_adc_test().

146 {
147  size_t rw = r, rd = r;
148  if (!fDownscaleFullView) { rd *= fDriftWindow; }
149 
150  size_t didx = getDriftIndex(drift);
151  int d0 = didx - rd;
152  if (d0 < 0) { d0 = 0; }
153  int d1 = didx + rd;
154  if (d1 >= (int)fAlgView.fNCachedDrifts) { d1 = fAlgView.fNCachedDrifts - 1; }
155 
156  int w0 = wire - rw;
157  if (w0 < 0) { w0 = 0; }
158  int w1 = wire + rw;
159  if (w1 >= (int)fAlgView.fNWires) { w1 = fAlgView.fNWires - 1; }
160 
161  float adc, max_adc = 0;
162  for (int w = w0; w <= w1; ++w) {
163  auto const* col = fAlgView.fWireDriftData[w].data();
164  for (int d = d0; d <= d1; ++d) {
165  adc = col[d];
166  if (adc > max_adc) { max_adc = adc; }
167  }
168  }
169 
170  return max_adc;
171 }
TRandom r
Definition: spectrum.C:23
std::vector< std::vector< float > > fWireDriftData
Int_t col[ntarg]
Definition: Style.C:29
Float_t d
Definition: plot.C:235
DataProviderAlgView fAlgView
Float_t w
Definition: plot.C:20
size_t getDriftIndex(float drift) const
void nnet::TrainingDataAlg::reconfigure ( const Config config)
img::DataProviderAlgView nnet::TrainingDataAlg::resizeView ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
size_t  wires,
size_t  drifts 
)
overrideprotectedvirtual

Reimplemented from img::DataProviderAlg.

Definition at line 370 of file PointIdAlg.cxx.

References trkf::fill(), fWireDriftEdep, fWireDriftPdg, img::DataProviderAlg::resizeView(), and w.

375 {
376  auto view = img::DataProviderAlg::resizeView(clock_data, det_prop, wires, drifts);
377 
378  fWireDriftEdep.resize(wires);
379  for (auto& w : fWireDriftEdep) {
380  w.resize(view.fNCachedDrifts);
381  std::fill(w.begin(), w.end(), 0.0F);
382  }
383 
384  fWireDriftPdg.resize(wires);
385  for (auto& w : fWireDriftPdg) {
386  w.resize(view.fNCachedDrifts);
387  std::fill(w.begin(), w.end(), 0);
388  }
389  return view;
390 }
virtual DataProviderAlgView resizeView(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, size_t wires, size_t drifts)
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
std::vector< std::vector< int > > fWireDriftPdg
Definition: PointIdAlg.h:336
std::vector< std::vector< float > > fWireDriftEdep
Definition: PointIdAlg.h:335
Float_t w
Definition: plot.C:20
bool nnet::TrainingDataAlg::saveSimInfo ( ) const
inline

Definition at line 262 of file PointIdAlg.h.

Referenced by nnet::PointIdTrainingData::analyze().

262 { return fSaveSimInfo; }
bool nnet::TrainingDataAlg::setDataEventData ( const art::Event event,
detinfo::DetectorClocksData const &  clockData,
detinfo::DetectorPropertiesData const &  detProp,
unsigned int  plane,
unsigned int  tpc,
unsigned int  cryo 
)

Definition at line 720 of file PointIdAlg.cxx.

References larg4::dist(), img::DataProviderAlg::fAlgView, fEventsPerBin, fHitProducerLabel, art::fill_ptr_vector(), img::DataProviderAlgView::fNDrifts, fTrackModuleLabel, fWireProducerLabel, art::ProductRetriever::getByLabel(), img::DataProviderAlg::setWireDriftData(), and setWireEdepsAndLabels().

726 {
727 
729  std::vector<art::Ptr<recob::Wire>> Wirelist;
730 
731  if (event.getByLabel(fWireProducerLabel, wireHandle)) art::fill_ptr_vector(Wirelist, wireHandle);
732 
733  if (!setWireDriftData(clockData, detProp, *wireHandle, plane, tpc, cryo)) {
734  mf::LogError("TrainingDataAlg") << "Wire data not set.";
735  return false;
736  }
737 
738  // Hit info
740  std::vector<art::Ptr<recob::Hit>> Hitlist;
741 
742  if (event.getByLabel(fHitProducerLabel, HitHandle)) art::fill_ptr_vector(Hitlist, HitHandle);
743 
744  // Track info
746  std::vector<art::Ptr<recob::Track>> Tracklist;
747 
748  if (event.getByLabel(fTrackModuleLabel, TrackHandle))
749  art::fill_ptr_vector(Tracklist, TrackHandle);
750 
751  art::FindManyP<recob::Track> ass_trk_hits(HitHandle, event, fTrackModuleLabel);
752 
753  // Loop over wires (sorry about hard coded value) to fill in 1) pdg and 2) charge depo
754  for (size_t widx = 0; widx < 240; ++widx) {
755 
756  std::vector<float> labels_deposit(fAlgView.fNDrifts, 0); // full-drift-length buffers
757  std::vector<int> labels_pdg(fAlgView.fNDrifts, 0);
758 
759  // First, the charge depo
760  for (size_t subwidx = 0; subwidx < Wirelist.size(); ++subwidx) {
761  if (widx + 240 == Wirelist[subwidx]->Channel()) {
762  labels_deposit = Wirelist[subwidx]->Signal();
763  break;
764  }
765  }
766 
767  // Second, the pdg code
768  // This code finds the angle of the track and records
769  // events based on its angle to try to get an isometric sample
770  // instead of just a bunch of straight tracks
771 
772  // Meta code:
773  // For each hit:
774  // find farthest hit from point
775  // then find farthest hit from THAT one
776  // should be start and end of track, then just use trig
777 
778  for (size_t iHit = 0; iHit < Hitlist.size(); ++iHit) {
779 
780  if (Hitlist[iHit]->Channel() != widx + 240) { continue; }
781  if (Hitlist[iHit]->View() != 1) { continue; }
782 
783  // Make sure there is a track association
784  if (ass_trk_hits.at(iHit).size() == 0) { continue; }
785 
786  // Not sure about this
787  // Cutting on length to not just get a bunch of shower stubs
788  // Might add a lot of bias though
789  if (ass_trk_hits.at(iHit)[0]->Length() < 5) { continue; }
790 
791  // Search for farest hit from this one
792  int far_index = 0;
793  double far_dist = 0;
794 
795  for (size_t jHit = 0; jHit < Hitlist.size(); ++jHit) {
796  if (jHit == iHit) { continue; }
797  if (Hitlist[jHit]->View() != 1) { continue; }
798 
799  if (ass_trk_hits.at(jHit).size() == 0) { continue; }
800  if (ass_trk_hits.at(jHit)[0]->ID() != ass_trk_hits.at(iHit)[0]->ID()) { continue; }
801 
802  double dist = sqrt((Hitlist[iHit]->Channel() - Hitlist[jHit]->Channel()) *
803  (Hitlist[iHit]->Channel() - Hitlist[jHit]->Channel()) +
804  (Hitlist[iHit]->PeakTime() - Hitlist[jHit]->PeakTime()) *
805  (Hitlist[iHit]->PeakTime() - Hitlist[jHit]->PeakTime()));
806 
807  if (far_dist < dist) {
808  far_dist = dist;
809  far_index = jHit;
810  }
811  }
812 
813  // Search for the other end of the track
814  int other_end = 0;
815  int other_dist = 0;
816 
817  for (size_t jHit = 0; jHit < Hitlist.size(); ++jHit) {
818  if (jHit == iHit or int(jHit) == far_index) { continue; }
819  if (Hitlist[jHit]->View() != 1) { continue; }
820 
821  if (ass_trk_hits.at(jHit).size() == 0) { continue; }
822  if (ass_trk_hits.at(jHit)[0]->ID() != ass_trk_hits.at(iHit)[0]->ID()) { continue; }
823 
824  double dist = sqrt((Hitlist[far_index]->Channel() - Hitlist[jHit]->Channel()) *
825  (Hitlist[far_index]->Channel() - Hitlist[jHit]->Channel()) +
826  (Hitlist[far_index]->PeakTime() - Hitlist[jHit]->PeakTime()) *
827  (Hitlist[far_index]->PeakTime() - Hitlist[jHit]->PeakTime()));
828 
829  if (other_dist < dist) {
830  other_dist = dist;
831  other_end = jHit;
832  }
833  }
834 
835  // We have the end points now
836  double del_wire = double(Hitlist[other_end]->Channel() - Hitlist[far_index]->Channel());
837  double del_time = double(Hitlist[other_end]->PeakTime() - Hitlist[far_index]->PeakTime());
838  double hypo = sqrt(del_wire * del_wire + del_time * del_time);
839 
840  if (hypo == 0) { continue; } // Should never happen, but doing it anyway
841 
842  double cosser = TMath::Abs(del_wire / hypo);
843  double norm_ang = TMath::ACos(cosser) * 2 / TMath::Pi();
844 
845  // Using fEventsPerBin to keep track of number of hits per angle (normalized to 0 to 1)
846 
847  int binner = int(norm_ang * fEventsPerBin.size());
848  if (binner >= (int)fEventsPerBin.size()) {
849  binner = fEventsPerBin.size() - 1;
850  } // Dealing with rounding errors
851 
852  // So we should get a total of 5000 * 100 = 50,000 if we use the whole set
853  if (fEventsPerBin[binner] > 5000) { continue; }
854  fEventsPerBin[binner]++;
855 
856  // If survives everything, saves the pdg
857  labels_pdg[Hitlist[iHit]->PeakTime()] = 211; // Same as pion for now
858  }
859 
860  setWireEdepsAndLabels(labels_deposit, labels_pdg, widx);
861 
862  } // for each Wire
863 
864  return true;
865 }
bool setWireEdepsAndLabels(std::vector< float > const &edeps, std::vector< int > const &pdgs, size_t wireIdx)
Definition: PointIdAlg.cxx:393
art::InputTag fTrackModuleLabel
Definition: PointIdAlg.h:340
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
art::InputTag fWireProducerLabel
Definition: PointIdAlg.h:338
std::vector< size_t > fEventsPerBin
Definition: PointIdAlg.h:348
DataProviderAlgView fAlgView
bool setWireDriftData(const detinfo::DetectorClocksData &clock_data, const detinfo::DetectorPropertiesData &det_prop, const std::vector< recob::Wire > &wires, unsigned int plane, unsigned int tpc, unsigned int cryo)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
art::InputTag fHitProducerLabel
Definition: PointIdAlg.h:339
bool nnet::TrainingDataAlg::setEventData ( const art::Event event,
detinfo::DetectorClocksData const &  clockData,
detinfo::DetectorPropertiesData const &  detProp,
unsigned int  plane,
unsigned int  tpc,
unsigned int  cryo 
)

Definition at line 867 of file PointIdAlg.cxx.

References util::abs(), collectVtxFlags(), energy, fAdcDelay, img::DataProviderAlg::fAlgView, fEdepTot, img::DataProviderAlgView::fNDrifts, img::DataProviderAlgView::fNWires, fSaveSimInfo, fSaveVtxFlags, fSimChannelProducerLabel, fSimulationProducerLabel, img::DataProviderAlgView::fWireChannels, fWireProducerLabel, sim::LArG4Parameters::GeVToElectrons(), raw::InvalidChannelID, art::Event::isRealData(), kDelta, kMichel, kPdgMask, kPriEl, kPriMu, kTypeMask, img::DataProviderAlg::setWireDriftData(), setWireEdepsAndLabels(), and detinfo::DetectorClocksData::TPCTDC2Tick().

Referenced by nnet::PointIdTrainingData::analyze().

873 {
875  event.getValidHandle<std::vector<recob::Wire>>(fWireProducerLabel);
876 
877  if (!setWireDriftData(clockData, detProp, *wireHandle, plane, tpc, cryo)) {
878  mf::LogError("TrainingDataAlg") << "Wire data not set.";
879  return false;
880  }
881 
882  if (!fSaveSimInfo || event.isRealData()) {
883  mf::LogInfo("TrainingDataAlg") << "Skip MC simulation info.";
884  return true;
885  }
886 
888  double electronsToGeV = 1. / larParameters->GeVToElectrons();
889 
890  auto particleHandle =
891  event.getValidHandle<std::vector<simb::MCParticle>>(fSimulationProducerLabel);
892 
893  auto simChannelHandle =
894  event.getValidHandle<std::vector<sim::SimChannel>>(fSimChannelProducerLabel);
895 
896  std::unordered_map<int, const simb::MCParticle*> particleMap;
897  for (auto const& particle : *particleHandle) {
898  particleMap[particle.TrackId()] = &particle;
899  }
900 
901  std::unordered_map<size_t, std::unordered_map<int, int>> wireToDriftToVtxFlags;
902  if (fSaveVtxFlags) collectVtxFlags(wireToDriftToVtxFlags, clockData, detProp, particleMap, plane);
903 
904  fEdepTot = 0;
905 
906  std::map<int, int> trackToPDG;
907  for (size_t widx = 0; widx < fAlgView.fNWires; ++widx) {
908  auto wireChannelNumber = fAlgView.fWireChannels[widx];
909  if (wireChannelNumber == raw::InvalidChannelID) continue;
910 
911  std::vector<float> labels_deposit(fAlgView.fNDrifts, 0); // full-drift-length buffers,
912  std::vector<int> labels_pdg(labels_deposit.size(), 0); // both of the same size,
913  int labels_size = labels_deposit.size(); // cached as int for comparisons below
914 
915  std::map<int, std::map<int, double>> timeToTrackToCharge;
916  for (auto const& channel : *simChannelHandle) {
917  if (channel.Channel() != wireChannelNumber) continue;
918 
919  auto const& timeSlices = channel.TDCIDEMap();
920  for (auto const& timeSlice : timeSlices) {
921  int time = timeSlice.first;
922 
923  auto const& energyDeposits = timeSlice.second;
924  for (auto const& energyDeposit : energyDeposits) {
925  int pdg = 0;
926  int tid = energyDeposit.trackID;
927  if (tid < 0) // negative tid means it is EM activity, and -tid is the mother
928  {
929  pdg = 11;
930  tid = -tid;
931 
932  auto search = particleMap.find(tid);
933  if (search == particleMap.end()) {
934  mf::LogWarning("TrainingDataAlg") << "PARTICLE NOT FOUND";
935  continue;
936  }
937  auto const& mother = *((*search).second); // mother particle of this EM
938  int mPdg = abs(mother.PdgCode());
939  if ((mPdg == 13) || (mPdg == 211) || (mPdg == 2212)) {
940  if (energyDeposit.numElectrons > 10)
941  pdg |= nnet::TrainingDataAlg::kDelta; // tag delta ray
942  }
943  }
944  else {
945  auto search = particleMap.find(tid);
946  if (search == particleMap.end()) {
947  mf::LogWarning("TrainingDataAlg") << "PARTICLE NOT FOUND";
948  continue;
949  }
950  auto const& particle = *((*search).second);
951  pdg = abs(particle.PdgCode());
952 
953  if (particle.Process() == "primary") {
954  if (pdg == 11) {
955  pdg |= nnet::TrainingDataAlg::kPriEl; // tag primary
956  }
957  else if (pdg == 13) {
958  pdg |= nnet::TrainingDataAlg::kPriMu; // tag primary
959  }
960  }
961 
962  /*
963  auto msearch = particleMap.find(particle.Mother());
964  if (msearch != particleMap.end()) {
965  auto const& mother = *((*msearch).second);
966  if (pdg == 11) // electron, check if it is Michel
967  {
968  if (nnet::TrainingDataAlg::isMuonDecaying(mother, particleMap)) {
969  std::cout<<particle.Process()<<std::endl;
970  pdg |= nnet::TrainingDataAlg::kMichel; // tag Michel
971  }
972  }
973  }
974  */
975  if (pdg == 11) { // electron, check if it is Michel or delta ray
976  if (particle.Process() == "Decay") {
977  pdg |= nnet::TrainingDataAlg::kMichel; // tag Michel
978  }
979  else if (particle.Process() == "muIoni") {
980  pdg |= nnet::TrainingDataAlg::kDelta; // tag delta ray
981  }
982  }
983  }
984 
985  trackToPDG[energyDeposit.trackID] = pdg;
986 
987  double energy = energyDeposit.numElectrons * electronsToGeV;
988  timeToTrackToCharge[time][energyDeposit.trackID] += energy;
989  fEdepTot += energy;
990 
991  } // loop over energy deposits
992  } // loop over time slices
993  } // for each SimChannel
994 
996  for (auto const& ttc : timeToTrackToCharge) {
997  float max_deposit = 0.0;
998  int max_pdg = 0;
999  for (auto const& tc : ttc.second) {
1000 
1001  if (tc.second > max_deposit) {
1002  max_deposit = tc.second;
1003  max_pdg = trackToPDG[tc.first];
1004  }
1005  }
1006 
1007  int tick_idx = clockData.TPCTDC2Tick(ttc.first) + fAdcDelay;
1008 
1009  if (tick_idx < labels_size && tick_idx >= 0) {
1010  labels_deposit[tick_idx] = max_deposit;
1011  labels_pdg[tick_idx] = max_pdg & type_pdg_mask;
1012  }
1013  }
1014 
1015  for (auto const& drift_flags : wireToDriftToVtxFlags[widx]) {
1016  int drift = drift_flags.first, flags = drift_flags.second;
1017  if ((drift >= 0) && (drift < labels_size)) { labels_pdg[drift] |= flags; }
1018  }
1019  setWireEdepsAndLabels(labels_deposit, labels_pdg, widx);
1020  } // for each Wire
1021 
1022  return true;
1023 }
void collectVtxFlags(std::unordered_map< size_t, std::unordered_map< int, int >> &wireToDriftToVtxFlags, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const std::unordered_map< int, const simb::MCParticle * > &particleMap, unsigned int plane) const
Definition: PointIdAlg.cxx:564
bool setWireEdepsAndLabels(std::vector< float > const &edeps, std::vector< int > const &pdgs, size_t wireIdx)
Definition: PointIdAlg.cxx:393
unsigned int fAdcDelay
Definition: PointIdAlg.h:346
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
constexpr auto abs(T v)
Returns the absolute value of the argument.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
bool isRealData() const
Definition: Event.cc:53
art::InputTag fWireProducerLabel
Definition: PointIdAlg.h:338
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:31
std::vector< raw::ChannelID_t > fWireChannels
double energy
Definition: plottest35.C:25
art::InputTag fSimChannelProducerLabel
Definition: PointIdAlg.h:342
DataProviderAlgView fAlgView
bool setWireDriftData(const detinfo::DetectorClocksData &clock_data, const detinfo::DetectorPropertiesData &det_prop, const std::vector< recob::Wire > &wires, unsigned int plane, unsigned int tpc, unsigned int cryo)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
art::InputTag fSimulationProducerLabel
Definition: PointIdAlg.h:341
double GeVToElectrons() const
std::optional< std::vector< float > > img::DataProviderAlg::setWireData ( std::vector< float > const &  adc,
size_t  wireIdx 
) const
protectedinherited

Definition at line 273 of file DataProviderAlg.cxx.

References img::DataProviderAlg::downscale(), img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDownscaleFullView, and img::DataProviderAlgView::fWireDriftData.

Referenced by img::DataProviderAlg::setWireDriftData().

275 {
276  if (wireIdx >= fAlgView.fWireDriftData.size()) { return std::nullopt; }
277  auto& wData = fAlgView.fWireDriftData[wireIdx];
278 
279  if (fDownscaleFullView) {
280  if (!adc.empty()) { return downscale(wData.size(), adc, 0); }
281  return std::nullopt;
282  }
283  if (adc.empty()) { return std::nullopt; }
284  if (adc.size() <= wData.size()) { return adc; }
285  return std::vector<float>(adc.begin(), adc.begin() + wData.size());
286 }
std::vector< std::vector< float > > fWireDriftData
std::vector< float > downscale(std::size_t dst_size, std::vector< float > const &adc, size_t tick0) const
DataProviderAlgView fAlgView
bool img::DataProviderAlg::setWireDriftData ( const detinfo::DetectorClocksData clock_data,
const detinfo::DetectorPropertiesData det_prop,
const std::vector< recob::Wire > &  wires,
unsigned int  plane,
unsigned int  tpc,
unsigned int  cryo 
)
inherited

Definition at line 289 of file DataProviderAlg.cxx.

References img::DataProviderAlg::addCoherentNoise(), img::DataProviderAlg::addWhiteNoise(), img::DataProviderAlg::applyBlur(), geo::GeometryCore::ChannelToWire(), img::DataProviderAlg::fAdcAreaOverThr, img::DataProviderAlg::fAdcSumOverThr, img::DataProviderAlg::fAdcSumThr, img::DataProviderAlg::fAlgView, img::DataProviderAlg::fCryo, img::DataProviderAlg::fGeometry, img::DataProviderAlg::fPlane, img::DataProviderAlg::fTPC, img::DataProviderAlgView::fWireChannels, img::DataProviderAlgView::fWireDriftData, detinfo::DetectorPropertiesData::NumberTimeSamples(), geo::GeometryCore::Nwires(), img::DataProviderAlg::Plane(), img::DataProviderAlg::resizeView(), and img::DataProviderAlg::setWireData().

Referenced by nnet::ParticleDecayId::DetectDecay(), nnet::EmTrackClusterId2out::produce(), nnet::EmTrackClusterId::produce(), nnet::EmTrackMichelId::produce(), setDataEventData(), and setEventData().

295 {
296  mf::LogInfo("DataProviderAlg") << "Create image for cryo:" << cryo << " tpc:" << tpc
297  << " plane:" << plane;
298 
299  fCryo = cryo;
300  fTPC = tpc;
301  fPlane = plane;
302 
303  fAdcSumOverThr = 0;
304  fAdcAreaOverThr = 0;
305 
306  size_t nwires = fGeometry->Nwires({cryo, tpc, plane});
307  size_t ndrifts = det_prop.NumberTimeSamples();
308 
309  fAlgView = resizeView(clock_data, det_prop, nwires, ndrifts);
310 
311  auto const& channelStatus =
313 
314  bool allWrong = true;
315  for (auto const& wire : wires) {
316  auto wireChannelNumber = wire.Channel();
317  if (!channelStatus.IsGood(wireChannelNumber)) { continue; }
318 
319  size_t w_idx = 0;
320  for (auto const& id : fGeometry->ChannelToWire(wireChannelNumber)) {
321  if ((id.Plane == plane) && (id.TPC == tpc) && (id.Cryostat == cryo)) {
322  w_idx = id.Wire;
323 
324  auto adc = wire.Signal();
325  if (adc.size() < ndrifts) {
326  mf::LogWarning("DataProviderAlg") << "Wire ADC vector size lower than NumberTimeSamples.";
327  continue; // not critical, maybe other wires are OK, so continue
328  }
329  auto wire_data = setWireData(adc, w_idx);
330  if (!wire_data) {
331  mf::LogWarning("DataProviderAlg") << "Wire data not set.";
332  continue; // also not critical, try to set other wires
333  }
334  fAlgView.fWireDriftData[w_idx] = *wire_data;
335  for (auto v : adc) {
336  if (v >= fAdcSumThr) {
337  fAdcSumOverThr += v;
338  fAdcAreaOverThr++;
339  }
340  }
341 
342  fAlgView.fWireChannels[w_idx] = wireChannelNumber;
343  allWrong = false;
344  }
345  }
346  }
347  if (allWrong) {
348  mf::LogError("DataProviderAlg")
349  << "Wires data not set in the cryo:" << cryo << " tpc:" << tpc << " plane:" << plane;
350  return false;
351  }
352 
353  applyBlur();
354  addWhiteNoise();
356 
357  return true;
358 }
geo::GeometryCore const * fGeometry
std::optional< std::vector< float > > setWireData(std::vector< float > const &adc, size_t wireIdx) const
std::vector< std::vector< float > > fWireDriftData
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
virtual DataProviderAlgView resizeView(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, size_t wires, size_t drifts)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
unsigned int Plane() const
std::vector< raw::ChannelID_t > fWireChannels
DataProviderAlgView fAlgView
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
unsigned int Nwires(PlaneID const &planeid) const
Returns the total number of wires in the specified plane.
bool nnet::TrainingDataAlg::setWireEdepsAndLabels ( std::vector< float > const &  edeps,
std::vector< int > const &  pdgs,
size_t  wireIdx 
)
private

Definition at line 393 of file PointIdAlg.cxx.

References img::DataProviderAlg::fAlgView, img::DataProviderAlg::fDownscaleFullView, img::DataProviderAlg::fDriftWindow, img::DataProviderAlgView::fNCachedDrifts, fSaveVtxFlags, fWireDriftEdep, fWireDriftPdg, kPdgMask, kTypeMask, and kVtxMask.

Referenced by setDataEventData(), and setEventData().

396 {
397  if ((wireIdx >= fWireDriftEdep.size()) || (edeps.size() != pdgs.size())) { return false; }
398 
399  size_t dstep = 1;
400  if (fDownscaleFullView) { dstep = fDriftWindow; }
401 
402  if (edeps.size() / dstep > fAlgView.fNCachedDrifts) { return false; }
403 
404  auto& wEdep = fWireDriftEdep[wireIdx];
405  auto& wPdg = fWireDriftPdg[wireIdx];
406 
407  for (size_t i = 0; i < fAlgView.fNCachedDrifts; ++i) {
408  size_t i0 = i * dstep;
409  size_t i1 = (i + 1) * dstep;
410 
411  int best_pdg = pdgs[i0] & nnet::TrainingDataAlg::kPdgMask;
412  int vtx_flags = pdgs[i0] & nnet::TrainingDataAlg::kVtxMask;
413  int type_flags = pdgs[i0] & nnet::TrainingDataAlg::kTypeMask;
414  float max_edep = edeps[i0];
415  for (size_t k = i0 + 1; k < i1; ++k) {
416  float ek = edeps[k];
417  if (ek > max_edep) {
418  max_edep = ek;
419  best_pdg = pdgs[k] & nnet::TrainingDataAlg::kPdgMask; // remember best matching pdg
420  }
421  type_flags |= pdgs[k] & nnet::TrainingDataAlg::kTypeMask; // accumulate track type flags
422  vtx_flags |= pdgs[k] & nnet::TrainingDataAlg::kVtxMask; // accumulate all vtx flags
423  }
424 
425  wEdep[i] = max_edep;
426 
427  best_pdg |= type_flags;
428  if (fSaveVtxFlags) best_pdg |= vtx_flags;
429  wPdg[i] = best_pdg;
430  }
431 
432  return true;
433 }
DataProviderAlgView fAlgView
std::vector< std::vector< int > > fWireDriftPdg
Definition: PointIdAlg.h:336
std::vector< std::vector< float > > fWireDriftEdep
Definition: PointIdAlg.h:335
unsigned int img::DataProviderAlg::TPC ( ) const
inlineinherited

Definition at line 162 of file DataProviderAlg.h.

Referenced by collectVtxFlags().

162 { return fTPC; }
std::vector<float> const& img::DataProviderAlg::wireData ( size_t  widx) const
inlineinherited

Definition at line 117 of file DataProviderAlg.h.

Referenced by nnet::PointIdTrainingData::analyze().

117 { return fAlgView.fWireDriftData[widx]; }
std::vector< std::vector< float > > fWireDriftData
DataProviderAlgView fAlgView
std::vector<float> const& nnet::TrainingDataAlg::wireEdep ( size_t  widx) const
inline

Definition at line 287 of file PointIdAlg.h.

Referenced by nnet::PointIdTrainingData::analyze().

287 { return fWireDriftEdep[widx]; }
std::vector< std::vector< float > > fWireDriftEdep
Definition: PointIdAlg.h:335
std::vector<int> const& nnet::TrainingDataAlg::wirePdg ( size_t  widx) const
inline

Definition at line 288 of file PointIdAlg.h.

Referenced by nnet::PointIdTrainingData::analyze().

288 { return fWireDriftPdg[widx]; }
std::vector< std::vector< int > > fWireDriftPdg
Definition: PointIdAlg.h:336
float img::DataProviderAlg::ZeroLevel ( ) const
inlineinherited

Level of zero ADC after scaling.

Definition at line 171 of file DataProviderAlg.h.

171 { return fAdcZero; }

Member Data Documentation

unsigned int nnet::TrainingDataAlg::fAdcDelay
private

Definition at line 346 of file PointIdAlg.h.

Referenced by setEventData().

calo::CalorimetryAlg img::DataProviderAlg::fCalorimetryAlg
protectedinherited
EDownscaleMode img::DataProviderAlg::fDownscaleMode
protectedinherited

Definition at line 182 of file DataProviderAlg.h.

Referenced by img::DataProviderAlg::DataProviderAlg().

float img::DataProviderAlg::fDriftWindowInv
protectedinherited
double nnet::TrainingDataAlg::fEdepTot
private

Definition at line 334 of file PointIdAlg.h.

Referenced by setEventData().

std::vector<size_t> nnet::TrainingDataAlg::fEventsPerBin
private

Definition at line 348 of file PointIdAlg.h.

Referenced by setDataEventData().

geo::GeometryCore const* img::DataProviderAlg::fGeometry
protectedinherited
art::InputTag nnet::TrainingDataAlg::fHitProducerLabel
private

Definition at line 339 of file PointIdAlg.h.

Referenced by setDataEventData().

bool nnet::TrainingDataAlg::fSaveSimInfo
private

Definition at line 344 of file PointIdAlg.h.

Referenced by setEventData(), and TrainingDataAlg().

bool nnet::TrainingDataAlg::fSaveVtxFlags
private

Definition at line 343 of file PointIdAlg.h.

Referenced by setEventData(), and setWireEdepsAndLabels().

art::InputTag nnet::TrainingDataAlg::fSimChannelProducerLabel
private

Definition at line 342 of file PointIdAlg.h.

Referenced by setEventData(), and TrainingDataAlg().

art::InputTag nnet::TrainingDataAlg::fSimulationProducerLabel
private

Definition at line 341 of file PointIdAlg.h.

Referenced by setEventData(), and TrainingDataAlg().

art::InputTag nnet::TrainingDataAlg::fTrackModuleLabel
private

Definition at line 340 of file PointIdAlg.h.

Referenced by setDataEventData().

std::vector<std::vector<float> > nnet::TrainingDataAlg::fWireDriftEdep
private

Definition at line 335 of file PointIdAlg.h.

Referenced by findCrop(), resizeView(), and setWireEdepsAndLabels().

std::vector<std::vector<int> > nnet::TrainingDataAlg::fWireDriftPdg
private

Definition at line 336 of file PointIdAlg.h.

Referenced by resizeView(), and setWireEdepsAndLabels().

art::InputTag nnet::TrainingDataAlg::fWireProducerLabel
private

Definition at line 338 of file PointIdAlg.h.

Referenced by setDataEventData(), and setEventData().


The documentation for this class was generated from the following files: