]>
Commit | Line | Data |
---|---|---|
4c039060 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | /* | |
17 | $Log$ | |
65fb704d | 18 | Revision 1.6 2000/10/02 21:28:06 fca |
19 | Removal of useless dependecies via forward declarations | |
20 | ||
94de3818 | 21 | Revision 1.5 2000/06/09 20:37:20 morsch |
22 | All coding rule violations except RS3 corrected | |
23 | ||
f87cfe57 | 24 | Revision 1.4 1999/11/03 17:43:20 fca |
25 | New version from G.Martinez & A.Morsch | |
26 | ||
886b6f73 | 27 | Revision 1.3 1999/09/29 09:24:14 fca |
28 | Introduction of the Copyright and cvs Log | |
29 | ||
4c039060 | 30 | */ |
31 | ||
b0418df4 | 32 | #include "AliGenScan.h" |
b0418df4 | 33 | #include "AliRun.h" |
f87cfe57 | 34 | |
b0418df4 | 35 | ClassImp(AliGenScan) |
36 | ||
37 | AliGenScan::AliGenScan() | |
38 | :AliGenerator(-1) | |
39 | { | |
f87cfe57 | 40 | // Constructor |
b0418df4 | 41 | fXmin=0; |
42 | fXmax=0; | |
43 | fNx=1; | |
44 | fYmin=0; | |
45 | fYmax=0; | |
46 | fNy=1; | |
47 | fZmin=0; | |
48 | fZmax=0; | |
49 | fNz=1; | |
50 | // | |
51 | // Read all particles | |
52 | fNpart=-1; | |
53 | } | |
54 | ||
55 | AliGenScan::AliGenScan(Int_t npart) | |
56 | :AliGenerator(npart) | |
57 | { | |
f87cfe57 | 58 | // Constructor |
b0418df4 | 59 | fXmin=0; |
60 | fXmax=0; | |
61 | fNx=1; | |
62 | fYmin=0; | |
63 | fYmax=0; | |
64 | fNy=1; | |
65 | fZmin=0; | |
66 | fZmax=0; | |
67 | fNz=1; | |
68 | } | |
69 | ||
70 | //____________________________________________________________ | |
71 | AliGenScan::~AliGenScan() | |
f87cfe57 | 72 | { |
73 | // Destructor | |
74 | } | |
b0418df4 | 75 | |
76 | void AliGenScan::SetRange(Int_t nx, Float_t xmin, Float_t xmax, | |
77 | Int_t ny, Float_t ymin, Float_t ymax, | |
78 | Int_t nz, Float_t zmin, Float_t zmax) | |
79 | { | |
f87cfe57 | 80 | // Define the grid |
b0418df4 | 81 | fXmin=xmin; |
82 | fXmax=xmax; | |
83 | fNx=nx; | |
84 | fYmin=ymin; | |
85 | fYmax=ymax; | |
86 | fNy=ny; | |
87 | fZmin=zmin; | |
88 | fZmax=zmax; | |
89 | fNz=nz; | |
90 | } | |
91 | ||
92 | //____________________________________________________________ | |
93 | void AliGenScan::Generate() | |
94 | { | |
95 | // | |
96 | // Generate one trigger | |
97 | // | |
b0418df4 | 98 | |
99 | Float_t polar[3]= {0,0,0}; | |
100 | // | |
101 | Float_t origin[3]; | |
102 | Float_t p[3]; | |
103 | Int_t nt; | |
104 | Float_t pmom, theta, phi; | |
105 | // | |
106 | Float_t random[6]; | |
107 | Float_t dx,dy,dz; | |
108 | ||
109 | // | |
110 | if (fNy > 0) { | |
111 | dx=(fXmax-fXmin)/fNx; | |
112 | } else { | |
113 | dx=1e10; | |
114 | } | |
115 | ||
116 | if (fNy > 0) { | |
117 | dy=(fYmax-fYmin)/fNy; | |
118 | } else { | |
119 | dy=1e10; | |
120 | } | |
121 | ||
122 | if (fNz > 0) { | |
123 | dz=(fZmax-fZmin)/fNz; | |
124 | } else { | |
125 | dz=1e10; | |
126 | } | |
127 | for (Int_t ix=0; ix<fNx; ix++) { | |
128 | for (Int_t iy=0; iy<fNy; iy++) { | |
129 | for (Int_t iz=0; iz<fNz; iz++){ | |
65fb704d | 130 | Rndm(random,6); |
b0418df4 | 131 | origin[0]=fXmin+ix*dx+2*(random[0]-0.5)*fOsigma[0]; |
132 | origin[1]=fYmin+iy*dy+2*(random[1]-0.5)*fOsigma[1]; | |
133 | origin[2]=fZmin+iz*dz+2*(random[2]-0.5)*fOsigma[2]; | |
134 | pmom=fPMin+random[3]*(fPMax-fPMin); | |
135 | theta=fThetaMin+random[4]*(fThetaMax-fThetaMin); | |
136 | phi=fPhiMin+random[5]*(fPhiMax-fPhiMin); | |
137 | p[0] = pmom*TMath::Cos(phi)*TMath::Sin(theta); | |
138 | p[1] = pmom*TMath::Sin(phi)*TMath::Sin(theta); | |
139 | p[2] = pmom*TMath::Cos(theta); | |
65fb704d | 140 | gAlice->SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt); |
b0418df4 | 141 | } |
142 | } | |
143 | } | |
144 | } | |
145 | ||
146 | ||
147 | ||
148 | ||
149 | ||
150 | ||
151 | ||
152 | ||
153 |