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