ThreeDChargeFeatureTool class for the calculation of charge-related features.
More...
#include <TrackShowerIdFeatureTool.h>
|
void | CalculateChargeVariables (const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, float &totalCharge, float &chargeSigma, float &chargeMean, float &endCharge) |
| Calculation of the charge variables. More...
|
|
void | OrderCaloHitsByDistanceToVertex (const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, pandora::CaloHitList &caloHitList) |
| Function to order the calo hit list by distance to neutrino vertex. More...
|
|
pandora::StatusCode | ReadSettings (const pandora::TiXmlHandle xmlHandle) |
|
ThreeDChargeFeatureTool class for the calculation of charge-related features.
Definition at line 259 of file TrackShowerIdFeatureTool.h.
lar_content::ThreeDChargeFeatureTool::ThreeDChargeFeatureTool |
( |
| ) |
|
Default constructor.
Definition at line 728 of file TrackShowerIdFeatureTool.cc.
float m_endChargeFraction
Fraction of hits that will be considered to calculate end charge (default 10%)
void lar_content::ThreeDChargeFeatureTool::CalculateChargeVariables |
( |
const pandora::Algorithm *const |
pAlgorithm, |
|
|
const pandora::Cluster *const |
pCluster, |
|
|
float & |
totalCharge, |
|
|
float & |
chargeSigma, |
|
|
float & |
chargeMean, |
|
|
float & |
endCharge |
|
) |
| |
|
private |
Calculation of the charge variables.
- Parameters
-
pAlgorithm,the | algorithm |
pCluster | the cluster we are characterizing |
totalCharge,to | receive the total charge |
chargeSigma,to | receive the charge sigma |
chargeMean,to | receive the charge mean |
startCharge,to | receive the charge in the initial 10% hits |
endCharge,to | receive the charge in the last 10% hits |
Definition at line 761 of file TrackShowerIdFeatureTool.cc.
769 CaloHitList orderedCaloHitList;
773 unsigned int hitCounter(0);
774 const unsigned int nTotalHits(orderedCaloHitList.size());
776 for (
const CaloHit *
const pCaloHit : orderedCaloHitList)
779 const float pCaloHitCharge(pCaloHit->GetInputEnergy());
781 if (pCaloHitCharge >= 0.
f)
783 totalCharge += pCaloHitCharge;
784 chargeVector.push_back(pCaloHitCharge);
787 endCharge += pCaloHitCharge;
791 if (!chargeVector.empty())
793 chargeMean = totalCharge /
static_cast<float>(chargeVector.size());
795 for (
const float charge : chargeVector)
796 chargeSigma += (charge - chargeMean) * (charge - chargeMean);
798 chargeSigma = std::sqrt(chargeSigma / static_cast<float>(chargeVector.size()));
void OrderCaloHitsByDistanceToVertex(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, pandora::CaloHitList &caloHitList)
Function to order the calo hit list by distance to neutrino vertex.
Dft::FloatVector FloatVector
float m_endChargeFraction
Fraction of hits that will be considered to calculate end charge (default 10%)
void lar_content::ThreeDChargeFeatureTool::OrderCaloHitsByDistanceToVertex |
( |
const pandora::Algorithm *const |
pAlgorithm, |
|
|
const pandora::Cluster *const |
pCluster, |
|
|
pandora::CaloHitList & |
caloHitList |
|
) |
| |
|
private |
Function to order the calo hit list by distance to neutrino vertex.
- Parameters
-
pAlgorithm,the | algorithm |
pCluster | the cluster we are characterizing |
caloHitList | to receive the ordered calo hit list |
Definition at line 804 of file TrackShowerIdFeatureTool.cc.
808 (void)PandoraContentApi::GetCurrentList(*pAlgorithm, pVertexList);
810 if (!pVertexList || pVertexList->empty())
813 unsigned int nInteractionVertices(0);
814 const Vertex *pInteractionVertex(
nullptr);
816 for (
const Vertex *pVertex : *pVertexList)
818 if ((pVertex->GetVertexLabel() == VERTEX_INTERACTION) && (pVertex->GetVertexType() == VERTEX_3D))
820 ++nInteractionVertices;
821 pInteractionVertex = pVertex;
825 if (pInteractionVertex && (1 == nInteractionVertices))
830 CaloHitList clusterCaloHitList;
831 pCluster->GetOrderedCaloHitList().FillCaloHitList(clusterCaloHitList);
833 clusterCaloHitList.sort(ThreeDChargeFeatureTool::VertexComparator(vertexPosition2D));
834 caloHitList.insert(caloHitList.end(), clusterCaloHitList.begin(), clusterCaloHitList.end());
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
std::list< Vertex > VertexList
StatusCode lar_content::ThreeDChargeFeatureTool::ReadSettings |
( |
const pandora::TiXmlHandle |
xmlHandle | ) |
|
|
private |
Definition at line 840 of file TrackShowerIdFeatureTool.cc.
842 PANDORA_RETURN_RESULT_IF_AND_IF(
843 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"EndChargeFraction",
m_endChargeFraction));
845 return STATUS_CODE_SUCCESS;
float m_endChargeFraction
Fraction of hits that will be considered to calculate end charge (default 10%)
void lar_content::ThreeDChargeFeatureTool::Run |
( |
LArMvaHelper::MvaFeatureVector & |
featureVector, |
|
|
const pandora::Algorithm *const |
pAlgorithm, |
|
|
const pandora::ParticleFlowObject *const |
pInputPfo |
|
) |
| |
Definition at line 734 of file TrackShowerIdFeatureTool.cc.
737 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
738 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() <<
std::endl;
740 float totalCharge(-1.
f), chargeSigma(-1.
f), chargeMean(-1.
f), endCharge(-1.
f);
743 ClusterList clusterListW;
746 if (!clusterListW.empty())
749 if (chargeMean > std::numeric_limits<float>::epsilon())
750 charge1 = chargeSigma / chargeMean;
752 if (totalCharge > std::numeric_limits<float>::epsilon())
753 charge2 = endCharge / totalCharge;
755 featureVector.push_back(charge1);
756 featureVector.push_back(charge2);
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.
MvaTypes::MvaFeature MvaFeature
void CalculateChargeVariables(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, float &totalCharge, float &chargeSigma, float &chargeMean, float &endCharge)
Calculation of the charge variables.
QTextStream & endl(QTextStream &s)
float lar_content::ThreeDChargeFeatureTool::m_endChargeFraction |
|
private |
The documentation for this class was generated from the following files: