Belle II Software development
MCSegmentRelationFilter.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/segmentRelation/MCSegmentRelationFilter.h>
9
10#include <tracking/trackFindingCDC/mclookup/CDCMCSegment2DLookUp.h>
11
12#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
13
14#include <tracking/trackFindingCDC/filters/base/MCSymmetricFilter.icc.h>
15
16#include <tracking/trackFindingCDC/numerics/EForwardBackward.h>
17
18#include <framework/core/ModuleParamList.templateDetails.h>
19
20#include <cmath>
21
22using namespace Belle2;
23using namespace TrackFindingCDC;
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}
42
44 const CDCSegment2D& toSegment)
45{
47
48 // Check if the segments are aligned correctly along the Monte Carlo track
49 EForwardBackward pairFBInfo =
51 ? mcSegmentLookUp.areAlignedInMCTrackWithRLCheck(&fromSegment, &toSegment)
52 : mcSegmentLookUp.areAlignedInMCTrack(&fromSegment, &toSegment);
53
54 if (pairFBInfo == EForwardBackward::c_Invalid) return NAN;
55
56 if (pairFBInfo == EForwardBackward::c_Forward or
57 (getAllowReverse() and pairFBInfo == EForwardBackward::c_Backward)) {
58
59 // Final check for the distance between the segment
60 Index fromNPassedSuperLayers = mcSegmentLookUp.getLastNPassedSuperLayers(&fromSegment);
61 if (fromNPassedSuperLayers == c_InvalidIndex) return NAN;
62
63 Index toNPassedSuperLayers = mcSegmentLookUp.getFirstNPassedSuperLayers(&toSegment);
64 if (toNPassedSuperLayers == c_InvalidIndex) return NAN;
65
66 // Allow relations only from the same super layer
67 if (fromNPassedSuperLayers != toNPassedSuperLayers) return NAN;
68
69 return fromSegment.size() + toSegment.size();
70 }
71
72 return NAN;
73}
The Module parameter list class.
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...
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...
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...
Index getFirstNPassedSuperLayers(const ACDCHitCollection *ptrHits) const
Getter for number of passed superlayer till the first hit the collection of hits which has the Monte ...
Specialisation of the lookup for the truth values of two dimensional segments.
static const CDCMCSegment2DLookUp & getInstance()
Getter for the singletone instance.
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
bool m_param_requireRLPure
Parameter : Switch to require the segment combination contain mostly correct rl information.
Weight operator()(const CDCSegment2D &fromSegment, const CDCSegment2D &toSegment) final
Checks if a segment relation is a good combination.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
MCSegmentRelationFilter(bool allowReverse=true)
Constructor.
Mixin for filters that use Monte Carlo information.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the set of parameters of the filter to the module parameter list.
bool getAllowReverse() const
Getter for the allow reverse parameter.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
Abstract base class for different kinds of events.