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&) {
81 fIdConverter = new AliGenEposIsajetToPdgConverter();
86 void TEpos::Initialize() {
87 // Generates input file and prepares EPOS to read from it.
94 const char *inputFileName = GetInputFileName();
95 Int_t nameLength = strlen(inputFileName);
96 setinp(inputFileName, nameLength, nameLength);
98 while(copen.nopen == -1) {
105 utpri("aamain",prnt1.ish,ishini,4,6);
107 IniModel(appli.model);
113 void TEpos::GenerateEvent() {
114 // cseed.seedj = gRandom->Rndm() * 1e10;
119 Int_t TEpos::ImportParticles(TClonesArray *particles, Option_t *) {
120 //Fills provided ClonesArray with generated particles
122 if (!cevt.nevt) return 0;
123 Int_t numpart = cptl.nptl;
124 printf("%d particles generated\n", numpart);
125 for (Int_t iPart=0; iPart<numpart; iPart++) {
126 Int_t tFather = cptl.iorptl[iPart] - 1;
127 tFather = tFather < -1 ? -1 : tFather;
129 TParticle *mother = (TParticle*) (particles->UncheckedAt(tFather));
130 mother->SetLastDaughter(iPart);
131 if (mother->GetFirstDaughter()==-1)
132 mother->SetFirstDaughter(iPart);
134 Int_t status = cptl.istptl[iPart] + 1;
135 Int_t pdg = fIdConverter->ConvertIsajetToPdg(cptl.idptl[iPart]);
136 new((*particles)[iPart]) TParticle(pdg, status,
138 cptl.pptl[iPart][0], cptl.pptl[iPart][1],cptl.pptl[iPart][2],cptl.pptl[iPart][3],
139 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);
140 (*particles)[iPart]->SetUniqueID(iPart);
146 TObjArray* TEpos::ImportParticles(Option_t *) {
147 //Creates new particle array
149 if (!cevt.nevt) return NULL;
150 Int_t numpart = cptl.nptl;
151 printf("%d particles generated\n", numpart);
152 for (Int_t iPart=0; iPart<numpart; iPart++) {
153 Int_t tFather = cptl.iorptl[iPart] - 1;
154 tFather = tFather < -1 ? -1 : tFather;
156 TParticle *mother = (TParticle*) (fParticles->UncheckedAt(tFather));
157 mother->SetLastDaughter(iPart);
158 if (mother->GetFirstDaughter()==-1)
159 mother->SetFirstDaughter(iPart);
161 Int_t status = cptl.istptl[iPart] + 1;
162 Int_t pdg = fIdConverter->ConvertIsajetToPdg(cptl.idptl[iPart]);
163 TParticle* p = new TParticle(pdg, status,
165 cptl.pptl[iPart][0], cptl.pptl[iPart][1],cptl.pptl[iPart][2],cptl.pptl[iPart][3],
166 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);
167 p->SetUniqueID(iPart);
174 void TEpos::AddNoDecay(Int_t nodecay) {
175 fNoDecays.push_back(nodecay);
178 void TEpos::AddExtraInputLine(const char *line) {
179 fExtraInputLines.push_back(line);
182 void TEpos::GenerateInputFile() {
183 // Generate input file in EPOS format
184 ofstream file(GetInputFileName(), ios_base::out | ios_base::trunc);
186 char *epoEnv = getenv("EPO");
188 strncpy(epo, epoEnv, 255);
190 strncpy(epo, getenv("ALICE_ROOT"), 255);
192 strncat(epo, "/EPOS/epos167", 255);
194 file << "fname pathnx " << epo << "/" << endl;
195 file << "fname histo none" << endl;
196 file << "fname copy none" << endl;
197 file << "fname log none" << endl;
198 file << "fname check none" << endl;
199 // file << "fname data /tmp/epos.out" << endl;
200 file << "fname initl " << epo << "/epos.initl" << endl;
201 file << "fname inidi " << epo << "/epos.inidi" << endl;
202 file << "fname inidr " << epo << "/epos.inidr" << endl;
203 file << "fname iniev " << epo << "/epos.iniev" << endl;
204 file << "fname inirj " << epo << "/epos.inirj" << endl;
205 file << "fname inics " << epo << "/epos.inics" << endl;
206 file << "fname inigrv " << epo << "/epos.inigrv" << endl;
207 file << "fqgsjet dat " << epo << "/qgsjet/qgsjet.dat" << endl;
208 file << "fqgsjet ncs " << epo << "/qgsjet/qgsjet.ncs" << endl;
209 file << "fqgsjetII dat " << epo << "/qgsjetII/qgsdat-II-03" << endl;
210 file << "fqgsjetII ncs " << epo << "/qgsjetII/sectnu-II-03" << endl;
211 file << "nodecay 120" << endl;
212 file << "nodecay -120" << endl;
213 file << "nodecay 130" << endl;
214 file << "nodecay -130" << endl;
215 file << "nodecay -20" << endl;
216 file << "nodecay 20" << endl;
217 file << "nodecay 14" << endl;
218 file << "nodecay -14" << endl;
219 file << "set ndecay 1111110" << endl;
220 file << "echo on" << endl;
223 int precision = file.precision();
225 file << "set seedj " << (gRandom->Rndm() * 1e14) << endl;
226 file.precision(precision);
227 file << "application hadron" << endl;
228 file << "set laproj " << fLaproj << endl;
229 file << "set maproj " << fMaproj << endl;
230 file << "set latarg " << fLatarg << endl;
231 file << "set matarg " << fMatarg << endl;
232 file << "set bminim " << fBminim << endl;
233 file << "set bmaxim " << fBmaxim << endl;
234 file << "set phimin " << fPhimin << endl;
235 file << "set phimax " << fPhimax << endl;
236 file << "set ecms " << fEcms << endl;
238 for(unsigned int i = 0; i < fNoDecays.size(); ++i) {
239 file << "nodecay " << fNoDecays[i] << endl;
242 file << "switch splitting " << (fSplitting ? "on" : "off") << endl;
244 file << "frame nucleon-nucleon" << endl;
246 for(unsigned int i = 0; i < fExtraInputLines.size(); ++i) {
247 file << fExtraInputLines[i] << endl;
250 // file << "output epos" << endl;
251 // file << "record event nevt nptl b endrecord" << endl;
252 // file << "record particle i id fa mo c1 c2 st endrecord" << endl;
254 file << "input " << epo << "/epos.param" << endl;
255 file << "runprogram" << endl;
259 Float_t TEpos::GetBimevt() const { return cevt.bimevt; }
260 Float_t TEpos::GetPhievt() const { return cevt.phievt; }
261 Int_t TEpos::GetKolevt() const { return cevt.kolevt; }
262 Int_t TEpos::GetKoievt() const { return cevt.koievt; }
263 Float_t TEpos::GetPmxevt() const { return cevt.pmxevt; }
264 Float_t TEpos::GetEgyevt() const { return cevt.egyevt; }
265 Int_t TEpos::GetNpjevt() const { return cevt.npjevt; }
266 Int_t TEpos::GetNtgevt() const { return cevt.ntgevt; }
267 Int_t TEpos::GetNpnevt() const { return cevt.npnevt; }
268 Int_t TEpos::GetNppevt() const { return cevt.nppevt; }
269 Int_t TEpos::GetNtnevt() const { return cevt.ntnevt; }
270 Int_t TEpos::GetNtpevt() const { return cevt.ntpevt; }
271 Int_t TEpos::GetJpnevt() const { return cevt.jpnevt; }
272 Int_t TEpos::GetJppevt() const { return cevt.jppevt; }
273 Int_t TEpos::GetJtnevt() const { return cevt.jtnevt; }
274 Int_t TEpos::GetJtpevt() const { return cevt.jtpevt; }
275 Float_t TEpos::GetXbjevt() const { return cevt.xbjevt; }
276 Float_t TEpos::GetQsqevt() const { return cevt.qsqevt; }
277 Int_t TEpos::GetNglevt() const { return cevt.nglevt; }
278 Float_t TEpos::GetZppevt() const { return cevt.zppevt; }
279 Float_t TEpos::GetZptevt() const { return cevt.zptevt; }