18 #include "StFlowPhiWgtMaker.h"
19 #include "StFlowMaker/StFlowMaker.h"
20 #include "StFlowMaker/StFlowEvent.h"
21 #include "StFlowMaker/StFlowConstants.h"
22 #include "StFlowMaker/StFlowSelection.h"
23 #include "PhysicalConstants.h"
27 #include "TOrdCollection.h"
28 #include "StMessMgr.h"
30 #define PR(x) cout << "##### FlowPhiWgt: " << (#x) << " = " << (x) << endl;
43 StFlowPhiWgtMaker::~StFlowPhiWgtMaker() {
54 if (pFlowMaker) pFlowEvent = pFlowMaker->FlowEventPointer();
55 if (pFlowEvent && pFlowSelect->Select(pFlowEvent)) {
56 FillParticleHistograms();
58 gMessMgr->Info(
"##### FlowPhiWgt: FlowEvent pointer null");
61 if (Debug()) StMaker::PrintInfo();
68 Int_t StFlowPhiWgtMaker::Init() {
72 for (
int n = 1; n < nCens; n++) {
73 fileName =
new TString(
"flowPhiWgt");
75 fileName->Append(
".root");
76 phiWgtFile[n] =
new TFile(fileName->Data(),
"RECREATE");
81 const float phiMin = 0.;
82 const float phiMax = twopi;
86 mHistZDCSMDPsiWgtEast =
new TH1F(
"Flow_ZDCSMDPsiWgtEast",
"Flow_ZDCSMDPsiWgtEast",
87 Flow::zdcsmd_nPsiBins,-twopi/2.,twopi/2.);
88 mHistZDCSMDPsiWgtWest =
new TH1F(
"Flow_ZDCSMDPsiWgtWest",
"Flow_ZDCSMDPsiWgtWest",
89 Flow::zdcsmd_nPsiBins,-twopi/2.,twopi/2.);
92 for (
int n = 1; n < nCens; n++) {
96 for (
int k = 0; k < Flow::nSels; k++) {
99 for (
int j = 0; j < 2; j++) {
103 histTitle =
new TString(
"Flow_Phi_FarEast_Sel");
105 histTitle->Append(
"_Har");
107 hist[k].histCen[n].histHar[j].mHistPhiFarEast =
108 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBins, phiMin, phiMax);
109 hist[k].histCen[n].histHar[j].mHistPhiFarEast->SetXTitle
110 (
"Azimuthal Angles (rad)");
111 hist[k].histCen[n].histHar[j].mHistPhiFarEast->SetYTitle(
"Counts");
115 histTitle =
new TString(
"Flow_Phi_East_Sel");
117 histTitle->Append(
"_Har");
119 hist[k].histCen[n].histHar[j].mHistPhiEast =
120 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBins, phiMin, phiMax);
121 hist[k].histCen[n].histHar[j].mHistPhiEast->SetXTitle
122 (
"Azimuthal Angles (rad)");
123 hist[k].histCen[n].histHar[j].mHistPhiEast->SetYTitle(
"Counts");
127 histTitle =
new TString(
"Flow_Phi_West_Sel");
129 histTitle->Append(
"_Har");
131 hist[k].histCen[n].histHar[j].mHistPhiWest =
132 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBins, phiMin, phiMax);
133 hist[k].histCen[n].histHar[j].mHistPhiWest->SetXTitle
134 (
"Azimuthal Angles (rad)");
135 hist[k].histCen[n].histHar[j].mHistPhiWest->SetYTitle(
"Counts");
139 histTitle =
new TString(
"Flow_Phi_FarWest_Sel");
141 histTitle->Append(
"_Har");
143 hist[k].histCen[n].histHar[j].mHistPhiFarWest =
144 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBins, phiMin, phiMax);
145 hist[k].histCen[n].histHar[j].mHistPhiFarWest->SetXTitle
146 (
"Azimuthal Angles (rad)");
147 hist[k].histCen[n].histHar[j].mHistPhiFarWest->SetYTitle(
"Counts");
151 histTitle =
new TString(
"Flow_Phi_FtpcFarEast_Sel");
153 histTitle->Append(
"_Har");
155 hist[k].histCen[n].histHar[j].mHistPhiFtpcFarEast =
156 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBinsFtpc, phiMin, phiMax);
157 hist[k].histCen[n].histHar[j].mHistPhiFtpcFarEast->SetXTitle
158 (
"Azimuthal Angles (rad)");
159 hist[k].histCen[n].histHar[j].mHistPhiFtpcFarEast->SetYTitle(
"Counts");
163 histTitle =
new TString(
"Flow_Phi_FtpcEast_Sel");
165 histTitle->Append(
"_Har");
167 hist[k].histCen[n].histHar[j].mHistPhiFtpcEast =
168 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBinsFtpc, phiMin, phiMax);
169 hist[k].histCen[n].histHar[j].mHistPhiFtpcEast->SetXTitle
170 (
"Azimuthal Angles (rad)");
171 hist[k].histCen[n].histHar[j].mHistPhiFtpcEast->SetYTitle(
"Counts");
175 histTitle =
new TString(
"Flow_Phi_FtpcWest_Sel");
177 histTitle->Append(
"_Har");
179 hist[k].histCen[n].histHar[j].mHistPhiFtpcWest =
180 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBinsFtpc, phiMin, phiMax);
181 hist[k].histCen[n].histHar[j].mHistPhiFtpcWest->SetXTitle
182 (
"Azimuthal Angles (rad)");
183 hist[k].histCen[n].histHar[j].mHistPhiFtpcWest->SetYTitle(
"Counts");
187 histTitle =
new TString(
"Flow_Phi_FtpcFarWest_Sel");
189 histTitle->Append(
"_Har");
191 hist[k].histCen[n].histHar[j].mHistPhiFtpcFarWest =
192 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBinsFtpc, phiMin, phiMax);
193 hist[k].histCen[n].histHar[j].mHistPhiFtpcFarWest->SetXTitle
194 (
"Azimuthal Angles (rad)");
195 hist[k].histCen[n].histHar[j].mHistPhiFtpcFarWest->SetYTitle(
"Counts");
201 histTitle =
new TString(
"Flow_Phi_Weight_FarEast_Sel");
203 histTitle->Append(
"_Har");
205 hist[k].histCen[n].histHar[j].mHistPhiWgtFarEast =
206 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBins, phiMin, phiMax);
207 hist[k].histCen[n].histHar[j].mHistPhiWgtFarEast->Sumw2();
208 hist[k].histCen[n].histHar[j].mHistPhiWgtFarEast->SetXTitle
209 (
"Azimuthal Angles (rad)");
210 hist[k].histCen[n].histHar[j].mHistPhiWgtFarEast->SetYTitle(
"PhiWgt");
214 histTitle =
new TString(
"Flow_Phi_Weight_East_Sel");
216 histTitle->Append(
"_Har");
218 hist[k].histCen[n].histHar[j].mHistPhiWgtEast =
219 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBins, phiMin, phiMax);
220 hist[k].histCen[n].histHar[j].mHistPhiWgtEast->Sumw2();
221 hist[k].histCen[n].histHar[j].mHistPhiWgtEast->SetXTitle
222 (
"Azimuthal Angles (rad)");
223 hist[k].histCen[n].histHar[j].mHistPhiWgtEast->SetYTitle(
"PhiWgt");
227 histTitle =
new TString(
"Flow_Phi_Weight_West_Sel");
229 histTitle->Append(
"_Har");
231 hist[k].histCen[n].histHar[j].mHistPhiWgtWest =
232 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBins, phiMin, phiMax);
233 hist[k].histCen[n].histHar[j].mHistPhiWgtWest->Sumw2();
234 hist[k].histCen[n].histHar[j].mHistPhiWgtWest->SetXTitle
235 (
"Azimuthal Angles (rad)");
236 hist[k].histCen[n].histHar[j].mHistPhiWgtWest->SetYTitle(
"PhiWgt");
240 histTitle =
new TString(
"Flow_Phi_Weight_FarWest_Sel");
242 histTitle->Append(
"_Har");
244 hist[k].histCen[n].histHar[j].mHistPhiWgtFarWest =
245 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBins, phiMin, phiMax);
246 hist[k].histCen[n].histHar[j].mHistPhiWgtFarWest->Sumw2();
247 hist[k].histCen[n].histHar[j].mHistPhiWgtFarWest->SetXTitle
248 (
"Azimuthal Angles (rad)");
249 hist[k].histCen[n].histHar[j].mHistPhiWgtFarWest->SetYTitle(
"PhiWgt");
253 histTitle =
new TString(
"Flow_Phi_Weight_FtpcFarEast_Sel");
255 histTitle->Append(
"_Har");
257 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarEast =
258 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBinsFtpc, phiMin, phiMax);
259 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarEast->Sumw2();
260 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarEast->SetXTitle
261 (
"Azimuthal Angles (rad)");
262 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarEast->SetYTitle(
"PhiWgt");
266 histTitle =
new TString(
"Flow_Phi_Weight_FtpcEast_Sel");
268 histTitle->Append(
"_Har");
270 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcEast =
271 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBinsFtpc, phiMin, phiMax);
272 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcEast->Sumw2();
273 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcEast->SetXTitle
274 (
"Azimuthal Angles (rad)");
275 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcEast->SetYTitle(
"PhiWgt");
279 histTitle =
new TString(
"Flow_Phi_Weight_FtpcWest_Sel");
281 histTitle->Append(
"_Har");
283 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcWest =
284 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBinsFtpc, phiMin, phiMax);
285 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcWest->Sumw2();
286 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcWest->SetXTitle
287 (
"Azimuthal Angles (rad)");
288 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcWest->SetYTitle(
"PhiWgt");
292 histTitle =
new TString(
"Flow_Phi_Weight_FtpcFarWest_Sel");
294 histTitle->Append(
"_Har");
296 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarWest =
297 new TH1D(histTitle->Data(), histTitle->Data(), Flow::nPhiBinsFtpc, phiMin, phiMax);
298 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarWest->Sumw2();
299 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarWest->SetXTitle
300 (
"Azimuthal Angles (rad)");
301 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarWest->SetYTitle(
"PhiWgt");
308 gMessMgr->SetLimit(
"##### FlowPhiWgt", 2);
309 gMessMgr->Info(
"##### FlowPhiWgt: $Id: StFlowPhiWgtMaker.cxx,v 1.7 2004/12/09 23:47:09 posk Exp $");
311 return StMaker::Init();
316 void StFlowPhiWgtMaker::FillParticleHistograms() {
319 mHistZDCSMDPsiWgtEast->Fill(pFlowEvent->ZDCSMD_PsiEst());
320 mHistZDCSMDPsiWgtWest->Fill(pFlowEvent->ZDCSMD_PsiWst());
325 int iCen = pFlowEvent->Centrality();
326 if (!iCen) {
return; }
327 Float_t vertexZ = pFlowEvent->VertexPos().z();
330 StFlowTrackCollection* pFlowTracks = pFlowEvent->TrackCollection();
331 StFlowTrackIterator itr;
333 for (itr = pFlowTracks->begin(); itr != pFlowTracks->end(); itr++) {
336 float phi = pFlowTrack->Phi();
337 if (phi < 0.) phi += twopi;
338 float eta = pFlowTrack->Eta();
339 float pt = pFlowTrack->Pt();
340 float zFirstPoint = 0.;
341 float zLastPoint = 0.;
342 if (pFlowEvent->FirstLastPoints()) {
343 zFirstPoint = pFlowTrack->ZFirstPoint();
344 zLastPoint = pFlowTrack->ZLastPoint();
348 for (
int k = 0; k < Flow::nSels; k++) {
349 pFlowSelect->SetSelection(k);
350 for (
int j = 0; j < 2; j++) {
351 bool oddHar = (j+1) % 2;
352 pFlowSelect->SetHarmonic(j);
353 if (pFlowSelect->Select(pFlowTrack)) {
356 Bool_t kTpcFarEast = kFALSE;
357 Bool_t kTpcEast = kFALSE;
358 Bool_t kTpcWest = kFALSE;
359 Bool_t kTpcFarWest = kFALSE;
360 Bool_t kFtpcFarEast = kFALSE;
361 Bool_t kFtpcEast = kFALSE;
362 Bool_t kFtpcWest = kFALSE;
363 Bool_t kFtpcFarWest = kFALSE;
364 if (map.hasHitInDetector(kTpcId) || (map.data(0) == 0 && map.data(1) == 0)) {
368 if (pFlowEvent->FirstLastPoints()) {
369 if (zFirstPoint > 0. && zLastPoint > 0.) {
371 }
else if (zFirstPoint > 0. && zLastPoint < 0.) {
373 }
else if (zFirstPoint < 0. && zLastPoint > 0.) {
379 if (eta > 0. && vertexZ > 0.) {
381 }
else if (eta > 0. && vertexZ < 0.) {
383 }
else if (eta < 0. && vertexZ > 0.) {
389 }
else if (map.trackFtpcEast()) {
394 kFtpcFarEast = kTRUE;
396 }
else if (map.trackFtpcWest()) {
399 kFtpcFarWest = kTRUE;
409 if (pFlowEvent->PtWgt()) {
410 wt *= (pt < pFlowEvent->PtWgtSaturation()) ? pt : pFlowEvent->PtWgtSaturation();
412 float etaAbs = fabs(eta);
413 if (pFlowEvent->EtaWgt() && oddHar && etaAbs > 1.) { wt *= etaAbs; }
417 hist[k].histCen[iCen].histHar[j].mHistPhiFtpcFarEast->Fill(phi,wt);
418 }
else if (kFtpcEast) {
419 hist[k].histCen[iCen].histHar[j].mHistPhiFtpcEast->Fill(phi,wt);
420 }
else if (kFtpcWest) {
421 hist[k].histCen[iCen].histHar[j].mHistPhiFtpcWest->Fill(phi,wt);
422 }
else if (kFtpcFarWest) {
423 hist[k].histCen[iCen].histHar[j].mHistPhiFtpcFarWest->Fill(phi,wt);
424 }
else if (kTpcFarEast){
425 hist[k].histCen[iCen].histHar[j].mHistPhiFarEast->Fill(phi,wt);
426 }
else if (kTpcEast){
427 hist[k].histCen[iCen].histHar[j].mHistPhiEast->Fill(phi,wt);
428 }
else if (kTpcWest){
429 hist[k].histCen[iCen].histHar[j].mHistPhiWest->Fill(phi,wt);
430 }
else if (kTpcFarWest){
431 hist[k].histCen[iCen].histHar[j].mHistPhiFarWest->Fill(phi,wt);
447 TOrdCollection* phiWgtHistNames[nCens];
448 for (
int n = 1; n < nCens; n++) {
449 phiWgtHistNames[n] =
new TOrdCollection(Flow::nSels*2 + 2);
452 cout << endl <<
"##### PhiWgt Maker:" << endl;
454 for (
int n = 1; n < nCens; n++) {
455 for (
int k = 0; k < Flow::nSels; k++) {
456 for (
int j = 0; j < 2; j++) {
458 double meanFarEast = hist[k].histCen[n].histHar[j].mHistPhiFarEast->
459 Integral() / (double)Flow::nPhiBins;
460 double meanEast = hist[k].histCen[n].histHar[j].mHistPhiEast->
461 Integral() / (double)Flow::nPhiBins;
462 double meanWest = hist[k].histCen[n].histHar[j].mHistPhiWest->
463 Integral() / (double)Flow::nPhiBins;
464 double meanFarWest = hist[k].histCen[n].histHar[j].mHistPhiFarWest->
465 Integral() / (double)Flow::nPhiBins;
466 double meanFtpcFarEast = hist[k].histCen[n].histHar[j].mHistPhiFtpcFarEast->
467 Integral() / (double)Flow::nPhiBinsFtpc;
468 double meanFtpcEast = hist[k].histCen[n].histHar[j].mHistPhiFtpcEast->
469 Integral() / (double)Flow::nPhiBinsFtpc;
470 double meanFtpcWest = hist[k].histCen[n].histHar[j].mHistPhiFtpcWest->
471 Integral() / (double)Flow::nPhiBinsFtpc;
472 double meanFtpcFarWest = hist[k].histCen[n].histHar[j].mHistPhiFtpcFarWest->
473 Integral() / (double)Flow::nPhiBinsFtpc;
476 for (
int i = 0; i < Flow::nPhiBins; i++) {
477 hist[k].histCen[n].histHar[j].mHistPhiWgtFarEast->
478 SetBinContent(i+1,meanFarEast);
479 hist[k].histCen[n].histHar[j].mHistPhiWgtFarEast->
480 SetBinError(i+1, 0.);
481 hist[k].histCen[n].histHar[j].mHistPhiWgtEast->
482 SetBinContent(i+1, meanEast);
483 hist[k].histCen[n].histHar[j].mHistPhiWgtEast->
484 SetBinError(i+1, 0.);
485 hist[k].histCen[n].histHar[j].mHistPhiWgtWest->
486 SetBinContent(i+1, meanWest);
487 hist[k].histCen[n].histHar[j].mHistPhiWgtWest->
488 SetBinError(i+1, 0.);
489 hist[k].histCen[n].histHar[j].mHistPhiWgtFarWest->
490 SetBinContent(i+1,meanFarWest);
491 hist[k].histCen[n].histHar[j].mHistPhiWgtFarWest->
492 SetBinError(i+1, 0.);
496 for (
int i = 0; i < Flow::nPhiBinsFtpc; i++) {
497 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarEast->
498 SetBinContent(i+1, meanFtpcFarEast);
499 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarEast->
500 SetBinError(i+1, 0.);
501 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcEast->
502 SetBinContent(i+1, meanFtpcEast);
503 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcEast->
504 SetBinError(i+1, 0.);
505 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcWest->
506 SetBinContent(i+1, meanFtpcWest);
507 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcWest->
508 SetBinError(i+1, 0.);
509 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarWest->
510 SetBinContent(i+1, meanFtpcFarWest);
511 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarWest->
512 SetBinError(i+1, 0.);
516 hist[k].histCen[n].histHar[j].mHistPhiWgtFarEast->
517 Divide(hist[k].histCen[n].histHar[j].mHistPhiFarEast);
518 phiWgtHistNames[n]->AddLast(hist[k].histCen[n].histHar[j].mHistPhiWgtFarEast);
519 hist[k].histCen[n].histHar[j].mHistPhiWgtEast->
520 Divide(hist[k].histCen[n].histHar[j].mHistPhiEast);
521 phiWgtHistNames[n]->AddLast(hist[k].histCen[n].histHar[j].mHistPhiWgtEast);
522 hist[k].histCen[n].histHar[j].mHistPhiWgtWest->
523 Divide(hist[k].histCen[n].histHar[j].mHistPhiWest);
524 phiWgtHistNames[n]->AddLast(hist[k].histCen[n].histHar[j].mHistPhiWgtWest);
525 hist[k].histCen[n].histHar[j].mHistPhiWgtFarWest->
526 Divide(hist[k].histCen[n].histHar[j].mHistPhiFarWest);
527 phiWgtHistNames[n]->AddLast(hist[k].histCen[n].histHar[j].mHistPhiWgtFarWest);
530 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarEast->
531 Divide(hist[k].histCen[n].histHar[j].mHistPhiFtpcFarEast);
532 phiWgtHistNames[n]->AddLast(hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarEast);
533 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcEast->
534 Divide(hist[k].histCen[n].histHar[j].mHistPhiFtpcEast);
535 phiWgtHistNames[n]->AddLast(hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcEast);
536 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcWest->
537 Divide(hist[k].histCen[n].histHar[j].mHistPhiFtpcWest);
538 phiWgtHistNames[n]->AddLast(hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcWest);
539 hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarWest->
540 Divide(hist[k].histCen[n].histHar[j].mHistPhiFtpcFarWest);
541 phiWgtHistNames[n]->AddLast(hist[k].histCen[n].histHar[j].mHistPhiWgtFtpcFarWest);
544 phiWgtHistNames[n]->AddLast(mHistZDCSMDPsiWgtEast);
545 phiWgtHistNames[n]->AddLast(mHistZDCSMDPsiWgtWest);
551 if (pFlowEvent->FirstLastPoints()) {
553 sprintf(chInfo,
"%s%d%s%d%s",
" pt weight= ", pFlowEvent->PtWgt(),
554 ", eta weight= ", pFlowEvent->EtaWgt(),
"\n");
555 textInfo =
new TText(0,0,chInfo);
559 for (
int n = 1; n < nCens; n++) {
561 if (pFlowEvent->FirstLastPoints()) { textInfo->Write(
"info"); }
562 phiWgtHistNames[n]->Write();
563 phiWgtFile[n]->Close();
564 delete phiWgtHistNames[n];
567 if (pFlowEvent->FirstLastPoints())
delete textInfo;