Introducing Copyright include file
[u/mrichter/AliRoot.git] / EVGEN / AliGenScan.cxx
CommitLineData
b0418df4 1#include "AliGenScan.h"
2#include <stdlib.h>
3#include "AliRun.h"
4 ClassImp(AliGenScan)
5
6 AliGenScan::AliGenScan()
7 :AliGenerator(-1)
8{
9//
10 fXmin=0;
11 fXmax=0;
12 fNx=1;
13 fYmin=0;
14 fYmax=0;
15 fNy=1;
16 fZmin=0;
17 fZmax=0;
18 fNz=1;
19//
20// Read all particles
21 fNpart=-1;
22}
23
24AliGenScan::AliGenScan(Int_t npart)
25 :AliGenerator(npart)
26{
27 fXmin=0;
28 fXmax=0;
29 fNx=1;
30 fYmin=0;
31 fYmax=0;
32 fNy=1;
33 fZmin=0;
34 fZmax=0;
35 fNz=1;
36}
37
38//____________________________________________________________
39AliGenScan::~AliGenScan()
40{}
41
42void AliGenScan::SetRange(Int_t nx, Float_t xmin, Float_t xmax,
43 Int_t ny, Float_t ymin, Float_t ymax,
44 Int_t nz, Float_t zmin, Float_t zmax)
45{
46 fXmin=xmin;
47 fXmax=xmax;
48 fNx=nx;
49 fYmin=ymin;
50 fYmax=ymax;
51 fNy=ny;
52 fZmin=zmin;
53 fZmax=zmax;
54 fNz=nz;
55}
56
57//____________________________________________________________
58void AliGenScan::Generate()
59{
60 //
61 // Generate one trigger
62 //
b0418df4 63
64 Float_t polar[3]= {0,0,0};
65 //
66 Float_t origin[3];
67 Float_t p[3];
68 Int_t nt;
69 Float_t pmom, theta, phi;
70 //
71 Float_t random[6];
72 Float_t dx,dy,dz;
73
74 //
75 if (fNy > 0) {
76 dx=(fXmax-fXmin)/fNx;
77 } else {
78 dx=1e10;
79 }
80
81 if (fNy > 0) {
82 dy=(fYmax-fYmin)/fNy;
83 } else {
84 dy=1e10;
85 }
86
87 if (fNz > 0) {
88 dz=(fZmax-fZmin)/fNz;
89 } else {
90 dz=1e10;
91 }
92 for (Int_t ix=0; ix<fNx; ix++) {
93 for (Int_t iy=0; iy<fNy; iy++) {
94 for (Int_t iz=0; iz<fNz; iz++){
cfce8870 95 gMC->Rndm(random,6);
b0418df4 96 origin[0]=fXmin+ix*dx+2*(random[0]-0.5)*fOsigma[0];
97 origin[1]=fYmin+iy*dy+2*(random[1]-0.5)*fOsigma[1];
98 origin[2]=fZmin+iz*dz+2*(random[2]-0.5)*fOsigma[2];
99 pmom=fPMin+random[3]*(fPMax-fPMin);
100 theta=fThetaMin+random[4]*(fThetaMax-fThetaMin);
101 phi=fPhiMin+random[5]*(fPhiMax-fPhiMin);
102 p[0] = pmom*TMath::Cos(phi)*TMath::Sin(theta);
103 p[1] = pmom*TMath::Sin(phi)*TMath::Sin(theta);
104 p[2] = pmom*TMath::Cos(theta);
105 gAlice->SetTrack(1,-1,fIpart,p,origin,polar,0,"Primary",nt);
106 }
107 }
108 }
109}
110
111
112
113
114
115
116
117
118