Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
ThreeDHitCreationAlgorithm.h
Go to the documentation of this file.
1
8#ifndef LAR_THREE_D_HIT_CREATION_ALGORITHM_H
9#define LAR_THREE_D_HIT_CREATION_ALGORITHM_H 1
10
11#include "Pandora/Algorithm.h"
13
14#include <vector>
15
16namespace lar_content
17{
18
19class HitCreationBaseTool;
20class ThreeDSlidingFitResult;
21
22//------------------------------------------------------------------------------------------------------------------------------------------
23
28{
29public:
34 {
35 public:
39 TrajectorySample(const pandora::CartesianVector &position, const pandora::HitType hitType, const double sigma);
40
47
54
60 double GetSigma() const;
61
62 private:
65 double m_sigma;
66 };
67
68 typedef std::vector<TrajectorySample> TrajectorySampleVector;
69
74 {
75 public:
81 ProtoHit(const pandora::CaloHit *const pParentCaloHit2D);
82
89
95 bool IsPositionSet() const;
96
105
113 double GetChi2() const;
114
120 unsigned int GetNTrajectorySamples() const;
121
130
139
146 void SetPosition3D(const pandora::CartesianVector &position3D, const double chi2);
147
153 void AddTrajectorySample(const TrajectorySample &trajectorySample);
154
155 private:
159 double m_chi2;
161 };
162
163 typedef std::vector<ProtoHit> ProtoHitVector;
164
169
178 const pandora::CaloHitVector &inputCaloHitVector, const pandora::HitType hitType, pandora::CaloHitVector &outputCaloHitVector) const;
179
180private:
182
190 void SeparateTwoDHits(const pandora::ParticleFlowObject *const pPfo, const ProtoHitVector &protoHitVector,
191 pandora::CaloHitVector &remainingHitVector) const;
192
198 void IterativeTreatment(ProtoHitVector &protoHitVector) const;
199
207 void ExtractResults(const ProtoHitVector &protoHitVector, double &chi2, pandora::CartesianPointVector &pointVector) const;
208
217 double GetChi2WrtFit(const ThreeDSlidingFitResult &slidingFitResult, const ProtoHitVector &protoHitVector) const;
218
226 double GetHitMovementChi2(const ProtoHitVector &protoHitVector) const;
227
234 void RefineHitPositions(const ThreeDSlidingFitResult &slidingFitResult, ProtoHitVector &protoHitVector) const;
235
242 void CreateThreeDHits(const ProtoHitVector &protoHitVector, pandora::CaloHitList &newThreeDHits) const;
243
250 void CreateThreeDHit(const ProtoHit &protoHit, const pandora::CaloHit *&pCaloHit3D) const;
251
259 bool CheckThreeDHit(const ProtoHit &protoHit) const;
260
267 void AddThreeDHitsToPfo(const pandora::ParticleFlowObject *const pPfo, const pandora::CaloHitList &caloHitList) const;
268
270
271 typedef std::vector<HitCreationBaseTool *> HitCreationToolVector;
273
274 std::string m_inputPfoListName;
277
284};
285
286//------------------------------------------------------------------------------------------------------------------------------------------
287
289 const pandora::CartesianVector &position, const pandora::HitType hitType, const double sigma) :
290 m_position(position),
291 m_hitType(hitType),
292 m_sigma(sigma)
293{
294}
295
296//------------------------------------------------------------------------------------------------------------------------------------------
297
299{
300 return m_position;
301}
302
303//------------------------------------------------------------------------------------------------------------------------------------------
304
309
310//------------------------------------------------------------------------------------------------------------------------------------------
311
313{
314 return m_sigma;
315}
316
317//------------------------------------------------------------------------------------------------------------------------------------------
318//------------------------------------------------------------------------------------------------------------------------------------------
319
321 m_pParentCaloHit2D(pParentCaloHit2D),
322 m_isPositionSet(false),
323 m_position3D(0.f, 0.f, 0.f),
324 m_chi2(std::numeric_limits<double>::max())
325{
326}
327
328//------------------------------------------------------------------------------------------------------------------------------------------
329
331{
332 return m_pParentCaloHit2D;
333}
334
335//------------------------------------------------------------------------------------------------------------------------------------------
336
338{
339 return m_isPositionSet;
340}
341
342//------------------------------------------------------------------------------------------------------------------------------------------
343
345{
346 return m_trajectorySampleVector.size();
347}
348
349//------------------------------------------------------------------------------------------------------------------------------------------
350
352{
353 m_position3D = position3D;
354 m_chi2 = chi2;
355 m_isPositionSet = true;
356}
357
358//------------------------------------------------------------------------------------------------------------------------------------------
359
361{
362 m_trajectorySampleVector.push_back(trajectorySample);
363}
364
365} // namespace lar_content
366
367#endif // #ifndef LAR_THREE_D_HIT_CREATION_ALGORITHM_H
Header file for the algorithm class.
Header file for the algorithm tool class.
Proto hits are temporary constructs to be used during iterative 3D hit procedure.
const TrajectorySample & GetFirstTrajectorySample() const
Get the first trajectory sample.
TrajectorySampleVector m_trajectorySampleVector
The trajectory sample vector.
ProtoHit(const pandora::CaloHit *const pParentCaloHit2D)
Constructor.
void SetPosition3D(const pandora::CartesianVector &position3D, const double chi2)
Set position 3D.
void AddTrajectorySample(const TrajectorySample &trajectorySample)
Add a trajectory sample.
unsigned int GetNTrajectorySamples() const
Get the number of trajectory samples.
bool IsPositionSet() const
Whether the proto hit position is set.
const pandora::CaloHit * m_pParentCaloHit2D
The address of the parent 2D calo hit.
const pandora::CaloHit * GetParentCaloHit2D() const
Get the address of the parent 2D calo hit.
pandora::CartesianVector m_position3D
The output 3D position.
const TrajectorySample & GetLastTrajectorySample() const
Get the last trajectory sample.
bool m_isPositionSet
Whether the output 3D position has been set.
const pandora::CartesianVector & GetPosition3D() const
Get the output 3D position.
Trajectory samples record the results of sampling a particles in a particular view.
const pandora::CartesianVector & GetPosition() const
Get the sampling position.
TrajectorySample(const pandora::CartesianVector &position, const pandora::HitType hitType, const double sigma)
Constructor.
pandora::CartesianVector m_position
The sampling position.
pandora::HitType GetHitType() const
Get the sampling hit type.
ThreeDHitCreationAlgorithm::Algorithm class.
bool m_iterateTrackHits
Whether to enable iterative improvement of 3D hits for track trajectories.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
bool CheckThreeDHit(const ProtoHit &protoHit) const
Check that a new three dimensional position is not unphysical.
void IterativeTreatment(ProtoHitVector &protoHitVector) const
Improve initial 3D hits by fitting proto hits and iteratively creating consisted 3D hit trajectory.
std::string m_inputPfoListName
The name of the input pfo list.
pandora::StatusCode Run()
Run the algorithm.
double GetChi2WrtFit(const ThreeDSlidingFitResult &slidingFitResult, const ProtoHitVector &protoHitVector) const
Receive a chi2 value indicating consistency of a list of proto hits with a provided 3D sliding fit tr...
void SeparateTwoDHits(const pandora::ParticleFlowObject *const pPfo, const ProtoHitVector &protoHitVector, pandora::CaloHitVector &remainingHitVector) const
Get the list of 2D calo hits in a pfo for which 3D hits have and have not been created.
void RefineHitPositions(const ThreeDSlidingFitResult &slidingFitResult, ProtoHitVector &protoHitVector) const
Refine the 3D hit positions (and chi2) for a list of proto hits, in accordance with a provided 3D sli...
std::vector< HitCreationBaseTool * > HitCreationToolVector
void CreateThreeDHits(const ProtoHitVector &protoHitVector, pandora::CaloHitList &newThreeDHits) const
Create new three dimensional hits from two dimensional hits.
bool m_iterateShowerHits
Whether to enable iterative improvement of 3D hits for showers.
void FilterCaloHitsByType(const pandora::CaloHitVector &inputCaloHitVector, const pandora::HitType hitType, pandora::CaloHitVector &outputCaloHitVector) const
Get the subset of a provided calo hit vector corresponding to a specified hit type.
double GetHitMovementChi2(const ProtoHitVector &protoHitVector) const
Receive a chi2 value indicating consistency of a list of proto hits with the original,...
void ExtractResults(const ProtoHitVector &protoHitVector, double &chi2, pandora::CartesianPointVector &pointVector) const
Extract key results from a provided proto hit vector.
HitCreationToolVector m_algorithmToolVector
The algorithm tool vector.
unsigned int m_slidingFitHalfWindow
The sliding linear fit half window.
unsigned int m_nHitRefinementIterations
The maximum number of hit refinement iterations.
double m_sigma3DFitMultiplier
Multiplicative factor: sigmaUVW (same as sigmaHit and sigma2DFit) to sigma3DFit.
std::string m_outputCaloHitListName
The name of the output calo hit list.
void AddThreeDHitsToPfo(const pandora::ParticleFlowObject *const pPfo, const pandora::CaloHitList &caloHitList) const
Add a specified list of three dimensional hits to a cluster in a pfo, creating the new cluster if req...
std::vector< TrajectorySample > TrajectorySampleVector
void CreateThreeDHit(const ProtoHit &protoHit, const pandora::CaloHit *&pCaloHit3D) const
Create a new three dimensional hit from a two dimensional hit.
std::string m_outputClusterListName
The name of the output cluster list.
double m_iterationMaxChi2Ratio
Max ratio between current and previous chi2 values to cease iterations.
Algorithm class. Algorithm addresses are held only by the algorithm manager. They have a fully define...
Definition Algorithm.h:21
CaloHit class.
Definition CaloHit.h:26
CartesianVector class.
ParticleFlowObject class.
HitType
Calorimeter hit type enum.
std::vector< const CaloHit * > CaloHitVector
std::vector< CartesianVector > CartesianPointVector
MANAGED_CONTAINER< const CaloHit * > CaloHitList
StatusCode
The StatusCode enum.