]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenBox.cxx
fEntries initialized to 0 in constructor and new TList() for first call of
[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
88cb7938 16/* $Id$ */
790bbabf 17
790bbabf 18
675e9664 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.
23//
24// Comments and suggestions: andreas.morsch@cern.ch
790bbabf 25//
26//Begin_Html
27/*
28<img src="picts/AliGeneratorClass.gif">
29</pre>
30<br clear=left>
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>.
34</font>
35<pre>
36*/
37//End_Html
38// //
39///////////////////////////////////////////////////////////////////
40
116cbefd 41#include "TPDGCode.h"
42
43#include "AliConst.h"
790bbabf 44#include "AliGenBox.h"
45#include "AliRun.h"
790bbabf 46
47ClassImp(AliGenBox)
48
49//_____________________________________________________________________________
50AliGenBox::AliGenBox()
51 :AliGenerator()
52{
53 //
54 // Default constructor
55 //
56 fIpart=0;
57}
58
59//_____________________________________________________________________________
60AliGenBox::AliGenBox(Int_t npart)
61 :AliGenerator(npart)
62{
63 //
64 // Standard constructor
65 //
8b31bfac 66 fName = "Box";
67 fTitle = "Box particle generator";
790bbabf 68 // Generate Proton by default
69 fIpart=kProton;
70}
71
72//_____________________________________________________________________________
73
74void AliGenBox::Generate()
75{
76 //
77 // Generate one trigger
78 //
79
80 Float_t polar[3]= {0,0,0};
81 //
82 Float_t origin[3];
83 Float_t p[3];
84 Int_t i, j, nt;
85 Double_t pmom, theta, phi, pt;
86 //
87 Float_t random[6];
88 //
89 for (j=0;j<3;j++) origin[j]=fOrigin[j];
aee8290b 90 if(fVertexSmear==kPerEvent) {
c8f7f6f9 91 Vertex();
92 for (j=0;j<3;j++) origin[j]=fVertex[j];
790bbabf 93 }
c8f7f6f9 94
790bbabf 95 for(i=0;i<fNpart;i++) {
65fb704d 96 Rndm(random,3);
790bbabf 97 theta=fThetaMin+random[0]*(fThetaMax-fThetaMin);
98 if(TestBit(kMomentumRange)) {
99 pmom=fPMin+random[1]*(fPMax-fPMin);
100 pt=pmom*TMath::Sin(theta);
101 } else {
102
103 pt=fPtMin+random[1]*(fPtMax-fPtMin);
104 pmom=pt/TMath::Sin(theta);
105 }
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);
110
aee8290b 111 if(fVertexSmear==kPerTrack) {
65fb704d 112 Rndm(random,6);
790bbabf 113 for (j=0;j<3;j++) {
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]));
116 }
117 }
642f15cf 118 PushTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
790bbabf 119 }
120}
121
122//_____________________________________________________________________________
123
124void AliGenBox::Init()
125{
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");
131}
132