8#ifndef NEW_LAR_VALIDATION_H
9#define NEW_LAR_VALIDATION_H 1
667 m_displayMatchedEvents(true),
669 m_nEventsToProcess(std::numeric_limits<int>::max()),
670 m_applyUbooneFiducialCut(false),
671 m_applySBNDFiducialCut(false),
672 m_correctTrackShowerId(false),
673 m_vertexXCorrection(0.495694f),
674 m_histogramOutput(false),
675 m_testBeamMode(false),
676 m_triggeredBeamOnly(true)
684 m_x(-std::numeric_limits<float>::max()),
685 m_y(-std::numeric_limits<float>::max()),
686 m_z(-std::numeric_limits<float>::max())
720 m_momentum(0.f, 0.f, 0.f),
721 m_vertex(-1.f, -1.f, -1.f),
722 m_endpoint(-1.f, -1.f, -1.f),
727 m_nPrimaryMatchedPfos(0),
728 m_nPrimaryMatchedNuPfos(0),
729 m_nPrimaryMatchedCRPfos(0),
730 m_bestMatchPfoId(-1),
731 m_bestMatchPfoPdgCode(0),
732 m_bestMatchPfoIsRecoNu(0),
733 m_bestMatchPfoRecoNuId(-1),
734 m_bestMatchPfoIsTestBeam(0),
735 m_bestMatchPfoNHitsTotal(0),
736 m_bestMatchPfoNHitsU(0),
737 m_bestMatchPfoNHitsV(0),
738 m_bestMatchPfoNHitsW(0),
739 m_bestMatchPfoNSharedHitsTotal(0),
740 m_bestMatchPfoNSharedHitsU(0),
741 m_bestMatchPfoNSharedHitsV(0),
742 m_bestMatchPfoNSharedHitsW(0)
753 m_isBeamParticle(false),
754 m_isCosmicRay(false),
755 m_targetVertex(0.f, 0.f, 0.f),
756 m_recoVertex(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max()),
757 m_isCorrectNu(false),
758 m_isCorrectTB(false),
759 m_isCorrectCR(false),
766 m_nTargetNuMatches(0),
767 m_nTargetCRMatches(0),
768 m_nTargetGoodNuMatches(0),
769 m_nTargetNuSplits(0),
770 m_nTargetNuLosses(0),
771 m_nTargetPrimaries(0)
779 m_fileIdentifier(-1),
804 m_nBestMatchSharedHitsTotal(0),
805 m_nBestMatchRecoHitsTotal(0),
806 m_bestMatchCompleteness(0.f),
807 m_bestMatchPurity(0.f),
808 m_isCorrectParticleId(false),
817 m_fileIdentifier(-1),
820 m_hasRecoVertex(false),
821 m_vertexOffset(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max())
830 m_hHitsEfficiency(nullptr),
831 m_hMomentumAll(nullptr),
832 m_hMomentumEfficiency(nullptr),
833 m_hCompleteness(nullptr),
842 m_hVtxDeltaX(nullptr),
843 m_hVtxDeltaY(nullptr),
844 m_hVtxDeltaZ(nullptr),
845 m_hVtxDeltaR(nullptr)
bool PassSBNDFiducialCut(const SimpleMCTarget &simpleMCTarget)
Whether a simple mc event passes sbnd fiducial cut, applied to target vertices.
std::map< InteractionType, PrimaryHistogramMap > InteractionPrimaryHistogramMap
std::map< ExpectedPrimary, CountingDetails > CountingMap
bool IsGoodParticleIdMatch(const SimpleMCPrimary &simpleMCPrimary, const int bestMatchPfoPdgCode)
Whether a provided mc primary and best matched pfo are deemed to have a good particle id match.
SimpleThreeVector operator-(const SimpleThreeVector &lhs, const SimpleThreeVector &rhs)
Simple three vector subtraction operator.
std::vector< SimpleMCEvent > SimpleMCEventList
std::map< ExpectedPrimary, PrimaryHistogramCollection > PrimaryHistogramMap
SimpleThreeVector operator+(const SimpleThreeVector &lhs, const SimpleThreeVector &rhs)
Simple three vector addition operator.
std::vector< SimpleThreeVector > SimpleThreeVectorList
std::map< InteractionType, CountingMap > InteractionCountingMap
std::map< ExpectedPrimary, PrimaryResult > PrimaryResultMap
void DisplayInteractionCountingMap(const InteractionCountingMap &interactionCountingMap, const Parameters ¶meters)
Print details to screen for a provided interaction type to counting map.
std::map< InteractionType, TargetResultList > InteractionTargetResultMap
void CountPfoMatches(const SimpleMCEvent &simpleMCEvent, const Parameters ¶meters, InteractionCountingMap &interactionCountingMap, InteractionTargetResultMap &interactionTargetResultMap)
CountPfoMatches Relies on fact that primary list is sorted by number of true good hits.
std::vector< TargetResult > TargetResultList
int ReadNextEvent(TChain *const pTChain, const int iEntry, SimpleMCEvent &simpleMCEvent, const Parameters ¶meters)
Read the next event from the chain.
std::vector< float > FloatVector
ExpectedPrimary GetExpectedPrimary(const SimpleMCPrimary &simpleMCPrimary, const SimpleMCPrimaryList &simpleMCPrimaryList)
Work out which of the primary particles (expected for a given interaction types) corresponds to the p...
bool PassUbooneFiducialCut(const SimpleMCTarget &simpleMCTarget)
Whether a simple mc event passes uboone fiducial cut, applied to target vertices.
bool PassFiducialCut(const SimpleMCTarget &simpleMCTarget, const Parameters ¶meters)
Whether a simple mc event passes the relevant fiducial cut, applied to target vertices.
void DisplaySimpleMCEventMatches(const SimpleMCEvent &simpleMCEvent, const Parameters ¶meters)
Print matching details to screen for a simple mc event.
InteractionType
InteractionType enum.
@ CCRES_E_P_P_P_P_P_PIZERO
@ BEAM_PARTICLE_KAON_MINUS
@ CCRES_E_P_P_P_P_P_PIPLUS
@ CCRES_MU_P_P_P_P_PIPLUS
@ CCDIS_MU_P_P_P_P_PIPLUS
@ BEAM_PARTICLE_KAON_PLUS
@ CCRES_MU_P_P_P_P_P_PHOTON
@ CCDIS_MU_P_P_P_P_P_PIPLUS
@ CCRES_MU_P_P_P_P_P_PIPLUS
@ CCDIS_MU_P_P_P_P_PHOTON
@ CCRES_E_P_P_P_P_P_PHOTON
@ CCRES_MU_P_P_P_P_P_PIZERO
@ CCRES_MU_P_P_P_P_PHOTON
@ NCDIS_P_P_P_P_P_PIMINUS
@ CCDIS_MU_P_P_P_P_P_PIZERO
@ CCRES_MU_P_P_P_P_PIZERO
@ CCDIS_MU_P_P_P_P_PIZERO
@ NCRES_P_P_P_P_P_PIMINUS
@ CCDIS_MU_P_P_P_P_P_PHOTON
std::vector< int > IntVector
ExpectedPrimary
ExpectedPrimary enum.
void FillTargetHistogramCollection(const std::string &histPrefix, const TargetResult &targetResult, TargetHistogramCollection &targetHistogramCollection)
Fill histograms in the provided target histogram collection, using information in the provided target...
std::vector< SimpleMCPrimary > SimpleMCPrimaryList
void ProcessHistogramCollections(const InteractionPrimaryHistogramMap &interactionPrimaryHistogramMap)
Process histograms stored in the provided map e.g. calculating final efficiencies,...
std::map< InteractionType, TargetHistogramCollection > InteractionTargetHistogramMap
void FillPrimaryHistogramCollection(const std::string &histPrefix, const Parameters ¶meters, const PrimaryResult &primaryResult, PrimaryHistogramCollection &primaryHistogramCollection)
Fill histograms in the provided histogram collection, using information in the provided primary resul...
std::vector< SimpleMCTarget > SimpleMCTargetList
void Validation(const std::string &inputFiles, const Parameters ¶meters=Parameters())
Validation - Main entry point for analysis.
void AnalyseInteractionTargetResultMap(const InteractionTargetResultMap &interactionTargetResultMap, const Parameters ¶meters)
Opportunity to fill histograms, perform post-processing of information collected in main loop over nt...
std::string ToString(const ExpectedPrimary expectedPrimary)
Get a string representation of an interaction type.
unsigned int m_nTotal
The total number of occurences.
unsigned int m_correctId
The number of times the mc primary particle id was correct.
unsigned int m_nMatch0
The number of times the mc primary has 0 pfo matches.
unsigned int m_nMatch2
The number of times the mc primary has 2 pfo matches.
unsigned int m_nMatch3Plus
The number of times the mc primary has 3 or more pfo matches.
CountingDetails()
Default constructor.
unsigned int m_nMatch1
The number of times the mc primary has 1 pfo matches.
bool m_applyUbooneFiducialCut
Whether to apply uboone fiducial volume cut to true neutrino vertex position.
bool m_triggeredBeamOnly
Whether to only consider triggered beam particles.
std::string m_eventFileName
File name to which to write list of correct events.
std::string m_histPrefix
Histogram name prefix.
float m_vertexXCorrection
The vertex x correction, added to reported mc neutrino endpoint x value, in cm.
std::string m_mapFileName
File name to which to write output ascii tables, etc.
int m_nEventsToProcess
The number of events to process.
bool m_displayMatchedEvents
Whether to display matching results for individual events.
bool m_testBeamMode
Whether running in test beam mode.
int m_skipEvents
The number of events to skip.
bool m_histogramOutput
Whether to produce output histograms.
bool m_correctTrackShowerId
Whether to demand that pfos are correctly flagged as tracks or showers.
bool m_applySBNDFiducialCut
Whether to apply sbnd fiducial volume cut to true neutrino vertex position.
Parameters()
Default constructor.
PrimaryHistogramCollection class.
TH1F * m_hMomentumAll
The number of primaries vs momentum histogram.
TH1F * m_hHitsEfficiency
The primary efficiency vs number of hits histogram.
PrimaryHistogramCollection()
Default constructor.
TH1F * m_hPurity
The primary (best match) purity histogram.
TH1F * m_hMomentumEfficiency
The primary efficiency vs momentum histogram.
TH1F * m_hHitsAll
The number of primaries vs number of hits histogram.
TH1F * m_hCompleteness
The primary (best match) completeness histogram.
PrimaryResult()
Default constructor.
bool m_isCorrectParticleId
Whether the best matched pfo has the correct particle id.
unsigned int m_nPfoMatches
The total number of pfo matches for a given primary.
unsigned int m_nMCHitsTotal
The number of hits in the mc primary.
unsigned int m_nBestMatchRecoHitsTotal
The number of hits in the best matched pfo.
float m_bestMatchPurity
The purity of the best matched pfo.
float m_trueMomentum
The true momentum of the mc primary.
float m_bestMatchCompleteness
The completeness of the best matched pfo.
unsigned int m_nBestMatchSharedHitsTotal
The number of hits shared by the mc primary and the best matched pfo.
int m_eventNumber
The event number.
int m_fileIdentifier
The file identifier.
SimpleMCTargetList m_mcTargetList
The list of mc targets.
int m_nMCTargets
The number of mc targets.
SimpleMCEvent()
Constructor.
SimpleThreeVector m_momentum
The momentum.
int m_nMCHitsV
The number of v mc hits.
int m_pdgCode
The pdg code.
SimpleMCPrimary()
Constructor.
int m_bestMatchPfoIsTestBeam
Whether best match pfo is reconstructed as a test beam particle.
int m_bestMatchPfoNHitsW
The best match pfo number of w pfo hits.
int m_primaryId
The identifier.
int m_bestMatchPfoNSharedHitsW
The best match pfo number of w matched hits.
int m_bestMatchPfoIsRecoNu
Whether best match pfo is reconstructed as part of a neutrino hierarchy.
int m_bestMatchPfoRecoNuId
The identifier of the associated reco neutrino (if part of a neutrino hierarchy)
int m_nPrimaryMatchedPfos
The number of matched pfos.
int m_bestMatchPfoNSharedHitsU
The best match pfo number of u matched hits.
int m_bestMatchPfoNHitsTotal
The best match pfo total number of pfo hits.
int m_nMCHitsTotal
The total number of mc hits.
SimpleThreeVector m_vertex
The vertex.
int m_bestMatchPfoNHitsU
The best match pfo number of u pfo hits.
int m_nMCHitsU
The number of u mc hits.
int m_bestMatchPfoNHitsV
The best match pfo number of v pfo hits.
SimpleThreeVector m_endpoint
The endpoint.
int m_bestMatchPfoId
The best match pfo identifier.
int m_bestMatchPfoNSharedHitsV
The best match pfo number of v matched hits.
int m_nPrimaryMatchedCRPfos
The number of matched cr pfos.
float m_energy
The energy.
int m_nMCHitsW
The number of w mc hits.
int m_bestMatchPfoPdgCode
The best match pfo pdg code.
int m_nPrimaryMatchedNuPfos
The number of matched nu pfos.
int m_bestMatchPfoNSharedHitsTotal
The best match pfo total number of matched hits.
int m_isCosmicRay
Whether the target is a cosmic ray.
int m_isFakeCR
Whether the target was reconstructed as a fake cosmic ray.
SimpleMCTarget()
Constructor.
int m_isNeutrino
Whether the target is a neutrino.
int m_nTargetNuMatches
The number of neutrino pfo matches to the target.
int m_isLost
Whether the target was lost (not reconstructed)
int m_nTargetGoodNuMatches
The number of good neutrino pfo matches to the target (all from same parent neutrino)
int m_isFakeNu
Whether the target was reconstructed as a fake neutrino.
SimpleMCPrimaryList m_mcPrimaryList
The list of mc primaries.
int m_nTargetNuLosses
The number of neutrino primaries with no matches.
int m_isCorrectNu
Whether the target was correctly reconstructed as a neutrino.
int m_interactionType
The target interaction type.
int m_nTargetPrimaries
The number of target mc primaries.
int m_isCorrectTB
Whether the target was correctly reconstructed as a beam particle.
int m_nTargetMatches
The number of pfo matches to the target.
int m_nTargetCRMatches
The number of cosmic ray pfo matches to the target.
SimpleThreeVector m_targetVertex
The target vertex position.
int m_nTargetNuSplits
The number of split neutrino pfo matches to the target (from different parent neutrinos)
int m_isSplitNu
Whether the target was reconstructed as a split neutrino.
int m_isCorrectCR
Whether the target was correctly reconstructed as a cosmic ray.
SimpleThreeVector m_recoVertex
The reco vertex position, if available.
int m_mcNuanceCode
The target nuance code.
int m_isBeamParticle
Whether the target is a beam particle.
int m_isSplitCR
Whether the target was reconstructed as a split cosmic ray.
SimpleThreeVector()
Default constructor.
TargetHistogramCollection class.
TargetHistogramCollection()
Default constructor.
TH1F * m_hVtxDeltaY
The vtx delta y histogram.
TH1F * m_hVtxDeltaX
The vtx delta x histogram.
TH1F * m_hVtxDeltaR
The vtx delta r histogram.
TH1F * m_hVtxDeltaZ
The vtx delta z histogram.
bool m_hasRecoVertex
Whether a reco vertex is matched to the target.
TargetResult()
Default constructor.
bool m_isCorrect
Whether the target is reconstructed correctly.
PrimaryResultMap m_primaryResultMap
The primary result map.
int m_fileIdentifier
The file identifier.
int m_eventNumber
The event number.
SimpleThreeVector m_vertexOffset
The offset between the reco and true target vertices.