All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
sbn::TrackCaloSkimmerSelectStoppingTrack Class Reference
Inheritance diagram for sbn::TrackCaloSkimmerSelectStoppingTrack:
sbn::ITCSSelectionTool

Public Member Functions

 TrackCaloSkimmerSelectStoppingTrack (const fhicl::ParameterSet &p)
 
 ~TrackCaloSkimmerSelectStoppingTrack ()
 
bool Select (const TrackInfo &t) override
 For children to implement: Whether to select a given track. More...
 
- Public Member Functions inherited from sbn::ITCSSelectionTool
 ITCSSelectionTool (const fhicl::ParameterSet &p)
 
 fRequireT0 (p.get< bool >("RequireT0", true))
 
 fInvert (p.get< bool >("Invert", false))
 
 fNPreScale (p.get< unsigned >("PreScale", 1))
 
 fISelect (0)
 
virtual ~ITCSSelectionTool () noexcept=default
 
bool DoSelect (const TrackInfo &t)
 For external modules to call: run the actual selection. More...
 
unsigned GetPrescale () const
 

Private Attributes

double fFVInsetMinX
 
double fFVInsetMaxX
 
double fFVInsetMinY
 
double fFVInsetMaxY
 
double fFVInsetMinZ
 
double fFVInsetMaxZ
 
double fMinTimeTickInset
 
double fMaxTimeTickInset
 
double fEndMediandQdxCut
 
unsigned fNumberTimeSamples
 
bool fRequireDownwards
 
int fTickMin
 
int fTickMax
 
std::vector< std::vector
< geo::BoxBoundedGeo > > 
fTPCVolumes
 
std::vector< geo::BoxBoundedGeofActiveVolumes
 
std::vector< geo::BoxBoundedGeofFiducialVolumes
 
double fFidTickMin
 
double fFidTickMax
 
double fMediandQdxRRMax
 
bool fCheckFiducialX
 

Additional Inherited Members

- Protected Attributes inherited from sbn::ITCSSelectionTool
std::vector< bool > fAllowT0
 
bool fRequireT0
 
bool fInvert
 
unsigned fNPreScale
 
unsigned fISelect
 

Detailed Description

Definition at line 18 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

Constructor & Destructor Documentation

sbn::TrackCaloSkimmerSelectStoppingTrack::TrackCaloSkimmerSelectStoppingTrack ( const fhicl::ParameterSet &  p)

Definition at line 60 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

