Belle II Software  release-05-01-25
MCAxialSegmentPairFilter.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - 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/axialSegmentPair/MCAxialSegmentPairFilter.h>
11 
12 #include <tracking/trackFindingCDC/mclookup/CDCMCSegment2DLookUp.h>
13 
14 #include <tracking/trackFindingCDC/fitting/CDCRiemannFitter.h>
15 
16 #include <tracking/trackFindingCDC/eventdata/tracks/CDCAxialSegmentPair.h>
17 #include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
18 
19 #include <tracking/trackFindingCDC/filters/base/MCSymmetricFilter.icc.h>
20 
21 #include <framework/core/ModuleParamList.templateDetails.h>
22 
23 using namespace Belle2;
24 using namespace TrackFindingCDC;
25 
27 
29  : Super(allowReverse)
30 {
31 }
32 
34  const std::string& prefix)
35 {
36  Super::exposeParameters(moduleParamList, prefix);
37  moduleParamList->addParameter(prefixed(prefix, "requireRLPure"),
39  "Switch to require the segment combination contain mostly correct rl information",
41 }
42 
44 {
45  const CDCAxialSegment2D* ptrFromSegment = axialSegmentPair.getStartSegment();
46  const CDCAxialSegment2D* ptrToSegment = axialSegmentPair.getEndSegment();
47 
48  assert(ptrFromSegment);
49  assert(ptrToSegment);
50 
51  const CDCAxialSegment2D& fromSegment = *ptrFromSegment;
52  const CDCAxialSegment2D& toSegment = *ptrToSegment;
53 
55 
56  // Check if the segments are aligned correctly along the Monte Carlo track
57  EForwardBackward pairFBInfo =
59  ? mcSegmentLookUp.areAlignedInMCTrackWithRLCheck(ptrFromSegment, ptrToSegment)
60  : mcSegmentLookUp.areAlignedInMCTrack(ptrFromSegment, ptrToSegment);
61 
62  if (pairFBInfo == EForwardBackward::c_Invalid) return NAN;
63 
64  if (pairFBInfo == EForwardBackward::c_Forward or (getAllowReverse() and pairFBInfo == EForwardBackward::c_Backward)) {
65  // Final check for the distance between the segment
66  Index fromNPassedSuperLayers = mcSegmentLookUp.getLastNPassedSuperLayers(ptrFromSegment);
67  if (fromNPassedSuperLayers == c_InvalidIndex) return NAN;
68 
69  Index toNPassedSuperLayers = mcSegmentLookUp.getFirstNPassedSuperLayers(ptrToSegment);
70  if (toNPassedSuperLayers == c_InvalidIndex) return NAN;
71 
72  // Do not join in the same superlayer - this should be the responsibility of the segment relation filter
73  if (abs(fromNPassedSuperLayers - toNPassedSuperLayers) == 0) return NAN;
74 
75  // Do not join further away than two superlayers
76  if (abs(fromNPassedSuperLayers - toNPassedSuperLayers) > 2) return NAN;
77 
78  if (not axialSegmentPair.getTrajectory2D().isFitted()) {
79  CDCTrajectory2D trajectory2D = CDCRiemannFitter::getFitter().fit(fromSegment, toSegment);
80  axialSegmentPair.setTrajectory2D(trajectory2D);
81  }
82 
83  return fromSegment.size() + toSegment.size();
84  }
85  return NAN;
86 }
Belle2::TrackFindingCDC::MCSymmetric< BaseAxialSegmentPairFilter >::getAllowReverse
bool getAllowReverse() const
Getter for the allow reverse parameter.
Definition: MCSymmetricFilter.icc.h:85
Belle2::TrackFindingCDC::MCAxialSegmentPairFilter::MCAxialSegmentPairFilter
MCAxialSegmentPairFilter(bool allowReverse=true)
Constructor.
Definition: MCAxialSegmentPairFilter.cc:28
Belle2::TrackFindingCDC::CDCMCHitCollectionLookUp::areAlignedInMCTrackWithRLCheck
EForwardBackward areAlignedInMCTrackWithRLCheck(const ACDCHitCollection *ptrFromHits, const ACDCHitCollection *ptrToHits) const
Returns if the second collection of hits follows the first collection of hits in their common Monte C...
Definition: CDCMCHitCollectionLookUp.icc.h:327
Belle2::TrackFindingCDC::CDCMCHitCollectionLookUp::getFirstNPassedSuperLayers
Index getFirstNPassedSuperLayers(const ACDCHitCollection *ptrHits) const
Getter for number of passed superlayer till the first hit the collection of hits which has the Monte ...
Definition: CDCMCHitCollectionLookUp.h:143
Belle2::TrackFindingCDC::CDCAxialSegmentPair::getStartSegment
const CDCAxialSegment2D * getStartSegment() const
Getter for the start segment.
Definition: CDCAxialSegmentPair.h:99
Belle2::TrackFindingCDC::CDCMCSegment2DLookUp
Specialisation of the lookup for the truth values of two dimensional segments.
Definition: CDCMCSegment2DLookUp.h:33
Belle2::TrackFindingCDC::MCSymmetric< BaseAxialSegmentPairFilter >
Belle2::TrackFindingCDC::NForwardBackward::EForwardBackward
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
Definition: EForwardBackward.h:35
Belle2::TrackFindingCDC::CDCMCSegment2DLookUp::getInstance
static const CDCMCSegment2DLookUp & getInstance()
Getter for the singletone instance.
Definition: CDCMCSegment2DLookUp.cc:23
Belle2::TrackFindingCDC::CDCTrajectory2D
Particle trajectory as it is seen in xy projection represented as a circle.
Definition: CDCTrajectory2D.h:46
Belle2::TrackFindingCDC::CDCAxialSegmentPair::getEndSegment
const CDCAxialSegment2D * getEndSegment() const
Getter for the end segment.
Definition: CDCAxialSegmentPair.h:111
Belle2::TrackFindingCDC::MCAxialSegmentPairFilter::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
Definition: MCAxialSegmentPairFilter.cc:33
Belle2::TrackFindingCDC::CDCMCHitCollectionLookUp::areAlignedInMCTrack
EForwardBackward areAlignedInMCTrack(const ACDCHitCollection *ptrFromHits, const ACDCHitCollection *ptrToHits) const
Returns if the second collection of hits follows the first collection of hits in their common Monte C...
Definition: CDCMCHitCollectionLookUp.icc.h:210
Belle2::TrackFindingCDC::MCAxialSegmentPairFilter::m_param_requireRLPure
bool m_param_requireRLPure
Parameter : Switch to require the segment combination contain mostly correct rl information.
Definition: MCAxialSegmentPairFilter.h:52
Belle2::ModuleParamList::addParameter
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Definition: ModuleParamList.templateDetails.h:38
Belle2::TrackFindingCDC::CDCAxialSegmentPair
Class representing a pair of reconstructed axial segements in adjacent superlayer.
Definition: CDCAxialSegmentPair.h:41
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCFitter2D::fit
CDCTrajectory2D fit(const CDCObservations2D &observations2D) const
Fits a collection of observation drift circles.
Definition: CDCFitter2D.icc.h:48
Belle2::TrackFindingCDC::CDCAxialSegmentPair::getTrajectory2D
CDCTrajectory2D & getTrajectory2D() const
Getter for the trajectory of the two dimensional trajectory.
Definition: CDCAxialSegmentPair.h:131
Belle2::TrackFindingCDC::CDCTrajectory2D::isFitted
bool isFitted() const
Checks if the circle is already set to a valid value.
Definition: CDCTrajectory2D.cc:85
Belle2::TrackFindingCDC::CDCRiemannFitter::getFitter
static const CDCRiemannFitter & getFitter()
Static getter for a general Riemann fitter.
Definition: CDCRiemannFitter.cc:22
Belle2::TrackFindingCDC::CDCSegment2D
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:40
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46
Belle2::TrackFindingCDC::MCSymmetric< BaseAxialSegmentPairFilter >::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the set of parameters of the filter to the module parameter list.
Definition: MCSymmetricFilter.icc.h:48
Belle2::TrackFindingCDC::CDCAxialSegmentPair::setTrajectory2D
void setTrajectory2D(const CDCTrajectory2D &trajectory2D) const
Setter for the trajectory of the two dimensional trajectory.
Definition: CDCAxialSegmentPair.h:137
Belle2::TrackFindingCDC::MCAxialSegmentPairFilter::operator()
Weight operator()(const CDCAxialSegmentPair &axialSegmentPair) final
Checks if a pair of axial segments is a good combination.
Definition: MCAxialSegmentPairFilter.cc:43
Belle2::TrackFindingCDC::CDCMCHitCollectionLookUp::getLastNPassedSuperLayers
Index getLastNPassedSuperLayers(const ACDCHitCollection *ptrHits) const
Getter for number of passed superlayer till the last hit the collection of hits which has the Monte C...
Definition: CDCMCHitCollectionLookUp.h:147