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