9 #include "Pandora/AlgorithmHeaders.h" 24 const CaloHitVector &inputTwoDHits,
ProtoHitVector &protoHitVector)
26 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
27 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() <<
std::endl;
31 if (!LArPfoHelper::IsShower(pPfo) || (1 != pPfo->GetParentPfoList().size()))
34 const ParticleFlowObject *
const pParentPfo(pPfo->GetParentPfoList().front());
36 CaloHitList parentHitList3D;
37 LArPfoHelper::GetCaloHits(pParentPfo, TPC_3D, parentHitList3D);
39 if (parentHitList3D.empty())
42 CaloHitVector parentHitVector3D(parentHitList3D.begin(), parentHitList3D.end());
43 std::sort(parentHitVector3D.begin(), parentHitVector3D.end(), LArClusterHelper::SortHitsByPosition);
45 this->CreateDeltaRayShowerHits3D(inputTwoDHits, parentHitVector3D, protoHitVector);
47 catch (StatusCodeException &)
54 void DeltaRayShowerHitsTool::CreateDeltaRayShowerHits3D(
55 const CaloHitVector &inputTwoDHits,
const CaloHitVector &parentHits3D,
ProtoHitVector &protoHitVector)
const 57 for (
const CaloHit *
const pCaloHit2D : inputTwoDHits)
61 const HitType hitType(pCaloHit2D->GetHitType());
62 const HitType hitType1((TPC_VIEW_U == hitType) ? TPC_VIEW_V : (TPC_VIEW_V == hitType) ? TPC_VIEW_W : TPC_VIEW_U);
63 const HitType hitType2((TPC_VIEW_U == hitType) ? TPC_VIEW_W : (TPC_VIEW_V == hitType) ? TPC_VIEW_U : TPC_VIEW_V);
65 bool foundClosestPosition(
false);
67 CartesianVector closestPosition3D(0.
f, 0.
f, 0.
f);
69 for (
const CaloHit *
const pCaloHit3D : parentHits3D)
71 const CartesianVector thisPosition3D(pCaloHit3D->GetPositionVector());
72 const CartesianVector thisPosition2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), thisPosition3D, hitType));
73 const float thisDistanceSquared((pCaloHit2D->GetPositionVector() - thisPosition2D).GetMagnitudeSquared());
75 if (thisDistanceSquared < closestDistanceSquared)
77 foundClosestPosition =
true;
78 closestDistanceSquared = thisDistanceSquared;
79 closestPosition3D = thisPosition3D;
83 if (!foundClosestPosition)
86 const CartesianVector position1(LArGeometryHelper::ProjectPosition(this->GetPandora(), closestPosition3D, hitType1));
87 const CartesianVector position2(LArGeometryHelper::ProjectPosition(this->GetPandora(), closestPosition3D, hitType2));
90 this->GetBestPosition3D(hitType1, hitType2, position1, position2, protoHit);
93 protoHitVector.push_back(protoHit);
95 catch (StatusCodeException &)
Header file for the pfo helper class.
Proto hits are temporary constructs to be used during iterative 3D hit procedure. ...
ThreeDHitCreationAlgorithm::ProtoHitVector ProtoHitVector
bool IsPositionSet() const
Whether the proto hit position is set.
Header file for the three dimensional hit creation algorithm class.
Header file for the geometry helper class.
Header file for the cluster helper class.
static int max(int a, int b)
ThreeDHitCreationAlgorithm::Algorithm class.
QTextStream & endl(QTextStream &s)