All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LArPandoraInput.h
Go to the documentation of this file.
1 /**
2  * @file larpandora/LArPandoraInterface/LArPandoraInput.h
3  *
4  * @brief Helper functions for providing inputs to pandora
5  */
6 
7 #ifndef LAR_PANDORA_INPUT_H
8 #define LAR_PANDORA_INPUT_H 1
9 
10 namespace detinfo {
11  class DetectorPropertiesData;
12 }
13 
17 
19 
20 namespace pandora { class Pandora; }
21 
22 namespace lar_pandora {
23 
24  /**
25  * @brief LArPandoraInput class
26  */
28  public:
29  /**
30  * @brief Settings class
31  */
32  class Settings {
33  public:
34  /**
35  * @brief Default constructor
36  */
37  Settings();
38 
39  const pandora::Pandora* m_pPrimaryPandora; ///<
40  bool m_useHitWidths; ///<
43  int m_uidOffset; ///<
45  double m_dx_cm; ///<
46  double m_int_cm; ///<
47  double m_rad_cm; ///<
48  double m_dEdX_mip; ///<
49  double m_mips_max; ///<
50  double m_mips_if_negative; ///<
51  double m_mips_to_gev; ///<
53  };
54 
55  /**
56  * @brief Create the Pandora 2D hits from the ART hits
57  *
58  * @param evt art event being processed
59  * @param settings the settings
60  * @param driftVolumeMap the mapping from volume id to drift volume
61  * @param hits the input list of ART hits for this event
62  * @param idToHitMap to receive the mapping from Pandora hit ID to ART hit
63  */
64  static void CreatePandoraHits2D(const art::Event& evt,
65  const Settings& settings,
66  const LArDriftVolumeMap& driftVolumeMap,
67  const HitVector& hitVector,
68  IdToHitMap& idToHitMap);
69 
70  /**
71  * @brief Create pandora LArTPCs to represent the different drift volumes in use
72  *
73  * @param settings the settings
74  * @param driftVolumeList the drift volume list
75  */
76  static void CreatePandoraLArTPCs(const Settings& settings,
77  const LArDriftVolumeList& driftVolumeList);
78 
79  /**
80  * @brief Create pandora line gaps to cover dead regions between TPCs in a global drift volume approach
81  *
82  * @param settings the settings
83  * @param driftVolumeList the drift volume list
84  * @param listOfGaps the list of gaps
85  */
86  static void CreatePandoraDetectorGaps(const Settings& settings,
87  const LArDriftVolumeList& driftVolumeList,
88  const LArDetectorGapList& listOfGaps);
89 
90  /**
91  * @brief Create pandora line gaps to cover any (continuous regions of) bad channels
92  *
93  * @param settings the settings
94  * @param driftVolumeMap the mapping from volume id to drift volume
95  */
96  static void CreatePandoraReadoutGaps(const Settings& settings,
97  const LArDriftVolumeMap& driftVolumeMap);
98 
99  /**
100  * @brief Create the Pandora MC particles from the MC particles
101  *
102  * @param settings the settings
103  * @param truthToParticles mapping from MC truth to MC particles
104  * @param particlesToTruth mapping from MC particles to MC truth
105  */
106  static void CreatePandoraMCParticles(const Settings& settings,
107  const MCTruthToMCParticles& truthToParticles,
108  const MCParticlesToMCTruth& particlesToTruth,
109  const RawMCParticleVector& generatorMCParticleVector);
110 
111  /**
112  * @brief Find all primary MCParticles in a given vector of MCParticles
113  *
114  * @param mcParticleVector vector of all MCParticles to consider
115  * @param primaryMCParticleMap map containing primary MCParticles and bool indicating whether particle has been accounted for
116  */
117  static void FindPrimaryParticles(const RawMCParticleVector& mcParticleVector,
118  std::map<const simb::MCParticle, bool>& primaryMCParticleMap);
119 
120  /**
121  * @brief Check whether an MCParticle can be found in a given map
122  *
123  * @param mcParticle target MCParticle
124  * @param primaryMCParticleMap map containing primary MCParticles and bool indicating whether particle has been accounted for
125  */
126  static bool IsPrimaryMCParticle(const art::Ptr<simb::MCParticle>& mcParticle,
127  std::map<const simb::MCParticle, bool>& primaryMCParticleMap);
128 
129  /**
130  * @brief Create links between the 2D hits and Pandora MC particles
131  *
132  * @param settings the settings
133  * @param hitMap mapping from Pandora hit addresses to ART hits
134  * @param hitToParticleMap mapping from each ART hit to its underlying G4 track ID
135  */
136  static void CreatePandoraMCLinks2D(const Settings& settings,
137  const HitMap& hitMap,
138  const HitsToTrackIDEs& hitToParticleMap);
139 
140  private:
141  typedef std::map<std::string, lar_content::MCProcess> MCProcessMap;
142 
143  /**
144  * @brief Loop over MC trajectory points and identify start and end points within the detector
145  *
146  * @param settings the settings
147  * @param particle the true particle
148  * @param startT the first trajectory point in the detector
149  * @param endT the last trajectory point in the detector
150  */
151  static void GetTrueStartAndEndPoints(const Settings& settings,
152  const art::Ptr<simb::MCParticle>& particle,
153  int& startT,
154  int& endT);
155 
156  /**
157  * @brief Loop over MC trajectory points and identify start and end points within a given cryostat and TPC
158  *
159  * @param cstat the cryostat
160  * @param tpc the TPC
161  * @param particle the true particle
162  * @param startT the first trajectory point in the detector
163  * @param endT the last trajectory point in the detector
164  */
165  static void GetTrueStartAndEndPoints(const unsigned int cstat,
166  const unsigned int tpc,
167  const art::Ptr<simb::MCParticle>& particle,
168  int& startT,
169  int& endT);
170 
171  /**
172  * @brief Use detector and time services to get a true X offset for a given trajectory point
173  *
174  * @param evt event currently being processing by art
175  * @param particle the true particle
176  * @param nT the trajectory point
177  */
178  static float GetTrueX0(const art::Event& evt,
179  const art::Ptr<simb::MCParticle>& particle,
180  const int nT);
181 
182  /**
183  * @brief Convert charge in ADCs to approximate MIPs
184  *
185  * @param settings the settings
186  * @param hit_Charge the input charge
187  * @param hit_View the input view number
188  */
189  static double GetMips(const detinfo::DetectorPropertiesData& detProp,
190  const Settings& settings,
191  const double hit_Charge,
192  const geo::View_t hit_View);
193 
194  /**
195  * @brief Populate a map from MC process string to enumeration
196  *
197  * @param processMap the output map from MC process string to enumeration
198  */
199  static void FillMCProcessMap(MCProcessMap& processMap);
200  };
201 
202 } // namespace lar_pandora
203 
204 #endif // #ifndef LAR_PANDORA_INPUT_H
Interface class for LArPandora producer modules, which reconstruct recob::PFParticles from recob::Hit...
static void CreatePandoraMCParticles(const Settings &settings, const MCTruthToMCParticles &truthToParticles, const MCParticlesToMCTruth &particlesToTruth, const RawMCParticleVector &generatorMCParticleVector)
Create the Pandora MC particles from the MC particles.
static void CreatePandoraDetectorGaps(const Settings &settings, const LArDriftVolumeList &driftVolumeList, const LArDetectorGapList &listOfGaps)
Create pandora line gaps to cover dead regions between TPCs in a global drift volume approach...
Helper functions for extracting detector geometry for use in reconsruction.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::map< unsigned int, LArDriftVolume > LArDriftVolumeMap
static float GetTrueX0(const art::Event &evt, const art::Ptr< simb::MCParticle > &particle, const int nT)
Use detector and time services to get a true X offset for a given trajectory point.
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth > > MCParticlesToMCTruth
std::vector< LArDriftVolume > LArDriftVolumeList
static void FindPrimaryParticles(const RawMCParticleVector &mcParticleVector, std::map< const simb::MCParticle, bool > &primaryMCParticleMap)
Find all primary MCParticles in a given vector of MCParticles.
const pandora::Pandora * m_pPrimaryPandora
std::map< int, art::Ptr< recob::Hit > > IdToHitMap
Definition: ILArPandora.h:21
std::map< int, art::Ptr< recob::Hit > > HitMap
static bool IsPrimaryMCParticle(const art::Ptr< simb::MCParticle > &mcParticle, std::map< const simb::MCParticle, bool > &primaryMCParticleMap)
Check whether an MCParticle can be found in a given map.
std::map< art::Ptr< recob::Hit >, TrackIDEVector > HitsToTrackIDEs
static double GetMips(const detinfo::DetectorPropertiesData &detProp, const Settings &settings, const double hit_Charge, const geo::View_t hit_View)
Convert charge in ADCs to approximate MIPs.
std::vector< simb::MCParticle > RawMCParticleVector
std::map< art::Ptr< simb::MCTruth >, MCParticleVector > MCTruthToMCParticles
static void CreatePandoraMCLinks2D(const Settings &settings, const HitMap &hitMap, const HitsToTrackIDEs &hitToParticleMap)
Create links between the 2D hits and Pandora MC particles.
static void FillMCProcessMap(MCProcessMap &processMap)
Populate a map from MC process string to enumeration.
Header file for the lar mc particle class.
static void CreatePandoraReadoutGaps(const Settings &settings, const LArDriftVolumeMap &driftVolumeMap)
Create pandora line gaps to cover any (continuous regions of) bad channels.
std::vector< art::Ptr< recob::Hit > > HitVector
static void CreatePandoraLArTPCs(const Settings &settings, const LArDriftVolumeList &driftVolumeList)
Create pandora LArTPCs to represent the different drift volumes in use.
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
Definition: reco_sbnd.fcl:182
std::map< std::string, lar_content::MCProcess > MCProcessMap
std::vector< LArDetectorGap > LArDetectorGapList
static void CreatePandoraHits2D(const art::Event &evt, const Settings &settings, const LArDriftVolumeMap &driftVolumeMap, const HitVector &hitVector, IdToHitMap &idToHitMap)
Create the Pandora 2D hits from the ART hits.
TCEvent evt
Definition: DataStructs.cxx:8
helper function for LArPandoraInterface producer module
auto const detProp
static void GetTrueStartAndEndPoints(const Settings &settings, const art::Ptr< simb::MCParticle > &particle, int &startT, int &endT)
Loop over MC trajectory points and identify start and end points within the detector.
LArPandoraInput class.