LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::LArGeometryHelper Class Reference

LArGeometryHelper class. More...

#include "LArGeometryHelper.h"

Static Public Member Functions

static float MergeTwoPositions (const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const float position1, const float position2)
 Merge two views (U,V) to give a third view (Z). More...
 
static pandora::CartesianVector MergeTwoDirections (const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const pandora::CartesianVector &direction1, const pandora::CartesianVector &direction2)
 Merge two views (U,V) to give a third view (Z). More...
 
static void MergeTwoPositions (const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const pandora::CartesianVector &position1, const pandora::CartesianVector &position2, pandora::CartesianVector &position3, float &chiSquared)
 Merge 2D positions from two views to give 2D position in third view. More...
 
static void MergeTwoPositions (const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const pandora::CartesianVector &position1, const pandora::CartesianVector &position2, pandora::CartesianVector &outputU, pandora::CartesianVector &outputV, pandora::CartesianVector &outputW, float &chiSquared)
 Merge 2D positions from two views to give 2D position in third view. More...
 
static void MergeThreePositions (const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const pandora::HitType view3, const pandora::CartesianVector &position1, const pandora::CartesianVector &position2, const pandora::CartesianVector &position3, pandora::CartesianVector &outputU, pandora::CartesianVector &outputV, pandora::CartesianVector &outputW, float &chiSquared)
 Merge 2D positions from three views to give unified 2D positions for each view. More...
 
static void MergeThreePositions (const pandora::Pandora &pandora, const pandora::CartesianVector &positionU, const pandora::CartesianVector &positionV, const pandora::CartesianVector &positionW, pandora::CartesianVector &outputU, pandora::CartesianVector &outputV, pandora::CartesianVector &outputW, float &chiSquared)
 Merge 2D positions from three views to give unified 2D positions for each view. More...
 
static void MergeTwoPositions3D (const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const pandora::CartesianVector &position1, const pandora::CartesianVector &position2, pandora::CartesianVector &position3D, float &chiSquared)
 Merge 2D positions from two views to give unified 3D position. More...
 
static void MergeThreePositions3D (const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const pandora::HitType view3, const pandora::CartesianVector &position1, const pandora::CartesianVector &position2, const pandora::CartesianVector &position3, pandora::CartesianVector &position3D, float &chiSquared)
 Merge 2D positions from three views to give unified 3D position. More...
 
