LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
lar_dl_content::DlSNSignalAlgorithm Class Reference

DeepLearningSignalIdAlgorithm class. More...

#include "DlSNSignalAlgorithm.h"

Inheritance diagram for lar_dl_content::DlSNSignalAlgorithm:

Public Types

typedef std::map< std::pair< int, int >, std::vector< const pandora::CaloHit * > > PixelToCaloHitsMap
 

Public Member Functions

 DlSNSignalAlgorithm ()
 Default constructor. More...
 
virtual ~DlSNSignalAlgorithm ()
 

Private Types

typedef std::pair< int, int > Pixel
 
typedef std::map< const pandora::CaloHit *, PixelPixelMap
 

Private Member Functions

pandora::StatusCode Run ()
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
pandora::StatusCode PrepareTrainingSample ()
 
pandora::StatusCode Infer ()
 
pandora::StatusCode CheatedSeparation ()
 
pandora::StatusCode MakeNetworkInputFromHits (const pandora::CaloHitList &caloHits, const pandora::HitType view, const float xMin, const float xMax, const float zMin, const float zMax, LArDLHelper::TorchInput &networkInput, PixelMap &pixelMap) const
 
pandora::StatusCode GetMCToHitsMap (LArMCParticleHelper::MCContributionMap &mcToHitsMap) const
 
pandora::StatusCode CompleteMCHierarchy (const LArMCParticleHelper::MCContributionMap &mcToHitsMap, pandora::MCParticleList &mcHierarchy) const
 
void GetHitRegion (const pandora::CaloHitList &caloHitList, float &xMin, float &xMax, float &zMin, float &zMax) const
 

Private Attributes

bool m_trainingMode
 Training mode. More...
 
std::string m_trainingOutputFile
 Output file name for training examples. More...
 
std::string m_inputSignalListName
 Input vertex list name if 2nd pass. More...
 
pandora::StringVector m_caloHitListNames
 Names of input calo hit lists. More...
 
LArDLHelper::TorchModel m_modelU
 The model for the U view. More...
 
LArDLHelper::TorchModel m_modelV
 The model for the V view. More...
 
LArDLHelper::TorchModel m_modelW
 The model for the W view. More...
 
int m_event
 The current event number. More...
 
int m_pass
 The pass of the train/infer step. More...
 
int m_height
 The height of the images. More...
 
int m_width
 The width of the images. More...
 
float m_driftStep
 The size of a pixel in the drift direction in cm (most relevant in pass 2) More...
 
bool m_visualise
 Whether or not to visualise the candidate vertices. More...
 
bool m_writeTree
 Whether or not to write validation details to a ROOT tree. More...
 
std::string m_rootTreeName
 The ROOT tree name. More...
 
std::string m_rootFileName
 The ROOT file name. More...
 
std::mt19937 m_rng
 The random number generator. More...
 
bool m_printOut
 Whether or not to print out network outputs of CaloHitList names and sizes. More...
 
std::string m_signalListNameU
 Output signal CaloHitListU name. More...
 
std::string m_signalListNameV
 Output signal CaloHitListV name. More...
 
std::string m_signalListNameW
 Output signal CaloHitListW name. More...
 
std::string m_signalListName2D
 Output signal CaloHitList2D name. More...
 
std::string m_caloHitListName2D
 Input CaloHitList2D name. More...
 
pandora::StringVector m_inputCaloHitListNames
 Names of input calo hit lists, passed from Pass 1 of DLSignalAlg. More...
 
std::string m_backgroundListName
 Input Background CaloHitList name. More...
 
bool m_applyCheatedSeparation
 Whether cheating to separate background and signal hits. More...
 
bool m_simpleZoom
 Decide whethere to run a simple loop to find highest adc hit or run network. More...
 
long unsigned int m_passOneTrustThreshold
 Number of pixels in pass one required to trust the wire finding ability, below this threshold, the algorithm will use highest ADC within Drift Min/Max to set wire limits. More...
 
const int PHOTON_CLASS {2}
 Constant for network classification for photons. More...
 
const int ELECTRON_CLASS {3}
 Constant for network classification for electrons. More...
 
const int SIGNAL_CLASS {2}
 Constant for network classification for signal. More...
 

Detailed Description

DeepLearningSignalIdAlgorithm class.

Definition at line 27 of file DlSNSignalAlgorithm.h.

Member Typedef Documentation

typedef std::pair<int, int> lar_dl_content::DlSNSignalAlgorithm::Pixel
private

Definition at line 40 of file DlSNSignalAlgorithm.h.

typedef std::map<const pandora::CaloHit *, Pixel> lar_dl_content::DlSNSignalAlgorithm::PixelMap
private

Definition at line 41 of file DlSNSignalAlgorithm.h.

typedef std::map<std::pair<int, int>, std::vector<const pandora::CaloHit *> > lar_dl_content::DlSNSignalAlgorithm::PixelToCaloHitsMap

Definition at line 30 of file DlSNSignalAlgorithm.h.

Constructor & Destructor Documentation

lar_dl_content::DlSNSignalAlgorithm::DlSNSignalAlgorithm ( )

Default constructor.

Definition at line 31 of file DlSNSignalAlgorithm.cc.

References m_applyCheatedSeparation, m_backgroundListName, m_caloHitListName2D, m_driftStep, m_event, m_height, m_pass, m_passOneTrustThreshold, m_printOut, m_signalListName2D, m_signalListNameU, m_signalListNameV, m_signalListNameW, m_simpleZoom, m_trainingOutputFile, m_visualise, m_width, and m_writeTree.

31  :
32  m_trainingMode{false},
34  m_event{-1},
35  m_pass{1},
36  m_height{256},
37  m_width{256},
38  m_driftStep{0.5f},
39  m_visualise{false},
40  m_writeTree{false},
41  m_printOut{false},
49  m_simpleZoom{false},
51 {
52 }
std::string m_signalListNameV
Output signal CaloHitListV name.
int m_width
The width of the images.
std::string m_caloHitListName2D
Input CaloHitList2D name.
int m_height
The height of the images.
std::string m_signalListNameW
Output signal CaloHitListW name.
int m_pass
The pass of the train/infer step.
std::string m_trainingOutputFile
Output file name for training examples.
bool m_visualise
Whether or not to visualise the candidate vertices.
std::string m_backgroundListName
Input Background CaloHitList name.
long unsigned int m_passOneTrustThreshold
Number of pixels in pass one required to trust the wire finding ability, below this threshold...
int m_event
The current event number.
std::string m_signalListName2D
Output signal CaloHitList2D name.
bool m_applyCheatedSeparation
Whether cheating to separate background and signal hits.
float m_driftStep
The size of a pixel in the drift direction in cm (most relevant in pass 2)
bool m_printOut
Whether or not to print out network outputs of CaloHitList names and sizes.
bool m_simpleZoom
Decide whethere to run a simple loop to find highest adc hit or run network.
bool m_writeTree
Whether or not to write validation details to a ROOT tree.
std::string m_signalListNameU
Output signal CaloHitListU name.
lar_dl_content::DlSNSignalAlgorithm::~DlSNSignalAlgorithm ( )
virtual

Definition at line 54 of file DlSNSignalAlgorithm.cc.

References e, m_rootFileName, m_rootTreeName, and m_writeTree.

55 {
56  if (m_writeTree)
57  {
58  try
59  {
60  PANDORA_MONITORING_API(SaveTree(this->GetPandora(), m_rootTreeName, m_rootFileName, "RECREATE"));
61  }
62  catch (StatusCodeException e)
63  {
64  std::cout << "SignalAssessmentAlgorithm: Unable to write to ROOT tree" << std::endl;
65  }
66  }
67 }
std::string m_rootFileName
The ROOT file name.
std::string m_rootTreeName
The ROOT tree name.
bool m_writeTree
Whether or not to write validation details to a ROOT tree.
Float_t e
Definition: plot.C:35

Member Function Documentation

StatusCode lar_dl_content::DlSNSignalAlgorithm::CheatedSeparation ( )
private

Definition at line 618 of file DlSNSignalAlgorithm.cc.

References util::abs(), f, m_backgroundListName, m_caloHitListNames, m_signalListName2D, m_signalListNameU, m_signalListNameV, m_signalListNameW, and m_visualise.

Referenced by Run().

