Belle II Software  release-05-02-19
BoostVectorAlgorithm.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2021 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Radek Zlebcik *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <mdst/dbobjects/CollisionBoostVector.h>
12 #include <tracking/calibration/BoostVectorAlgorithm.h>
13 #include <tracking/calibration/BoostVectorStandAlone.h>
14 #include <tracking/calibration/calibTools.h>
15 
16 #include <Eigen/Dense>
17 
18 using Eigen::Vector3d;
19 using Eigen::Matrix3d;
20 
21 using namespace Belle2;
22 
23 using Belle2::BoostVectorCalib::getEvents;
24 using Belle2::BoostVectorCalib::runBoostVectorAnalysis;
25 
26 
28 {
29  setDescription("BoostVector calibration algorithm");
30 }
31 
32 
34 static TObject* getBoostVectorObj(Vector3d vBoost, Matrix3d vBoostUnc, Matrix3d /*vBoostSpread*/)
35 {
36  auto payload = new CollisionBoostVector();
37  payload->setBoost(toTVector3(vBoost), toTMatrixDSym(vBoostUnc));
38  TObject* obj = static_cast<TObject*>(payload);
39  return obj;
40 }
41 
42 
43 
44 /* Main calibration method calling dedicated functions */
46 {
47  TTree* tracks = getObjectPtr<TTree>("events").get();
48  return runCalibration(tracks, "CollisionBoostVector", getEvents,
49  runBoostVectorAnalysis, getBoostVectorObj,
51 }
Belle2::runCalibration
CalibrationAlgorithm::EResult runCalibration(TTree *tracks, const std::string &calibName, Fun1 GetEvents, Fun2 calibAnalysis, std::function< TObject *(Eigen::VectorXd, Eigen::MatrixXd, Eigen::MatrixXd)> calibObjCreator, TString m_lossFunctionOuter, TString m_lossFunctionInner)
Run the the calibration over the whole event sample.
Definition: calibTools.h:386
Belle2::BoostVectorAlgorithm::m_lossFunctionInner
TString m_lossFunctionInner
Inner loss function (for calibraion subintervals of mean BoostVector values)
Definition: BoostVectorAlgorithm.h:56
Belle2::toTVector3
TVector3 toTVector3(Eigen::VectorXd vIn)
Function that converts Eigen vector to ROOT vector.
Definition: calibTools.h:65
Belle2::CalibrationAlgorithm::setDescription
void setDescription(const std::string &description)
Set algorithm description (in constructor)
Definition: CalibrationAlgorithm.h:331
Belle2::toTMatrixDSym
TMatrixDSym toTMatrixDSym(Eigen::MatrixXd mIn)
Function that converts Eigen symmetric matrix to ROOT matrix.
Definition: calibTools.h:55
Belle2::BoostVectorAlgorithm::m_lossFunctionOuter
TString m_lossFunctionOuter
Outer loss function (for calibration intervals of BoostVector spread parameters)
Definition: BoostVectorAlgorithm.h:53
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::BoostVectorAlgorithm::calibrate
virtual EResult calibrate() override
Run algo on data.
Definition: BoostVectorAlgorithm.cc:45
Belle2::CalibrationAlgorithm::EResult
EResult
The result of calibration.
Definition: CalibrationAlgorithm.h:50
Belle2::BoostVectorAlgorithm::BoostVectorAlgorithm
BoostVectorAlgorithm()
Constructor set the prefix to BoostVectorCollector.
Definition: BoostVectorAlgorithm.cc:27
Belle2::CalibrationAlgorithm
Base class for calibration algorithms.
Definition: CalibrationAlgorithm.h:47
Belle2::CollisionBoostVector
This class contains the measured average boost vector vec(beta) = (beta_x, beta_y,...
Definition: CollisionBoostVector.h:33