Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
CheatingCosmicRayRemovalAlgorithm.cc
Go to the documentation of this file.
1
11
13
15
16using namespace pandora;
17
18namespace lar_content
19{
20
22{
23 const MCParticleList *pMCParticleList(nullptr);
24 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_mcParticleListName, pMCParticleList));
25
26 const CaloHitList *pCaloHitList(nullptr);
27 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_inputCaloHitListName, pCaloHitList));
28
29 CaloHitList outputCaloHitList;
30
31 for (const CaloHit *pCaloHit : *pCaloHitList)
32 {
33 try
34 {
35 const MCParticle *const pMCParticle(MCParticleHelper::GetMainMCParticle(pCaloHit));
37 outputCaloHitList.push_back(pCaloHit);
38 }
39 catch (const StatusCodeException &)
40 {
41 std::cout << "CheatingCosmicRayRemovalAlgorithm::Run - Unable to determine MCParticle origin for an input CaloHit, which will be skipped."
42 << std::endl;
43 continue;
44 }
45 }
46
47 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, outputCaloHitList, m_outputCaloHitListName));
49
50 return STATUS_CODE_SUCCESS;
51}
52
53//------------------------------------------------------------------------------------------------------------------------------------------
54
56{
57 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputCaloHitListName", m_inputCaloHitListName));
58 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "MCParticleListName", m_mcParticleListName));
59 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputCaloHitListName", m_outputCaloHitListName));
60
61 return STATUS_CODE_SUCCESS;
62}
63
64} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the cheating cosmic ray removal algorithm class.
Header file for the lar monte carlo particle helper helper class.
Header file for the mc particle helper class.
#define PANDORA_THROW_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:43
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:19
static pandora::StatusCode SaveList(const pandora::Algorithm &algorithm, const T &t, const std::string &newListName)
Save a provided input object list under a new name.
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 GetList(const pandora::Algorithm &algorithm, const std::string &listName, const T *&pT)
Get a named list.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
static bool IsCosmicRay(const pandora::MCParticle *const pMCParticle)
Return true if passed a primary cosmic ray MCParticle.
static const pandora::MCParticle * GetParentMCParticle(const pandora::MCParticle *const pMCParticle)
Get the parent mc particle.
CaloHit class.
Definition CaloHit.h:26
static const MCParticle * GetMainMCParticle(const T *const pT)
Find the mc particle making the largest contribution to a specified calo hit, track or cluster.
MCParticle class.
Definition MCParticle.h:26
StatusCodeException class.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
MANAGED_CONTAINER< const MCParticle * > MCParticleList
MANAGED_CONTAINER< const CaloHit * > CaloHitList
StatusCode
The StatusCode enum.