Belle II Software development
MCTrackRelationFilter.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/trackRelation/MCTrackRelationFilter.h>
9
10#include <tracking/trackFindingCDC/mclookup/CDCMCTrackLookUp.h>
11
12#include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
13
14#include <tracking/trackFindingCDC/filters/base/MCSymmetricFilter.icc.h>
15
16using namespace Belle2;
17using namespace TrackFindingCDC;
18
20
22 : Super(allowReverse)
23{
24}
25
27 const CDCTrack& toTrack)
28{
29 const CDCMCTrackLookUp& mcTrackLookUp = CDCMCTrackLookUp::getInstance();
30
31 // Check if the tracks are aligned correctly along the Monte Carlo track
32 EForwardBackward pairFBInfo = mcTrackLookUp.areAlignedInMCTrack(&fromTrack, &toTrack);
33 if (pairFBInfo == EForwardBackward::c_Invalid) return NAN;
34
35 if (pairFBInfo == EForwardBackward::c_Forward or
36 (getAllowReverse() and pairFBInfo == EForwardBackward::c_Backward)) {
37 // Final check for the distance between the track
38 Index fromNPassedSuperLayers = mcTrackLookUp.getLastNPassedSuperLayers(&fromTrack);
39 if (fromNPassedSuperLayers == c_InvalidIndex) return NAN;
40
41 Index toNPassedSuperLayers = mcTrackLookUp.getFirstNPassedSuperLayers(&toTrack);
42 if (toNPassedSuperLayers == c_InvalidIndex) return NAN;
43
44 if (fromNPassedSuperLayers == toNPassedSuperLayers) return NAN;
45
46 // Limit loops to be merged to one
47 Index fromNLoops = mcTrackLookUp.getLastNLoops(&fromTrack);
48 Index toNLoops = mcTrackLookUp.getFirstNLoops(&toTrack);
49 if (fromNLoops != toNLoops) return NAN;
50
51 return fromTrack.size() + toTrack.size();
52 }
53
54 return NAN;
55}
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...
Index getFirstNLoops(const ACDCHitCollection *ptrHits) const
Getter for number of loops till the first hit the collection of hits which has the Monte Carlo track ...
Index getLastNLoops(const ACDCHitCollection *ptrHits) const
Getter for number of loops till the last hit the collection of hits which has the Monte Carlo track i...
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 reconstructed tracks.
static const CDCMCTrackLookUp & getInstance()
Getter for the singletone instance.
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
Mixin for filters that use Monte Carlo information.
bool getAllowReverse() const
Getter for the allow reverse parameter.
Weight operator()(const CDCTrack &fromTrack, const CDCTrack &toTrack) final
Checks if a track relation is a good combination.
MCTrackRelationFilter(bool allowReverse=false)
Constructor also setting the switch , if the reversed version of a track relation (in comparision to ...
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
Abstract base class for different kinds of events.