]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliGenScan.cxx
New class used for primary vertex finding (AliITSVertexerTracks)
[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.10.6.1  2002/07/30 11:30:48  alibrary
19 Updating VirtualMC
20
21 Revision 1.11  2002/07/30 09:09:59  morsch
22 Correction in initialization.
23
24 Revision 1.10  2002/02/08 16:50:50  morsch
25 Add name and title in constructor.
26
27 Revision 1.9  2001/07/27 17:09:36  morsch
28 Use local SetTrack, KeepTrack and SetHighWaterMark methods
29 to delegate either to local stack or to stack owned by AliRun.
30 (Piotr Skowronski, A.M.)
31
32 Revision 1.8  2000/12/06 15:11:38  morsch
33 Correct double declared data members.
34
35 Revision 1.7  2000/11/30 07:12:50  alibrary
36 Introducing new Rndm and QA classes
37
38 Revision 1.6  2000/10/02 21:28:06  fca
39 Removal of useless dependecies via forward declarations
40
41 Revision 1.5  2000/06/09 20:37:20  morsch
42 All coding rule violations except RS3 corrected
43
44 Revision 1.4  1999/11/03 17:43:20  fca
45 New version from G.Martinez & A.Morsch
46
47 Revision 1.3  1999/09/29 09:24:14  fca
48 Introduction of the Copyright and cvs Log
49
50 */
51
52 #include "AliGenScan.h"
53 #include "AliRun.h"
54
55  ClassImp(AliGenScan)
56     
57  AliGenScan::AliGenScan()
58          :AliGenerator(-1)
59 {
60 // Constructor
61     fXCmin=0;
62     fXCmax=0;
63     fNx=1;
64     fYCmin=0;
65     fYCmax=0;
66     fNy=1;
67     fZmin=0;
68     fZmax=0;
69     fNz=1;
70 //
71 //  Read all particles
72     fNpart=-1;
73 }
74
75 AliGenScan::AliGenScan(Int_t npart)
76     :AliGenerator(npart)
77 {
78 // Constructor
79     fName  = "Scan";
80     fTitle = "Generator for particles on a grid";
81
82
83     fXCmin=0;
84     fXCmax=0;
85     fNx=1;
86     fYCmin=0;
87     fYCmax=0;
88     fNy=1;
89     fZmin=0;
90     fZmax=0;
91     fNz=1;
92 }
93
94 //____________________________________________________________
95 AliGenScan::~AliGenScan()
96 {
97 // Destructor
98 }
99
100 void AliGenScan::SetRange(Int_t nx, Float_t xmin, Float_t xmax,
101                      Int_t ny, Float_t ymin, Float_t ymax,
102                      Int_t nz, Float_t zmin, Float_t zmax)
103 {
104 // Define the grid
105     fXCmin=xmin;
106     fXCmax=xmax;
107     fNx=nx;
108     fYCmin=ymin;
109     fYCmax=ymax;
110     fNy=ny;
111     fZmin=zmin;
112     fZmax=zmax;
113     fNz=nz;
114 }
115
116 //____________________________________________________________
117 void AliGenScan::Generate()
118 {
119   //
120   // Generate one trigger
121   //
122   
123   Float_t polar[3]= {0,0,0};
124   //
125   Float_t origin[3];
126   Float_t p[3];
127   Int_t nt;
128   Float_t pmom, theta, phi;
129   //
130   Float_t random[6];
131   Float_t dx,dy,dz;
132   
133   //
134   if (fNx > 0) {
135       dx=(fXCmax-fXCmin)/fNx;
136   } else {
137       dx=1e10;
138   }
139
140   if (fNy > 0) {
141       dy=(fYCmax-fYCmin)/fNy;
142   } else {
143       dy=1e10;
144   }
145
146   if (fNz > 0) {
147       dz=(fZmax-fZmin)/fNz;
148   } else {
149       dz=1e10;
150   }
151   for (Int_t ix=0; ix<fNx; ix++) {
152       for (Int_t iy=0; iy<fNy; iy++) {
153           for (Int_t iz=0; iz<fNz; iz++){
154               Rndm(random,6);
155               origin[0]=fXCmin+ix*dx+2*(random[0]-0.5)*fOsigma[0];
156               origin[1]=fYCmin+iy*dy+2*(random[1]-0.5)*fOsigma[1];
157               origin[2]=fZmin+iz*dz+2*(random[2]-0.5)*fOsigma[2];            
158               pmom=fPMin+random[3]*(fPMax-fPMin);
159               theta=fThetaMin+random[4]*(fThetaMax-fThetaMin);
160               phi=fPhiMin+random[5]*(fPhiMax-fPhiMin);
161               p[0] = pmom*TMath::Cos(phi)*TMath::Sin(theta);
162               p[1] = pmom*TMath::Sin(phi)*TMath::Sin(theta);
163               p[2] = pmom*TMath::Cos(theta);
164               SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
165           }
166       }
167   }
168 }
169
170
171
172
173
174
175
176
177