static pandora::CartesianVector ProjectPosition (const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
 Project 3D position into a given 2D view. More...
 
static pandora::CartesianVector ProjectDirection (const pandora::Pandora &pandora, const pandora::CartesianVector &direction3D, const pandora::HitType view)
 Project 3D direction into a given 2D view. More...
 
static float GetWireZPitch (const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
 Return the wire pitch. More...
 
static float GetWirePitch (const pandora::Pandora &pandora, const pandora::HitType view, const float maxWirePitchDiscrepancy=0.01)
 Return the wire pitch. More...
 
static pandora::CartesianVector GetWireAxis (const pandora::Pandora &pandora, const pandora::HitType view)
 Return the wire axis (vector perpendicular to the wire direction and drift direction) More...
 
static bool IsInGap (const pandora::Pandora &pandora, const pandora::CartesianVector &testPoint2D, const pandora::HitType hitType, const float gapTolerance=0.f)
 Whether a 2D test point lies in a registered gap with the associated hit type. More...
 
static bool IsInGap3D (const pandora::Pandora &pandora, const pandora::CartesianVector &testPoint3D, const pandora::HitType hitType, const float gapTolerance=0.f)
 Whether a 3D test point lies in a registered gap with the associated hit type. More...
 
static bool IsXSamplingPointInGap (const pandora::Pandora &pandora, const float xSample, const TwoDSlidingFitResult &slidingFitResult, const float gapTolerance=0.f)
 Whether there is a gap in a cluster (described via its sliding fit result) at a specified x sampling position. More...
 
static float CalculateGapDeltaZ (const pandora::Pandora &pandora, const float minZ, const float maxZ, const pandora::HitType hitType)
 Calculate the total distance within a given 2D region that is composed of detector gaps. More...
 
static float GetSigmaUVW (const pandora::Pandora &pandora, const float maxSigmaDiscrepancy=0.01)
 Find the sigmaUVW value for the detector geometry. More...
 

Detailed Description

LArGeometryHelper class.

Definition at line 28 of file LArGeometryHelper.h.

Member Function Documentation

float lar_content::LArGeometryHelper::CalculateGapDeltaZ ( const pandora::Pandora &  pandora,
const float  minZ,
const float  maxZ,
const pandora::HitType  hitType 
)
static

Calculate the total distance within a given 2D region that is composed of detector gaps.

Parameters
pandorathe associated pandora instance
minZthe start position in Z
maxZthe end position in Z
hitTypethe hit type

Definition at line 462 of file LArGeometryHelper.cc.

References f, max, and min.

Referenced by lar_content::TwoDLinearFitFeatureTool::CalculateVariablesSlidingLinearFit(), lar_content::ThreeDLinearFitFeatureTool::CalculateVariablesSlidingLinearFit(), and lar_content::CrossGapsExtensionAlgorithm::IsAcrossGap().

463 {
464  if (maxZ - minZ < std::numeric_limits<float>::epsilon())
465  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
466 
467  float gapDeltaZ(0.f);
468 
469  for (const DetectorGap *const pDetectorGap : pandora.GetGeometry()->GetDetectorGapList())
470  {
471  const LineGap *const pLineGap = dynamic_cast<const LineGap*>(pDetectorGap);
472 
473  if (!pLineGap)
474  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
475 
476  const LineGapType lineGapType(pLineGap->GetLineGapType());
477 
478  if (!(((TPC_VIEW_U == hitType) && (TPC_WIRE_GAP_VIEW_U == lineGapType)) ||
479  ((TPC_VIEW_V == hitType) && (TPC_WIRE_GAP_VIEW_V == lineGapType)) ||
480  ((TPC_VIEW_W == hitType) && (TPC_WIRE_GAP_VIEW_W == lineGapType))))
481  {
482  continue;
483  }
484 
485  if ((pLineGap->GetLineStartZ() > maxZ) || (pLineGap->GetLineEndZ() < minZ))
486  continue;
487 
488  const float gapMinZ(std::max(minZ, pLineGap->GetLineStartZ()));
489  const float gapMaxZ(std::min(maxZ, pLineGap->GetLineEndZ()));
490 
491  if ((gapMaxZ - gapMinZ) > std::numeric_limits<float>::epsilon())
492  gapDeltaZ += (gapMaxZ - gapMinZ);
493  }
494 
495  return gapDeltaZ;
496 }
TFile f
Definition: plotHisto.C:6
Int_t max
Definition: plot.C:27
Int_t min
Definition: plot.C:26
float lar_content::LArGeometryHelper::GetSigmaUVW ( const pandora::Pandora &  pandora,
const float  maxSigmaDiscrepancy = 0.01 
)
static

Find the sigmaUVW value for the detector geometry.

Parameters
pandorathe associated pandora instance
maxSigmaDiscrepancymaximum allowed discrepancy between lar tpc sigmaUVW values

Definition at line 500 of file LArGeometryHelper.cc.

Referenced by lar_content::ThreeDHitCreationAlgorithm::GetChi2WrtFit(), lar_content::ThreeDHitCreationAlgorithm::GetHitMovementChi2(), lar_content::ThreeDHitCreationAlgorithm::RefineHitPositions(), and lar_content::HitCreationBaseTool::~HitCreationBaseTool().

501 {
502  const LArTPCMap &larTPCMap(pandora.GetGeometry()->GetLArTPCMap());
503 
504  if (larTPCMap.empty())
505  {
506  std::cout << "LArGeometryHelper::GetSigmaUVW - LArTPC description not registered with Pandora as required " << std::endl;
507  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
508  }
509 
510  const LArTPC *const pFirstLArTPC(larTPCMap.begin()->second);
511  const float sigmaUVW(pFirstLArTPC->GetSigmaUVW());
512 
513  for (const LArTPCMap::value_type &mapEntry : larTPCMap)
514  {
515  const LArTPC *const pLArTPC(mapEntry.second);
516 
517  if (std::fabs(sigmaUVW - pLArTPC->GetSigmaUVW()) > maxSigmaDiscrepancy)
518  {
519  std::cout << "LArGeometryHelper::GetSigmaUVW - Plugin does not support provided LArTPC configurations " << std::endl;
520  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
521  }
522  }
523 
524  return sigmaUVW;
525 }
CartesianVector lar_content::LArGeometryHelper::GetWireAxis ( const pandora::Pandora &  pandora,
const pandora::HitType  view 
)
static

Return the wire axis (vector perpendicular to the wire direction and drift direction)

Parameters
pandorathe associated pandora instance
viewthe 2D projection

Definition at line 375 of file LArGeometryHelper.cc.

References f.

376 {
377  if (view == TPC_VIEW_U)
378  {
379  return CartesianVector(0.f,
380  pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoU(1.f, 0.f),
381  pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoU(0.f, 1.f));
382  }
383 
384  else if (view == TPC_VIEW_V)
385  {
386  return CartesianVector(0.f,
387  pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoV(1.f, 0.f),
388  pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoV(0.f, 1.f));
389  }
390 
391  else if (view == TPC_VIEW_W)
392  {
393  return CartesianVector(0.f,
394  pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoW(1.f, 0.f),
395  pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoW(0.f, 1.f));
396  }
397 
398  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
399 }
TFile f
Definition: plotHisto.C:6
float lar_content::LArGeometryHelper::GetWirePitch ( const pandora::Pandora &  pandora,
const pandora::HitType  view,
const float  maxWirePitchDiscrepancy = 0.01 
)
static

Return the wire pitch.

Parameters
pandorathe associated pandora instance
viewthe 2D projection
maxWirePitchDiscrepancymaximum allowed discrepancy between lar tpc wire pitch values

Definition at line 342 of file LArGeometryHelper.cc.

343 {
344  if (view != TPC_VIEW_U && view != TPC_VIEW_V && view != TPC_VIEW_W)
345  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
346 
347  const LArTPCMap &larTPCMap(pandora.GetGeometry()->GetLArTPCMap());
348 
349  if (larTPCMap.empty())
350  {
351  std::cout << "LArGeometryHelper::GetWirePitch - LArTPC description not registered with Pandora as required " << std::endl;
352  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
353  }
354 
355  const LArTPC *const pFirstLArTPC(larTPCMap.begin()->second);
356  const float wirePitch(view == TPC_VIEW_U ? pFirstLArTPC->GetWirePitchU() : (view == TPC_VIEW_V ? pFirstLArTPC->GetWirePitchV() : pFirstLArTPC->GetWirePitchW()));
357 
358  for (const LArTPCMap::value_type &mapEntry : larTPCMap)
359  {
360  const LArTPC *const pLArTPC(mapEntry.second);
361  const float alternateWirePitch(view == TPC_VIEW_U ? pLArTPC->GetWirePitchU() : (view == TPC_VIEW_V ? pLArTPC->GetWirePitchV() : pLArTPC->GetWirePitchW()));
362 
363  if (std::fabs(wirePitch - alternateWirePitch) > maxWirePitchDiscrepancy)
364  {
365  std::cout << "LArGeometryHelper::GetWirePitch - LArTPC configuration not supported" << std::endl;
366  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
367  }
368  }
369 
370  return wirePitch;
371 }
float lar_content::LArGeometryHelper::GetWireZPitch ( const pandora::Pandora &  pandora,
const float  maxWirePitchDiscrepancy = 0.01 
)
inlinestatic

Return the wire pitch.

Parameters
pandorathe associated pandora instance
maxWirePitchDiscrepancymaximum allowed discrepancy between lar tpc wire pitch value in the w view

Definition at line 260 of file LArGeometryHelper.h.

Referenced by lar_content::ThreeDShowersAlgorithm::AddToSlidingFitCache(), lar_content::ThreeDTracksBaseAlgorithm< T >::AddToSlidingFitCache(), lar_content::CandidateVertexCreationAlgorithm::AddToSlidingFitCache(), lar_content::DeltaRayMatchingAlgorithm::AreClustersMatched(), lar_content::CosmicRayVertexBuildingAlgorithm::BuildPointingClusterMap(), lar_content::NeutrinoDaughterVerticesAlgorithm::BuildPointingClusterMap(), lar_content::TrackHitsBaseTool::BuildSlidingFitMap(), lar_content::CosmicRaySplittingAlgorithm::BuildSlidingFitResultMap(), lar_content::TwoDSlidingFitMultiSplitAlgorithm::BuildSlidingFitResultMap(), lar_content::CosmicRayTrackRecoveryAlgorithm::BuildSlidingFitResultMap(), lar_content::VertexBasedPfoRecoveryAlgorithm::BuildSlidingFitResultMap(), lar_content::TwoDSlidingFitSplittingAndSwitchingAlgorithm::BuildSlidingFitResultMap(), lar_content::TwoDSlidingFitSplittingAndSplicingAlgorithm::BuildSlidingFitResultMap(), lar_content::TwoDSlidingFitConsolidationAlgorithm::BuildSlidingLinearFits(), lar_content::VertexSelectionBaseAlgorithm::CalculateClusterSlidingFits(), lar_content::ParticleRecoveryAlgorithm::CalculateEffectiveSpan(), lar_content::SvmVertexSelectionAlgorithm::CalculateShowerClusterList(), lar_content::TwoDLinearFitFeatureTool::CalculateVariablesSlidingLinearFit(), lar_content::ThreeDLinearFitFeatureTool::CalculateVariablesSlidingLinearFit(), lar_content::ConeClusterMopUpAlgorithm::ClusterMopUp(), lar_content::BoundedClusterMopUpAlgorithm::ClusterMopUp(), lar_content::CutPfoCharacterisationAlgorithm::CutPfoCharacterisationAlgorithm(), lar_content::SlidingConePfoMopUpAlgorithm::GetClusterMergeMap(), lar_content::SlidingConeClusterMopUpAlgorithm::GetClusterMergeMap(), lar_content::EventSlicingTool::GetClusterSliceList(), lar_content::NeutrinoHierarchyAlgorithm::GetInitialPfoInfoMap(), lar_content::ThreeDTrackFragmentsAlgorithm::GetProjectedPositions(), lar_content::CutClusterCharacterisationAlgorithm::GetShowerFitWidth(), lar_content::MissingTrackSegmentTool::GetSlidingFitResultMap(), lar_content::CutClusterCharacterisationAlgorithm::IsClearTrack(), lar_content::ThreeDHitCreationAlgorithm::IterativeTreatment(), lar_content::LArParticleIdPlugins::LArMuonId::LArMuonId(), lar_content::CrossGapsAssociationAlgorithm::PopulateClusterAssociationMap(), lar_content::TwoDShowerFitFeatureTool::Run(), lar_content::TwoDVertexDistanceFeatureTool::Run(), and lar_content::TwoDSlidingFitSplittingAlgorithm::TwoDSlidingFitSplittingAlgorithm().

261 {
262  return LArGeometryHelper::GetWirePitch(pandora, pandora::TPC_VIEW_W, maxWirePitchWDiscrepancy);
263 }
static float GetWirePitch(const pandora::Pandora &pandora, const pandora::HitType view, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
bool lar_content::LArGeometryHelper::IsInGap ( const pandora::Pandora &  pandora,
const pandora::CartesianVector &  testPoint2D,
const pandora::HitType  hitType,
const float  gapTolerance = 0.f 
)
static

Whether a 2D test point lies in a registered gap with the associated hit type.

Parameters
pandorathe associated pandora instance
testPointthe test point
hitTypethe hit type
gapTolerancethe gap tolerance
Returns
boolean

Definition at line 403 of file LArGeometryHelper.cc.

Referenced by lar_content::CrossGapsExtensionAlgorithm::BuildPointingClusterList(), lar_content::TracksCrossingGapsTool::CheckXPositionInGap(), and lar_content::CrossGapsAssociationAlgorithm::IsAssociated().

404 {
405  // ATTN: input test point MUST be a 2D position vector
406  for (const DetectorGap *const pDetectorGap : pandora.GetGeometry()->GetDetectorGapList())
407  {
408  if (pDetectorGap->IsInGap(testPoint2D, hitType, gapTolerance))
409  return true;
410  }
411 
412  return false;
413 }
bool lar_content::LArGeometryHelper::IsInGap3D ( const pandora::Pandora &  pandora,
const pandora::CartesianVector &  testPoint3D,
const pandora::HitType  hitType,
const float  gapTolerance = 0.f 
)
static

Whether a 3D test point lies in a registered gap with the associated hit type.

Parameters
pandorathe associated pandora instance
testPointthe test point
hitTypethe hit type
gapTolerancethe gap tolerance
Returns
boolean

Definition at line 417 of file LArGeometryHelper.cc.

Referenced by lar_content::VertexSelectionBaseAlgorithm::IsVertexInGap().

418 {
419  const CartesianVector testPoint2D(LArGeometryHelper::ProjectPosition(pandora, testPoint3D, hitType));
420  return LArGeometryHelper::IsInGap(pandora, testPoint2D, hitType, gapTolerance);
421 }
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 bool IsInGap(const pandora::Pandora &pandora, const pandora::CartesianVector &testPoint2D, const pandora::HitType hitType, const float gapTolerance=0.f)
Whether a 2D test point lies in a registered gap with the associated hit type.
bool lar_content::LArGeometryHelper::IsXSamplingPointInGap ( const pandora::Pandora &  pandora,
const float  xSample,
const TwoDSlidingFitResult slidingFitResult,
const float  gapTolerance = 0.f 
)
static

Whether there is a gap in a cluster (described via its sliding fit result) at a specified x sampling position.

Parameters
pandorathe associated pandora instance
xSamplethe x sampling position
slidingFitResultthe sliding fit result for a cluster
gapTolerancethe gap tolerance
Returns
boolean

Definition at line 425 of file LArGeometryHelper.cc.

References f, lar_content::TwoDSlidingFitResult::GetCluster(), lar_content::TwoDSlidingFitResult::GetGlobalFitPositionAtX(), lar_content::TwoDSlidingFitResult::GetGlobalMaxLayerDirection(), lar_content::TwoDSlidingFitResult::GetGlobalMaxLayerPosition(), lar_content::TwoDSlidingFitResult::GetGlobalMinLayerDirection(), and lar_content::TwoDSlidingFitResult::GetGlobalMinLayerPosition().

Referenced by lar_content::ParticleRecoveryAlgorithm::CalculateEffectiveSpan(), and lar_content::TracksCrossingGapsTool::CheckXPositionInGap().

427 {
428  const HitType hitType(LArClusterHelper::GetClusterHitType(slidingFitResult.GetCluster()));
429  const CartesianVector minLayerPosition(slidingFitResult.GetGlobalMinLayerPosition());
430  const CartesianVector maxLayerPosition(slidingFitResult.GetGlobalMaxLayerPosition());
431 
432  const bool minLayerIsAtLowX(minLayerPosition.GetX() < maxLayerPosition.GetX());
433  const CartesianVector &lowXCoordinate(minLayerIsAtLowX ? minLayerPosition : maxLayerPosition);
434  const CartesianVector &highXCoordinate(minLayerIsAtLowX ? maxLayerPosition : minLayerPosition);
435 
436  if ((xSample > lowXCoordinate.GetX()) && (xSample < highXCoordinate.GetX()))
437  {
438  CartesianVector slidingFitPosition(0.f, 0.f, 0.f);
439 
440  if (STATUS_CODE_SUCCESS == slidingFitResult.GetGlobalFitPositionAtX(xSample, slidingFitPosition))
441  return (LArGeometryHelper::IsInGap(pandora, slidingFitPosition, hitType, gapTolerance));
442  }
443 
444  const CartesianVector lowXDirection(minLayerIsAtLowX ? slidingFitResult.GetGlobalMinLayerDirection() : slidingFitResult.GetGlobalMaxLayerDirection());
445  const CartesianVector highXDirection(minLayerIsAtLowX ? slidingFitResult.GetGlobalMaxLayerDirection() : slidingFitResult.GetGlobalMinLayerDirection());
446 
447  const bool sampleIsNearerToLowX(std::fabs(xSample - lowXCoordinate.GetX()) < std::fabs(xSample - highXCoordinate.GetX()));
448  const CartesianVector &startPosition(sampleIsNearerToLowX ? lowXCoordinate : highXCoordinate);
449  const CartesianVector &startDirection(sampleIsNearerToLowX ? lowXDirection : highXDirection);
450 
451  if (std::fabs(startDirection.GetX()) < std::numeric_limits<float>::epsilon())
452  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
453 
454  const float pathLength((xSample - startPosition.GetX()) / startDirection.GetX());
455  const CartesianVector samplingPoint(startPosition + startDirection * pathLength);
456 
457  return (LArGeometryHelper::IsInGap(pandora, samplingPoint, hitType, gapTolerance));
458 }
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
static bool IsInGap(const pandora::Pandora &pandora, const pandora::CartesianVector &testPoint2D, const pandora::HitType hitType, const float gapTolerance=0.f)
Whether a 2D test point lies in a registered gap with the associated hit type.
TFile f
Definition: plotHisto.C:6
static void lar_content::LArGeometryHelper::MergeThreePositions ( const pandora::Pandora &  pandora,
const pandora::HitType  view1,
const pandora::HitType  view2,
const pandora::HitType  view3,
const pandora::CartesianVector &  position1,
const pandora::CartesianVector &  position2,
const pandora::CartesianVector &  position3,
pandora::CartesianVector &  outputU,
pandora::CartesianVector &  outputV,
pandora::CartesianVector &  outputW,
float &  chiSquared 
)
static

Merge 2D positions from three views to give unified 2D positions for each view.

Parameters
pandorathe associated pandora instance
view1the first view
view2the second view
view3the third view
position1the position in the first view
position2the position in the second view
position3the position in the third view
positionUoutput position in the U view
positionVoutput position in the V view
positionWoutput position in the W view
chi-squared

Referenced by lar_content::ThreeDLongitudinalTracksAlgorithm::ThreeDLongitudinalTracksAlgorithm().

static void lar_content::LArGeometryHelper::MergeThreePositions ( const pandora::Pandora &  pandora,
const pandora::CartesianVector &  positionU,
const pandora::CartesianVector &  positionV,
const pandora::CartesianVector &  positionW,
pandora::CartesianVector &  outputU,
pandora::CartesianVector &  outputV,
pandora::CartesianVector &  outputW,
float &  chiSquared 
)
static

Merge 2D positions from three views to give unified 2D positions for each view.

Parameters
pandorathe associated pandora instance
positionUinput position in the U view
positionVinput position in the V view
positionWinput position in the W view
positionUoutput position in the U view
positionVoutput position in the V view
positionWoutput position in the W view
chi-squared
void lar_content::LArGeometryHelper::MergeThreePositions3D ( const pandora::Pandora &  pandora,
const pandora::HitType  view1,
const pandora::HitType  view2,
const pandora::HitType  view3,
const pandora::CartesianVector &  position1,
const pandora::CartesianVector &  position2,
const pandora::CartesianVector &  position3,
pandora::CartesianVector &  position3D,
float &  chiSquared 
)
static

Merge 2D positions from three views to give unified 3D position.

Parameters
pandorathe associated pandora instance
view1the first view
view2the second view
view3the third view
position1the position in the first view
position2the position in the second view
position3the position in the third view
position3Doutput position in 3D
chi-squared

Definition at line 286 of file LArGeometryHelper.cc.

References f.

Referenced by lar_content::UndershootTracksTool::IsThreeDKink(), lar_content::OvershootTracksTool::IsThreeDKink(), and lar_content::VertexBasedPfoRecoveryAlgorithm::MatchTwoViews().

288 {
289  CartesianVector positionU(0.f, 0.f, 0.f), positionV(0.f, 0.f, 0.f), positionW(0.f, 0.f, 0.f);
290  LArGeometryHelper::MergeThreePositions(pandora, view1, view2, view3, position1, position2, position3, positionU, positionV, positionW, chiSquared);
291 
292  position3D.SetValues(positionW.GetX(), pandora.GetPlugins()->GetLArTransformationPlugin()->UVtoY(positionU.GetZ(),positionV.GetZ()),
293  pandora.GetPlugins()->GetLArTransformationPlugin()->UVtoZ(positionU.GetZ(),positionV.GetZ()));
294 }
TFile f
Definition: plotHisto.C:6
static void MergeThreePositions(const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const pandora::HitType view3, const pandora::CartesianVector &position1, const pandora::CartesianVector &position2, const pandora::CartesianVector &position3, pandora::CartesianVector &outputU, pandora::CartesianVector &outputV, pandora::CartesianVector &outputW, float &chiSquared)
Merge 2D positions from three views to give unified 2D positions for each view.
CartesianVector lar_content::LArGeometryHelper::MergeTwoDirections ( const pandora::Pandora &  pandora,
const pandora::HitType  view1,
const pandora::HitType  view2,
const pandora::CartesianVector &  direction1,
const pandora::CartesianVector &  direction2 
)
static

Merge two views (U,V) to give a third view (Z).

Parameters
pandorathe associated pandora instance
view1the first view
view2the second view
direction1the direction in the first view
direction2the direction in the second view

Definition at line 71 of file LArGeometryHelper.cc.

References f, Z1, and Z2.

73 {
74  // x components must be consistent
75  if (direction1.GetX() * direction2.GetX() < 0.f)
76  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
77 
78  // scale x components to a common value
79  const float s1((std::fabs(direction1.GetX()) > std::numeric_limits<float>::epsilon()) ? 100.f * std::fabs(direction2.GetX()) : 1.f);
80  const float s2((std::fabs(direction2.GetX()) > std::numeric_limits<float>::epsilon()) ? 100.f * std::fabs(direction1.GetX()) : 1.f);
81 
82  float pX(s1 * direction1.GetX()), pU(0.f), pV(0.f), pW(0.f);
83  HitType newView(HIT_CUSTOM);
84 
85  if ((view1 == TPC_VIEW_U) && (view2 == TPC_VIEW_V))
86  {
87  pU = s1 * direction1.GetZ(); pV = s2 * direction2.GetZ(); newView = TPC_VIEW_W;
88  }
89 
90  if ((view1 == TPC_VIEW_V) && (view2 == TPC_VIEW_U))
91  {
92  pV = s1 * direction1.GetZ(); pU = s2 * direction2.GetZ(); newView = TPC_VIEW_W;
93  }
94 
95  if ((view1 == TPC_VIEW_W) && (view2 == TPC_VIEW_U))
96  {
97  pW = s1 * direction1.GetZ(); pU = s2 * direction2.GetZ(); newView = TPC_VIEW_V;
98  }
99 
100  if ((view1 == TPC_VIEW_U) && (view2 == TPC_VIEW_W))
101  {
102  pU = s1 * direction1.GetZ(); pW = s2 * direction2.GetZ(); newView = TPC_VIEW_V;
103  }
104 
105  if ((view1 == TPC_VIEW_V) && (view2 == TPC_VIEW_W))
106  {
107  pV = s1 * direction1.GetZ(); pW = s2 * direction2.GetZ(); newView = TPC_VIEW_U;
108  }
109 
110  if ((view1 == TPC_VIEW_W) && (view2 == TPC_VIEW_V))
111  {
112  pW = s1 * direction1.GetZ(); pV = s2 * direction2.GetZ(); newView = TPC_VIEW_U;
113  }
114 
115  if (newView == TPC_VIEW_W)
116  return CartesianVector(pX, 0.f, pandora.GetPlugins()->GetLArTransformationPlugin()->UVtoW(pU, pV)).GetUnitVector();
117 
118  if (newView == TPC_VIEW_U)
119  return CartesianVector(pX, 0.f, pandora.GetPlugins()->GetLArTransformationPlugin()->VWtoU(pV, pW)).GetUnitVector();
120 
121  if (newView == TPC_VIEW_V)
122  return CartesianVector(pX, 0.f, pandora.GetPlugins()->GetLArTransformationPlugin()->WUtoV(pW, pU)).GetUnitVector();
123 
124  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
125 }
TFile f
Definition: plotHisto.C:6
static void lar_content::LArGeometryHelper::MergeTwoPositions ( const pandora::Pandora &  pandora,
const pandora::HitType  view1,
const pandora::HitType  view2,
const pandora::CartesianVector &  position1,
const pandora::CartesianVector &  position2,
pandora::CartesianVector &  position3,
float &  chiSquared 
)
static

Merge 2D positions from two views to give 2D position in third view.

Parameters
pandorathe associated pandora instance
view1the first view
view2the second view
position1the position in the first view
position2the position in the second view
position3output position in the third view
chi-squared
static void lar_content::LArGeometryHelper::MergeTwoPositions ( const pandora::Pandora &  pandora,
const pandora::HitType  view1,
const pandora::HitType  view2,
const pandora::CartesianVector &  position1,
const pandora::CartesianVector &  position2,
pandora::CartesianVector &  outputU,
pandora::CartesianVector &  outputV,
pandora::CartesianVector &  outputW,
float &  chiSquared 
)
static

Merge 2D positions from two views to give 2D position in third view.

Parameters
view1the first view
view2the second view
position1the position in the first view
position2the position in the second view
positionUoutput position in the U view
positionVoutput position in the V view
positionWoutput position in the W view
chi-squared
void lar_content::LArGeometryHelper::MergeTwoPositions3D ( const pandora::Pandora &  pandora,
const pandora::HitType  view1,
const pandora::HitType  view2,
const pandora::CartesianVector &  position1,
const pandora::CartesianVector &  position2,
pandora::CartesianVector &  position3D,
float &  chiSquared 
)
static

Merge 2D positions from two views to give unified 3D position.

Parameters
pandorathe associated pandora instance
view1the first view
view2the second view
position1the position in the first view
position2the position in the second view
position3Doutput position in 3D
chi-squared

Definition at line 274 of file LArGeometryHelper.cc.

References f.

Referenced by lar_content::CandidateVertexCreationAlgorithm::CreateCrossingVertices(), lar_content::CandidateVertexCreationAlgorithm::CreateEndpointVertex(), lar_content::ThreeDTrackFragmentsAlgorithm::GetProjectedPositions(), lar_content::VertexBasedPfoRecoveryAlgorithm::MatchTwoViews(), lar_content::ThreeDLongitudinalTracksAlgorithm::ThreeDLongitudinalTracksAlgorithm(), lar_content::LongitudinalTrackHitsBaseTool::UpdateBestPosition(), and lar_content::HitCreationBaseTool::~HitCreationBaseTool().

276 {
277  CartesianVector positionU(0.f, 0.f, 0.f), positionV(0.f, 0.f, 0.f), positionW(0.f, 0.f, 0.f);
278  LArGeometryHelper::MergeTwoPositions(pandora, view1, view2, position1, position2, positionU, positionV, positionW, chiSquared);
279 
280  position3D.SetValues(positionW.GetX(), pandora.GetPlugins()->GetLArTransformationPlugin()->UVtoY(positionU.GetZ(),positionV.GetZ()),
281  pandora.GetPlugins()->GetLArTransformationPlugin()->UVtoZ(positionU.GetZ(),positionV.GetZ()) );
282 }
TFile f
Definition: plotHisto.C:6
static float MergeTwoPositions(const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const float position1, const float position2)
Merge two views (U,V) to give a third view (Z).
CartesianVector lar_content::LArGeometryHelper::ProjectDirection ( const pandora::Pandora &  pandora,
const pandora::CartesianVector &  direction3D,
const pandora::HitType  view 
)
static

Project 3D direction into a given 2D view.

Parameters
pandorathe associated pandora instance
direction3Dthe direction in 3D
viewthe 2D projection

Definition at line 320 of file LArGeometryHelper.cc.

321 {
322  if (view == TPC_VIEW_U)
323  {
324  return CartesianVector(direction3D.GetX(), 0.f, pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoU(direction3D.GetY(), direction3D.GetZ())).GetUnitVector();
325  }
326 
327  else if (view == TPC_VIEW_V)
328  {
329  return CartesianVector(direction3D.GetX(), 0.f, pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoV(direction3D.GetY(), direction3D.GetZ())).GetUnitVector();
330  }
331 
332  else if (view == TPC_VIEW_W)
333  {
334  return CartesianVector(direction3D.GetX(), 0.f, pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoW(direction3D.GetY(), direction3D.GetZ())).GetUnitVector();
335  }
336 
337  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
338 }
CartesianVector lar_content::LArGeometryHelper::ProjectPosition ( const pandora::Pandora &  pandora,
const pandora::CartesianVector &  position3D,
const pandora::HitType  view 
)
static

Project 3D position into a given 2D view.

Parameters
pandorathe associated pandora instance
position3Dthe position in 3D
viewthe 2D projection

Definition at line 298 of file LArGeometryHelper.cc.

Referenced by lar_content::SplitShowersTool::CheckClusterVertexRelations(), lar_content::ConeClusterMopUpAlgorithm::ClusterMopUp(), lar_content::NearbyClusterMopUpAlgorithm::ClusterMopUp(), lar_content::RPhiFeatureTool::FillKernelEstimate(), lar_content::VertexSplittingAlgorithm::FindBestSplitPosition(), lar_content::ShowerGrowingAlgorithm::GetAllVertexSeedCandidates(), lar_content::VertexBasedPfoMopUpAlgorithm::GetClusterAssociation(), lar_content::SlidingConeClusterMopUpAlgorithm::GetClusterMergeMap(), lar_content::ShowerGrowingAlgorithm::GetFigureOfMerit(), lar_content::ThreeDHitCreationAlgorithm::GetHitMovementChi2(), lar_content::VertexBasedPfoMopUpAlgorithm::GetInputPfos(), lar_content::EventSlicingTool::GetKDTreeEntries3D(), lar_content::ThreeDTrackFragmentsAlgorithm::GetProjectedPositions(), lar_content::LongitudinalTrackHitsBaseTool::GetVertexAndEndPositions(), lar_content::CutClusterCharacterisationAlgorithm::GetVertexDistance(), lar_content::VertexSelectionBaseAlgorithm::IsVertexOnHit(), lar_content::VertexBasedPfoRecoveryAlgorithm::MatchTwoViews(), lar_content::ThreeDChargeFeatureTool::OrderCaloHitsByDistanceToVertex(), lar_content::EnergyKickFeatureTool::Run(), lar_content::GlobalAsymmetryFeatureTool::Run(), lar_content::LocalAsymmetryFeatureTool::Run(), lar_content::ShowerAsymmetryFeatureTool::Run(), lar_content::VertexBasedPfoRecoveryAlgorithm::SelectVertexClusters(), and lar_content::ThreeDLongitudinalTracksAlgorithm::ThreeDLongitudinalTracksAlgorithm().

299 {
300  if (view == TPC_VIEW_U)
301  {
302  return CartesianVector(position3D.GetX(), 0.f, pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoU(position3D.GetY(), position3D.GetZ()));
303  }
304 
305  else if (view == TPC_VIEW_V)
306  {
307  return CartesianVector(position3D.GetX(), 0.f, pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoV(position3D.GetY(), position3D.GetZ()));
308  }
309 
310  else if (view == TPC_VIEW_W)
311  {
312  return CartesianVector(position3D.GetX(), 0.f, pandora.GetPlugins()->GetLArTransformationPlugin()->YZtoW(position3D.GetY(), position3D.GetZ()));
313  }
314 
315  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
316 }

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