12 #include "StEStructFlat.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/StEStructCentrality.h"
20 StEStructFlat::StEStructFlat() {
40 mEventsToDo = eventsToDo;
47 bool StEStructFlat::hasGenerator() {
return true; };
50 void StEStructFlat::setSeed(
int iseed) {
51 cout <<
" Calling srand48(" << iseed <<
")" << endl;
57 if(mEventCount==mEventsToDo){
68 float z = mFlatEvent->Vz();
69 int nTracks = countGoodTracks();
70 mFlatEvent->SetCentrality( (
double) nTracks );
72 int jCent = cent->centrality( mFlatEvent->Centrality() );
73 if (((mCentBin >= 0) && (jCent != mCentBin)) ||
74 !mECuts->goodPrimaryVertexZ(z) ||
75 !mECuts->goodCentrality(mFlatEvent->Centrality())) {
76 mECuts->fillHistogram(mECuts->centralityName(),(float)nTracks,
false);
77 mECuts->fillHistogram(mECuts->primaryVertexZName(),z,
false);
80 mFlatEvent->FillChargeCollections();
81 mECuts->fillHistogram(mECuts->centralityName(),(float)nTracks,
true);
82 mECuts->fillHistogram(mECuts->primaryVertexZName(),z,
true);
88 void StEStructFlat::generateEvent() {
91 mFlatEvent->SetVz(30*gRand48());
92 mFlatEvent->SetBField(0.5);
94 fillTracks(mFlatEvent);
105 int numCharge, numInEta = 850;
106 double v2 = 0.05, pi = 3.1415926;
107 double eta, quadEta = 0.2, etaMax = 2;
108 double phi, phiOff, sectorWidth;
111 sectorWidth = 360 / numSector;
112 phiOff = 360*drand48();
114 float p[3], pt, pz, v[3];
116 double etaMaxAmp = 1 + quadEta*etaMax*etaMax;
117 numCharge = int( numInEta*etaMax * (3+quadEta*etaMax*etaMax) / (3+quadEta) );
118 for(
int i=0;i<numCharge;i++) {
120 eTrack->SetInComplete();
121 if (i < numCharge/2) {
128 double etaAmp = 0, randAmp = 1;
129 while (randAmp > etaAmp) {
130 eta = etaMax*(2*drand48() - 1);
131 etaAmp = 1 + quadEta*eta*eta;
132 randAmp = drand48()*etaMaxAmp;
137 double h = (1+v2)*drand48();
138 while ( h > (1+v2*cos(2*phi*pi/180)) ) {
140 h = (1+v2)*drand48();
147 pt = 0.1 - 0.5 * log(drand48());
148 pz = sqrt( pt*pt + 0.139*0.139) * (exp(eta)-exp(-eta)) / 2;
150 p[0] = pt*cos(phi*pi/180);
151 p[1] = pt*sin(phi*pi/180);
155 v[2] = estructEvent->Vz();
159 if (maxRadius(eta,pt,v[2]) < 155.0) {
163 if (!isTrackGood(v,p,eta)) {
164 mTCuts->fillHistograms(
false);
167 mTCuts->fillHistograms(
true);
168 if (pt<0.15)
continue;
172 float *gdca = globalDCA(p,v);
173 eTrack->SetBx(gdca[0]);
174 eTrack->SetBy(gdca[1]);
175 eTrack->SetBz(gdca[2]);
176 eTrack->SetBxPrimary(gdca[0]);
177 eTrack->SetByPrimary(gdca[1]);
178 eTrack->SetBzPrimary(gdca[2]);
179 eTrack->SetBxGlobal(gdca[0]);
180 eTrack->SetByGlobal(gdca[1]);
181 eTrack->SetBzGlobal(gdca[2]);
188 eTrack->SetPhi(phi*pi/180);
191 eTrack->SetTopologyMapData(0, 0xffffff80);
192 eTrack->SetTopologyMapData(1, 0x3fff);
193 eTrack->SetTopologyMapTPCNHits(45);
194 eTrack->SetNMaxPoints(45);
195 eTrack->SetNFoundPoints(45);
196 eTrack->SetNFitPoints(45);
199 eTrack->SetCharge(-1);
201 eTrack->SetCharge(1);
203 estructEvent->AddTrack(eTrack);
206 estructEvent->SetCentrality( (
double) mnumTracks );
215 double StEStructFlat::maxRadius(
double eta,
double pt,
double vz) {
216 double pi = 3.14159265359;
217 double lambda = pi/2 - 2*atan(exp(-eta));
220 s = (+200 - vz) / sin(lambda);
222 s = (-200 - vz) / sin(lambda);
224 double r = pt / 0.0015;
225 double phi = s * cos(lambda) / r;
227 return r * sqrt(2 - 2*cos(phi));
235 bool StEStructFlat::isTrackGood(
float *v,
float *p,
float eta) {
236 float pt = sqrt(p[0]*p[0]+p[1]*p[1]);
241 float phi = atan2((
double)p[1], (
double)p[0]);
242 float *gdca = globalDCA(p,v);
244 float yt = log(sqrt(1+_r*_r)+_r);
246 bool useTrack =
true;
247 useTrack = (mTCuts->goodGlobalDCA(gdca[3]) && useTrack);
248 useTrack = (mTCuts->goodEta(eta) && useTrack);
249 useTrack = (mTCuts->goodPhi(phi) && useTrack);
250 useTrack = (mTCuts->goodPt(pt) && useTrack);
251 useTrack = (mTCuts->goodYt(yt) && useTrack);
256 int StEStructFlat::countGoodTracks() {
260 double StEStructFlat::gRand48() {
268 x1 = 2.0 * drand48() - 1.0;
269 x2 = 2.0 * drand48() - 1.0;
270 w = x1 * x1 + x2 * x2;
271 }
while ( w >= 1.0 );
273 w = sqrt( (-2.0 * log( w ) ) / w );