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 **************************************************************************/
19 // Generator for particles in a preset
20 // kinematic range (flat distribution)
21 // Note that for a given theta pt and p are not independent
22 // Range for only one variable (pt or p) should be given.
24 // Comments and suggestions: andreas.morsch@cern.ch
28 <img src="picts/AliGeneratorClass.gif">
31 <font size=+2 color=red>
32 <p>The responsible person for this module is
33 <a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
39 ///////////////////////////////////////////////////////////////////
44 #include "AliGenBox.h"
49 //_____________________________________________________________________________
50 AliGenBox::AliGenBox()
54 // Default constructor
59 //_____________________________________________________________________________
60 AliGenBox::AliGenBox(Int_t npart)
64 // Standard constructor
67 fTitle = "Box particle generator";
68 // Generate Proton by default
72 //_____________________________________________________________________________
74 void AliGenBox::Generate()
77 // Generate one trigger
80 Float_t polar[3]= {0,0,0};
85 Double_t pmom, theta, phi, pt;
89 for (j=0;j<3;j++) origin[j]=fOrigin[j];
90 if(fVertexSmear==kPerEvent) {
92 for (j=0;j<3;j++) origin[j]=fVertex[j];
95 for(i=0;i<fNpart;i++) {
97 theta=fThetaMin+random[0]*(fThetaMax-fThetaMin);
98 if(TestBit(kMomentumRange)) {
99 pmom=fPMin+random[1]*(fPMax-fPMin);
100 pt=pmom*TMath::Sin(theta);
103 pt=fPtMin+random[1]*(fPtMax-fPtMin);
104 pmom=pt/TMath::Sin(theta);
106 phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
107 p[0] = pt*TMath::Cos(phi);
108 p[1] = pt*TMath::Sin(phi);
109 p[2] = pmom*TMath::Cos(theta);
111 if(fVertexSmear==kPerTrack) {
114 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
115 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
118 PushTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
122 //_____________________________________________________________________________
124 void AliGenBox::Init()
126 // Initialisation, check consistency of selected ranges
127 if(TestBit(kPtRange)&&TestBit(kMomentumRange))
128 Fatal("Init","You should not set the momentum range and the pt range!\n");
129 if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange)))
130 Fatal("Init","You should set either the momentum or the pt range!\n");