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