Introducing the interaction time into the aliroot generators. In case of gaussian...
[u/mrichter/AliRoot.git] / EPOS / AliGenEpos.cxx
CommitLineData
9033ee49 1//
2// AliGenEpos.cxx
3//
4// ALICE event generator based on EPOS model from Klaus Werner
5//
6// Created on: Feb 28, 2009
7// Author: Piotr Ostrowski, postrow@if.pw.edu.pl
8//
9ef1c2d9 9
10#include "AliGenEpos.h"
11#include "TEpos.h"
12#include "TParticle.h"
879c2333 13#include "TMath.h"
9ef1c2d9 14#include "AliLog.h"
15#include "AliGenEventHeader.h"
16#include "AliGenEposEventHeader.h"
17
18ClassImp(AliGenEpos)
19
20AliGenEpos::AliGenEpos() : AliGenMC(),
21 fBmin(0),
22 fBmax(10000),
23 fPhiMin(0),
879c2333 24 fPhiMax(TMath::TwoPi()),
9ef1c2d9 25 fFilterModelOutput(kFALSE) {
26 SetMC(new TEpos());
27}
28
29AliGenEpos::AliGenEpos(Int_t npart) : AliGenMC(npart),
30 fBmin(0),
31 fBmax(10000),
32 fPhiMin(0),
879c2333 33 fPhiMax(TMath::TwoPi()),
9ef1c2d9 34 fFilterModelOutput(kFALSE) {
35 SetMC(new TEpos());
36}
37
38void AliGenEpos::Init() {
9033ee49 39 // Sets up TEpos
9ef1c2d9 40 AliGenMC::Init();
41 TEpos *epos = GetTEpos();
42 epos->SetLaproj(this->fZProjectile);
43 epos->SetMaproj(this->fAProjectile);
44 epos->SetLatarg(this->fZTarget);
45 epos->SetMatarg(this->fATarget);
46 epos->SetPhimin(this->fPhiMin);
47 epos->SetPhimax(this->fPhiMax);
48 epos->SetBminim(this->fBmin);
49 epos->SetBmaxim(this->fBmax);
50 epos->SetEcms(this->fEnergyCMS);
06c8cc00 51 epos->SetSplitting(kTRUE);
9ef1c2d9 52 GetTEpos()->Initialize();
53}
54
55void AliGenEpos::Generate() {
9033ee49 56 // Does actual generation and output conversion
e6348652 57 Float_t polar[3] = {0,0,0};
9ef1c2d9 58 Float_t origin0[3] = {0,0,0};
59 Float_t origin[3] = {0,0,0};
21391258 60 Float_t time0 = 0.;
61 Float_t time = 0.;
879c2333 62 fNprimaries = 0;
9ef1c2d9 63 Int_t nt = 0; //output parameter for PushTrack
64
65 Vertex();
66 for (int j=0; j < 3; j++) origin0[j] = fVertex[j];
21391258 67 time0 = fTime;
9ef1c2d9 68
69 // Generate one event
70
71 GetTEpos()->GenerateEvent();
72 AliWarning("Generated");
73 GetTEpos()->ImportParticles(&fParticles);
74
75 Int_t np = fParticles.GetEntriesFast();
76 AliWarning(Form("Imported %d particles", np));
77
78 Int_t *idsOnStack = NULL;
79 idsOnStack = new Int_t[np];
e6348652 80 for (int i = 0; i < np; i++) idsOnStack[i] = 0;
9ef1c2d9 81 TParticle *iparticle;
82
83 for (int i = 0; i < np; i++) {
84 iparticle = (TParticle *) fParticles.At(i);
85 //Bool_t isNullEntry = iparticle->GetStatusCode() == 0;
86 //Bool_t isCommentOrUnknown = iparticle->GetStatusCode() > 2;
879c2333 87 Bool_t hasDecayed = iparticle->GetStatusCode() >= 2;
9ef1c2d9 88 Bool_t isFinalState = iparticle->GetStatusCode() == 1;
89 Int_t imo = iparticle->GetFirstMother();
90 Bool_t hasMother = (imo >=0);
91
92
93 if (isFinalState) {
94 origin[0] = iparticle->Vx();
95 origin[1] = iparticle->Vy();
96 origin[2] = iparticle->Vz();
21391258 97 time = iparticle->T();
9ef1c2d9 98 //doubled track with freeze out coordinates for femtoscopy
99 PushTrack(0,
100 imo>=0?idsOnStack[imo]:-1,
101 iparticle->GetPdgCode(),
102 iparticle->Px(),iparticle->Py(),iparticle->Pz(),iparticle->Energy(),
103 origin[0], origin[1], origin[2],
21391258 104 time,
9ef1c2d9 105 polar[0],polar[1],polar[2],
106 hasMother ? kPDecay:kPNoProcess,nt);
107
108 idsOnStack[i] = nt;
109 fNprimaries++;
110 KeepTrack(nt);
111
112 //real track with smeared vertex
113 origin[0] += origin0[0];
114 origin[1] += origin0[1];
115 origin[2] += origin0[2];
21391258 116 time += time0;
9ef1c2d9 117 PushTrack(1,
118 nt, //doubled track as mother
119 iparticle->GetPdgCode(),
120 iparticle->Px(),iparticle->Py(),iparticle->Pz(),iparticle->Energy(),
121 origin[0], origin[1], origin[2],
21391258 122 time,
9ef1c2d9 123 polar[0],polar[1],polar[2],
124 kPDecay,nt);
125 fNprimaries++;
126 KeepTrack(nt);
127 } else if(hasDecayed || !fFilterModelOutput) {
128 // don't track it and don't smear vertex
129 origin[0] = iparticle->Vx();
130 origin[1] = iparticle->Vy();
131 origin[2] = iparticle->Vz();
21391258 132 time = iparticle->T();
9ef1c2d9 133 PushTrack(0,
134 imo>=0?idsOnStack[imo]:-1,
135 iparticle->GetPdgCode(),
136 iparticle->Px(),iparticle->Py(),iparticle->Pz(),iparticle->Energy(),
137 origin[0], origin[1], origin[2],
21391258 138 time,
9ef1c2d9 139 polar[0],polar[1],polar[2],
140 hasMother ? kPDecay:kPNoProcess,nt);
141 idsOnStack[i] = nt;
142 fNprimaries++;
143 KeepTrack(nt);
144 } else if(fFilterModelOutput) {
145 //filtered internal model objects
146 idsOnStack[i] = -1; // to erase mother field in its dauthers
147 }
148 }
149 SetHighWaterMark(fNprimaries);
150 TArrayF eventVertex;
151 eventVertex.Set(3);
152 eventVertex[0] = origin0[0];
153 eventVertex[1] = origin0[1];
154 eventVertex[2] = origin0[2];
155 // Builds the event header, to be called after each event
156 AliGenEposEventHeader* header = new AliGenEposEventHeader("EPOS");
157
158 header->SetNProduced(fNprimaries);
159 header->SetPrimaryVertex(eventVertex);
21391258 160 header->SetInteractionTime(time0);
9ef1c2d9 161
162 header->SetImpactParameter(GetTEpos()->GetBimevt());
163 header->SetReactionPlaneAngle(GetTEpos()->GetPhievt());
164
165 header->SetHardScatters(0);
166 header->SetParticipants(GetTEpos()->GetNpjevt(), GetTEpos()->GetNtgevt());
167 header->SetCollisions(GetTEpos()->GetKolevt(), 0, 0, GetTEpos()->GetNpjevt());
168 header->SetSpectators(GetTEpos()->GetJpnevt(), GetTEpos()->GetJppevt(), GetTEpos()->GetJtnevt(), GetTEpos()->GetJtpevt());
169
170 // Event Vertex
171 header->SetPrimaryVertex(fVertex);
33652044 172
173 header->SetBimevt(GetTEpos()->GetBimevt());
174 header->SetPhievt(GetTEpos()->GetPhievt());
175 header->SetKolevt(GetTEpos()->GetKolevt());
176 header->SetKoievt(GetTEpos()->GetKoievt());
177 header->SetPmxevt(GetTEpos()->GetPmxevt());
178 header->SetEgyevt(GetTEpos()->GetEgyevt());
179 header->SetNpjevt(GetTEpos()->GetNpjevt());
180 header->SetNtgevt(GetTEpos()->GetNtgevt());
181 header->SetNpnevt(GetTEpos()->GetNpnevt());
182 header->SetNppevt(GetTEpos()->GetNppevt());
183 header->SetNtnevt(GetTEpos()->GetNtnevt());
184 header->SetNtpevt(GetTEpos()->GetNtpevt());
185 header->SetJpnevt(GetTEpos()->GetJpnevt());
186 header->SetJppevt(GetTEpos()->GetJppevt());
187 header->SetJtnevt(GetTEpos()->GetJtnevt());
188 header->SetJtpevt(GetTEpos()->GetJtpevt());
189 header->SetXbjevt(GetTEpos()->GetXbjevt());
190 header->SetQsqevt(GetTEpos()->GetQsqevt());
191 header->SetNglevt(GetTEpos()->GetNglevt());
192 header->SetZppevt(GetTEpos()->GetZppevt());
193 header->SetZptevt(GetTEpos()->GetZptevt());
194 AddHeader(header);
195 fCollisionGeometry = (AliGenEposEventHeader*) header;
196
197 delete[] idsOnStack;
9ef1c2d9 198}
199
200AliGenEpos::~AliGenEpos() {
201}
202