619 {
620  CaloHitList signalCandidatesU, signalCandidatesV, signalCandidatesW, signalCandidates2D, backgroundCaloHitList, photonCandidatesU,
621  photonCandidatesV, photonCandidatesW, electronCandidatesU, electronCandidatesV, electronCandidatesW;
622  for (const std::string &listname : m_caloHitListNames)
623  {
624  const CaloHitList *pCaloHitList(nullptr);
625  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, listname, pCaloHitList));
626  if (!pCaloHitList || pCaloHitList->empty())
627  continue;
628 
629  HitType view{pCaloHitList->front()->GetHitType()};
630  const bool isU{view == TPC_VIEW_U}, isV{view == TPC_VIEW_V}, isW{view == TPC_VIEW_W};
631  if (!isU && !isV && !isW)
632  return STATUS_CODE_NOT_ALLOWED;
633 
634  for (const CaloHit *pCaloHit : *pCaloHitList)
635  {
636  const MCParticle *pMainMCParticle(nullptr);
637  try
638  {
639  pMainMCParticle = MCParticleHelper::GetMainMCParticle(pCaloHit);
640  }
641  catch (const StatusCodeException &)
642  {
643  }
644 
645  if (pMainMCParticle)
646  {
647  const MCParticle *const pParentMCParticle(LArMCParticleHelper::GetParentMCParticle(pMainMCParticle));
648 
649  if (LArMCParticleHelper::IsNeutrino(pParentMCParticle))
650  {
651  if (std::abs(pMainMCParticle->GetParticleId()) == PHOTON)
652  {
653  signalCandidates2D.emplace_back(pCaloHit);
654 
655  if (isU)
656  {
657  signalCandidatesU.emplace_back(pCaloHit);
658  photonCandidatesU.emplace_back(pCaloHit);
659  }
660  else if (isV)
661  {
662  signalCandidatesV.emplace_back(pCaloHit);
663  photonCandidatesV.emplace_back(pCaloHit);
664  }
665  else
666  {
667  signalCandidatesW.emplace_back(pCaloHit);
668  photonCandidatesU.emplace_back(pCaloHit);
669  }
670  if (std::abs(pMainMCParticle->GetParticleId()) == E_MINUS)
671  {
672  if (isU)
673  {
674  signalCandidatesU.emplace_back(pCaloHit);
675  electronCandidatesU.emplace_back(pCaloHit);
676  }
677  else if (isV)
678  {
679  signalCandidatesV.emplace_back(pCaloHit);
680  electronCandidatesV.emplace_back(pCaloHit);
681  }
682  else
683  {
684  signalCandidatesW.emplace_back(pCaloHit);
685  electronCandidatesW.emplace_back(pCaloHit);
686  }
687  }
688  else
689  {
690  backgroundCaloHitList.emplace_back(pCaloHit);
691  }
692  }
693  else
694  {
695  backgroundCaloHitList.emplace_back(pCaloHit);
696  }
697  }
698  else
699  {
700  backgroundCaloHitList.emplace_back(pCaloHit);
701  }
702  }
703  }
704  if (m_visualise)
705  {
706  if (isU)
707  {
708  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &signalCandidatesU, "true signal U", BLUE));
709  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &photonCandidatesU, "true photon U", BLACK));
710  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &electronCandidatesU, "true electron U", RED));
711  }
712  if (isV)
713  {
714  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &signalCandidatesV, "true signal V", BLUE));
715  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &photonCandidatesV, "true photon V", BLACK));
716  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &electronCandidatesV, "true electron V", RED));
717  }
718  if (isW)
719  {
720  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &signalCandidatesW, "true signal W", BLUE));
721  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &photonCandidatesW, "true photon W", BLACK));
722  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &electronCandidatesW, "true electron W", RED));
723  }
724 
725  PANDORA_MONITORING_API(SetEveDisplayParameters(this->GetPandora(), true, DETECTOR_VIEW_XZ, -1.f, 1.f, 1.f));
726  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
727  }
728  }
729 
730  if (signalCandidatesU.empty() || signalCandidatesV.empty() || signalCandidatesW.empty() || signalCandidates2D.empty())
731  {
732  std::cout << "Error: A CaloHitList is empty" << std::endl;
733  }
734  if (!signalCandidatesU.empty())
735  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, signalCandidatesU, m_signalListNameU));
736 
737  if (!signalCandidatesV.empty())
738  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, signalCandidatesV, m_signalListNameV));
739 
740  if (!signalCandidatesW.empty())
741  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, signalCandidatesW, m_signalListNameW));
742 
743  if (!signalCandidates2D.empty())
744  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, signalCandidates2D, m_signalListName2D));
745 
746  if (!backgroundCaloHitList.empty())
747  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, backgroundCaloHitList, m_backgroundListName));
748 
749  return STATUS_CODE_SUCCESS;
750 }
std::string m_signalListNameV
Output signal CaloHitListV name.
constexpr auto abs(T v)
Returns the absolute value of the argument.
pandora::StringVector m_caloHitListNames
Names of input calo hit lists.
std::string m_signalListNameW
Output signal CaloHitListW name.
TFile f
Definition: plotHisto.C:6
bool m_visualise
Whether or not to visualise the candidate vertices.
std::string m_backgroundListName
Input Background CaloHitList name.
std::string m_signalListName2D
Output signal CaloHitList2D name.
HitType
Definition: HitType.h:12
std::string m_signalListNameU
Output signal CaloHitListU name.
StatusCode lar_dl_content::DlSNSignalAlgorithm::CompleteMCHierarchy ( const LArMCParticleHelper::MCContributionMap mcToHitsMap,
pandora::MCParticleList &  mcHierarchy 
) const
private

Definition at line 819 of file DlSNSignalAlgorithm.cc.

References e, and hits().

820 {
821  try
822  {
823  for (const auto &[mc, hits] : mcToHitsMap)
824  {
825  (void)hits;
826  mcHierarchy.push_back(mc);
827  LArMCParticleHelper::GetAllAncestorMCParticles(mc, mcHierarchy);
828  }
829  }
830  catch (const StatusCodeException &e)
831  {
832  return e.GetStatusCode();
833  }
834 
835  // Move the neutrino to the front of the list
836  auto pivot =
837  std::find_if(mcHierarchy.begin(), mcHierarchy.end(), [](const MCParticle *mc) -> bool { return LArMCParticleHelper::IsNeutrino(mc); });
838  if (pivot != mcHierarchy.end())
839  std::rotate(mcHierarchy.begin(), pivot, std::next(pivot));
840  else
841  return STATUS_CODE_NOT_FOUND;
842 
843  return STATUS_CODE_SUCCESS;
844 }
void hits()
Definition: readHits.C:15
Float_t e
Definition: plot.C:35
void lar_dl_content::DlSNSignalAlgorithm::GetHitRegion ( const pandora::CaloHitList &  caloHitList,
float &  xMin,
float &  xMax,
float &  zMin,
float &  zMax 
) const
private

Definition at line 848 of file DlSNSignalAlgorithm.cc.

References util::begin(), m_driftStep, m_height, m_pass, m_simpleZoom, m_width, x, and z.

Referenced by Infer(), and PrepareTrainingSample().

