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

CosmicRayTaggingTool class. More...

#include "CosmicRayTaggingTool.h"

Inheritance diagram for lar_content::CosmicRayTaggingTool:
lar_content::CosmicRayTaggingBaseTool

Classes

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

Public Member Functions

 CosmicRayTaggingTool ()
 Default constructor. More...
 
pandora::StatusCode Initialize ()
 
void FindAmbiguousPfos (const pandora::PfoList &parentCosmicRayPfos, pandora::PfoList &ambiguousPfos, const MasterAlgorithm *const pAlgorithm)
 Find the list of ambiguous pfos (could represent cosmic-ray muons or neutrinos) More...
 

Private Types

typedef std::list< CRCandidateCRCandidateList
 
typedef std::unordered_map< const pandora::ParticleFlowObject *, pandora::PfoList > PfoToPfoListMap
 
typedef std::unordered_map< const pandora::ParticleFlowObject *, unsigned int > PfoToSliceIdMap
 
typedef std::unordered_map< const pandora::ParticleFlowObject *, bool > PfoToBoolMap
 
typedef std::set< unsigned int > UIntSet
 
typedef std::unordered_map< int, bool > IntBoolMap
 
typedef std::pair< const ThreeDSlidingFitResult, const ThreeDSlidingFitResultSlidingFitPair
 
typedef std::unordered_map< const pandora::ParticleFlowObject *, SlidingFitPairPfoToSlidingFitsMap
 
typedef std::vector< pandora::PfoList > SliceList
 

Private Member Functions

bool GetValid3DCluster (const pandora::ParticleFlowObject *const pPfo, const pandora::Cluster *&pCluster3D) const
 Get the 3D calo hit cluster associated with a given Pfo, and check if it has sufficient hits. More...
 
void GetPfoAssociations (const pandora::PfoList &parentCosmicRayPfos, PfoToPfoListMap &pfoAssociationMap) const
 Get mapping between Pfos that are associated with it other by pointing. More...
 
bool CheckAssociation (const pandora::CartesianVector &endPoint1, const pandora::CartesianVector &endDir1, const pandora::CartesianVector &endPoint2, const pandora::CartesianVector &endDir2) const
 Check whethe two Pfo endpoints are associated by distance of closest approach. More...
 
void SliceEvent (const pandora::PfoList &parentCosmicRayPfos, const PfoToPfoListMap &pfoAssociationMap, PfoToSliceIdMap &pfoToSliceIdMap) const
 Break the event up into slices of associated Pfos. More...
 
void FillSlice (const pandora::ParticleFlowObject *const pPfo, const PfoToPfoListMap &pfoAssociationMap, pandora::PfoList &slice) const
 Fill a slice iteratively using Pfo associations. More...
 
void GetCRCandidates (const pandora::PfoList &parentCosmicRayPfos, const PfoToSliceIdMap &pfoToSliceIdMap, CRCandidateList &candidates) const
 Make a list of CRCandidates. More...
 
void CheckIfInTime (const CRCandidateList &candidates, PfoToBoolMap &pfoToInTimeMap) const
 Check if each candidate is "in time". More...
 
void CheckIfContained (const CRCandidateList &candidates, PfoToBoolMap &pfoToIsContainedMap) const
 Check if each candidate is "contained" (contained = no associations to Y or Z detector faces, but the Pfo could still enter or exit by and X-face) More...
 
void CheckIfTopToBottom (const CRCandidateList &candidates, PfoToBoolMap &pfoToIsTopToBottomMap) const
 Check if each candidate is "top to bottom". More...
 
void GetNeutrinoSlices (const CRCandidateList &candidates, const PfoToBoolMap &pfoToInTimeMap, const PfoToBoolMap &pfoToIsContainedMap, UIntSet &neutrinoSliceSet) const
 Get the slice indices which contain a likely neutrino Pfo. More...
 
void TagCRMuons (const CRCandidateList &candidates, const PfoToBoolMap &pfoToInTimeMap, const PfoToBoolMap &pfoToIsTopToBottomMap, const UIntSet &neutrinoSliceSet, PfoToBoolMap &pfoToIsLikelyCRMuonMap) const
 Tag Pfos which are likely to be a CR muon. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

std::string m_cutMode
 Choose a set of cuts using a keyword - "cautious" = remove as few neutrinos as possible "nominal" = optimised to maximise CR removal whilst preserving neutrinos "aggressive" = remove CR muons and allow more neutrinos to be tagged. More...
 
float m_angularUncertainty
 The uncertainty in degrees for the angle of a Pfo. More...
 
float m_positionalUncertainty
 The uncertainty in cm for the position of Pfo endpoint in 3D. More...
 
float m_maxAssociationDist
 The maximum distance from endpoint to point of closest approach, typically a multiple of LAr radiation length. More...
 
unsigned int m_minimumHits
 The minimum number of hits for a Pfo to be considered. More...
 
float m_inTimeMargin
 The maximum distance outside of the physical detector volume that a Pfo may be to still be considered in time. More...
 
float m_inTimeMaxX0
 The maximum pfo x0 (determined from shifted vertex) to allow pfo to still be considered in time. More...
 
float m_marginY
 The minimum distance from a detector Y-face for a Pfo to be associated. More...
 
float m_marginZ
 The minimum distance from a detector Z-face for a Pfo to be associated. More...
 
float m_maxNeutrinoCosTheta
 The maximum cos(theta) that a Pfo can have to be classified as a likely neutrino. More...
 
float m_minCosmicCosTheta
 The minimum cos(theta) that a Pfo can have to be classified as a likely CR muon. More...
 
float m_maxCosmicCurvature
 The maximum curvature that a Pfo can have to be classified as a likely CR muon. More...
 
float m_face_Xa
 Anode X face. More...
 
float m_face_Xc
 Cathode X face. More...
 
float m_face_Yb
 Bottom Y face. More...
 
float m_face_Yt
 Top Y face. More...
 
float m_face_Zu
 Upstream Z face. More...
 
float m_face_Zd
 Downstream Z face. More...
 

Detailed Description

CosmicRayTaggingTool class.

Definition at line 24 of file CosmicRayTaggingTool.h.

Member Typedef Documentation

Definition at line 69 of file CosmicRayTaggingTool.h.

typedef std::unordered_map<int, bool> lar_content::CosmicRayTaggingTool::IntBoolMap
private

Definition at line 160 of file CosmicRayTaggingTool.h.

typedef std::unordered_map<const pandora::ParticleFlowObject *, bool> lar_content::CosmicRayTaggingTool::PfoToBoolMap
private

Definition at line 133 of file CosmicRayTaggingTool.h.

typedef std::unordered_map<const pandora::ParticleFlowObject *, pandora::PfoList> lar_content::CosmicRayTaggingTool::PfoToPfoListMap
private

