36 m_workerInstancesInitialized(false),
37 m_larCaloHitVersion(1),
38 m_shouldRunAllHitsCosmicReco(true),
39 m_shouldRunStitching(true),
40 m_shouldRunCosmicHitRemoval(true),
41 m_shouldRunSlicing(true),
42 m_shouldRunNeutrinoRecoOption(true),
43 m_shouldRunCosmicRecoOption(true),
44 m_shouldPerformSliceId(true),
45 m_printOverallRecoStatus(false),
46 m_visualizeOverallRecoStatus(false),
47 m_shouldRemoveOutOfTimeHits(true),
48 m_pSlicingWorkerInstance(nullptr),
49 m_pSliceNuWorkerInstance(nullptr),
50 m_pSliceCRWorkerInstance(nullptr),
51 m_fullWidthCRWorkerWireGaps(true),
52 m_passMCParticlesToWorkerInstances(false),
53 m_filePathEnvironmentVariable(
"FW_SEARCH_PATH"),
65 PfoToLArTPCMap::const_iterator larTPCIter(pfoToLArTPCMap.find(pParentPfo));
67 if (pfoToLArTPCMap.end() == larTPCIter)
75 std::cout <<
"ShiftPfoHierarchy: x0 " << x0 << std::endl;
82 for (
const Cluster *
const pCluster : pDaughterPfo->GetClusterList())
84 pCluster->GetOrderedCaloHitList().FillCaloHitList(caloHitList);
85 caloHitList.insert(caloHitList.end(), pCluster->GetIsolatedCaloHitList().begin(), pCluster->GetIsolatedCaloHitList().end());
88 for (
const CaloHit *
const pCaloHit : caloHitList)
90 PandoraContentApi::CaloHit::Metadata metadata;
95 for (
const Vertex *
const pVertex : pDaughterPfo->GetVertexList())
97 PandoraContentApi::Vertex::Metadata metadata;
115 if (pPfoToEnlarge == pPfoToDelete)
119 pfoToLArTPCMap.erase(pPfoToEnlarge);
120 pfoToLArTPCMap.erase(pPfoToDelete);
131 for (
const Vertex *
const pDaughterVertex : daughterVertices)
134 for (
const Cluster *
const pDaughterCluster : daughterClusters)
180 PfoList clearCosmicRayPfos, ambiguousPfos;
195 return STATUS_CODE_SUCCESS;
204 return STATUS_CODE_ALREADY_INITIALIZED;
211 for (
const LArTPCMap::value_type &mapEntry : larTPCMap)
213 const unsigned int volumeId(mapEntry.second->GetLArTPCVolumeId());
229 std::cout <<
"MasterAlgorithm: Exception during initialization of worker instances " << statusCodeException.
ToString() << std::endl;
234 return STATUS_CODE_SUCCESS;
254 for (
const Pandora *
const pPandoraWorker : pandoraWorkerInstances)
256 for (
const MCParticle *
const pMCParticle : *pMCParticleList)
260 return STATUS_CODE_SUCCESS;
268 const unsigned int nLArTPCs(larTPCMap.size());
273 for (
const CaloHit *
const pCaloHit : *pCaloHitList)
277 if (!pLArCaloHit && (1 != nLArTPCs))
278 return STATUS_CODE_INVALID_PARAMETER;
281 const LArTPC *
const pLArTPC(larTPCMap.at(volumeId));
283 LArTPCHitList &larTPCHitList(volumeIdToHitListMap[volumeId]);
286 if (((pCaloHit->GetPositionVector().GetX() >= (pLArTPC->GetCenterX() - 0.5f * pLArTPC->GetWidthX())) &&
287 (pCaloHit->GetPositionVector().GetX() <= (pLArTPC->GetCenterX() + 0.5f * pLArTPC->GetWidthX()))))
293 return STATUS_CODE_SUCCESS;
300 unsigned int workerCounter(0);
304 const LArTPC &larTPC(pCRWorker->GetGeometry()->GetLArTPC());
305 VolumeIdToHitListMap::const_iterator iter(volumeIdToHitListMap.find(larTPC.
GetLArTPCVolumeId()));
307 if (volumeIdToHitListMap.end() == iter)
310 for (
const CaloHit *
const pCaloHit : iter->second.m_allHitList)
314 std::cout <<
"Running cosmic-ray reconstruction worker instance " << ++workerCounter <<
" of " <<
m_crWorkerInstances.size() << std::endl;
319 return STATUS_CODE_SUCCESS;
328 const PfoList *pCRPfos(
nullptr);
334 const LArTPC &larTPC(pCRWorker->GetGeometry()->GetLArTPC());
336 for (
const Pfo *
const pNewPfo : newPfoList)
337 pfoToLArTPCMap[pNewPfo] = &larTPC;
340 return STATUS_CODE_SUCCESS;
347 const PfoList *pRecreatedCRPfos(
nullptr);
357 pStitchingTool->Run(
this, pRecreatedCRPfos, pfoToLArTPCMap, stitchedPfosToX0Map);
365 return STATUS_CODE_SUCCESS;
372 const PfoList *pRecreatedCRPfos(
nullptr);
375 PfoList nonStitchedParentCosmicRayPfos;
376 for (
const Pfo *
const pPfo : *pRecreatedCRPfos)
378 if (!pPfo->GetParentPfoList().empty())
381 PfoToFloatMap::const_iterator pfoToX0Iter = stitchedPfosToX0Map.find(pPfo);
382 const float x0Shift((pfoToX0Iter != stitchedPfosToX0Map.end()) ? pfoToX0Iter->second : 0.f);
383 PfoList &targetList((std::fabs(x0Shift) >
m_inTimeMaxX0) ? clearCosmicRayPfos : nonStitchedParentCosmicRayPfos);
384 targetList.push_back(pPfo);
388 pCosmicRayTaggingTool->FindAmbiguousPfos(nonStitchedParentCosmicRayPfos, ambiguousPfos,
this);
390 for (
const Pfo *
const pPfo : nonStitchedParentCosmicRayPfos)
392 const bool isClearCosmic(ambiguousPfos.end() == std::find(ambiguousPfos.begin(), ambiguousPfos.end(), pPfo));
395 clearCosmicRayPfos.push_back(pPfo);
398 for (
const Pfo *
const pPfo : *pRecreatedCRPfos)
400 const bool isClearCosmic(ambiguousPfos.end() == std::find(ambiguousPfos.begin(), ambiguousPfos.end(), pPfo));
401 PandoraContentApi::ParticleFlowObject::Metadata metadata;
402 metadata.m_propertiesToAdd[
"IsClearCosmic"] = (isClearCosmic ? 1.f : 0.f);
413 return STATUS_CODE_SUCCESS;
423 for (
const Pfo *
const pPfoToDelete : allPfosToDelete)
425 const ClusterList clusterList(pPfoToDelete->GetClusterList());
426 const VertexList vertexList(pPfoToDelete->GetVertexList());
439 for (
const CaloHit *
const pCaloHit : caloHitList2D)
441 PandoraContentApi::CaloHit::Metadata metadata;
452 return STATUS_CODE_SUCCESS;
459 for (
const VolumeIdToHitListMap::value_type &mapEntry : volumeIdToHitListMap)
466 const HitType hitType(pCaloHit->GetHitType());
476 if (sliceVector.empty())
478 sliceVector.back().push_back(pCaloHit);
486 std::cout <<
"Running slicing worker instance" << std::endl;
488 const PfoList *pSlicePfos(
nullptr);
498 for (
const Pfo *
const pSlicePfo : *pSlicePfos)
508 std::cout <<
"Identified " << sliceVector.size() <<
" slice(s)" << std::endl;
510 return STATUS_CODE_SUCCESS;
523 pSliceSelectionTool->SelectSlices(
this, inputSliceVector, selectedSliceVector);
524 inputSliceVector = selectedSliceVector;
529 selectedSliceVector = std::move(sliceVector);
532 unsigned int sliceCounter(0);
534 for (
const CaloHitList &sliceHits : selectedSliceVector)
536 for (
const CaloHit *
const pSliceCaloHit : sliceHits)
551 std::cout <<
"Running nu worker instance for slice " << (sliceCounter + 1) <<
" of " << selectedSliceVector.size() << std::endl;
553 const PfoList *pSliceNuPfos(
nullptr);
556 nuSliceHypotheses.push_back(*pSliceNuPfos);
560 PandoraContentApi::ParticleFlowObject::Metadata metadata;
561 metadata.m_propertiesToAdd[
"SliceIndex"] = sliceCounter;
569 std::cout <<
"Running cr worker instance for slice " << (sliceCounter + 1) <<
" of " << selectedSliceVector.size() << std::endl;
571 const PfoList *pSliceCRPfos(
nullptr);
574 crSliceHypotheses.push_back(*pSliceCRPfos);
578 PandoraContentApi::ParticleFlowObject::Metadata metadata;
579 metadata.m_propertiesToAdd[
"SliceIndex"] = sliceCounter;
590 sliceVector = std::move(selectedSliceVector);
595 return STATUS_CODE_SUCCESS;
603 std::cout <<
"Select best slice hypotheses" << std::endl;
610 pSliceIdTool->SelectOutputPfos(
this, nuSliceHypotheses, crSliceHypotheses, selectedSlicePfos);
616 for (
const PfoList &slice : sliceHypotheses)
617 selectedSlicePfos.insert(selectedSlicePfos.end(), slice.begin(), slice.end());
623 return STATUS_CODE_SUCCESS;
642 return STATUS_CODE_SUCCESS;
650 if (pLArCaloHit ==
nullptr)
652 std::cout <<
"MasterAlgorithm: Could not cast CaloHit to LArCaloHit" << std::endl;
653 return STATUS_CODE_INVALID_PARAMETER;
656 pLArCaloHit->FillParameters(parameters);
662 for (
const auto &weightMapEntry : pLArCaloHit->GetMCParticleWeightMap())
663 mcParticleVector.push_back(weightMapEntry.first);
666 for (
const MCParticle *
const pMCParticle : mcParticleVector)
673 return STATUS_CODE_SUCCESS;
684 std::cout <<
"MasterAlgorithm::Copy - Expect to pass only LArMCParticles to Pandora worker instances." << std::endl;
685 return STATUS_CODE_INVALID_PARAMETER;
690 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraApi::MCParticle::Create(*pPandora, parameters, *pMCParticleFactory));
698 return STATUS_CODE_SUCCESS;
705 if (inputPfoList.empty())
706 return STATUS_CODE_SUCCESS;
710 std::string clusterListName;
714 std::string vertexListName;
718 std::string pfoListName;
719 const PfoList *pPfoList(
nullptr);
722 for (
const Pfo *
const pPfo : inputPfoList)
724 if (pPfo->GetParentPfoList().empty())
725 this->
Recreate(pPfo,
nullptr, newPfoList);
728 if (!pClusterList->empty())
734 if (!pVertexList->empty())
740 if (!pPfoList->empty())
746 return STATUS_CODE_SUCCESS;
753 ClusterList inputClusterList2D, inputClusterList3D, newClusterList;
757 for (
const Cluster *
const pInputCluster : inputClusterList2D)
759 CaloHitList inputCaloHitList, newCaloHitList, newIsolatedCaloHitList;
760 pInputCluster->GetOrderedCaloHitList().FillCaloHitList(inputCaloHitList);
762 for (
const CaloHit *
const pInputCaloHit : inputCaloHitList)
763 newCaloHitList.push_back(
static_cast<const CaloHit *
>(pInputCaloHit->GetParentAddress()));
765 for (
const CaloHit *
const pInputCaloHit : pInputCluster->GetIsolatedCaloHitList())
766 newIsolatedCaloHitList.push_back(
static_cast<const CaloHit *
>(pInputCaloHit->GetParentAddress()));
768 if (!newCaloHitList.empty())
769 newClusterList.push_back(this->CreateCluster(pInputCluster, newCaloHitList, newIsolatedCaloHitList));
772 for (
const Cluster *
const pInputCluster : inputClusterList3D)
774 CaloHitList inputCaloHitList, newCaloHitList, newIsolatedCaloHitList;
775 pInputCluster->GetOrderedCaloHitList().FillCaloHitList(inputCaloHitList);
777 for (
const CaloHit *
const pInputCaloHit : inputCaloHitList)
779 const CaloHit *
const pWorkerParentCaloHit(
static_cast<const CaloHit *
>(pInputCaloHit->GetParentAddress()));
781 newCaloHitList.push_back(this->
CreateCaloHit(pInputCaloHit, pMasterParentCaloHit));
784 for (
const CaloHit *
const pInputCaloHit : pInputCluster->GetIsolatedCaloHitList())
786 const CaloHit *
const pWorkerParentCaloHit(
static_cast<const CaloHit *
>(pInputCaloHit->GetParentAddress()));
788 newIsolatedCaloHitList.push_back(this->
CreateCaloHit(pInputCaloHit, pMasterParentCaloHit));
791 if (!newCaloHitList.empty())
792 newClusterList.push_back(this->
CreateCluster(pInputCluster, newCaloHitList, newIsolatedCaloHitList));
798 newVertexList.push_back(this->CreateVertex(pInputVertex));
801 newPfoList.push_back(pNewPfo);
807 this->
Recreate(pInputDaughterPfo, pNewPfo, newPfoList);
809 return STATUS_CODE_SUCCESS;
816 PandoraContentApi::CaloHit::Parameters parameters;
826 parameters.m_time = pInputCaloHit->
GetTime();
831 parameters.m_isDigital = pInputCaloHit->
IsDigital();
832 parameters.m_hitType = pInputCaloHit->
GetHitType();
834 parameters.m_layer = pInputCaloHit->
GetLayer();
836 parameters.m_pParentAddress =
static_cast<const void *
>(pParentCaloHit);
838 const CaloHit *pNewCaloHit(
nullptr);
839 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CaloHit::Create(*
this, parameters, pNewCaloHit));
841 PandoraContentApi::CaloHit::Metadata metadata;
842 metadata.m_isIsolated = pInputCaloHit->
IsIsolated();
854 PandoraContentApi::Cluster::Parameters parameters;
855 parameters.m_caloHitList = newCaloHitList;
858 const Cluster *pNewCluster(
nullptr);
859 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*
this, parameters, pNewCluster));
861 PandoraContentApi::Cluster::Metadata metadata;
872 PandoraContentApi::Vertex::Parameters parameters;
877 const Vertex *pNewVertex(
nullptr);
878 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Vertex::Create(*
this, parameters, pNewVertex));
888 PandoraContentApi::ParticleFlowObject::Parameters parameters;
890 parameters.m_charge = pInputPfo->
GetCharge();
891 parameters.m_mass = pInputPfo->
GetMass();
892 parameters.m_energy = pInputPfo->
GetEnergy();
894 parameters.m_clusterList = newClusterList;
895 parameters.m_trackList.clear();
896 parameters.m_vertexList = newVertexList;
900 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*
this, parameters, pNewPfo));
908 const LArTPC &larTPC,
const DetectorGapList &gapList,
const std::string &settingsFile,
const std::string &name)
const
923 larTPCParameters.m_centerX = larTPC.
GetCenterX();
924 larTPCParameters.m_centerY = larTPC.
GetCenterY();
925 larTPCParameters.m_centerZ = larTPC.
GetCenterZ();
926 larTPCParameters.m_widthX = larTPC.
GetWidthX();
927 larTPCParameters.m_widthY = larTPC.
GetWidthY();
928 larTPCParameters.m_widthZ = larTPC.
GetWidthZ();
935 larTPCParameters.m_sigmaUVW = larTPC.
GetSigmaUVW();
944 const LineGap *
const pLineGap(
dynamic_cast<const LineGap *
>(pGap));
951 lineGapParameters.m_lineGapType = lineGapType;
953 lineGapParameters.m_lineEndX = pLineGap->
GetLineEndX();
958 lineGapParameters.m_lineStartX = -std::numeric_limits<float>::max();
959 lineGapParameters.m_lineEndX = std::numeric_limits<float>::max();
963 lineGapParameters.m_lineEndZ = pLineGap->
GetLineEndZ();
976 const LArTPCMap &larTPCMap,
const DetectorGapList &gapList,
const std::string &settingsFile,
const std::string &name)
const
978 if (larTPCMap.empty())
980 std::cout <<
"MasterAlgorithm::CreateWorkerInstance - no LArTPC details provided" << std::endl;
995 const LArTPC *
const pFirstLArTPC(larTPCMap.begin()->second);
1003 for (
const LArTPCMap::value_type &mapEntry : larTPCMap)
1005 const LArTPC *
const pLArTPC(mapEntry.second);
1015 larTPCParameters.m_larTPCVolumeId = 0;
1016 larTPCParameters.m_centerX = 0.5f * (parentMaxX + parentMinX);
1017 larTPCParameters.m_centerY = 0.5f * (parentMaxY + parentMinY);
1018 larTPCParameters.m_centerZ = 0.5f * (parentMaxZ + parentMinZ);
1019 larTPCParameters.m_widthX = parentMaxX - parentMinX;
1020 larTPCParameters.m_widthY = parentMaxY - parentMinY;
1021 larTPCParameters.m_widthZ = parentMaxZ - parentMinZ;
1024 larTPCParameters.m_wirePitchW = pFirstLArTPC->
GetWirePitchW();
1025 larTPCParameters.m_wireAngleU = pFirstLArTPC->
GetWireAngleU();
1026 larTPCParameters.m_wireAngleV = pFirstLArTPC->
GetWireAngleV();
1027 larTPCParameters.m_wireAngleW = pFirstLArTPC->
GetWireAngleW();
1028 larTPCParameters.m_sigmaUVW = pFirstLArTPC->
GetSigmaUVW();
1035 const LineGap *
const pLineGap(
dynamic_cast<const LineGap *
>(pGap));
1042 lineGapParameters.m_lineEndX = pLineGap->
GetLineEndX();
1044 lineGapParameters.m_lineEndZ = pLineGap->
GetLineEndZ();
1058 return STATUS_CODE_SUCCESS;
1070 if (!pExternalParameters)
1071 return STATUS_CODE_FAILURE;
1079 for (
AlgorithmTool *
const pAlgorithmTool : algorithmToolVector)
1082 if (!pSliceSelectionTool)
1083 return STATUS_CODE_INVALID_PARAMETER;
1098 std::cout <<
"MasterAlgorithm::ReadSettings - ShouldRunStitching requires ShouldRunAllHitsCosmicReco to be true" << std::endl;
1099 return STATUS_CODE_INVALID_PARAMETER;
1107 for (
AlgorithmTool *
const pAlgorithmTool : algorithmToolVector)
1110 if (!pStitchingTool)
1111 return STATUS_CODE_INVALID_PARAMETER;
1122 std::cout <<
"MasterAlgorithm::ReadSettings - ShouldRunCosmicHitRemoval requires ShouldRunAllHitsCosmicReco to be true" << std::endl;
1123 return STATUS_CODE_INVALID_PARAMETER;
1132 for (
AlgorithmTool *
const pAlgorithmTool : algorithmToolVector)
1135 if (!pCosmicRayTaggingTool)
1136 return STATUS_CODE_INVALID_PARAMETER;
1159 std::cout <<
"MasterAlgorithm::ReadSettings - ShouldPerformSliceId requires ShouldRunSlicing and both neutrino and cosmic reconstruction options"
1161 return STATUS_CODE_INVALID_PARAMETER;
1169 for (
AlgorithmTool *
const pAlgorithmTool : algorithmToolVector)
1172 if (!pSliceIdIdTool)
1173 return STATUS_CODE_INVALID_PARAMETER;
1218 return STATUS_CODE_SUCCESS;
1224 const TiXmlHandle xmlHandle,
const std::string &xmlTag,
bool &outputBool)
1228 outputBool = inputBool.
Get();
1235 return STATUS_CODE_SUCCESS;
Header file for the lar calo hit class.
Header file for the cluster helper class.
Header file detailing content for use with particle flow reconstruction at liquid argon time projecti...
Header file for the file helper class.
Header file for the lar mc particle class.
Header file for the lar monte carlo particle helper helper class.
Header file for the pfo helper class.
Header file for the lar pseudo layer plugin class.
Header file for the helper class for multiple drift volumes.
Header file for the master algorithm class.
std::vector< const pandora::Pandora * > PandoraInstanceList
Header file for the pandora api class.
Header file for the pfo mop up algorithm base class.
#define PANDORA_THROW_RESULT_IF(StatusCode1, Operator, Command)
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
static pandora::StatusCode RegisterAlgorithms(const pandora::Pandora &pandora)
Register all the lar content algorithms and tools with pandora.
static pandora::StatusCode RegisterBasicPlugins(const pandora::Pandora &pandora)
Register the basic lar content plugins with pandora.
static void AddDaughterPandoraInstance(const pandora::Pandora *const pPrimaryPandora, const pandora::Pandora *const pDaughterPandora)
Add a pandora daughter instance, associated to a primary pandora instance.
static pandora::StatusCode ReadSettings(const pandora::Pandora &pandora, const std::string &xmlFileName)
Read pandora settings.
static pandora::StatusCode ProcessEvent(const pandora::Pandora &pandora)
Process an event.
static pandora::StatusCode Reset(const pandora::Pandora &pandora)
Reset pandora to process another event.
static pandora::StatusCode SetMCParentDaughterRelationship(const pandora::Pandora &pandora, const void *const pParentAddress, const void *const pDaughterAddress)
Set parent-daughter mc particle relationship.
static pandora::StatusCode SetLArTransformationPlugin(const pandora::Pandora &pandora, pandora::LArTransformationPlugin *const pLArTransformationPlugin)
Set the lar transformation plugin used by pandora.
static pandora::StatusCode SetCaloHitToMCParticleRelationship(const pandora::Pandora &pandora, const void *const pCaloHitParentAddress, const void *const pMCParticleParentAddress, const float mcParticleWeight=1)
Set calo hit to mc particle relationship.
static pandora::StatusCode SetPseudoLayerPlugin(const pandora::Pandora &pandora, pandora::PseudoLayerPlugin *const pPseudoLayerPlugin)
Set the pseudo layer plugin used by pandora.
static pandora::StatusCode GetCurrentPfoList(const pandora::Pandora &pandora, const pandora::PfoList *&pPfoList)
Get the current pfo list.
static bool IsAvailable(const pandora::Algorithm &algorithm, const T *const pT)
Is object, or a list of objects, available as a building block.
static pandora::StatusCode ReplaceCurrentList(const pandora::Algorithm &algorithm, const std::string &newListName)
Replace the current list with a pre-saved list; use this new list as a permanent replacement for the ...
static pandora::StatusCode AddToPfo(const pandora::Algorithm &algorithm, const pandora::ParticleFlowObject *const pPfo, const T *const pT)
Add a cluster to a particle flow object.
static pandora::StatusCode CreateTemporaryListAndSetCurrent(const pandora::Algorithm &algorithm, const T *&pT, std::string &temporaryListName)
Create a temporary list and set it to be the current list, enabling object creation.
static pandora::StatusCode MergeAndDeleteClusters(const pandora::Algorithm &algorithm, const pandora::Cluster *const pClusterToEnlarge, const pandora::Cluster *const pClusterToDelete)
Merge two clusters in the current list, enlarging one cluster and deleting the second.
static pandora::StatusCode SetPfoParentDaughterRelationship(const pandora::Algorithm &algorithm, const pandora::ParticleFlowObject *const pParentPfo, const pandora::ParticleFlowObject *const pDaughterPfo)
Set parent-daughter particle flow object relationship.
static pandora::StatusCode Delete(const pandora::Algorithm &algorithm, const T *const pT)
Delete an object from the current list.
static pandora::StatusCode GetList(const pandora::Algorithm &algorithm, const std::string &listName, const T *&pT)
Get a named list.
CosmicRayTaggingBaseTool class.
unsigned int GetLArTPCVolumeId() const
Get the lar tpc volume id.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
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...
LArMCParticleFactory responsible for object creation.
static bool SortByMomentum(const pandora::MCParticle *const pLhs, const pandora::MCParticle *const pRhs)
Sort mc particles by their momentum.
void FillParameters(LArMCParticleParameters ¶meters) const
Fill the parameters associated with this MC particle.
LAr mc particle parameters.
static void GetAllConnectedPfos(const pandora::PfoList &inputPfoList, pandora::PfoList &outputPfoList)
Get a flat list of all pfos, recursively including all daughters and parents associated with those pf...
static void GetThreeDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 3D clusters from an input pfo.
static void GetAllDownstreamPfos(const pandora::PfoList &inputPfoList, pandora::PfoList &outputPfoList)
Get a flat list of all pfos, recursively, of all daughters associated with those pfos in an input lis...
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
static void GetIsolatedCaloHits(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::CaloHitList &caloHitList)
Get a list of isolated calo hits of a particular hit type from a list of pfos.
static void GetCaloHits(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::CaloHitList &caloHitList)
Get a list of calo hits of a particular hit type from a list of pfos.
LarPandoraPseudoLayerPlugin class.
LArRotationalTransformationPlugin class.
static bool HasPfoBeenStitched(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo has been stitched.
External steering parameters class.
pandora::InputBool m_printOverallRecoStatus
Whether to print current operation status messages.
pandora::InputBool m_shouldRunStitching
Whether to stitch cosmic-ray muons crossing between volumes.
pandora::InputBool m_shouldPerformSliceId
Whether to identify slices and select most appropriate pfos.
pandora::InputBool m_shouldRunCosmicRecoOption
Whether to run cosmic-ray reconstruction for each slice.
pandora::InputBool m_shouldRunNeutrinoRecoOption
Whether to run neutrino reconstruction for each slice.
pandora::InputBool m_shouldRunCosmicHitRemoval
Whether to remove hits from tagged cosmic-rays.
pandora::InputBool m_shouldRunSlicing
Whether to slice events into separate regions for processing.
pandora::InputBool m_shouldRunAllHitsCosmicReco
Whether to run all hits cosmic-ray reconstruction.
const pandora::Pandora * m_pSliceNuWorkerInstance
The per-slice neutrino reconstruction worker instance.
bool m_printOverallRecoStatus
Whether to print current operation status messages.
std::string m_nuSettingsFile
The neutrino reconstruction settings file.
bool m_workerInstancesInitialized
Whether all worker instances have been initialized.
const pandora::Pandora * CreateWorkerInstance(const pandora::LArTPC &larTPC, const pandora::DetectorGapList &gapList, const std::string &settingsFile, const std::string &name) const
Create a pandora worker instance to handle a single LArTPC.
bool m_shouldRunAllHitsCosmicReco
Whether to run all hits cosmic-ray reconstruction.
pandora::StatusCode RunCosmicRayHitRemoval(const pandora::PfoList &ambiguousPfos) const
Run cosmic-ray hit removal, freeing hits in ambiguous pfos for further processing.
bool m_fullWidthCRWorkerWireGaps
Whether wire-type line gaps in cosmic-ray worker instances should cover all drift time.
const pandora::Pandora * m_pSlicingWorkerInstance
The slicing worker instance.
std::string m_crSettingsFile
The cosmic-ray reconstruction settings file.
void StitchPfos(const pandora::ParticleFlowObject *const pPfoToEnlarge, const pandora::ParticleFlowObject *const pPfoToDelete, PfoToLArTPCMap &pfoToLArTPCMap) const
Stitch together a pair of pfos.
std::string m_recreatedVertexListName
The output recreated vertex list name.
bool m_shouldRunCosmicHitRemoval
Whether to remove hits from tagged cosmic-rays.
bool m_shouldPerformSliceId
Whether to identify slices and select most appropriate pfos.
pandora::StatusCode Recreate(const pandora::PfoList &inputPfoList, pandora::PfoList &newPfoList) const
Recreate a specified list of pfos in the current pandora instance.
pandora::StatusCode StitchCosmicRayPfos(PfoToLArTPCMap &pfoToLArTPCMap, PfoToFloatMap &stitchedPfosToX0Map) const
Stitch together cosmic-ray pfos crossing between adjacent lar tpcs.
const pandora::Pandora * m_pSliceCRWorkerInstance
The per-slice cosmic-ray reconstruction worker instance.
pandora::StatusCode RecreateCosmicRayPfos(PfoToLArTPCMap &pfoToLArTPCMap) const
Recreate cosmic-ray pfos (created by worker instances) in the master instance.
std::string m_inputMCParticleListName
The input mc particle list name.
pandora::StatusCode SelectBestSliceHypotheses(const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses) const
Examine slice hypotheses to identify the most appropriate to provide in final event output.
pandora::StatusCode ReadExternalSettings(const ExternalSteeringParameters *const pExternalParameters, const pandora::InputBool inputBool, const pandora::TiXmlHandle xmlHandle, const std::string &xmlTag, bool &outputBool)
Read settings from external steering parameters block, if present, otherwise from xml as standard.
const pandora::ParticleFlowObject * CreatePfo(const pandora::ParticleFlowObject *const pInputPfo, const pandora::ClusterList &newClusterList, const pandora::VertexList &newVertexList) const
Create a new pfo in the current pandora instance, based upon the provided input pfo.
bool m_passMCParticlesToWorkerInstances
Whether to pass mc particle details (and links to calo hits) to worker instances.
pandora::StatusCode Reset()
Reset all worker instances.
const pandora::Vertex * CreateVertex(const pandora::Vertex *const pInputVertex) const
Create a new vertex in the current pandora instance, based upon the provided input vertex.
bool m_shouldRunNeutrinoRecoOption
Whether to run neutrino reconstruction for each slice.
bool m_shouldRunCosmicRecoOption
Whether to run cosmic-ray reconstruction for each slice.
LArCaloHitFactory m_larCaloHitFactory
Factory for creating LArCaloHits during hit copying.
unsigned int m_larCaloHitVersion
The LArCaloHit version for LArCaloHitFactory.
virtual pandora::StatusCode RegisterCustomContent(const pandora::Pandora *const pPandora) const
Register custom content, such as algorithms or algorithm tools, with a specified pandora instance.
pandora::StatusCode Copy(const pandora::Pandora *const pPandora, const pandora::CaloHit *const pCaloHit) const
Copy a specified calo hit to the provided pandora instance.
std::string m_recreatedPfoListName
The output recreated pfo list name.
void ShiftPfoHierarchy(const pandora::ParticleFlowObject *const pParentPfo, const PfoToLArTPCMap &pfoToLArTPCMap, const float x0) const
Shift a Pfo hierarchy by a specified x0 value.
pandora::StatusCode CopyMCParticles() const
Copy mc particles in the named input list to all pandora worker instances.
std::string m_inputHitListName
The input hit list name.
bool m_shouldRemoveOutOfTimeHits
Whether to remove out of time hits.
pandora::StatusCode RunSlicing(const VolumeIdToHitListMap &volumeIdToHitListMap, SliceVector &sliceVector) const
Run the event slicing procedures, dividing available hits up into distinct 3D regions.
std::unordered_map< const pandora::ParticleFlowObject *, const pandora::LArTPC * > PfoToLArTPCMap
pandora::StatusCode Run()
Run the algorithm.
std::string m_filePathEnvironmentVariable
The environment variable providing a list of paths to xml files.
std::string m_slicingSettingsFile
The slicing settings file.
SliceSelectionToolVector m_sliceSelectionToolVector
The slice selection tool vector.
pandora::StatusCode RunSliceReconstruction(SliceVector &sliceVector, SliceHypotheses &nuSliceHypotheses, SliceHypotheses &crSliceHypotheses) const
Process each slice under different reconstruction hypotheses.
bool m_shouldRunSlicing
Whether to slice events into separate regions for processing.
bool m_visualizeOverallRecoStatus
Whether to display results of current operations.
pandora::StatusCode RunCosmicRayReconstruction(const VolumeIdToHitListMap &volumeIdToHitListMap) const
Run the cosmic-ray reconstruction worker instances.
PandoraInstanceList m_crWorkerInstances
The list of cosmic-ray reconstruction worker instances.
pandora::CaloHitList m_allHitList
The list of all hits originating from a given LArTPC.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
std::string m_recreatedClusterListName
The output recreated cluster list name.
CosmicRayTaggingToolVector m_cosmicRayTaggingToolVector
The cosmic-ray tagging tool vector.
const pandora::Cluster * CreateCluster(const pandora::Cluster *const pInputCluster, const pandora::CaloHitList &newCaloHitList, const pandora::CaloHitList &newIsolatedCaloHitList) const
Create a new cluster in the current pandora instance, based upon the provided input cluster.
std::map< unsigned int, LArTPCHitList > VolumeIdToHitListMap
pandora::StatusCode InitializeWorkerInstances()
Initialize pandora worker instances.
pandora::CaloHitList m_truncatedHitList
The list of hits confined within LArTPC boundaries for given beam t0 value.
float m_inTimeMaxX0
Cut on X0 to determine whether particle is clear cosmic ray.
SliceIdToolVector m_sliceIdToolVector
The slice id tool vector.
StitchingToolVector m_stitchingToolVector
The stitching tool vector.
bool m_shouldRunStitching
Whether to stitch cosmic-ray muons crossing between volumes.
pandora::StatusCode GetVolumeIdToHitListMap(VolumeIdToHitListMap &volumeIdToHitListMap) const
Get the mapping from lar tpc volume id to lists of all hits, and truncated hits.
pandora::StatusCode TagCosmicRayPfos(const PfoToFloatMap &stitchedPfosToX0Map, pandora::PfoList &clearCosmicRayPfos, pandora::PfoList &ambiguousPfos) const
Tag clear, unambiguous cosmic-ray pfos.
const pandora::CaloHit * CreateCaloHit(const pandora::CaloHit *const pInputCaloHit, const pandora::CaloHit *const pParentCaloHit) const
Create a new calo hit in the current pandora instance, based upon the provided input calo hit.
MasterAlgorithm()
Default constructor.
static const pandora::Cluster * GetParentCluster(const pandora::ClusterList &clusterList, const pandora::HitType hitType)
Select the parent cluster (same hit type and most hits) using a provided cluster list and hit type.
SliceSelectionBaseTool class.
static pandora::StatusCode Create(const pandora::Pandora &pandora, const Parameters ¶meters, const pandora::ObjectFactory< Parameters, Object > &factory=pandora::PandoraObjectFactory< Parameters, Object >())
Create a new object from a user factory.
float GetElectromagneticEnergy() const
Get the calibrated electromagnetic energy measure.
HitType GetHitType() const
Get the calorimeter hit type.
CellGeometry GetCellGeometry() const
Get the cell geometry.
bool IsInOuterSamplingLayer() const
Whether cell is in one of the outermost detector sampling layers.
HitRegion GetHitRegion() const
Get the region of the detector in which the calo hit is located.
const CartesianVector & GetPositionVector() const
Get the position vector of center of calorimeter cell, units mm.
bool IsIsolated() const
Whether the calo hit is flagged as isolated.
CartesianVector m_positionVector
Position vector of center of calorimeter cell, units mm.
unsigned int GetLayer() const
Get the subdetector readout layer number.
float GetMipEquivalentEnergy() const
Get the calibrated mip equivalent energy.
float GetNCellRadiationLengths() const
Get the absorber material in front of cell, units radiation lengths.
float GetNCellInteractionLengths() const
Get the absorber material in front of cell, units interaction lengths.
bool IsPossibleMip() const
Whether the calo hit is flagged as a possible mip hit.
float GetCellThickness() const
Get the thickness of cell, units mm.
float GetCellSize1() const
Get the cell size 1 [pointing: phi, rectangular: perpendicular to size 0 and thickness,...
StatusCode AlterMetadata(const object_creation::CaloHit::Metadata &metadata)
Alter the metadata information stored in a calo hit.
bool IsDigital() const
Whether cell should be treated as digital.
float GetCellSize0() const
Get the cell size 0 [pointing: eta, rectangular: up in ENDCAP, along beam in BARREL,...
const CartesianVector & GetCellNormalVector() const
Get the unit vector normal to the sampling layer, pointing outwards from the origin.
float GetHadronicEnergy() const
Get the calibrated hadronic energy measure.
float GetInputEnergy() const
Get the corrected energy of the calorimeter cell, units GeV, as supplied by the user.
float GetTime() const
Get the time of (earliest) energy deposition in this cell, units ns.
const void * GetParentAddress() const
Get the address of the parent calo hit in the user framework.
const CartesianVector & GetExpectedDirection() const
Get the unit vector in direction of expected hit propagation.
CaloHitList m_isolatedCaloHitList
The list of isolated hits, which contribute only towards cluster energy.
StatusCode AlterMetadata(const object_creation::Cluster::Metadata &metadata)
Alter the metadata information stored in a cluster.
int GetParticleId() const
Get the particle id flag.
float GetWireAngleV() const
Get the v wire angle to the vertical, units radians.
float GetWirePitchU() const
Get the u wire pitch, units mm.
float GetCenterY() const
Get center in y, units mm.
float GetWidthZ() const
Get the width in z, units mm.
float GetWireAngleW() const
Get the w wire angle to the vertical, units radians.
float GetCenterZ() const
Get center in z, units mm.
bool IsDriftInPositiveX() const
Whether the electron drift is in the positive x direction.
float GetCenterX() const
Get center in x, units mm.
float GetWirePitchV() const
Get the v wire pitch, units mm.
float GetWidthX() const
Get the width in x, units mm.
float GetWidthY() const
Get the width in y, units mm.
float GetWireAngleU() const
Get the u wire angle to the vertical, units radians.
float GetWirePitchW() const
Get the w wire pitch, units mm.
unsigned int GetLArTPCVolumeId() const
Get the lar volume id, uniquely specifying the lar tpc.
float GetSigmaUVW() const
Get the u, v, w resolution, units mm.
LineGap class, associated only with 2D TPC hit types and applied only to the z coordinate when sampli...
float GetLineEndZ() const
Get the line end z coordinate.
LineGapType GetLineGapType() const
Get the line gap type.
float GetLineStartX() const
Get the line start x coordinate.
float GetLineStartZ() const
Get the line start z coordinate.
float GetLineEndX() const
Get the line end x coordinate.
const MCParticleList & GetDaughterList() const
Get list of daughters of mc particle.
const MCParticleList & GetParentList() const
Get list of parents of mc particle.
ParticleFlowObject class.
float GetEnergy() const
Get the particle flow object energy.
const PropertiesMap & GetPropertiesMap() const
Get the map from registered property name to floating point property value.
const PfoList & GetDaughterPfoList() const
Get the daughter pfo list.
const ClusterList & GetClusterList() const
Get the cluster list.
const PfoList & GetParentPfoList() const
Get the parent pfo list.
const VertexList & GetVertexList() const
Get the vertex list.
StatusCode AlterMetadata(const object_creation::ParticleFlowObject::Metadata &metadata)
Alter particle flow object metadata parameters.
float GetMass() const
Get particle flow object mass.
int GetCharge() const
Get particle flow object charge.
int GetParticleId() const
Get the particle flow object id (PDG code)
int m_particleId
The particle flow object id (PDG code)
const CartesianVector & GetMomentum() const
Get particle flow object momentum vector.
const Pandora & GetPandora() const
Get the associated pandora instance.
StatusCodeException class.
std::string ToString() const
Get status code as a string.
StatusCode GetStatusCode() const
Get status code.
VertexType GetVertexType() const
Get the vertex type.
StatusCode AlterMetadata(const object_creation::Vertex::Metadata &metadata)
Alter the metadata information stored in a vertex.
CartesianVector m_position
The vertex position.
const CartesianVector & GetPosition() const
Get the vertex position.
VertexLabel GetVertexLabel() const
Get the vertex label.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
static StatusCode ProcessAlgorithmToolList(const Algorithm &algorithm, const TiXmlHandle &xmlHandle, const std::string &listName, AlgorithmToolVector &algorithmToolVector)
Process a list of algorithms tools in an xml file.
std::unordered_map< const pandora::ParticleFlowObject *, float > PfoToFloatMap
std::vector< pandora::CaloHitList > SliceVector
std::vector< pandora::PfoList > SliceHypotheses
HitType
Calorimeter hit type enum.
MANAGED_CONTAINER< const MCParticle * > MCParticleList
std::vector< const Cluster * > ClusterVector
PandoraInputType< bool > InputBool
MANAGED_CONTAINER< const Cluster * > ClusterList
std::vector< AlgorithmTool * > AlgorithmToolVector
std::map< unsigned int, const LArTPC * > LArTPCMap
MANAGED_CONTAINER< const DetectorGap * > DetectorGapList
MANAGED_CONTAINER< const CaloHit * > CaloHitList
std::vector< const MCParticle * > MCParticleVector
MANAGED_CONTAINER< const Vertex * > VertexList
StatusCode
The StatusCode enum.
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList
std::vector< const Vertex * > VertexVector
LineGapType
Line gap type.