Skip to content

Commit 9f7a7c7

Browse files
committed
Ensure TPC matching algorithms compile
1 parent 02d11c3 commit 9f7a7c7

4 files changed

Lines changed: 69 additions & 54 deletions

File tree

sbndcode/CRT/CRTTPCMatching/CRTSpacePointMatchAlg.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ namespace sbnd::crt {
2929
fMaxUncert = config.MaxUncert();
3030
fTPCTrackLabel = config.TPCTrackLabel();
3131
fCRTSpacePointLabel = config.CRTSpacePointLabel();
32+
fUseTs0 = config.UseTs0();
3233

3334
return;
3435
}
@@ -74,7 +75,7 @@ namespace sbnd::crt {
7475

7576
for(auto &crtSP : crtSPs){
7677

77-
const double crtTime = crtSP->Time() * 1e-3 + fTimeCorrection;
78+
const double crtTime = fUseTs0 ? crtSP->Ts0() * 1e-3 + fTimeCorrection : crtSP->Ts1() * 1e-3 + fTimeCorrection;
7879

7980
if(!(crtTime > t0MinMax.first - 10. && crtTime < t0MinMax.second + 10.))
8081
continue;

sbndcode/CRT/CRTTPCMatching/CRTSpacePointMatchAlg.h

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -64,78 +64,84 @@ namespace sbnd::crt {
6464

6565
fhicl::Atom<double> TrackDirectionFrac {
6666
Name("TrackDirectionFrac"),
67-
Comment(""),
68-
0.5
69-
};
67+
Comment(""),
68+
0.5
69+
};
7070

7171
fhicl::Atom<double> TimeCorrection {
7272
Name("TimeCorrection"),
73-
Comment(""),
74-
0.
75-
};
73+
Comment(""),
74+
0.
75+
};
7676

7777
fhicl::Atom<double> DCALimit {
7878
Name("DCALimit"),
79-
Comment(""),
80-
200.
81-
};
79+
Comment(""),
80+
200.
81+
};
8282

8383
fhicl::Atom<double> MinTPCTrackLength {
8484
Name("MinTPCTrackLength"),
85-
Comment("Only consider TPC tracks with a length longer than this (cm)"),
86-
0.
87-
};
85+
Comment("Only consider TPC tracks with a length longer than this (cm)"),
86+
0.
87+
};
8888

8989
fhicl::Atom<int> DirMethod {
9090
Name("DirMethod"),
91-
Comment("1=endpoints (default), 2=average; must use endpoints if applying SCE position corrections"),
92-
1
93-
};
91+
Comment("1=endpoints (default), 2=average; must use endpoints if applying SCE position corrections"),
92+
1
93+
};
9494

9595
fhicl::Atom<bool> DCAuseBox {
9696
Name("DCAuseBox"),
97-
Comment("false = distance to point (default), true = distance to box edge"),
98-
false
99-
};
97+
Comment("false = distance to point (default), true = distance to box edge"),
98+
false
99+
};
100100

101101
fhicl::Atom<bool> DCAoverLength {
102102
Name("DCAoverLength"),
103-
Comment("false = use DCA to select closest CRTSpacePoint (default), true = use DCA/extrapolation_length"),
104-
false
105-
};
103+
Comment("false = use DCA to select closest CRTSpacePoint (default), true = use DCA/extrapolation_length"),
104+
false
105+
};
106106

107107
fhicl::Atom<double> PECut {
108108
Name("PECut"),
109-
Comment("Only consider CRTSpacePoints with PE values larger than this"),
110-
0.0
111-
};
109+
Comment("Only consider CRTSpacePoints with PE values larger than this"),
110+
0.0
111+
};
112112

113113
fhicl::Atom<double> MaxUncert {
114114
Name("MaxUncert"),
115-
Comment("Only consider CRTSpacePoints with position uncertainties below this value (cm)"),
116-
1000.0
117-
};
115+
Comment("Only consider CRTSpacePoints with position uncertainties below this value (cm)"),
116+
1000.0
117+
};
118118

119119
fhicl::Atom<art::InputTag> TPCTrackLabel {
120120
Name("TPCTrackLabel"),
121-
Comment("")
122-
};
121+
Comment("")
122+
};
123123

124124
fhicl::Atom<art::InputTag> CRTSpacePointLabel {
125125
Name("CRTSpacePointLabel"),
126-
Comment("")
127-
};
126+
Comment("")
127+
};
128+
129+
fhicl::Atom<bool> UseTs0 {
130+
Name("UseTs0"),
131+
Comment("Whether to use the T0 or T1 clock time of the CRT object"),
132+
};
133+
128134
};
129135

130136
CRTSpacePointMatchAlg(const Config& config);
131137

132138
CRTSpacePointMatchAlg(const Config& config, geo::GeometryCore const *GeometryService);
133139

134140
CRTSpacePointMatchAlg(const fhicl::ParameterSet& pset) :
135-
CRTSpacePointMatchAlg(fhicl::Table<Config>(pset, {})()) {}
141+
CRTSpacePointMatchAlg(fhicl::Table<Config>(pset, {})()) {}
136142

137143
CRTSpacePointMatchAlg(const fhicl::ParameterSet& pset, geo::GeometryCore const *GeometryService) :
138-
CRTSpacePointMatchAlg(fhicl::Table<Config>(pset, {})(), GeometryService) {}
144+
CRTSpacePointMatchAlg(fhicl::Table<Config>(pset, {})(), GeometryService) {}
139145

140146
CRTSpacePointMatchAlg();
141147

