All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Attributes | List of all members
sbnd::ApaCrossCosmicIdAlg Class Reference

#include <ApaCrossCosmicIdAlg.h>

Classes

struct  BeamTime
 
struct  Config
 

Public Member Functions

 ApaCrossCosmicIdAlg (const Config &config)
 
 ApaCrossCosmicIdAlg (const fhicl::ParameterSet &pset)
 
 ~ApaCrossCosmicIdAlg ()
 
void reconfigure (const Config &config)
 
std::pair< double, double > MinApaDistance (detinfo::DetectorPropertiesData const &detProp, recob::Track track, std::vector< double > t0List, int tpc)
 
double T0FromApaCross (detinfo::DetectorPropertiesData const &detProp, recob::Track track, std::vector< double > t0List, int tpc)
 
double ApaDistance (detinfo::DetectorPropertiesData const &detProp, recob::Track track, double t0, std::vector< art::Ptr< recob::Hit >> hits)
 
std::pair< double, double > MinApaDistance (detinfo::DetectorPropertiesData const &detProp, recob::Track track, std::vector< art::Ptr< recob::Hit >> hits, std::vector< double > t0Tpc0, std::vector< double > t0Tpc1)
 
bool ApaCrossCosmicId (detinfo::DetectorPropertiesData const &detProp, recob::Track track, std::vector< art::Ptr< recob::Hit >> hits, std::vector< double > t0Tpc0, std::vector< double > t0Tpc1)
 

Private Attributes

double fDistanceLimit
 
double fMaxApaDistance
 
double fBeamTimeMin
 
double fBeamTimeMax
 
TPCGeoAlg fTpcGeo
 

Detailed Description

Definition at line 35 of file sbndcode/sbndcode/CosmicId/Algs/ApaCrossCosmicIdAlg.h.

Constructor & Destructor Documentation

sbnd::ApaCrossCosmicIdAlg::ApaCrossCosmicIdAlg ( const Config config)

Definition at line 7 of file sbndcode/sbndcode/CosmicId/Algs/ApaCrossCosmicIdAlg.cc.

7  {
8 
9  this->reconfigure(config);
10 
11 }
sbnd::ApaCrossCosmicIdAlg::ApaCrossCosmicIdAlg ( const fhicl::ParameterSet &  pset)
inline

Definition at line 77 of file sbndcode/sbndcode/CosmicId/Algs/ApaCrossCosmicIdAlg.h.

77  :
78  ApaCrossCosmicIdAlg(fhicl::Table<Config>(pset, {})()) {}
sbnd::ApaCrossCosmicIdAlg::~ApaCrossCosmicIdAlg ( )

Definition at line 19 of file sbndcode/sbndcode/CosmicId/Algs/ApaCrossCosmicIdAlg.cc.

19  {
20 
21 }

Member Function Documentation

bool sbnd::ApaCrossCosmicIdAlg::ApaCrossCosmicId ( detinfo::DetectorPropertiesData const &  detProp,
recob::Track  track,
std::vector< art::Ptr< recob::Hit >>  hits,
std::vector< double >  t0Tpc0,
std::vector< double >  t0Tpc1 
)

Definition at line 128 of file sbndcode/sbndcode/CosmicId/Algs/ApaCrossCosmicIdAlg.cc.

129  {
130 
131  // Determine the TPC from hit collection
132  int tpc = fTpcGeo.DetectedInTPC(hits);
133 
134  // Get the minimum distance from the APA in the corresponding TPC (with corresponding flashes)
135  if(tpc == 0){
136  // Get the closest matched time with distance below limit
137  double crossTimeThrough = T0FromApaCross(detProp, track, t0Tpc0, tpc);
138  // If the matched time is outside of the beam time then tag as a cosmic
139  if(crossTimeThrough != -99999 && (crossTimeThrough < fBeamTimeMin || crossTimeThrough > fBeamTimeMax)) return true;
140  }
141  if(tpc == 1){
142  double crossTimeThrough = T0FromApaCross(detProp, track, t0Tpc1, tpc);
143  if(crossTimeThrough != -99999 && (crossTimeThrough < fBeamTimeMin || crossTimeThrough > fBeamTimeMax)) return true;
144  }
145 
146  return false;
147 
148 }
int DetectedInTPC(std::vector< art::Ptr< recob::Hit >> hits)
auto const detProp
double T0FromApaCross(detinfo::DetectorPropertiesData const &detProp, recob::Track track, std::vector< double > t0List, int tpc)
double sbnd::ApaCrossCosmicIdAlg::ApaDistance ( detinfo::DetectorPropertiesData const &  detProp,
recob::Track  track,
double  t0,
std::vector< art::Ptr< recob::Hit >>  hits 
)

Definition at line 98 of file sbndcode/sbndcode/CosmicId/Algs/ApaCrossCosmicIdAlg.cc.

99  {
100 
101  std::vector<double> t0List {t0};
102  // Determine the TPC from hit collection
103  int tpc = fTpcGeo.DetectedInTPC(hits);
104  // Get the distance to the APA at the given time
105  std::pair<double, double> min = MinApaDistance(detProp, track, t0List, tpc);
106  return min.first;
107 
108 }
std::pair< double, double > MinApaDistance(detinfo::DetectorPropertiesData const &detProp, recob::Track track, std::vector< double > t0List, int tpc)
int DetectedInTPC(std::vector< art::Ptr< recob::Hit >> hits)
auto const detProp
std::pair< double, double > sbnd::ApaCrossCosmicIdAlg::MinApaDistance ( detinfo::DetectorPropertiesData const &  detProp,
recob::Track  track,
std::vector< double >  t0List,
int  tpc 
)