Definition at line 81 of file CosmicRayTaggingTool.h.

typedef std::unordered_map<const pandora::ParticleFlowObject *, unsigned int> lar_content::CosmicRayTaggingTool::PfoToSliceIdMap
private

Definition at line 104 of file CosmicRayTaggingTool.h.

typedef std::unordered_map<const pandora::ParticleFlowObject *, SlidingFitPair> lar_content::CosmicRayTaggingTool::PfoToSlidingFitsMap
private

Definition at line 188 of file CosmicRayTaggingTool.h.

typedef std::vector<pandora::PfoList> lar_content::CosmicRayTaggingTool::SliceList
private

Definition at line 189 of file CosmicRayTaggingTool.h.

typedef std::set<unsigned int> lar_content::CosmicRayTaggingTool::UIntSet
private

Definition at line 159 of file CosmicRayTaggingTool.h.

Constructor & Destructor Documentation

lar_content::CosmicRayTaggingTool::CosmicRayTaggingTool ( )

Default constructor.

Definition at line 23 of file CosmicRayTaggingTool.cc.

23  :
24  m_cutMode("nominal"),
27  m_maxAssociationDist(3.f * 18.f),
28  m_minimumHits(15),
29  m_inTimeMargin(5.f),
30  m_inTimeMaxX0(1.f),
31  m_marginY(20.f),
32  m_marginZ(10.f),
36  m_face_Xa(0.f),
37  m_face_Xc(0.f),
38  m_face_Yb(0.f),
39  m_face_Yt(0.f),
40  m_face_Zu(0.f),
41  m_face_Zd(0.f)
42 {
43 }
float m_maxNeutrinoCosTheta
The maximum cos(theta) that a Pfo can have to be classified as a likely neutrino. ...
float m_positionalUncertainty
The uncertainty in cm for the position of Pfo endpoint in 3D.
float m_angularUncertainty
The uncertainty in degrees for the angle of a Pfo.
std::string m_cutMode
Choose a set of cuts using a keyword - "cautious" = remove as few neutrinos as possible "nominal" = o...
TFile f
Definition: plotHisto.C:6
float m_inTimeMaxX0
The maximum pfo x0 (determined from shifted vertex) to allow pfo to still be considered in time...
float m_inTimeMargin
The maximum distance outside of the physical detector volume that a Pfo may be to still be considered...
float m_minCosmicCosTheta
The minimum cos(theta) that a Pfo can have to be classified as a likely CR muon.
float m_marginZ
The minimum distance from a detector Z-face for a Pfo to be associated.
float m_marginY
The minimum distance from a detector Y-face for a Pfo to be associated.
float m_maxCosmicCurvature
The maximum curvature that a Pfo can have to be classified as a likely CR muon.
float m_maxAssociationDist
The maximum distance from endpoint to point of closest approach, typically a multiple of LAr radiatio...
unsigned int m_minimumHits
The minimum number of hits for a Pfo to be considered.

Member Function Documentation

bool lar_content::CosmicRayTaggingTool::CheckAssociation ( const pandora::CartesianVector &  endPoint1,
const pandora::CartesianVector &  endDir1,
const pandora::CartesianVector &  endPoint2,
const pandora::CartesianVector &  endDir2 
) const
private

Check whethe two Pfo endpoints are associated by distance of closest approach.

Parameters
endPoint1position vector of an endpoint of Pfo 1
endDir1direction vector of an endpoint of Pfo 1
endPoint2position vector of an endpoint of Pfo 2
endDir2direction vector of an endpoint of Pfos
Returns
whether the Pfos are associated

Definition at line 220 of file CosmicRayTaggingTool.cc.

References d, f, m_angularUncertainty, m_face_Xa, m_face_Xc, m_face_Yb, m_face_Yt, m_face_Zd, m_face_Zu, m_maxAssociationDist, m_positionalUncertainty, and n.

Referenced by GetPfoAssociations().

222 {
223  // TODO This function needs significant tidying and checks (variable names must be self describing, check deltaTheta, etc.)
224  const CartesianVector n(endDir1.GetUnitVector());
225  const CartesianVector m(endDir2.GetUnitVector());
226  const CartesianVector a(endPoint2 - endPoint1);
227  const float b(n.GetDotProduct(m));
228 
229  // Parallel lines never meet
230  if (std::fabs(b - 1.f) < std::numeric_limits<float>::epsilon())
231  return false;
232 
233  // Distance from endPoint1 along endDir1 to the point of closest approach
234  const float lambda((n - m * b).GetDotProduct(a) / (1.f - b * b));
235 
236  // Distance from endPoint2 along endDir2 to the point of closest approach
237  const float mu((n * b - m).GetDotProduct(a) / (1.f - b * b));
238 
239  // Calculate the maximum "vertex uncertainty"
240  const float deltaTheta(m_angularUncertainty * M_PI / 180.f);
241  const float maxVertexUncertainty(m_maxAssociationDist * std::sin(deltaTheta) + m_positionalUncertainty);
242 
243  // Ensure that the distances to the point of closest approch are within the limits
244  if ((lambda < -maxVertexUncertainty) || (mu < -maxVertexUncertainty) || (lambda > m_maxAssociationDist + maxVertexUncertainty) ||
245  (mu > m_maxAssociationDist + maxVertexUncertainty))
246  {
247  return false;
248  }
249 
250  // Ensure point of closest approach is within detector
251  const CartesianVector impactPosition((endPoint1 + n * lambda + endPoint2 + m * mu) * 0.5f);
252 
253  if ((impactPosition.GetX() < m_face_Xa - maxVertexUncertainty) || (impactPosition.GetX() > m_face_Xc + maxVertexUncertainty) ||
254  (impactPosition.GetY() < m_face_Yb - maxVertexUncertainty) || (impactPosition.GetY() > m_face_Yt + maxVertexUncertainty) ||
255  (impactPosition.GetZ() < m_face_Zu - maxVertexUncertainty) || (impactPosition.GetZ() > m_face_Zd + maxVertexUncertainty))
256  {
257  return false;
258  }
259 
260  // Compare distance of closest approach and max uncertainty in impact parameter
261  const float maxImpactDist(std::sin(deltaTheta) * (std::fabs(mu) + std::fabs(lambda)) + m_positionalUncertainty);
262  const CartesianVector d(a - n * lambda + m * mu);
263 
264  return (d.GetMagnitude() < maxImpactDist);
265 }
float m_positionalUncertainty
The uncertainty in cm for the position of Pfo endpoint in 3D.
float m_angularUncertainty
The uncertainty in degrees for the angle of a Pfo.
TFile f
Definition: plotHisto.C:6
Float_t d
Definition: plot.C:235
float m_maxAssociationDist
The maximum distance from endpoint to point of closest approach, typically a multiple of LAr radiatio...
Char_t n[5]
void lar_content::CosmicRayTaggingTool::CheckIfContained ( const CRCandidateList candidates,
PfoToBoolMap pfoToIsContainedMap 
) const
private

