LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::CosmicRayTaggingTool::CRCandidate Class Reference

Class to encapsulate the logic required determine if a Pfo should or shouldn't be tagged as a cosmic ray. More...

Public Member Functions

 CRCandidate (const pandora::Pandora &pandora, const pandora::ParticleFlowObject *const pPfo, const unsigned int sliceId)
 Constructor. More...
 

Public Attributes

const pandora::ParticleFlowObject *const m_pPfo
 Address of the candidate Pfo. More...
 
unsigned int m_sliceId
 Slice ID. More...
 
bool m_canFit
 If there are a sufficient number of 3D hits to perform a fitting. More...
 
pandora::CartesianVector m_endPoint1
 First fitted end point in 3D. More...
 
pandora::CartesianVector m_endPoint2
 Second fitted end point in 3D. More...
 
double m_length
 Straight line length of the linear fit. More...
 
double m_curvature
 Measure of the curvature of the track. More...
 
double m_theta
 Direction made with vertical. More...
 

Private Member Functions

void CalculateFitVariables (const ThreeDSlidingFitResult &slidingFitResult)
 Calculate all variables which require a fit. More...
 

Detailed Description

Class to encapsulate the logic required determine if a Pfo should or shouldn't be tagged as a cosmic ray.

Definition at line 39 of file CosmicRayTaggingTool.h.

Constructor & Destructor Documentation

lar_content::CosmicRayTaggingTool::CRCandidate::CRCandidate ( const pandora::Pandora &  pandora,
const pandora::ParticleFlowObject *const  pPfo,
const unsigned int  sliceId 
)

Constructor.

Parameters
pandorathe relevant pandora instance
pPfothe address of the candidate pfo
slicethe slice id

Definition at line 521 of file CosmicRayTaggingTool.cc.

References CalculateFitVariables(), lar_content::LArPfoHelper::GetThreeDClusterList(), and m_canFit.

521  :
522  m_pPfo(pPfo),
523  m_sliceId(sliceId),
524  m_canFit(false),
525  m_endPoint1(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max()),
526  m_endPoint2(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max()),
527  m_length(std::numeric_limits<float>::max()),
528  m_curvature(std::numeric_limits<float>::max()),
529  m_theta(std::numeric_limits<float>::max())
530 {
531  ClusterList clusters3D;
532  LArPfoHelper::GetThreeDClusterList(pPfo, clusters3D);
533 
534  if (!clusters3D.empty() && (clusters3D.front()->GetNCaloHits() > 15)) // TODO Configurable
535  {
536  m_canFit = true;
537  const LArTPC *const pFirstLArTPC(pandora.GetGeometry()->GetLArTPCMap().begin()->second);
538  const ThreeDSlidingFitResult slidingFitResult(clusters3D.front(), 5, pFirstLArTPC->GetWirePitchW()); // TODO Configurable
539  this->CalculateFitVariables(slidingFitResult);
540  }
541 }
double m_theta
Direction made with vertical.
bool m_canFit
If there are a sufficient number of 3D hits to perform a fitting.
double m_length
Straight line length of the linear fit.
pandora::CartesianVector m_endPoint2
Second fitted end point in 3D.
double m_curvature
Measure of the curvature of the track.
void CalculateFitVariables(const ThreeDSlidingFitResult &slidingFitResult)
Calculate all variables which require a fit.
static void GetThreeDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 3D clusters from an input pfo.
pandora::CartesianVector m_endPoint1
First fitted end point in 3D.
const pandora::ParticleFlowObject *const m_pPfo
Address of the candidate Pfo.

Member Function Documentation

void lar_content::CosmicRayTaggingTool::CRCandidate::CalculateFitVariables ( const ThreeDSlidingFitResult slidingFitResult)
private

Calculate all variables which require a fit.

Parameters
slidingFitResultthe three dimensional sliding fit result

Definition at line 545 of file CosmicRayTaggingTool.cc.