849 {
850  if (m_pass == 1)
851  {
852  xMin = std::numeric_limits<float>::max();
853  xMax = -std::numeric_limits<float>::max();
854  zMin = std::numeric_limits<float>::max();
855  zMax = -std::numeric_limits<float>::max();
856  }
857  // Find the range of x and z values in the view
858  if (caloHitList.empty())
859  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
860 
861  for (const CaloHit *pCaloHit : caloHitList)
862  {
863  const float x{pCaloHit->GetPositionVector().GetX()};
864  const float z{pCaloHit->GetPositionVector().GetZ()};
865  xMin = std::min(x, xMin);
866  xMax = std::max(x, xMax);
867  zMin = std::min(z, zMin);
868  zMax = std::max(z, zMax);
869  }
870  HitType view{caloHitList.front()->GetHitType()};
871  const bool isU{view == TPC_VIEW_U}, isV{view == TPC_VIEW_V}, isW{view == TPC_VIEW_W};
872  if (!(isU || isV || isW))
873  throw StatusCodeException(STATUS_CODE_NOT_ALLOWED);
874 
875  // ATTN If wire w pitches vary between TPCs, exception will be raised in initialisation of lar pseudolayer plugin
876  const LArTPC *const pTPC(this->GetPandora().GetGeometry()->GetLArTPCMap().begin()->second);
877  const float pitch(view == TPC_VIEW_U ? pTPC->GetWirePitchU() : view == TPC_VIEW_V ? pTPC->GetWirePitchV() : pTPC->GetWirePitchW());
878 
879  if (!m_simpleZoom && m_pass > 1)
880  {
881  float xSum{0.f}, zSum{0.f}, nSum{0.f};
882 
883  for (const CaloHit *pCaloHit : caloHitList)
884  {
885  const float x{pCaloHit->GetPositionVector().GetX()}, z{pCaloHit->GetPositionVector().GetZ()};
886  xSum += x;
887  zSum += z;
888  ++nSum;
889  }
890  if (nSum == 0)
891  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
892  const CartesianVector &centre{xSum / nSum, 0.f, zSum / nSum};
893 
894  // Get hit distribution left/right asymmetry
895  int nHitsLeft{0}, nHitsRight{0};
896 
897  // Get hit distribution upstream/downstream asymmetry
898  int nHitsUpstream{0}, nHitsDownstream{0};
899 
900  const float xCtr{centre.GetX()};
901  const float zCtr{centre.GetZ()};
902 
903  for (const CaloHit *pCaloHit : caloHitList)
904  {
905  const float x{pCaloHit->GetPositionVector().GetX()}, z{pCaloHit->GetPositionVector().GetZ()};
906  if (x <= xCtr)
907  ++nHitsLeft;
908  else
909  ++nHitsRight;
910 
911  if (z <= zCtr)
912  ++nHitsUpstream;
913  else
914  ++nHitsDownstream;
915  }
916 
917  const int nHitsTotal{nHitsLeft + nHitsRight};
918  if (nHitsTotal == 0)
919  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
920  const float xAsymmetry{nHitsLeft / static_cast<float>(nHitsTotal)};
921 
922  const int nHitsViewTotal{nHitsUpstream + nHitsDownstream};
923  if (nHitsViewTotal == 0)
924  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
925  const float zAsymmetry{nHitsUpstream / static_cast<float>(nHitsViewTotal)};
926 
927  const float xSpan{m_driftStep * (m_width - 1)};
928  xMin = xCtr - xAsymmetry * xSpan;
929  xMax = xMin + (m_driftStep * (m_width - 1));
930  const float zSpan{pitch * (m_height - 1)};
931  zMin = zCtr - zAsymmetry * zSpan;
932  zMax = zMin + zSpan;
933  }
934 
935  if (m_simpleZoom && m_pass > 1)
936  {
937  float xPos{-std::numeric_limits<float>::max()}, zPos{-std::numeric_limits<float>::max()}, adcMax{0.f};
938  int nSum{0};
939  for (const CaloHit *pCaloHit : caloHitList)
940  {
941  const float xC{pCaloHit->GetPositionVector().GetX()}, zC{pCaloHit->GetPositionVector().GetZ()}, adc{pCaloHit->GetMipEquivalentEnergy()};
942  ;
943  if (xC >= xMin && xC < xMax)
944  {
945  nSum += 1;
946  if (adc > adcMax)
947  {
948  adcMax = adc;
949  xPos = xC;
950  zPos = zC;
951  }
952  }
953  }
954  if (nSum == 0)
955  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
956 
957  const float xSpan{m_driftStep * (m_width - 1)};
958  xMin = xPos - xSpan;
959  xMax = xPos + xSpan;
960  const float zSpan{pitch * (m_height - 1)};
961  zMin = zPos - zSpan;
962  zMax = zPos + zSpan;
963  }
964 
965  // Avoid unreasonable rescaling of very small hit regions, pixels are assumed to be 0.5cm in x and wire pitch in z
966  // ATTN: Rescaling is to a size 1 pixel smaller than the intended image to ensure all hits fit within an imaged binned
967  // to be one pixel wider than this
968  const float xRange{xMax - xMin}, zRange{zMax - zMin};
969  const float minXSpan{m_driftStep * (m_width - 1)};
970  if (xRange < minXSpan)
971  {
972  const float padding{0.5f * (minXSpan - xRange)};
973  xMin -= padding;
974  xMax += padding;
975  }
976  const float minZSpan{pitch * (m_height - 1)};
977  if (zRange < minZSpan)
978  {
979  const float padding{0.5f * (minZSpan - zRange)};
980  zMin -= padding;
981  zMax += padding;
982  }
983 }
Float_t x
Definition: compare.C:6
int m_width
The width of the images.
Double_t z
Definition: plot.C:276
int m_height
The height of the images.
int m_pass
The pass of the train/infer step.
HitType
Definition: HitType.h:12
float m_driftStep
The size of a pixel in the drift direction in cm (most relevant in pass 2)
bool m_simpleZoom
Decide whethere to run a simple loop to find highest adc hit or run network.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82
StatusCode lar_dl_content::DlSNSignalAlgorithm::GetMCToHitsMap ( LArMCParticleHelper::MCContributionMap mcToHitsMap) const
private

Definition at line 797 of file DlSNSignalAlgorithm.cc.

References m_caloHitListName2D, lar_content::LArMCParticleHelper::PrimaryParameters::m_maxPhotonPropagation, lar_content::LArMCParticleHelper::PrimaryParameters::m_minHitsForGoodView, lar_content::LArMCParticleHelper::PrimaryParameters::m_minPrimaryGoodHits, and lar_content::LArMCParticleHelper::PrimaryParameters::m_minPrimaryGoodViews.

Referenced by PrepareTrainingSample().

798 {
799  const CaloHitList *pCaloHitList2D(nullptr);
800  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_caloHitListName2D, pCaloHitList2D));
801  const MCParticleList *pMCParticleList(nullptr);
802  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pMCParticleList));
803  if (pMCParticleList->empty() || pCaloHitList2D->empty())
804  throw StatusCodeException(STATUS_CODE_NOT_ALLOWED);
805 
807  parameters.m_minPrimaryGoodHits = 3;
808  parameters.m_minHitsForGoodView = 2;
809  parameters.m_minPrimaryGoodViews = 2;
810  parameters.m_maxPhotonPropagation = std::numeric_limits<float>::max();
811  LArMCParticleHelper::SelectReconstructableMCParticles(
812  pMCParticleList, pCaloHitList2D, parameters, LArMCParticleHelper::IsBeamNeutrinoFinalState, mcToHitsMap);
813 
814  return STATUS_CODE_SUCCESS;
815 }
unsigned int m_minPrimaryGoodViews
the minimum number of primary good views
unsigned int m_minPrimaryGoodHits
the minimum number of primary good Hits
std::string m_caloHitListName2D
Input CaloHitList2D name.
unsigned int m_minHitsForGoodView
the minimum number of Hits for a good view
float m_maxPhotonPropagation
the maximum photon propagation length
StatusCode lar_dl_content::DlSNSignalAlgorithm::Infer ( )
private

Definition at line 285 of file DlSNSignalAlgorithm.cc.

References util::begin(), e, ELECTRON_CLASS, f, lar_dl_content::LArDLHelper::Forward(), GetHitRegion(), m_backgroundListName, m_caloHitListNames, m_event, m_height, m_inputCaloHitListNames, m_modelU, m_modelV, m_modelW, m_pass, m_passOneTrustThreshold, m_printOut, m_signalListName2D, m_signalListNameU, m_signalListNameV, m_signalListNameW, m_simpleZoom, m_visualise, MakeNetworkInputFromHits(), PHOTON_CLASS, SIGNAL_CLASS, util::to_string(), x, and z.

Referenced by Run().