Check if each candidate is "contained" (contained = no associations to Y or Z detector faces, but the Pfo could still enter or exit by and X-face)

Parameters
candidatesinput list of candidates
pfoToIsContainedMapoutput mapping between candidates Pfos and if they are contained

Definition at line 430 of file CosmicRayTaggingTool.cc.

References m_face_Yb, m_face_Yt, m_face_Zd, m_face_Zu, m_marginY, and m_marginZ.

Referenced by FindAmbiguousPfos().

431 {
432  for (const CRCandidate &candidate : candidates)
433  {
434  const float upperY(
435  (candidate.m_endPoint1.GetY() > candidate.m_endPoint2.GetY()) ? candidate.m_endPoint1.GetY() : candidate.m_endPoint2.GetY());
436  const float lowerY(
437  (candidate.m_endPoint1.GetY() < candidate.m_endPoint2.GetY()) ? candidate.m_endPoint1.GetY() : candidate.m_endPoint2.GetY());
438 
439  const float zAtUpperY(
440  (candidate.m_endPoint1.GetY() > candidate.m_endPoint2.GetY()) ? candidate.m_endPoint1.GetZ() : candidate.m_endPoint2.GetZ());
441  const float zAtLowerY(
442  (candidate.m_endPoint1.GetY() < candidate.m_endPoint2.GetY()) ? candidate.m_endPoint1.GetZ() : candidate.m_endPoint2.GetZ());
443 
444  const bool isContained((upperY < m_face_Yt - m_marginY) && (upperY > m_face_Yb + m_marginY) && (lowerY < m_face_Yt - m_marginY) &&
445  (lowerY > m_face_Yb + m_marginY) && (zAtUpperY < m_face_Zd - m_marginZ) && (zAtUpperY > m_face_Zu + m_marginZ) &&
446  (zAtLowerY < m_face_Zd - m_marginZ) && (zAtLowerY > m_face_Zu + m_marginZ));
447 
448  if (!pfoToIsContainedMap.insert(PfoToBoolMap::value_type(candidate.m_pPfo, isContained)).second)
449  throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
450  }
451 }
float m_marginZ
The minimum distance from a detector Z-face for a Pfo to be associated.
float m_marginY
The minimum distance from a detector Y-face for a Pfo to be associated.
void lar_content::CosmicRayTaggingTool::CheckIfInTime ( const CRCandidateList candidates,
PfoToBoolMap pfoToInTimeMap 
) const
private

Check if each candidate is "in time".

Parameters
candidatesinput list of candidates
pfoToInTimeMapoutput mapping between candidates Pfos and if they are in time

Definition at line 339 of file CosmicRayTaggingTool.cc.

References lar_content::LArPfoHelper::GetCaloHits(), lar_content::LArCaloHit::GetLArTPCVolumeId(), lar_content::LArPfoHelper::GetVertex(), m_face_Xa, m_face_Xc, m_inTimeMargin, and m_inTimeMaxX0.

Referenced by FindAmbiguousPfos().

340 {
341  const LArTPCMap &larTPCMap(this->GetPandora().GetGeometry()->GetLArTPCMap());
342 
343  for (const CRCandidate &candidate : candidates)
344  {
345  // Cosmic-ray muons extending outside of (single) physical volume if given t0 is that of the beam particle
346  float minX(std::numeric_limits<float>::max()), maxX(-std::numeric_limits<float>::max());
347 
348  if (candidate.m_canFit)
349  {
350  minX = ((candidate.m_endPoint1.GetX() < candidate.m_endPoint2.GetX()) ? candidate.m_endPoint1.GetX() : candidate.m_endPoint2.GetX());
351  maxX = ((candidate.m_endPoint1.GetX() > candidate.m_endPoint2.GetX()) ? candidate.m_endPoint1.GetX() : candidate.m_endPoint2.GetX());
352  }
353  else
354  {
355  // Handle any particles with small numbers of 3D hits, for which no 3D sliding fit information is available
356  for (const Cluster *const pCluster : candidate.m_pPfo->GetClusterList())
357  {
358  float clusterMinX(std::numeric_limits<float>::max()), clusterMaxX(-std::numeric_limits<float>::max());
359  pCluster->GetClusterSpanX(clusterMinX, clusterMaxX);
360  minX = std::min(clusterMinX, minX);
361  maxX = std::max(clusterMaxX, maxX);
362  }
363  }
364 
365  bool isInTime((minX > m_face_Xa - m_inTimeMargin) && (maxX < m_face_Xc + m_inTimeMargin));
366 
367  // Cosmic-ray muons that have been shifted and stitched across mid plane between volumes
368  if (isInTime)
369  {
370  try
371  {
372  if (std::fabs(LArPfoHelper::GetVertex(candidate.m_pPfo)->GetX0()) > m_inTimeMaxX0)
373  isInTime = false;
374  }
375  catch (const StatusCodeException &)
376  {
377  }
378  }
379 
380  // Cosmic-ray muons extending outside of (any individual) physical volume if given t0 is that of the beam particle
381  if (isInTime)
382  {
383  CaloHitList caloHitList;
384  LArPfoHelper::GetCaloHits(candidate.m_pPfo, TPC_VIEW_U, caloHitList);
385  LArPfoHelper::GetCaloHits(candidate.m_pPfo, TPC_VIEW_V, caloHitList);
386  LArPfoHelper::GetCaloHits(candidate.m_pPfo, TPC_VIEW_W, caloHitList);
387 
388  bool isFirstHit(true);
389  bool isInSingleVolume(true);
390  unsigned int volumeId(std::numeric_limits<unsigned int>::max());
391 
392  for (const CaloHit *const pCaloHit : caloHitList)
393  {
394  const LArCaloHit *const pLArCaloHit(dynamic_cast<const LArCaloHit *>(pCaloHit));
395 
396  if (!pLArCaloHit)
397  continue;
398 
399  if (isFirstHit)
400  {
401  isFirstHit = false;
402  volumeId = pLArCaloHit->GetLArTPCVolumeId();
403  }
404  else if (volumeId != pLArCaloHit->GetLArTPCVolumeId())
405  {
406  isInSingleVolume = false;
407  break;
408  }
409  }
410 
411  LArTPCMap::const_iterator tpcIter(larTPCMap.find(volumeId));
412 
413  if (isInSingleVolume && (larTPCMap.end() != tpcIter))
414  {
415  const float thisFaceXLow(tpcIter->second->GetCenterX() - 0.5f * tpcIter->second->GetWidthX());
416  const float thisFaceXHigh(tpcIter->second->GetCenterX() + 0.5f * tpcIter->second->GetWidthX());
417 
418  if (!((minX > thisFaceXLow - m_inTimeMargin) && (maxX < thisFaceXHigh + m_inTimeMargin)))
419  isInTime = false;
420  }
421  }
422 
423  if (!pfoToInTimeMap.insert(PfoToBoolMap::value_type(candidate.m_pPfo, isInTime)).second)
424  throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
425  }
426 }
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
intermediate_table::const_iterator const_iterator
float m_inTimeMaxX0
The maximum pfo x0 (determined from shifted vertex) to allow pfo to still be considered in time...
float m_inTimeMargin
The maximum distance outside of the physical detector volume that a Pfo may be to still be considered...
static void GetCaloHits(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::CaloHitList &caloHitList)
Get a list of calo hits of a particular hit type from a list of pfos.
void lar_content::CosmicRayTaggingTool::CheckIfTopToBottom ( const CRCandidateList candidates,
PfoToBoolMap pfoToIsTopToBottomMap 
) const
private