60  :
62  fFVInsetMinX(p.get<double>("FVInsetMinX")),
63  fFVInsetMaxX(p.get<double>("FVInsetMaxX")),
64  fFVInsetMinY(p.get<double>("FVInsetMinY")),
65  fFVInsetMaxY(p.get<double>("FVInsetMaxY")),
66  fFVInsetMinZ(p.get<double>("FVInsetMinZ")),
67  fFVInsetMaxZ(p.get<double>("FVInsetMaxZ")),
68  fMinTimeTickInset(p.get<double>("MinTimeTickInset")),
69  fMaxTimeTickInset(p.get<double>("MaxTimeTickInset")),
70  fEndMediandQdxCut(p.get<double>("EndMediandQdxCut")),
71  fNumberTimeSamples(p.get<unsigned>("NumberTimeSamples")),
72  fRequireDownwards(p.get<bool>("RequireDownwards", true)),
73  fMediandQdxRRMax(p.get<double>("MediandQdxRRMax", 5.)),
74  fCheckFiducialX(p.get<bool>("CheckFiducialX"))
75 {
76  // Get the fiducial volume info
77  const geo::GeometryCore *geometry = lar::providerFrom<geo::Geometry>();
78 
79  // first the TPC volumes
80  for (auto const &cryo: geometry->IterateCryostats()) {
81  geo::GeometryCore::TPC_iterator iTPC = geometry->begin_TPC(cryo.ID()),
82  tend = geometry->end_TPC(cryo.ID());
83  std::vector<geo::BoxBoundedGeo> this_tpc_volumes;
84  while (iTPC != tend) {
85  geo::TPCGeo const& TPC = *iTPC;
86  this_tpc_volumes.push_back(TPC.ActiveBoundingBox());
87  iTPC++;
88  }
89  fTPCVolumes.push_back(std::move(this_tpc_volumes));
90  }
91 
92  // TODO: make configurable? Is this every not 0?
93  fTickMin = 0;
95 
98 
99  // then combine them into active volumes
100  for (const std::vector<geo::BoxBoundedGeo> &tpcs: fTPCVolumes) {
101  double XMin = std::min_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MinX() < rhs.MinX(); })->MinX();
102  double YMin = std::min_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MinY() < rhs.MinY(); })->MinY();
103  double ZMin = std::min_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MinZ() < rhs.MinZ(); })->MinZ();
104 
105  double XMax = std::max_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MaxX() < rhs.MaxX(); })->MaxX();
106  double YMax = std::max_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MaxY() < rhs.MaxY(); })->MaxY();
107  double ZMax = std::max_element(tpcs.begin(), tpcs.end(), [](auto &lhs, auto &rhs) { return lhs.MaxZ() < rhs.MaxZ(); })->MaxZ();
108 
109  fActiveVolumes.emplace_back(XMin, XMax, YMin, YMax, ZMin, ZMax);
110  }
111 
112  // And take the inset for the fiducial volumes
113  for (const geo::BoxBoundedGeo &AV: fActiveVolumes) {
114  fFiducialVolumes.emplace_back(AV.MinX() + fFVInsetMinX, AV.MaxX() - fFVInsetMaxX,
115  AV.MinY() + fFVInsetMinY, AV.MaxY() - fFVInsetMaxY,
116  AV.MinZ() + fFVInsetMinZ, AV.MaxZ() - fFVInsetMaxZ);
117  }
118 
119 }
ITCSSelectionTool(const fhicl::ParameterSet &p)
const geo::GeometryCore * geometry
pdgs p
Definition: selectors.fcl:22
Geometry information for a single TPC.
Definition: TPCGeo.h:38
geo::BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
Definition: TPCGeo.h:320
std::vector< std::vector< geo::BoxBoundedGeo > > fTPCVolumes
BEGIN_PROLOG TPC
TPC_iterator begin_TPC() const
Returns an iterator pointing to the first TPC in the detector.
Description of geometry of one entire detector.
IteratorBox< cryostat_iterator,&GeometryCore::begin_cryostat,&GeometryCore::end_cryostat > IterateCryostats() const
Enables ranged-for loops on all cryostats of the detector.
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
Forward iterator browsing all geometry elements in the detector.
Definition: GeometryCore.h:727
TPC_iterator end_TPC() const
Returns an iterator pointing after the last TPC in the detector.
sbn::TrackCaloSkimmerSelectStoppingTrack::~TrackCaloSkimmerSelectStoppingTrack ( )
inline

Definition at line 22 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

22 {}

Member Function Documentation

bool sbn::TrackCaloSkimmerSelectStoppingTrack::Select ( const TrackInfo t)
overridevirtual

For children to implement: Whether to select a given track.

Implements sbn::ITCSSelectionTool.

Definition at line 121 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