286 {
287  if (m_pass == 1)
288  ++m_event;
289 
290  std::map<int, float> wireMin, wireMax;
291  std::map<int, bool> viewCalculated;
292  float driftMin{std::numeric_limits<float>::max()}, driftMax{-std::numeric_limits<float>::max()};
293  for (const std::string &listname : m_inputCaloHitListNames)
294  {
295  const CaloHitList *pCaloHitList{nullptr};
296  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, listname, pCaloHitList));
297 
298  if (!pCaloHitList)
299  continue;
300 
301  if (pCaloHitList->size() < m_passOneTrustThreshold)
302  continue;
303 
304  HitType view{pCaloHitList->front()->GetHitType()};
305  float viewDriftMin{driftMin}, viewDriftMax{driftMax};
306  try
307  {
308  this->GetHitRegion(*pCaloHitList, viewDriftMin, viewDriftMax, wireMin[view], wireMax[view]);
309  viewCalculated[view] = true;
310  }
311  catch (const StatusCodeException &e)
312  {
313  if (e.GetStatusCode() == STATUS_CODE_NOT_FOUND)
314  {
315  continue;
316  }
317  }
318  driftMin = std::min(viewDriftMin, driftMin);
319  driftMax = std::max(viewDriftMax, driftMax);
320  }
321 
322  for (const std::string &listName : m_caloHitListNames)
323  {
324  const CaloHitList *pCaloHitList{nullptr};
325  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, listName, pCaloHitList));
326 
327  if (!pCaloHitList)
328  {
329  std::cout << "ERR: Could not find full CaloHitList - DlSNSignalAlgorithm unable to proceed" << std::endl;
330  continue;
331  }
332 
333  HitType view{pCaloHitList->front()->GetHitType()};
334  float viewDriftMin{driftMin}, viewDriftMax{driftMax};
335  if (viewCalculated[view] != true)
336  {
337  const LArTPC *const pTPC(this->GetPandora().GetGeometry()->GetLArTPCMap().begin()->second);
338  const float pitch(view == TPC_VIEW_U ? pTPC->GetWirePitchU()
339  : view == TPC_VIEW_V ? pTPC->GetWirePitchV()
340  : pTPC->GetWirePitchW());
341  const float zSpan{pitch * (m_height - 1)};
342  bool projected{false};
343 
344  //Check W and U - Project to V
345  if (viewCalculated[TPC_VIEW_W] && viewCalculated[TPC_VIEW_U])
346  {
347  const float z1{(wireMax[TPC_VIEW_W] - wireMin[TPC_VIEW_W]) * 0.5f};
348  const float z2{(wireMax[TPC_VIEW_U] - wireMin[TPC_VIEW_U]) * 0.5f};
349  const float m_projectedCoordinate{static_cast<float>(this->GetPandora().GetPlugins()->GetLArTransformationPlugin()->WUtoV(z1, z2))};
350  wireMin[view] = m_projectedCoordinate - zSpan;
351  wireMax[view] = m_projectedCoordinate + zSpan;
352  projected = true;
353  }
354  //Check W and V - Project to U
355  if (viewCalculated[TPC_VIEW_W] && viewCalculated[TPC_VIEW_V])
356  {
357  const float z1{(wireMax[TPC_VIEW_W] - wireMin[TPC_VIEW_W]) * 0.5f};
358  const float z2{(wireMax[TPC_VIEW_V] - wireMin[TPC_VIEW_V]) * 0.5f};
359  this->GetPandora();
360  const float m_projectedCoordinate{static_cast<float>(this->GetPandora().GetPlugins()->GetLArTransformationPlugin()->VWtoU(z1, z2))};
361  wireMin[view] = m_projectedCoordinate - zSpan;
362  wireMax[view] = m_projectedCoordinate + zSpan;
363  projected = true;
364  }
365  //Check U and V - Project to W
366  if (viewCalculated[TPC_VIEW_U] && viewCalculated[TPC_VIEW_V])
367  {
368  const float z1{(wireMax[TPC_VIEW_U] - wireMin[TPC_VIEW_U]) * 0.5f};
369  const float z2{(wireMax[TPC_VIEW_V] - wireMin[TPC_VIEW_V]) * 0.5f};
370  const float m_projectedCoordinate{static_cast<float>(this->GetPandora().GetPlugins()->GetLArTransformationPlugin()->UVtoW(z1, z2))};
371  wireMin[view] = m_projectedCoordinate - zSpan;
372  wireMax[view] = m_projectedCoordinate + zSpan;
373  projected = true;
374  }
375 
376  if (!projected)
377  {
378  try
379  {
380  m_simpleZoom = true;
381  this->GetHitRegion(*pCaloHitList, viewDriftMin, viewDriftMax, wireMin[view], wireMax[view]);
382  m_simpleZoom = false;
383  }
384  catch (const StatusCodeException &e)
385  {
386  if (e.GetStatusCode() == STATUS_CODE_NOT_FOUND)
387  {
388  std::cout << "ERR: Could not calculate zoom region - DlSNSignalAlgorithm unable to proceed" << std::endl;
389  continue;
390  }
391  }
392  }
393  }
394  driftMin = std::min(viewDriftMin, driftMin);
395  driftMax = std::max(viewDriftMax, driftMax);
396  }
397 
398  CaloHitList signalCandidatesU, signalCandidatesV, signalCandidatesW, signalCandidates2D, backgroundCaloHitList, photonCandidatesU,
399  photonCandidatesV, photonCandidatesW, electronCandidatesU, electronCandidatesV, electronCandidatesW;
400  for (const std::string &listName : m_caloHitListNames)
401  {
402  const CaloHitList *pCaloHitList{nullptr};
403  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, listName, pCaloHitList));
404 
405  if (!pCaloHitList || pCaloHitList->empty())
406  continue;
407 
408  HitType view{pCaloHitList->front()->GetHitType()};
409  const bool isU{view == TPC_VIEW_U}, isV{view == TPC_VIEW_V}, isW{view == TPC_VIEW_W};
410  if (!isU && !isV && !isW)
411  return STATUS_CODE_NOT_ALLOWED;
412 
414  PixelMap pixelMap;
415  this->MakeNetworkInputFromHits(*pCaloHitList, view, driftMin, driftMax, wireMin[view], wireMax[view], input, pixelMap);
416 
417  // Run the input through the trained model
419  inputs.push_back(input);
421  if (isU)
422  LArDLHelper::Forward(m_modelU, inputs, output);
423  else if (isV)
424  LArDLHelper::Forward(m_modelV, inputs, output);
425  else
426  LArDLHelper::Forward(m_modelW, inputs, output);
427 
428  // we want the maximum value in the num_classes dimension (1) for every pixel
429  auto classes{torch::argmax(output, 1)};
430  // the argmax result is a 1 x height x width tensor where each element is a class id
431  auto classesAccessor{classes.accessor<int64_t, 3>()};
432  std::map<int, bool> haveSeenMap;
433 
434  for (const auto &[pCaloHit, pixel] : pixelMap)
435  {
436  //The ordering of the pixel is x coordinate, z coordinate
437  const auto cls{classesAccessor[0][pixel.second][pixel.first]};
438  if (m_printOut)
439  {
440  if (m_pass > 1 && cls == ELECTRON_CLASS)
441  {
442  std::cout << "*Electron identified*" << std::endl;
443  }
444  if (m_pass > 1 && cls == PHOTON_CLASS)
445  {
446  std::cout << "*Photon identified*" << std::endl;
447  }
448  if (m_pass < 2 && cls == SIGNAL_CLASS)
449  {
450  std::cout << "*Signal Pixel identified*" << std::endl;
451  }
452  }
453 
454  if (cls == PHOTON_CLASS)
455  {
456  signalCandidates2D.emplace_back(pCaloHit);
457 
458  if (isU)
459  {
460  signalCandidatesU.emplace_back(pCaloHit);
461  photonCandidatesU.emplace_back(pCaloHit);
462  }
463  else if (isV)
464  {
465  signalCandidatesV.emplace_back(pCaloHit);
466  photonCandidatesV.emplace_back(pCaloHit);
467  }
468  else
469  {
470  signalCandidatesW.emplace_back(pCaloHit);
471  photonCandidatesW.emplace_back(pCaloHit);
472  }
473  }
474  else if (cls == ELECTRON_CLASS)
475  {
476  signalCandidates2D.emplace_back(pCaloHit);
477 
478  if (isU)
479  {
480  signalCandidatesU.emplace_back(pCaloHit);
481  electronCandidatesU.emplace_back(pCaloHit);
482  }
483  else if (isV)
484  {
485  signalCandidatesV.emplace_back(pCaloHit);
486  electronCandidatesV.emplace_back(pCaloHit);
487  }
488  else
489  {
490  signalCandidatesW.emplace_back(pCaloHit);
491  electronCandidatesW.emplace_back(pCaloHit);
492  }
493  }
494  else
495  {
496  backgroundCaloHitList.emplace_back(pCaloHit);
497  }
498  }
499  if (m_visualise)
500  {
501  if (isU)
502  {
503  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &signalCandidatesU, "candidate signal U", BLUE));
504  if (m_pass == 2)
505  {
506  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &photonCandidatesU, "candidate photon U", BLACK));
507  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &electronCandidatesU, "candidate electron U", RED));
508  }
509  }
510 
511  if (isV)
512  {
513  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &signalCandidatesV, "candidate signal V", BLUE));
514  if (m_pass == 2)
515  {
516  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &photonCandidatesV, "candidate photon V", BLACK));
517  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &electronCandidatesV, "candidate electron V", RED));
518  }
519  }
520 
521  if (isW)
522  {
523  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &signalCandidatesW, "candidate signal W", BLUE));
524  if (m_pass == 2)
525  {
526  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &photonCandidatesW, "candidate photon W", BLACK));
527  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &electronCandidatesW, "candidate electron W", RED));
528  }
529  }
530 
531  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
532  }
533 #ifdef MONITORING
534  if (m_visualise)
535  {
536  PANDORA_MONITORING_API(SetEveDisplayParameters(this->GetPandora(), true, DETECTOR_VIEW_XZ, -1.f, 1.f, 1.f));
537  try
538  {
539  for (const CaloHit *pCaloHit : *pCaloHitList)
540  {
541  const float x{pCaloHit->GetPositionVector().GetX()}, z{pCaloHit->GetPositionVector().GetZ()};
542  const MCParticle *pMainMCParticle(nullptr);
543  try
544  {
545  pMainMCParticle = MCParticleHelper::GetMainMCParticle(pCaloHit);
546  }
547  catch (const StatusCodeException &)
548  {
549  }
550 
551  if (pMainMCParticle)
552  {
553  const MCParticle *const pParentMCParticle(LArMCParticleHelper::GetParentMCParticle(pMainMCParticle));
554 
555  if (LArMCParticleHelper::IsNeutrino(pParentMCParticle))
556  {
557  const CartesianVector signalHit(x, 0.f, z);
558  const int pdg{pMainMCParticle->GetParticleId()};
559  std::string electronLabel{"True electron "}, photonLabel{"True photon "};
560  if (pdg == E_MINUS)
561  {
562  std::string label{electronLabel + std::to_string(view)};
563  PANDORA_MONITORING_API(AddMarkerToVisualization(this->GetPandora(), &signalHit, label, YELLOW, 2));
564  }
565  if (pdg == PHOTON)
566  {
567  std::string label{photonLabel + std::to_string(view)};
568  PANDORA_MONITORING_API(AddMarkerToVisualization(this->GetPandora(), &signalHit, label, GREEN, 2));
569  }
570  }
571  }
572  }
573  }
574  catch (StatusCodeException &e)
575  {
576  std::cerr << "DlSNSignalAlgorithm: Warning. Couldn't find signal hits." << std::endl;
577  }
578  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
579  }
580 #endif
581  }
582  if (m_printOut)
583  {
584  std::cout << "Printing U view candidate length: " << signalCandidatesU.size() << std::endl;
585  std::cout << "Printing V view candidate length: " << signalCandidatesV.size() << std::endl;
586  std::cout << "Printing W view candidate length: " << signalCandidatesW.size() << std::endl;
587  std::cout << "Printing 2D view candidate length: " << signalCandidates2D.size() << std::endl;
588  std::cout << "Printing background CaloHitList length: " << backgroundCaloHitList.size() << std::endl;
589  std::cout << "Printing New CaloHitList Names: " << std::endl;
590  std::cout << m_signalListNameU << " | " << m_signalListNameV << " | " << m_signalListNameW << " | " << m_signalListName2D << " | "
591  << m_backgroundListName << std::endl;
592  }
593 
594  if (signalCandidatesU.empty() || signalCandidatesV.empty() || signalCandidatesW.empty() || signalCandidates2D.empty())
595  {
596  std::cout << "Error: A CaloHitList is empty" << std::endl;
597  }
598  if (!signalCandidatesU.empty())
599  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, signalCandidatesU, m_signalListNameU));
600 
601  if (!signalCandidatesV.empty())
602  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, signalCandidatesV, m_signalListNameV));
603 
604  if (!signalCandidatesW.empty())
605  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, signalCandidatesW, m_signalListNameW));
606 
607  if (!signalCandidates2D.empty())
608  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, signalCandidates2D, m_signalListName2D));
609 
610  if (!backgroundCaloHitList.empty())
611  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, backgroundCaloHitList, m_backgroundListName));
612 
613  return STATUS_CODE_SUCCESS;
614 }
Float_t x
Definition: compare.C:6
std::string m_signalListNameV
Output signal CaloHitListV name.
const int ELECTRON_CLASS
Constant for network classification for electrons.
pandora::StatusCode MakeNetworkInputFromHits(const pandora::CaloHitList &caloHits, const pandora::HitType view, const float xMin, const float xMax, const float zMin, const float zMax, LArDLHelper::TorchInput &networkInput, PixelMap &pixelMap) const
Double_t z
Definition: plot.C:276
int m_height
The height of the images.
const int PHOTON_CLASS
Constant for network classification for photons.
pandora::StringVector m_caloHitListNames
Names of input calo hit lists.
std::string m_signalListNameW
Output signal CaloHitListW name.
int m_pass
The pass of the train/infer step.
LArDLHelper::TorchModel m_modelU
The model for the U view.
LArDLHelper::TorchModel m_modelW
The model for the W view.
TFile f
Definition: plotHisto.C:6
bool m_visualise
Whether or not to visualise the candidate vertices.
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
std::string m_backgroundListName
Input Background CaloHitList name.
static void Forward(TorchModel &model, const TorchInputVector &input, TorchOutput &output)
Run a deep learning model.
Definition: LArDLHelper.cc:41
long unsigned int m_passOneTrustThreshold
Number of pixels in pass one required to trust the wire finding ability, below this threshold...
pandora::StringVector m_inputCaloHitListNames
Names of input calo hit lists, passed from Pass 1 of DLSignalAlg.
int m_event
The current event number.
std::string m_signalListName2D
Output signal CaloHitList2D name.
const int SIGNAL_CLASS
Constant for network classification for signal.
LArDLHelper::TorchModel m_modelV
The model for the V view.
HitType
Definition: HitType.h:12
bool m_printOut
Whether or not to print out network outputs of CaloHitList names and sizes.
bool m_simpleZoom
Decide whethere to run a simple loop to find highest adc hit or run network.
std::map< const pandora::CaloHit *, Pixel > PixelMap
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
std::string m_signalListNameU
Output signal CaloHitListU name.
Float_t e
Definition: plot.C:35
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82
void GetHitRegion(const pandora::CaloHitList &caloHitList, float &xMin, float &xMax, float &zMin, float &zMax) const
std::vector< torch::jit::IValue > TorchInputVector
Definition: LArDLHelper.h:27
StatusCode lar_dl_content::DlSNSignalAlgorithm::MakeNetworkInputFromHits ( const pandora::CaloHitList &  caloHits,
const pandora::HitType  view,
const float  xMin,
const float  xMax,
const float  zMin,
const float  zMax,
LArDLHelper::TorchInput networkInput,
PixelMap pixelMap 
) const
private