Check if each candidate is "top to bottom".

Parameters
candidatesinput list of candidates
pfoToIsTopToBottomMapoutput mapping between candidates Pfos and if they are top to bottom

Definition at line 455 of file CosmicRayTaggingTool.cc.

References m_face_Yb, m_face_Yt, and m_marginY.

Referenced by FindAmbiguousPfos().

456 {
457  for (const CRCandidate &candidate : candidates)
458  {
459  const float upperY(
460  (candidate.m_endPoint1.GetY() > candidate.m_endPoint2.GetY()) ? candidate.m_endPoint1.GetY() : candidate.m_endPoint2.GetY());
461  const float lowerY(
462  (candidate.m_endPoint1.GetY() < candidate.m_endPoint2.GetY()) ? candidate.m_endPoint1.GetY() : candidate.m_endPoint2.GetY());
463 
464  const bool isTopToBottom((upperY > m_face_Yt - m_marginY) && (lowerY < m_face_Yb + m_marginY));
465 
466  if (!pfoToIsTopToBottomMap.insert(PfoToBoolMap::value_type(candidate.m_pPfo, isTopToBottom)).second)
467  throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
468  }
469 }
float m_marginY
The minimum distance from a detector Y-face for a Pfo to be associated.
void lar_content::CosmicRayTaggingTool::FillSlice ( const pandora::ParticleFlowObject *const  pPfo,
const PfoToPfoListMap pfoAssociationMap,
pandora::PfoList &  slice 
) const
private

Fill a slice iteratively using Pfo associations.

Parameters
pPfoPfo to add to the slice
pfoAssociationMapmapping between Pfos and other associated Pfos
slicethe slice to add Pfos to

Definition at line 308 of file CosmicRayTaggingTool.cc.

Referenced by SliceEvent().

309 {
310  if (std::find(slice.begin(), slice.end(), pPfo) != slice.end())
311  return;
312 
313  slice.push_back(pPfo);
314 
315  PfoToPfoListMap::const_iterator iter(pfoAssociationMap.find(pPfo));
316 
317  if (pfoAssociationMap.end() != iter)
318  {
319  for (const ParticleFlowObject *const pAssociatedPfo : iter->second)
320  this->FillSlice(pAssociatedPfo, pfoAssociationMap, slice);
321  }
322 }
intermediate_table::const_iterator const_iterator
void FillSlice(const pandora::ParticleFlowObject *const pPfo, const PfoToPfoListMap &pfoAssociationMap, pandora::PfoList &slice) const
Fill a slice iteratively using Pfo associations.
void lar_content::CosmicRayTaggingTool::FindAmbiguousPfos ( const pandora::PfoList &  parentCosmicRayPfos,
pandora::PfoList &  ambiguousPfos,
const MasterAlgorithm *const  pAlgorithm 
)
virtual

Find the list of ambiguous pfos (could represent cosmic-ray muons or neutrinos)

Parameters
parentCosmicRayPfosthe list of parent cosmic-ray pfos
ambiguousPfosto receive the list of ambiguous pfos
pAlgorithmthe address of this master algorithm

Implements lar_content::CosmicRayTaggingBaseTool.

Definition at line 74 of file CosmicRayTaggingTool.cc.

References CheckIfContained(), CheckIfInTime(), CheckIfTopToBottom(), GetCRCandidates(), GetNeutrinoSlices(), GetPfoAssociations(), m_face_Xa, m_face_Xc, m_face_Yb, m_face_Yt, m_face_Zd, m_face_Zu, SliceEvent(), and TagCRMuons().

