Belle II Software  release-08-01-10
TimeExtractionUtils.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 <framework/datastore/StoreObjPtr.h>
11 #include <framework/dataobjects/EventT0.h>
12 
13 #include <vector>
14 #include <TVectorD.h>
15 #include <TMatrixDSym.h>
16 
17 namespace Belle2 {
22  class RecoTrack;
23 
49  public:
51  static std::pair<double, double> getChi2WithFit(const std::vector<RecoTrack*>& recoTracks, bool setDirtyFlag);
52 
54  static std::pair<double, double> getExtractedTimeAndUncertaintyWithFit(const std::vector<RecoTrack*>& recoTracks,
55  bool setDirtyFlag);
56 
58  static void addEventT0WithQuality(const std::vector<RecoTrack*>& recoTracks, StoreObjPtr<EventT0>& eventT0,
59  std::vector<EventT0::EventT0Component>& eventT0WithQualityIndex);
60 
62  static double extractReducedChi2(const RecoTrack& recoTrack);
63 
70  static std::pair<double, double> getChi2Derivatives(const RecoTrack& recoTrack);
71 
72  private:
80  static std::vector<int> getMeasurementDimensions(const RecoTrack& recoTrack);
81 
100  static bool buildFullCovarianceMatrix(const RecoTrack& recoTrack,
101  TMatrixDSym& fullCovariance);
102 
113  static bool buildFullResidualCovarianceMatrix(const RecoTrack& recoTrack,
114  const std::vector<int>& vDimMeas,
115  const TMatrixDSym& fullCovariance,
116  TMatrixDSym& fullResidualCovariance,
117  TMatrixDSym& inverseFullMeasurementCovariance);
118 
126  static void buildResidualsAndTimeDerivative(const RecoTrack& recoTrack,
127  const std::vector<int>& vDimMeas,
128  TVectorD& residuals,
129  TVectorD& residualTimeDerivative);
130  };
132 }
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Helper class to perform all kind of track extrapolations using the methods from arXiv:0810....
static std::pair< double, double > getExtractedTimeAndUncertaintyWithFit(const std::vector< RecoTrack * > &recoTracks, bool setDirtyFlag)
Fit the tracks and extract the chi2 derivatives.
static std::pair< double, double > getChi2WithFit(const std::vector< RecoTrack * > &recoTracks, bool setDirtyFlag)
Fit the tracks and extract the reduced chi2.
static void buildResidualsAndTimeDerivative(const RecoTrack &recoTrack, const std::vector< int > &vDimMeas, TVectorD &residuals, TVectorD &residualTimeDerivative)
Calculate the weighted residuals (weighted with the DAF weight) of each hit and the time derivative o...
static std::pair< double, double > getChi2Derivatives(const RecoTrack &recoTrack)
Extract the derivatives d chi^2 / d alpha and d^2 chi^2 / (d alpha)^2 from the reco track by calculat...
static bool buildFullCovarianceMatrix(const RecoTrack &recoTrack, TMatrixDSym &fullCovariance)
Build the full covariance matrix of the given reco track and fills it into the given TMatrixDSym.
static double extractReducedChi2(const RecoTrack &recoTrack)
Small helper function to extract the reduced chi^2 (chi^2/ndf). Returns NaN if ndf is 0.
static void addEventT0WithQuality(const std::vector< RecoTrack * > &recoTracks, StoreObjPtr< EventT0 > &eventT0, std::vector< EventT0::EventT0Component > &eventT0WithQualityIndex)
Append an event-t0 value with quality information.
static std::vector< int > getMeasurementDimensions(const RecoTrack &recoTrack)
Get a list of dimensions for each measurement in the reco track.
static bool buildFullResidualCovarianceMatrix(const RecoTrack &recoTrack, const std::vector< int > &vDimMeas, const TMatrixDSym &fullCovariance, TMatrixDSym &fullResidualCovariance, TMatrixDSym &inverseFullMeasurementCovariance)
Build the full covariance matrix of the residuals of the measurements out of the full covariance matr...
Abstract base class for different kinds of events.