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/trackingUtilities/eventdata/segments/CDCSegment2D.h>
13
14#include <tracking/trackFindingCDC/filters/base/MCSymmetricFilter.icc.h>
15
16#include <tracking/trackingUtilities/numerics/EForwardBackward.h>
17
18#include <framework/core/ModuleParamList.templateDetails.h>
19
20#include <cmath>
21
22using namespace Belle2;
23using namespace TrackFindingCDC;
24using namespace TrackingUtilities;
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}
43
45 const CDCSegment2D& toSegment)
46{
48
49 // Check if the segments are aligned correctly along the Monte Carlo track
50 EForwardBackward pairFBInfo =
52 ? mcSegmentLookUp.areAlignedInMCTrackWithRLCheck(&fromSegment, &toSegment)
53 : mcSegmentLookUp.areAlignedInMCTrack(&fromSegment, &toSegment);
54
55 if (pairFBInfo == EForwardBackward::c_Invalid) return NAN;
56
57 if (pairFBInfo == EForwardBackward::c_Forward or
58 (getAllowReverse() and pairFBInfo == EForwardBackward::c_Backward)) {
59
60 // Final check for the distance between the segment
61 Index fromNPassedSuperLayers = mcSegmentLookUp.getLastNPassedSuperLayers(&fromSegment);
62 if (fromNPassedSuperLayers == c_InvalidIndex) return NAN;
63
64 Index toNPassedSuperLayers = mcSegmentLookUp.getFirstNPassedSuperLayers(&toSegment);
65 if (toNPassedSuperLayers == c_InvalidIndex) return NAN;
66
67 // Allow relations only from the same super layer
68 if (fromNPassedSuperLayers != toNPassedSuperLayers) return NAN;
69
70 return fromSegment.size() + toSegment.size();
71 }
72
73 return NAN;
74}
The Module parameter list class.
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.
bool m_param_requireRLPure
Parameter : Switch to require the segment combination contain mostly correct rl information.
MCSymmetric< BaseSegmentRelationFilter > Super
Type of the super class.
TrackingUtilities::Weight operator()(const TrackingUtilities::CDCSegment2D &fromSegment, const TrackingUtilities::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
A reconstructed sequence of two dimensional hits in one super layer.
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.