Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::CheatingCosmicRayRemovalAlgorithm Class Reference

CheatingCosmicRayRemovalAlgorithm::Algorithm class. More...

#include <CheatingCosmicRayRemovalAlgorithm.h>

Inheritance diagram for lar_content::CheatingCosmicRayRemovalAlgorithm:

Public Member Functions

 CheatingCosmicRayRemovalAlgorithm ()=default
 Default constructor. More...
 

Private Member Functions

pandora::StatusCode Run ()
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

std::string m_inputCaloHitListName
 Input calo hit list name. More...
 
std::string m_outputCaloHitListName
 Output calo hit list name. More...
 
std::string m_mcParticleListName
 MC Particle list name. More...
 

Detailed Description

CheatingCosmicRayRemovalAlgorithm::Algorithm class.

Definition at line 19 of file CheatingCosmicRayRemovalAlgorithm.h.

Constructor & Destructor Documentation

lar_content::CheatingCosmicRayRemovalAlgorithm::CheatingCosmicRayRemovalAlgorithm ( )
default

Default constructor.

Member Function Documentation

StatusCode lar_content::CheatingCosmicRayRemovalAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 55 of file CheatingCosmicRayRemovalAlgorithm.cc.

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 }
std::string m_outputCaloHitListName
Output calo hit list name.
std::string m_inputCaloHitListName
Input calo hit list name.
StatusCode lar_content::CheatingCosmicRayRemovalAlgorithm::Run ( )
private

Definition at line 21 of file CheatingCosmicRayRemovalAlgorithm.cc.

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));
48  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<CaloHit>(*this, m_outputCaloHitListName));
49 
50  return STATUS_CODE_SUCCESS;
51 }
std::string m_outputCaloHitListName
Output calo hit list name.
std::string m_inputCaloHitListName
Input calo hit list name.
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.
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::string lar_content::CheatingCosmicRayRemovalAlgorithm::m_inputCaloHitListName
private

Input calo hit list name.

Definition at line 32 of file CheatingCosmicRayRemovalAlgorithm.h.

std::string lar_content::CheatingCosmicRayRemovalAlgorithm::m_mcParticleListName
private

MC Particle list name.

Definition at line 34 of file CheatingCosmicRayRemovalAlgorithm.h.

std::string lar_content::CheatingCosmicRayRemovalAlgorithm::m_outputCaloHitListName
private

Output calo hit list name.

Definition at line 33 of file CheatingCosmicRayRemovalAlgorithm.h.


The documentation for this class was generated from the following files: