ThreeDChargeFeatureTool class for the calculation of charge-related features.
More...
#include "TrackShowerIdFeatureTool.h"
|
| ThreeDChargeFeatureTool () |
| 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) |
|
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...) |
|
|
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 338 of file TrackShowerIdFeatureTool.h.
lar_content::ThreeDChargeFeatureTool::ThreeDChargeFeatureTool |
( |
| ) |
|
Default constructor.
Definition at line 1066 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 1122 of file TrackShowerIdFeatureTool.cc.
References f, m_endChargeFraction, and OrderCaloHitsByDistanceToVertex().
Referenced by Run().
1130 CaloHitList orderedCaloHitList;
1133 FloatVector chargeVector;
1134 unsigned int hitCounter(0);
1135 const unsigned int nTotalHits(orderedCaloHitList.size());
1137 for (
const CaloHit *
const pCaloHit : orderedCaloHitList)
1140 const float pCaloHitCharge(pCaloHit->GetInputEnergy());
1142 if (pCaloHitCharge >= 0.
f)
1144 totalCharge += pCaloHitCharge;
1145 chargeVector.push_back(pCaloHitCharge);
1148 endCharge += pCaloHitCharge;
1152 if (!chargeVector.empty())
1154 chargeMean = totalCharge /
static_cast<float>(chargeVector.size());
1156 for (
const float charge : chargeVector)
1157 chargeSigma += (charge - chargeMean) * (charge - chargeMean);
1159 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.
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 1165 of file TrackShowerIdFeatureTool.cc.
References lar_content::LArClusterHelper::GetClusterHitType(), and lar_content::LArGeometryHelper::ProjectPosition().
Referenced by CalculateChargeVariables().
1169 (void)PandoraContentApi::GetCurrentList(*pAlgorithm, pVertexList);
1171 if (!pVertexList || pVertexList->empty())
1174 unsigned int nInteractionVertices(0);
1175 const Vertex *pInteractionVertex(
nullptr);
1177 for (
const Vertex *pVertex : *pVertexList)
1179 if ((pVertex->GetVertexLabel() == VERTEX_INTERACTION) && (pVertex->GetVertexType() == VERTEX_3D))
1181 ++nInteractionVertices;
1182 pInteractionVertex = pVertex;
1186 if (pInteractionVertex && (1 == nInteractionVertices))
1191 CaloHitList clusterCaloHitList;
1192 pCluster->GetOrderedCaloHitList().FillCaloHitList(clusterCaloHitList);
1194 clusterCaloHitList.sort(ThreeDChargeFeatureTool::VertexComparator(vertexPosition2D));
1195 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 1201 of file TrackShowerIdFeatureTool.cc.
References m_endChargeFraction.
1203 PANDORA_RETURN_RESULT_IF_AND_IF(
1204 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"EndChargeFraction",
m_endChargeFraction));
1206 return STATUS_CODE_SUCCESS;
float m_endChargeFraction
Fraction of hits that will be considered to calculate end charge (default 10%)
Run the algorithm tool.
- Parameters
-
featureVector | the vector of features to append |
args | arguments to pass to the tool |
void lar_content::ThreeDChargeFeatureTool::Run |
( |
LArMvaHelper::MvaFeatureVector & |
featureVector, |
|
|
const pandora::Algorithm *const |
pAlgorithm, |
|
|
const pandora::ParticleFlowObject *const |
pInputPfo |
|
) |
| |
Definition at line 1073 of file TrackShowerIdFeatureTool.cc.
References CalculateChargeVariables(), f, and lar_content::LArPfoHelper::GetClusters().
1076 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
1077 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() << std::endl;
1079 float totalCharge(-1.
f), chargeSigma(-1.
f), chargeMean(-1.
f), endCharge(-1.
f);
1082 ClusterList clusterListW;
1085 if (!clusterListW.empty())
1088 if (chargeMean > std::numeric_limits<float>::epsilon())
1089 charge1 = chargeSigma / chargeMean;
1091 if (totalCharge > std::numeric_limits<float>::epsilon())
1092 charge2 = endCharge / totalCharge;
1094 featureVector.push_back(charge1);
1095 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.
void lar_content::ThreeDChargeFeatureTool::Run |
( |
LArMvaHelper::MvaFeatureMap & |
featureMap, |
|
|
pandora::StringVector & |
featureOrder, |
|
|
const std::string & |
featureToolName, |
|
|
const pandora::Algorithm *const |
pAlgorithm, |
|
|
const pandora::ParticleFlowObject *const |
pInputPfo |
|
) |
| |
float lar_content::ThreeDChargeFeatureTool::m_endChargeFraction |
|
private |
The documentation for this class was generated from the following files: