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