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 **************************************************************************/
22 Revision 1.8 2000/06/08 13:34:50 fca
23 Better control of momentum range in GenBox
25 Revision 1.7 2000/06/07 16:29:58 fca
26 Adding check for pt range in AliGenBox
28 Revision 1.6 1999/11/03 17:43:20 fca
29 New version from G.Martinez & A.Morsch
31 Revision 1.5 1999/09/29 09:24:14 fca
32 Introduction of the Copyright and cvs Log
35 ///////////////////////////////////////////////////////////////////
37 // Generate the final state of the interaction as the input //
38 // to the MonteCarlo //
42 <img src="picts/AliGeneratorClass.gif">
45 <font size=+2 color=red>
46 <p>The responsible person for this module is
47 <a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
53 ///////////////////////////////////////////////////////////////////
55 #include "AliGenBox.h"
62 //_____________________________________________________________________________
63 AliGenBox::AliGenBox()
67 // Default constructor
72 //_____________________________________________________________________________
73 AliGenBox::AliGenBox(Int_t npart)
77 // Standard constructor
80 fTitle="Box particle generator";
81 // Generate Proton by default
85 //_____________________________________________________________________________
87 void AliGenBox::Generate()
90 // Generate one trigger
93 Float_t polar[3]= {0,0,0};
98 Double_t pmom, theta, phi, pt;
102 for (j=0;j<3;j++) origin[j]=fOrigin[j];
103 if(fVertexSmear==perEvent) {
106 origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
107 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
110 for(i=0;i<fNpart;i++) {
112 theta=fThetaMin+random[0]*(fThetaMax-fThetaMin);
113 if(TestBit(kMomentumRange)) {
114 pmom=fPMin+random[1]*(fPMax-fPMin);
115 pt=pmom*TMath::Sin(theta);
118 pt=fPtMin+random[1]*(fPtMax-fPtMin);
119 pmom=pt/TMath::Sin(theta);
121 phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
122 p[0] = pt*TMath::Cos(phi);
123 p[1] = pt*TMath::Sin(phi);
124 p[2] = pmom*TMath::Cos(theta);
126 if(fVertexSmear==perTrack) {
129 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
130 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
133 gAlice->SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,"Primary",nt);
137 //_____________________________________________________________________________
139 void AliGenBox::Init()
141 // Initialisation, check consistency of selected ranges
142 if(TestBit(kPtRange)&&TestBit(kMomentumRange))
143 Fatal("Init","You should not set the momentum range and the pt range!\n");
144 if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange)))
145 Fatal("Init","You should set either the momentum or the pt range!\n");