Definition at line 754 of file DlSNSignalAlgorithm.cc.

References util::begin(), lar_dl_content::LArDLHelper::InitialiseInput(), m_driftStep, m_height, m_pass, m_width, x, and z.

Referenced by Infer().

756 {
757  // ATTN If wire w pitches vary between TPCs, exception will be raised in initialisation of lar pseudolayer plugin
758  const LArTPC *const pTPC(this->GetPandora().GetGeometry()->GetLArTPCMap().begin()->second);
759  const float pitch(view == TPC_VIEW_U ? pTPC->GetWirePitchU() : view == TPC_VIEW_V ? pTPC->GetWirePitchV() : pTPC->GetWirePitchW());
760 
761  // Determine the bin edges
762  std::vector<double> xBinEdges(m_width + 1);
763  std::vector<double> zBinEdges(m_height + 1);
764  xBinEdges[0] = xMin - 0.5f * m_driftStep;
765  const double dx = ((xMax + 0.5f * m_driftStep) - xBinEdges[0]) / m_width;
766  for (int i = 1; i < m_width + 1; ++i)
767  xBinEdges[i] = xBinEdges[i - 1] + dx;
768  zBinEdges[0] = zMin - 0.5f * pitch;
769  const double dz = ((zMax + 0.5f * pitch) - zBinEdges[0]) / m_height;
770  for (int i = 1; i < m_height + 1; ++i)
771  zBinEdges[i] = zBinEdges[i - 1] + dz;
772 
773  LArDLHelper::InitialiseInput({1, 1, m_height, m_width}, networkInput);
774  auto accessor = networkInput.accessor<float, 4>();
775 
776  for (const CaloHit *pCaloHit : caloHits)
777  {
778  const float x{pCaloHit->GetPositionVector().GetX()};
779  const float z{pCaloHit->GetPositionVector().GetZ()};
780  if (m_pass > 1)
781  {
782  if (x < xMin || x > xMax || z < zMin || z > zMax)
783  continue;
784  }
785  const float adc{pCaloHit->GetMipEquivalentEnergy()};
786  const int pixelX{static_cast<int>(std::floor((x - xBinEdges[0]) / dx))};
787  const int pixelZ{static_cast<int>(std::floor((z - zBinEdges[0]) / dz))};
788  accessor[0][0][pixelZ][pixelX] += adc;
789  pixelMap[pCaloHit] = std::make_pair(pixelX, pixelZ);
790  }
791 
792  return STATUS_CODE_SUCCESS;
793 }
Float_t x
Definition: compare.C:6
int m_width
The width of the images.
Double_t z
Definition: plot.C:276
int m_height
The height of the images.
int m_pass
The pass of the train/infer step.
float m_driftStep
The size of a pixel in the drift direction in cm (most relevant in pass 2)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82
static void InitialiseInput(const at::IntArrayRef dimensions, TorchInput &tensor)
Create a torch input tensor.
Definition: LArDLHelper.cc:34
StatusCode lar_dl_content::DlSNSignalAlgorithm::PrepareTrainingSample ( )
private

