Belle II Software  release-05-02-19
TimeExtractionUtils.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost, Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <framework/datastore/StoreObjPtr.h>
13 #include <framework/dataobjects/EventT0.h>
14 
15 #include <vector>
16 #include <TVectorD.h>
17 #include <TMatrixDSym.h>
18 
19 namespace Belle2 {
24  class RecoTrack;
25 
50  class TimeExtractionUtils {
51  public:
53  static std::pair<double, double> getChi2WithFit(const std::vector<RecoTrack*>& recoTracks, bool setDirtyFlag);
54 
56  static std::pair<double, double> getExtractedTimeAndUncertaintyWithFit(const std::vector<RecoTrack*>& recoTracks,
57  bool setDirtyFlag);
58 
60  static void addEventT0WithQuality(std::vector<RecoTrack*>& recoTracks, StoreObjPtr<EventT0>& eventT0,
61  std::vector<EventT0::EventT0Component>& eventT0WithQualityIndex);
62 
64  static double extractReducedChi2(const RecoTrack& recoTrack);
65 
72  static std::pair<double, double> getChi2Derivatives(const RecoTrack& recoTrack);
73 
74  private:
82  static std::vector<int> getMeasurementDimensions(const RecoTrack& recoTrack);
83 
102  static bool buildFullCovarianceMatrix(const RecoTrack& recoTrack,
103  TMatrixDSym& fullCovariance);
104 
115  static bool buildFullResidualCovarianceMatrix(const RecoTrack& recoTrack,
116  const std::vector<int>& vDimMeas,
117  const TMatrixDSym& fullCovariance,
118  TMatrixDSym& fullResidualCovariance,
119  TMatrixDSym& inverseFullMeasurementCovariance);
120 
128  static void buildResidualsAndTimeDerivative(const RecoTrack& recoTrack,
129  const std::vector<int>& vDimMeas,
130  TVectorD& residuals,
131  TVectorD& residualTimeDerivative);
132  };
134 }
Belle2::TimeExtractionUtils::addEventT0WithQuality
static void addEventT0WithQuality(std::vector< RecoTrack * > &recoTracks, StoreObjPtr< EventT0 > &eventT0, std::vector< EventT0::EventT0Component > &eventT0WithQualityIndex)
Append an event-t0 value with quality information.
Definition: TimeExtractionUtils.cc:78
Belle2::TimeExtractionUtils::buildResidualsAndTimeDerivative
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...
Definition: TimeExtractionUtils.cc:428
Belle2::TimeExtractionUtils::getChi2Derivatives
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...
Definition: TimeExtractionUtils.cc:201
Belle2::TimeExtractionUtils::getMeasurementDimensions
static std::vector< int > getMeasurementDimensions(const RecoTrack &recoTrack)
Get a list of dimensions for each measurement in the reco track.
Definition: TimeExtractionUtils.cc:259
Belle2::TimeExtractionUtils::getExtractedTimeAndUncertaintyWithFit
static std::pair< double, double > getExtractedTimeAndUncertaintyWithFit(const std::vector< RecoTrack * > &recoTracks, bool setDirtyFlag)
Fit the tracks and extract the chi2 derivatives.
Definition: TimeExtractionUtils.cc:142
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::TimeExtractionUtils::extractReducedChi2
static double extractReducedChi2(const RecoTrack &recoTrack)
Small helper function to extract the reduced chi^2 (chi^2/ndf). Returns NaN if ndf is 0.
Definition: TimeExtractionUtils.cc:188
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::TimeExtractionUtils::buildFullResidualCovarianceMatrix
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...
Definition: TimeExtractionUtils.cc:359
Belle2::TimeExtractionUtils::buildFullCovarianceMatrix
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.
Definition: TimeExtractionUtils.cc:275
Belle2::TimeExtractionUtils::getChi2WithFit
static std::pair< double, double > getChi2WithFit(const std::vector< RecoTrack * > &recoTracks, bool setDirtyFlag)
Fit the tracks and extract the reduced chi2.
Definition: TimeExtractionUtils.cc:105