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

#include <ApaCrossCosmicIdAlg.h>

Classes

struct  BeamTime
 
struct  Config
 

Public Member Functions

 ApaCrossCosmicIdAlg (const core::ProviderManager &manager, const Config &config)
 
 ApaCrossCosmicIdAlg (const core::ProviderManager &manager, const fhicl::ParameterSet &pset)
 
 ~ApaCrossCosmicIdAlg ()
 
void reconfigure (const core::ProviderManager &manager, const Config &config)
 
std::pair< double, double > MinApaDistance (const recob::Track &track, std::vector< double > &t0List, geo::TPCID &tpcid)
 
double T0FromApaCross (const recob::Track &track, std::vector< art::Ptr< recob::Hit >> hits, std::map< geo::CryostatID, std::vector< double >> &t_zeros)
 
double ApaDistance (recob::Track track, double t0, std::vector< art::Ptr< recob::Hit >> hits)
 
bool ApaCrossCosmicId (const recob::Track &track, std::vector< art::Ptr< recob::Hit >> &hits, std::map< geo::CryostatID, std::vector< double >> &t_zeros)
 

Private Attributes

double fDistanceLimit
 
double fMaxApaDistance
 
double fBeamTimeMin
 
double fBeamTimeMax
 
geo::GeometryCore const * fGeometry
 
detinfo::DetectorPropertiesStandard
const * 
fDetectorProperties
 

Detailed Description

Definition at line 35 of file sbnana/sbnanalysis/ana/SBNOscReco/CosmicIDAlgs/ApaCrossCosmicIdAlg.h.

Constructor & Destructor Documentation

ana::ApaCrossCosmicIdAlg::ApaCrossCosmicIdAlg ( const core::ProviderManager manager,
const Config config 
)

Definition at line 5 of file sbnana/sbnanalysis/ana/SBNOscReco/CosmicIDAlgs/ApaCrossCosmicIdAlg.cc.

5  {
6  this->reconfigure(manager, config);
7 }
void reconfigure(const core::ProviderManager &manager, const Config &config)
ana::ApaCrossCosmicIdAlg::ApaCrossCosmicIdAlg ( const core::ProviderManager manager,
const fhicl::ParameterSet &  pset 
)
inline

Definition at line 77 of file sbnana/sbnanalysis/ana/SBNOscReco/CosmicIDAlgs/ApaCrossCosmicIdAlg.h.

77  :
78  ApaCrossCosmicIdAlg(manager, fhicl::Table<Config>(pset, {})()) {}
ApaCrossCosmicIdAlg(const core::ProviderManager &manager, const Config &config)
ana::ApaCrossCosmicIdAlg::~ApaCrossCosmicIdAlg ( )

Member Function Documentation

bool ana::ApaCrossCosmicIdAlg::ApaCrossCosmicId ( const recob::Track track,
std::vector< art::Ptr< recob::Hit >> &  hits,
std::map< geo::CryostatID, std::vector< double >> &  t_zeros 
)

Definition at line 112 of file sbnana/sbnanalysis/ana/SBNOscReco/CosmicIDAlgs/ApaCrossCosmicIdAlg.cc.

112  {
113  double crossTimeThrough = T0FromApaCross(track, hits, t_zeros);
114  // If the matched time is outside of the beam time then tag as a cosmic
115  if(crossTimeThrough != -99999 && (crossTimeThrough < fBeamTimeMin || crossTimeThrough > fBeamTimeMax)) return true;
116  return false;
117 }
double T0FromApaCross(const recob::Track &track, std::vector< art::Ptr< recob::Hit >> hits, std::map< geo::CryostatID, std::vector< double >> &t_zeros)
double ana::ApaCrossCosmicIdAlg::ApaDistance ( recob::Track  track,
double  t0,
std::vector< art::Ptr< recob::Hit >>  hits 
)

Definition at line 100 of file sbnana/sbnanalysis/ana/SBNOscReco/CosmicIDAlgs/ApaCrossCosmicIdAlg.cc.

100  {
101 
102  std::vector<double> t0List {t0};
103  // Determine the TPC from hit collection
105  // Get the distance to the APA at the given time
106  std::pair<double, double> min = MinApaDistance(track, t0List, tpc);
107  return min.first;
108 
109 }
geo::TPCID DetectedInTPC(const std::vector< art::Ptr< recob::Hit >> &hits)
Definition: Util.cc:30
std::pair< double, double > MinApaDistance(const recob::Track &track, std::vector< double > &t0List, geo::TPCID &tpcid)
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
std::pair< double, double > ana::ApaCrossCosmicIdAlg::MinApaDistance ( const recob::Track track,
std::vector< double > &  t0List,
geo::TPCID tpcid 
)

Definition at line 29 of file sbnana/sbnanalysis/ana/SBNOscReco/CosmicIDAlgs/ApaCrossCosmicIdAlg.cc.

