Belle II Software  release-05-01-25
CDCSZObservations.h
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 #pragma once
11 
12 #include <tracking/trackFindingCDC/fitting/EFitVariance.h>
13 
14 #include <vector>
15 
16 namespace Belle2 {
21  namespace TrackFindingCDC {
22  class Vector2D;
23  class CDCRecoHit3D;
24  class CDCSegment3D;
25  class CDCTrack;
26 
28  class CDCSZObservations {
29 
30  public:
38  explicit CDCSZObservations(EFitVariance fitVariance = EFitVariance::c_Proper,
39  bool onlyStereo = false)
40  : m_fitVariance(fitVariance)
41  , m_onlyStereo(onlyStereo)
42  {
43  }
44 
45  public:
47  std::size_t size() const
48  {
49  return m_szObservations.size() / 3;
50  }
51 
53  double* data()
54  {
55  return m_szObservations.data();
56  }
57 
59  bool empty() const
60  {
61  return m_szObservations.empty();
62  }
63 
65  void clear()
66  {
68  }
69 
71  void reserve(std::size_t nObservations)
72  {
73  m_szObservations.reserve(nObservations * 3);
74  }
75 
77  double getS(int iObservation) const
78  {
79  return m_szObservations[iObservation * 3];
80  }
81 
83  double getZ(int iObservation) const
84  {
85  return m_szObservations[iObservation * 3 + 1];
86  }
87 
89  double getWeight(int iObservation) const
90  {
91  return m_szObservations[iObservation * 3 + 2];
92  }
93 
105  std::size_t fill(double s, double z, double weight = 1.0);
106 
108  std::size_t append(const CDCRecoHit3D& recoHit3D);
109 
114  std::size_t appendRange(const std::vector<CDCRecoHit3D>& recoHit3Ds);
115 
120  std::size_t appendRange(const CDCSegment3D& segment3D);
121 
126  std::size_t appendRange(const CDCTrack& track);
127 
129  Vector2D getCentralPoint() const;
130 
132  void passiveMoveBy(const Vector2D& origin);
133 
136 
137  public:
139  void setFitVariance(EFitVariance fitVariance)
140  {
141  m_fitVariance = fitVariance;
142  }
143 
144  private:
149  std::vector<double> m_szObservations;
150 
156  EFitVariance m_fitVariance;
157 
159  bool m_onlyStereo;
160  };
161  }
163 }
Belle2::TrackFindingCDC::CDCSZObservations::centralize
Vector2D centralize()
Picks one observation as a reference point and transform all observations to that new origin.
Definition: CDCSZObservations.cc:120
Belle2::TrackFindingCDC::CDCRecoHit3D
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:62
Belle2::TrackFindingCDC::CDCSZObservations::getCentralPoint
Vector2D getCentralPoint() const
Extracts the observation center that is at the index in the middle.
Definition: CDCSZObservations.cc:96
Belle2::TrackFindingCDC::CDCTrack
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:51
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::CDCSZObservations::m_fitVariance
EFitVariance m_fitVariance
Indicator which variance information should preferably be extracted from hits in calls to append.
Definition: CDCSZObservations.h:164
Belle2::TrackFindingCDC::CDCSZObservations::append
std::size_t append(const CDCRecoHit3D &recoHit3D)
Appends the observed position.
Definition: CDCSZObservations.cc:40
Belle2::TrackFindingCDC::CDCSZObservations::CDCSZObservations
CDCSZObservations(EFitVariance fitVariance=EFitVariance::c_Proper, bool onlyStereo=false)
Constructor taking in prefered variance quanity be taken from the various hit objects if present.
Definition: CDCSZObservations.h:46
Belle2::TrackFindingCDC::CDCSZObservations::size
std::size_t size() const
Returns the number of observations stored.
Definition: CDCSZObservations.h:55
Belle2::TrackFindingCDC::CDCSZObservations::empty
bool empty() const
Returns true if there are no observations stored.
Definition: CDCSZObservations.h:67
Belle2::TrackFindingCDC::CDCSegment3D
A segment consisting of three dimensional reconstructed hits.
Definition: CDCSegment3D.h:36
Belle2::TrackFindingCDC::CDCSZObservations::setFitVariance
void setFitVariance(EFitVariance fitVariance)
Setter for the indicator that the drift variance should be used.
Definition: CDCSZObservations.h:147
Belle2::TrackFindingCDC::CDCSZObservations::passiveMoveBy
void passiveMoveBy(const Vector2D &origin)
Moves all observations passively such that the given vector becomes to origin of the new coordinate s...
Definition: CDCSZObservations.cc:113
Belle2::TrackFindingCDC::CDCSZObservations::clear
void clear()
Removes all observations stored.
Definition: CDCSZObservations.h:73
Belle2::TrackFindingCDC::CDCSZObservations::data
double * data()
Return the pointer to the number buffer.
Definition: CDCSZObservations.h:61
Belle2::TrackFindingCDC::CDCSZObservations::getZ
double getZ(int iObservation) const
Getter for the z value of the observation at the given index.
Definition: CDCSZObservations.h:91
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCSZObservations::appendRange
std::size_t appendRange(const std::vector< CDCRecoHit3D > &recoHit3Ds)
Appends all reconstructed hits from the three dimensional track.
Definition: CDCSZObservations.cc:75
Belle2::TrackFindingCDC::CDCSZObservations::getS
double getS(int iObservation) const
Getter for the arc length value of the observation at the given index.
Definition: CDCSZObservations.h:85
Belle2::TrackFindingCDC::CDCSZObservations::m_szObservations
std::vector< double > m_szObservations
Memory for the individual observations.
Definition: CDCSZObservations.h:157
Belle2::TrackFindingCDC::CDCSZObservations::getWeight
double getWeight(int iObservation) const
Getter for the weight / inverse variance of the observation at the given index.
Definition: CDCSZObservations.h:97
Belle2::TrackFindingCDC::CDCSZObservations::reserve
void reserve(std::size_t nObservations)
Reserves enough space for nObservations.
Definition: CDCSZObservations.h:79
Belle2::TrackFindingCDC::CDCSZObservations::fill
std::size_t fill(double s, double z, double weight=1.0)
Appends the observed position.
Definition: CDCSZObservations.cc:25
Belle2::TrackFindingCDC::CDCSZObservations::m_onlyStereo
bool m_onlyStereo
Switch to only use information from stereo hits.
Definition: CDCSZObservations.h:167