LArSoft  v10_04_05
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::Geometry const * fGeometry
 
geo::WireReadoutGeom const * fWireReadoutGeom
 

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 192 of file PointIdAlg.h.

Member Enumeration Documentation

Enumerator
kMax 
kMaxMean 
kMean 

Definition at line 62 of file DataProviderAlg.h.

Enumerator
kNone 
kPdgMask 
kTypeMask 
kVtxMask 

Definition at line 194 of file PointIdAlg.h.

194  {
195  kNone = 0,
196  kPdgMask = 0x00000FFF, // pdg code mask
197  kTypeMask = 0x0000F000, // track type mask
198  kVtxMask = 0xFFFF0000 // vertex flags
199  };
Enumerator
kDelta 
kMichel 
kPriEl 
kPriMu 

Definition at line 201 of file PointIdAlg.h.

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

Definition at line 208 of file PointIdAlg.h.

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

Constructor & Destructor Documentation

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

Definition at line 248 of file PointIdAlg.h.

250  {}
TrainingDataAlg(const fhicl::ParameterSet &pset)
Definition: PointIdAlg.h:248
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:342
art::InputTag fTrackModuleLabel
Definition: PointIdAlg.h:336
art::InputTag fWireProducerLabel
Definition: PointIdAlg.h:334
std::string const & label() const noexcept
Definition: InputTag.cc:79
std::vector< size_t > fEventsPerBin
Definition: PointIdAlg.h:344
art::InputTag fSimChannelProducerLabel
Definition: PointIdAlg.h:338
art::InputTag fSimulationProducerLabel
Definition: PointIdAlg.h:337
art::InputTag fHitProducerLabel
Definition: PointIdAlg.h:335
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 159 of file DataProviderAlg.h.

Referenced by collectVtxFlags().