Definition at line 36 of file sbndcode/sbndcode/CosmicId/Algs/ApaCrossCosmicIdAlg.cc.

37  {
38 
39  double crossTime = -99999;
40  double xmax = fTpcGeo.MaxX();
41 
42  double minDist = 99999;
43  double startX = track.Vertex().X();
44  double endX = track.End().X();
45  geo::Point_t point = track.Vertex();
46 
47  // Don't try to shift tracks near the APA (may give artificially small distances)
48  if(std::abs(startX) > xmax - fMaxApaDistance
49  || std::abs(endX) > xmax - fMaxApaDistance) return std::make_pair(minDist, crossTime);
50 
51  // If in TPC 0 use start/end with lowest X
52  if(tpc == 0 && endX < startX) point = track.End();
53 
54  // If in TPC 1 use start/end with highest X
55  if(tpc == 1 && endX > startX) point = track.End();
56 
57  // If in both TPCs (stitched) return null values
58  if(tpc == -1) return std::make_pair(minDist, crossTime);
59 
60  // Shift track by all t0's
61  for(auto const& t0 : t0List){
62  // If particle crosses the APA before t = 0 the crossing point won't be reconstructed
63  if(t0 < 0) continue;
64  double shiftedX = point.X();
65  double shift = t0 * detProp.DriftVelocity();
66  if(tpc == 0) shiftedX = point.X() - shift;
67  if(tpc == 1) shiftedX = point.X() + shift;
68 
69  //Check track still in TPC
70  if(std::abs(shiftedX) > (xmax + fDistanceLimit)) continue;
71  //Calculate distance between start/end and APA
72  double dist = std::abs(std::abs(shiftedX) - xmax);
73  if(dist < minDist) {
74  minDist = dist;
75  crossTime = t0;
76  }
77  }
78 
79  return std::make_pair(minDist, crossTime);
80 
81 }
shift
Definition: fcl_checks.sh:26
T abs(T value)
Point_t const & Vertex() const
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
Point_t const & End() const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
auto const detProp
std::pair< double, double > sbnd::ApaCrossCosmicIdAlg::MinApaDistance ( detinfo::DetectorPropertiesData const &  detProp,
recob::Track  track,
std::vector< art::Ptr< recob::Hit >>  hits,
std::vector< double >  t0Tpc0,
std::vector< double >  t0Tpc1 
)

Definition at line 111 of file sbndcode/sbndcode/CosmicId/Algs/ApaCrossCosmicIdAlg.cc.

112  {
113 
114  // Determine the TPC from hit collection
115  int tpc = fTpcGeo.DetectedInTPC(hits);
116  // Get the minimum distance from the APA in the corresponding TPC (with corresponding flashes)
117  if(tpc == 0){
118  return MinApaDistance(detProp, track, t0Tpc0, tpc);
119  }
120  if(tpc == 1){
121  return MinApaDistance(detProp, track, t0Tpc1, tpc);
122  }
123  return std::make_pair(-99999, -99999);
124 }
std::pair< double, double > MinApaDistance(detinfo::DetectorPropertiesData const &detProp, recob::Track track, std::vector< double > t0List, int tpc)
int DetectedInTPC(std::vector< art::Ptr< recob::Hit >> hits)
auto const detProp
void sbnd::ApaCrossCosmicIdAlg::reconfigure ( const Config config)

Definition at line 24 of file sbndcode/sbndcode/CosmicId/Algs/ApaCrossCosmicIdAlg.cc.

24  {
25 
26  fDistanceLimit = config.DistanceLimit();
27  fMaxApaDistance = config.MaxApaDistance();
28  fBeamTimeMin = config.BeamTimeLimits().BeamTimeMin();
29  fBeamTimeMax = config.BeamTimeLimits().BeamTimeMax();
30 
31  return;
32 }
double sbnd::ApaCrossCosmicIdAlg::T0FromApaCross ( detinfo::DetectorPropertiesData const &  detProp,
recob::Track  track,
std::vector< double >  t0List,
int  tpc 
)

Definition at line 85 of file sbndcode/sbndcode/CosmicId/Algs/ApaCrossCosmicIdAlg.cc.

86  {
87 
88  // Get the minimum distance to the APA and corresponding time
89  std::pair<double, double> min = MinApaDistance(detProp, track, t0List, tpc);
90  // Check the distance is within allowed limit
91  if(min.first < fDistanceLimit) return min.second;
92  return -99999;
93 
94 }
std::pair< double, double > MinApaDistance(detinfo::DetectorPropertiesData const &detProp, recob::Track track, std::vector< double > t0List, int tpc)
auto const detProp

Member Data Documentation

double sbnd::ApaCrossCosmicIdAlg::fBeamTimeMax
private
double sbnd::ApaCrossCosmicIdAlg::fBeamTimeMin
private
double sbnd::ApaCrossCosmicIdAlg::fDistanceLimit
private
double sbnd::ApaCrossCosmicIdAlg::fMaxApaDistance
private
TPCGeoAlg sbnd::ApaCrossCosmicIdAlg::fTpcGeo
private

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