12 #include "StEStructPythia.h"
14 #include "StEStructPool/AnalysisMaker/StEStructEventCuts.h"
15 #include "StEStructPool/AnalysisMaker/StEStructTrackCuts.h"
16 #include "StEStructPool/EventMaker/StEStructEvent.h"
17 #include "StEStructPool/EventMaker/StEStructTrack.h"
18 #include "StEStructPool/EventMaker/StEStructTrack.h"
19 #include "StEStructPool/EventMaker/StEStructCentrality.h"
21 StEStructPythia::StEStructPythia() {
26 museAllTracks =
false;
32 StEStructPythia::StEStructPythia(TPythia6* pythia,
41 museAllTracks = useAllTracks;
42 mEventsToDo = eventsToDo;
47 bool StEStructPythia::hasGenerator() {
return (mPythia) ?
true : false ; };
52 if (!mPythia || mEventCount==mEventsToDo) {
59 mPythia->GenerateEvent();
68 retVal->SetBField(0.5);
71 int nTracks = countGoodTracks();
75 centMeasure = getNPartonic();
77 centMeasure = nTracks;
79 retVal->SetCentrality(centMeasure);
80 if(!mECuts->goodCentrality(centMeasure) || !mstarTrigger){
83 mECuts->fillHistogram(mECuts->centralityName(),(float)nTracks,
false);
86 retVal->FillChargeCollections();
87 mECuts->fillHistogram(mECuts->centralityName(),(float)nTracks,
true);
94 double StEStructPythia::getNPartonic(){
95 if(!mPythia)
return 0.;
96 return (
double)mPythia->GetN();
103 Pyjets_t* pstr= mPythia->GetPyjets();
104 int numParticles=mPythia->GetN();
107 for (
int i=2;i<numParticles;i++) {
109 if (pstr->K[0][i]==21)
continue;
110 int pid = pstr->K[1][i];
112 if (!(0==pstr->K[3][i]))
continue;
114 if (!isTrackGood(i)) {
115 mTCuts->fillHistograms(
false);
118 mTCuts->fillHistograms(
true);
119 eTrack->SetInComplete();
123 for(
int k=0;k<3;k++){
128 float pt = sqrt(p[0]*p[0] + p[1]*p[1]);
129 float theta = acos(p[2]/ TMath::Sqrt(pt*pt + p[2]*p[2]) );
130 float eta = -1.0*log(tan(theta/2.0));
131 float *gdca = globalDCA(p,v);
132 float phi=atan2((
double)p[1], (
double)p[0]);
134 eTrack->SetBx(gdca[0]);
135 eTrack->SetBy(gdca[1]);
136 eTrack->SetBz(gdca[2]);
137 eTrack->SetBxPrimary(gdca[0]);
138 eTrack->SetByPrimary(gdca[1]);
139 eTrack->SetBzPrimary(gdca[2]);
140 eTrack->SetBxGlobal(gdca[0]);
141 eTrack->SetByGlobal(gdca[1]);
142 eTrack->SetBzGlobal(gdca[2]);
145 eTrack->SetPIDe_dEdx(10);
146 eTrack->SetPIDpi_dEdx(10);
147 eTrack->SetPIDk_dEdx(10);
148 eTrack->SetPIDp_dEdx(10);
149 eTrack->SetPIDd_dEdx(10);
150 eTrack->SetPIDe_ToF(10);
151 eTrack->SetPIDpi_ToF(10);
152 eTrack->SetPIDk_ToF(10);
153 eTrack->SetPIDp_ToF(10);
154 eTrack->SetPIDd_ToF(10);
155 if ((pid == 7) || (pid == 8)) {
156 eTrack->SetPIDe_dEdx(0);
157 eTrack->SetPIDe_ToF(0);
158 }
else if ((pid == -211) || (pid == 211)) {
159 eTrack->SetPIDpi_dEdx(0);
160 eTrack->SetPIDpi_ToF(0);
161 }
else if ((pid == -321) || (pid == 321)) {
162 eTrack->SetPIDk_dEdx(0);
163 eTrack->SetPIDk_ToF(0);
164 }
else if ((pid == -2212) || (pid == 2212)) {
165 eTrack->SetPIDk_dEdx(0);
166 eTrack->SetPIDk_ToF(0);
167 }
else if (pid ==95) {
170 eTrack->SetPIDd_dEdx(0);
171 eTrack->SetPIDd_ToF(0);
181 eTrack->SetTopologyMapTPCNHits(45);
182 eTrack->SetNMaxPoints(45);
183 eTrack->SetNFoundPoints(45);
184 eTrack->SetNFitPoints(45);
187 eTrack->SetCharge(-1);
189 eTrack->SetCharge(1);
199 int ip[4] = {0,0,0,0};
200 ip[0] = pstr->K[2][i];
201 for (
int k=1;k<4;k++) {
206 ip[k] = pstr->K[2][ip[k-1]-1];
209 map[0]=(
unsigned int)((ip[1]<<16)+ip[0]);
210 map[1]=(
unsigned int)((ip[3]<<16)+ip[2]);
211 eTrack->SetTopologyMapData(0,map[0]);
212 eTrack->SetTopologyMapData(1,map[1]);
216 eTrack->SetTopologyMapTPCNHits(45);
218 estructEvent->AddTrack(eTrack);
230 bool StEStructPythia::isTrackGood(
int i) {
231 Pyjets_t* pstr= mPythia->GetPyjets();
232 int pid = pstr->K[1][i];
233 if (!measureable(pid)) {
238 for (
int k=0;k<3;k++) {
239 p[k] = pstr->P[k][i];
240 v[k] = pstr->V[k][i];
243 float pt = sqrt(p[0]*p[0]+p[1]*p[1]);
248 float theta = acos(p[2]/ sqrt(pt * pt + p[2] * p[2]) );
249 float eta = -1.0*log(tan(theta/2.0));
250 float phi = atan2((
double)p[1], (
double)p[0]);
251 float* gdca = globalDCA(p,v);
253 float yt = log(sqrt(1+_r*_r)+_r);
255 bool useTrack =
true;
256 useTrack = (mTCuts->goodGlobalDCA(gdca[3]) && useTrack);
257 useTrack = (mTCuts->goodEta(eta) && useTrack);
258 useTrack = (mTCuts->goodPhi(phi) && useTrack);
259 useTrack = (mTCuts->goodPt(pt) && useTrack);
260 useTrack = (mTCuts->goodYt(yt) && useTrack);
263 if(eta<-3.5 && eta>-5.0) mstarTrigger=
true;
264 if(eta>3.5 && eta<5.0) mstarTrigger=
true;
273 int StEStructPythia::countGoodTracks() {
275 int numParticles = mPythia->GetN();
276 for (
int i=2;i<numParticles;i++) {
277 if (isTrackGood(i)) {