StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFlowReCentMaker.cxx
1 //
3 // $Id: StFlowReCentMaker.cxx,v 1.1 2009/11/24 19:29:15 posk Exp $
4 //
5 // Authors: Art Poskanzer, Sep 2009
6 //
8 //
9 // Description: Maker to produce ReCent files for each harmonic
10 // using StFlowEvent
11 //
13 
14 #include <Stiostream.h>
15 #include <stdlib.h>
16 #include <math.h>
17 #include "StMaker.h"
18 #include "StFlowReCentMaker.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"
24 #include "TFile.h"
25 #include "TString.h"
26 #include "TProfile.h"
27 #include "TOrdCollection.h"
28 #include "StMessMgr.h"
29 #define PR(x) cout << "##### FlowReCent: " << (#x) << " = " << (x) << endl;
30 
31 ClassImp(StFlowReCentMaker)
32 
33 //-----------------------------------------------------------------------
34 
35 StFlowReCentMaker::StFlowReCentMaker(const Char_t* name): StMaker(name),
36  MakerName(name) {
37  pFlowSelect = new StFlowSelection();
38 }
39 
40 //-----------------------------------------------------------------------
41 
42 StFlowReCentMaker::~StFlowReCentMaker() {
43 }
44 
45 //-----------------------------------------------------------------------
46 
48  // Make histograms
49 
50  // Get a pointer to StFlowEvent
51  StFlowMaker* pFlowMaker = NULL;
52  pFlowMaker = (StFlowMaker*)GetMaker("Flow");
53  if (pFlowMaker) pFlowEvent = pFlowMaker->FlowEventPointer();
54  if (pFlowEvent && pFlowSelect->Select(pFlowEvent)) { // event selected
55  FillEventHistograms(); // fill particle histograms
56  } else {
57  gMessMgr->Info("##### FlowReCent: FlowEvent pointer null");
58  return kStOK;
59  }
60  if (Debug()) StMaker::PrintInfo();
61 
62  return kStOK;
63 }
64 
65 //-----------------------------------------------------------------------
66 
67 Int_t StFlowReCentMaker::Init() {
68 
69  // Create the files
70  TString* fileName;
71  for (int n = 1; n < nCens; n++) {
72  fileName = new TString("flowReCent");
73  *fileName += n;
74  fileName->Append(".root");
75  reCentFile[n] = new TFile(fileName->Data(), "RECREATE");
76  delete fileName;
77  }
78 
79  // Book histograms
80  TString* histTitle;
81 
82  // for each centrality
83  for (int n = 1; n < nCens; n++) {
84  reCentFile[n]->cd(); // each file is a directory
85 
86  // for each selection
87  for (int k = 0; k < Flow::nSels; k++) {
88 
89  // for each harmonic
90  for (int j = 0; j < Flow::nHars; j++) {
91 
92  // Recenter, for exporting
93  histTitle = new TString("FlowReCentX_Sel");
94  *histTitle += k+1;
95  *histTitle += "_Har";
96  *histTitle += j+1;
97  hist[k].histCen[n].histHar[j].mHistReCentX = new TProfile(histTitle->Data(),
98  histTitle->Data(), 3, 0.5, 3.5);
99  hist[k].histCen[n].histHar[j].mHistReCentX->SetXTitle("FTPCE, FTPCW, TPCE, TPCW");
100  hist[k].histCen[n].histHar[j].mHistReCentX->SetYTitle("<cos n #phi>");
101  delete histTitle;
102 
103  histTitle = new TString("FlowReCentY_Sel");
104  *histTitle += k+1;
105  *histTitle += "_Har";
106  *histTitle += j+1;
107  hist[k].histCen[n].histHar[j].mHistReCentY = new TProfile(histTitle->Data(),
108  histTitle->Data(), 3, 0.5, 3.5);
109  hist[k].histCen[n].histHar[j].mHistReCentY->SetXTitle("FTPCE, FTPCW, TPCE, TPCW");
110  hist[k].histCen[n].histHar[j].mHistReCentY->SetYTitle("<sin n #phi>");
111  delete histTitle;
112 
113  }
114  }
115  }
116 
117  gMessMgr->SetLimit("##### FlowReCent", 2);
118  gMessMgr->Info("##### FlowReCent: $Id: StFlowReCentMaker.cxx,v 1.1 2009/11/24 19:29:15 posk Exp $");
119 
120  return StMaker::Init();
121 }
122 
123 //-----------------------------------------------------------------------
124 
125 void StFlowReCentMaker::FillEventHistograms() {
126  // Fill histograms
127 
128  // Centrality of this event
129  int n = pFlowEvent->Centrality();
130  if (!n) { return; } // skip centrality = 0
131 
132  // calculate recentering parameters, fill 4 bins
133  TVector2 qReCent;
134  for (int k = 0; k < Flow::nSels; k++) {
135  pFlowSelect->SetSelection(k);
136  for (int j = 0; j < Flow::nHars; j++) {
137  pFlowSelect->SetHarmonic(j);
138  qReCent = pFlowEvent->ReCentEPPar(pFlowSelect,"FTPCE");
139  if (qReCent.X()) hist[k].histCen[n].histHar[j].mHistReCentX->Fill(1., qReCent.X());
140  if (qReCent.Y()) hist[k].histCen[n].histHar[j].mHistReCentY->Fill(1., qReCent.Y());
141  qReCent = pFlowEvent->ReCentEPPar(pFlowSelect,"FTPCW");
142  if (qReCent.X()) hist[k].histCen[n].histHar[j].mHistReCentX->Fill(2., qReCent.X());
143  if (qReCent.Y()) hist[k].histCen[n].histHar[j].mHistReCentY->Fill(2., qReCent.Y());
144  qReCent = pFlowEvent->ReCentEPPar(pFlowSelect,"TPCE");
145  if (qReCent.X()) hist[k].histCen[n].histHar[j].mHistReCentX->Fill(3., qReCent.X());
146  if (qReCent.Y()) hist[k].histCen[n].histHar[j].mHistReCentY->Fill(3., qReCent.Y());
147  qReCent = pFlowEvent->ReCentEPPar(pFlowSelect,"TPCW");
148  if (qReCent.X()) hist[k].histCen[n].histHar[j].mHistReCentX->Fill(4., qReCent.X());
149  if (qReCent.Y()) hist[k].histCen[n].histHar[j].mHistReCentY->Fill(4., qReCent.Y());
150  }
151  }
152 }
153 
154 //-----------------------------------------------------------------------
155 
157  // Outputs reCent values
158 
159  // ReCent histogram collections
160  TOrdCollection* reCentHistNames[nCens];
161  for (int n = 1; n < nCens; n++) {
162  reCentHistNames[n] = new TOrdCollection(Flow::nSels * Flow::nHars * 2);
163  }
164 
165  cout << endl << "##### ReCent Maker:" << endl;
166 
167  // Write out the recentering parameters
168  for (int n = 1; n < nCens; n++) {
169  for (int k = 0; k < Flow::nSels; k++) {
170  for (int j = 0; j < Flow::nHars; j++) {
171  reCentHistNames[n]->AddLast(hist[k].histCen[n].histHar[j].mHistReCentX);
172  reCentHistNames[n]->AddLast(hist[k].histCen[n].histHar[j].mHistReCentY);
173  }
174  }
175  }
176 
177  GetHistList()->ls();
178 
179  // Write ReCent histograms
180  for (int n = 1; n < nCens; n++) {
181  reCentFile[n]->cd();
182  reCentHistNames[n]->Write();
183  reCentFile[n]->Close();
184  delete reCentHistNames[n];
185  }
186 
187  delete pFlowSelect;
188 
189  return StMaker::Finish();
190 }
191 
192 //-----------------------------------------------------------------------
193 
195 //
196 // $Log: StFlowReCentMaker.cxx,v $
197 // Revision 1.1 2009/11/24 19:29:15 posk
198 // Added reCenter to remove acceptance correlations as an option instead of phiWgt.
199 //
200 //
201 //
Definition: Stypes.h:40
virtual Int_t Finish()
Definition: StMaker.cxx:776