]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenScan.cxx
Psi and Upsilon family generated.
[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$
b9d0a01d 18Revision 1.10.6.1 2002/07/30 11:30:48 alibrary
19Updating VirtualMC
20
21Revision 1.11 2002/07/30 09:09:59 morsch
22Correction in initialization.
23
8a5ca7c5 24Revision 1.10 2002/02/08 16:50:50 morsch
25Add name and title in constructor.
26
8b31bfac 27Revision 1.9 2001/07/27 17:09:36 morsch
28Use local SetTrack, KeepTrack and SetHighWaterMark methods
29to delegate either to local stack or to stack owned by AliRun.
30(Piotr Skowronski, A.M.)
31
a99cf51f 32Revision 1.8 2000/12/06 15:11:38 morsch
33Correct double declared data members.
34
38f1bd58 35Revision 1.7 2000/11/30 07:12:50 alibrary
36Introducing new Rndm and QA classes
37
65fb704d 38Revision 1.6 2000/10/02 21:28:06 fca
39Removal of useless dependecies via forward declarations
40
94de3818 41Revision 1.5 2000/06/09 20:37:20 morsch
42All coding rule violations except RS3 corrected
43
f87cfe57 44Revision 1.4 1999/11/03 17:43:20 fca
45New version from G.Martinez & A.Morsch
46
886b6f73 47Revision 1.3 1999/09/29 09:24:14 fca
48Introduction of the Copyright and cvs Log
49
4c039060 50*/
51
b0418df4 52#include "AliGenScan.h"
b0418df4 53#include "AliRun.h"
f87cfe57 54
b0418df4 55 ClassImp(AliGenScan)
56
57 AliGenScan::AliGenScan()
58 :AliGenerator(-1)
59{
f87cfe57 60// Constructor
38f1bd58 61 fXCmin=0;
62 fXCmax=0;
b0418df4 63 fNx=1;
38f1bd58 64 fYCmin=0;
65 fYCmax=0;
b0418df4 66 fNy=1;
67 fZmin=0;
68 fZmax=0;
69 fNz=1;
70//
71// Read all particles
72 fNpart=-1;
73}
74
75AliGenScan::AliGenScan(Int_t npart)
76 :AliGenerator(npart)
77{
f87cfe57 78// Constructor
8b31bfac 79 fName = "Scan";
80 fTitle = "Generator for particles on a grid";
81
82
38f1bd58 83 fXCmin=0;
84 fXCmax=0;
b0418df4 85 fNx=1;
38f1bd58 86 fYCmin=0;
87 fYCmax=0;
b0418df4 88 fNy=1;
89 fZmin=0;
90 fZmax=0;
91 fNz=1;
92}
93
94//____________________________________________________________
95AliGenScan::~AliGenScan()
f87cfe57 96{
97// Destructor
98}
b0418df4 99
100void 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{
f87cfe57 104// Define the grid
38f1bd58 105 fXCmin=xmin;
106 fXCmax=xmax;
b0418df4 107 fNx=nx;
38f1bd58 108 fYCmin=ymin;
109 fYCmax=ymax;
b0418df4 110 fNy=ny;
111 fZmin=zmin;
112 fZmax=zmax;
113 fNz=nz;
114}
115
116//____________________________________________________________
117void AliGenScan::Generate()
118{
119 //
120 // Generate one trigger
121 //
b0418df4 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 //
8a5ca7c5 134 if (fNx > 0) {
38f1bd58 135 dx=(fXCmax-fXCmin)/fNx;
b0418df4 136 } else {
137 dx=1e10;
138 }
139
140 if (fNy > 0) {
38f1bd58 141 dy=(fYCmax-fYCmin)/fNy;
b0418df4 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++){
65fb704d 154 Rndm(random,6);
38f1bd58 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];
b0418df4 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);
a99cf51f 164 SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
b0418df4 165 }
166 }
167 }
168}
169
170
171
172
173
174
175
176
177