Belle II Software  release-05-02-19
BeamSpotAlgorithm.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2020 - 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/BeamSpot.h>
12 #include <tracking/calibration/BeamSpotAlgorithm.h>
13 #include <tracking/calibration/BeamSpotStandAlone.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::BeamSpotCalib::getEvents;
24 using Belle2::BeamSpotCalib::runBeamSpotAnalysis;
25 
27 {
28  setDescription("BeamSpot calibration algorithm");
29 }
30 
31 
33 static TObject* getBeamSpotObj(Vector3d ipVtx, Matrix3d ipVtxUnc, Matrix3d sizeMat)
34 {
35  auto payload = new BeamSpot();
36  payload->setIP(toTVector3(ipVtx), toTMatrixDSym(ipVtxUnc));
37  payload->setSizeCovMatrix(toTMatrixDSym(sizeMat));
38  TObject* obj = static_cast<TObject*>(payload);
39  return obj;
40 }
41 
42 
43 
44 
45 /* Main calibration method calling dedicated functions */
47 {
48  TTree* tracks = getObjectPtr<TTree>("events").get();
49  return runCalibration(tracks, "BeamSpot", getEvents,
50  runBeamSpotAnalysis, getBeamSpotObj,
52 }
Belle2::BeamSpotAlgorithm::BeamSpotAlgorithm
BeamSpotAlgorithm()
Constructor set the prefix to BeamSpotCollector.
Definition: BeamSpotAlgorithm.cc:26
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::toTVector3
TVector3 toTVector3(Eigen::VectorXd vIn)
Function that converts Eigen vector to ROOT vector.
Definition: calibTools.h:65
Belle2::BeamSpotAlgorithm::m_lossFunctionOuter
TString m_lossFunctionOuter
Outer loss function (for calibration intervals of BeamSpot size parameters)
Definition: BeamSpotAlgorithm.h:52
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::BeamSpot
This class contains the beam spot position and size modeled as a gaussian distribution in space.
Definition: BeamSpot.h:32
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::BeamSpotAlgorithm::calibrate
virtual EResult calibrate() override
Run algo on data.
Definition: BeamSpotAlgorithm.cc:46
Belle2::CalibrationAlgorithm::EResult
EResult
The result of calibration.
Definition: CalibrationAlgorithm.h:50
Belle2::CalibrationAlgorithm
Base class for calibration algorithms.
Definition: CalibrationAlgorithm.h:47
Belle2::BeamSpotAlgorithm::m_lossFunctionInner
TString m_lossFunctionInner
Inner loss function (for calibration subintervals of BeamSpot position parameters)
Definition: BeamSpotAlgorithm.h:55