CheatingClusterCreationAlgorithm class.
More...
#include <CheatingClusterCreationAlgorithm.h>
lar_content::CheatingClusterCreationAlgorithm::CheatingClusterCreationAlgorithm |
( |
| ) |
|
Default constructor.
Definition at line 18 of file CheatingClusterCreationAlgorithm.cc.
bool m_collapseToPrimaryMCParticles
Whether to collapse mc particle hierarchies to primary particles.
void lar_content::CheatingClusterCreationAlgorithm::CreateClusters |
( |
const MCParticleToHitListMap & |
mcParticleToHitListMap | ) |
const |
|
private |
Create clusters based on information in the mc particle to hit list map.
- Parameters
-
mcParticleToHitListMap | the mc particle to hit list map |
Definition at line 106 of file CheatingClusterCreationAlgorithm.cc.
109 for (
const auto &mapEntry : mcParticleToHitListMap)
110 mcParticleVector.push_back(mapEntry.first);
113 for (
const MCParticle *
const pMCParticle : mcParticleVector)
115 const CaloHitList &caloHitList(mcParticleToHitListMap.at(pMCParticle));
117 if (caloHitList.empty())
120 const Cluster *pCluster(
nullptr);
122 parameters.m_caloHitList = caloHitList;
123 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*
this, parameters, pCluster));
125 PandoraContentApi::Cluster::Metadata metadata;
127 switch (pMCParticle->GetParticleId())
134 metadata.m_particleId = pMCParticle->GetParticleId();
140 if (metadata.m_particleId.IsInitialized())
141 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::AlterMetadata(*
this, pCluster, metadata));
static bool SortByMomentum(const pandora::MCParticle *const pLhs, const pandora::MCParticle *const pRhs)
Sort mc particles by their momentum.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
fhicl::Table< sbnd::crt::CRTDetSimParams > Parameters
void lar_content::CheatingClusterCreationAlgorithm::GetMCParticleToHitListMap |
( |
MCParticleToHitListMap & |
mcParticleToHitListMap | ) |
const |
|
private |
Create map between each (primary) MC particle and associated calo hits.
- Parameters
-
mcParticleToHitListMap | to receive the mc particle to hit list map |
Definition at line 35 of file CheatingClusterCreationAlgorithm.cc.
41 const MCParticleList *pMCParticleList(
nullptr);
42 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_mcParticleListName, pMCParticleList));
47 const CaloHitList *pCaloHitList(
nullptr);
48 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*
this, pCaloHitList));
50 for (
const CaloHit *
const pCaloHit : *pCaloHitList)
54 if (!PandoraContentApi::IsAvailable(*
this, pCaloHit))
59 catch (
const StatusCodeException &)
std::string m_mcParticleListName
The mc particle list name, required if want to collapse mc particle hierarchy.
void SimpleMCParticleCollection(const pandora::CaloHit *const pCaloHit, const LArMCParticleHelper::MCRelationMap &mcPrimaryMap, MCParticleToHitListMap &mcParticleToHitListMap) const
Simple mc particle collection, using main mc particle associated with each calo hit.
static void GetMCPrimaryMap(const pandora::MCParticleList *const pMCParticleList, MCRelationMap &mcPrimaryMap)
Get mapping from individual mc particles (in a provided list) and their primary parent mc particles...
bool m_collapseToPrimaryMCParticles
Whether to collapse mc particle hierarchies to primary particles.
std::unordered_map< const pandora::MCParticle *, const pandora::MCParticle * > MCRelationMap
StatusCode lar_content::CheatingClusterCreationAlgorithm::ReadSettings |
( |
const pandora::TiXmlHandle |
xmlHandle | ) |
|
|
private |
Definition at line 147 of file CheatingClusterCreationAlgorithm.cc.
149 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
154 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"MCParticleListName",
m_mcParticleListName));
157 PANDORA_RETURN_RESULT_IF_AND_IF(
158 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"ParticleIdList",
m_particleIdList));
160 return STATUS_CODE_SUCCESS;
pandora::IntVector m_particleIdList
list of particle ids of MCPFOs to be selected
std::string m_mcParticleListName
The mc particle list name, required if want to collapse mc particle hierarchy.
bool m_collapseToPrimaryMCParticles
Whether to collapse mc particle hierarchies to primary particles.
StatusCode lar_content::CheatingClusterCreationAlgorithm::Run |
( |
| ) |
|
|
private |
Definition at line 24 of file CheatingClusterCreationAlgorithm.cc.
30 return STATUS_CODE_SUCCESS;
void GetMCParticleToHitListMap(MCParticleToHitListMap &mcParticleToHitListMap) const
Create map between each (primary) MC particle and associated calo hits.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCParticleToHitListMap
void CreateClusters(const MCParticleToHitListMap &mcParticleToHitListMap) const
Create clusters based on information in the mc particle to hit list map.
bool lar_content::CheatingClusterCreationAlgorithm::SelectMCParticlesForClustering |
( |
const pandora::MCParticle *const |
pMCParticle | ) |
const |
|
private |
Check whether mc particle is of a type specified for inclusion in cheated clustering.
- Parameters
-
pMCParticle | the mc particle to hit list map |
- Returns
- boolean
Definition at line 90 of file CheatingClusterCreationAlgorithm.cc.
97 if (pMCParticle->GetParticleId() == particleId)
pandora::IntVector m_particleIdList
list of particle ids of MCPFOs to be selected
Simple mc particle collection, using main mc particle associated with each calo hit.
- Parameters
-
pCaloHit | address of the calo hit |
mcPrimaryMap | the mapping between mc particles and their parents |
mcParticleToHitListMap | the mc particle to hit list map |
Definition at line 67 of file CheatingClusterCreationAlgorithm.cc.
70 const MCParticle *pMCParticle(MCParticleHelper::GetMainMCParticle(pCaloHit));
77 LArMCParticleHelper::MCRelationMap::const_iterator primaryIter = mcPrimaryMap.find(pMCParticle);
79 if (mcPrimaryMap.end() == primaryIter)
80 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
82 pMCParticle = primaryIter->second;
85 mcParticleToHitListMap[pMCParticle].push_back(pCaloHit);
bool SelectMCParticlesForClustering(const pandora::MCParticle *const pMCParticle) const
Check whether mc particle is of a type specified for inclusion in cheated clustering.
bool m_collapseToPrimaryMCParticles
Whether to collapse mc particle hierarchies to primary particles.
bool lar_content::CheatingClusterCreationAlgorithm::m_collapseToPrimaryMCParticles |
|
private |
std::string lar_content::CheatingClusterCreationAlgorithm::m_mcParticleListName |
|
private |
The documentation for this class was generated from the following files: