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

NeutrinoPropertiesAlgorithm class. More...

#include <NeutrinoPropertiesAlgorithm.h>

Inheritance diagram for lar_content::NeutrinoPropertiesAlgorithm:

Public Member Functions

 NeutrinoPropertiesAlgorithm ()
 Default constructor. More...
 

Private Member Functions

pandora::StatusCode Run ()
 
void SetNeutrinoId (const pandora::ParticleFlowObject *const pNeutrinoPfo) const
 identifying the primary daughter of a neutrino pfo and set the particle id accordingly More...
 
unsigned int GetNTwoDHitsInPfoChain (const pandora::ParticleFlowObject *const pPfo) const
 Get the number of two dimensional hits (TPC_VIEW_U, V or W) contained in clusters in a pfo and all its daughters. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

std::string m_neutrinoPfoListName
 The name of the output neutrino pfo list. More...
 
bool m_includeIsolatedHits
 Whether to include isolated hits when counting 2d hits in pfo chain. More...
 

Detailed Description

NeutrinoPropertiesAlgorithm class.

Definition at line 19 of file NeutrinoPropertiesAlgorithm.h.

Constructor & Destructor Documentation

lar_content::NeutrinoPropertiesAlgorithm::NeutrinoPropertiesAlgorithm ( )

Default constructor.

Definition at line 21 of file NeutrinoPropertiesAlgorithm.cc.

21  : m_includeIsolatedHits(false)
22 {
23 }
bool m_includeIsolatedHits
Whether to include isolated hits when counting 2d hits in pfo chain.

Member Function Documentation

unsigned int lar_content::NeutrinoPropertiesAlgorithm::GetNTwoDHitsInPfoChain ( const pandora::ParticleFlowObject *const  pPfo) const
private

Get the number of two dimensional hits (TPC_VIEW_U, V or W) contained in clusters in a pfo and all its daughters.

Parameters
pPfoaddress of the pfo
Returns
the number of two dimensional hits

Definition at line 105 of file NeutrinoPropertiesAlgorithm.cc.

106 {
107  unsigned int nTwoDHits(0);
108 
109  for (const Cluster *const pCluster : pPfo->GetClusterList())
110  {
111  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
112 
113  if ((TPC_VIEW_U == hitType) || (TPC_VIEW_V == hitType) || (TPC_VIEW_W == hitType))
114  {
115  nTwoDHits += pCluster->GetNCaloHits();
116 
118  nTwoDHits += pCluster->GetNIsolatedCaloHits();
119  }
120  }
121 
122  for (const ParticleFlowObject *const pDaughterPfo : pPfo->GetDaughterPfoList())
123  {
124  nTwoDHits += this->GetNTwoDHitsInPfoChain(pDaughterPfo);
125  }
126 
127  return nTwoDHits;
128 }
bool m_includeIsolatedHits
Whether to include isolated hits when counting 2d hits in pfo chain.
enum cvn::HType HitType
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
unsigned int GetNTwoDHitsInPfoChain(const pandora::ParticleFlowObject *const pPfo) const
Get the number of two dimensional hits (TPC_VIEW_U, V or W) contained in clusters in a pfo and all it...
StatusCode lar_content::NeutrinoPropertiesAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 132 of file NeutrinoPropertiesAlgorithm.cc.

133 {
134  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "NeutrinoPfoListName", m_neutrinoPfoListName));
135 
136  PANDORA_RETURN_RESULT_IF_AND_IF(
137  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "IncludeIsolatedHits", m_includeIsolatedHits));
138 
139  return STATUS_CODE_SUCCESS;
140 }
bool m_includeIsolatedHits
Whether to include isolated hits when counting 2d hits in pfo chain.
std::string m_neutrinoPfoListName
The name of the output neutrino pfo list.
StatusCode lar_content::NeutrinoPropertiesAlgorithm::Run ( )
private

Definition at line 27 of file NeutrinoPropertiesAlgorithm.cc.