@@ -178,6 +184,7 @@ namespace sbnd::crt {
178184
bool fDCAoverLength;
179185
double fPECut;
180186
double fMaxUncert;
187+
bool fUseTs0;
181188

182189
art::InputTag fTPCTrackLabel;
183190
art::InputTag fCRTSpacePointLabel;

sbndcode/CRT/CRTTPCMatching/CRTTrackMatchAlg.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace sbnd::crt {
2424
fMinTPCTrackLength = config.MinTPCTrackLength();
2525
fTPCTrackLabel = config.TPCTrackLabel();
2626
fSelectionMetric = config.SelectionMetric();
27+
fUseTs0 = config.UseTs0();
2728

2829
return;
2930
}
@@ -115,7 +116,7 @@ namespace sbnd::crt {
115116
if(!TPCIntersection(tpcGeo, crtTrack, entry, exit))
116117
continue;
117118

118-
const double crtTime = crtTrack->Time() * 1e-3;
119+
const double crtTime = fUseTs0 ? crtTrack->Ts0() * 1e-3 : crtTrack->Ts1() * 1e-3;
119120
const double shift = driftDirection * crtTime * detProp.DriftVelocity();
120121

121122
geo::Point_t start = tpcTrack->Vertex();
@@ -161,7 +162,7 @@ namespace sbnd::crt {
161162

162163
for(auto const &possCRTTrack : possCRTTracks)
163164
{
164-
const double crtTime = possCRTTrack->Time() * 1e-3;
165+
const double crtTime = fUseTs0 ? possCRTTrack->Ts0() * 1e-3 : possCRTTrack->Ts1() * 1e-3;
165166
const double shift = driftDirection * crtTime * detProp.DriftVelocity();
166167
const double DCA = AveDCABetweenTracks(tpcTrack, possCRTTrack, shift);
167168
const double angle = AngleBetweenTracks(tpcTrack, possCRTTrack);
@@ -208,7 +209,7 @@ namespace sbnd::crt {
208209

209210
for(auto const &possCRTTrack : possCRTTracks)
210211
{
211-
const double crtTime = possCRTTrack->Time() * 1e-3;
212+
const double crtTime = fUseTs0 ? possCRTTrack->Ts0() * 1e-3 : possCRTTrack->Ts1() * 1e-3;
212213
const double shift = driftDirection * crtTime * detProp.DriftVelocity();
213214
const double DCA = AveDCABetweenTracks(tpcTrack, possCRTTrack, shift);
214215
const double angle = AngleBetweenTracks(tpcTrack, possCRTTrack);
@@ -251,7 +252,7 @@ namespace sbnd::crt {
251252

252253
for(auto const &possCRTTrack : possCRTTracks)
253254
{
254-
const double crtTime = possCRTTrack->Time() * 1e-3;
255+
const double crtTime = fUseTs0 ? possCRTTrack->Ts0() * 1e-3 : possCRTTrack->Ts1() * 1e-3;
255256
const double shift = driftDirection * crtTime * detProp.DriftVelocity();
256257
const double DCA = AveDCABetweenTracks(tpcTrack, possCRTTrack, shift);
257258
const double angle = AngleBetweenTracks(tpcTrack, possCRTTrack);

sbndcode/CRT/CRTTPCMatching/CRTTrackMatchAlg.h

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,46 +59,51 @@ namespace sbnd::crt {
5959

6060
fhicl::Atom<double> MaxAngleDiff {
6161
Name("MaxAngleDiff"),
62-
Comment("")
63-
};
62+
Comment("")
63+
};
6464

6565
fhicl::Atom<double> MaxDCA {
6666
Name("MaxDCA"),
67-
Comment("")
68-
};
67+
Comment("")
68+
};
6969

7070
fhicl::Atom<double> MaxScore {
7171
Name("MaxScore"),
72-
Comment(""),
73-
200.
74-
};
72+
Comment(""),
73+
200.
74+
};
7575

7676
fhicl::Atom<double> MinTPCTrackLength {
7777
Name("MinTPCTrackLength"),
78-
Comment(""),
79-
0.
80-
};
78+
Comment(""),
79+
0.
80+
};
8181

8282
fhicl::Atom<std::string> SelectionMetric {
8383
Name("SelectionMetric"),
84-
Comment("")
85-
};
84+
Comment("")
85+
};
8686

8787
fhicl::Atom<art::InputTag> TPCTrackLabel {
8888
Name("TPCTrackLabel"),
89-
Comment("")
90-
};
89+
Comment("")
90+
};
91+
92+
fhicl::Atom<bool> UseTs0 {
93+
Name("UseTs0"),
94+
Comment("")
95+
};
9196
};
9297

9398
CRTTrackMatchAlg(const Config& config);
9499

95100
CRTTrackMatchAlg(const Config& config, geo::GeometryCore const* GeometryService);
96101

97102
CRTTrackMatchAlg(const fhicl::ParameterSet& pset) :
98-
CRTTrackMatchAlg(fhicl::Table<Config>(pset, {})()) {}
103+
CRTTrackMatchAlg(fhicl::Table<Config>(pset, {})()) {}
99104

100105
CRTTrackMatchAlg(const fhicl::ParameterSet& pset, geo::GeometryCore const* GeometryService) :
101-
CRTTrackMatchAlg(fhicl::Table<Config>(pset, {})(), GeometryService) {}
106+
CRTTrackMatchAlg(fhicl::Table<Config>(pset, {})(), GeometryService) {}
102107

103108
CRTTrackMatchAlg();
104109

@@ -151,6 +156,7 @@ namespace sbnd::crt {
151156
double fMaxScore;
152157
double fMinTPCTrackLength;
153158
std::string fSelectionMetric;
159+
bool fUseTs0;
154160

155161
art::InputTag fTPCTrackLabel;
156162
};

0 commit comments

Comments
 (0)