29  {
30  double crossTime = -99999;
31 
32  double minDist = 99999;
33  double startX = track.Vertex().X();
34  double endX = track.End().X();
35  geo::Point_t point = track.Vertex();
36 
37 
38  // if TPCID is invalid, return null values
39  if (!tpcid) {
40  return std::make_pair(minDist, crossTime);
41  }
42 
43  // get the TPC drift direction
44  const geo::TPCGeo &tpc = fGeometry->GetElement(tpcid);
45  int drift_direction_x = tpc.DriftDirection() == geo::driftdir::kPos ? 1 : -1;
46 
47  // get the location of the APA in the TPC -- should be the x-position downstream of the drift direction
48  double apa_X = (drift_direction_x == 1) ? tpc.MaxX() : tpc.MinX();
49 
50  // Don't try to shift tracks near the APA (may give artificially small distances)
51  if (std::abs(startX - apa_X) < fMaxApaDistance || std::abs(endX - apa_X) < fMaxApaDistance)
52  return std::make_pair(minDist, crossTime);
53 
54  // if drift direction positive use start/end with highest X
55  if (drift_direction_x == 1) {
56  point = endX < startX ? track.End() : track.Vertex();
57  }
58  else {
59  point = endX > startX ? track.End() : track.Vertex();
60  }
61 
62  // Shift track by all t0's
63  for(auto const& t0 : t0List){
64  // If particle crosses the APA before t = 0 the crossing point won't be reconstructed
65  if(t0 < 0) continue;
66  double shift = t0 * fDetectorProperties->DriftVelocity() * drift_direction_x;
67  double shiftedX = point.X() + shift;
68 
69  //Check track still in TPC
70  if (shiftedX - apa_X > fDistanceLimit) continue;
71  // Calculate distance between start/end and APA
72  double dist = std::abs(shiftedX - apa_X);
73  if(dist < minDist) {
74  minDist = dist;
75  crossTime = t0;
76  }
77  }
78 
79  return std::make_pair(minDist, crossTime);
80 
81 }
CryostatGeo const & GetElement(geo::CryostatID const &cryoid) const
Drift towards positive values.
Definition: geo_types.h:159
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
Geometry information for a single TPC.
Definition: TPCGeo.h:38
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
shift
Definition: fcl_checks.sh:26
T abs(T value)
Point_t const & Vertex() const
DriftDirection_t DriftDirection() const
Returns an enumerator value describing the drift direction.
Definition: TPCGeo.h:144
double DriftVelocity(double efield=0., double temperature=0.) const override
cm/us
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
void ana::ApaCrossCosmicIdAlg::reconfigure ( const core::ProviderManager manager,
const Config config 
)

Definition at line 16 of file sbnana/sbnanalysis/ana/SBNOscReco/CosmicIDAlgs/ApaCrossCosmicIdAlg.cc.

16  {
18  fGeometry = manager.GetGeometryProvider();
19  fDistanceLimit = config.DistanceLimit();
20  fMaxApaDistance = config.MaxApaDistance();
21  fBeamTimeMin = config.BeamTimeLimits().BeamTimeMin();
22  fBeamTimeMax = config.BeamTimeLimits().BeamTimeMax();
23 
24  return;
25 }
const detinfo::DetectorPropertiesStandard * GetDetectorPropertiesProvider() const
const geo::GeometryCore * GetGeometryProvider() const
double ana::ApaCrossCosmicIdAlg::T0FromApaCross ( const recob::Track track,
std::vector< art::Ptr< recob::Hit >>  hits,
std::map< geo::CryostatID, std::vector< double >> &  t_zeros 
)

Definition at line 85 of file sbnana/sbnanalysis/ana/SBNOscReco/CosmicIDAlgs/ApaCrossCosmicIdAlg.cc.

85  {
86  // Determine the TPC from hit collection
88  if (tpc) {
89  // Get the minimum distance to the APA and corresponding time
90  std::pair<double, double> min = MinApaDistance(track, t_zeros.at(tpc), tpc);
91  // Check the distance is within allowed limit
92  if(min.first < fDistanceLimit) return min.second;
93  }
94 
95  return -99999;
96 
97 }
geo::TPCID DetectedInTPC(const std::vector< art::Ptr< recob::Hit >> &hits)
Definition: Util.cc:30
std::pair< double, double > MinApaDistance(const recob::Track &track, std::vector< double > &t0List, geo::TPCID &tpcid)
The data type to uniquely identify a TPC.
Definition: geo_types.h:386

Member Data Documentation

double ana::ApaCrossCosmicIdAlg::fBeamTimeMax
private
double ana::ApaCrossCosmicIdAlg::fBeamTimeMin
private
detinfo::DetectorPropertiesStandard const* ana::ApaCrossCosmicIdAlg::fDetectorProperties
private
double ana::ApaCrossCosmicIdAlg::fDistanceLimit
private
geo::GeometryCore const* ana::ApaCrossCosmicIdAlg::fGeometry
private
double ana::ApaCrossCosmicIdAlg::fMaxApaDistance
private

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