Public Member Functions | Public Attributes | Private Member Functions | List of all members
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 38 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.

521  :
522  m_pPfo(pPfo),
523  m_sliceId(sliceId),
524  m_canFit(false),
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 int max(int a, int b)
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.

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.
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 52 of file CosmicRayTaggingTool.h.

double lar_content::CosmicRayTaggingTool::CRCandidate::m_curvature

Measure of the curvature of the track.

Definition at line 56 of file CosmicRayTaggingTool.h.

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

First fitted end point in 3D.

Definition at line 53 of file CosmicRayTaggingTool.h.

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

Second fitted end point in 3D.

Definition at line 54 of file CosmicRayTaggingTool.h.

double lar_content::CosmicRayTaggingTool::CRCandidate::m_length

Straight line length of the linear fit.

Definition at line 55 of file CosmicRayTaggingTool.h.

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

Address of the candidate Pfo.

Definition at line 50 of file CosmicRayTaggingTool.h.

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

Slice ID.

Definition at line 51 of file CosmicRayTaggingTool.h.

double lar_content::CosmicRayTaggingTool::CRCandidate::m_theta

Direction made with vertical.

Definition at line 57 of file CosmicRayTaggingTool.h.


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