Definition at line 91 of file DlSNSignalAlgorithm.cc.

References util::begin(), e, f, GetHitRegion(), GetMCToHitsMap(), m_caloHitListNames, m_height, m_inputCaloHitListNames, m_pass, m_simpleZoom, m_trainingOutputFile, x, and z.

Referenced by Run().

92 {
94  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->GetMCToHitsMap(mcToHitsMap));
95  if (mcToHitsMap.empty())
96  throw StatusCodeException(STATUS_CODE_NOT_ALLOWED);
97 
98  // Get boundaries for hits and make x dimension common
99  std::map<int, float> wireMin, wireMax;
100  std::map<int, bool> viewCalculated;
101  float driftMin{std::numeric_limits<float>::max()}, driftMax{-std::numeric_limits<float>::max()};
102  for (const std::string &listname : m_inputCaloHitListNames)
103  {
104  const CaloHitList *pCaloHitList{nullptr};
105  try
106  {
107  PandoraContentApi::GetList(*this, listname, pCaloHitList);
108  }
109  catch (const StatusCodeException &e)
110  {
111  continue;
112  }
113  if (!pCaloHitList || pCaloHitList->empty())
114  continue;
115 
116  HitType view{pCaloHitList->front()->GetHitType()};
117  float viewDriftMin{driftMin}, viewDriftMax{driftMax};
118  try
119  {
120  this->GetHitRegion(*pCaloHitList, viewDriftMin, viewDriftMax, wireMin[view], wireMax[view]);
121  viewCalculated[view] = true;
122  }
123  catch (const StatusCodeException &e)
124  {
125  if (e.GetStatusCode() == STATUS_CODE_NOT_FOUND)
126  continue;
127  else
128  throw;
129  }
130 
131  driftMin = std::min(viewDriftMin, driftMin);
132  driftMax = std::max(viewDriftMax, driftMax);
133  }
134 
135  for (const std::string &listName : m_caloHitListNames)
136  {
137  const CaloHitList *pCaloHitList{nullptr};
138  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, listName, pCaloHitList));
139 
140  if (!pCaloHitList)
141  {
142  std::cout << "ERR: Could not find full CaloHitList - DlSNSignalAlgorithm unable to proceed" << std::endl;
143  continue;
144  }
145 
146  HitType view{pCaloHitList->front()->GetHitType()};
147  float viewDriftMin{driftMin}, viewDriftMax{driftMax};
148  if (!viewCalculated[view])
149  {
150  const LArTPC *const pTPC(this->GetPandora().GetGeometry()->GetLArTPCMap().begin()->second);
151  const float pitch(view == TPC_VIEW_U ? pTPC->GetWirePitchU()
152  : view == TPC_VIEW_V ? pTPC->GetWirePitchV()
153  : pTPC->GetWirePitchW());
154  const float zSpan{pitch * (m_height - 1)};
155  bool projected{false};
156 
157  //Check W and U - Project to V
158  if (viewCalculated[TPC_VIEW_W] && viewCalculated[TPC_VIEW_U])
159  {
160  const float z1{(wireMax[TPC_VIEW_W] - wireMin[TPC_VIEW_W]) * 0.5f};
161  const float z2{(wireMax[TPC_VIEW_U] - wireMin[TPC_VIEW_U]) * 0.5f};
162  const float m_projectedCoordinate{static_cast<float>(this->GetPandora().GetPlugins()->GetLArTransformationPlugin()->WUtoV(z1, z2))};
163  wireMin[view] = m_projectedCoordinate - zSpan;
164  wireMax[view] = m_projectedCoordinate + zSpan;
165  projected = true;
166  }
167  //Check W and V - Project to U
168  if (viewCalculated[TPC_VIEW_W] && viewCalculated[TPC_VIEW_V])
169  {
170  const float z1{(wireMax[TPC_VIEW_W] - wireMin[TPC_VIEW_W]) * 0.5f};
171  const float z2{(wireMax[TPC_VIEW_V] - wireMin[TPC_VIEW_V]) * 0.5f};
172  this->GetPandora();
173  const float m_projectedCoordinate{static_cast<float>(this->GetPandora().GetPlugins()->GetLArTransformationPlugin()->VWtoU(z1, z2))};
174  wireMin[view] = m_projectedCoordinate - zSpan;
175  wireMax[view] = m_projectedCoordinate + zSpan;
176  projected = true;
177  }
178  //Check U and V - Project to W
179  if (viewCalculated[TPC_VIEW_U] && viewCalculated[TPC_VIEW_V])
180  {
181  const float z1{(wireMax[TPC_VIEW_U] - wireMin[TPC_VIEW_U]) * 0.5f};
182  const float z2{(wireMax[TPC_VIEW_V] - wireMin[TPC_VIEW_V]) * 0.5f};
183  const float m_projectedCoordinate{static_cast<float>(this->GetPandora().GetPlugins()->GetLArTransformationPlugin()->UVtoW(z1, z2))};
184  wireMin[view] = m_projectedCoordinate - zSpan;
185  wireMax[view] = m_projectedCoordinate + zSpan;
186  projected = true;
187  }
188  if (!projected)
189  {
190  try
191  {
192  m_simpleZoom = true;
193  this->GetHitRegion(*pCaloHitList, viewDriftMin, viewDriftMax, wireMin[view], wireMax[view]);
194  m_simpleZoom = false;
195  }
196  catch (const StatusCodeException &e)
197  {
198  if (e.GetStatusCode() == STATUS_CODE_NOT_FOUND)
199  {
200  std::cout << "ERR: Could not calculate zoom region - DlSNSignalAlgorithm unable to proceed" << std::endl;
201  continue;
202  }
203  }
204  }
205  }
206  driftMin = std::min(viewDriftMin, driftMin);
207  driftMax = std::max(viewDriftMax, driftMax);
208  }
209 
210  for (const std::string &listname : m_caloHitListNames)
211  {
212  const CaloHitList *pCaloHitList(nullptr);
213  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, listname, pCaloHitList));
214  if (pCaloHitList->empty())
215  continue;
216 
217  HitType view{pCaloHitList->front()->GetHitType()};
218  const bool isU{view == TPC_VIEW_U}, isV{view == TPC_VIEW_V}, isW{view == TPC_VIEW_W};
219  if (!(isU || isV || isW))
220  return STATUS_CODE_NOT_ALLOWED;
221 
222  const std::string trainingFilename{m_trainingOutputFile + "_" + listname + ".csv"};
223  unsigned long nHits{0};
224 
225  // Loop over all calo hits in appropriate region
226  double xMin{driftMin}, xMax{driftMax}, zMin{wireMin[view]}, zMax{wireMax[view]};
227 
228  LArMvaHelper::MvaFeatureVector featureVector;
229  featureVector.emplace_back(xMin);
230  featureVector.emplace_back(xMax);
231  featureVector.emplace_back(zMin);
232  featureVector.emplace_back(zMax);
233 
234  for (const CaloHit *pCaloHit : *pCaloHitList)
235  {
236  const float x{pCaloHit->GetPositionVector().GetX()}, z{pCaloHit->GetPositionVector().GetZ()}, adc{pCaloHit->GetMipEquivalentEnergy()};
237  // If on a refinement pass, drop hits outside the region of interest
238  if (m_pass > 1 && (x < xMin || x > xMax || z < zMin || z > zMax))
239  continue;
240  featureVector.emplace_back(static_cast<double>(x));
241  featureVector.emplace_back(static_cast<double>(z));
242  featureVector.emplace_back(static_cast<double>(adc));
243  ++nHits;
244 
245  const MCParticle *pMainMCParticle(nullptr);
246  try
247  {
248  pMainMCParticle = MCParticleHelper::GetMainMCParticle(pCaloHit);
249  }
250  catch (const StatusCodeException &)
251  {
252  }
253 
254  if (pMainMCParticle)
255  {
256  const MCParticle *const pParentMCParticle(LArMCParticleHelper::GetParentMCParticle(pMainMCParticle));
257 
258  if (LArMCParticleHelper::IsNeutrino(pParentMCParticle))
259  {
260  const int pdg{pMainMCParticle->GetParticleId()};
261  if (pdg == E_MINUS || pdg == PHOTON)
262  featureVector.emplace_back(pdg);
263  else
264  featureVector.emplace_back(0);
265  }
266  else
267  {
268  featureVector.emplace_back(0);
269  }
270  }
271  else
272  {
273  featureVector.emplace_back(0);
274  }
275  }
276  featureVector.insert(featureVector.begin() + 4, static_cast<double>(nHits));
277  LArMvaHelper::ProduceTrainingExample(trainingFilename, true, featureVector);
278  }
279 
280  return STATUS_CODE_SUCCESS;
281 }
Float_t x
Definition: compare.C:6
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
MvaTypes::MvaFeatureVector MvaFeatureVector
Definition: LArMvaHelper.h:75
Double_t z
Definition: plot.C:276
int m_height
The height of the images.
pandora::StringVector m_caloHitListNames
Names of input calo hit lists.
int m_pass
The pass of the train/infer step.
std::string m_trainingOutputFile
Output file name for training examples.
TFile f
Definition: plotHisto.C:6
pandora::StringVector m_inputCaloHitListNames
Names of input calo hit lists, passed from Pass 1 of DLSignalAlg.
HitType
Definition: HitType.h:12
bool m_simpleZoom
Decide whethere to run a simple loop to find highest adc hit or run network.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
pandora::StatusCode GetMCToHitsMap(LArMCParticleHelper::MCContributionMap &mcToHitsMap) const
Float_t e
Definition: plot.C:35
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82
void GetHitRegion(const pandora::CaloHitList &caloHitList, float &xMin, float &xMax, float &zMin, float &zMax) const
StatusCode lar_dl_content::DlSNSignalAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 987 of file DlSNSignalAlgorithm.cc.

