Belle II Software development
LabToCms.h
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#pragma once
10#include <framework/utilities/MathHelpers.h>
11#include <Math/Boost.h>
12#include <Math/AxisAngle.h>
13#include <Math/LorentzRotation.h>
14#include <Math/Vector3D.h>
15
16namespace Belle2 {
21
31 class LabToCms {
32
33 public:
34
35
44 static ROOT::Math::LorentzRotation rotateLabToCms(const ROOT::Math::XYZVector& boostVector,
45 double cmsAngleXZ, double cmsAngleYZ)
46 {
47 // Boost to CM frame
48 ROOT::Math::LorentzRotation boost(ROOT::Math::Boost(-1.*boostVector));
49
50 // Target pHER orientation (unit 3D vector)
51 ROOT::Math::XYZVector zaxis(0., 0., 1.);
52
53 // The current pHER orientation (unit 3D vector)
54 double tanAngleXZ = tan(cmsAngleXZ);
55 double tanAngleYZ = tan(cmsAngleYZ);
56 double Norm = 1 / sqrt(1 + square(tanAngleXZ) + square(tanAngleYZ));
57 ROOT::Math::XYZVector electronCMS(Norm * tanAngleXZ, Norm * tanAngleYZ, Norm);
58
59 // Axis to rotate current pHER direction to the target one
60 ROOT::Math::XYZVector rotAxis = zaxis.Cross(electronCMS);
61 double rotangle = asin(rotAxis.R()); // rotation angle
62
63 // Rotation that makes pHER align with z-axis
64 ROOT::Math::LorentzRotation rotation(ROOT::Math::AxisAngle(rotAxis, -rotangle));
65
66 // First boost, then rotation
67 ROOT::Math::LorentzRotation trans = rotation * boost;
68 return trans;
69 }
70
71 };
72
74}
Class implementing general Lorentz Transformation between LAB and CMS system.
Definition LabToCms.h:31
static ROOT::Math::LorentzRotation rotateLabToCms(const ROOT::Math::XYZVector &boostVector, double cmsAngleXZ, double cmsAngleYZ)
Function takes 3D boostVector and angles of the HER momentum in the CM system obtained by pure boost.
Definition LabToCms.h:44
constexpr T square(const T &x)
Calculate the square of the input.
Definition MathHelpers.h:21
double tan(double a)
tan for double
Definition beamHelpers.h:31
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28
Abstract base class for different kinds of events.