121  {
122  bool downwards = (t.dir.y < 0.) || !fRequireDownwards;
123 
124  bool end_is_fid = false;
125  for (const geo::BoxBoundedGeo &g: fFiducialVolumes) {
126  geo::Point_t end {t.end.x, t.end.y, t.end.z};
127 
128  bool is_contained = fCheckFiducialX ? g.ContainsPosition(end) : g.ContainsYZ(end.Y(), end.Z());
129 
130  if (is_contained) {
131  end_is_fid = true;
132  break;
133  }
134  }
135 
136  // Collection plane times need to be fiducial
137  bool time_is_fid = \
138  (t.hit_min_time_p2_tpcE < 0. || t.hit_min_time_p2_tpcE > fFidTickMin) &&
139  (t.hit_max_time_p2_tpcE < 0. || t.hit_max_time_p2_tpcE < fFidTickMax) &&
140  (t.hit_min_time_p2_tpcW < 0. || t.hit_min_time_p2_tpcW > fFidTickMin) &&
141  (t.hit_max_time_p2_tpcW < 0. || t.hit_max_time_p2_tpcW < fFidTickMax);
142 
143  // compute the median dqdx of the last few cm -- using fMediandQdxRRMax
144  std::vector<double> endp_dqdx;
145  for (const sbn::TrackHitInfo &h: t.hits2) {
146  if (h.oncalo && h.rr < fMediandQdxRRMax) endp_dqdx.push_back(h.dqdx);
147  }
148  double med_dqdx = -1;
149  if (endp_dqdx.size()) {
150  unsigned middle = endp_dqdx.size() / 2;
151  std::nth_element(endp_dqdx.begin(), endp_dqdx.begin() + middle, endp_dqdx.end());
152  med_dqdx = endp_dqdx[middle];
153 
154  // for even case
155  if (endp_dqdx.size() % 2 == 0) {
156  unsigned other_middle = middle - 1;
157  std::nth_element(endp_dqdx.begin(), endp_dqdx.begin() + other_middle, endp_dqdx.end());
158  med_dqdx = (med_dqdx + endp_dqdx[other_middle]) / 2.;
159  }
160  }
161 
162  bool valid_med_dqdx = ((med_dqdx > 0.) && (med_dqdx > fEndMediandQdxCut)) || (fEndMediandQdxCut < 0.);
163 
164  return downwards && end_is_fid && time_is_fid && valid_med_dqdx;
165 }
return track match has_match and!particle is_contained
Definition: selectors.fcl:108
BEGIN_PROLOG g
float dqdx
Initial computed dq/dx of hit [ADC/cm].
while getopts h
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
float rr
Residual range of hit along track [cm].
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
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
bool oncalo
Whether the hit is on the track calorimetry.

Member Data Documentation

std::vector<geo::BoxBoundedGeo> sbn::TrackCaloSkimmerSelectStoppingTrack::fActiveVolumes
private

Definition at line 48 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

bool sbn::TrackCaloSkimmerSelectStoppingTrack::fCheckFiducialX
private

Definition at line 57 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fEndMediandQdxCut
private

Definition at line 38 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fFidTickMax
private

Definition at line 54 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fFidTickMin
private

Definition at line 53 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

std::vector<geo::BoxBoundedGeo> sbn::TrackCaloSkimmerSelectStoppingTrack::fFiducialVolumes
private

Definition at line 51 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fFVInsetMaxX
private

Definition at line 29 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fFVInsetMaxY
private

Definition at line 31 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fFVInsetMaxZ
private

Definition at line 33 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fFVInsetMinX
private

Definition at line 28 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fFVInsetMinY
private

Definition at line 30 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fFVInsetMinZ
private

Definition at line 32 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fMaxTimeTickInset
private

Definition at line 36 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fMediandQdxRRMax
private

Definition at line 55 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

double sbn::TrackCaloSkimmerSelectStoppingTrack::fMinTimeTickInset
private

Definition at line 35 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

unsigned sbn::TrackCaloSkimmerSelectStoppingTrack::fNumberTimeSamples
private

Definition at line 39 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

bool sbn::TrackCaloSkimmerSelectStoppingTrack::fRequireDownwards
private

Definition at line 40 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

int sbn::TrackCaloSkimmerSelectStoppingTrack::fTickMax
private

Definition at line 44 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

int sbn::TrackCaloSkimmerSelectStoppingTrack::fTickMin
private

Definition at line 43 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.

std::vector<std::vector<geo::BoxBoundedGeo> > sbn::TrackCaloSkimmerSelectStoppingTrack::fTPCVolumes
private

Definition at line 47 of file TrackCaloSkimmerSelectStoppingTrack_tool.cc.


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