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