75 {
76  if (this->GetPandora().GetSettings()->ShouldDisplayAlgorithmInfo())
77  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
78 
79  // TODO First time only, TODO Refactor with master algorithm
80  const LArTPCMap &larTPCMap(this->GetPandora().GetGeometry()->GetLArTPCMap());
81  const LArTPC *const pFirstLArTPC(larTPCMap.begin()->second);
82 
83  float parentMinX(pFirstLArTPC->GetCenterX() - 0.5f * pFirstLArTPC->GetWidthX());
84  float parentMaxX(pFirstLArTPC->GetCenterX() + 0.5f * pFirstLArTPC->GetWidthX());
85  float parentMinY(pFirstLArTPC->GetCenterY() - 0.5f * pFirstLArTPC->GetWidthY());
86  float parentMaxY(pFirstLArTPC->GetCenterY() + 0.5f * pFirstLArTPC->GetWidthY());
87  float parentMinZ(pFirstLArTPC->GetCenterZ() - 0.5f * pFirstLArTPC->GetWidthZ());
88  float parentMaxZ(pFirstLArTPC->GetCenterZ() + 0.5f * pFirstLArTPC->GetWidthZ());
89 
90  for (const LArTPCMap::value_type &mapEntry : larTPCMap)
91  {
92  const LArTPC *const pLArTPC(mapEntry.second);
93  parentMinX = std::min(parentMinX, pLArTPC->GetCenterX() - 0.5f * pLArTPC->GetWidthX());
94  parentMaxX = std::max(parentMaxX, pLArTPC->GetCenterX() + 0.5f * pLArTPC->GetWidthX());
95  parentMinY = std::min(parentMinY, pLArTPC->GetCenterY() - 0.5f * pLArTPC->GetWidthY());
96  parentMaxY = std::max(parentMaxY, pLArTPC->GetCenterY() + 0.5f * pLArTPC->GetWidthY());
97  parentMinZ = std::min(parentMinZ, pLArTPC->GetCenterZ() - 0.5f * pLArTPC->GetWidthZ());
98  parentMaxZ = std::max(parentMaxZ, pLArTPC->GetCenterZ() + 0.5f * pLArTPC->GetWidthZ());
99  }
100 
101  m_face_Xa = parentMinX;
102  m_face_Xc = parentMaxX;
103  m_face_Yb = parentMinY;
104  m_face_Yt = parentMaxY;
105  m_face_Zu = parentMinZ;
106  m_face_Zd = parentMaxZ;
107 
108  PfoToPfoListMap pfoAssociationMap;
109  this->GetPfoAssociations(parentCosmicRayPfos, pfoAssociationMap);
110 
111  PfoToSliceIdMap pfoToSliceIdMap;
112  this->SliceEvent(parentCosmicRayPfos, pfoAssociationMap, pfoToSliceIdMap);
113 
114  CRCandidateList candidates;
115  this->GetCRCandidates(parentCosmicRayPfos, pfoToSliceIdMap, candidates);
116 
117  PfoToBoolMap pfoToInTimeMap;
118  this->CheckIfInTime(candidates, pfoToInTimeMap);
119 
120  PfoToBoolMap pfoToIsContainedMap;
121  this->CheckIfContained(candidates, pfoToIsContainedMap);
122 
123  PfoToBoolMap pfoToIsTopToBottomMap;
124  this->CheckIfTopToBottom(candidates, pfoToIsTopToBottomMap);
125 
126  UIntSet neutrinoSliceSet;
127  this->GetNeutrinoSlices(candidates, pfoToInTimeMap, pfoToIsContainedMap, neutrinoSliceSet);
128 
129  PfoToBoolMap pfoToIsLikelyCRMuonMap;
130  this->TagCRMuons(candidates, pfoToInTimeMap, pfoToIsTopToBottomMap, neutrinoSliceSet, pfoToIsLikelyCRMuonMap);
131 
132  for (const ParticleFlowObject *const pPfo : parentCosmicRayPfos)
133  {
134  if (!pfoToIsLikelyCRMuonMap.at(pPfo))
135  ambiguousPfos.push_back(pPfo);
136  }
137 }
std::unordered_map< const pandora::ParticleFlowObject *, pandora::PfoList > PfoToPfoListMap
std::unordered_map< const pandora::ParticleFlowObject *, bool > PfoToBoolMap
void TagCRMuons(const CRCandidateList &candidates, const PfoToBoolMap &pfoToInTimeMap, const PfoToBoolMap &pfoToIsTopToBottomMap, const UIntSet &neutrinoSliceSet, PfoToBoolMap &pfoToIsLikelyCRMuonMap) const
Tag Pfos which are likely to be a CR muon.
std::unordered_map< const pandora::ParticleFlowObject *, unsigned int > PfoToSliceIdMap
void SliceEvent(const pandora::PfoList &parentCosmicRayPfos, const PfoToPfoListMap &pfoAssociationMap, PfoToSliceIdMap &pfoToSliceIdMap) const
Break the event up into slices of associated Pfos.
void CheckIfTopToBottom(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsTopToBottomMap) const
Check if each candidate is "top to bottom".
void CheckIfContained(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsContainedMap) const
Check if each candidate is "contained" (contained = no associations to Y or Z detector faces...
std::list< CRCandidate > CRCandidateList
void CheckIfInTime(const CRCandidateList &candidates, PfoToBoolMap &pfoToInTimeMap) const
Check if each candidate is "in time".
void GetPfoAssociations(const pandora::PfoList &parentCosmicRayPfos, PfoToPfoListMap &pfoAssociationMap) const
Get mapping between Pfos that are associated with it other by pointing.
void GetCRCandidates(const pandora::PfoList &parentCosmicRayPfos, const PfoToSliceIdMap &pfoToSliceIdMap, CRCandidateList &candidates) const
Make a list of CRCandidates.
void GetNeutrinoSlices(const CRCandidateList &candidates, const PfoToBoolMap &pfoToInTimeMap, const PfoToBoolMap &pfoToIsContainedMap, UIntSet &neutrinoSliceSet) const
Get the slice indices which contain a likely neutrino Pfo.
void lar_content::CosmicRayTaggingTool::GetCRCandidates ( const pandora::PfoList &  parentCosmicRayPfos,
const PfoToSliceIdMap pfoToSliceIdMap,
CRCandidateList candidates 
) const
private

Make a list of CRCandidates.

Parameters
parentCosmicRayPfosinput list of Pfos
pfoToSliceIdMapinput mapping between Pfos and their slice id
candidatesto receive the output list of CRCandidates

Definition at line 326 of file CosmicRayTaggingTool.cc.

References lar_content::LArPfoHelper::IsFinalState().

Referenced by FindAmbiguousPfos().

327 {
328  for (const ParticleFlowObject *const pPfo : parentCosmicRayPfos)
329  {
330  if (!LArPfoHelper::IsFinalState(pPfo))
331  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
332 
333  candidates.push_back(CRCandidate(this->GetPandora(), pPfo, pfoToSliceIdMap.at(pPfo)));
334  }
335 }
static bool IsFinalState(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a primary parent particle.
void lar_content::CosmicRayTaggingTool::GetNeutrinoSlices ( const CRCandidateList candidates,
const PfoToBoolMap pfoToInTimeMap,
const PfoToBoolMap pfoToIsContainedMap,
UIntSet neutrinoSliceSet 
) const
private

Get the slice indices which contain a likely neutrino Pfo.

Parameters
candidatesinput list of candidates
pfoToInTimeMapinput map between Pfo and if in time
pfoToIsContainedMapinput map between Pfo and if contained
neutrinoSliceSetoutput set of slice indices containing a likely neutrino Pfo

Definition at line 473 of file CosmicRayTaggingTool.cc.

References m_maxNeutrinoCosTheta.

Referenced by FindAmbiguousPfos().

475 {
476  IntBoolMap sliceIdToIsInTimeMap;
477 
478  for (const CRCandidate &candidate : candidates)
479  {
480  if (sliceIdToIsInTimeMap.find(candidate.m_sliceId) == sliceIdToIsInTimeMap.end())
481  sliceIdToIsInTimeMap.insert(std::make_pair(candidate.m_sliceId, true));
482 
483  if (!pfoToInTimeMap.at(candidate.m_pPfo))
484  sliceIdToIsInTimeMap.at(candidate.m_sliceId) = false;
485  }
486 
487  for (const CRCandidate &candidate : candidates)
488  {
489  if (neutrinoSliceSet.count(candidate.m_sliceId))
490  continue;
491 
492  const bool likelyNeutrino(candidate.m_canFit && sliceIdToIsInTimeMap.at(candidate.m_sliceId) &&
493  (candidate.m_theta < m_maxNeutrinoCosTheta || pfoToIsContainedMap.at(candidate.m_pPfo)));
494 
495  if (likelyNeutrino)
496  (void)neutrinoSliceSet.insert(candidate.m_sliceId);
497  }
498 }
float m_maxNeutrinoCosTheta
The maximum cos(theta) that a Pfo can have to be classified as a likely neutrino. ...
std::unordered_map< int, bool > IntBoolMap
void lar_content::CosmicRayTaggingTool::GetPfoAssociations ( const pandora::PfoList &  parentCosmicRayPfos,
PfoToPfoListMap pfoAssociationMap 
) const
private

Get mapping between Pfos that are associated with it other by pointing.

Parameters
parentCosmicRayPfosinput list of Pfos
pfoAssociationsMapto receive the output mapping between associated Pfos

Definition at line 157 of file CosmicRayTaggingTool.cc.

References util::begin(), CheckAssociation(), lar_content::ThreeDSlidingFitResult::GetGlobalMaxLayerDirection(), lar_content::ThreeDSlidingFitResult::GetGlobalMinLayerDirection(), and GetValid3DCluster().

Referenced by FindAmbiguousPfos().

158 {
159  // ATTN If wire w pitches vary between TPCs, exception will be raised in initialisation of lar pseudolayer plugin
160  const LArTPC *const pFirstLArTPC(this->GetPandora().GetGeometry()->GetLArTPCMap().begin()->second);
161  const float layerPitch(pFirstLArTPC->GetWirePitchW());
162 
163  PfoToSlidingFitsMap pfoToSlidingFitsMap;
164 
165  for (const ParticleFlowObject *const pPfo : parentCosmicRayPfos)
166  {
167  const pandora::Cluster *pCluster(nullptr);
168  if (!this->GetValid3DCluster(pPfo, pCluster) || !pCluster)
169  continue;
170 
171  (void)pfoToSlidingFitsMap.insert(PfoToSlidingFitsMap::value_type(pPfo,
172  std::make_pair(ThreeDSlidingFitResult(pCluster, 5, layerPitch), ThreeDSlidingFitResult(pCluster, 100, layerPitch)))); // TODO Configurable
173  }
174 
175  for (const ParticleFlowObject *const pPfo1 : parentCosmicRayPfos)
176  {
177  PfoToSlidingFitsMap::const_iterator iter1(pfoToSlidingFitsMap.find(pPfo1));
178  if (pfoToSlidingFitsMap.end() == iter1)
179  continue;
180 
181  const ThreeDSlidingFitResult &fitPos1(iter1->second.first), &fitDir1(iter1->second.second);
182 
183  for (const ParticleFlowObject *const pPfo2 : parentCosmicRayPfos)
184  {
185  if (pPfo1 == pPfo2)
186  continue;
187 
188  PfoToSlidingFitsMap::const_iterator iter2(pfoToSlidingFitsMap.find(pPfo2));
189  if (pfoToSlidingFitsMap.end() == iter2)
190  continue;
191 
192  const ThreeDSlidingFitResult &fitPos2(iter2->second.first), &fitDir2(iter2->second.second);
193 
194  // TODO Use existing LArPointingClusters and IsEmission/IsNode logic, for consistency
195  if (!(this->CheckAssociation(fitPos1.GetGlobalMinLayerPosition(), fitDir1.GetGlobalMinLayerDirection() * -1.f,
196  fitPos2.GetGlobalMinLayerPosition(), fitDir2.GetGlobalMinLayerDirection() * -1.f) ||
197  this->CheckAssociation(fitPos1.GetGlobalMinLayerPosition(), fitDir1.GetGlobalMinLayerDirection() * -1.f,
198  fitPos2.GetGlobalMaxLayerPosition(), fitDir2.GetGlobalMaxLayerDirection()) ||
199  this->CheckAssociation(fitPos1.GetGlobalMaxLayerPosition(), fitDir1.GetGlobalMaxLayerDirection(),
200  fitPos2.GetGlobalMinLayerPosition(), fitDir2.GetGlobalMinLayerDirection() * -1.f) ||
201  this->CheckAssociation(fitPos1.GetGlobalMaxLayerPosition(), fitDir1.GetGlobalMaxLayerDirection(),
202  fitPos2.GetGlobalMaxLayerPosition(), fitDir2.GetGlobalMaxLayerDirection())))
203  {
204  continue;
205  }
206 
207  PfoList &pfoList1(pfoAssociationMap[pPfo1]), &pfoList2(pfoAssociationMap[pPfo2]);
208 
209  if (pfoList1.end() == std::find(pfoList1.begin(), pfoList1.end(), pPfo2))
210  pfoList1.push_back(pPfo2);
211 
212  if (pfoList2.end() == std::find(pfoList2.begin(), pfoList2.end(), pPfo1))
213  pfoList2.push_back(pPfo1);
214  }
215  }
216 }
bool CheckAssociation(const pandora::CartesianVector &endPoint1, const pandora::CartesianVector &endDir1, const pandora::CartesianVector &endPoint2, const pandora::CartesianVector &endDir2) const
Check whethe two Pfo endpoints are associated by distance of closest approach.
intermediate_table::const_iterator const_iterator
bool GetValid3DCluster(const pandora::ParticleFlowObject *const pPfo, const pandora::Cluster *&pCluster3D) const
Get the 3D calo hit cluster associated with a given Pfo, and check if it has sufficient hits...
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
std::unordered_map< const pandora::ParticleFlowObject *, SlidingFitPair > PfoToSlidingFitsMap
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82
bool lar_content::CosmicRayTaggingTool::GetValid3DCluster ( const pandora::ParticleFlowObject *const  pPfo,
const pandora::Cluster *&  pCluster3D 
) const
private

Get the 3D calo hit cluster associated with a given Pfo, and check if it has sufficient hits.

Parameters
pPfoinput Pfo
pCluster3Dto receive the address of the 3D cluster
Returns
whether the Pfo has sufficient hits?

Definition at line 141 of file CosmicRayTaggingTool.cc.

References lar_content::LArPfoHelper::GetThreeDClusterList(), and m_minimumHits.

Referenced by GetPfoAssociations().

142 {
143  pCluster3D = nullptr;
144  ClusterList clusters3D;
145  LArPfoHelper::GetThreeDClusterList(pPfo, clusters3D);
146 
147  // ATTN Only uses first cluster with hits of type TPC_3D
148  if (clusters3D.empty() || (clusters3D.front()->GetNCaloHits() < m_minimumHits))
149  return false;
150 
151  pCluster3D = clusters3D.front();
152  return true;
153 }
static void GetThreeDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 3D clusters from an input pfo.
unsigned int m_minimumHits
The minimum number of hits for a Pfo to be considered.
StatusCode lar_content::CosmicRayTaggingTool::Initialize ( )

Definition at line 47 of file CosmicRayTaggingTool.cc.

References m_cutMode, m_maxCosmicCurvature, and m_minCosmicCosTheta.

48 {
49  if ("nominal" == m_cutMode)
50  {
51  // Nominal values set in constructor
52  }
53  else if ("cautious" == m_cutMode)
54  {
55  m_minCosmicCosTheta = std::numeric_limits<double>::max();
56  m_maxCosmicCurvature = -std::numeric_limits<double>::max();
57  }
58  else if ("aggressive" == m_cutMode)
59  {
60  m_minCosmicCosTheta = 0.6f;
61  m_maxCosmicCurvature = 0.1f;
62  }
63  else
64  {
65  std::cout << "CosmicRayTaggingTool - invalid cut mode " << m_cutMode << std::endl;
66  return STATUS_CODE_INVALID_PARAMETER;
67  }
68 
69  return STATUS_CODE_SUCCESS;
70 }
std::string m_cutMode
Choose a set of cuts using a keyword - "cautious" = remove as few neutrinos as possible "nominal" = o...
float m_minCosmicCosTheta
The minimum cos(theta) that a Pfo can have to be classified as a likely CR muon.
float m_maxCosmicCurvature
The maximum curvature that a Pfo can have to be classified as a likely CR muon.
StatusCode lar_content::CosmicRayTaggingTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 581 of file CosmicRayTaggingTool.cc.

References m_angularUncertainty, m_cutMode, m_inTimeMargin, m_inTimeMaxX0, m_marginY, m_marginZ, m_maxAssociationDist, m_maxCosmicCurvature, m_maxNeutrinoCosTheta, m_minCosmicCosTheta, m_minimumHits, and m_positionalUncertainty.

582 {
583  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "CutMode", m_cutMode));
584  std::transform(m_cutMode.begin(), m_cutMode.end(), m_cutMode.begin(), ::tolower);
585 
586  PANDORA_RETURN_RESULT_IF_AND_IF(
587  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "AngularUncertainty", m_angularUncertainty));
588 
589  PANDORA_RETURN_RESULT_IF_AND_IF(
590  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PositionalUncertainty", m_positionalUncertainty));
591 
592  PANDORA_RETURN_RESULT_IF_AND_IF(
593  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxAssociationDist", m_maxAssociationDist));
594 
595  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "HitThreshold", m_minimumHits));
596 
597  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "InTimeMargin", m_inTimeMargin));
598 
599  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "InTimeMaxX0", m_inTimeMaxX0));
600 
601  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MarginY", m_marginY));
602 
603  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MarginZ", m_marginZ));
604 
605  PANDORA_RETURN_RESULT_IF_AND_IF(
606  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxNeutrinoCosTheta", m_maxNeutrinoCosTheta));
607 
608  PANDORA_RETURN_RESULT_IF_AND_IF(
609  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinCosmicCosTheta", m_minCosmicCosTheta));
610 
611  PANDORA_RETURN_RESULT_IF_AND_IF(
612  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxCosmicCurvature", m_maxCosmicCurvature));
613 
614  return STATUS_CODE_SUCCESS;
615 }
float m_maxNeutrinoCosTheta
The maximum cos(theta) that a Pfo can have to be classified as a likely neutrino. ...
float m_positionalUncertainty
The uncertainty in cm for the position of Pfo endpoint in 3D.
float m_angularUncertainty
The uncertainty in degrees for the angle of a Pfo.
std::string m_cutMode
Choose a set of cuts using a keyword - "cautious" = remove as few neutrinos as possible "nominal" = o...
float m_inTimeMaxX0
The maximum pfo x0 (determined from shifted vertex) to allow pfo to still be considered in time...
float m_inTimeMargin
The maximum distance outside of the physical detector volume that a Pfo may be to still be considered...
float m_minCosmicCosTheta
The minimum cos(theta) that a Pfo can have to be classified as a likely CR muon.
float m_marginZ
The minimum distance from a detector Z-face for a Pfo to be associated.
float m_marginY
The minimum distance from a detector Y-face for a Pfo to be associated.
float m_maxCosmicCurvature
The maximum curvature that a Pfo can have to be classified as a likely CR muon.
float m_maxAssociationDist
The maximum distance from endpoint to point of closest approach, typically a multiple of LAr radiatio...
unsigned int m_minimumHits
The minimum number of hits for a Pfo to be considered.
void lar_content::CosmicRayTaggingTool::SliceEvent ( const pandora::PfoList &  parentCosmicRayPfos,
const PfoToPfoListMap pfoAssociationMap,
PfoToSliceIdMap pfoToSliceIdMap 
) const
private

Break the event up into slices of associated Pfos.

Parameters
parentCosmicRayPfosinput list of Pfos
pfoAssociationMapmapping between Pfos and other associated Pfos
pfoToSliceIdMapto receive the mapping between Pfos and their slice ID

Definition at line 269 of file CosmicRayTaggingTool.cc.

References FillSlice().

Referenced by FindAmbiguousPfos().

270 {
271  SliceList sliceList;
272 
273  for (const ParticleFlowObject *const pPfo : parentCosmicRayPfos)
274  {
275  bool isAlreadyInSlice(false);
276 
277  for (const PfoList &slice : sliceList)
278  {
279  if (std::find(slice.begin(), slice.end(), pPfo) != slice.end())
280  {
281  isAlreadyInSlice = true;
282  break;
283  }
284  }
285 
286  if (!isAlreadyInSlice)
287  {
288  sliceList.push_back(PfoList());
289  this->FillSlice(pPfo, pfoAssociationMap, sliceList.back());
290  }
291  }
292 
293  unsigned int sliceId(0);
294  for (const PfoList &slice : sliceList)
295  {
296  for (const ParticleFlowObject *const pPfo : slice)
297  {
298  if (!pfoToSliceIdMap.insert(PfoToSliceIdMap::value_type(pPfo, sliceId)).second)
299  throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
300  }
301 
302  ++sliceId;
303  }
304 }
void FillSlice(const pandora::ParticleFlowObject *const pPfo, const PfoToPfoListMap &pfoAssociationMap, pandora::PfoList &slice) const
Fill a slice iteratively using Pfo associations.
std::vector< pandora::PfoList > SliceList
void lar_content::CosmicRayTaggingTool::TagCRMuons ( const CRCandidateList candidates,
const PfoToBoolMap pfoToInTimeMap,
const PfoToBoolMap pfoToIsTopToBottomMap,
const UIntSet neutrinoSliceSet,
PfoToBoolMap pfoToIsLikelyCRMuonMap 
) const
private

Tag Pfos which are likely to be a CR muon.

Parameters
candidatesinput list of candidates
pfoToInTimeMapinput map between Pfo and if in time
pfoToIsTopToBottomMapinput mapping between candidate Pfos and if they are top to bottom
neutrinoSliceSetinput set of slice indices containing a likely neutrino Pfo
pfoToIsLikelyCRMuonMapto receive the output mapping between Pfos and a boolean deciding if they are likely a CR muon

Definition at line 502 of file CosmicRayTaggingTool.cc.

References m_maxCosmicCurvature, and m_minCosmicCosTheta.

Referenced by FindAmbiguousPfos().

504 {
505  for (const CRCandidate &candidate : candidates)
506  {
507  const bool likelyCRMuon(!neutrinoSliceSet.count(candidate.m_sliceId) &&
508  (!pfoToInTimeMap.at(candidate.m_pPfo) ||
509  (candidate.m_canFit &&
510  (pfoToIsTopToBottomMap.at(candidate.m_pPfo) ||
511  ((candidate.m_theta > m_minCosmicCosTheta) && (candidate.m_curvature < m_maxCosmicCurvature))))));
512 
513  if (!pfoToIsLikelyCRMuonMap.insert(PfoToBoolMap::value_type(candidate.m_pPfo, likelyCRMuon)).second)
514  throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
515  }
516 }
float m_minCosmicCosTheta
The minimum cos(theta) that a Pfo can have to be classified as a likely CR muon.
float m_maxCosmicCurvature
The maximum curvature that a Pfo can have to be classified as a likely CR muon.

Member Data Documentation

float lar_content::CosmicRayTaggingTool::m_angularUncertainty
private

The uncertainty in degrees for the angle of a Pfo.

Definition at line 198 of file CosmicRayTaggingTool.h.

Referenced by CheckAssociation(), and ReadSettings().

std::string lar_content::CosmicRayTaggingTool::m_cutMode
private

Choose a set of cuts using a keyword - "cautious" = remove as few neutrinos as possible "nominal" = optimised to maximise CR removal whilst preserving neutrinos "aggressive" = remove CR muons and allow more neutrinos to be tagged.

Definition at line 196 of file CosmicRayTaggingTool.h.

Referenced by Initialize(), and ReadSettings().

float lar_content::CosmicRayTaggingTool::m_face_Xa
private

Anode X face.

Definition at line 212 of file CosmicRayTaggingTool.h.

Referenced by CheckAssociation(), CheckIfInTime(), and FindAmbiguousPfos().

float lar_content::CosmicRayTaggingTool::m_face_Xc
private

Cathode X face.

Definition at line 213 of file CosmicRayTaggingTool.h.

Referenced by CheckAssociation(), CheckIfInTime(), and FindAmbiguousPfos().

float lar_content::CosmicRayTaggingTool::m_face_Yb
private

Bottom Y face.

Definition at line 214 of file CosmicRayTaggingTool.h.

Referenced by CheckAssociation(), CheckIfContained(), CheckIfTopToBottom(), and FindAmbiguousPfos().

float lar_content::CosmicRayTaggingTool::m_face_Yt
private

Top Y face.

Definition at line 215 of file CosmicRayTaggingTool.h.

Referenced by CheckAssociation(), CheckIfContained(), CheckIfTopToBottom(), and FindAmbiguousPfos().

float lar_content::CosmicRayTaggingTool::m_face_Zd
private

Downstream Z face.

Definition at line 217 of file CosmicRayTaggingTool.h.

Referenced by CheckAssociation(), CheckIfContained(), and FindAmbiguousPfos().

float lar_content::CosmicRayTaggingTool::m_face_Zu
private

Upstream Z face.

Definition at line 216 of file CosmicRayTaggingTool.h.

Referenced by CheckAssociation(), CheckIfContained(), and FindAmbiguousPfos().

float lar_content::CosmicRayTaggingTool::m_inTimeMargin
private

The maximum distance outside of the physical detector volume that a Pfo may be to still be considered in time.

Definition at line 204 of file CosmicRayTaggingTool.h.

Referenced by CheckIfInTime(), and ReadSettings().

float lar_content::CosmicRayTaggingTool::m_inTimeMaxX0
private

The maximum pfo x0 (determined from shifted vertex) to allow pfo to still be considered in time.

Definition at line 205 of file CosmicRayTaggingTool.h.

Referenced by CheckIfInTime(), and ReadSettings().

float lar_content::CosmicRayTaggingTool::m_marginY
private

The minimum distance from a detector Y-face for a Pfo to be associated.

Definition at line 206 of file CosmicRayTaggingTool.h.

Referenced by CheckIfContained(), CheckIfTopToBottom(), and ReadSettings().

float lar_content::CosmicRayTaggingTool::m_marginZ
private

The minimum distance from a detector Z-face for a Pfo to be associated.

Definition at line 207 of file CosmicRayTaggingTool.h.

Referenced by CheckIfContained(), and ReadSettings().

float lar_content::CosmicRayTaggingTool::m_maxAssociationDist
private

The maximum distance from endpoint to point of closest approach, typically a multiple of LAr radiation length.

Definition at line 200 of file CosmicRayTaggingTool.h.

Referenced by CheckAssociation(), and ReadSettings().

float lar_content::CosmicRayTaggingTool::m_maxCosmicCurvature
private

The maximum curvature that a Pfo can have to be classified as a likely CR muon.

Definition at line 210 of file CosmicRayTaggingTool.h.

Referenced by Initialize(), ReadSettings(), and TagCRMuons().

float lar_content::CosmicRayTaggingTool::m_maxNeutrinoCosTheta
private

The maximum cos(theta) that a Pfo can have to be classified as a likely neutrino.

Definition at line 208 of file CosmicRayTaggingTool.h.

Referenced by GetNeutrinoSlices(), and ReadSettings().

float lar_content::CosmicRayTaggingTool::m_minCosmicCosTheta
private

The minimum cos(theta) that a Pfo can have to be classified as a likely CR muon.

Definition at line 209 of file CosmicRayTaggingTool.h.

Referenced by Initialize(), ReadSettings(), and TagCRMuons().

unsigned int lar_content::CosmicRayTaggingTool::m_minimumHits
private

The minimum number of hits for a Pfo to be considered.

Definition at line 202 of file CosmicRayTaggingTool.h.

Referenced by GetValid3DCluster(), and ReadSettings().

float lar_content::CosmicRayTaggingTool::m_positionalUncertainty
private

The uncertainty in cm for the position of Pfo endpoint in 3D.

Definition at line 199 of file CosmicRayTaggingTool.h.

Referenced by CheckAssociation(), and ReadSettings().


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