All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TruthMatchUtils.h
Go to the documentation of this file.
1 /**
2  * @file larsim/Utils/TruthMatchUtils.h
3  *
4  * @brief Utilities for matching a recob::Hit or vector of recob::Hit to the ID of the most significantly contributing G4 particle. Various functions using different definitions of 'most significantly contributing' are provided.
5  *
6  * @author Dom Brailsford (d.brailsford@lancaster.ac.uk)
7  *
8  * $log: $
9  */
10 #ifndef TRUTHMATCHUTILS_H_SEEN
11 #define TRUTHMATCHUTILS_H_SEEN
12 
13 // LArSoft
14 namespace recob { class Hit; }
15 
16 // art
17 #include "canvas/Persistency/Common/Ptr.h"
18 
19 // c++
20 #include <map>
21 #include <vector>
22 
23 namespace detinfo {
24  class DetectorClocksData;
25 }
26 
27 namespace TruthMatchUtils {
28 
29  typedef int G4ID;
30  typedef float EDeposit;
31  typedef std::map<G4ID, EDeposit> IDToEDepositMap;
32 
33  /**
34  * @brief Test whether a G4ID returned by the TruthMatchUtils functions is valid
35  *
36  * @param g4ID the G4ID to be tested
37  *
38  * @return validity bool
39  */
40  bool Valid(const G4ID g4ID) noexcept;
41 
42  /**
43  * @brief The G4 ID of the true particle which deposits the most energy in the recob::Hit
44  *
45  * @param pHit the recob::Hit to be assessed
46  * @param rollupUnsavedIDs whether to squash energy deposits for non-saved G4 particles (e.g. shower secondaries) its saved ancestor particle
47  *
48  * @return the ID of the G4 particle
49  */
51  const art::Ptr<recob::Hit>& pHit,
52  const bool rollupUnsavedIDs);
53 
54  /**
55  * @brief The G4 ID of the true particle which deposits the most energy in a vector of recob::Hit
56  *
57  * @param pHits the recob::Hit vector to be assessed
58  * @param rollupUnsavedIDs whether to squash energy deposits for non-saved G4 particles (e.g. shower secondaries) its saved ancestor particle
59  *
60  * @return the ID of the G4 particle
61  */
63  const std::vector<art::Ptr<recob::Hit>>& pHits,
64  const bool rollupUnsavedIDs);
65 
66  /**
67  * @brief The G4 ID of the true particle whose matched hits have produced the largest amount of reconstructed charge in a recob::Hit vector
68  *
69  * @param pHits the recob::Hit vector to be assessed
70  * @param rollupUnsavedIDs whether to squash energy deposits for non-saved G4 particles (e.g. shower secondaries) its saved ancestor particle
71  *
72  * @return the ID of the G4 particle
73  */
75  const std::vector<art::Ptr<recob::Hit>>& pHits,
76  const bool rollupUnsavedIDs);
77 
78  /**
79  * @brief The G4 ID of the true particle who has been truth-matched to the most hits in a recob::Hit vector
80  *
81  * @param pHits the recob::Hit vector to be assessed
82  * @param rollupUnsavedIDs whether to squash energy deposits for non-saved G4 particles (e.g. shower secondaries) its saved ancestor particle
83  *
84  * @return the ID of the G4 particle
85  */
87  const std::vector<art::Ptr<recob::Hit>>& pHits,
88  const bool rollupUnsavedIDs);
89 
90  /**
91  * @brief Fill an energy deposition map (maps G4 ID to true energy deposition) for a recob::Hit
92  *
93  * @param idToEDepMap the energy deposition map to be filled
94  * @param pHit the recob::Hit to be assessed
95  * @param rollupUnsavedIDs whether to squash energy deposits for non-saved G4 particles (e.g. shower secondaries) its saved ancestor particle
96  */
98  detinfo::DetectorClocksData const& clockData,
99  const art::Ptr<recob::Hit>& pHit,
100  const bool rollupUnsavedIDs);
101 
102 } // namespace TruthMatchUtils
103 
104 #endif // #ifndef TRUTHMATCHUTILS_H_SEEN
G4ID TrueParticleIDFromTotalRecoCharge(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit >> &pHits, const bool rollupUnsavedIDs)
The G4 ID of the true particle whose matched hits have produced the largest amount of reconstructed c...
G4ID TrueParticleID(detinfo::DetectorClocksData const &clockData, const art::Ptr< recob::Hit > &pHit, const bool rollupUnsavedIDs)
The G4 ID of the true particle which deposits the most energy in the recob::Hit.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
std::map< G4ID, EDeposit > IDToEDepositMap
bool Valid(const G4ID g4ID) noexcept
Test whether a G4ID returned by the TruthMatchUtils functions is valid.
void FillG4IDToEnergyDepositMap(IDToEDepositMap &idToEDepMap, detinfo::DetectorClocksData const &clockData, const art::Ptr< recob::Hit > &pHit, const bool rollupUnsavedIDs)
Fill an energy deposition map (maps G4 ID to true energy deposition) for a recob::Hit.
Contains all timing reference information for the detector.
G4ID TrueParticleIDFromTotalTrueEnergy(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit >> &pHits, const bool rollupUnsavedIDs)
The G4 ID of the true particle which deposits the most energy in a vector of recob::Hit.
G4ID TrueParticleIDFromTotalRecoHits(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit >> &pHits, const bool rollupUnsavedIDs)
The G4 ID of the true particle who has been truth-matched to the most hits in a recob::Hit vector...