9 #include "Pandora/AlgorithmHeaders.h" 21 LongitudinalTrackHitsBaseTool::LongitudinalTrackHitsBaseTool() :
22 m_vtxDisplacementCutSquared(5.
f * 5.
f),
23 m_minTrackLengthSquared(7.5
f * 7.5
f)
33 CartesianVector vtx3D(0.
f, 0.
f, 0.
f), end3D(0.
f, 0.
f, 0.
f);
36 for (
const CaloHit *
const pCaloHit2D : inputTwoDHits)
44 protoHitVector.push_back(protoHit);
46 catch (StatusCodeException &)
55 MatchedSlidingFitMap &outputSlidingFitMap, CartesianVector &bestVtx3D, CartesianVector &bestEnd3D)
const 59 const bool foundU(inputSlidingFitMap.end() != iterU);
62 const bool foundV(inputSlidingFitMap.end() != iterV);
65 const bool foundW(inputSlidingFitMap.end() != iterW);
67 bool useU(
false), useV(
false), useW(
false);
70 for (
unsigned int iPermutation = 0; iPermutation < 4; ++iPermutation)
72 const bool isForwardU((1 == iPermutation) ?
false :
true);
73 const bool isForwardV((2 == iPermutation) ?
false :
true);
74 const bool isForwardW((3 == iPermutation) ?
false :
true);
76 CartesianVector vtxU(0.
f, 0.
f, 0.
f), endU(0.
f, 0.
f, 0.
f);
77 CartesianVector vtxV(0.
f, 0.
f, 0.
f), endV(0.
f, 0.
f, 0.
f);
78 CartesianVector vtxW(0.
f, 0.
f, 0.
f), endW(0.
f, 0.
f, 0.
f);
101 CartesianVector vtx3D(0.
f, 0.
f, 0.
f), end3D(0.
f, 0.
f, 0.
f);
104 if (foundU && foundV)
110 if (foundV && foundW)
116 if (foundW && foundU)
122 bool matchedU(
false), matchedV(
false), matchedW(
false);
123 unsigned int matchedViews(0);
134 matchedU =
true; ++matchedViews;
147 matchedV =
true; ++matchedViews;
160 matchedW =
true; ++matchedViews;
164 if (matchedViews < 2)
167 if (vtxChi2 + endChi2 < bestChi2)
175 bestChi2 = vtxChi2 + endChi2;
180 outputSlidingFitMap.insert(MatchedSlidingFitMap::value_type(iterU->first, iterU->second));
183 outputSlidingFitMap.insert(MatchedSlidingFitMap::value_type(iterV->first, iterV->second));
186 outputSlidingFitMap.insert(MatchedSlidingFitMap::value_type(iterW->first, iterW->second));
188 if (outputSlidingFitMap.empty())
189 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
195 const CartesianVector &vtx2, CartesianVector &bestVtx,
float &bestChi2)
const 197 CartesianVector mergedVtx(0.
f, 0.
f, 0.
f);
202 if (mergedChi2 < bestChi2)
205 bestChi2 = mergedChi2;
214 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
215 "VertexDisplacementCut", vtxDisplacementCut));
219 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
220 "MinTrackLength", minTrackLength));
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Proto hits are temporary constructs to be used during iterative 3D hit procedure. ...
std::map< pandora::HitType, TwoDSlidingFitResult > MatchedSlidingFitMap
static void MergeTwoPositions3D(const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const pandora::CartesianVector &position1, const pandora::CartesianVector &position2, pandora::CartesianVector &position3D, float &chiSquared)
Merge 2D positions from two views to give unified 3D position.
virtual void GetLongitudinalTrackHit3D(const MatchedSlidingFitMap &matchedSlidingFitMap, const pandora::CartesianVector &vtx3D, const pandora::CartesianVector &end3D, ProtoHit &protoHit) const =0
Get the three dimensional position using a provided two dimensional calo hit and sliding linear fits ...
virtual void GetTrackHits3D(const pandora::CaloHitVector &inputTwoDHits, const MatchedSlidingFitMap &matchedSlidingFitMap, ProtoHitVector &protoHitVector) const
Calculate 3D hits from an input list of 2D hits.
ThreeDHitCreationAlgorithm::ProtoHitVector ProtoHitVector
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
bool IsPositionSet() const
Whether the proto hit position is set.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
double m_chiSquaredCut
The chi squared cut (accept only values below the cut value)
void UpdateBestPosition(const pandora::HitType hitType1, const pandora::HitType hitType2, const pandora::CartesianVector &vtx1, const pandora::CartesianVector &vtx2, pandora::CartesianVector &bestVtx, float &bestChi2) const
Combine two 2D coordinates to give a 3D coordinate.
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.
float m_minTrackLengthSquared
pandora::CartesianVector GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
float m_vtxDisplacementCutSquared
void GetVertexAndEndPositions(const MatchedSlidingFitMap &inputSlidingFitMap, MatchedSlidingFitMap &outputSlidingFitMap, pandora::CartesianVector &outputVtx3D, pandora::CartesianVector &outputEnd3D) const
Get reconstructed vertex and end positions for this 3D track.
pandora::CartesianVector GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
TwoDSlidingFitResult class.