Belle II Software  release-08-01-10
BoostVectorAlgorithm.cc
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 
9 #include <mdst/dbobjects/CollisionBoostVector.h>
10 #include <tracking/calibration/BoostVectorAlgorithm.h>
11 #include <tracking/calibration/BoostVectorStandAlone.h>
12 #include <tracking/calibration/calibTools.h>
13 
14 #include <Eigen/Dense>
15 
16 using Eigen::Vector3d;
17 using Eigen::Matrix3d;
18 
19 using namespace Belle2;
20 
21 using Belle2::BoostVectorCalib::getEvents;
22 using Belle2::BoostVectorCalib::runBoostVectorAnalysis;
23 
24 
26 {
27  setDescription("BoostVector calibration algorithm");
28 }
29 
30 
32 static TObject* getBoostVectorObj(Vector3d vBoost, Matrix3d vBoostUnc, Matrix3d /*vBoostSpread*/)
33 {
34  auto payload = new CollisionBoostVector();
35  payload->setBoost(toB2Vector3(vBoost), toTMatrixDSym(vBoostUnc));
36  TObject* obj = static_cast<TObject*>(payload);
37  return obj;
38 }
39 
40 
41 
42 /* Main calibration method calling dedicated functions */
44 {
45  TTree* tracks = getObjectPtr<TTree>("events").get();
46  return runCalibration(tracks, "CollisionBoostVector", getEvents,
47  runBoostVectorAnalysis, getBoostVectorObj,
49 }
BoostVectorAlgorithm()
Constructor set the prefix to BoostVectorCollector.
TString m_lossFunctionOuter
Outer loss function (for calibration intervals of BoostVector spread parameters)
virtual EResult calibrate() override
Run algo on data.
TString m_lossFunctionInner
Inner loss function (for calibraion subintervals of mean BoostVector values)
Base class for calibration algorithms.
void setDescription(const std::string &description)
Set algorithm description (in constructor)
EResult
The result of calibration.
This class contains the measured average boost vector vec(beta) = (beta_x, beta_y,...
B2Vector3D toB2Vector3(Eigen::VectorXd vIn)
Function that converts Eigen vector to ROOT vector.
Definition: calibTools.h:54
TMatrixDSym toTMatrixDSym(Eigen::MatrixXd mIn)
Function that converts Eigen symmetric matrix to ROOT matrix.
Definition: calibTools.h:44
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:428
Abstract base class for different kinds of events.