CbmRoot
Loading...
Searching...
No Matches
CbmLitPolarizedGenerator.cxx
Go to the documentation of this file.
1/* Copyright (C) 2009-2011 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Evgeny Kryshen, Andrey Lebedev [committer] */
4
5// -------------------------------------------------------------------------
6// ----- CbmLitPolarizedGenerator source file -----
7// ----- Created 11/09/09 by E. Kryshen -----
8// -------------------------------------------------------------------------
9
11
12#include "FairLogger.h"
13#include "FairPrimaryGenerator.h"
14#include "TDatabasePDG.h"
15#include "TF1.h"
16#include "TLorentzVector.h"
17#include "TMath.h"
18#include "TParticlePDG.h"
19#include "TRandom.h"
20
21// ------------------------------------------------------------------------
23{
24 // Default constructor
25 fPDGType = -1;
26 fMult = 0;
27 fAlpha = 0;
28 fBeamMomentum = 25.;
31 fPol = NULL;
32 fBox = 0;
33}
34// ------------------------------------------------------------------------
35
36
37// ------------------------------------------------------------------------
38CbmLitPolarizedGenerator::CbmLitPolarizedGenerator(Int_t pdgid, Int_t mult) : FairGenerator()
39{
40 // Constructor. Set default distributions
41 fPDGType = pdgid;
42 fMult = mult;
43 fAlpha = 0;
44 fBeamMomentum = 25.;
47 fPol = NULL;
48 fBox = 0;
51 SetRangePt();
52 SetRangeY();
53}
54// ------------------------------------------------------------------------
55
56
57// ------------------------------------------------------------------------
59{
60 // Initialize generator
61 // Check for particle type
62 TDatabasePDG* pdgBase = TDatabasePDG::Instance();
63 TParticlePDG* particle = pdgBase->GetParticle(fPDGType);
64 if (!particle) LOG(fatal) << GetName() << ": PDG code " << fPDGType << " not defined.";
65 fPDGMass = particle->Mass();
67 //gRandom->SetSeed(0);
68 fDistPt = new TF1("distPt", "x*exp(-sqrt(x*x+[1]*[1])/[0])", fPtMin, fPtMax);
69 fDistPt->SetParameters(fT, fPtDistMass);
70 fPol = new TF1("dsigdcostheta", "1.+[0]*x*x", -1., 1.);
71 fPol->SetParameter(0, fAlpha);
72 Info("Init", "pdg=%i y0=%4.2f sigma_y=%4.2f T_pt=%6.4f", fPDGType, fY0, fSigma, fT);
73 return 0;
74}
75// ------------------------------------------------------------------------
76
77
78// ------------------------------------------------------------------------
79Bool_t CbmLitPolarizedGenerator::ReadEvent(FairPrimaryGenerator* primGen)
80{
81 Double_t phi, pt, y, mt, px, py, pz;
82
83 // Generate particles
84 for (Int_t k = 0; k < fMult; k++) {
85
86 phi = gRandom->Uniform(0, TMath::TwoPi());
87 if (fBox)
88 pt = gRandom->Uniform(fPtMin, fPtMax);
89 else
90 pt = fDistPt->GetRandom(fPtMin, fPtMax);
91 px = pt * TMath::Cos(phi);
92 py = pt * TMath::Sin(phi);
93 if (fBox)
94 y = gRandom->Uniform(fYMin, fYMax);
95 else
96 y = gRandom->Gaus(fY0, fSigma);
97 mt = TMath::Sqrt(fPDGMass * fPDGMass + pt * pt);
98 pz = mt * TMath::SinH(y);
99 // Info("ReadEvent","Particle generated: pdg=%i pt=%f y=%f",fPDGType,pt,y);
100 // primGen->AddTrack(fPDGType, px, py, pz, 0, 0, 0);
101 GenerateDaughters(TVector3(px, py, pz), primGen);
102 }
103 return kTRUE;
104}
105// ------------------------------------------------------------------------
106
107
108// ------------------------------------------------------------------------
109Bool_t CbmLitPolarizedGenerator::GenerateDaughters(TVector3 pMother, FairPrimaryGenerator* primGen)
110{
111
112 TParticlePDG* part;
113 if (fDecayMode == kDiMuon)
114 part = TDatabasePDG::Instance()->GetParticle("mu+");
115 else if (fDecayMode == kDiElectron)
116 part = TDatabasePDG::Instance()->GetParticle("e+");
117 else
118 LOG(fatal) << GetName() << "::GenerateDaughters: Polarized dilepton decay only implemented";
119
120 // energies and momenta in dilepton rest frame
121 Double_t m = part->Mass();
122 Double_t e = fPDGMass / 2.;
123 Double_t p = TMath::Sqrt(e * e - m * m);
124
125 Double_t cost = fPol->GetRandom();
126 Double_t sint = TMath::Sqrt(1. - cost * cost);
127 Double_t phi = TMath::TwoPi() * gRandom->Rndm();
128 Double_t px = p * sint * TMath::Cos(phi);
129 Double_t py = p * sint * TMath::Sin(phi);
130 Double_t pz = p * cost;
131
132 TLorentzVector v1, v2, boosted1, boosted2;
133 v1.SetPxPyPzE(-px, -py, -pz, e);
134 v2.SetPxPyPzE(+px, +py, +pz, e);
135
136 // Define boost-vector
137 TLorentzVector v;
138 v.SetVectM(pMother, fPDGMass);
139 TVector3 boost = v.BoostVector();
140
141 // Define z-axis
142 TVector3 zaxis;
143 if (fFrame == kHelicity) {
144 // polarization axis: direction of meson in the delipton rest frame
145 zaxis = pMother.Unit();
146 }
147 else if (fFrame == kColSop) {
148 // polarization axis: bisector of proj and target in the dilepton rest frame
149 Double_t mp = 0.938;
150 Double_t ep = TMath::Sqrt(fBeamMomentum * fBeamMomentum + mp * mp);
151 TLorentzVector proj = TLorentzVector(0., 0., fBeamMomentum, ep); // projectile
152 TLorentzVector targ = TLorentzVector(0., 0., 0., mp); // target
153 proj.Boost(-boost); //boost proj and targ from lab to dilepton rest frame
154 targ.Boost(-boost);
155 zaxis = (proj.Vect().Unit() - targ.Vect().Unit()).Unit();
156 }
157 else {
158 zaxis = TVector3(0., 0., 1.);
159 }
160 v1.RotateUz(zaxis); // rotate lepton vectors with respect to polarization axis
161 v2.RotateUz(zaxis);
162
163 v1.Boost(boost); //boost leptons from dilepton rest frame to lab frame
164 v2.Boost(boost);
165
166 Int_t pdg = part->PdgCode();
167 Info("ReadEvent", "Particle generated: pdg=%3i pt=%7.4f y=%7.4f", pdg, v1.Pt(), v1.Rapidity());
168 Info("ReadEvent", "Particle generated: pdg=%3i pt=%7.4f y=%7.4f", -pdg, v2.Pt(), v2.Rapidity());
169 primGen->AddTrack(pdg, v1[0], v1[1], v1[2], 0, 0, 0);
170 primGen->AddTrack(-pdg, v2[0], v2[1], v2[2], 0, 0, 0);
171
172 return kTRUE;
173}
174// ------------------------------------------------------------------------
175
176
ClassImp(CbmConverterManager)
fscal v[fmask::Size]
Definition KfSimdPseudo.h:4
Double_t fPtMin
Max value of Pt.
Bool_t GenerateDaughters(const TVector3 p, FairPrimaryGenerator *primGen)
Int_t fPDGType
Particle type (PDG encoding)
Double_t fYMax
Min value of Pt.
Bool_t fBox
Polarization function.
virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen)
void SetRangeY(Double_t yMin=0, Double_t yMax=4)
Double_t fAlpha
Pointer to the Pt function.
void SetDistributionPt(Double_t T=0.154319, Double_t mass=-1.)
Double_t fPtMax
Min value of Pt.
void SetRangePt(Double_t ptMin=0, Double_t ptMax=3)
Double_t fPDGMass
Particle mass [GeV].
Double_t fPtDistMass
Mass in Pt distribution.
Double_t fT
Temperature in the Pt distribution.
Double_t fYMin
Max value of Pt.
Double_t fSigma
Simga in the rapidity distribution.
void SetDistributionY(Double_t y0=1.98604, Double_t sigma=0.617173)