9 #include "Pandora/AlgorithmHeaders.h" 21 void TransverseTrackHitsBaseTool::GetTrackHits3D(
24 for (
const CaloHit *
const pCaloHit2D : inputTwoDHits)
29 this->GetTransverseTrackHit3D(matchedSlidingFitMap, protoHit);
30 this->AddTransverseChi2(matchedSlidingFitMap, protoHit);
33 protoHitVector.push_back(protoHit);
35 catch (StatusCodeException &)
46 double chiSquared(protoHit.
GetChi2());
48 const CartesianVector &inputPosition3D(protoHit.
GetPosition3D());
50 for (
const MatchedSlidingFitMap::value_type &mapEntry : matchedSlidingFitMap)
52 if (mapEntry.first == inputHitType)
55 const CartesianVector inputPosition2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), inputPosition3D, mapEntry.first));
56 chiSquared += this->GetTransverseChi2(inputPosition2D, mapEntry.second);
64 double TransverseTrackHitsBaseTool::GetTransverseChi2(
const CartesianVector &position2D,
const TwoDSlidingFitResult &fitResult)
const 69 const float minX(
std::min(minLayerX, maxLayerX));
70 const float maxX(
std::max(minLayerX, maxLayerX));
72 if (((position2D.GetX() - minX) > -std::numeric_limits<float>::epsilon()) && ((position2D.GetX() - maxX) < +std::numeric_limits<float>::epsilon()))
78 double px(0.),
pz(0.);
80 if (minLayerDistanceSquared < maxLayerDistanceSquared)
85 else if (maxLayerDistanceSquared < minLayerDistanceSquared)
91 if (std::fabs(
px) > std::numeric_limits<double>::epsilon())
93 return (0.5 * (pz * pz) / (
px *
px));
96 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
Proto hits are temporary constructs to be used during iterative 3D hit procedure. ...
std::map< pandora::HitType, TwoDSlidingFitResult > MatchedSlidingFitMap
const pandora::CaloHit * GetParentCaloHit2D() const
Get the address of the parent 2D calo hit.
ThreeDHitCreationAlgorithm::ProtoHitVector ProtoHitVector
bool IsPositionSet() const
Whether the proto hit position is set.
pandora::CartesianVector GetGlobalMinLayerDirection() const
Get global direction corresponding to the fit result in minimum fit layer.
const pandora::CartesianVector & GetPosition3D() const
Get the output 3D position.
Header file for the three dimensional hit creation algorithm class.
Header file for the geometry helper class.
double GetChi2() const
Get the chi squared value.
pandora::CartesianVector GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
pandora::CartesianVector GetGlobalMaxLayerDirection() const
Get global direction corresponding to the fit result in maximum fit layer.
void SetPosition3D(const pandora::CartesianVector &position3D, const double chi2)
Set position 3D.
pandora::CartesianVector GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
TwoDSlidingFitResult class.