Belle II Software  release-06-02-00
cm2LabBoost.cc
1 #include "TLorentzVector.h"
2 #include "TLorentzRotation.h"
3 #include <framework/gearbox/Const.h>
4 #include <generators/utilities/cm2LabBoost.h>
5 
6 using namespace Belle2;
7 
8 TLorentzRotation getBoost(double Eher, double Eler, double cross_angle, double angle)
9 {
10 
11 // Lab frame Z axis is defined by B files
12 // its positive direction close to direction of
13 // high energy beam, i.e. e- beam
14 
15  double angleLerToB = M_PI - angle;
16  double pLerZ = Eler * cos(angleLerToB);
17  double pLerX = Eler * sin(angleLerToB);
18  double pLerY = 0.;
19 
20 
21  double angleHerToB = cross_angle - angle;
22 
23  double pHerZ = Eher * cos(angleHerToB);
24  double pHerX = Eher * sin(angleHerToB);
25  double pHerY = 0.;
26 
27  TLorentzVector vlLer;
28  vlLer.SetXYZM(pLerX, pLerY, pLerZ, Const::electronMass);
29 
30  TLorentzVector vlHer;
31  vlHer.SetXYZM(pHerX, pHerY, pHerZ, Const::electronMass);
32 
33  TLorentzVector vlY4s = vlHer + vlLer;
34 
35 
36 // ---------------------------------------------
37 
38 // Transformation from Lab system to CMS system
39  TVector3 cmsBoostVec = vlY4s.BoostVector();
40  TLorentzRotation lab2cmsBoost(-cmsBoostVec);
41 
42 // boost e- to CMS system
43  TLorentzVector vlEleCms = lab2cmsBoost * vlHer;
44 
45 // now rotate CMS such that incomming e- is parallel to z-axis
46  TVector3 zaxis(0., 0., 1.); TVector3 rotaxis = zaxis.Cross(vlEleCms.Vect()) * (1. / vlEleCms.Vect().Mag());
47  double rotangle = TMath::ASin(rotaxis.Mag());
48  TLorentzRotation lab2cmsBoostRotZ = lab2cmsBoost.Rotate(-rotangle, rotaxis);
49 
50 
51 // boost lab e- and e+ to properly rotated CMS system
52  TLorentzVector vlEleCmsR;
53  TLorentzVector vlPosCmsR;
54 
55 // obtain the backward transformation
56  TLorentzRotation cms2labBoostRotZ = lab2cmsBoostRotZ.Inverse();
57  /* for(int i=0; i<4; i++){
58  for(int j=0;j<4;j++){
59  std::cout << cms2labBoostRotZ(i,j) << " ";
60  }
61  std::cout << std::endl;
62  }*/
63 
64  return cms2labBoostRotZ;
65 }
66 
67 double getBeamEnergySpreadCM(double E1, double dE1,
68  double E2, double dE2,
69  double crossing_angle)
70 {
71  // To get fluctuation of root(s) from
72  // the beam energy, its energy spread and crossing angle
73  // at the lab. frame.
74  double m = Const::electronMass;
75  double ca = cos(crossing_angle);
76 
77  double P1 = sqrt(E1 * E1 - m * m);
78  double P2 = sqrt(E2 * E2 - m * m);
79  Double_t Etotcm = sqrt(2.*m * m + 2.*(E1 * E2 + P1 * P2 * ca));
80  Double_t dEdE1 = (P1 * E2 + P2 * E1 * ca) / P1 / Etotcm;
81  Double_t dEdE2 = (P1 * E2 * ca + P2 * E1) / P2 / Etotcm;
82  Double_t dEtotcm = sqrt((dE1 * dEdE1) * (dE1 * dEdE1) + (dE2 * dEdE2) * (dE2 * dEdE2));
83  return dEtotcm;
84 }
static const double electronMass
electron mass
Definition: Const.h:565
Abstract base class for different kinds of events.