]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenBox.cxx
Introducing Header instead of Log
[u/mrichter/AliRoot.git] / EVGEN / AliGenBox.cxx
CommitLineData
790bbabf 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$
8b31bfac 18Revision 1.6 2001/07/27 17:09:35 morsch
19Use local SetTrack, KeepTrack and SetHighWaterMark methods
20to delegate either to local stack or to stack owned by AliRun.
21(Piotr Skowronski, A.M.)
22
a99cf51f 23Revision 1.5 2000/12/21 16:24:06 morsch
24Coding convention clean-up
25
675e9664 26Revision 1.4 2000/11/30 07:12:49 alibrary
27Introducing new Rndm and QA classes
28
65fb704d 29Revision 1.3 2000/10/02 21:28:06 fca
30Removal of useless dependecies via forward declarations
31
94de3818 32Revision 1.2 2000/07/11 18:24:55 fca
33Coding convention corrections + few minor bug fixes
34
aee8290b 35Revision 1.1 2000/06/09 20:22:58 morsch
36Same class as previously in AliSimpleGen.cxx
37All coding rule violations except RS3 corrected (AM)
38
790bbabf 39*/
40
790bbabf 41
790bbabf 42
675e9664 43// Generator for particles in a preset
44// kinematic range (flat distribution)
45// Note that for a given theta pt and p are not independent
46// Range for only one variable (pt or p) should be given.
47//
48// Comments and suggestions: andreas.morsch@cern.ch
790bbabf 49//
50//Begin_Html
51/*
52<img src="picts/AliGeneratorClass.gif">
53</pre>
54<br clear=left>
55<font size=+2 color=red>
56<p>The responsible person for this module is
57<a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
58</font>
59<pre>
60*/
61//End_Html
62// //
63///////////////////////////////////////////////////////////////////
64
65#include "AliGenBox.h"
66#include "AliRun.h"
67#include "AliConst.h"
68#include "AliPDG.h"
69
70ClassImp(AliGenBox)
71
72//_____________________________________________________________________________
73AliGenBox::AliGenBox()
74 :AliGenerator()
75{
76 //
77 // Default constructor
78 //
79 fIpart=0;
80}
81
82//_____________________________________________________________________________
83AliGenBox::AliGenBox(Int_t npart)
84 :AliGenerator(npart)
85{
86 //
87 // Standard constructor
88 //
8b31bfac 89 fName = "Box";
90 fTitle = "Box particle generator";
790bbabf 91 // Generate Proton by default
92 fIpart=kProton;
93}
94
95//_____________________________________________________________________________
96
97void AliGenBox::Generate()
98{
99 //
100 // Generate one trigger
101 //
102
103 Float_t polar[3]= {0,0,0};
104 //
105 Float_t origin[3];
106 Float_t p[3];
107 Int_t i, j, nt;
108 Double_t pmom, theta, phi, pt;
109 //
110 Float_t random[6];
111 //
112 for (j=0;j<3;j++) origin[j]=fOrigin[j];
aee8290b 113 if(fVertexSmear==kPerEvent) {
65fb704d 114 Rndm(random,6);
790bbabf 115 for (j=0;j<3;j++) {
116 origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
117 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
118 }
119 }
120 for(i=0;i<fNpart;i++) {
65fb704d 121 Rndm(random,3);
790bbabf 122 theta=fThetaMin+random[0]*(fThetaMax-fThetaMin);
123 if(TestBit(kMomentumRange)) {
124 pmom=fPMin+random[1]*(fPMax-fPMin);
125 pt=pmom*TMath::Sin(theta);
126 } else {
127
128 pt=fPtMin+random[1]*(fPtMax-fPtMin);
129 pmom=pt/TMath::Sin(theta);
130 }
131 phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
132 p[0] = pt*TMath::Cos(phi);
133 p[1] = pt*TMath::Sin(phi);
134 p[2] = pmom*TMath::Cos(theta);
135
aee8290b 136 if(fVertexSmear==kPerTrack) {
65fb704d 137 Rndm(random,6);
790bbabf 138 for (j=0;j<3;j++) {
139 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
140 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
141 }
142 }
a99cf51f 143 SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
790bbabf 144 }
145}
146
147//_____________________________________________________________________________
148
149void AliGenBox::Init()
150{
151// Initialisation, check consistency of selected ranges
152 if(TestBit(kPtRange)&&TestBit(kMomentumRange))
153 Fatal("Init","You should not set the momentum range and the pt range!\n");
154 if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange)))
155 Fatal("Init","You should set either the momentum or the pt range!\n");
156}
157