References lar_dl_content::LArDLHelper::LoadModel(), m_applyCheatedSeparation, m_backgroundListName, m_caloHitListName2D, m_caloHitListNames, m_driftStep, m_height, m_inputCaloHitListNames, m_modelU, m_modelV, m_modelW, m_pass, m_passOneTrustThreshold, m_printOut, m_rootFileName, m_rootTreeName, m_signalListName2D, m_signalListNameU, m_signalListNameV, m_signalListNameW, m_trainingMode, m_trainingOutputFile, m_visualise, m_width, and m_writeTree.

988 {
989  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "TrainingMode", m_trainingMode));
990  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "Visualise", m_visualise));
991  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "Pass", m_pass));
992  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ImageHeight", m_height));
993  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ImageWidth", m_width));
994  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "DriftStep", m_driftStep));
995  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SignalListNameU", m_signalListNameU));
996  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SignalListNameV", m_signalListNameV));
997  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SignalListNameW", m_signalListNameW));
998  PANDORA_RETURN_RESULT_IF_AND_IF(
999  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SignalListName2D", m_signalListName2D));
1000 
1001  if (m_trainingMode)
1002  {
1003  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "TrainingOutputFileName", m_trainingOutputFile));
1004  }
1005  else
1006  {
1007  std::string modelName;
1008  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "ModelFileNameU", modelName));
1009  modelName = LArFileHelper::FindFileInPath(modelName, "FW_SEARCH_PATH");
1010  LArDLHelper::LoadModel(modelName, m_modelU);
1011  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "ModelFileNameV", modelName));
1012  modelName = LArFileHelper::FindFileInPath(modelName, "FW_SEARCH_PATH");
1013  LArDLHelper::LoadModel(modelName, m_modelV);
1014  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "ModelFileNameW", modelName));
1015  modelName = LArFileHelper::FindFileInPath(modelName, "FW_SEARCH_PATH");
1016  LArDLHelper::LoadModel(modelName, m_modelW);
1017  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "WriteTree", m_writeTree));
1018  if (m_writeTree)
1019  {
1020  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "RootTreeName", m_rootTreeName));
1021  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "RootFileName", m_rootFileName));
1022  }
1023  }
1024 
1025  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
1026  XmlHelper::ReadVectorOfValues(xmlHandle, "InputCaloHitListNames", m_inputCaloHitListNames));
1027  PANDORA_RETURN_RESULT_IF_AND_IF(
1028  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "CaloHitListNames", m_caloHitListNames));
1029  PANDORA_RETURN_RESULT_IF_AND_IF(
1030  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "CaloHitListName2D", m_caloHitListName2D));
1031  PANDORA_RETURN_RESULT_IF_AND_IF(
1032  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PassOneTrustThreshold", m_passOneTrustThreshold));
1033  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PrintOut", m_printOut));
1034  PANDORA_RETURN_RESULT_IF_AND_IF(
1035  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "BackgroundListName", m_backgroundListName));
1036  PANDORA_RETURN_RESULT_IF_AND_IF(
1037  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ApplyCheatedSeparation", m_applyCheatedSeparation));
1038 
1039  return STATUS_CODE_SUCCESS;
1040 }
std::string m_signalListNameV
Output signal CaloHitListV name.
std::string m_rootFileName
The ROOT file name.
int m_width
The width of the images.
std::string m_caloHitListName2D
Input CaloHitList2D name.
int m_height
The height of the images.
pandora::StringVector m_caloHitListNames
Names of input calo hit lists.
std::string m_signalListNameW
Output signal CaloHitListW name.
int m_pass
The pass of the train/infer step.
LArDLHelper::TorchModel m_modelU
The model for the U view.
LArDLHelper::TorchModel m_modelW
The model for the W view.
std::string m_trainingOutputFile
Output file name for training examples.
bool m_visualise
Whether or not to visualise the candidate vertices.
std::string m_rootTreeName
The ROOT tree name.
std::string m_backgroundListName
Input Background CaloHitList name.
long unsigned int m_passOneTrustThreshold
Number of pixels in pass one required to trust the wire finding ability, below this threshold...
pandora::StringVector m_inputCaloHitListNames
Names of input calo hit lists, passed from Pass 1 of DLSignalAlg.
std::string m_signalListName2D
Output signal CaloHitList2D name.
bool m_applyCheatedSeparation
Whether cheating to separate background and signal hits.
static pandora::StatusCode LoadModel(const std::string &filename, TorchModel &model)
Loads a deep learning model.
Definition: LArDLHelper.cc:16
LArDLHelper::TorchModel m_modelV
The model for the V view.
float m_driftStep
The size of a pixel in the drift direction in cm (most relevant in pass 2)
bool m_printOut
Whether or not to print out network outputs of CaloHitList names and sizes.
bool m_writeTree
Whether or not to write validation details to a ROOT tree.
std::string m_signalListNameU
Output signal CaloHitListU name.
StatusCode lar_dl_content::DlSNSignalAlgorithm::Run ( )
private

Definition at line 71 of file DlSNSignalAlgorithm.cc.

References CheatedSeparation(), f, Infer(), m_applyCheatedSeparation, m_trainingMode, m_visualise, and PrepareTrainingSample().