References f, lar_content::ThreeDSlidingFitResult::GetFirstFitResult(), lar_content::ThreeDSlidingFitResult::GetGlobalFitDirection(), lar_content::ThreeDSlidingFitResult::GetGlobalMaxLayerPosition(), lar_content::ThreeDSlidingFitResult::GetGlobalMinLayerPosition(), lar_content::TwoDSlidingFitResult::GetLayerPitch(), lar_content::ThreeDSlidingFitResult::GetMaxLayer(), lar_content::ThreeDSlidingFitResult::GetMinLayer(), m_curvature, m_endPoint1, m_endPoint2, m_length, and m_theta.

Referenced by CRCandidate().

546 {
547  m_endPoint1 = slidingFitResult.GetGlobalMinLayerPosition();
548  m_endPoint2 = slidingFitResult.GetGlobalMaxLayerPosition();
549  m_length = (m_endPoint2 - m_endPoint1).GetMagnitude();
550 
551  if (std::fabs(m_length) > std::numeric_limits<float>::epsilon())
552  m_theta = std::fabs(m_endPoint2.GetY() - m_endPoint1.GetY()) / m_length;
553 
554  const float layerPitch(slidingFitResult.GetFirstFitResult().GetLayerPitch());
555 
556  CartesianPointVector directionList;
557  for (int i = slidingFitResult.GetMinLayer(); i < slidingFitResult.GetMaxLayer(); ++i)
558  {
559  CartesianVector direction(0.f, 0.f, 0.f);
560  if (STATUS_CODE_SUCCESS == slidingFitResult.GetGlobalFitDirection(static_cast<float>(i) * layerPitch, direction))
561  directionList.push_back(direction);
562  }
563 
564  CartesianVector meanDirection(0.f, 0.f, 0.f);
565  for (const CartesianVector &direction : directionList)
566  meanDirection += direction;
567 
568  if (!directionList.empty() > 0)
569  meanDirection *= 1.f / static_cast<float>(directionList.size());
570 
571  m_curvature = 0.f;
572  for (const CartesianVector &direction : directionList)
573  m_curvature += (direction - meanDirection).GetMagnitude();
574 
575  if (!directionList.empty() > 0)
576  m_curvature *= 1.f / static_cast<float>(directionList.size());
577 }
double m_theta
Direction made with vertical.
TFile f
Definition: plotHisto.C:6
double m_length
Straight line length of the linear fit.
pandora::CartesianVector m_endPoint2
Second fitted end point in 3D.
double m_curvature
Measure of the curvature of the track.
pandora::CartesianVector m_endPoint1
First fitted end point in 3D.

Member Data Documentation

bool lar_content::CosmicRayTaggingTool::CRCandidate::m_canFit

If there are a sufficient number of 3D hits to perform a fitting.

Definition at line 53 of file CosmicRayTaggingTool.h.

Referenced by CRCandidate().

double lar_content::CosmicRayTaggingTool::CRCandidate::m_curvature

Measure of the curvature of the track.

Definition at line 57 of file CosmicRayTaggingTool.h.

Referenced by CalculateFitVariables().

pandora::CartesianVector lar_content::CosmicRayTaggingTool::CRCandidate::m_endPoint1

First fitted end point in 3D.

Definition at line 54 of file CosmicRayTaggingTool.h.

Referenced by CalculateFitVariables().

pandora::CartesianVector lar_content::CosmicRayTaggingTool::CRCandidate::m_endPoint2

Second fitted end point in 3D.

Definition at line 55 of file CosmicRayTaggingTool.h.

Referenced by CalculateFitVariables().

double lar_content::CosmicRayTaggingTool::CRCandidate::m_length

Straight line length of the linear fit.

Definition at line 56 of file CosmicRayTaggingTool.h.

Referenced by CalculateFitVariables().

const pandora::ParticleFlowObject* const lar_content::CosmicRayTaggingTool::CRCandidate::m_pPfo

Address of the candidate Pfo.

Definition at line 51 of file CosmicRayTaggingTool.h.

unsigned int lar_content::CosmicRayTaggingTool::CRCandidate::m_sliceId

Slice ID.

Definition at line 52 of file CosmicRayTaggingTool.h.

double lar_content::CosmicRayTaggingTool::CRCandidate::m_theta

Direction made with vertical.

Definition at line 58 of file CosmicRayTaggingTool.h.

Referenced by CalculateFitVariables().


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