1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.2 2000/07/11 18:24:55 fca
19 Coding convention corrections + few minor bug fixes
21 Revision 1.1 2000/06/09 20:22:58 morsch
22 Same class as previously in AliSimpleGen.cxx
23 All coding rule violations except RS3 corrected (AM)
29 Revision 1.8 2000/06/08 13:34:50 fca
30 Better control of momentum range in GenBox
32 Revision 1.7 2000/06/07 16:29:58 fca
33 Adding check for pt range in AliGenBox
35 Revision 1.6 1999/11/03 17:43:20 fca
36 New version from G.Martinez & A.Morsch
38 Revision 1.5 1999/09/29 09:24:14 fca
39 Introduction of the Copyright and cvs Log
42 ///////////////////////////////////////////////////////////////////
44 // Generate the final state of the interaction as the input //
45 // to the MonteCarlo //
49 <img src="picts/AliGeneratorClass.gif">
52 <font size=+2 color=red>
53 <p>The responsible person for this module is
54 <a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
60 ///////////////////////////////////////////////////////////////////
62 #include "AliGenBox.h"
70 //_____________________________________________________________________________
71 AliGenBox::AliGenBox()
75 // Default constructor
80 //_____________________________________________________________________________
81 AliGenBox::AliGenBox(Int_t npart)
85 // Standard constructor
88 fTitle="Box particle generator";
89 // Generate Proton by default
93 //_____________________________________________________________________________
95 void AliGenBox::Generate()
98 // Generate one trigger
101 Float_t polar[3]= {0,0,0};
106 Double_t pmom, theta, phi, pt;
110 for (j=0;j<3;j++) origin[j]=fOrigin[j];
111 if(fVertexSmear==kPerEvent) {
114 origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
115 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
118 for(i=0;i<fNpart;i++) {
120 theta=fThetaMin+random[0]*(fThetaMax-fThetaMin);
121 if(TestBit(kMomentumRange)) {
122 pmom=fPMin+random[1]*(fPMax-fPMin);
123 pt=pmom*TMath::Sin(theta);
126 pt=fPtMin+random[1]*(fPtMax-fPtMin);
127 pmom=pt/TMath::Sin(theta);
129 phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
130 p[0] = pt*TMath::Cos(phi);
131 p[1] = pt*TMath::Sin(phi);
132 p[2] = pmom*TMath::Cos(theta);
134 if(fVertexSmear==kPerTrack) {
137 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
138 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
141 gAlice->SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,"Primary",nt);
145 //_____________________________________________________________________________
147 void AliGenBox::Init()
149 // Initialisation, check consistency of selected ranges
150 if(TestBit(kPtRange)&&TestBit(kMomentumRange))
151 Fatal("Init","You should not set the momentum range and the pt range!\n");
152 if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange)))
153 Fatal("Init","You should set either the momentum or the pt range!\n");