]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliGenBox.cxx
Removal of useless dependecies via forward declarations
[u/mrichter/AliRoot.git] / EVGEN / AliGenBox.cxx
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$
18 Revision 1.2  2000/07/11 18:24:55  fca
19 Coding convention corrections + few minor bug fixes
20
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)
24
25 */
26
27 /*
28 Old Log:
29 Revision 1.8  2000/06/08 13:34:50  fca
30 Better control of momentum range in GenBox
31
32 Revision 1.7  2000/06/07 16:29:58  fca
33 Adding check for pt range in AliGenBox
34
35 Revision 1.6  1999/11/03 17:43:20  fca
36 New version from G.Martinez & A.Morsch
37
38 Revision 1.5  1999/09/29 09:24:14  fca
39 Introduction of the Copyright and cvs Log
40 */
41
42 ///////////////////////////////////////////////////////////////////
43 //                                                               //
44 //    Generate the final state of the interaction as the input   //
45 //    to the MonteCarlo                                          //
46 //
47 //Begin_Html
48 /*
49 <img src="picts/AliGeneratorClass.gif">
50 </pre>
51 <br clear=left>
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>.
55 </font>
56 <pre>
57 */
58 //End_Html
59 //                                                               //
60 ///////////////////////////////////////////////////////////////////
61
62 #include "AliGenBox.h"
63 #include "AliRun.h"
64 #include "AliConst.h"
65 #include "AliPDG.h"
66 #include "AliMC.h"
67
68 ClassImp(AliGenBox)
69
70 //_____________________________________________________________________________
71 AliGenBox::AliGenBox()
72     :AliGenerator()
73 {
74   //
75   // Default constructor
76   //
77   fIpart=0;
78 }
79
80 //_____________________________________________________________________________
81 AliGenBox::AliGenBox(Int_t npart)
82   :AliGenerator(npart)
83 {
84   //
85   // Standard constructor
86   //
87   fName="Box";
88   fTitle="Box particle generator";
89   // Generate Proton by default
90   fIpart=kProton;
91 }
92
93 //_____________________________________________________________________________
94
95 void AliGenBox::Generate()
96 {
97   //
98   // Generate one trigger
99   //
100   
101     Float_t polar[3]= {0,0,0};
102   //
103     Float_t origin[3];
104     Float_t p[3];
105     Int_t i, j, nt;
106     Double_t pmom, theta, phi, pt;
107     //
108     Float_t random[6];
109   //
110     for (j=0;j<3;j++) origin[j]=fOrigin[j];
111     if(fVertexSmear==kPerEvent) {
112         gMC->Rndm(random,6);
113         for (j=0;j<3;j++) {
114             origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
115                 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
116         }
117     }
118     for(i=0;i<fNpart;i++) {
119         gMC->Rndm(random,3);
120         theta=fThetaMin+random[0]*(fThetaMax-fThetaMin);
121         if(TestBit(kMomentumRange)) {
122             pmom=fPMin+random[1]*(fPMax-fPMin);
123             pt=pmom*TMath::Sin(theta);
124         } else {
125
126             pt=fPtMin+random[1]*(fPtMax-fPtMin);
127             pmom=pt/TMath::Sin(theta);
128         }
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);
133
134         if(fVertexSmear==kPerTrack) {
135             gMC->Rndm(random,6);
136             for (j=0;j<3;j++) {
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]));
139             }
140         }
141         gAlice->SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,"Primary",nt);
142     }
143 }
144
145 //_____________________________________________________________________________
146
147 void AliGenBox::Init()
148 {
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");
154 }
155