All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbndcode/sbndcode/CRT/CRTUtils/CRTT0MatchAlg.cc
Go to the documentation of this file.
1 #include "CRTT0MatchAlg.h"
2 
3 namespace sbnd{
4 
5 CRTT0MatchAlg::CRTT0MatchAlg(const Config& config) : CRTT0MatchAlg(config, lar::providerFrom<geo::Geometry>(),
6 lar::providerFrom<spacecharge::SpaceChargeService>()) {}
7 
8 CRTT0MatchAlg::CRTT0MatchAlg(const Config& config, geo::GeometryCore const *GeometryService, spacecharge::SpaceCharge const *SCE){
9 
10 
11  this->reconfigure(config);
12  fGeometryService = GeometryService;
13  fSCE = SCE;
14 }
16 
17 
18 
19 
20 void CRTT0MatchAlg::reconfigure(const Config& config){
21 
24  fDistanceLimit = config.DistanceLimit();
25  fTSMode = config.TSMode();
27  fTPCTrackLabel = config.TPCTrackLabel();
28  fSCEposCorr = config.SCEposCorr();
29  fDirMethod = config.DirMethod();
30  fDCAuseBox = config.DCAuseBox();
31  fDCAoverLength = config.DCAoverLength();
32  fDoverLLimit = config.DoverLLimit();
33  fPEcut = config.PEcut();
34  fMaxUncert = config.MaxUncert();
35  // fDistEndpointAVedge = config.DistEndpointAVedge();
36 
37  return;
38 
39 }
40 
43  matchCand null;
44  null.thishit = hit;
45  null.t0 = -99999;
46  null.dca = -99999;
47  null.extrapLen = -99999;
48  return null;
49 }
50 
51 
52 
53 // Utility function that determines the possible t0 range of a track
55  double startX, double endX, int driftDirection, std::pair<double, double> xLimits){
56 
57  // If track is stitched return zeros
58  if(driftDirection == 0) return std::make_pair(0, 0);
59 
60  //std::pair<double, double> result; // unused
61  double Vd = driftDirection * detProp.DriftVelocity();
62 
63  // Shift the most postive end to the most positive limit
64  double maxX = std::max(startX, endX);
65  double maxLimit = std::max(xLimits.first, xLimits.second);
66  double maxShift = maxLimit - maxX;
67  // Shift the most negative end to the most negative limit
68  double minX = std::min(startX, endX);
69  double minLimit = std::min(xLimits.first, xLimits.second);
70  double minShift = minLimit - minX;
71  // Convert to time
72  double t0max = maxShift/Vd;
73  double t0min = minShift/Vd;
74 
75  // if (t0min>2500) std::cout << " t0 min " << t0min << " t0max " << t0max << std::endl;
76  return std::make_pair(std::min(t0min, t0max), std::max(t0min, t0max));
77 
78 
79 } // CRTT0MatchAlg::TrackT0Range()
80 
81 
83  TVector3 trackPos, TVector3 trackDir, sbn::crt::CRTHit crtHit, int driftDirection, double t0){
84 
85  //double minDist = 99999;
86 
87  // Convert the t0 into an x shift
88  double xshift = driftDirection* t0 * detProp.DriftVelocity();
89  trackPos[0] += xshift;
90 
92  geo::Point_t temppt = {trackPos.X(),trackPos.Y(),trackPos.Z()};
94  geo::Vector_t fPosOffsets = fSCE->GetCalPosOffsets(temppt,tpcid.TPC);
95  trackPos[0] += fPosOffsets.X();
96  trackPos[1] += fPosOffsets.Y();
97  trackPos[2] += fPosOffsets.Z();
98  }
99 
100  TVector3 end = trackPos + trackDir;
101 
102  // calculate distance of closest approach (DCA)
103  // default is the distance to the point specified by the CRT hit (Simple DCA)
104  // useBox is the distance to the closest edge of the rectangle with the CRT hit at the center and the sides defined
105  // the position uncertainties on the CRT hits.
106  double thisdca;
107 
108  if (fDCAuseBox) thisdca = CRTCommonUtils::DistToCrtHit(crtHit, trackPos, end);
109  else thisdca = CRTCommonUtils::SimpleDCA(crtHit, trackPos, trackDir);
110  return thisdca;
111 
112 } // CRTT0MatchAlg::DistToOfClosestApproach()
113 
114 
115 std::pair<TVector3, TVector3> CRTT0MatchAlg::TrackDirectionAverage(recob::Track track, double frac)
116  {
117  // Calculate direction as an average over directions
118  size_t nTrackPoints = track.NumberTrajectoryPoints();
119  recob::TrackTrajectory trajectory = track.Trajectory();
120  std::vector<geo::Vector_t> validDirections;
121  for(size_t i = 0; i < nTrackPoints; i++){
123  validDirections.push_back(track.DirectionAtPoint(i));
124  }
125 
126  size_t nValidPoints = validDirections.size();
127  int endPoint = (int)floor(nValidPoints*frac);
128  double xTotStart = 0; double yTotStart = 0; double zTotStart = 0;
129  double xTotEnd = 0; double yTotEnd = 0; double zTotEnd = 0;
130  for(int i = 0; i < endPoint; i++){
131  geo::Vector_t dirStart = validDirections.at(i);
132  geo::Vector_t dirEnd = validDirections.at(nValidPoints - (i+1));
133  xTotStart += dirStart.X();
134  yTotStart += dirStart.Y();
135  zTotStart += dirStart.Z();
136  xTotEnd += dirEnd.X();
137  yTotEnd += dirEnd.Y();
138  zTotEnd += dirEnd.Z();
139  }
140  TVector3 startDir = {-xTotStart/endPoint, -yTotStart/endPoint, -zTotStart/endPoint};
141  TVector3 endDir = {xTotEnd/endPoint, yTotEnd/endPoint, zTotEnd/endPoint};
142 
143  return std::make_pair(startDir, endDir);
144 
145 } // CRTT0MatchAlg::TrackDirectionAverage()
146 
147 
148  std::pair<TVector3, TVector3> CRTT0MatchAlg::TrackDirection(detinfo::DetectorPropertiesData const& detProp,recob::Track track, double frac, double CRTtime, int driftDirection){
149 
150  size_t nTrackPoints = track.NPoints();
151  int midPt = (int)floor(nTrackPoints*frac);
152  geo::Point_t startP = track.Start();
153  geo::Point_t endP = track.End();
154  geo::Point_t midP = track.LocationAtPoint(midPt);
155 
156  double xshift = driftDirection * CRTtime * detProp.DriftVelocity();
157  TVector3 startPoint = {startP.X()+xshift,startP.Y(),startP.Z()};
158  TVector3 endPoint = {endP.X()+xshift,endP.Y(),endP.Z()};
159  TVector3 midPoint = {midP.X()+xshift,midP.Y(),midP.Z()};
161 
162  // Apply the shift depending on which TPC the track is in
163  geo::Point_t fTrackPos = startP;
164  fTrackPos.SetX(startPoint.X());
165  geo::TPCID tpcid = fGeometryService->PositionToTPCID(fTrackPos);
166  geo::Vector_t fPosOffsets = fSCE->GetCalPosOffsets(geo::Point_t{fTrackPos.X(),fTrackPos.Y(),fTrackPos.Z()},tpcid.TPC);
167  startPoint.SetX(fTrackPos.X() + fPosOffsets.X());
168  startPoint.SetY(fTrackPos.Y() + fPosOffsets.Y());
169  startPoint.SetZ(fTrackPos.Z() + fPosOffsets.Z());
170  fTrackPos = endP;
171  fTrackPos.SetX(endPoint.X());
172  tpcid = fGeometryService->PositionToTPCID(fTrackPos);
173  // fPosOffsets = fSCE->GetCalPosOffsets(fTrackPos,tpcid.TPC);
174  fPosOffsets = fSCE->GetCalPosOffsets(geo::Point_t{fTrackPos.X(),fTrackPos.Y(),fTrackPos.Z()},tpcid.TPC);
175  endPoint.SetX(fTrackPos.X() + fPosOffsets.X());
176  endPoint.SetY(fTrackPos.Y() + fPosOffsets.Y());
177  endPoint.SetZ(fTrackPos.Z() + fPosOffsets.Z());
178  fTrackPos = midP;
179  fTrackPos.SetX(midPoint.X());
180  tpcid = fGeometryService->PositionToTPCID(fTrackPos);
181  //fPosOffsets = fSCE->GetCalPosOffsets(fTrackPos,tpcid.TPC);
182  fPosOffsets = fSCE->GetCalPosOffsets(geo::Point_t{fTrackPos.X(),fTrackPos.Y(),fTrackPos.Z()},tpcid.TPC);
183  midPoint.SetX(fTrackPos.X() + fPosOffsets.X());
184  midPoint.SetY(fTrackPos.Y() + fPosOffsets.Y());
185  midPoint.SetZ(fTrackPos.Z() + fPosOffsets.Z());
186  }
187 
188  TVector3 startDir = {midPoint.X()-startPoint.X(),midPoint.Y()-startPoint.Y(),midPoint.Z()-startPoint.Z()};
189  float norm = startDir.Mag();
190  if (norm>0) startDir *=(1.0/norm);
191  TVector3 endDir = {midPoint.X()-endPoint.X(),midPoint.Y()-endPoint.Y(),midPoint.Z()-endPoint.Z()};
192  norm = endDir.Mag();
193  if (norm>0) endDir *=(1.0/norm);
194 
195  return std::make_pair(startDir, endDir);
196 
197  } // CRTT0MatchAlg::TrackDirection()
198 
199 std::pair<TVector3, TVector3> CRTT0MatchAlg::TrackDirectionAverageFromPoints(recob::Track track, double frac){
200 
201  // Calculate direction as an average over directions
202  size_t nTrackPoints = track.NumberTrajectoryPoints();
203  recob::TrackTrajectory trajectory = track.Trajectory();
204  std::vector<TVector3> validPoints;
205  for(size_t i = 0; i < nTrackPoints; i++){
206  if(trajectory.FlagsAtPoint(i) != recob::TrajectoryPointFlags::InvalidHitIndex) continue;
207  validPoints.push_back(track.LocationAtPoint<TVector3>(i));
208  }
209 
210  size_t nValidPoints = validPoints.size();
211  int endPoint = (int)floor(nValidPoints*frac);
212  TVector3 startDir = validPoints.at(0) - validPoints.at(endPoint-1);
213  TVector3 endDir = validPoints.at(nValidPoints - 1) - validPoints.at(nValidPoints - (endPoint));
214 
215  return std::make_pair(startDir.Unit(), endDir.Unit());
216 
217 } // CRTT0MatchAlg::TrackDirectionAverageFromPoints()
218 
219 
220 // Keeping ClosestCRTHit function for backward compatibility only
221 // *** use GetClosestCRTHit instead
222 
223 std::pair<sbn::crt::CRTHit, double> CRTT0MatchAlg::ClosestCRTHit(detinfo::DetectorPropertiesData const& detProp,
224  recob::Track tpcTrack, std::vector<sbn::crt::CRTHit> crtHits, const art::Event& event) {
225  auto tpcTrackHandle = event.getValidHandle<std::vector<recob::Track>>(fTPCTrackLabel);
226  art::FindManyP<recob::Hit> findManyHits(tpcTrackHandle, event, fTPCTrackLabel);
227  std::vector<art::Ptr<recob::Hit>> hits = findManyHits.at(tpcTrack.ID());
228  return ClosestCRTHit(detProp, tpcTrack, hits, crtHits);
229 }
230 
231 
232 std::pair<sbn::crt::CRTHit, double> CRTT0MatchAlg::ClosestCRTHit(detinfo::DetectorPropertiesData const& detProp,
233  recob::Track tpcTrack, std::vector<art::Ptr<recob::Hit>> hits, std::vector<sbn::crt::CRTHit> crtHits) {
234 
235  auto start = tpcTrack.Vertex<TVector3>();
236  auto end = tpcTrack.End<TVector3>();
237  // Get the drift direction from the TPC
238  int driftDirection = TPCGeoUtil::DriftDirectionFromHits(fGeometryService, hits);
239  std::pair<double, double> xLimits = TPCGeoUtil::XLimitsFromHits(fGeometryService, hits);
240  // Get the allowed t0 range
241  std::pair<double, double> t0MinMax = TrackT0Range(detProp, start.X(), end.X(), driftDirection, xLimits);
242 
243  return ClosestCRTHit(detProp, tpcTrack, t0MinMax, crtHits, driftDirection);
244 }
245 
246 std::pair<sbn::crt::CRTHit, double> CRTT0MatchAlg::ClosestCRTHit(detinfo::DetectorPropertiesData const& detProp,
247  recob::Track tpcTrack, std::pair<double, double> t0MinMax, std::vector<sbn::crt::CRTHit> crtHits, int driftDirection) {
248  matchCand bestmatch = GetClosestCRTHit(detProp, tpcTrack,t0MinMax,crtHits,driftDirection);
249  return std::make_pair(bestmatch.thishit,bestmatch.dca);
250 
251 }
252 
253 
255  recob::Track tpcTrack, std::vector<art::Ptr<recob::Hit>> hits, std::vector<sbn::crt::CRTHit> crtHits) {
256 
257  auto start = tpcTrack.Vertex<TVector3>();
258  auto end = tpcTrack.End<TVector3>();
259  // Get the drift direction from the TPC
260  int driftDirection = TPCGeoUtil::DriftDirectionFromHits(fGeometryService, hits);
261  std::pair<double, double> xLimits = TPCGeoUtil::XLimitsFromHits(fGeometryService, hits);
262  // Get the allowed t0 range
263  std::pair<double, double> t0MinMax = TrackT0Range(detProp, start.X(), end.X(), driftDirection, xLimits);
264 
265  return GetClosestCRTHit(detProp, tpcTrack, t0MinMax, crtHits, driftDirection);
266 }
267 
269  recob::Track tpcTrack, std::vector<sbn::crt::CRTHit> crtHits, const art::Event& event) {
270  auto tpcTrackHandle = event.getValidHandle<std::vector<recob::Track>>(fTPCTrackLabel);
271  art::FindManyP<recob::Hit> findManyHits(tpcTrackHandle, event, fTPCTrackLabel);
272  std::vector<art::Ptr<recob::Hit>> hits = findManyHits.at(tpcTrack.ID());
273  return GetClosestCRTHit(detProp, tpcTrack, hits, crtHits);
274 }
275 
276 
278  recob::Track tpcTrack, std::pair<double, double> t0MinMax, std::vector<sbn::crt::CRTHit> crtHits, int driftDirection) {
279  auto start = tpcTrack.Vertex<TVector3>();
280  auto end = tpcTrack.End<TVector3>();
281 
282 
283  // ====================== Matching Algorithm ========================== //
284  // std::vector<std::pair<sbn::crt::CRTHit, double>> t0Candidates;
285  std::vector<matchCand> t0Candidates;
286 
287 
288 
289  // Loop over all the CRT hits
290  for(auto &crtHit : crtHits){
291  // Check if hit is within the allowed t0 range
292  double crtTime = -99999.; // units are us
293  if (fTSMode == 1) {
294  crtTime = ((double)(int)crtHit.ts1_ns) * 1e-3 + fTimeCorrection;
295  }
296  else {
297  crtTime = ((double)(int)crtHit.ts0_ns) * 1e-3 + fTimeCorrection;
298  }
299  // if (crtTime>3000) std::cout << "crt hit times " << crtTime << std::endl;
300  // If track is stitched then try all hits
301  if (!((crtTime >= t0MinMax.first - 10. && crtTime <= t0MinMax.second + 10.)
302  || t0MinMax.first == t0MinMax.second)) continue;
303  // cut on CRT hit PE value
304  if (crtHit.peshit<fPEcut) continue;
305  if (crtHit.x_err>fMaxUncert) continue;
306  if (crtHit.y_err>fMaxUncert) continue;
307  if (crtHit.z_err>fMaxUncert) continue;
308 
309  TVector3 crtPoint(crtHit.x_pos, crtHit.y_pos, crtHit.z_pos);
310 
311  //Calculate Track direction
312  std::pair<TVector3, TVector3> startEndDir;
313  // dirmethod=2 is original algorithm, dirmethod=1 is simple algorithm for which SCE corrections are possible
314  if (fDirMethod==2) startEndDir = TrackDirectionAverage(tpcTrack, fTrackDirectionFrac);
315  else startEndDir = TrackDirection(detProp, tpcTrack, fTrackDirectionFrac, crtTime, driftDirection);
316  TVector3 startDir = startEndDir.first;
317  TVector3 endDir = startEndDir.second;
318 
319  // Calculate the distance between the crossing point and the CRT hit, SCE corrections are done inside but dropped
320  double startDist = DistOfClosestApproach(detProp, start, startDir, crtHit, driftDirection, crtTime);
321  double endDist = DistOfClosestApproach(detProp, end, endDir, crtHit, driftDirection, crtTime);
322 
323 
324  double xshift = driftDirection * crtTime * detProp.DriftVelocity();
325  auto thisstart = start;
326  thisstart.SetX(start.X()+xshift);
327  auto thisend = end;
328  thisend.SetX(end.X()+xshift);
329 
330  // repeat SCE correction for endpoints
332  geo::Point_t temppt = {thisstart.X(),thisstart.Y(),thisstart.Z()};
334  geo::Vector_t fPosOffsets = fSCE->GetCalPosOffsets(temppt,tpcid.TPC);
335  thisstart[0] += fPosOffsets.X();
336  thisstart[1] += fPosOffsets.Y();
337  thisstart[2] += fPosOffsets.Z();
338  temppt.SetX(thisend.X());
339  temppt.SetY(thisend.Y());
340  temppt.SetZ(thisend.Z());
341  tpcid = fGeometryService->PositionToTPCID(temppt);
342  fPosOffsets = fSCE->GetCalPosOffsets(temppt,tpcid.TPC);
343  thisend[0] += fPosOffsets.X();
344  thisend[1] += fPosOffsets.Y();
345  thisend[2] += fPosOffsets.Z();
346  }
347 
348 
349  matchCand newmc = makeNULLmc();
350  if (startDist<fDistanceLimit || endDist<fDistanceLimit) {
351  double distS = (crtPoint-thisstart).Mag();
352  double distE = (crtPoint-thisend).Mag();
353  // std::cout << " distS " << distS << " distE " << distE << std::endl;
354  // std::cout << "startdis " << startDist << " endDist " << endDist << " dca " << std::endl;
355  // std::cout << " doL start " << startDist/distS << " doL end " << endDist/distE << std::endl;
356 
357  if (distS < distE){
358  newmc.thishit = crtHit;
359  newmc.t0= crtTime;
360  newmc.dca = startDist;
361  newmc.extrapLen = distS;
362  t0Candidates.push_back(newmc);
363  }
364  else{
365  newmc.thishit = crtHit;
366  newmc.t0= crtTime;
367  newmc.dca = endDist;
368  newmc.extrapLen = distE;
369  t0Candidates.push_back(newmc);
370  }
371  }
372  }
373 
374 
375  // std::cout << " found " << t0Candidates.size() << " candidates" << std::endl;
376  matchCand bestmatch = makeNULLmc();
377  if(t0Candidates.size() > 0){
378  // Find candidate with shortest DCA or DCA/L value
379  bestmatch=t0Candidates[0];
380  double sin_angle = bestmatch.dca/bestmatch.extrapLen;
381  if (fDCAoverLength) { // Use dca/extrapLen to judge best
382  for(auto &thisCand : t0Candidates){
383  double this_sin_angle = thisCand.dca/thisCand.extrapLen;
384  if (bestmatch.dca<0 ) bestmatch=thisCand;
385  else if (this_sin_angle<sin_angle && thisCand.dca>=0) bestmatch=thisCand;
386  }
387  }
388  else { // use Dca to judge best
389  for(auto &thisCand : t0Candidates){
390  if (bestmatch.dca<0 ) bestmatch=thisCand;
391  else if (thisCand.dca<bestmatch.dca && thisCand.dca>=0) bestmatch=thisCand;
392  }
393  }
394  }
395 
396  // std::cout << "best match has dca of " << bestmatch.dca << std::endl;
397  return bestmatch;
398 
399 }
400 
401 
403  recob::Track tpcTrack, std::vector<sbn::crt::CRTHit> crtHits, const art::Event& event){
404  auto tpcTrackHandle = event.getValidHandle<std::vector<recob::Track>>(fTPCTrackLabel);
405  art::FindManyP<recob::Hit> findManyHits(tpcTrackHandle, event, fTPCTrackLabel);
406  std::vector<art::Ptr<recob::Hit>> hits = findManyHits.at(tpcTrack.ID());
407  return T0FromCRTHits(detProp, tpcTrack, hits, crtHits);
408 }
409 
411  recob::Track tpcTrack, std::vector<art::Ptr<recob::Hit>> hits, std::vector<sbn::crt::CRTHit> crtHits) {
412 
413  if (tpcTrack.Length() < fMinTrackLength) return -99999;
414 
415  matchCand closestHit = GetClosestCRTHit(detProp, tpcTrack, hits, crtHits);
416  if(closestHit.dca <0) return -99999;
417 
418  double crtTime;
419  if (fTSMode == 1) {
420  crtTime = ((double)(int)closestHit.thishit.ts1_ns) * 1e-3 + fTimeCorrection;
421  }
422  else {
423  crtTime = ((double)(int)closestHit.thishit.ts0_ns) * 1e-3 + fTimeCorrection;
424  }
425  if (closestHit.dca < fDistanceLimit && (closestHit.dca/closestHit.extrapLen) < fDoverLLimit) return crtTime;
426 
427  return -99999;
428 
429 }
430 
432  recob::Track tpcTrack, std::vector<sbn::crt::CRTHit> crtHits, const art::Event& event){
433  auto tpcTrackHandle = event.getValidHandle<std::vector<recob::Track>>(fTPCTrackLabel);
434  art::FindManyP<recob::Hit> findManyHits(tpcTrackHandle, event, fTPCTrackLabel);
435  std::vector<art::Ptr<recob::Hit>> hits = findManyHits.at(tpcTrack.ID());
436  return T0AndDCAFromCRTHits(detProp, tpcTrack, hits, crtHits);
437 }
438 
440  recob::Track tpcTrack, std::vector<art::Ptr<recob::Hit>> hits, std::vector<sbn::crt::CRTHit> crtHits) {
441 
442  if (tpcTrack.Length() < fMinTrackLength) return std::make_pair(-9999., -9999.);
443 
444  matchCand closestHit = GetClosestCRTHit(detProp, tpcTrack, hits, crtHits);
445 
446  if(closestHit.dca < 0 ) return std::make_pair(-9999., -9999.);
447  if (closestHit.dca < fDistanceLimit && (closestHit.dca/closestHit.extrapLen) < fDoverLLimit) return std::make_pair(closestHit.t0, closestHit.dca);
448 
449  return std::make_pair(-9999., -9999.);
450 
451 
452 }
453 
454 }
std::pair< double, double > XLimitsFromHits(const geo::GeometryCore *GeometryService, std::vector< art::Ptr< recob::Hit >> hits)
std::pair< TVector3, TVector3 > TrackDirectionAverageFromPoints(recob::Track track, double frac)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
virtual geo::Vector_t GetCalPosOffsets(geo::Point_t const &point, int const &TPCid) const =0
matchCand GetClosestCRTHit(detinfo::DetectorPropertiesData const &detProp, recob::Track tpcTrack, std::pair< double, double > t0MinMax, std::vector< sbn::crt::CRTHit > crtHits, int driftDirection)
double ts1_ns
Timestamp T1 ([signal time w.r.t. Trigger time]), in UTC absolute time scale in nanoseconds from the ...
Definition: CRTHit.hh:34
T::provider_type const * providerFrom()
Returns a constant pointer to the provider of specified service.
Definition: ServiceUtil.h:77
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
Point_t const & LocationAtPoint(size_t i) const
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
geo::TPCID PositionToTPCID(geo::Point_t const &point) const
Returns the ID of the TPC at specified location.
process_name use argoneut_mc_hitfinder track
process_name hit
Definition: cheaterreco.fcl:51
std::pair< double, double > TrackT0Range(detinfo::DetectorPropertiesData const &detProp, double startX, double endX, int driftDirection, std::pair< double, double > xLimits)
std::pair< double, double > T0AndDCAFromCRTHits(detinfo::DetectorPropertiesData const &detProp, recob::Track tpcTrack, std::vector< sbn::crt::CRTHit > crtHits, const art::Event &event)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
double ts0_ns
Timestamp T0 (from White Rabbit), in UTC absolute time scale in nanoseconds from the Epoch...
Definition: CRTHit.hh:32
double DistToCrtHit(sbn::crt::CRTHit hit, TVector3 start, TVector3 end)
double DistOfClosestApproach(detinfo::DetectorPropertiesData const &detProp, TVector3 trackPos, TVector3 trackDir, sbn::crt::CRTHit crtHit, int driftDirection, double t0)
std::pair< sbn::crt::CRTHit, double > ClosestCRTHit(detinfo::DetectorPropertiesData const &detProp, recob::Track tpcTrack, std::pair< double, double > t0MinMax, std::vector< sbn::crt::CRTHit > crtHits, int driftDirection)
double Length(size_t p=0) const
Access to various track properties.
PointFlags_t const & FlagsAtPoint(size_t i) const
Returns the flags for the specified trajectory point.
Point_t const & Start() const
Access to track position at different points.
A trajectory in space reconstructed from hits.
Point_t const & Vertex() const
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
double DriftVelocity(double efield=0., double temperature=0.) const
cm/us
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
Description of geometry of one entire detector.
static constexpr HitIndex_t InvalidHitIndex
Value marking an invalid hit index.
auto norm(Vector const &v)
Return norm of the specified vector.
double SimpleDCA(sbn::crt::CRTHit hit, TVector3 start, TVector3 direction)
double T0FromCRTHits(detinfo::DetectorPropertiesData const &detProp, recob::Track tpcTrack, std::vector< sbn::crt::CRTHit > crtHits, const art::Event &event)
int DriftDirectionFromHits(const geo::GeometryCore *GeometryService, std::vector< art::Ptr< recob::Hit >> hits)
std::pair< TVector3, TVector3 > TrackDirectionAverage(recob::Track track, double frac)
do i e
Point_t const & End() const
stream1 can override from command line with o or output services user sbnd
Vector_t DirectionAtPoint(size_t i) const
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
virtual bool EnableCalSpatialSCE() const =0
std::pair< TVector3, TVector3 > TrackDirection(detinfo::DetectorPropertiesData const &detProp, recob::Track track, double frac, double CRTtime, int driftDirection)
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
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track: