9 #include "Helpers/MCParticleHelper.h" 10 #include "Objects/CartesianVector.h" 11 #include "Objects/MCParticle.h" 12 #include "Pandora/AlgorithmHeaders.h" 36 m_trainingSetMode{
false},
61 PANDORA_MONITORING_API(SaveTree(this->GetPandora(),
m_treeName.c_str(),
m_fileName.c_str(),
"RECREATE"));
70 std::map<const Cluster *, ClusterVector> clustersToMerge;
76 const ClusterList *pClusterList{
nullptr};
77 PANDORA_RETURN_RESULT_IF_AND_IF(
78 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*
this, clusterListName, pClusterList));
80 if (!pClusterList || pClusterList->empty())
82 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
83 std::cout <<
"ClusterMergingAlgorithm: unable to find cluster list " << clusterListName << std::endl;
87 PandoraContentApi::ParticleFlowObject::Metadata lowEClustersMetadata;
92 catch (StatusCodeException &statusCodeException)
94 throw statusCodeException;
99 PANDORA_MONITORING_API(SaveTree(this->GetPandora(),
m_treeName.c_str(),
m_fileName.c_str(),
"RECREATE"))
103 return STATUS_CODE_SUCCESS;
108 template <
typename T>
110 const Cluster *
const cluster, std::map<const Cluster *, const MCParticle *> &clusterToMCMap)
const 112 const MCParticle *clusterMC{
nullptr};
114 if (clusterToMCMap.count(cluster) > 0)
116 clusterMC = clusterToMCMap.at(cluster);
122 clusterMC = MCParticleHelper::GetMainMCParticle(cluster);
123 clusterToMCMap[cluster] = clusterMC;
125 catch (StatusCodeException
e)
127 std::cout <<
"Failed to get MC particle for cluster of " << cluster->GetOrderedCaloHitList().size() <<
" : " << e.ToString() << std::endl;
136 template <
typename T>
139 if (!cluster->IsAvailable())
142 if (clusterIsUsed.count(cluster) > 0)
155 template <
typename T>
158 std::map<const Cluster *, const MCParticle *> clusterToMCParticleMap;
159 std::map<const Cluster *, bool> clusterIsUsed;
160 std::map<const Cluster *, ClusterVector> clustersToMerge;
163 for (
const Cluster *
const pCluster : *pClusterList)
167 countHits += pCluster->GetNCaloHits();
169 catch (StatusCodeException)
174 for (
auto iter = pClusterList->begin(); iter != pClusterList->end(); ++iter)
177 const Cluster *
const cluster(*iter);
179 cluster->GetOrderedCaloHitList().FillCaloHitList(hits);
180 const CaloHitList &isoHits{cluster->GetIsolatedCaloHitList()};
181 hits.insert(hits.end(), isoHits.begin(), isoHits.end());
183 if (!cluster || hits.empty())
189 CaloHitList clusterEdgeHits;
190 CartesianVector centroid11(0.
f, 0.
f, 0.
f), centroid12(0.
f, 0.
f, 0.
f), centroid21(0.
f, 0.
f, 0.
f), centroid22(0.
f, 0.
f, 0.
f);
193 centroid11 = cluster->GetCentroid(cluster->GetInnerPseudoLayer());
194 centroid12 = cluster->GetCentroid(cluster->GetOuterPseudoLayer());
198 CaloHitList tempHits;
199 cluster->GetOrderedCaloHitList().FillCaloHitList(tempHits);
200 const CaloHitList &tempIsoHits{cluster->GetIsolatedCaloHitList()};
201 tempHits.insert(tempHits.end(), tempIsoHits.begin(), tempIsoHits.end());
202 centroid11 = tempHits.front()->GetPositionVector();
203 centroid12 = tempHits.back()->GetPositionVector();
206 const CartesianVector centroid1((centroid11 + centroid12) * 0.5
f);
210 const unsigned int clusterNHits{cluster->GetNCaloHits()};
212 for (
auto iter2 = std::next(iter); iter2 != pClusterList->end(); ++iter2)
214 const Cluster *
const otherCluster(*iter2);
215 CaloHitList otherHits;
216 otherCluster->GetOrderedCaloHitList().FillCaloHitList(otherHits);
217 const CaloHitList &otherIsoHits{otherCluster->GetIsolatedCaloHitList()};
218 otherHits.insert(otherHits.end(), otherIsoHits.begin(), otherIsoHits.end());
220 if (!otherCluster || otherHits.empty())
228 centroid21 = otherCluster->GetCentroid(otherCluster->GetInnerPseudoLayer());
229 centroid22 = otherCluster->GetCentroid(otherCluster->GetOuterPseudoLayer());
233 CaloHitList tempHits;
234 cluster->GetOrderedCaloHitList().FillCaloHitList(tempHits);
235 const CaloHitList &tempIsoHits{cluster->GetIsolatedCaloHitList()};
236 tempHits.insert(tempHits.end(), tempIsoHits.begin(), tempIsoHits.end());
237 centroid21 = tempHits.front()->GetPositionVector();
238 centroid22 = tempHits.back()->GetPositionVector();
241 const CartesianVector centroid2((centroid21 + centroid22) * 0.5f);
242 const float centroidSeparation{std::sqrt(centroid1.GetDistanceSquared(centroid2))};
243 const CartesianVector centroidVector(centroid2 - centroid1);
245 float vtxClusterAngle{std::numeric_limits<float>::lowest()};
246 PANDORA_RETURN_RESULT_IF_AND_IF(
247 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*
this,
m_vertexListName, pVertexList));
249 if (pVertexList && !pVertexList->empty())
251 const Vertex *pVertex{pVertexList->front()};
254 const CartesianVector vtxToCluster(centroid1 - vertexPosition), vtxToOtherCluster(centroid2 - vertexPosition);
255 const float D1(vtxToCluster.GetMagnitude()), D2(vtxToOtherCluster.GetMagnitude());
259 vtxClusterAngle = (vtxToCluster.GetDotProduct(vtxToOtherCluster) / (D1 * D2));
262 CaloHitList otherClusterEdgeHits;
266 const unsigned int otherClusterNHits{otherCluster->GetNCaloHits()};
267 CaloHitList largestList, smallestList;
268 CartesianVector vectorTool(0.f, 0.f, 0.f);
270 if (clusterEdgeHits.size() > otherClusterEdgeHits.size())
272 largestList = clusterEdgeHits;
273 smallestList = otherClusterEdgeHits;
274 vectorTool = centroid2;
278 largestList = otherClusterEdgeHits;
279 smallestList = clusterEdgeHits;
280 vectorTool = centroid1;
282 std::vector<float> distanceDistribution;
283 float finalDistance{0.f}, maxEdgeHitSeparation{std::numeric_limits<float>::lowest()},
284 minEdgeHitSeparation{std::numeric_limits<float>::max()}, adc1{0.f}, adc2{0.f};
285 int contact{0}, proximity{0};
288 for (
const CaloHit *
const caloHit1 : largestList)
290 CartesianVector hit1Position(caloHit1->GetPositionVector());
291 float nearestHit{std::numeric_limits<float>::lowest()};
292 adc1 += caloHit1->GetInputEnergy();
294 for (
const CaloHit *
const caloHit2 : smallestList)
296 CartesianVector hit2Position(caloHit2->GetPositionVector());
297 float distance{std::sqrt(hit1Position.GetDistanceSquared(hit2Position))};
298 CartesianVector vector1(hit2Position - hit1Position), tangent(centroidVector.GetZ(), 0.f, -centroidVector.GetX());
299 double smallestAngle{std::numeric_limits<float>::max()};
300 const float c(tangent.GetX() * vectorTool.GetX() + tangent.GetZ() * vectorTool.GetZ()),
301 intercept(tangent.GetX() * hit2Position.GetX() + tangent.GetZ() * hit2Position.GetZ());
302 adc2 += caloHit2->GetInputEnergy();
317 if (distance > maxEdgeHitSeparation)
319 maxEdgeHitSeparation = distance;
322 if (distance < minEdgeHitSeparation)
324 minEdgeHitSeparation = distance;
327 if (distance < nearestHit)
329 nearestHit = distance;
331 if (
std::abs(vector1.GetDotProduct(centroidVector)) > smallestAngle)
334 smallestAngle =
std::abs(vector1.GetDotProduct(centroidVector));
335 finalDistance = distance;
337 distanceDistribution.push_back(finalDistance);
340 const double avgDistance{!distanceDistribution.empty()
341 ? std::accumulate(distanceDistribution.begin(), distanceDistribution.end(), 0.0) / distanceDistribution.size()
344 std::vector<std::string> featureOrder;
345 featureOrder.emplace_back(
"VertexClusterAngle");
346 featureOrder.emplace_back(
"MinEdgeHitSeparation");
347 featureOrder.emplace_back(
"Cluster1NHits");
348 featureOrder.emplace_back(
"Cluster2NHits");
349 featureOrder.emplace_back(
"NHitsInContact");
350 featureOrder.emplace_back(
"NHitsInProximity");
351 featureOrder.emplace_back(
"CentroidSeparation");
352 featureOrder.emplace_back(
"AvgDistance");
353 featureOrder.emplace_back(
"CentroidVectorX");
354 featureOrder.emplace_back(
"CentroidVectorZ");
355 featureOrder.emplace_back(
"Cluster1ADC");
356 featureOrder.emplace_back(
"Cluster2ADC");
360 const MCParticle *clusterMC(this->
GetMCForCluster(cluster, clusterToMCParticleMap)),
361 *otherClusterMC(this->
GetMCForCluster(otherCluster, clusterToMCParticleMap));
362 const bool mcMatch(clusterMC == otherClusterMC);
365 featureVector.emplace_back(static_cast<double>(vtxClusterAngle));
366 featureVector.emplace_back(static_cast<double>(minEdgeHitSeparation));
367 featureVector.emplace_back(static_cast<double>(clusterNHits));
368 featureVector.emplace_back(static_cast<double>(otherClusterNHits));
369 featureVector.emplace_back(static_cast<double>(contact));
370 featureVector.emplace_back(static_cast<double>(proximity));
371 featureVector.emplace_back(static_cast<double>(centroidSeparation));
372 featureVector.emplace_back(static_cast<double>(avgDistance));
373 featureVector.emplace_back(static_cast<double>(centroidVector.GetX()));
374 featureVector.emplace_back(static_cast<double>(centroidVector.GetZ()));
375 featureVector.emplace_back(static_cast<double>(adc1));
376 featureVector.emplace_back(static_cast<double>(adc2));
385 featureMap[
"VertexClusterAngle"] = vtxClusterAngle;
386 featureMap[
"MinEdgeHitSeparation"] = minEdgeHitSeparation;
387 featureMap[
"Cluster1NHits"] = clusterNHits;
388 featureMap[
"Cluster2NHits"] = otherClusterNHits;
389 featureMap[
"NHitsInContact"] = contact;
390 featureMap[
"NHitsInProximity"] = proximity;
391 featureMap[
"CentroidSeparation"] = centroidSeparation;
392 featureMap[
"AvgDistance"] = avgDistance;
393 featureMap[
"CentroidVectorX"] = centroidVector.GetX();
394 featureMap[
"CentroidVectorZ"] = centroidVector.GetZ();
395 featureMap[
"Cluster1ADC"] = adc1;
396 featureMap[
"Cluster2ADC"] = adc2;
398 const bool areClustersToMerge(this->
ClusterTool(featureOrder, featureMap));
401 clusterIsUsed[cluster] =
true;
402 clusterIsUsed[otherCluster] =
true;
403 clustersToMerge[cluster].push_back(otherCluster);
410 const int nClusters(pClusterList->size());
411 const unsigned long int clusterNEdgeHits{clusterEdgeHits.size()};
412 const unsigned long int otherClusterNEdgeHits{otherClusterEdgeHits.size()};
413 float combinedNClusterHits(clusterNHits + otherClusterNHits), combinedNClusterEdgeHits(clusterNEdgeHits + otherClusterNEdgeHits);
415 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"EventNumber",
m_event));
416 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"VertexClusterAngle", vtxClusterAngle));
417 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"maxEdgeHitSeparation", maxEdgeHitSeparation));
418 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"NHitsInContact", contact));
419 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"NHitsInProximity", proximity));
420 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"minEdgeHitSeparation", minEdgeHitSeparation));
421 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"CentroidSeparation", centroidSeparation));
422 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"NClusters", nClusters));
423 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"CentroidVectorX", centroidVector.GetX()));
424 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"CentroidVectorZ", centroidVector.GetZ()));
425 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"TotalNClusterHits", (int)combinedNClusterHits));
426 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"TotalNClusterEdgeHits", (int)combinedNClusterEdgeHits));
427 PANDORA_MONITORING_API(FillTree(this->GetPandora(),
m_treeName.c_str()));
432 for (
auto clusterToMergePair : clustersToMerge)
434 const Cluster *currentCluster{clusterToMergePair.first};
435 const auto clusters{clusterToMergePair.second};
437 for (
auto clusterToMerge : clusters)
439 if (!clusterToMerge->IsAvailable())
444 std::cout <<
"Number of hits in clusters: " << currentCluster->GetNCaloHits() <<
" | " << clusterToMerge->GetNCaloHits() << std::endl;
449 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
450 PandoraContentApi::MergeAndDeleteClusters(*
this, currentCluster, clusterToMerge, listName, listName));
452 catch (StatusCodeException)
458 return STATUS_CODE_SUCCESS;
463 template <
typename T>
478 template <
typename T>
481 CartesianVector vector1(0.
f, 0.
f, 0.
f), vector2(0.
f, 0.
f, 0.
f), clusterCentroid(0.
f, 0.
f, 0.
f), centroidI(0.
f, 0.
f, 0.
f),
482 centroidJ(0.
f, 0.
f, 0.
f);
483 CaloHitList clusterCaloHits;
484 std::map<const Cluster *, bool> clusterIsUsed;
488 cluster->GetOrderedCaloHitList().FillCaloHitList(clusterCaloHits);
489 const CaloHitList &clusterIsoHits{cluster->GetIsolatedCaloHitList()};
490 clusterCaloHits.insert(clusterCaloHits.end(), clusterIsoHits.begin(), clusterIsoHits.end());
492 catch (StatusCodeException &)
494 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
495 std::cout <<
"Couldn't fill cluster with CaloHits" << std::endl;
499 centroidI = cluster->GetCentroid(cluster->GetInnerPseudoLayer());
500 centroidJ = cluster->GetCentroid(cluster->GetOuterPseudoLayer());
504 CaloHitList tempHits;
505 cluster->GetOrderedCaloHitList().FillCaloHitList(tempHits);
506 const CaloHitList &tempIsoHits{cluster->GetIsolatedCaloHitList()};
507 tempHits.insert(tempHits.end(), tempIsoHits.begin(), tempIsoHits.end());
508 centroidI = tempHits.front()->GetPositionVector();
509 centroidJ = tempHits.back()->GetPositionVector();
512 const CartesianVector centroid((centroidI + centroidJ) * 0.5
f);
513 std::map<const CaloHit *, bool> hitIsUsed;
517 float maxMag{0}, phi((6.28318 * i) / m_divisions);
518 CartesianVector vec(std::cos(phi), 0.f, std::sin(phi));
519 CaloHitList sectorHits;
522 for (
const CaloHit *pCaloHit : clusterCaloHits)
524 if (hitIsUsed.count(pCaloHit) == 0)
526 const CartesianVector hitPosition(pCaloHit->GetPositionVector().GetX(), 0.f, pCaloHit->GetPositionVector().GetZ());
527 const CartesianVector centroidToHitVec(hitPosition - centroid);
528 const float mag(centroidToHitVec.GetMagnitude());
529 const CartesianVector normCentroidVec(centroidToHitVec * (1 /
mag));
530 const float dotProduct(vec.GetDotProduct(normCentroidVec));
538 hitIsUsed[pCaloHit] =
true;
539 sectorHits.push_back(pCaloHit);
545 for (
const CaloHit *pCaloHit : sectorHits)
547 clusterEdgeHits.push_back(pCaloHit);
552 std::cout <<
"SectorHit size: " << sectorHits.size() << std::endl;
553 std::cout <<
"Cluster Hit Size: " << clusterCaloHits.size() <<
" | Edge Hit Size: " << clusterEdgeHits.size() << std::endl;
556 if (clusterCaloHits.size() < clusterEdgeHits.size())
558 std::cout <<
"Error in Edge Hit Algorithm: Incorrect edge hit classification !!!!" << std::endl;
562 return clusterEdgeHits;
567 template <
typename T>
570 const double dx{vector1.GetX() - vector2.GetX()};
571 const double dz{vector1.GetZ() - vector2.GetZ()};
572 double angle{tan(dx / dz)};
578 template <
typename T>
581 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"TrainingSetMode",
m_trainingSetMode));
583 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"PrintOut",
m_printOut));
585 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
588 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MvaFileName",
m_mvaFileName));
590 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MvaName",
m_mvaName));
592 PANDORA_RETURN_RESULT_IF_AND_IF(
593 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"EnableProbability",
m_enableProbability));
595 PANDORA_RETURN_RESULT_IF_AND_IF(
596 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinProbabilityCut",
m_minProbabilityCut));
598 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"InputClusterListNames",
m_inputClusterListNames));
600 PANDORA_RETURN_RESULT_IF_AND_IF(
601 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MCParticleListName",
m_mcParticleListName));
603 PANDORA_RETURN_RESULT_IF_AND_IF(
604 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"UpperHitThreshold",
m_upperHitThreshold));
606 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinNCaloHits",
m_minNCaloHits));
608 PANDORA_RETURN_RESULT_IF_AND_IF(
609 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"CountHitsThreshold",
m_countHitsThreshold));
611 PANDORA_RETURN_RESULT_IF_AND_IF(
612 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ContactThreshold",
m_contactThreshold));
614 PANDORA_RETURN_RESULT_IF_AND_IF(
615 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ProximityThreshold",
m_proximityThreshold));
617 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"EdgeHitToolDivisions",
m_divisions));
619 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SectorTolerance",
m_sectorTolerance));
621 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"WriteTree",
m_writeTree));
623 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"VertexListName",
m_vertexListName));
627 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"TreeName",
m_treeName));
629 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"FileName",
m_fileName));
634 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"MCParticleListName",
m_mcParticleListName));
635 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"TrainingOutputFileName",
m_trainingOutputFile));
641 std::cout <<
"MvaLowEClusterMergingAlgorithm: MvaFileName and MvaName must be set if in classification mode " << std::endl;
643 return STATUS_CODE_INVALID_PARAMETER;
650 return STATUS_CODE_SUCCESS;
static bool Classify(const MvaInterface &classifier, TCONTAINER &&featureContainer)
Use the trained classifier to predict the boolean class of an example.
Header file for the pfo helper class.
bool m_printOut
Whether the algorithm outputs cluster size information.
float m_contactThreshold
Distance value for hits to be considered in contact.
std::string m_fileName
Input file name for ROOT.
MvaTypes::MvaFeatureVector MvaFeatureVector
int m_event
Event Number Counter.
const pandora::MCParticle * GetMCForCluster(const pandora::Cluster *const cluster, std::map< const pandora::Cluster *, const pandora::MCParticle * > &clusterToMCMap) const
Get the MC particle for a given cluster, caching to a map.
static pandora::StatusCode ProduceTrainingExample(const std::string &trainingOutputFile, const bool result, TCONTAINER &&featureContainer)
Produce a training example with the given features and result.
const pandora::CaloHitList EdgeHitFinder(const pandora::Cluster *const cluster, pandora::CaloHitList &clusterEdgeHits) const
float m_minProbabilityCut
The minimum probability to label a cluster as track-like.
constexpr auto abs(T v)
Returns the absolute value of the argument.
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 IsValidToUse(const pandora::Cluster *const cluster, std::map< const pandora::Cluster *, bool > &clusterIsUsed) const
virtual ~MvaLowEClusterMergingAlgorithm()
Destructor.
std::string m_mvaName
The name of the mva to find.
Cluster finding and building.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
std::string m_mvaFileName
The mva input file.
MvaTypes::MvaFeatureMap MvaFeatureMap
pandora::StatusCode EdgeHitComparer(const pandora::ClusterList *const pClusterList, const std::string &listName) const
float m_maxClusterFraction
The maximum fraction a cluster can be contaminated by to be considered clean.
double Angle(const pandora::CartesianVector vector1, const pandora::CartesianVector vector2) const
bool m_enableProbability
Whether to use probabilities instead of binary classification.
Header file for the geometry helper class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Header file for the lar monte carlo particle helper helper class.
Header file for the cluster helper class.
std::string m_mcParticleListName
Input MC particle list name.
float m_minNCaloHits
The minimum number of hits for a cluster to be deemed true for IsAvailableToUse.
bool m_trainingSetMode
Whether to train.
float m_proximityThreshold
Distance value for hits to be considered in proximity.
bool ClusterTool(std::vector< std::string > featureOrder, LArMvaHelper::MvaFeatureMap featureMap) const
static std::string FindFileInPath(const std::string &unqualifiedFileName, const std::string &environmentVariable, const std::string &delimiter=":")
Find the fully-qualified file name by searching through a list of delimiter-separated paths in a name...
Header file for the file helper class.
float m_countHitsThreshold
A cut on whether cluster merges will occur depending on total event hits.
pandora::StatusCode Run()
std::string m_vertexListName
Input Vertex List name for vertex based calculation.
Header file for the lar mc particle class.
float m_sectorTolerance
Tolerance in radians for dot product between sector and centroid to CaloHit vector.
std::string m_filePathEnvironmentVariable
The environment variable providing a list of paths to mva files.
Header file for the shower growing algorithm class.
std::string m_treeName
Input tree name for ROOT.
pandora::StringVector m_inputClusterListNames
The names of the input cluster lists.
std::string m_trainingOutputFile
The training output file.
MvaLowEClusterMergingAlgorithm class.
Header file for the mva lowe cluster merging base algorithm class.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
static double CalculateProbability(const MvaInterface &classifier, TCONTAINER &&featureContainer)
Use the trained mva to calculate a classification probability for an example.
float m_divisions
Number of sectors to search in with Edge Hit Finder Function.
bool m_writeTree
Whether a tree should be output with recorded parameters.
std::list< Vertex > VertexList
float m_upperHitThreshold
Max number of hits for cluster to be considered.