Belle II Software  release-05-01-25
SimpleSegmentTripleFilter.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/filters/segmentTriple/SimpleSegmentTripleFilter.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/tracks/CDCSegmentTriple.h>
13 #include <tracking/trackFindingCDC/eventdata/segments/CDCSegment3D.h>
14 #include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
15 
16 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectorySZ.h>
17 
18 #include <tracking/trackFindingCDC/topology/CDCWire.h>
19 
20 #include <framework/logging/Logger.h>
21 
22 using namespace Belle2;
23 using namespace TrackFindingCDC;
24 
26 {
27  const CDCAxialSegment2D* ptrStartSegment = segmentTriple.getStartSegment();
28  const CDCStereoSegment2D* ptrMiddleSegment = segmentTriple.getMiddleSegment();
29  const CDCAxialSegment2D* ptrEndSegment = segmentTriple.getEndSegment();
30 
31  assert(ptrStartSegment);
32  assert(ptrMiddleSegment);
33  assert(ptrEndSegment);
34 
35  const CDCAxialSegment2D& startSegment = *ptrStartSegment;
36  const CDCStereoSegment2D& middleSegment = *ptrMiddleSegment;
37  const CDCAxialSegment2D& endSegment = *ptrEndSegment;
38 
39  const double toleranceFraction = 0.0;
40 
41  // Check if the middle segment lies within the acceptable bounds in angular deviation
42  {
43  //get the remembered fits
44  const CDCTrajectory2D& startFit = startSegment.getTrajectory2D();
45  const CDCTrajectory2D& endFit = endSegment.getTrajectory2D();
46 
47  //use only the first and last hit for this check
48  const CDCRecoHit2D& firstHit = middleSegment.front();
49  const CDCRecoHit2D& lastHit = middleSegment.back();
50 
51  Vector3D firstRecoPos = firstHit.reconstruct3D(startFit);
52  Vector3D lastRecoPos = lastHit.reconstruct3D(endFit);
53 
54  const CDCWire& firstWire = firstHit.getWire();
55  const CDCWire& lastWire = lastHit.getWire();
56 
57  const bool agrees =
58  firstWire.isInCellZBounds(firstRecoPos, toleranceFraction) and
59  lastWire.isInCellZBounds(lastRecoPos, toleranceFraction);
60 
61  if (not agrees) return NAN;
62  }
63 
64  // make more complex judgement on fitness
65 
66  // Get the combined fit of start and end axial segment
67  CDCTrajectory2D trajectory2D = getFitter2D().fit(*(segmentTriple.getStartSegment()),
68  *(segmentTriple.getEndSegment()));
69 
70  // Check if the middle segment is actually coaligned with the trajectory
71  EForwardBackward fbInfo = trajectory2D.isForwardOrBackwardTo(middleSegment);
72  if (fbInfo != EForwardBackward::c_Forward) return NAN;
73 
74  // Reconstruct the middle stereo segment
75  CDCSegment3D reconstructedMiddle;
76  for (const CDCRecoHit2D& recoHit2D : middleSegment) {
77  reconstructedMiddle.push_back(CDCRecoHit3D::reconstruct(recoHit2D, trajectory2D));
78  if (not reconstructedMiddle.back().isInCellZBounds(toleranceFraction)) {
79  B2DEBUG(100, " RecoHit out of CDC");
80  return NAN;
81  }
82  }
83 
84  // Fit the sz slope and intercept
85  CDCTrajectorySZ trajectorySZ;
86  getSZFitter().update(trajectorySZ, middleSegment, trajectory2D);
87  segmentTriple.setTrajectory3D(CDCTrajectory3D(trajectory2D, trajectorySZ));
88 
89  Weight result = startSegment.size() + middleSegment.size() + endSegment.size();
90 
91  return result;
92 }
Belle2::TrackFindingCDC::CDCSegmentTriple::getStartSegment
const CDCAxialSegment2D * getStartSegment() const
Getter for the start axial segment.
Definition: CDCSegmentTriple.h:111
Belle2::TrackFindingCDC::CDCSegmentTriple::getMiddleSegment
const CDCStereoSegment2D * getMiddleSegment() const
Getter for the middle stereo segment.
Definition: CDCSegmentTriple.h:123
Belle2::TrackFindingCDC::SimpleSegmentTripleFilter::getFitter2D
const CDCRiemannFitter & getFitter2D() const
Returns the xy fitter instance that is used by this filter.
Definition: SimpleSegmentTripleFilter.h:49
Belle2::TrackFindingCDC::CDCSegmentTriple::setTrajectory3D
void setTrajectory3D(const CDCTrajectory3D &trajectory3D) const
Setter for the three dimensional helix trajectory.
Definition: CDCSegmentTriple.h:159
Belle2::TrackFindingCDC::CDCWire::isInCellZBounds
bool isInCellZBounds(const Vector3D &pos3D, const double factor=1) const
Checks whether the position is in the z bounds of the drift cell (scaled by the factor) surrounding t...
Definition: CDCWire.h:297
Belle2::TrackFindingCDC::CDCTrajectorySZ
Linear trajectory in sz space.
Definition: CDCTrajectorySZ.h:41
Belle2::TrackFindingCDC::CDCSegment3D
A segment consisting of three dimensional reconstructed hits.
Definition: CDCSegment3D.h:36
Belle2::TrackFindingCDC::NForwardBackward::EForwardBackward
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
Definition: EForwardBackward.h:35
Belle2::TrackFindingCDC::CDCSegmentTriple::getEndSegment
const CDCAxialSegment2D * getEndSegment() const
Getter for the end axial segment.
Definition: CDCSegmentTriple.h:135
Belle2::TrackFindingCDC::CDCTrajectory2D
Particle trajectory as it is seen in xy projection represented as a circle.
Definition: CDCTrajectory2D.h:46
Belle2::TrackFindingCDC::SimpleSegmentTripleFilter::getSZFitter
const CDCSZFitter & getSZFitter() const
Returns the sz fitter instance that is used by this filter.
Definition: SimpleSegmentTripleFilter.h:53
Belle2::TrackFindingCDC::CDCRecoHit2D::getWire
const CDCWire & getWire() const
Getter for the wire the reconstructed hit assoziated to.
Definition: CDCRecoHit2D.h:185
Belle2::TrackFindingCDC::CDCRecoHit2D
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:57
Belle2::TrackFindingCDC::CDCSegment::getTrajectory2D
CDCTrajectory2D & getTrajectory2D() const
Getter for the two dimensional trajectory fitted to the segment.
Definition: CDCSegment.h:79
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::CDCSZFitter::update
void update(const CDCSegmentPair &segmentPair) const
Updates the trajectory of the axial stereo segment pair inplace.
Definition: CDCSZFitter.cc:165
Belle2::TrackFindingCDC::SimpleSegmentTripleFilter::operator()
Weight operator()(const CDCSegmentTriple &segmentTriple) final
Checks if a triple of axial, stereo and axial segments is a good combination to be stored.
Definition: SimpleSegmentTripleFilter.cc:25
Belle2::TrackFindingCDC::CDCFitter2D::fit
CDCTrajectory2D fit(const CDCObservations2D &observations2D) const
Fits a collection of observation drift circles.
Definition: CDCFitter2D.icc.h:48
Belle2::TrackFindingCDC::CDCWire
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:60
Belle2::TrackFindingCDC::CDCSegment2D
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:40
Belle2::TrackFindingCDC::CDCTrajectory2D::isForwardOrBackwardTo
EForwardBackward isForwardOrBackwardTo(const AHits &hits) const
Calculates if this trajectory and the hits are coaligned Returns:
Definition: CDCTrajectory2D.h:210
Belle2::TrackFindingCDC::CDCRecoHit3D::reconstruct
static CDCRecoHit3D reconstruct(const CDCRecoHit2D &recoHit2D, const CDCTrajectory2D &trajectory2D)
Reconstructs the three dimensional hit from the two dimensional and the two dimensional trajectory.
Definition: CDCRecoHit3D.cc:58
Belle2::TrackFindingCDC::CDCRecoHit2D::reconstruct3D
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, const double z=0) const
Reconstruct the three dimensional position (especially of stereo hits) by determinating the z coordin...
Definition: CDCRecoHit2D.cc:133
Belle2::TrackFindingCDC::CDCTrajectory3D
Particle full three dimensional trajectory.
Definition: CDCTrajectory3D.h:47
Belle2::TrackFindingCDC::CDCSegmentTriple
Class representing a triple of reconstructed segements in adjacent superlayer.
Definition: CDCSegmentTriple.h:42