LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
NeutrinoIdTool.h
Go to the documentation of this file.
1 
8 #ifndef LAR_NEUTRINO_ID_TOOL_H
9 #define LAR_NEUTRINO_ID_TOOL_H 1
10 
12 
14 
15 #include <functional>
16 
17 namespace lar_content
18 {
19 
31 {
32 public:
37 
38  void SelectOutputPfos(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, pandora::PfoList &selectedPfos);
39 
40 private:
45  {
46  public:
54  SliceFeatures(const pandora::PfoList &nuPfos, const pandora::PfoList &crPfos, const NeutrinoIdTool *const pTool);
55 
61  bool IsFeatureVectorAvailable() const;
62 
68  void GetFeatureVector(LArMvaHelper::MvaFeatureVector &featureVector) const;
69 
77  float GetNeutrinoProbability(const SupportVectorMachine &supportVectorMachine) const;
78 
79  private:
85  const pandora::ParticleFlowObject *GetNeutrino(const pandora::PfoList &nuPfos) const;
86 
93  void GetSpacePoints(const pandora::ParticleFlowObject *const pPfo, pandora::CartesianPointVector &spacePoints) const;
94 
103  pandora::CartesianVector GetDirection(const pandora::CartesianPointVector &spacePoints, std::function<bool(const pandora::CartesianVector &pointA, const pandora::CartesianVector &pointB)> fShouldChooseA) const;
104 
113  pandora::CartesianVector GetDirectionFromVertex(const pandora::CartesianPointVector &spacePoints, const pandora::CartesianVector &vertex) const;
114 
122  pandora::CartesianVector GetUpperDirection(const pandora::CartesianPointVector &spacePoints) const;
123 
131  pandora::CartesianVector GetLowerDirection(const pandora::CartesianPointVector &spacePoints) const;
132 
141  void GetPointsInSphere(const pandora::CartesianPointVector &spacePoints, const pandora::CartesianVector &vertex, const float radius, pandora::CartesianPointVector &spacePointsInSphere) const;
142 
145  const NeutrinoIdTool *const m_pTool;
146  };
147 
148  typedef std::pair<unsigned int, float> UintFloatPair;
149  typedef std::vector<SliceFeatures> SliceFeaturesVector;
150 
159  void GetSliceFeatures(const NeutrinoIdTool *const pTool, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, SliceFeaturesVector &sliceFeaturesVector) const;
160 
171  bool GetBestMCSliceIndex(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, unsigned int &bestSliceIndex) const;
172 
182  bool PassesQualityCuts(const pandora::Algorithm *const pAlgorithm, const float purity, const float completeness) const;
183 
191  void Collect2DHits(const pandora::PfoList &pfos, pandora::CaloHitList &reconstructedCaloHitList, const pandora::CaloHitSet &reconstructableCaloHitSet) const;
192 
200  unsigned int CountNeutrinoInducedHits(const pandora::CaloHitList &caloHitList) const;
201 
209  int GetNuanceCode(const pandora::Algorithm *const pAlgorithm) const;
210 
218  void SelectAllPfos(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &hypotheses, pandora::PfoList &selectedPfos) const;
219 
229  void SelectPfosByProbability(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, const SliceFeaturesVector &sliceFeaturesVector, pandora::PfoList &selectedPfos) const;
230 
237  void SelectPfos(const pandora::PfoList &pfos, pandora::PfoList &selectedPfos) const;
238 
239  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
240 
241  // Training
243  std::string m_trainingOutputFile;
245  int m_nuance;
246  float m_minPurity;
248 
249  // Classification
251  unsigned int m_maxNeutrinos;
252 
255 };
256 
257 } // namespace lar_content
258 
259 #endif // #ifndef LAR_NEUTRINO_ID_TOOL_H
float GetNeutrinoProbability(const SupportVectorMachine &supportVectorMachine) const
Get the probability that this slice contains a neutrino interaction.
void GetPointsInSphere(const pandora::CartesianPointVector &spacePoints, const pandora::CartesianVector &vertex, const float radius, pandora::CartesianPointVector &spacePointsInSphere) const
Get a vector of spacepoints within a given radius of a vertex point.
bool m_isAvailable
Is the feature vector available.
std::string m_filePathEnvironmentVariable
The environment variable providing a list of paths to svm files.
bool m_selectNuanceCode
Should select training events by nuance code.
float m_minCompleteness
Minimum completeness of the best slice to use event for training.
const NeutrinoIdTool *const m_pTool
The tool that owns this.
bool GetBestMCSliceIndex(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, unsigned int &bestSliceIndex) const
Get the slice with the most neutrino induced hits using Monte-Carlo information.
MvaTypes::MvaFeatureVector MvaFeatureVector
Definition: LArMvaHelper.h:58
pandora::CartesianVector GetDirection(const pandora::CartesianPointVector &spacePoints, std::function< bool(const pandora::CartesianVector &pointA, const pandora::CartesianVector &pointB)> fShouldChooseA) const
Use a sliding fit to get the direction of a collection of spacepoints.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
int m_nuance
Nuance code to select for training.
unsigned int m_maxNeutrinos
The maximum number of neutrinos to select in any one event.
LArMvaHelper::MvaFeatureVector m_featureVector
The SVM feature vector.
pandora::CartesianVector GetDirectionFromVertex(const pandora::CartesianPointVector &spacePoints, const pandora::CartesianVector &vertex) const
Use a sliding fit to get the direction of a collection of spacepoint near a vertex position...
float m_minPurity
Minimum purity of the best slice to use event for training.
bool IsFeatureVectorAvailable() const
Check if all features were calculable.
std::pair< unsigned int, float > UintFloatPair
void GetSpacePoints(const pandora::ParticleFlowObject *const pPfo, pandora::CartesianPointVector &spacePoints) const
Get the 3D space points in a given pfo.
unsigned int CountNeutrinoInducedHits(const pandora::CaloHitList &caloHitList) const
Count the number of neutrino induced hits in a given list using MC information.
void SelectPfosByProbability(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, const SliceFeaturesVector &sliceFeaturesVector, pandora::PfoList &selectedPfos) const
Select pfos based on the probability that their slice contains a neutrino interaction.
Header file for the master algorithm class.
void SelectAllPfos(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &hypotheses, pandora::PfoList &selectedPfos) const
Select all pfos under the same hypothesis.
Header file for the lar support vector machine class.
std::vector< SliceFeatures > SliceFeaturesVector
void SelectOutputPfos(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, pandora::PfoList &selectedPfos)
Select which reconstruction hypotheses to use; neutrino outcomes or cosmic-ray muon outcomes for each...
std::vector< pandora::PfoList > SliceHypotheses
void Collect2DHits(const pandora::PfoList &pfos, pandora::CaloHitList &reconstructedCaloHitList, const pandora::CaloHitSet &reconstructableCaloHitSet) const
Collect all 2D hits in a supplied list of Pfos and push them on to an existing hit list...
int GetNuanceCode(const pandora::Algorithm *const pAlgorithm) const
Use the current MCParticle list to get the nuance code of the neutrino in the event.
Double_t radius
NeutrinoIdTool()
Default constructor.
NeutrinoIdTool class.
SliceFeatures(const pandora::PfoList &nuPfos, const pandora::PfoList &crPfos, const NeutrinoIdTool *const pTool)
Constructor.
SliceIdBaseTool class.
void GetFeatureVector(LArMvaHelper::MvaFeatureVector &featureVector) const
Get the feature vector for the SVM.
void GetSliceFeatures(const NeutrinoIdTool *const pTool, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, SliceFeaturesVector &sliceFeaturesVector) const
Get the features of each slice.
std::string m_trainingOutputFile
Output file name for training examples.
float m_minProbability
Minimum probability required to classify a slice as the neutrino.
bool m_useTrainingMode
Should use training mode. If true, training examples will be written to the output file...
void SelectPfos(const pandora::PfoList &pfos, pandora::PfoList &selectedPfos) const
Add the given pfos to the selected Pfo list.
SupportVectorMachine m_supportVectorMachine
The support vector machine.
pandora::CartesianVector GetLowerDirection(const pandora::CartesianPointVector &spacePoints) const
Use a sliding fit to get the lower direction of a collection of spacepoints.
pandora::CartesianVector GetUpperDirection(const pandora::CartesianPointVector &spacePoints) const
Use a sliding fit to get the upper direction of a collection of spacepoints.
bool PassesQualityCuts(const pandora::Algorithm *const pAlgorithm, const float purity, const float completeness) const
Determine if the event passes the selection cuts for training and has the required NUANCE code...
const pandora::ParticleFlowObject * GetNeutrino(const pandora::PfoList &nuPfos) const
Get the recontructed neutrino the input list of neutrino Pfos.
vertex reconstruction