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) |
|
| 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) |
|
|
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 1057 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 1112 of file TrackShowerIdFeatureTool.cc.
1120 CaloHitList orderedCaloHitList;
1123 FloatVector chargeVector;
1124 unsigned int hitCounter(0);
1125 const unsigned int nTotalHits(orderedCaloHitList.size());
1127 for (
const CaloHit *
const pCaloHit : orderedCaloHitList)
1130 const float pCaloHitCharge(pCaloHit->GetInputEnergy());
1132 if (pCaloHitCharge >= 0.f)
1134 totalCharge += pCaloHitCharge;
1135 chargeVector.push_back(pCaloHitCharge);
1137 if (hitCounter >= std::floor(static_cast<float>(nTotalHits) * (1.f -
m_endChargeFraction)))
1138 endCharge += pCaloHitCharge;
1142 if (!chargeVector.empty())
1144 chargeMean = totalCharge /
static_cast<float>(chargeVector.size());
1146 for (
const float charge : chargeVector)
1147 chargeSigma += (charge - chargeMean) * (charge - chargeMean);
1149 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 1155 of file TrackShowerIdFeatureTool.cc.
1159 (
void)PandoraContentApi::GetCurrentList(*pAlgorithm, pVertexList);
1161 if (!pVertexList || pVertexList->empty())
1164 unsigned int nInteractionVertices(0);
1165 const Vertex *pInteractionVertex(
nullptr);
1167 for (
const Vertex *pVertex : *pVertexList)
1169 if ((pVertex->GetVertexLabel() == VERTEX_INTERACTION) && (pVertex->GetVertexType() == VERTEX_3D))
1171 ++nInteractionVertices;
1172 pInteractionVertex = pVertex;
1176 if (pInteractionVertex && (1 == nInteractionVertices))
1181 CaloHitList clusterCaloHitList;
1182 pCluster->GetOrderedCaloHitList().FillCaloHitList(clusterCaloHitList);
1184 clusterCaloHitList.sort(ThreeDChargeFeatureTool::VertexComparator(vertexPosition2D));
1185 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.
std::list< Vertex > VertexList
StatusCode lar_content::ThreeDChargeFeatureTool::ReadSettings |
( |
const pandora::TiXmlHandle |
xmlHandle | ) |
|
|
private |
Definition at line 1191 of file TrackShowerIdFeatureTool.cc.
1193 PANDORA_RETURN_RESULT_IF_AND_IF(
1194 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"EndChargeFraction",
m_endChargeFraction));
1196 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 1063 of file TrackShowerIdFeatureTool.cc.
1066 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
1067 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() << std::endl;
1069 float totalCharge(-1.f), chargeSigma(-1.f), chargeMean(-1.f), endCharge(-1.f);
1072 ClusterList clusterListW;
1075 if (!clusterListW.empty())
1078 if (chargeMean > std::numeric_limits<float>::epsilon())
1079 charge1 = chargeSigma / chargeMean;
1081 if (totalCharge > std::numeric_limits<float>::epsilon())
1082 charge2 = endCharge / totalCharge;
1084 featureVector.push_back(charge1);
1085 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.
BEGIN_PROLOG could also be cout
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: