]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenMUONLMR.cxx
printout removed
[u/mrichter/AliRoot.git] / EVGEN / AliGenMUONLMR.cxx
CommitLineData
368fc61e 1//#include <TClonesArray.h>
2
3#include <TDatabasePDG.h>
4#include <TFile.h>
5#include "AliConst.h"
6#include "AliGenMUONLMR.h"
7#include "AliMC.h"
8#include "AliRun.h"
c279681a 9#include "AliLog.h"
368fc61e 10#include "AliGenEventHeader.h"
11
12ClassImp(AliGenMUONLMR)
13
0d19baad 14 AliGenMUONLMR::AliGenMUONLMR () : AliGenMC(),
15 fNMuMin(2),
16 fCMSEnergy(kNCMSEnergies),
17 fGenSingleProc(-1),
18 fYCM(0),
19 fCosTheta(0x0),
20 fRhoLineShape(0x0),
21 fHMultMu(0x0),
22 fHNProc(0x0) {
23 //
24 // default constructor
25 //
26 for (int i=0; i<fgkNpart; i++) {
27 fPDG[i] = 0;
28 fScaleMult[i] = 1.;
29 fPt[i] = NULL;
30 fY[i] = NULL;
31 fMult[i] = NULL;
32 fDecay[i] = NULL;
33 fParticle[i] = NULL;
34 }
35 for (int i=0; i<3; i++) fDalitz[i] = NULL;
36 for (int i=0; i<3; i++) fMu[i] = NULL;
c279681a 37
0d19baad 38 }
35e2c739 39
c279681a 40//-----------------------------------------------------------
368fc61e 41
c279681a 42void AliGenMUONLMR::SetCMSEnergy(CMSEnergies energy){
0d19baad 43 fCMSEnergy = energy;
44 // initialize pt and y distributions according to a fit to
45 // Pythia simulation at sqrt(s) = 7 TeV
46 for (Int_t ipart=0; ipart < fgkNpart; ipart++) fScaleMult[ipart] = 1;
47 fScaleMult[kPionLMR] = 0; // set pion multiplicity to zero
48 fScaleMult[kKaonLMR] = 0; // set kaon multiplicity to zero
49 const char* fdname[2] = {"fDecPion","fDecKaon"};
50 Double_t ctau[2] = {7.8045, 3.712};
51 Int_t pdg[7] = {211, 321, 221, 113, 223, 333, 331};
52 const char* fptname[7] = {"fPtPion","fPtKaon","fPtEta","fPtRho","fPtOmega","fPtPhi","fPtEtaPrime"};
53 const char* fyname[7] = {"fYPion","fYKaon","fYEta","fYRho","fYOmega","fYPhi","fYEtaPrime"};
54 const char* fnname[7] = {"fMultPion","fMultKaon","fMultEta","fMultRho","fMultOmega","fMultPhi","fMultEtaPrime"};
55 Double_t ptparam[7][9];
56 Double_t yparam[7][9];
57 Double_t nparam[7][9];
c279681a 58
0d19baad 59 // parameters for 7 TeV generation
60 if (fCMSEnergy==kCMS7000GeV) {
61 AliInfo ("Using pp parameterization at 7 TeV\n");
62 Double_t ptparam7000[7][9] = {{1,0.427,2.52,0,0,0,0,0,0}, // pions from Pythia
63 {1,0.58,2.57,0,0,0,0,0,0}, // kaons from Pythia
64 {1,0.641,2.62,0,0,0,0,0,0}, // eta from Pythia
65 {1,1.44,3.16,0,0,0,0,0,0}, // rho+omega from ALICE muon
66 {1,1.44,3.16,0,0,0,0,0,0}, // rho+omega from ALICE muon
67 {1,1.16,2.74,0,0,0,0,0,0}, // phi from ALICE muon
68 {1,0.72,2.5,0,0,0,0,0,0}}; // etaPrime from Pythia
c279681a 69
0d19baad 70 Double_t yparam7000[7][9] = {{1,0.8251,3.657,0,0,0,0,0,0}, // pions from pythia
71 {1,1.83,2.698,0,0,0,0,0,0}, // kaons from pythia
72 {1,1.169,3.282,0,0,0,0,0,0}, // eta from pythia
73 {1,1.234,3.264,0,0,0,0,0,0}, // rho from pythia
74 {1,1.311,3.223,0,0,0,0,0,0}, // omega from pythia
75 {1,2.388,2.129,0,0,0,0,0,0}, // phi from pythia
76 {1,1.13,3.3,0,0,0,0,0,0}}; // eta prime from pythia
c279681a 77
0d19baad 78 // multiplicity parameters from pythia
79 Double_t nparam7000[7][9] = {{353.582, 6.76263, 1.66979, 998.445, 9.73281, 12.6704, 175.187, 29.08, 40.2531},
80 {1.e4, 0.2841, 0,0,0,0,0,0,0},
81 {1.e4, 0.2647, 0,0,0,0,0,0,0},
82 {7055, 0.1786, 0,0,0,0,0,0,0},
83 {7500, 0.1896, 0,0,0,0,0,0,0},
84 {5.e4, 1.167, 0,0,0,0,0,0,0},
85 {2.9e4, 0.714, 0,0,0,0,0,0,0}};
c279681a 86
0d19baad 87 for (Int_t i=0; i<fgkNpart; i++) {
88 for (Int_t j=0; j<9; j++) {
89 ptparam[i][j] = ptparam7000[i][j];
90 yparam[i][j] = yparam7000[i][j];
91 nparam[i][j] = nparam7000[i][j];
92 }
93 }
94 }
95 if (fCMSEnergy==kCMS5020GeVpPb || fCMSEnergy==kCMS5020GeVPbp) {
96 AliInfo ("Using pPb parameterization at 5.02 TeV\n");
97 Double_t ptparam5020[7][9] = {{1,0.427,2.52,0,0,0,0,0,0}, // pions from Pythia at 7 TeV
98 {1,0.58,2.57,0,0,0,0,0,0}, // kaons from Pythia at 7 TeV
99 {1,0.665,2.796,0,0,0,0,0,0}, // eta from Pythia at 5.02 TeV
100 {1,1.66,3.12,0,0,0,0,0,0}, // rho+omega from ALICE muon
101 {1,1.66,3.12,0,0,0,0,0,0}, // rho+omega from ALICE muon
102 {1,2.03,3.13,0,0,0,0,0,0}, // phi from ALICE muon
103 {1,0.767,2.713,0,0,0,0,0,0}}; // etaPrime from Pythia at 5.02 TeV
c279681a 104
0d19baad 105 Double_t yparam5020[7][9] = {{1,0.8251,3.657,0,0,0,0,0,0}, // pions from pythia at 7 TeV
106 {1,1.83,2.698,0,0,0,0,0,0}, // kaons from pythia at 7 TeV
107 {1,1.169,3.282,0,0,0,0,0,0}, // eta from pythia at 7 TeV
108 {1,1.234,3.264,0,0,0,0,0,0}, // rho from pythia at 7 TeV
109 {1,1.311,3.223,0,0,0,0,0,0}, // omega from pythia at 7 TeV
110 {1,2.388,2.129,0,0,0,0,0,0}, // phi from pythia at 7 TeV
111 {1,1.13,3.3,0,0,0,0,0,0}}; // eta prime from pythia at 7 TeV
c279681a 112
0d19baad 113 // multiplicity parameters from pythia at 7 TeV
114 Double_t nparam5020[7][9] = {{353.582, 6.76263, 1.66979, 998.445, 9.73281, 12.6704, 175.187, 29.08, 40.2531},
115 {1.e4, 0.2841, 0,0,0,0,0,0,0},
116 {1.e4, 0.2647, 0,0,0,0,0,0,0},
117 {7055, 0.1786, 0,0,0,0,0,0,0},
118 {7500, 0.1896, 0,0,0,0,0,0,0},
119 {5.e4, 1.167, 0,0,0,0,0,0,0},
120 {2.9e4, 0.714, 0,0,0,0,0,0,0}};
c279681a 121
c279681a 122 for (Int_t i=0; i<fgkNpart; i++) {
0d19baad 123 for (Int_t j=0; j<9; j++) {
124 ptparam[i][j] = ptparam5020[i][j];
125 yparam[i][j] = yparam5020[i][j];
126 nparam[i][j] = nparam5020[i][j];
127 }
128 }
129 if (fCMSEnergy==kCMS5020GeVpPb) fYCM = -0.4654;
130 else fYCM = 0.4654;
131 }
132 else if (fCMSEnergy==kCMS2760GeV){
133 // parameters for 2.76 generation
134 // pt params has been determined as <pt>ALICE_2.76 = <pt>ALICE_7 * <pt>PYTHIA_2.76 / <pt>PYTHIA_7
135 AliInfo ("Using pp parameterization at 2.76 TeV\n");
136 Double_t yparam2760[7][9] = {{1,0.8251,3.657,0,0,0,0,0,0}, // pions from pythia
137 {1,1.83,2.698,0,0,0,0,0,0}, // kaons from pythia
138 {1,0.011,3.474,0,0,0,0,0,0}, // eta from pythia
139 {1,-0.01,3.409,0,0,0,0,0,0}, // rho from pythia
140 {1,-0.037,3.294,0,0,0,0,0,0}, // omega from pythia
141 {1,-0.016,2.717,0,0,0,0,0,0}, // phi from pythia
142 {1,-0.010,3.312,0,0,0,0,0,0}}; // eta prime from pythia
c279681a 143
0d19baad 144 Double_t ptparam2760[7][9] = {{1,0.1665,8.878,0,0,0,0,0,0}, // pions from Pythia
145 {1,0.1657,8.591,0,0,0,0,0,0}, // kaons from Pythia
146 {1,0.641,2.62,0,0,0,0,0,0}, // eta from ALICE 7 TeV
147 {1,1.3551,3.16,0,0,0,0,0,0}, // rho with <pt> scaled
148 {1,1.3551,3.16,0,0,0,0,0,0}, // omega with <pt> scaled
149 {1,1.0811,2.74,0,0,0,0,0,0}, // phi with <pt> scaled
150 {1,0.72,2.5,0,0,0,0,0,0}}; // etaPrime from ALICE 7 TeV
151
152 Double_t nparam2760[7][9] = {{9752,-2.693,3.023,9.5e9,-84.68,16.75,-14.06,635.3,-423.2}, // pions
153 {1.e5, 1.538, 0,0,0,0,0,0,0}, // kaons
154 {1.e4, 0.351, 0,0,0,0,0,0,0}, // eta
155 {1.e4, 0.2471, 0,0,0,0,0,0,0}, // rho
156 {1.e4, 0.2583, 0,0,0,0,0,0,0}, // omega
157 {1.e5, 1.393, 0,0,0,0,0,0,0}, // phi
158 {1.e4, 0.9005, 0,0,0,0,0,0,0}}; // etaPrime
159
160 for (Int_t i=0; i<fgkNpart; i++) {
161 for (Int_t j=0; j<9; j++) {
162 ptparam[i][j] = ptparam2760[i][j];
163 yparam[i][j] = yparam2760[i][j];
164 nparam[i][j] = nparam2760[i][j];
165 }
368fc61e 166 }
0d19baad 167 }
168 else AliFatal("Energy not correctly defined");
c279681a 169
0d19baad 170 for (Int_t i=0; i<fgkNpart; i++) {
171 fPDG[i] = pdg[i];
172 if (i!=0) {
173 fMult[i] = new TF1(fnname[i],"[0]*exp(-[1]*x)",0,30);
174 fMult[i]->SetParameters(nparam[i][0],nparam[i][1]);
175 }
176 else {
177 fMult[i] = new TF1(fnname[i],"gaus(0)+gaus(3)+gaus(6)",0,150);
178 for (Int_t j=0; j<9; j++) fMult[i]->SetParameter(j,nparam[i][j]);
179 }
180
181 fPt[i] = new TF1(fptname[i],AliGenMUONLMR::PtDistr,0,20,3);
182 fPt[i]->SetParameters(ptparam[i][0], ptparam[i][1], ptparam[i][2]);
183 fY[i] = new TF1(fyname[i],AliGenMUONLMR::YDistr,-10,10,4);
184 fY[i]->SetParameters(yparam[i][0], yparam[i][1], yparam[i][2],fYCM);
185 }
c279681a 186
0d19baad 187 for(Int_t i = 0; i<2; i++){
188 fDecay[i] = new TF1(fdname[i],"exp(-x/[0])",0,150);
189 fDecay[i]->SetParameter(0,ctau[i]);
190 }
191
192 for (Int_t ipart = 0; ipart < fgkNpart; ipart++) {
193 fParticle[ipart] = new TParticle();
194 fParticle[ipart]->SetPdgCode(fPDG[ipart]);
195 }
c279681a 196
0d19baad 197 TDatabasePDG *pdgdb = TDatabasePDG::Instance();
198 Double_t mumass = pdgdb->GetParticle(13)->Mass();
199 fMu[0] = new TParticle();
200 fMu[0]->SetPdgCode(-13);
201 fMu[0]->SetCalcMass(mumass);
202 fMu[1] = new TParticle();
203 fMu[1]->SetPdgCode(13);
204 fMu[1]->SetCalcMass(mumass);
c279681a 205
0d19baad 206 // function for polarized theta distributions
207 fCosTheta = new TF1 ("fCosTheta","1+[0]*x*x",-1,1);
208 fCosTheta->SetParameter(0,1);
c279681a 209
0d19baad 210 // Dalitz decays
211 Int_t nbins = 1000;
212 Double_t xmin = 0, xmax = 2;
213 fDalitz[0] = new TH1F("hDalitzEta","",nbins,xmin,xmax);
214 fDalitz[1] = new TH1F("hDalitzOmega","",nbins,xmin,xmax);
215 fDalitz[2] = new TH1F("hDalitzEtaPrime","",nbins,xmin,xmax);
c279681a 216
0d19baad 217 Double_t meta = pdgdb->GetParticle("eta")->Mass();
218 Double_t momega = pdgdb->GetParticle("omega")->Mass();
219 Double_t metaPrime = pdgdb->GetParticle("eta'")->Mass();
220 Double_t mpi0 = pdgdb->GetParticle("pi0")->Mass();
221 Double_t md3 = 0, mres = 0;
c279681a 222
0d19baad 223 for (Int_t index = 0; index < 3; index++) {
224 if (index == 0) {
225 mres = meta;
226 md3 = 0;
227 }
228 else if (index == 1) {
229 mres = momega;
230 md3 = mpi0;
231 }
232 else if (index == 2) {
233 mres = metaPrime;
234 md3 = 0;
235 }
236 Double_t delta = md3 * md3 / (mres * mres);
237 Double_t epsilon = mumass * mumass / (mres * mres);
238 nbins = fDalitz[index]->GetNbinsX();
239 xmin = fDalitz[index]->GetXaxis()->GetXmin();
240 Double_t deltax = fDalitz[index]->GetBinWidth(1);
241 Double_t xd = xmin - deltax/2.;
242 for (Int_t ibin = 0; ibin< nbins; ibin++) {
243 Double_t dalval = 0;
244 xd += deltax;
245 if (xd > 4. *epsilon) {
246 Double_t bracket = TMath::Power(1. + xd/(1. - delta),2)
247 - 4. * xd / ((1. - delta) * (1. - delta));
248 if (bracket > 0) {
249 dalval = TMath::Power(bracket,1.5) /xd *
250 TMath::Sqrt(1 - 4 * epsilon / xd) * (1 + 2 * epsilon / xd) *
251 FormFactor(xd * mres * mres, index);
252 fDalitz[index]->Fill(xd,dalval);
c279681a 253 }
0d19baad 254 }
255 }
256 }
c279681a 257
0d19baad 258 fRhoLineShape = new TF1("fRhoLineShape",RhoLineShapeNew,0,2,2);
259 fHMultMu = new TH1D("fHMultMu","Muon multiplicity",20,-0.5,19.5);
260 fHNProc = new TH1D("fHNProc","Number of gen. evts. per process in 4 pi",9,-0.5,8.5);
c279681a 261
368fc61e 262}
35e2c739 263//-----------------------------------------------------------
264
265AliGenMUONLMR::AliGenMUONLMR (AliGenMUONLMR &gen) : AliGenMC(),
266 fNMuMin(gen.fNMuMin),
0d19baad 267 fCMSEnergy(gen.fCMSEnergy),
268 fGenSingleProc(gen.fGenSingleProc),
269 fYCM(gen.fYCM),
35e2c739 270 fCosTheta(gen.fCosTheta),
271 fRhoLineShape(gen.fRhoLineShape),
272 fHMultMu(gen.fHMultMu),
273 fHNProc(gen.fHNProc) {
274 for (Int_t i=0; i < fgkNpart; i++) {
275 fPDG[i] = gen.fPDG[i];
276 fScaleMult[i] = gen.fScaleMult[i];
277 fPt[i] = (TF1*) gen.fPt[i]->Clone();
278 fY[i] = (TF1*) gen.fY[i]->Clone();
279 fMult[i] = (TF1*) gen.fMult[i]->Clone();
280 fParticle[i] = (TParticle*) gen.fParticle[i]->Clone();
281 }
282
283 for(Int_t i = 0; i<2; i++) fDecay[i] = (TF1*) gen.fDecay[i]->Clone();
284 for(Int_t i = 0; i<3; i++) fDalitz[i] = (TH1F*) gen.fDalitz[i]->Clone();
285 for(Int_t i = 0; i<2; i++) fMu[i] = (TParticle*) gen.fMu[i]->Clone();
286}
287
288//-----------------------------------------------------------
289
290AliGenMUONLMR& AliGenMUONLMR::operator=(const AliGenMUONLMR &gen) {
0d19baad 291 // Assignment operator
a59583d3 292 if (this!=&gen) {
293 fNMuMin = gen.fNMuMin;
0d19baad 294 fCMSEnergy = gen.fCMSEnergy;
a59583d3 295 fGenSingleProc = gen.fGenSingleProc;
0d19baad 296 fYCM = gen.fYCM;
a59583d3 297 fCosTheta = (TF1*) gen.fCosTheta->Clone();
298 fRhoLineShape = (TF1*) gen.fRhoLineShape->Clone();
299 fHMultMu = (TH1D*) gen.fHMultMu->Clone();
300 fHNProc = (TH1D*) gen.fHNProc->Clone();
301
302 for (Int_t i=0; i < fgkNpart; i++) {
303 fPDG[i] = gen.fPDG[i];
304 fScaleMult[i] = gen.fScaleMult[i];
305 fPt[i] = (TF1*) gen.fPt[i]->Clone();
306 fY[i] = (TF1*) gen.fY[i]->Clone();
307 fMult[i] = (TF1*) gen.fMult[i]->Clone();
308 fParticle[i] = (TParticle*) gen.fParticle[i]->Clone();
309 }
310
311 for(Int_t i = 0; i<2; i++) fDecay[i] = (TF1*) gen.fDecay[i]->Clone();
312 for(Int_t i = 0; i<3; i++) fDalitz[i] = (TH1F*) gen.fDalitz[i]->Clone();
313 for(Int_t i = 0; i<2; i++) fMu[i] = (TParticle*) gen.fMu[i]->Clone();
35e2c739 314 }
35e2c739 315 return *this;
316}
317
318
368fc61e 319//-----------------------------------------------------------
320
321AliGenMUONLMR::~AliGenMUONLMR()
322{
323 // Default destructor
324 for (Int_t i=0; i<7; i++) {
325 delete fPt[i];
326 delete fY[i];
327 delete fMult[i];
328 delete fParticle[i];
329 }
330
331 for (Int_t i=0; i<2; i++) {
332 delete fDecay[i];
333 delete fMu[i];
334 }
335
336 for (Int_t i=0; i<3; i++) delete fDalitz[i];
337
338 delete fCosTheta; fCosTheta = 0;
339 delete fRhoLineShape; fRhoLineShape = 0;
340 delete fHMultMu; fHMultMu = 0;
341 delete fHNProc; fHNProc = 0;
342}
343
344//-----------------------------------------------------------
345
346void AliGenMUONLMR::FinishRun(){
347 // save some histograms to an output file
348 Int_t nbins = fHNProc->GetNbinsX();
c279681a 349 for (Int_t ibin=1; ibin <= nbins; ibin++) AliInfo (Form("ibin = %d nEvProc = %g",
0d19baad 350 ibin,fHNProc->GetBinContent(ibin)));
351 TFile *fout = new TFile("AliGenMUONLMR_histos.root","recreate");
368fc61e 352 fHMultMu->Write();
353 fHNProc->Write();
354 fout->Close();
355}
356
357//-----------------------------------------------------------
358
35e2c739 359Double_t AliGenMUONLMR::YDistr(Double_t *px, Double_t *par){
368fc61e 360 // function for rapidity distribution: plateau at par[0] +
361 // gaussian tails centered at par[1] and with par[2]=sigma
0d19baad 362 Double_t ylab = px[0];
363 Double_t y0 = par[3]; // center of mass rapidity
368fc61e 364 Double_t func = 0;
0d19baad 365 if (ylab<y0+par[1] && ylab>y0-par[1]) func = par[0];
366 else if (ylab>y0+par[1]) {
367 Double_t z = (ylab-(par[1]+y0) )/(par[2]);
368 func = par[0] * TMath::Exp(-0.5 * z * z);
369 }
370 else {
371 Double_t z = (ylab-(-par[1]+y0) )/(par[2]);
368fc61e 372 func = par[0] * TMath::Exp(-0.5 * z * z);
373 }
374 return func;
375}
376
377//-----------------------------------------------------------
378
35e2c739 379Double_t AliGenMUONLMR::PtDistr(Double_t *px, Double_t *par){
368fc61e 380 // pt distribution: power law
381 Double_t x = px[0];
382 Double_t func = par[0] * x / TMath::Power((1+(x/par[1])*(x/par[1])),par[2]);
383 return func;
384}
385
386//-----------------------------------------------------------
387
388void AliGenMUONLMR::Generate() {
389 //
390 // generate the low mass resonances and their decays according to
391 // the multiplicity parameterized by pythia and BR from PDG
392 // rapidity distributions parametrized from pythia
393 // pt distributions from data (or pythia for etaprime)
394 //
395 Double_t pxPushed[100], pyPushed[100], pzPushed[100], ePushed[100];
396 Int_t nmuons = -1, npartPushed = 0, pdgPushed[100];
397 Double_t polar[3]= {0,0,0}; // Polarisation of the parent particle (for GEANT tracking)
398 Double_t origin0[3]; // Origin of the generated parent particle (for GEANT tracking)
399 // Calculating vertex position per event
400 for (Int_t j=0;j<3;j++) origin0[j]=fOrigin[j];
401 if(fVertexSmear==kPerEvent) {
402 Vertex();
403 for (Int_t j=0;j<3;j++) origin0[j]=fVertex[j];
404 }
405
368fc61e 406 TParticle *mother;
407 TDatabasePDG* pdg = TDatabasePDG::Instance();
408
409 Double_t pt, y, phi, mass, px, py, pz, ene, mt;
410
411 const Int_t nproc = 9;
412 Int_t idRes[nproc] = {kEtaLMR, kEtaLMR, kRhoLMR, kOmegaLMR, kOmegaLMR, kPhiLMR, kEtaPrimeLMR, kPionLMR, kKaonLMR};
35e2c739 413 Double_t BR[nproc] = {5.8e-6, 3.1e-4, 4.55e-5, 7.28e-5, 1.3e-4, 2.86e-4, 1.04e-4, 1, 0.6344};
368fc61e 414 // Double_t BR[nproc] = {1, 1, 1, 1, 1, 1, 1, 1, 1};
415 Int_t idDec[nproc] = {0, 1, 0, 0, 1, 0, 1, 2, 2}; // 0:2body, 1:Dalitz, 2:pi/K
416 Int_t mult[nproc] = {0,0,0,0,0,0,0,0,0};
417
418 while (nmuons < fNMuMin) {
419
420 nmuons = 0;
421 npartPushed = 0;
422 for (Int_t iproc=0; iproc<nproc; iproc++) {
423 if (fGenSingleProc == -1) {
424 mult[iproc] = Int_t(fMult[idRes[iproc]]->GetRandom()*fScaleMult[idRes[iproc]]);
425 }
426 else {
427 if (iproc==fGenSingleProc) {
428 mult[iproc] = 1;
429 BR[iproc] = 1;
430 }
431 else {
432 mult[iproc] = 0;
433 BR[iproc] = 0;
434 }
435 }
436 }
437
438 if (fGenSingleProc == -1) {
439 mult[1] = mult[0];
440 mult[4] = mult[3];
441 }
442
443 for (Int_t iproc = 0; iproc < nproc; iproc++) {
0d19baad 444 // printf ("Multiplicity for process %d is %d\n",iproc,mult[iproc]);
368fc61e 445 for (Int_t imult=0; imult<mult[iproc]; imult++) {
446 if (gRandom->Rndm() < BR[iproc]) {
447 fHNProc->Fill(iproc);
448 Int_t ipart = idRes[iproc];
449 pt = fPt[ipart]->GetRandom();
450 y = fY[ipart]->GetRandom();
451 phi = gRandom->Rndm() * 2 * TMath::Pi();
452 mass = pdg->GetParticle(fPDG[ipart])->Mass();
453 px = pt * TMath::Cos(phi);
454 py = pt * TMath::Sin(phi);
455 mt = TMath::Sqrt(pt * pt + mass * mass);
456 pz = mt * TMath::SinH(y);
457 ene = mt * TMath::CosH(y);
458
459 mother = fParticle[ipart];
460 mother->SetMomentum(px,py,pz,ene);
461 mother->SetCalcMass(mass);
462 if (!KinematicSelection(mother,0)) continue;
463
464 Bool_t hasDecayed = kTRUE;
465 if (idDec[iproc] == 0) Decay2Body(mother);
466 else if (idDec[iproc] == 1) DalitzDecay(mother);
467 else DecayPiK(mother,hasDecayed);
468 if (!hasDecayed) continue;
469 Bool_t isMu0Acc = KinematicSelection(fMu[0],1);
470 Bool_t isMu1Acc = KinematicSelection(fMu[1],1);
471 Bool_t isMuFromPiKAcc = kTRUE;
472
473 if (idDec[iproc] == 2) isMuFromPiKAcc = (mother->GetPdgCode()>0) ? isMu0Acc : isMu1Acc;
474 // mother
475 if ((idDec[iproc] < 2 && (isMu0Acc || isMu1Acc)) ||
476 (idDec[iproc] == 2 && isMuFromPiKAcc)) {
477 pdgPushed[npartPushed] = mother->GetPdgCode();
478 pxPushed[npartPushed] = mother->Px();
479 pyPushed[npartPushed] = mother->Py();
480 pzPushed[npartPushed] = mother->Pz();
481 ePushed[npartPushed] = mother->Energy();
482 npartPushed++;
483 if (isMu0Acc && (idDec[iproc] < 2 || mother->GetPdgCode() > 0)) {
484 pdgPushed[npartPushed] = fMu[0]->GetPdgCode();
485 pxPushed[npartPushed] = fMu[0]->Px();
486 pyPushed[npartPushed] = fMu[0]->Py();
487 pzPushed[npartPushed] = fMu[0]->Pz();
488 ePushed[npartPushed] = fMu[0]->Energy();
489 npartPushed++;
490 nmuons++;
491 }
492
493 if (isMu1Acc && (idDec[iproc] < 2 || mother->GetPdgCode() < 0)) {
494 pdgPushed[npartPushed] = fMu[1]->GetPdgCode();
495 pxPushed[npartPushed] = fMu[1]->Px();
496 pyPushed[npartPushed] = fMu[1]->Py();
497 pzPushed[npartPushed] = fMu[1]->Pz();
498 ePushed[npartPushed] = fMu[1]->Energy();
499 npartPushed++;
500 nmuons++;
501 }
502 }
503 } // end if BR
504 } // end loop on multiplicity
505 } // end loop on process
506 fHMultMu->Fill(nmuons);
507 } // keep on generating until at least a muon is created in the event
508
509 Int_t ntmother = 0, ntchild =0;
510 for (Int_t ipart = 0; ipart < npartPushed; ipart++) {
511 if (TMath::Abs(pdgPushed[ipart]) != 13) { // particle is not a muon, hence it's a mother
512 PushTrack(0,-1,pdgPushed[ipart],
513 pxPushed[ipart],pyPushed[ipart],pzPushed[ipart],ePushed[ipart],
35e2c739 514 origin0[0],origin0[1],origin0[2],0.,
368fc61e 515 polar[0],polar[1],polar[2],
516 kPPrimary,ntmother,1,11);
517 KeepTrack(ntmother);
518 }
519 else {
520 PushTrack(1,ntmother,pdgPushed[ipart],
521 pxPushed[ipart],pyPushed[ipart],pzPushed[ipart],ePushed[ipart],
35e2c739 522 origin0[0],origin0[1],origin0[2],0.,
368fc61e 523 polar[0],polar[1],polar[2],
524 kPDecay,ntchild,1,1);
525 KeepTrack(ntchild);
526 }
527 }
528 SetHighWaterMark(ntchild);
529 AliGenEventHeader* header = new AliGenEventHeader("LMR");
530 header->SetPrimaryVertex(fVertex);
531 header->SetNProduced(fNprimaries);
532 AddHeader(header);
533}
534
535//------------------------------------------------------------------
536
35e2c739 537void AliGenMUONLMR::Decay2Body(TParticle *mother){
368fc61e 538 // performs decay in two muons of the low mass resonances
539 Double_t md1 = fMu[0]->GetMass();
540 Int_t pdg = mother->GetPdgCode();
541 Double_t mres =0;
542 // if mother is a rho, extract the mass from its line shape
543 // otherwise consider the resonance mass
544 if (pdg == 113) mres = fRhoLineShape->GetRandom();
545 else mres = mother->GetCalcMass();
546 // while (mres < md1 + md2) mres = fDsigmaDm[res]->GetRandom();
547 // energies and momenta in rest frame
548 Double_t e1 = mres / 2.;
549 Double_t p1 = TMath::Sqrt((e1 + md1)*(e1 - md1));
550 // orientation in decaying particle rest frame
551 Double_t costheta = gRandom->Rndm() * 2 - 1;
552 Double_t sintheta = TMath::Sqrt((1. + costheta)*(1. - costheta));
553 Double_t phi = 2. * TMath::Pi() * gRandom->Rndm();
554 Double_t px1 = p1 * sintheta * TMath::Cos(phi);
555 Double_t py1 = p1 * sintheta * TMath::Sin(phi);
556 Double_t pz1 = p1 * costheta;
557
558 // boost muons into lab frame
559
560 TLorentzVector vmother, v1, v2;
561 // TLorentzVector boosted1, boosted2;
562 vmother.SetPxPyPzE(mother->Px(),mother->Py(),mother->Pz(),mother->Energy());
563 v1.SetPxPyPzE(px1,py1,pz1,e1);
564 v2.SetPxPyPzE(-px1,-py1,-pz1,e1);
565
566 TVector3 betaParent = (1./vmother.E())*vmother.Vect(); // beta = p/E
567 v1.Boost(betaParent);
568 v2.Boost(betaParent);
569
0d19baad 570 // TLorentzVector vtot = v1 + v2;
571 // printf ("mother: %g %g %g %g\n",vmother.Px(), vmother.Py(), vmother.Pz(), vmother.E());
572 // printf ("vtot : %g %g %g %g\n",vtot.Px(), vtot.Py(), vtot.Pz(), vtot.E());
368fc61e 573
574 fMu[0]->SetMomentum(v1.Px(),v1.Py(),v1.Pz(),v1.E());
575 fMu[1]->SetMomentum(v2.Px(),v2.Py(),v2.Pz(),v2.E());
576}
577
578//------------------------------------------------------------------
579
580void AliGenMUONLMR::DecayPiK(TParticle *mother, Bool_t &hasDecayed){
581 // performs decays of pions and kaons
582 Double_t md1 = fMu[0]->GetMass();
583 // extract the mass from the resonance's line shape
584 Double_t mres = mother->GetMass();
585 // choose the pi/k sign, assuming 50% probabilities for both signs
586 Int_t sign = (gRandom->Rndm() > 0.5) ? 1 : -1;
587 mother->SetPdgCode(sign * TMath::Abs(mother->GetPdgCode()));
588
589 // energies and momenta in rest frame
590 Double_t e1 = (mres*mres + md1*md1)/(2*mres);
591 Double_t p1 = TMath::Sqrt((e1 + md1)*(e1 - md1));
592 // orientation in decaying particle rest frame
593 Double_t costheta = gRandom->Rndm() * 2 - 1;
594 Double_t sintheta = TMath::Sqrt((1. + costheta)*(1. - costheta));
595 Double_t phi = 2. * TMath::Pi() * gRandom->Rndm();
596 Double_t px1 = p1 * sintheta * TMath::Cos(phi);
597 Double_t py1 = p1 * sintheta * TMath::Sin(phi);
598 Double_t pz1 = p1 * costheta;
599
600 // boost muons into lab frame
601 TLorentzVector vmother, v1;
602 vmother.SetPxPyPzE(mother->Px(),mother->Py(),mother->Pz(),mother->Energy());
603 v1.SetPxPyPzE(px1,py1,pz1,e1);
604
605 TVector3 betaParent = (1./vmother.E())*vmother.Vect(); // beta = p/E
606 v1.Boost(betaParent);
607 if (mother->GetPdgCode()>0) fMu[0]->SetMomentum(v1.Px(),v1.Py(),v1.Pz(),v1.E());
608 else fMu[1]->SetMomentum(v1.Px(),v1.Py(),v1.Pz(),v1.E());
609
a59583d3 610 Int_t idmother = 0;
35e2c739 611 if (TMath::Abs(mother->GetPdgCode())== 211) idmother = 0;
612 if (TMath::Abs(mother->GetPdgCode())== 321) idmother = 1;
368fc61e 613 Double_t gammaRes = mother->Energy()/mres;
614 Double_t zResCM = fDecay[idmother]->GetRandom();
615 Double_t zResLab = gammaRes*zResCM;
616 if(zResLab > 0.938) hasDecayed = 0; // 0.938: distance from IP to absorber + lambda_i
617 else hasDecayed = 1;
368fc61e 618}
619
620//-------------------------------------------------------------------
621
35e2c739 622void AliGenMUONLMR::DalitzDecay(TParticle *mother){
368fc61e 623 //
624 // perform dalitz decays of eta, omega and etaprime
625 //
626 //in the rest frame of the virtual photon:
627 Double_t mres = mother->GetCalcMass();
628 Double_t mumass = fMu[0]->GetMass();
629 Double_t md3 = 0; // unless differently specified, third particle is a photon
630 if (mother->GetPdgCode() == 223) md3 = 0.134977; // if mother is an omega, third particle is a pi0
a59583d3 631 Int_t index = 0;
35e2c739 632 if (mother->GetPdgCode() == 221) index = 0; // eta
633 else if (mother->GetPdgCode() == 223) index = 1; // omega
634 else if (mother->GetPdgCode() == 331) index = 2; // etaPrime
368fc61e 635 Int_t flag = 0;
636 Double_t xd=0, mvirt2=0;
637 Double_t countIt = 0;
638 while (flag==0) {
639 xd = fDalitz[index]->GetRandom();
640 mvirt2 = xd * mres * mres; // mass of virtual photon
641 // check kinematics
642 if (mres - md3 > TMath::Sqrt(mvirt2) && TMath::Sqrt(mvirt2)/2. > mumass) flag=1;
643 if (++countIt>1E11) {
644 mvirt2 = mres * mres * 0.998;
645 break;
646 }
647 }
648
649 //
650 // Generate muons in virtual photon rest frame.
651 // z axis is the virt. photon direction (before boost)
652 //
653
654 Double_t e1 = TMath::Sqrt(mvirt2)/2.; // energy of mu1 in the virtual photon frame
655 Double_t psquare = (e1 + mumass)*(e1 - mumass);
656 if (psquare<0) {
c279681a 657 AliError(Form("sqrt of psquare = %f put to 0\n",psquare));
368fc61e 658 psquare = 0;
659 }
660 Double_t p1 = TMath::Sqrt(psquare);
661 //theta angle between the pos. muon and the virtual photon
662 Double_t costheta = fCosTheta->GetRandom();
663 if (costheta>1) costheta = 1;
664 if (costheta<-1) costheta = -1;
665 Double_t sintheta = TMath::Sqrt((1. + costheta)*(1. - costheta));
666 Double_t phi = 2 * TMath::Pi() * gRandom->Rndm();
667 Double_t sinphi = TMath::Sin(phi);
668 Double_t cosphi = TMath::Cos(phi);
669
670 // fill 4-vectors of leptons in the virtual photon frame
671
672 Double_t px1 = p1*sintheta*cosphi;
673 Double_t py1 = p1*sintheta*sinphi;
674 Double_t pz1 = p1*costheta;
675 Double_t px2 = -p1*sintheta*cosphi;
676 Double_t py2 = -p1*sintheta*sinphi;
677 Double_t pz2 = -p1*costheta;
678 Double_t e2 = e1;
679
680 fMu[0]->SetMomentum(px1,py1,pz1,e1);
681 fMu[1]->SetMomentum(px2,py2,pz2,e2);
682
683 // calculate components of non-dilepton in CMS of parent resonance
684
685 Double_t e3 = (mres * mres + md3 * md3 - mvirt2) / (2.*mres);
686 Double_t psquare3 = (e3 + md3)*(e3 - md3);
687 if (psquare3<0) {
c279681a 688 AliError(Form("Sqrt of psquare3 = %f put to 0\n",psquare3));
368fc61e 689 psquare3 = 0;
690 }
691 Double_t p3 = TMath::Sqrt(psquare3);
692 Double_t costheta2 = 2.* gRandom->Rndm() - 1.; // angle between virtual photon and resonance
693 if (costheta2>1) costheta2 = 1;
694 if (costheta2<-1) costheta2 = -1;
695 Double_t sintheta2 = TMath::Sqrt((1. + costheta2)*(1. - costheta2));
696 Double_t phi2 = 2 * TMath::Pi() * gRandom->Rndm();
697 Double_t sinphi2 = TMath::Sin(phi2);
698 Double_t cosphi2 = TMath::Cos(phi2);
699 Double_t px3 = p3*sintheta2*cosphi2;
700 Double_t py3 = p3*sintheta2*sinphi2;
701 Double_t pz3 = p3*costheta2;
702 TLorentzVector v3(px3,py3,pz3,e3);
703
704 sintheta2 = -sintheta2;
705 cosphi2 = -cosphi2;
706 sinphi2 = -sinphi2;
707
708 Double_t px1new = px1*costheta2*cosphi2 - py1*sinphi2 + pz1*sintheta2*cosphi2;
709 Double_t py1new = px1*costheta2*sinphi2 + py1*cosphi2 + pz1*sintheta2*sinphi2;
710 Double_t pz1new =-px1*sintheta2 + pz1*costheta2;
711 Double_t px2new = px2*costheta2*cosphi2 - py2*sinphi2 + pz2*sintheta2*cosphi2;
712 Double_t py2new = px2*costheta2*sinphi2 + py2*cosphi2 + pz2*sintheta2*sinphi2;
713 Double_t pz2new =-px2*sintheta2 + pz2*costheta2;
714
715 fMu[0]->SetMomentum(px1new,py1new,pz1new,e1);
716 fMu[1]->SetMomentum(px2new,py2new,pz2new,e2);
717
718 Double_t evirt = mres - e3;
719 Double_t pxvirt = -px3;
720 Double_t pyvirt = -py3;
721 Double_t pzvirt = -pz3;
722 TLorentzVector vvirt(pxvirt,pyvirt,pzvirt,evirt);
723 TVector3 betaVirt = (1./evirt) * vvirt.Vect(); // virtual photon beta in res frame
724
725 TLorentzVector v1(px1,py1,pz1,e1);
726 TLorentzVector v2(px2,py2,pz2,e2);
727
728 // boost the muons in the frame where the resonance is at rest
729
730 v1.Boost(betaVirt);
731 v2.Boost(betaVirt);
732
733 // boost muons and third particle in lab frame
734
735 TLorentzVector vmother(mother->Px(), mother->Py(), mother->Pz(), mother->Energy());
736 TVector3 resBetaLab = (1./vmother.E())*vmother.Vect(); // eta beta in lab frame
737 v1.Boost(resBetaLab);
738 v2.Boost(resBetaLab);
739 v3.Boost(resBetaLab);
740 vvirt.Boost(resBetaLab);
741
742 fMu[0]->SetMomentum(v1.Px(),v1.Py(),v1.Pz(),v1.E());
743 fMu[1]->SetMomentum(v2.Px(),v2.Py(),v2.Pz(),v2.E());
0d19baad 744 // part3->SetMomentum(v3.Px(),v3.Py(),v3.Pz(),v3.E());
368fc61e 745
0d19baad 746 // TLorentzVector vtot = v1 + v2 + v3;
747 // TLorentzVector vdimu = v1 + v2;
748 // printf ("mother: %g %g %g %g\n",vmother.Px(), vmother.Py(), vmother.Pz(), vmother.E());
749 // printf ("vtot : %g %g %g %g\n",vtot.Px(), vtot.Py(), vtot.Pz(), vtot.E());
750 // printf ("vvirt : %g %g %g %g\n",vvirt.Px(), vvirt.Py(), vvirt.Pz(), vvirt.E());
751 // printf ("vdimu : %g %g %g %g\n",vdimu.Px(), vdimu.Py(), vdimu.Pz(), vdimu.E());
368fc61e 752
753}
754
755//------------------------------------------------------------------
756
757Double_t AliGenMUONLMR::FormFactor(Double_t q2, Int_t decay){
758 // Calculates the form factor for Dalitz decays A->B+l+l
759 // Returns: |F(q^2)|^2
760 //
761 // References: L.G. Landsberg, Physics Reports 128 No.6 (1985) 301-376.
762
763 Double_t ff2, mass2;
764 Double_t n2, n4, m2;
765 // Lepton-G
766
767 Double_t lambda2inv = 0;
768 switch (decay) {
769 case 0: // eta -> mu mu gamma
0d19baad 770 // eta -> l+ l- gamma: pole approximation
368fc61e 771 lambda2inv = 1.95;
772 mass2 = fParticle[kEtaLMR]->GetMass() * fParticle[kEtaLMR]->GetMass();
773 if (q2 < mass2) ff2 = TMath::Power(1./(1.-lambda2inv*q2),2);
774 else ff2 = 0;
775 break;
776 case 1: // omega -> mu mu pi0
777 // omega -> l+ l- pi0: pole approximation
778 mass2 = fParticle[kOmegaLMR]->GetMass() * fParticle[kOmegaLMR]->GetMass();
779 lambda2inv = 2.26;
780 if (q2 < mass2) ff2 = TMath::Power(1./(1.-lambda2inv*q2),2);
781 else ff2 = 0;
782 break;
783 case 2: // etaPrime -> mu mu gamma
784 mass2 = fParticle[kEtaPrimeLMR]->GetMass() * fParticle[kEtaPrimeLMR]->GetMass();
785 // eta' -> l+ l- gamma: Breit-Wigner fitted to data
786 n2 = 0.764 * 0.764;
787 n4 = n2 * n2;
788 m2 = 0.1020 * 0.1020;
789 if (q2 < mass2) ff2 = n4 / (TMath::Power(n2-q2,2) + m2 * n2);
790 else ff2 = 0;
791 break;
792 default:
c279681a 793 AliError ("FormFactor: Decay not found");
368fc61e 794 return 0;
795 break;
796 }
797 return ff2;
798}
799
800//____________________________________________________________
801
35e2c739 802Double_t AliGenMUONLMR::RhoLineShapeNew(Double_t *x, Double_t */*para*/){
368fc61e 803 //new parameterization implemented by Hiroyuki Sako (GSI)
804 Double_t mass = *x;
805 double r, GammaTot;
806 Double_t mRho = TDatabasePDG::Instance()->GetParticle("rho0")->Mass();
807 Double_t mPi = TDatabasePDG::Instance()->GetParticle("pi0")->Mass();
808 Double_t mMu = TDatabasePDG::Instance()->GetParticle("mu-")->Mass();
809 Double_t Gamma0 = TDatabasePDG::Instance()->GetParticle("rho0")->Width();
810
811 const double Norm = 0.0744416*1.01;
35e2c739 812
368fc61e 813 // 0.0744416 at m = 0.72297
814 // is the max number with Norm=1 (for rho)
815
816 double mThreshold = 2.*mPi;
817
818 const double T = 0.170; // Assumption of pi+ temperature [GeV/c^2]
819 //const double T = 0.11; // Taken from fit to pi+ temperature [GeV/c^2]
820 // with Reference: LEBC-EHS collab., Z. Phys. C 50 (1991) 405
821
822 if (mass < mThreshold) {
823 r = 0.;
824 return r;
825 }
826
827 double k = sqrt(0.25*mass*mass-(mThreshold/2)*(mThreshold/2));
828 double k0 = sqrt(0.25*mRho*mRho-(mThreshold/2)*(mThreshold/2));
829
830 GammaTot = (k/k0)*(k/k0)*(k/k0)*(mRho/mass)*(mRho/mass)*Gamma0;
831
832 double FormFactor2 = 1/((mass*mass-mRho*mRho)*(mass*mass-mRho*mRho)+
833 mass*mass*GammaTot*GammaTot);
834
835 r = pow(mass,1.5)*pow((1-mThreshold*mThreshold/(mass*mass)),1.5)*
836 ((mass*mass+2*mMu*mMu)/(mass*mass))*(pow((mass*mass-4*mMu*mMu),0.5)/mass)*FormFactor2
837 *exp(-mass/T)/Norm;
838
839 return r;
840}
c279681a 841