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