Belle II Software  release-08-01-10
CDCSZObservations.h
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 #pragma once
9 
10 #include <tracking/trackFindingCDC/fitting/EFitVariance.h>
11 
12 #include <vector>
13 
14 namespace Belle2 {
19  namespace TrackFindingCDC {
20  class Vector2D;
21  class CDCRecoHit3D;
22  class CDCSegment3D;
23  class CDCTrack;
24 
27 
28  public:
36  explicit CDCSZObservations(EFitVariance fitVariance = EFitVariance::c_Proper,
37  bool onlyStereo = false)
38  : m_fitVariance(fitVariance)
39  , m_onlyStereo(onlyStereo)
40  {
41  }
42 
43  public:
45  std::size_t size() const
46  {
47  return m_szObservations.size() / 3;
48  }
49 
51  double* data()
52  {
53  return m_szObservations.data();
54  }
55 
57  bool empty() const
58  {
59  return m_szObservations.empty();
60  }
61 
63  void clear()
64  {
65  m_szObservations.clear();
66  }
67 
69  void reserve(std::size_t nObservations)
70  {
71  m_szObservations.reserve(nObservations * 3);
72  }
73 
75  double getS(int iObservation) const
76  {
77  return m_szObservations[iObservation * 3];
78  }
79 
81  double getZ(int iObservation) const
82  {
83  return m_szObservations[iObservation * 3 + 1];
84  }
85 
87  double getWeight(int iObservation) const
88  {
89  return m_szObservations[iObservation * 3 + 2];
90  }
91 
103  std::size_t fill(double s, double z, double weight = 1.0);
104 
106  std::size_t append(const CDCRecoHit3D& recoHit3D);
107 
112  std::size_t appendRange(const std::vector<CDCRecoHit3D>& recoHit3Ds);
113 
118  std::size_t appendRange(const CDCSegment3D& segment3D);
119 
124  std::size_t appendRange(const CDCTrack& track);
125 
127  Vector2D getCentralPoint() const;
128 
130  void passiveMoveBy(const Vector2D& origin);
131 
134 
135  public:
137  void setFitVariance(EFitVariance fitVariance)
138  {
139  m_fitVariance = fitVariance;
140  }
141 
142  private:
147  std::vector<double> m_szObservations;
148 
154  EFitVariance m_fitVariance;
155 
158  };
159  }
161 }
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52
Class serving as a storage of observed sz positions to present to the sz line fitters.
std::size_t appendRange(const std::vector< CDCRecoHit3D > &recoHit3Ds)
Appends all reconstructed hits from the three dimensional track.
bool m_onlyStereo
Switch to only use information from stereo hits.
double * data()
Return the pointer to the number buffer.
std::size_t fill(double s, double z, double weight=1.0)
Appends the observed position.
CDCSZObservations(EFitVariance fitVariance=EFitVariance::c_Proper, bool onlyStereo=false)
Constructor taking in prefered variance quanity be taken from the various hit objects if present.
Vector2D centralize()
Picks one observation as a reference point and transform all observations to that new origin.
void reserve(std::size_t nObservations)
Reserves enough space for nObservations.
void setFitVariance(EFitVariance fitVariance)
Setter for the indicator that the drift variance should be used.
bool empty() const
Returns true if there are no observations stored.
Vector2D getCentralPoint() const
Extracts the observation center that is at the index in the middle.
double getWeight(int iObservation) const
Getter for the weight / inverse variance of the observation at the given index.
double getZ(int iObservation) const
Getter for the z value of the observation at the given index.
std::size_t append(const CDCRecoHit3D &recoHit3D)
Appends the observed position.
std::vector< double > m_szObservations
Memory for the individual observations.
void passiveMoveBy(const Vector2D &origin)
Moves all observations passively such that the given vector becomes to origin of the new coordinate s...
void clear()
Removes all observations stored.
EFitVariance m_fitVariance
Indicator which variance information should preferably be extracted from hits in calls to append.
std::size_t size() const
Returns the number of observations stored.
double getS(int iObservation) const
Getter for the arc length value of the observation at the given index.
A segment consisting of three dimensional reconstructed hits.
Definition: CDCSegment3D.h:26
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:35
Abstract base class for different kinds of events.