Belle II Software development
BasicAxialSegmentPairVarSet.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/axialSegmentPair/BasicAxialSegmentPairVarSet.h>
9
10#include <tracking/trackingUtilities/eventdata/tracks/CDCAxialSegmentPair.h>
11#include <tracking/trackingUtilities/eventdata/segments/CDCSegment2D.h>
12#include <tracking/trackingUtilities/eventdata/hits/CDCRecoHit2D.h>
13#include <tracking/trackingUtilities/eventdata/hits/CDCWireHit.h>
14
15#include <tracking/trackingUtilities/utilities/Functional.h>
16
17using namespace Belle2;
18using namespace TrackFindingCDC;
19using namespace TrackingUtilities;
20
21namespace {
22 std::array<int, 8> getNHitsByILayer(const CDCSegment2D& segment)
23 {
24 std::array<int, 8> result{};
25 for (const CDCRecoHit2D& recoHit2D : segment) {
26 ++result[recoHit2D.getWireHit().getILayer()];
27 }
28 return result;
29 }
30}
31
33{
34 if (not ptrAxialSegmentPair) return false;
35
36 const CDCAxialSegmentPair& axialSegmentPair = *ptrAxialSegmentPair;
37
38 const CDCSegment2D* ptrFromSegment = axialSegmentPair.getStartSegment();
39 const CDCSegment2D* ptrToSegment = axialSegmentPair.getEndSegment();
40
41 const CDCSegment2D& fromSegment = *ptrFromSegment;
42 const CDCSegment2D& toSegment = *ptrToSegment;
43
44 var<named("stereo_kind")>() = static_cast<float>(fromSegment.getStereoKind());
45 var<named("sl_id")>() = fromSegment.getISuperLayer();
46
47 var<named("from_size")>() = fromSegment.size();
48 var<named("to_size")>() = toSegment.size();
49
50 std::array<int, 8> fromNHitsByILayer = getNHitsByILayer(fromSegment);
51 std::array<int, 8> toNHitsByILayer = getNHitsByILayer(toSegment);
52
53 var<named("from_n_layers")>() = std::count_if(fromNHitsByILayer.begin(), fromNHitsByILayer.end(), Id() > 0);;
54 var<named("to_n_layers")>() = std::count_if(toNHitsByILayer.begin(), toNHitsByILayer.end(), Id() > 0);
55
56 return true;
57}
bool extract(const TrackingUtilities::CDCAxialSegmentPair *ptrAxialSegmentPair) override
Generate and assign the contained variables.
Class representing a pair of reconstructed axial segments in adjacent superlayer.
const CDCAxialSegment2D * getEndSegment() const
Getter for the end segment.
const CDCAxialSegment2D * getStartSegment() const
Getter for the start segment.
Class representing a two dimensional reconstructed hit in the central drift chamber.
A reconstructed sequence of two dimensional hits in one super layer.
CDC::ISuperLayer getISuperLayer() const
Returns the common super layer id of all stored tracking hits.
Definition CDCSegment.h:57
CDC::EStereoKind getStereoKind() const
Returns the common stereo type of all hits.
Definition CDCSegment.h:39
Abstract base class for different kinds of events.
Generic identity functor.
Definition Functional.h:25