2 *###################################################################
3 *# EPOS 1.67 K. WERNER, T. PIEROG, S. PORTEBOEUF. #
4 *# Contact: werner@subatech.in2p3.fr #
5 *###################################################################
9 * Wraper class for interfacing EPOS model, derived from ROOT's TGenerator.
10 * It generates temporary input file for the model, providing user with
11 * ability to add his/hers own lines to the input.
12 * Output is read directly from common blocks.
14 * Author: Piotr Ostrowski, postrow@if.pw.edu.pl
18 #include <TClonesArray.h>
19 #include <TDatabasePDG.h>
20 #include <TObjArray.h>
21 #include <TParticle.h>
30 #include "EPOScommon.h"
31 #include "AliGenEposIsajetToPdgConverter.h"
38 TEpos::TEpos() : TGenerator("EPOS", "Epos event generator"),
46 fPhimax(TMath::TwoPi()),
53 fIdConverter=new AliGenEposIsajetToPdgConverter();
56 TEpos::TEpos(const TEpos&) : TGenerator("EPOS", "Epos event generator"),
64 fPhimax(TMath::TwoPi()),
71 fIdConverter = new AliGenEposIsajetToPdgConverter();
78 TEpos& TEpos::operator=(const TEpos&) {
80 fIdConverter = new AliGenEposIsajetToPdgConverter();
85 void TEpos::Initialize() {
92 const char *inputFileName = GetInputFileName();
93 Int_t nameLength = strlen(inputFileName);
94 setinp(inputFileName, nameLength, nameLength);
96 while(copen.nopen == -1) {
103 utpri("aamain",prnt1.ish,ishini,4,6);
105 IniModel(appli.model);
111 void TEpos::GenerateEvent() {
112 // cseed.seedj = gRandom->Rndm() * 1e10;
117 Int_t TEpos::ImportParticles(TClonesArray *particles, Option_t *) {
119 if (!cevt.nevt) return 0;
120 Int_t numpart = cptl.nptl;
121 printf("%d particles generated\n", numpart);
122 for (Int_t iPart=0; iPart<numpart; iPart++) {
123 Int_t tFather = cptl.iorptl[iPart] - 1;
124 tFather = tFather < -1 ? -1 : tFather;
126 TParticle *mother = (TParticle*) (particles->UncheckedAt(tFather));
127 mother->SetLastDaughter(iPart);
128 if (mother->GetFirstDaughter()==-1)
129 mother->SetFirstDaughter(iPart);
131 Int_t status = cptl.istptl[iPart] + 1;
132 Int_t pdg = fIdConverter->ConvertIsajetToPdg(cptl.idptl[iPart]);
133 new((*particles)[iPart]) TParticle(pdg, status,
135 cptl.pptl[iPart][0], cptl.pptl[iPart][1],cptl.pptl[iPart][2],cptl.pptl[iPart][3],
136 cptl.xorptl[iPart][0]*1.e-12, cptl.xorptl[iPart][1]*1.e-12, cptl.xorptl[iPart][2]*1.e-12, cptl.xorptl[iPart][3]*1e-12);
137 (*particles)[iPart]->SetUniqueID(iPart);
143 TObjArray* TEpos::ImportParticles(Option_t *) {
145 if (!cevt.nevt) return NULL;
146 Int_t numpart = cptl.nptl;
147 printf("%d particles generated\n", numpart);
148 for (Int_t iPart=0; iPart<numpart; iPart++) {
149 Int_t tFather = cptl.iorptl[iPart] - 1;
150 tFather = tFather < -1 ? -1 : tFather;
152 TParticle *mother = (TParticle*) (fParticles->UncheckedAt(tFather));
153 mother->SetLastDaughter(iPart);
154 if (mother->GetFirstDaughter()==-1)
155 mother->SetFirstDaughter(iPart);
157 Int_t status = cptl.istptl[iPart] + 1;
158 Int_t pdg = fIdConverter->ConvertIsajetToPdg(cptl.idptl[iPart]);
159 TParticle* p = new TParticle(pdg, status,
161 cptl.pptl[iPart][0], cptl.pptl[iPart][1],cptl.pptl[iPart][2],cptl.pptl[iPart][3],
162 cptl.xorptl[iPart][0]*1.e-12, cptl.xorptl[iPart][1]*1.e-12, cptl.xorptl[iPart][2]*1.e-12, cptl.xorptl[iPart][3]*1e-12);
163 p->SetUniqueID(iPart);
170 void TEpos::AddNoDecay(Int_t nodecay) {
171 fNoDecays.push_back(nodecay);
174 void TEpos::AddExtraInputLine(const char *line) {
175 fExtraInputLines.push_back(line);
178 void TEpos::GenerateInputFile() {
179 ofstream file(GetInputFileName(), ios_base::out | ios_base::trunc);
181 char *epoEnv = getenv("EPO");
185 strcpy(epo, getenv("ALICE_ROOT"));
187 strcat(epo, "/EPOS/epos167");
189 file << "fname pathnx " << epo << "/" << endl;
190 file << "fname histo none" << endl;
191 file << "fname copy none" << endl;
192 file << "fname log none" << endl;
193 file << "fname check none" << endl;
194 // file << "fname data /tmp/epos.out" << endl;
195 file << "fname initl " << epo << "/epos.initl" << endl;
196 file << "fname inidi " << epo << "/epos.inidi" << endl;
197 file << "fname inidr " << epo << "/epos.inidr" << endl;
198 file << "fname iniev " << epo << "/epos.iniev" << endl;
199 file << "fname inirj " << epo << "/epos.inirj" << endl;
200 file << "fname inics " << epo << "/epos.inics" << endl;
201 file << "fname inigrv " << epo << "/epos.inigrv" << endl;
202 file << "fqgsjet dat " << epo << "/qgsjet/qgsjet.dat" << endl;
203 file << "fqgsjet ncs " << epo << "/qgsjet/qgsjet.ncs" << endl;
204 file << "fqgsjetII dat " << epo << "/qgsjetII/qgsdat-II-03" << endl;
205 file << "fqgsjetII ncs " << epo << "/qgsjetII/sectnu-II-03" << endl;
206 file << "nodecay 120" << endl;
207 file << "nodecay -120" << endl;
208 file << "nodecay 130" << endl;
209 file << "nodecay -130" << endl;
210 file << "nodecay -20" << endl;
211 file << "nodecay 20" << endl;
212 file << "nodecay 14" << endl;
213 file << "nodecay -14" << endl;
214 file << "set ndecay 1111110" << endl;
215 file << "echo on" << endl;
218 int precision = file.precision();
220 file << "set seedj " << (gRandom->Rndm() * 1e14) << endl;
221 file.precision(precision);
222 file << "application hadron" << endl;
223 file << "set laproj " << fLaproj << endl;
224 file << "set maproj " << fMaproj << endl;
225 file << "set latarg " << fLatarg << endl;
226 file << "set matarg " << fMatarg << endl;
227 file << "set bminim " << fBminim << endl;
228 file << "set bmaxim " << fBmaxim << endl;
229 file << "set phimin " << fPhimin << endl;
230 file << "set phimax " << fPhimax << endl;
231 file << "set ecms " << fEcms << endl;
233 for(unsigned int i = 0; i < fNoDecays.size(); ++i) {
234 file << "nodecay " << fNoDecays[i] << endl;
237 file << "switch splitting " << (fSplitting ? "on" : "off") << endl;
239 file << "frame nucleon-nucleon" << endl;
241 for(unsigned int i = 0; i < fExtraInputLines.size(); ++i) {
242 file << fExtraInputLines[i] << endl;
245 // file << "output epos" << endl;
246 // file << "record event nevt nptl b endrecord" << endl;
247 // file << "record particle i id fa mo c1 c2 st endrecord" << endl;
249 file << "input " << epo << "/epos.param" << endl;
250 file << "runprogram" << endl;
254 Float_t TEpos::GetBimevt() { return cevt.bimevt; }
255 Float_t TEpos::GetPhievt() { return cevt.phievt; }
256 Int_t TEpos::GetKolevt() { return cevt.kolevt; }
257 Int_t TEpos::GetKoievt() { return cevt.koievt; }
258 Float_t TEpos::GetPmxevt() { return cevt.pmxevt; }
259 Float_t TEpos::GetEgyevt() { return cevt.egyevt; }
260 Int_t TEpos::GetNpjevt() { return cevt.npjevt; }
261 Int_t TEpos::GetNtgevt() { return cevt.ntgevt; }
262 Int_t TEpos::GetNpnevt() { return cevt.npnevt; }
263 Int_t TEpos::GetNppevt() { return cevt.nppevt; }
264 Int_t TEpos::GetNtnevt() { return cevt.ntnevt; }
265 Int_t TEpos::GetNtpevt() { return cevt.ntpevt; }
266 Int_t TEpos::GetJpnevt() { return cevt.jpnevt; }
267 Int_t TEpos::GetJppevt() { return cevt.jppevt; }
268 Int_t TEpos::GetJtnevt() { return cevt.jtnevt; }
269 Int_t TEpos::GetJtpevt() { return cevt.jtpevt; }
270 Float_t TEpos::GetXbjevt() { return cevt.xbjevt; }
271 Float_t TEpos::GetQsqevt() { return cevt.qsqevt; }
272 Int_t TEpos::GetNglevt() { return cevt.nglevt; }
273 Float_t TEpos::GetZppevt() { return cevt.zppevt; }
274 Float_t TEpos::GetZptevt() { return cevt.zptevt; }