Belle II Software development
MCAxialSegmentPairFilter.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <tracking/trackFindingCDC/filters/axialSegmentPair/MCAxialSegmentPairFilter.h>
9
10#include <tracking/trackFindingCDC/mclookup/CDCMCSegment2DLookUp.h>
11
12#include <tracking/trackFindingCDC/fitting/CDCRiemannFitter.h>
13
14#include <tracking/trackingUtilities/eventdata/tracks/CDCAxialSegmentPair.h>
15#include <tracking/trackingUtilities/eventdata/segments/CDCSegment2D.h>
16
17#include <tracking/trackFindingCDC/filters/base/MCSymmetricFilter.icc.h>
18
19#include <framework/core/ModuleParamList.templateDetails.h>
20
21using namespace Belle2;
22using namespace TrackFindingCDC;
23using namespace TrackingUtilities;
24
26
28 : Super(allowReverse)
29{
30}
31
33 const std::string& prefix)
34{
35 Super::exposeParameters(moduleParamList, prefix);
36 moduleParamList->addParameter(prefixed(prefix, "requireRLPure"),
38 "Switch to require the segment combination contain mostly correct rl information",
40}
41
43{
44 const CDCAxialSegment2D* ptrFromSegment = axialSegmentPair.getStartSegment();
45 const CDCAxialSegment2D* ptrToSegment = axialSegmentPair.getEndSegment();
46
47 assert(ptrFromSegment);
48 assert(ptrToSegment);
49
50 const CDCAxialSegment2D& fromSegment = *ptrFromSegment;
51 const CDCAxialSegment2D& toSegment = *ptrToSegment;
52
54
55 // Check if the segments are aligned correctly along the Monte Carlo track
56 EForwardBackward pairFBInfo =
58 ? mcSegmentLookUp.areAlignedInMCTrackWithRLCheck(ptrFromSegment, ptrToSegment)
59 : mcSegmentLookUp.areAlignedInMCTrack(ptrFromSegment, ptrToSegment);
60
61 if (pairFBInfo == EForwardBackward::c_Invalid) return NAN;
62
63 if (pairFBInfo == EForwardBackward::c_Forward or (getAllowReverse() and pairFBInfo == EForwardBackward::c_Backward)) {
64 // Final check for the distance between the segment
65 Index fromNPassedSuperLayers = mcSegmentLookUp.getLastNPassedSuperLayers(ptrFromSegment);
66 if (fromNPassedSuperLayers == c_InvalidIndex) return NAN;
67
68 Index toNPassedSuperLayers = mcSegmentLookUp.getFirstNPassedSuperLayers(ptrToSegment);
69 if (toNPassedSuperLayers == c_InvalidIndex) return NAN;
70
71 // Do not join in the same superlayer - this should be the responsibility of the segment relation filter
72 if (abs(fromNPassedSuperLayers - toNPassedSuperLayers) == 0) return NAN;
73
74 // Do not join further away than two superlayers
75 if (abs(fromNPassedSuperLayers - toNPassedSuperLayers) > 2) return NAN;
76
77 if (not axialSegmentPair.getTrajectory2D().isFitted()) {
78 CDCTrajectory2D trajectory2D = CDCRiemannFitter::getFitter().fit(fromSegment, toSegment);
79 axialSegmentPair.setTrajectory2D(trajectory2D);
80 }
81
82 return fromSegment.size() + toSegment.size();
83 }
84 return NAN;
85}
The Module parameter list class.
TrackingUtilities::CDCTrajectory2D fit(const CDCObservations2D &observations2D) const
Fits a collection of observation drift circles.
TrackingUtilities::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...
TrackingUtilities::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...
TrackingUtilities::Index getFirstNPassedSuperLayers(const ACDCHitCollection *ptrHits) const
Getter for number of passed superlayer till the first hit the collection of hits which has the Monte ...
TrackingUtilities::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...
Specialisation of the lookup for the truth values of two dimensional segments.
static const CDCMCSegment2DLookUp & getInstance()
Getter for the singletone instance.
static const CDCRiemannFitter & getFitter()
Static getter for a general Riemann fitter.
bool m_param_requireRLPure
Parameter : Switch to require the segment combination contain mostly correct rl information.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
TrackingUtilities::Weight operator()(const TrackingUtilities::CDCAxialSegmentPair &axialSegmentPair) final
Checks if a pair of axial segments is a good combination.
MCSymmetric< BaseAxialSegmentPairFilter > Super
Type of the super class.
MCAxialSegmentPairFilter(bool allowReverse=true)
Constructor.
Mixin for filters that use Monte Carlo information.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Class representing a pair of reconstructed axial segments in adjacent superlayer.
void setTrajectory2D(const CDCTrajectory2D &trajectory2D) const
Setter for the trajectory of the two dimensional trajectory.
const CDCAxialSegment2D * getEndSegment() const
Getter for the end segment.
CDCTrajectory2D & getTrajectory2D() const
Getter for the trajectory of the two dimensional trajectory.
const CDCAxialSegment2D * getStartSegment() const
Getter for the start segment.
Particle trajectory as it is seen in xy projection represented as a circle.
bool isFitted() const
Checks if the circle is already set to a valid value.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.