Belle II Software  release-05-02-19
MCSegmentRelationFilter.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/segmentRelation/MCSegmentRelationFilter.h>
11 
12 #include <tracking/trackFindingCDC/mclookup/CDCMCSegment2DLookUp.h>
13 
14 #include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
15 
16 #include <tracking/trackFindingCDC/filters/base/MCSymmetricFilter.icc.h>
17 
18 #include <tracking/trackFindingCDC/numerics/EForwardBackward.h>
19 
20 #include <framework/core/ModuleParamList.templateDetails.h>
21 
22 #include <cmath>
23 
24 using namespace Belle2;
25 using namespace TrackFindingCDC;
26 
28 
30  : Super(allowReverse)
31 {
32 }
33 
35  const std::string& prefix)
36 {
37  Super::exposeParameters(moduleParamList, prefix);
38  moduleParamList->addParameter(prefixed(prefix, "requireRLPure"),
40  "Switch to require the segment combination contain mostly correct rl information",
42 
43 }
44 
46  const CDCSegment2D& toSegment)
47 {
49 
50  // Check if the segments are aligned correctly along the Monte Carlo track
51  EForwardBackward pairFBInfo =
53  ? mcSegmentLookUp.areAlignedInMCTrackWithRLCheck(&fromSegment, &toSegment)
54  : mcSegmentLookUp.areAlignedInMCTrack(&fromSegment, &toSegment);
55 
56  if (pairFBInfo == EForwardBackward::c_Invalid) return NAN;
57 
58  if (pairFBInfo == EForwardBackward::c_Forward or
59  (getAllowReverse() and pairFBInfo == EForwardBackward::c_Backward)) {
60 
61  // Final check for the distance between the segment
62  Index fromNPassedSuperLayers = mcSegmentLookUp.getLastNPassedSuperLayers(&fromSegment);
63  if (fromNPassedSuperLayers == c_InvalidIndex) return NAN;
64 
65  Index toNPassedSuperLayers = mcSegmentLookUp.getFirstNPassedSuperLayers(&toSegment);
66  if (toNPassedSuperLayers == c_InvalidIndex) return NAN;
67 
68  // Allow relations only from the same super layer
69  if (fromNPassedSuperLayers != toNPassedSuperLayers) return NAN;
70 
71  return fromSegment.size() + toSegment.size();
72  }
73 
74  return NAN;
75 }
Belle2::TrackFindingCDC::RelationFilter< const CDCSegment2D >
Belle2::TrackFindingCDC::MCSymmetric< BaseSegmentRelationFilter >::getAllowReverse
bool getAllowReverse() const
Getter for the allow reverse parameter.
Definition: MCSymmetricFilter.icc.h:85
Belle2::TrackFindingCDC::MCSegmentRelationFilter::MCSegmentRelationFilter
MCSegmentRelationFilter(bool allowReverse=true)
Constructor.
Definition: MCSegmentRelationFilter.cc:29
Belle2::TrackFindingCDC::MCSegmentRelationFilter::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
Definition: MCSegmentRelationFilter.cc:34
Belle2::TrackFindingCDC::CDCMCHitCollectionLookUp::areAlignedInMCTrackWithRLCheck
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...
Definition: CDCMCHitCollectionLookUp.icc.h:327
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::CDCMCSegment2DLookUp
Specialisation of the lookup for the truth values of two dimensional segments.
Definition: CDCMCSegment2DLookUp.h:33
Belle2::TrackFindingCDC::MCSymmetric< BaseSegmentRelationFilter >
Belle2::TrackFindingCDC::NForwardBackward::EForwardBackward
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
Definition: EForwardBackward.h:35
Belle2::TrackFindingCDC::CDCMCSegment2DLookUp::getInstance
static const CDCMCSegment2DLookUp & getInstance()
Getter for the singletone instance.
Definition: CDCMCSegment2DLookUp.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::ModuleParamList::addParameter
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Definition: ModuleParamList.templateDetails.h:38
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::MCSegmentRelationFilter::operator()
Weight operator()(const CDCSegment2D &fromSegment, const CDCSegment2D &toSegment) final
Checks if a segment relation is a good combination.
Definition: MCSegmentRelationFilter.cc:45
Belle2::TrackFindingCDC::CDCSegment2D
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:40
Belle2::TrackFindingCDC::MCSegmentRelationFilter::m_param_requireRLPure
bool m_param_requireRLPure
Parameter : Switch to require the segment combination contain mostly correct rl information.
Definition: MCSegmentRelationFilter.h:51
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46
Belle2::TrackFindingCDC::MCSymmetric< BaseSegmentRelationFilter >::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the set of parameters of the filter to the module parameter list.
Definition: MCSymmetricFilter.icc.h:48
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