All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::ConeChargeFeatureTool Class Reference

ConeChargeFeatureTool class for the calculation of charge distribution and conicalness. More...

#include <TrackShowerIdFeatureTool.h>

Inheritance diagram for lar_content::ConeChargeFeatureTool:
lar_content::MvaFeatureTool< Ts >

Public Member Functions

 ConeChargeFeatureTool ()
 Default constructor. More...
 
void Run (LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
 
void Run (LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
 
- Public Member Functions inherited from lar_content::MvaFeatureTool< Ts >
 MvaFeatureTool ()=default
 Default constructor. More...
 
virtual void Run (MvaTypes::MvaFeatureVector &featureVector, Ts...args)=0
 Run the algorithm tool. More...
 
virtual void Run (MvaTypes::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName, Ts...args)
 

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
void CalculateChargeDistribution (const pandora::CaloHitList &caloHitList, const pandora::CartesianVector &pfoStart, const pandora::CartesianVector &pfoDir, float &chargeCore, float &chargeHalo, float &chargeCon)
 Calculate charge distribution in relation to the Moeliere radius. More...
 
float CalculateConicalness (const pandora::CaloHitList &caloHitList, const pandora::CartesianVector &pfoStart, const pandora::CartesianVector &pfoDir, const float pfoLength)
 Calculate conicalness as a ratio of charge distribution at the end and start of pfo. More...
 

Private Attributes

unsigned int m_conMinHits
 Configurable parameters to calculate cone charge variables. More...
 
float m_minCharge
 
float m_conFracRange
 
float m_MoliereRadius
 
float m_MoliereRadiusFrac
 

Additional Inherited Members

- Public Types inherited from lar_content::MvaFeatureTool< Ts >
typedef std::vector
< MvaFeatureTool< Ts...> * > 
FeatureToolVector
 
typedef std::map< std::string,
MvaFeatureTool< Ts...> * > 
FeatureToolMap
 

Detailed Description

ConeChargeFeatureTool class for the calculation of charge distribution and conicalness.

Definition at line 210 of file TrackShowerIdFeatureTool.h.

Constructor & Destructor Documentation

lar_content::ConeChargeFeatureTool::ConeChargeFeatureTool ( )

Default constructor.

Definition at line 397 of file TrackShowerIdFeatureTool.cc.

397  :
398  m_conMinHits(3),
399  m_minCharge(0.1f),
400  m_conFracRange(0.2f),
401  m_MoliereRadius(10.1f),
402  m_MoliereRadiusFrac(0.2f)
403 {
404 }
unsigned int m_conMinHits
Configurable parameters to calculate cone charge variables.

Member Function Documentation

void lar_content::ConeChargeFeatureTool::CalculateChargeDistribution ( const pandora::CaloHitList &  caloHitList,
const pandora::CartesianVector &  pfoStart,
const pandora::CartesianVector &  pfoDir,
float &  chargeCore,
float &  chargeHalo,
float &  chargeCon 
)
private

Calculate charge distribution in relation to the Moeliere radius.

Parameters
caloHitList,:the calo hit list of plane w
pfoStart,:start position of the pfo
pfoDir,:direction of pfo from the principle vector of pca
chargeCore,:to receive sum of charge within Moeliete radius * fraction
chargeHalo,:to receive sum of charge outside of Moeliere radius * fraction
chargeCon,:to receive weighted sum of total charge

Definition at line 472 of file TrackShowerIdFeatureTool.cc.

474 {
475  for (const CaloHit *const pCaloHit : caloHitList)
476  {
477  const float distFromTrackFit(((pCaloHit->GetPositionVector() - pfoStart).GetCrossProduct(pfoDir)).GetMagnitude());
478 
479  if (distFromTrackFit < m_MoliereRadiusFrac * m_MoliereRadius)
480  chargeCore += pCaloHit->GetInputEnergy();
481  else
482  chargeHalo += pCaloHit->GetInputEnergy();
483 
484  chargeCon += pCaloHit->GetInputEnergy() / std::max(1.E-2f, distFromTrackFit); /* Set 1.E-2f to prevent division by 0 and to set max histogram bin as 100 */
485  }
486 }
process_name E
float lar_content::ConeChargeFeatureTool::CalculateConicalness ( const pandora::CaloHitList &  caloHitList,
const pandora::CartesianVector &  pfoStart,
const pandora::CartesianVector &  pfoDir,
const float  pfoLength 
)
private

Calculate conicalness as a ratio of charge distribution at the end and start of pfo.

Parameters
caloHitList,:the calo hit list of plane w
pfoStart,:start position of the pfo
pfoDir,:direction of pfo from the principle vector of pca
pfoLength,:length of the whole pfo return conicalness

Definition at line 490 of file TrackShowerIdFeatureTool.cc.

492 {
493  float totalChargeStart(0.f), totalChargeEnd(0.f);
494  float chargeConStart(0.f), chargeConEnd(0.f);
495  unsigned int nHitsConStart(0), nHitsConEnd(0);
496 
497  for (const CaloHit *const pCaloHit : caloHitList)
498  {
499  const float distFromTrackFit(((pCaloHit->GetPositionVector() - pfoStart).GetCrossProduct(pfoDir)).GetMagnitude());
500  const float hitLength(std::fabs((pCaloHit->GetPositionVector() - pfoStart).GetDotProduct(pfoDir)));
501 
502  if (hitLength / pfoLength < m_conFracRange)
503  {
504  chargeConStart += distFromTrackFit * distFromTrackFit * pCaloHit->GetInputEnergy();
505  ++nHitsConStart;
506  totalChargeStart += pCaloHit->GetInputEnergy();
507  }
508  else if (1.f - hitLength / pfoLength < m_conFracRange)
509  {
510  chargeConEnd += distFromTrackFit * distFromTrackFit * pCaloHit->GetInputEnergy();
511  ++nHitsConEnd;
512  totalChargeEnd += pCaloHit->GetInputEnergy();
513  }
514  }
515 
516  float conicalness(1.f);
517 
518  if (nHitsConStart >= m_conMinHits && nHitsConEnd >= m_conMinHits && totalChargeEnd > m_minCharge &&
519  std::sqrt(chargeConStart) > m_minCharge && totalChargeStart > m_minCharge)
520  conicalness = (std::sqrt(chargeConEnd / chargeConStart)) / (totalChargeEnd / totalChargeStart);
521 
522  return conicalness;
523 }
unsigned int m_conMinHits
Configurable parameters to calculate cone charge variables.
StatusCode lar_content::ConeChargeFeatureTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 527 of file TrackShowerIdFeatureTool.cc.

528 {
529  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ConMinHits", m_conMinHits));
530  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinCharge", m_minCharge));
531  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ConFracRange", m_conFracRange));
532  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MoliereRadius", m_MoliereRadius));
533  PANDORA_RETURN_RESULT_IF_AND_IF(
534  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MoliereRadiusFrac", m_MoliereRadiusFrac));
535 
536  return STATUS_CODE_SUCCESS;
537 }
unsigned int m_conMinHits
Configurable parameters to calculate cone charge variables.
void lar_content::ConeChargeFeatureTool::Run ( LArMvaHelper::MvaFeatureVector featureVector,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pInputPfo 
)

Definition at line 408 of file TrackShowerIdFeatureTool.cc.

410 {
411  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
412  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
413 
414  ClusterList clusterListW;
415  LArPfoHelper::GetClusters(pInputPfo, TPC_VIEW_W, clusterListW);
416 
417  LArMvaHelper::MvaFeature haloTotalRatio, concentration, conicalness;
418 
419  if (!clusterListW.empty())
420  {
421  CaloHitList clusterCaloHitList;
422  clusterListW.front()->GetOrderedCaloHitList().FillCaloHitList(clusterCaloHitList);
423 
424  const CartesianVector &pfoStart(clusterCaloHitList.front()->GetPositionVector());
425  CartesianVector centroid(0.f, 0.f, 0.f);
426  LArPcaHelper::EigenVectors eigenVecs;
427  LArPcaHelper::EigenValues eigenValues(0.f, 0.f, 0.f);
428  LArPcaHelper::RunPca(clusterCaloHitList, centroid, eigenValues, eigenVecs);
429 
430  float chargeCore(0.f), chargeHalo(0.f), chargeCon(0.f);
431  this->CalculateChargeDistribution(clusterCaloHitList, pfoStart, eigenVecs[0], chargeCore, chargeHalo, chargeCon);
432  haloTotalRatio = (chargeCore + chargeHalo > std::numeric_limits<float>::epsilon()) ? chargeHalo / (chargeCore + chargeHalo) : -1.f;
433  concentration = (chargeCore + chargeHalo > std::numeric_limits<float>::epsilon()) ? chargeCon / (chargeCore + chargeHalo) : -1.f;
434  const float pfoLength(std::sqrt(LArPfoHelper::GetThreeDLengthSquared(pInputPfo)));
435  conicalness = (pfoLength > std::numeric_limits<float>::epsilon())
436  ? this->CalculateConicalness(clusterCaloHitList, pfoStart, eigenVecs[0], pfoLength)
437  : 1.f;
438  }
439 
440  featureVector.push_back(haloTotalRatio);
441  featureVector.push_back(concentration);
442  featureVector.push_back(conicalness);
443 }
static void GetClusters(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::ClusterList &clusterList)
Get a list of clusters of a particular hit type from a list of pfos.
pandora::CartesianVector EigenValues
Definition: LArPcaHelper.h:24
static float GetThreeDLengthSquared(const pandora::ParticleFlowObject *const pPfo)
Calculate length of Pfo using 3D clusters.
MvaTypes::MvaFeature MvaFeature
Definition: LArMvaHelper.h:71
static void RunPca(const T &t, pandora::CartesianVector &centroid, EigenValues &outputEigenValues, EigenVectors &outputEigenVectors)
Run principal component analysis using input calo hits (TPC_VIEW_U,V,W or TPC_3D; all treated as 3D p...
std::vector< pandora::CartesianVector > EigenVectors
Definition: LArPcaHelper.h:25
float CalculateConicalness(const pandora::CaloHitList &caloHitList, const pandora::CartesianVector &pfoStart, const pandora::CartesianVector &pfoDir, const float pfoLength)
Calculate conicalness as a ratio of charge distribution at the end and start of pfo.
void CalculateChargeDistribution(const pandora::CaloHitList &caloHitList, const pandora::CartesianVector &pfoStart, const pandora::CartesianVector &pfoDir, float &chargeCore, float &chargeHalo, float &chargeCon)
Calculate charge distribution in relation to the Moeliere radius.
BEGIN_PROLOG could also be cout
void lar_content::ConeChargeFeatureTool::Run ( LArMvaHelper::MvaFeatureMap featureMap,
pandora::StringVector &  featureOrder,
const std::string &  featureToolName,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pInputPfo 
)

Member Data Documentation

float lar_content::ConeChargeFeatureTool::m_conFracRange
private

Definition at line 236 of file TrackShowerIdFeatureTool.h.

unsigned int lar_content::ConeChargeFeatureTool::m_conMinHits
private

Configurable parameters to calculate cone charge variables.

Parameters
conMinHits,:minimum hit requirement at start and end of pfo to calculate conicalness
minCharge,:minimum charge requirement at start and end of pfo to calculate conicalness
conFracRange,:conincal fractional range to determine start/end of pfo
MoliereRadius,:10.1 cm to determine halo/core of pfo
MoliereRadiusFrac,:fraction of Moliere radius, default = 0.2

Definition at line 234 of file TrackShowerIdFeatureTool.h.

float lar_content::ConeChargeFeatureTool::m_minCharge
private

Definition at line 235 of file TrackShowerIdFeatureTool.h.

float lar_content::ConeChargeFeatureTool::m_MoliereRadius
private

Definition at line 237 of file TrackShowerIdFeatureTool.h.

float lar_content::ConeChargeFeatureTool::m_MoliereRadiusFrac
private

Definition at line 238 of file TrackShowerIdFeatureTool.h.


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