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