72 {
73  if (m_visualise)
74  {
75  PANDORA_MONITORING_API(SetEveDisplayParameters(this->GetPandora(), true, DETECTOR_VIEW_XZ, -1.f, 1.f, 1.f));
76  }
77 
79  {
80  if (m_trainingMode)
81  return this->PrepareTrainingSample();
82  else
83  return this->Infer();
84  }
85  else
86  return this->CheatedSeparation();
87 
88  return STATUS_CODE_SUCCESS;
89 }
TFile f
Definition: plotHisto.C:6
bool m_visualise
Whether or not to visualise the candidate vertices.
bool m_applyCheatedSeparation
Whether cheating to separate background and signal hits.

Member Data Documentation

const int lar_dl_content::DlSNSignalAlgorithm::ELECTRON_CLASS {3}
private

Constant for network classification for electrons.

Definition at line 128 of file DlSNSignalAlgorithm.h.

Referenced by Infer().

bool lar_dl_content::DlSNSignalAlgorithm::m_applyCheatedSeparation
private

Whether cheating to separate background and signal hits.

Definition at line 124 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), ReadSettings(), and Run().

std::string lar_dl_content::DlSNSignalAlgorithm::m_backgroundListName
private

Input Background CaloHitList name.

Definition at line 123 of file DlSNSignalAlgorithm.h.

Referenced by CheatedSeparation(), DlSNSignalAlgorithm(), Infer(), and ReadSettings().

std::string lar_dl_content::DlSNSignalAlgorithm::m_caloHitListName2D
private

Input CaloHitList2D name.

Definition at line 121 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), GetMCToHitsMap(), and ReadSettings().

pandora::StringVector lar_dl_content::DlSNSignalAlgorithm::m_caloHitListNames
private

Names of input calo hit lists.

Definition at line 102 of file DlSNSignalAlgorithm.h.

Referenced by CheatedSeparation(), Infer(), PrepareTrainingSample(), and ReadSettings().

float lar_dl_content::DlSNSignalAlgorithm::m_driftStep
private

The size of a pixel in the drift direction in cm (most relevant in pass 2)

Definition at line 110 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), GetHitRegion(), MakeNetworkInputFromHits(), and ReadSettings().

int lar_dl_content::DlSNSignalAlgorithm::m_event
private

The current event number.

Definition at line 106 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), and Infer().

int lar_dl_content::DlSNSignalAlgorithm::m_height
private

The height of the images.

Definition at line 108 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), GetHitRegion(), Infer(), MakeNetworkInputFromHits(), PrepareTrainingSample(), and ReadSettings().

pandora::StringVector lar_dl_content::DlSNSignalAlgorithm::m_inputCaloHitListNames
private

Names of input calo hit lists, passed from Pass 1 of DLSignalAlg.

Definition at line 122 of file DlSNSignalAlgorithm.h.

Referenced by Infer(), PrepareTrainingSample(), and ReadSettings().

std::string lar_dl_content::DlSNSignalAlgorithm::m_inputSignalListName
private

Input vertex list name if 2nd pass.

Definition at line 101 of file DlSNSignalAlgorithm.h.

LArDLHelper::TorchModel lar_dl_content::DlSNSignalAlgorithm::m_modelU
private

The model for the U view.

Definition at line 103 of file DlSNSignalAlgorithm.h.

Referenced by Infer(), and ReadSettings().

LArDLHelper::TorchModel lar_dl_content::DlSNSignalAlgorithm::m_modelV
private

The model for the V view.

Definition at line 104 of file DlSNSignalAlgorithm.h.

Referenced by Infer(), and ReadSettings().

LArDLHelper::TorchModel lar_dl_content::DlSNSignalAlgorithm::m_modelW
private

The model for the W view.

Definition at line 105 of file DlSNSignalAlgorithm.h.

Referenced by Infer(), and ReadSettings().

int lar_dl_content::DlSNSignalAlgorithm::m_pass
private

The pass of the train/infer step.

Definition at line 107 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), GetHitRegion(), Infer(), MakeNetworkInputFromHits(), PrepareTrainingSample(), and ReadSettings().

long unsigned int lar_dl_content::DlSNSignalAlgorithm::m_passOneTrustThreshold
private

Number of pixels in pass one required to trust the wire finding ability, below this threshold, the algorithm will use highest ADC within Drift Min/Max to set wire limits.

Definition at line 126 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), Infer(), and ReadSettings().

bool lar_dl_content::DlSNSignalAlgorithm::m_printOut
private

Whether or not to print out network outputs of CaloHitList names and sizes.

Definition at line 116 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), Infer(), and ReadSettings().

std::mt19937 lar_dl_content::DlSNSignalAlgorithm::m_rng
private

The random number generator.

Definition at line 115 of file DlSNSignalAlgorithm.h.

std::string lar_dl_content::DlSNSignalAlgorithm::m_rootFileName
private

The ROOT file name.

Definition at line 114 of file DlSNSignalAlgorithm.h.

Referenced by ReadSettings(), and ~DlSNSignalAlgorithm().

std::string lar_dl_content::DlSNSignalAlgorithm::m_rootTreeName
private

The ROOT tree name.

Definition at line 113 of file DlSNSignalAlgorithm.h.

Referenced by ReadSettings(), and ~DlSNSignalAlgorithm().

std::string lar_dl_content::DlSNSignalAlgorithm::m_signalListName2D
private

Output signal CaloHitList2D name.

Definition at line 120 of file DlSNSignalAlgorithm.h.

Referenced by CheatedSeparation(), DlSNSignalAlgorithm(), Infer(), and ReadSettings().

std::string lar_dl_content::DlSNSignalAlgorithm::m_signalListNameU
private

Output signal CaloHitListU name.

Definition at line 117 of file DlSNSignalAlgorithm.h.

Referenced by CheatedSeparation(), DlSNSignalAlgorithm(), Infer(), and ReadSettings().

std::string lar_dl_content::DlSNSignalAlgorithm::m_signalListNameV
private

Output signal CaloHitListV name.

Definition at line 118 of file DlSNSignalAlgorithm.h.

Referenced by CheatedSeparation(), DlSNSignalAlgorithm(), Infer(), and ReadSettings().

std::string lar_dl_content::DlSNSignalAlgorithm::m_signalListNameW
private

Output signal CaloHitListW name.

Definition at line 119 of file DlSNSignalAlgorithm.h.

Referenced by CheatedSeparation(), DlSNSignalAlgorithm(), Infer(), and ReadSettings().

bool lar_dl_content::DlSNSignalAlgorithm::m_simpleZoom
private

Decide whethere to run a simple loop to find highest adc hit or run network.

Definition at line 125 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), GetHitRegion(), Infer(), and PrepareTrainingSample().

bool lar_dl_content::DlSNSignalAlgorithm::m_trainingMode
private

Training mode.

Definition at line 99 of file DlSNSignalAlgorithm.h.

Referenced by ReadSettings(), and Run().

std::string lar_dl_content::DlSNSignalAlgorithm::m_trainingOutputFile
private

Output file name for training examples.

Definition at line 100 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), PrepareTrainingSample(), and ReadSettings().

bool lar_dl_content::DlSNSignalAlgorithm::m_visualise
private

Whether or not to visualise the candidate vertices.

Definition at line 111 of file DlSNSignalAlgorithm.h.

Referenced by CheatedSeparation(), DlSNSignalAlgorithm(), Infer(), ReadSettings(), and Run().

int lar_dl_content::DlSNSignalAlgorithm::m_width
private

The width of the images.

Definition at line 109 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), GetHitRegion(), MakeNetworkInputFromHits(), and ReadSettings().

bool lar_dl_content::DlSNSignalAlgorithm::m_writeTree
private

Whether or not to write validation details to a ROOT tree.

Definition at line 112 of file DlSNSignalAlgorithm.h.

Referenced by DlSNSignalAlgorithm(), ReadSettings(), and ~DlSNSignalAlgorithm().

const int lar_dl_content::DlSNSignalAlgorithm::PHOTON_CLASS {2}
private

Constant for network classification for photons.

Definition at line 127 of file DlSNSignalAlgorithm.h.

Referenced by Infer().

const int lar_dl_content::DlSNSignalAlgorithm::SIGNAL_CLASS {2}
private

Constant for network classification for signal.

Definition at line 129 of file DlSNSignalAlgorithm.h.

Referenced by Infer().


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