159 { 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 196 of file DataProviderAlg.h.

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

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

199  {
200  switch (fDownscaleMode) {
201  case img::DataProviderAlg::kMean: return downscaleMean(dst_size, adc, tick0);
202  case img::DataProviderAlg::kMaxMean: return downscaleMaxMean(dst_size, adc, tick0);
203  case img::DataProviderAlg::kMax: return downscaleMax(dst_size, adc, tick0);
204  }
205  throw cet::exception("img::DataProviderAlg") << "Downscale mode not supported." << std::endl;
206  }
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 193 of file DataProviderAlg.cxx.

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

196 {
197  size_t kStop = dst_size;
198  std::vector<float> result(dst_size);
199  if (adc.size() < kStop) { kStop = adc.size(); }
200  for (size_t i = 0, k0 = 0; i < kStop; ++i, k0 += fDriftWindow) {
201  size_t k1 = k0 + fDriftWindow;
202 
203  float max_adc = adc[k0] * fAlgView.fLifetimeCorrFactors[k0 + tick0];
204  for (size_t k = k0 + 1; k < k1; ++k) {
205  float ak = adc[k] * fAlgView.fLifetimeCorrFactors[k + tick0];
206  if (ak > max_adc) max_adc = ak;
207  }
208  result[i] = max_adc;
209  }
210  scaleAdcSamples(result);
211  return result;
212 }
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 214 of file DataProviderAlg.cxx.

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

217 {
218  size_t kStop = dst_size;
219  std::vector<float> result(dst_size);
220  if (adc.size() < kStop) { kStop = adc.size(); }
221  for (size_t i = 0, k0 = 0; i < kStop; ++i, k0 += fDriftWindow) {
222  size_t k1 = k0 + fDriftWindow;
223  size_t max_idx = k0;
224  float max_adc = adc[k0] * fAlgView.fLifetimeCorrFactors[k0 + tick0];
225  for (size_t k = k0 + 1; k < k1; ++k) {
226  float ak = adc[k] * fAlgView.fLifetimeCorrFactors[k + tick0];
227  if (ak > max_adc) {
228  max_adc = ak;
229  max_idx = k;
230  }
231  }
232 
233  size_t n = 1;
234  if (max_idx > 0) {
235  max_adc += adc[max_idx - 1] * fAlgView.fLifetimeCorrFactors[max_idx - 1 + tick0];
236  n++;
237  }
238  if (max_idx + 1 < adc.size()) {
239  max_adc += adc[max_idx + 1] * fAlgView.fLifetimeCorrFactors[max_idx + 1 + tick0];
240  n++;
241  }
242 
243  result[i] = max_adc / n;
244  }
245  scaleAdcSamples(result);
246  return result;
247 }
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 249 of file DataProviderAlg.cxx.

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

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

Definition at line 166 of file DataProviderAlg.h.

166 { 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:331
size_t img::DataProviderAlg::getAdcArea ( ) const
inlineinherited

Definition at line 151 of file DataProviderAlg.h.

References r.

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

Definition at line 150 of file DataProviderAlg.h.

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

Definition at line 208 of file DataProviderAlg.h.

References lar::dump::vector().

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

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

Definition at line 282 of file PointIdAlg.h.

282 { 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 120 of file DataProviderAlg.h.

124  {
125  bool ok = false;
126  std::vector<std::vector<float>> patch;
127  if (fDownscaleFullView) {
128  ok = patchFromDownsampledView(wire, drift, patchSizeW, patchSizeD, patch);
129  }
130  else {
131  ok = patchFromOriginalView(wire, drift, patchSizeW, patchSizeD, patch);
132  }
133 
134  if (ok) return patch;
135  throw cet::exception("img::DataProviderAlg") << "Patch filling failed." << std::endl;
136  }
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 140 of file DataProviderAlg.h.

141  {
142  size_t didx = getDriftIndex(drift), widx = (size_t)wire;
143 
144  if ((widx < fAlgView.fWireDriftData.size()) && (didx < fAlgView.fNCachedDrifts)) {
145  return fAlgView.fWireDriftData[widx][didx];
146  }
147  return 0;
148  }
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, nnet::TrainingDataAlg::WireDrift::Drift, geo::TPCGeo::DriftAxisWithSign(), detinfo::DetectorPropertiesData::DriftVelocity(), e, img::DataProviderAlg::fGeometry, geo::GeometryCore::FindTPCAtPosition(), img::DataProviderAlg::fWireReadoutGeom, geo::CryostatID::isValid, geo::PlaneGeo::NearestWireID(), geo::Negative, geo::WireReadoutGeom::Plane(), pmtana::sign(), nnet::TrainingDataAlg::WireDrift::TPC, geo::GeometryCore::TPC(), nnet::TrainingDataAlg::WireDrift::Wire, geo::WireID::Wire, and geo::X.

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 
453  // correct for the time offset
454  float dx = tvec.T() * 1.e-3 * detProp.DriftVelocity();
455  auto const [axis, sign] = fGeometry->TPC(tpcid).DriftAxisWithSign();
456  if (axis != geo::Coordinate::X) {
457  throw cet::exception("nnet::TrainingDataAlg") << "drift direction is not X." << std::endl;
458  }
459  if (sign == geo::DriftSign::Negative) { dx *= -1; }
460  vtx.SetX(tvec.X() + dx);
461 
462  geo::PlaneID const planeID{tpcid, plane};
463  wd.Wire = fWireReadoutGeom->Plane(planeID).NearestWireID(vtx).Wire;
464  wd.Drift = detProp.ConvertXToTicks(vtx.X(), planeID);
465  wd.TPC = planeID.TPC;
466  wd.Cryo = planeID.Cryostat;
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 }
WireID NearestWireID(Point_t const &pos) const
Returns the ID of wire closest to the specified position.
Definition: PlaneGeo.cxx:485
geo::Geometry const * fGeometry
The data type to uniquely identify a Plane.
Definition: geo_types.h:364
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:194
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:430
DriftAxis DriftAxisWithSign() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.h:78
TPCID FindTPCAtPosition(Point_t const &point) const
Returns the ID of the TPC at specified location.
geo::WireReadoutGeom const * fWireReadoutGeom
Drift towards negative values.
The data type to uniquely identify a TPC.
Definition: geo_types.h:306
int sign(double val)
Definition: UtilFunc.cxx:104
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
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Exception thrown on invalid wire number.
Definition: Exceptions.h:37
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified wire.
TPCGeo const & TPC(TPCID const &tpcid=details::tpc_zero) const
Returns the specified TPC.
Definition: GeometryCore.h:448
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:317
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 171 of file DataProviderAlg.h.

174  {
175  return fCalorimetryAlg.LifetimeCorrection(clock_data, det_prop, tick);
176  }
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 165 of file DataProviderAlg.h.

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

Definition at line 164 of file DataProviderAlg.h.

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

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

Definition at line 163 of file DataProviderAlg.h.

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

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

Definition at line 317 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().

318  {
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;
323  }
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 436 of file DataProviderAlg.cxx.

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

441 {
442  int halfSizeW = size_w / 2;
443  int halfSizeD = size_d / 2;
444 
445  int w0 = wire - halfSizeW;
446  int w1 = wire + halfSizeW;
447 
448  size_t sd = (size_t)(drift / fDriftWindow);
449  int d0 = sd - halfSizeD;
450  int d1 = sd + halfSizeD;
451 
452  int wsize = fAlgView.fWireDriftData.size();
453  for (int w = w0, wpatch = 0; w < w1; ++w, ++wpatch) {
454  auto& dst = patch[wpatch];
455  if ((w >= 0) && (w < wsize)) {
456  auto& src = fAlgView.fWireDriftData[w];
457  int dsize = src.size();
458  for (int d = d0, dpatch = 0; d < d1; ++d, ++dpatch) {
459  if ((d >= 0) && (d < dsize)) { dst[dpatch] = src[d]; }
460  else {
461  dst[dpatch] = fAdcZero;
462  }
463  }
464  }
465  else {
466  std::fill(dst.begin(), dst.end(), fAdcZero);
467  }
468  }
469 
470  return true;
471 }
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 473 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.

478 {
479  int dsize = fDriftWindow * size_d;
480  int halfSizeW = size_w / 2;
481  int halfSizeD = dsize / 2;
482 
483  int w0 = wire - halfSizeW;
484  int w1 = wire + halfSizeW;
485 
486  int d0 = int(drift) - halfSizeD;
487  int d1 = int(drift) + halfSizeD;
488 
489  if (d0 < 0) d0 = 0;
490 
491  std::vector<float> tmp(dsize);
492  int wsize = fAlgView.fWireDriftData.size();
493  for (int w = w0, wpatch = 0; w < w1; ++w, ++wpatch) {
494  if ((w >= 0) && (w < wsize)) {
495  auto& src = fAlgView.fWireDriftData[w];
496  int src_size = src.size();
497  for (int d = d0, dpatch = 0; d < d1; ++d, ++dpatch) {
498  if ((d >= 0) && (d < src_size)) { tmp[dpatch] = src[d]; }
499  else {
500  tmp[dpatch] = fAdcZero;
501  }
502  }
503  }
504  else {
505  std::fill(tmp.begin(), tmp.end(), fAdcZero);
506  }
507  patch[wpatch] = downscale(patch[wpatch].size(), tmp, d0);
508  }
509 
510  return true;
511 }
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 142 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().

143 {
144  size_t rw = r, rd = r;
145  if (!fDownscaleFullView) { rd *= fDriftWindow; }
146 
147  size_t didx = getDriftIndex(drift);
148  int d0 = didx - rd;
149  if (d0 < 0) { d0 = 0; }
150  int d1 = didx + rd;
151  if (d1 >= (int)fAlgView.fNCachedDrifts) { d1 = fAlgView.fNCachedDrifts - 1; }
152 
153  int w0 = wire - rw;
154  if (w0 < 0) { w0 = 0; }
155  int w1 = wire + rw;
156  if (w1 >= (int)fAlgView.fNWires) { w1 = fAlgView.fNWires - 1; }
157 
158  float adc, max_adc = 0;
159  for (int w = w0; w <= w1; ++w) {
160  auto const* col = fAlgView.fWireDriftData[w].data();
161  for (int d = d0; d <= d1; ++d) {
162  adc = col[d];
163  if (adc > max_adc) { max_adc = adc; }
164  }
165  }
166 
167  return max_adc;
168 }
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:332
std::vector< std::vector< float > > fWireDriftEdep
Definition: PointIdAlg.h:331
Float_t w
Definition: plot.C:20
bool nnet::TrainingDataAlg::saveSimInfo ( ) const
inline

Definition at line 258 of file PointIdAlg.h.

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

258 { 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:336
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
art::InputTag fWireProducerLabel
Definition: PointIdAlg.h:334
std::vector< size_t > fEventsPerBin
Definition: PointIdAlg.h:344
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
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:335
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:342
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:334
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:338
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:337
double GeVToElectrons() const
std::optional< std::vector< float > > img::DataProviderAlg::setWireData ( std::vector< float > const &  adc,
size_t  wireIdx 
) const
protectedinherited

Definition at line 270 of file DataProviderAlg.cxx.

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

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

272 {
273  if (wireIdx >= fAlgView.fWireDriftData.size()) { return std::nullopt; }
274  auto& wData = fAlgView.fWireDriftData[wireIdx];
275 
276  if (fDownscaleFullView) {
277  if (!adc.empty()) { return downscale(wData.size(), adc, 0); }
278  return std::nullopt;
279  }
280  if (adc.empty()) { return std::nullopt; }
281  if (adc.size() <= wData.size()) { return adc; }
282  return std::vector<float>(adc.begin(), adc.begin() + wData.size());
283 }
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 286 of file DataProviderAlg.cxx.

References img::DataProviderAlg::addCoherentNoise(), img::DataProviderAlg::addWhiteNoise(), img::DataProviderAlg::applyBlur(), geo::WireReadoutGeom::ChannelToWire(), img::DataProviderAlg::fAdcAreaOverThr, img::DataProviderAlg::fAdcSumOverThr, img::DataProviderAlg::fAdcSumThr, img::DataProviderAlg::fAlgView, img::DataProviderAlg::fCryo, img::DataProviderAlg::fPlane, img::DataProviderAlg::fTPC, img::DataProviderAlgView::fWireChannels, img::DataProviderAlgView::fWireDriftData, img::DataProviderAlg::fWireReadoutGeom, detinfo::DetectorPropertiesData::NumberTimeSamples(), geo::WireReadoutGeom::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().

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

Definition at line 160 of file DataProviderAlg.h.

Referenced by collectVtxFlags().

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

Definition at line 115 of file DataProviderAlg.h.

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

115 { 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 283 of file PointIdAlg.h.

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

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

Definition at line 284 of file PointIdAlg.h.

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

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

Level of zero ADC after scaling.

Definition at line 169 of file DataProviderAlg.h.

169 { return fAdcZero; }

Member Data Documentation

unsigned int nnet::TrainingDataAlg::fAdcDelay
private

Definition at line 342 of file PointIdAlg.h.

Referenced by setEventData().

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

Definition at line 180 of file DataProviderAlg.h.

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

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

Definition at line 330 of file PointIdAlg.h.

Referenced by setEventData().

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

Definition at line 344 of file PointIdAlg.h.

Referenced by setDataEventData().

geo::Geometry const* img::DataProviderAlg::fGeometry
protectedinherited

Definition at line 239 of file DataProviderAlg.h.

Referenced by img::DataProviderAlg::DataProviderAlg(), and getProjection().

art::InputTag nnet::TrainingDataAlg::fHitProducerLabel
private

Definition at line 335 of file PointIdAlg.h.

Referenced by setDataEventData().

bool nnet::TrainingDataAlg::fSaveSimInfo
private

Definition at line 340 of file PointIdAlg.h.

Referenced by setEventData(), and TrainingDataAlg().

bool nnet::TrainingDataAlg::fSaveVtxFlags
private

Definition at line 339 of file PointIdAlg.h.

Referenced by setEventData(), and setWireEdepsAndLabels().

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

Definition at line 338 of file PointIdAlg.h.

Referenced by setEventData(), and TrainingDataAlg().

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

Definition at line 337 of file PointIdAlg.h.

Referenced by setEventData(), and TrainingDataAlg().

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

Definition at line 336 of file PointIdAlg.h.

Referenced by setDataEventData().

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

Definition at line 331 of file PointIdAlg.h.

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

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

Definition at line 332 of file PointIdAlg.h.

Referenced by resizeView(), and setWireEdepsAndLabels().

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

Definition at line 334 of file PointIdAlg.h.

Referenced by setDataEventData(), and setEventData().

geo::WireReadoutGeom const* img::DataProviderAlg::fWireReadoutGeom
protectedinherited

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