]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliGenEpEmv1.cxx
New class used for primary vertex finding (AliITSVertexerTracks)
[u/mrichter/AliRoot.git] / EVGEN / AliGenEpEmv1.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2002, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  *                                                                        *
15  *                                                                        *
16  * Copyright(c) 1997, 1998, 2002, Adrian Alscher and Kai Hencken          *
17  * See $ALICE_ROOT/EpEmGen/diffcross.f for full Copyright notice          *
18  *                                                                        *
19  *                                                                        *
20  * Copyright(c) 2002 Kai Hencken, Yuri Kharlov, Serguei Sadovsky          *
21  * See $ALICE_ROOT/EpEmGen/epemgen.f for full Copyright notice            *
22  *                                                                        *
23  **************************************************************************/
24
25 /*
26 $Log$
27 */
28
29 // Event generator of single e+e- pair production in ultraperipheral PbPb collisions
30 // at 5.5 TeV/nucleon.
31 // The generator is based on 5-dimentional differential cross section of the process.
32 //%
33 // References:
34 // [1] "Multiple electromagnetic electron positron pair production in
35 //      relativistic heavy ion collisions".
36 //      Adrian Alscher, Kai Hencken, Dirk Trautmann, and Gerhard Baur,
37 //      Phys. Rev. A55 (1997) 396.
38 // [2] K.Hencken, Yu.Kharlov, S.Sadovsky, Internal ALICE Note 2002-27.
39 //%
40 // Usage:
41 // Initialization:
42 //    AliGenEpEmv1 *gener = new AliGenEpEmv1();
43 //    gener->SetXXXRange(); // Set kinematics range
44 //    gener->Init();
45 // Event generation:
46 //    gener->Generate(); // Produce one e+e- pair with the event weight assigned 
47 //                       // to each track. The sum of event weights, divided by 
48 //                       // the total number of generated events, gives the 
49 //                       // integral cross section of the process of e+e- pair 
50 //                       // production in the above mentioned kinematics range.
51 //                       // Sum of the selected event weights, divided by the total 
52 //                       // number of generated events, gives the integral cross 
53 //                       // section corresponded to the set of selected events
54 //%
55 // The generator consists of several modules:
56 // 1) $ALICE_ROOT/EpEmGen/diffcross.f:
57 //    Exact calculation of the total differential e+ e- -pair production
58 //    in Relativistic Heavy Ion Collisions for a point particle in an
59 //    external field approach. See full comments in the mentioned file.
60 // 2) $ALICE_ROOT/EpEmGen/epemgen.f:
61 //    Generator of e+e- pairs produced in PbPb collisions at LHC
62 //    it generates events according to the parametrization of the
63 //    differential cross section. Produces events have weights calculated
64 //    by the exact differential cross section calculation (diffcross.f).
65 //    See full comments in the mentioned file.
66 // 3) Class TEpEmGen:
67 //    Interface from the fortran event generator to ALIROOT
68 // 4) Class AliGenEpEmv1:
69 //    The event generator to call within ALIROOT
70 //%
71 // Author of this module: Yuri.Kharlov@cern.ch
72 // 9 October 2002
73
74 #include "AliGenEpEmv1.h"
75 #include <TParticle.h>
76 #include <TParticlePDG.h>
77 #include <TDatabasePDG.h>
78 #include <TEpEmGen.h>
79
80 ClassImp(AliGenEpEmv1)
81
82 //------------------------------------------------------------
83
84 AliGenEpEmv1::AliGenEpEmv1()
85 {
86   // Default constructor
87   // Avoid zero pt
88   if (fPtMin == 0) fPtMin = 1.E-04;
89 }
90
91 //____________________________________________________________
92 AliGenEpEmv1::AliGenEpEmv1(const AliGenEpEmv1 & gen)
93 {
94   // copy constructor
95   gen.Copy(*this);
96 }
97
98 //____________________________________________________________
99 AliGenEpEmv1::~AliGenEpEmv1()
100 {
101   // Destructor
102 }
103
104 //____________________________________________________________
105 void AliGenEpEmv1::Init()
106 {
107   // Initialisation:
108   // 1) define a generator
109   // 2) initialize the generator of e+e- pair production
110
111   fMass = TDatabasePDG::Instance()->GetParticle(11)->Mass();
112
113   SetMC(new TEpEmGen());
114   fEpEmGen = (TEpEmGen*) fgMCEvGen;
115   fEpEmGen ->Initialize(fYMin,fYMax,fPtMin,fPtMax);
116   fEvent = 0;
117 }
118
119 //____________________________________________________________
120 void AliGenEpEmv1::Generate()
121 {
122   //
123   // Generate one e+e- pair
124   // Gaussian smearing on the vertex is done if selected. 
125   //%
126   // Each produced e+e- pair is defined by the following variables:
127   // rapidities of e-, e+ (yElectron,yPositron)
128   // log10(pt in MeV/c) of e-, e+ (xElectron,xPositron)
129   // azymuth angles between e- and e+ (phi12)
130   //%
131   // On output an event weight is given (weight) which is assigned to each track.
132   // The sum of event weights, divided by the total number of generated events, 
133   // gives the integral cross section of the e+e- pair production in the   
134   // selected kinematics range.   
135   //
136
137   Float_t polar[3]= {0,0,0};
138   Float_t origin[3];
139   Float_t p[3];
140
141   Double_t ptElectron,ptPositron, phiElectron,phiPositron, mt;
142   Double_t phi12=0,xElectron=0,xPositron=0,yElectron=0,yPositron=0,weight=0;
143   Int_t   j, nt, id;
144   Float_t random[6];
145
146   fEpEmGen->GenerateEvent(fYMin,fYMax,fPtMin,fPtMax,
147            yElectron,yPositron,xElectron,xPositron,phi12,weight);
148   if (fDebug == 1)
149     printf("AliGenEpEmv1::Generate(): y=(%f,%f), x=(%f,%f), phi=%f\n",
150            yElectron,yPositron,xElectron,xPositron,phi12);
151
152   for (j=0;j<3;j++) origin[j]=fOrigin[j];
153   if(fVertexSmear==kPerEvent) {
154     Rndm(random,6);
155     for (j=0;j<3;j++) {
156       origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
157         TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
158     }
159   }
160
161   Rndm(random,1);
162   ptElectron  = TMath::Power(10,xElectron) * 1.e-03;;
163   ptPositron  = TMath::Power(10,xPositron) * 1.e-03;;
164   phiElectron = fPhiMin + random[0] * (fPhiMax-fPhiMin);
165   phiPositron = phiElectron + phi12;
166
167   // Produce electron
168   mt = TMath::Sqrt(ptElectron*ptElectron + fMass*fMass);
169   p[0] = ptElectron*TMath::Cos(phiElectron);
170   p[1] = ptElectron*TMath::Sin(phiElectron);
171   p[2] = mt*TMath::SinH(yElectron);
172   id =  11;
173   if (fDebug == 2)
174     printf("id=%+3d, p = (%+11.4e,%+11.4e,%+11.4e) GeV\n",id,p[0],p[1],p[2]);
175   SetTrack(fTrackIt,-1, id,p,origin,polar,0,kPPrimary,nt,weight);
176
177   // Produce positron
178   mt = TMath::Sqrt(ptPositron*ptPositron + fMass*fMass);
179   p[0] = ptPositron*TMath::Cos(phiPositron);
180   p[1] = ptPositron*TMath::Sin(phiPositron);
181   p[2] = mt*TMath::SinH(yPositron);
182   id = -11;
183   if (fDebug == 2)
184     printf("id=%+3d, p = (%+11.4e,%+11.4e,%+11.4e) GeV\n",id,p[0],p[1],p[2]);
185   SetTrack(fTrackIt,-1, id,p,origin,polar,0,kPPrimary,nt,weight);
186   
187   fEvent++;
188   if (fEvent%1000 == 0) {
189     printf("=====> AliGenEpEmv1::Generate(): \n   Event %d, sigma=%f +- %f kb\n",
190            fEvent,fEpEmGen->GetXsection(),fEpEmGen->GetDsection());
191   }
192 }
193