Skip to content

Commit 484dd0e

Browse files
committed
Replace throughgoing selection and add exiting selection as previous
1 parent 22b1505 commit 484dd0e

3 files changed

Lines changed: 99 additions & 4 deletions

File tree

sbncode/Calibration/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ cet_build_plugin(TrackCaloSkimmerSelectAllTrack art::tool
7070
ROOT::X3d
7171
)
7272

73+
cet_build_plugin(TrackCaloSkimmerSelectThroughgoingTrack art::tool
74+
LIBRARIES
75+
larcore::Geometry_Geometry_service
76+
)
77+
7378
cet_build_plugin ( DataSelect art::module
7479
LIBRARIES
7580
ifdh_art::IFDH_service
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#include "art/Utilities/ToolMacros.h"
2+
#include "fhiclcpp/ParameterSet.h"
3+
4+
#include "larcore/Geometry/Geometry.h"
5+
#include "larcore/CoreUtils/ServiceUtil.h"
6+
#include "larcorealg/Geometry/GeometryCore.h"
7+
8+
#include "ITCSSelectionTool.h"
9+
10+
namespace sbn {
11+
12+
class TrackCaloSkimmerSelectThroughgoingTrack: public ITCSSelectionTool {
13+
public:
14+
15+
TrackCaloSkimmerSelectThroughgoingTrack(const fhicl::ParameterSet &p);
16+
~TrackCaloSkimmerSelectThroughgoingTrack() {}
17+
18+
bool Select(const TrackInfo &t) override;
19+
20+
private:
21+
double fFVInsetMinX;
22+
double fFVInsetMaxX;
23+
double fFVInsetMinY;
24+
double fFVInsetMaxY;
25+
double fFVInsetMinZ;
26+
double fFVInsetMaxZ;
27+
bool fCheckFiducialX;
28+
29+
std::vector<geo::BoxBoundedGeo> fTPCVolumes;
30+
geo::BoxBoundedGeo fActiveVolume, fFiducialVolume;
31+
};
32+
33+
TrackCaloSkimmerSelectThroughgoingTrack::TrackCaloSkimmerSelectThroughgoingTrack(const fhicl::ParameterSet &p):
34+
ITCSSelectionTool(p),
35+
fFVInsetMinX(p.get<double>("FVInsetMinX")),
36+
fFVInsetMaxX(p.get<double>("FVInsetMaxX")),
37+
fFVInsetMinY(p.get<double>("FVInsetMinY")),
38+
fFVInsetMaxY(p.get<double>("FVInsetMaxY")),
39+
fFVInsetMinZ(p.get<double>("FVInsetMinZ")),
40+
fFVInsetMaxZ(p.get<double>("FVInsetMaxZ")),
41+
fCheckFiducialX(p.get<bool>("CheckFiducialX"))
42+
{
43+
const geo::GeometryCore *geometry = lar::providerFrom<geo::Geometry>();
44+
45+
for(auto const &cryoid: geometry->Iterate<geo::CryostatID>())
46+
{
47+
for(auto const& TPC : geometry->Iterate<geo::TPCGeo>(cryoid))
48+
fTPCVolumes.push_back(TPC.ActiveBoundingBox());
49+
}
50+
51+
double XMin = std::min_element(fTPCVolumes.begin(), fTPCVolumes.end(), [](auto &lhs, auto &rhs) { return lhs.MinX() < rhs.MinX(); })->MinX();
52+
double YMin = std::min_element(fTPCVolumes.begin(), fTPCVolumes.end(), [](auto &lhs, auto &rhs) { return lhs.MinY() < rhs.MinY(); })->MinY();
53+
double ZMin = std::min_element(fTPCVolumes.begin(), fTPCVolumes.end(), [](auto &lhs, auto &rhs) { return lhs.MinZ() < rhs.MinZ(); })->MinZ();
54+
55+
double XMax = std::max_element(fTPCVolumes.begin(), fTPCVolumes.end(), [](auto &lhs, auto &rhs) { return lhs.MaxX() < rhs.MaxX(); })->MaxX();
56+
double YMax = std::max_element(fTPCVolumes.begin(), fTPCVolumes.end(), [](auto &lhs, auto &rhs) { return lhs.MaxY() < rhs.MaxY(); })->MaxY();
57+
double ZMax = std::max_element(fTPCVolumes.begin(), fTPCVolumes.end(), [](auto &lhs, auto &rhs) { return lhs.MaxZ() < rhs.MaxZ(); })->MaxZ();
58+
59+
fActiveVolume = geo::BoxBoundedGeo(XMin, XMax, YMin, YMax, ZMin, ZMax);
60+
61+
fFiducialVolume = geo::BoxBoundedGeo(fActiveVolume.MinX() + fFVInsetMinX, fActiveVolume.MaxX() - fFVInsetMaxX,
62+
fActiveVolume.MinY() + fFVInsetMinY, fActiveVolume.MaxY() - fFVInsetMaxY,
63+
fActiveVolume.MinZ() + fFVInsetMinZ, fActiveVolume.MaxZ() - fFVInsetMaxZ);
64+
}
65+
66+
bool TrackCaloSkimmerSelectThroughgoingTrack::Select(const TrackInfo &t)
67+
{
68+
geo::Point_t start {t.start.x, t.start.y, t.start.z};
69+
bool start_is_non_fid = fCheckFiducialX ? !fFiducialVolume.ContainsPosition(start) : !fFiducialVolume.ContainsYZ(start.Y(), start.Z());
70+
71+
geo::Point_t end {t.end.x, t.end.y, t.end.z};
72+
bool end_is_non_fid = fCheckFiducialX ? !fFiducialVolume.ContainsPosition(end) : !fFiducialVolume.ContainsYZ(end.Y(), end.Z());
73+
74+
return start_is_non_fid && end_is_non_fid;
75+
}
76+
77+
DEFINE_ART_CLASS_TOOL(TrackCaloSkimmerSelectThroughgoingTrack)
78+
79+
}

sbncode/Calibration/fcl/sbnd/sbnd_trackcalo_skimmer.fcl

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ stopping_selection: {
5656
EndMediandQdxCut: 1600
5757
NumberTimeSamples: 3400
5858
MediandQdxRRMax: 5.
59-
CheckFiducialX: false
59+
CheckFiducialX: true
6060
}
6161

62-
throughgoing_selection: {
62+
exiting_selection: {
6363
tool_type: TrackCaloSkimmerSelectStoppingTrack
6464
Invert: true
6565
PreScale: 1
@@ -74,15 +74,26 @@ throughgoing_selection: {
7474
EndMediandQdxCut: -1
7575
RequireDownwards: false
7676
NumberTimeSamples: 3400
77-
CheckFiducialX: false
77+
CheckFiducialX: true
7878
}
7979

8080
a2c_selection: {
8181
tool_type: TrackCaloSkimmerSelectAnode2CathodeTrack
8282
TickCut: 2500
8383
}
8484

85+
throughgoing_selection: {
86+
tool_type: TrackCaloSkimmerSelectThroughgoingTrack
87+
FVInsetMinX: 5
88+
FVInsetMaxX: 5
89+
FVInsetMinY: 5
90+
FVInsetMaxY: 5
91+
FVInsetMinZ: 5
92+
FVInsetMaxZ: 5
93+
CheckFiducialX: true
94+
}
95+
8596
caloskim_nodigits_goldentracks: @local::caloskim_nodigits
86-
caloskim_nodigits_goldentracks.SelectionTools: [@local::stopping_selection, @local::a2c_selection, @local::throughgoing_selection]
97+
caloskim_nodigits_goldentracks.SelectionTools: [@local::stopping_selection, @local::a2c_selection, @local::throughgoing_selection, @local::exiting_selection]
8798

8899
END_PROLOG

0 commit comments

Comments
 (0)