28 {
29  const PfoList *pPfoList(nullptr);
30  PANDORA_THROW_RESULT_IF_AND_IF(
31  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, m_neutrinoPfoListName, pPfoList));
32 
33  if (!pPfoList || pPfoList->empty())
34  {
35  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
36  std::cout << "NeutrinoPropertiesAlgorithm: unable to find pfo list " << m_neutrinoPfoListName << std::endl;
37 
38  return STATUS_CODE_SUCCESS;
39  }
40 
41  // ATTN Enforces that only one pfo, of neutrino-type, be in the specified input list
42  const ParticleFlowObject *const pNeutrinoPfo((1 == pPfoList->size()) ? *(pPfoList->begin()) : nullptr);
43 
44  if (!pNeutrinoPfo || !LArPfoHelper::IsNeutrino(pNeutrinoPfo))
45  return STATUS_CODE_FAILURE;
46 
47  // ATTN At this (maybe unconventional) stage, remove any lone, placeholder neutrinos, with no daughter particles
48  if (pNeutrinoPfo->GetDaughterPfoList().empty())
49  {
50  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete(*this, pNeutrinoPfo, m_neutrinoPfoListName));
51  }
52  else
53  {
54  this->SetNeutrinoId(pNeutrinoPfo);
55  }
56 
57  return STATUS_CODE_SUCCESS;
58 }
void SetNeutrinoId(const pandora::ParticleFlowObject *const pNeutrinoPfo) const
identifying the primary daughter of a neutrino pfo and set the particle id accordingly ...
std::string m_neutrinoPfoListName
The name of the output neutrino pfo list.
static bool IsNeutrino(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a neutrino or (antineutrino)
QTextStream & endl(QTextStream &s)
void lar_content::NeutrinoPropertiesAlgorithm::SetNeutrinoId ( const pandora::ParticleFlowObject *const  pNeutrinoPfo) const
private

identifying the primary daughter of a neutrino pfo and set the particle id accordingly

Parameters
pNeutrinoPfoaddress of the neutrino pfo

Definition at line 62 of file NeutrinoPropertiesAlgorithm.cc.

63 {
64  unsigned int nPrimaryTwoDHits(0);
65  const ParticleFlowObject *pPrimaryDaughter(nullptr);
66 
67  PfoVector daughterPfoVector(pNeutrinoPfo->GetDaughterPfoList().begin(), pNeutrinoPfo->GetDaughterPfoList().end());
68  std::sort(daughterPfoVector.begin(), daughterPfoVector.end(), LArPfoHelper::SortByNHits);
69 
70  for (const ParticleFlowObject *const pDaughterPfo : daughterPfoVector)
71  {
72  const unsigned int nTwoDHits(this->GetNTwoDHitsInPfoChain(pDaughterPfo));
73 
74  if (!pPrimaryDaughter || (nTwoDHits > nPrimaryTwoDHits))
75  {
76  nPrimaryTwoDHits = nTwoDHits;
77  pPrimaryDaughter = pDaughterPfo;
78  }
79  }
80 
81  if (!pPrimaryDaughter)
82  throw StatusCodeException(STATUS_CODE_FAILURE);
83 
84  PandoraContentApi::ParticleFlowObject::Metadata metadata;
85 
86  if (E_MINUS == std::abs(pPrimaryDaughter->GetParticleId()))
87  {
88  metadata.m_particleId = NU_E;
89  }
90  else if (MU_MINUS == std::abs(pPrimaryDaughter->GetParticleId()))
91  {
92  metadata.m_particleId = NU_MU;
93  }
94 
95  if (metadata.m_particleId.IsInitialized())
96  {
97  metadata.m_charge = PdgTable::GetParticleCharge(metadata.m_particleId.Get());
98  metadata.m_mass = PdgTable::GetParticleMass(metadata.m_particleId.Get());
99  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*this, pNeutrinoPfo, metadata));
100  }
101 }
static bool SortByNHits(const pandora::ParticleFlowObject *const pLhs, const pandora::ParticleFlowObject *const pRhs)
Sort pfos by number of constituent hits.
T abs(T value)
unsigned int GetNTwoDHitsInPfoChain(const pandora::ParticleFlowObject *const pPfo) const
Get the number of two dimensional hits (TPC_VIEW_U, V or W) contained in clusters in a pfo and all it...

Member Data Documentation

bool lar_content::NeutrinoPropertiesAlgorithm::m_includeIsolatedHits
private

Whether to include isolated hits when counting 2d hits in pfo chain.

Definition at line 50 of file NeutrinoPropertiesAlgorithm.h.

std::string lar_content::NeutrinoPropertiesAlgorithm::m_neutrinoPfoListName
private

The name of the output neutrino pfo list.

Definition at line 48 of file NeutrinoPropertiesAlgorithm.h.


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