Belle II Software development
BeamSpotAlgorithm.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/BeamSpot.h>
10#include <reconstruction/calibration/BeamSpotBoostInvMass/BeamSpotAlgorithm.h>
11#include <reconstruction/calibration/BeamSpotBoostInvMass/BeamSpotStandAlone.h>
12#include <reconstruction/calibration/BeamSpotBoostInvMass/calibTools.h>
13
14#include <Eigen/Dense>
15
16using Eigen::Vector3d;
17using Eigen::Matrix3d;
18
19using namespace Belle2;
20
21using Belle2::BeamSpotCalib::getEvents;
22using Belle2::BeamSpotCalib::runBeamSpotAnalysis;
23
25{
26 setDescription("BeamSpot calibration algorithm");
27}
28
29
31static TObject* getBeamSpotObj(Vector3d ipVtx, Matrix3d ipVtxUnc, Matrix3d sizeMat)
32{
33 auto payload = new BeamSpot();
34 payload->setIP(toB2Vector3(ipVtx), toTMatrixDSym(ipVtxUnc));
35 payload->setSizeCovMatrix(toTMatrixDSym(sizeMat));
36 TObject* obj = static_cast<TObject*>(payload);
37 return obj;
38}
39
40
41
42
43/* Main calibration method calling dedicated functions */
45{
46 TTree* tracks = getObjectPtr<TTree>("events").get();
47 return runCalibration(tracks, "BeamSpot", getEvents,
48 runBeamSpotAnalysis, getBeamSpotObj,
50}
TString m_lossFunctionOuter
Outer loss function (for calibration intervals of BeamSpot size parameters)
virtual EResult calibrate() override
Run algo on data.
BeamSpotAlgorithm()
Constructor set the prefix to BeamSpotCollector.
TString m_lossFunctionInner
Inner loss function (for calibration subintervals of BeamSpot position parameters)
This class contains the beam spot position and size modeled as a gaussian distribution in space.
Definition: BeamSpot.h:22
Base class for calibration algorithms.
void setDescription(const std::string &description)
Set algorithm description (in constructor)
EResult
The result of calibration.
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
B2Vector3D toB2Vector3(Eigen::VectorXd vIn)
Function that converts Eigen vector to ROOT vector.
Definition: calibTools.h:54
Abstract base class for different kinds of events.