]>
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$ | |
aee8290b | 18 | Revision 1.1 2000/06/09 20:22:58 morsch |
19 | Same class as previously in AliSimpleGen.cxx | |
20 | All coding rule violations except RS3 corrected (AM) | |
21 | ||
790bbabf | 22 | */ |
23 | ||
24 | /* | |
25 | Old Log: | |
26 | Revision 1.8 2000/06/08 13:34:50 fca | |
27 | Better control of momentum range in GenBox | |
28 | ||
29 | Revision 1.7 2000/06/07 16:29:58 fca | |
30 | Adding check for pt range in AliGenBox | |
31 | ||
32 | Revision 1.6 1999/11/03 17:43:20 fca | |
33 | New version from G.Martinez & A.Morsch | |
34 | ||
35 | Revision 1.5 1999/09/29 09:24:14 fca | |
36 | Introduction of the Copyright and cvs Log | |
37 | */ | |
38 | ||
39 | /////////////////////////////////////////////////////////////////// | |
40 | // // | |
41 | // Generate the final state of the interaction as the input // | |
42 | // to the MonteCarlo // | |
43 | // | |
44 | //Begin_Html | |
45 | /* | |
46 | <img src="picts/AliGeneratorClass.gif"> | |
47 | </pre> | |
48 | <br clear=left> | |
49 | <font size=+2 color=red> | |
50 | <p>The responsible person for this module is | |
51 | <a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>. | |
52 | </font> | |
53 | <pre> | |
54 | */ | |
55 | //End_Html | |
56 | // // | |
57 | /////////////////////////////////////////////////////////////////// | |
58 | ||
59 | #include "AliGenBox.h" | |
60 | #include "AliRun.h" | |
61 | #include "AliConst.h" | |
62 | #include "AliPDG.h" | |
63 | ||
64 | ClassImp(AliGenBox) | |
65 | ||
66 | //_____________________________________________________________________________ | |
67 | AliGenBox::AliGenBox() | |
68 | :AliGenerator() | |
69 | { | |
70 | // | |
71 | // Default constructor | |
72 | // | |
73 | fIpart=0; | |
74 | } | |
75 | ||
76 | //_____________________________________________________________________________ | |
77 | AliGenBox::AliGenBox(Int_t npart) | |
78 | :AliGenerator(npart) | |
79 | { | |
80 | // | |
81 | // Standard constructor | |
82 | // | |
83 | fName="Box"; | |
84 | fTitle="Box particle generator"; | |
85 | // Generate Proton by default | |
86 | fIpart=kProton; | |
87 | } | |
88 | ||
89 | //_____________________________________________________________________________ | |
90 | ||
91 | void AliGenBox::Generate() | |
92 | { | |
93 | // | |
94 | // Generate one trigger | |
95 | // | |
96 | ||
97 | Float_t polar[3]= {0,0,0}; | |
98 | // | |
99 | Float_t origin[3]; | |
100 | Float_t p[3]; | |
101 | Int_t i, j, nt; | |
102 | Double_t pmom, theta, phi, pt; | |
103 | // | |
104 | Float_t random[6]; | |
105 | // | |
106 | for (j=0;j<3;j++) origin[j]=fOrigin[j]; | |
aee8290b | 107 | if(fVertexSmear==kPerEvent) { |
790bbabf | 108 | gMC->Rndm(random,6); |
109 | for (j=0;j<3;j++) { | |
110 | origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
111 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
112 | } | |
113 | } | |
114 | for(i=0;i<fNpart;i++) { | |
115 | gMC->Rndm(random,3); | |
116 | theta=fThetaMin+random[0]*(fThetaMax-fThetaMin); | |
117 | if(TestBit(kMomentumRange)) { | |
118 | pmom=fPMin+random[1]*(fPMax-fPMin); | |
119 | pt=pmom*TMath::Sin(theta); | |
120 | } else { | |
121 | ||
122 | pt=fPtMin+random[1]*(fPtMax-fPtMin); | |
123 | pmom=pt/TMath::Sin(theta); | |
124 | } | |
125 | phi=fPhiMin+random[2]*(fPhiMax-fPhiMin); | |
126 | p[0] = pt*TMath::Cos(phi); | |
127 | p[1] = pt*TMath::Sin(phi); | |
128 | p[2] = pmom*TMath::Cos(theta); | |
129 | ||
aee8290b | 130 | if(fVertexSmear==kPerTrack) { |
790bbabf | 131 | gMC->Rndm(random,6); |
132 | for (j=0;j<3;j++) { | |
133 | origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
134 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
135 | } | |
136 | } | |
137 | gAlice->SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,"Primary",nt); | |
138 | } | |
139 | } | |
140 | ||
141 | //_____________________________________________________________________________ | |
142 | ||
143 | void AliGenBox::Init() | |
144 | { | |
145 | // Initialisation, check consistency of selected ranges | |
146 | if(TestBit(kPtRange)&&TestBit(kMomentumRange)) | |
147 | Fatal("Init","You should not set the momentum range and the pt range!\n"); | |
148 | if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange))) | |
149 | Fatal("Init","You should set either the momentum or the pt range!\n"); | |
150 | } | |
151 |