StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEStructFluctAnal.cxx
1 
2 #include "StEStructFluctAnal.h"
3 
4 #include "TH1F.h"
5 #include "TH2F.h"
6 #include "TFile.h"
7 
8 #include "StEStructPool/EventMaker/StEStructEvent.h"
9 #include "StEStructPool/EventMaker/StEStructTrack.h"
10 #include "StEStructPool/AnalysisMaker/StEStructQAHists.h"
11 #include "StTimer.hh"
12 
13 #include <stdlib.h>
14 
15 
16 ClassImp(StEStructFluctAnal)
17 
18 //--------------------------------------------------------------------------
19 StEStructFluctAnal::StEStructFluctAnal(int mode, int etaSumMode, int phiSumMode): manalysisMode(mode) {
20  mEtaSumMode = etaSumMode;
21  mPhiSumMode = phiSumMode;
22  mCurrentEvent = 0;
23  mCentralities = 0;
24 
25  mEtaMin = -1.0;
26  mEtaMax = 1.0;
27  mPtMin = 0.0;
28  mPtMax = 99.9;
29 
30  mnTotEvents = 0;
31  mnCentEvents = 0;
32  mnTotBins = 0;
33  mnCents = 0;
34  mnPts = 0;
35  mnPtCents = 0;
36 
37 
38  mFluct = 0;
39  mPtFluct = 0;
40  mptnplus = 0;
41  mptnminus = 0;
42  mptpplus = 0;
43  mptpminus = 0;
44 
45  mAmDone = false;
46  mQAHists=NULL;
47  mlocalQAHists = false;
48  mPairCuts = new StEStructPairCuts;
49 
50  initHistograms();
51 }
52 
53 //--------------------------------------------------------------------------
54 StEStructFluctAnal::~StEStructFluctAnal() {
55  delete ms; ms = 0;
56  deleteHistograms();
57  deleteCentralityObjects();
58 }
59 
60 void StEStructFluctAnal::initStructures(StEStructCuts *tcut){
61  //(const char* cutFileName) {
62 // Want to expand range of eta cuts beyond range used in analysis so that we
63 // can add a vertex dependent offset.
64 // setEtaLimits(cutFileName);
65 // setPtLimits(cutFileName);
66  setEtaLimits(tcut);
67  setPtLimits(tcut);
68 
69  mCentralities = StEStructCentrality::Instance(); // dynamic_cast<StEStructCentrality*>(cent);
70  if (!mCentralities) {
71  printf("Invalid centrality object passed into StEStructFluctAnal::setCutFile!!!!!\n");
72  }
73  createCentralityObjects();
74  ms = new multStruct(mCentralities->numPts());
75  // mPairCuts->setCutFile(cutFileName);
76  // mPairCuts->loadCuts();
77 };
78 void StEStructFluctAnal::createCentralityObjects() {
79  deleteCentralityObjects();
80 
81  mnCents = mCentralities->numCentralities() - 1;
82  mnCentEvents = new int[mnCents];
83  for (int jC=0;jC<mnCents;jC++) {
84  mnCentEvents[jC] = 0;
85  }
86 
87  mFluct = new StEStructFluct*[mnCents];
88  char key[1024];
89  for (int jC=0;jC<mnCents;jC++) {
90  sprintf(key,"%i",jC);
91  mFluct[jC] = new StEStructFluct(key,mnTotBins,mEtaMin,mEtaMax,mPtMin,mPtMax);
92  }
93  mnPts = mCentralities->numPts() - 1;
94  mnPtCents = mCentralities->numPtCentralities() - 1;
95  mPtFluct = new StEStructFluct*[mnPtCents*mnPts];
96  for (int jC=0;jC<mnPtCents;jC++) {
97  for (int jP=0;jP<mnPts;jP++) {
98  sprintf(key,"%i_%i",jC,jP);
99  int index = jP + jC*mnPts;
100  mPtFluct[index] = new StEStructFluct(key,mnTotBins,mEtaMin,mEtaMax,mPtMin,mPtMax);
101  }
102  }
103 
104  mptnplus = new double[mnPts];
105  mptnminus = new double[mnPts];
106  mptpplus = new double[mnPts];
107  mptpminus = new double[mnPts];
108 }
109 void StEStructFluctAnal::deleteCentralityObjects() {
110  if (mFluct) {
111  for (int i=0;i<mnCents;i++) {
112  delete mFluct[i]; mFluct[i] = 0;
113  }
114  delete [] mFluct; mFluct = 0;
115  }
116  if (mPtFluct) {
117  for (int i=0;i<mnPts*mnPtCents;i++) {
118  delete [] mPtFluct[i]; mPtFluct[i] = 0;
119  }
120  delete [] mPtFluct; mPtFluct = 0;
121  }
122  if (mnCentEvents) {
123  delete [] mnCentEvents; mnCentEvents = 0;
124  }
125  if (mptnplus) {
126  delete [] mptnplus; mptnplus = 0;
127  }
128  if (mptnminus) {
129  delete [] mptnminus; mptnminus = 0;
130  }
131  if (mptpplus) {
132  delete [] mptpplus; mptpplus = 0;
133  }
134  if (mptpminus) {
135  delete [] mptpminus; mptpminus = 0;
136  }
137 }
138 
139 void StEStructFluctAnal::setEtaLimits( StEStructCuts* tcut){
140 
141  if(!tcut){
142  cout<<"Error Track Cuts Not found to get eta range "<<endl;
143  assert(tcut);
144  }
145 
146  mEtaMin=tcut->minVal("Eta");
147  mEtaMax=tcut->maxVal("Eta");
148 
149 };
150 
151 void StEStructFluctAnal::setPtLimits( StEStructCuts* tcut){
152 
153  if(!tcut){
154  cout<<"Error Track Cuts Not found to get eta range "<<endl;
155  assert(tcut);
156  }
157 
158  mPtMin=tcut->minVal("Pt");
159  mPtMax=tcut->maxVal("Pt");
160 
161 }
162 
163 //
164 //------- Analysis Function ------//
165 //
166 //--------------------------------------------------------------------------
167 bool StEStructFluctAnal::doEvent(StEStructEvent* event) {
168  if (!event) {
169  return false;
170  }
171 
172  if (1 > event->Ntrack()) {
173  delete event; event = 0;
174  return true;
175  }
176 
177  if (mCurrentEvent) {
178  delete mCurrentEvent;
179  }
180  mCurrentEvent=event;
181  fillMultStruct();
182  return true;
183 }
184 
185 //--------------------------------------------------------------------------
186 
187 // Modified 8/18/2004 djp
188 // Assume Chi2 cut done in Track cuts.
189 void StEStructFluctAnal::fillMultStruct() {
190  StEStructTrackCollection* tc;
191  StEStructTrackIterator Iter;
192  StEStructTrack* t;
193 
194  int jEta, jPhi, jPt, jCent, jPtCent, totMult = 0;
195  float totPt = 0;
196 
197  ms->NewEvent(mCurrentEvent->Vx(), mCurrentEvent->Vy(), mCurrentEvent->Vz() );
198  jCent = mCentralities->centrality( mCurrentEvent->Centrality() );
199  if ((jCent < 0) || (mnCents <= jCent)) {
200  return;
201  }
202  jPtCent = mCentralities->ptCentrality( mCurrentEvent->Centrality() );
203  double etaOff = etaOffset( mCurrentEvent->Vz() );
204 
205  tc = mCurrentEvent->TrackCollectionP();
206  for(Iter=tc->begin(); Iter!=tc->end(); ++Iter){
207  t = *Iter;
208  if ( (t->Eta() > mEtaMax+etaOff) || (mEtaMin+etaOff > t->Eta()) ) {
209  continue;
210  }
211  jEta = int(NETABINS*(t->Eta()-(mEtaMin+etaOff))/(mEtaMax-mEtaMin));
212  if ((jEta < 0) || (NETABINS <= jEta)) {
213  continue;
214  }
215  jPhi = int(NPHIBINS*(1.0 + t->Phi()/3.141592654)/2.0);
216  if ((jPhi < 0) || (NPHIBINS <= jPhi)) {
217  continue;
218  }
219  jPt = mCentralities->ptIndex( t->Pt() );
220 
221  ms->AddTrack( jPhi, jEta, jPt, +1, t->Pt() );
222  totMult++;
223  totPt += t->Pt();
224 
225 
226  StTrackTopologyMap *map = new StTrackTopologyMap(t->TopologyMapData(0),t->TopologyMapData(1));
227  int iF=1, iL=45;
228  for (int ifirst=0;ifirst<46;ifirst++) {
229  if (map->hasHitInRow(kTpcId,ifirst)) {
230  iF = ifirst;
231  break;
232  }
233  }
234  for (int ilast=45;ilast>0;ilast--) {
235  if (map->hasHitInRow(kTpcId,ilast)) {
236  iL = ilast;
237  break;
238  }
239  }
240  mFluct[jCent]->fillEtaZ( mCurrentEvent->Vz(), t->Eta(), t->NMaxPoints(),
241  t->NFoundPoints(), t->NFitPoints(), iF, iL );
242  mFluct[jCent]->fillPtHist( t->Pt(), +1 );
243  mFluct[jCent]->fillPhiHist( t->Phi(), +1 );
244  mFluct[jCent]->fillEtaHist( t->Eta(), +1 );
245  int index = jPt + jPtCent*mnPts;
246  if ((-1 < index) && (index < mnPtCents*mnPts)) {
247  mPtFluct[index]->fillEtaZ( mCurrentEvent->Vz(), t->Eta(), t->NMaxPoints(),
248  t->NFoundPoints(), t->NFitPoints(), iF, iL );
249  mPtFluct[index]->fillPtHist( t->Pt(), +1 );
250  mPtFluct[index]->fillPtHist( t->Phi(), +1 );
251  mPtFluct[index]->fillPtHist( t->Eta(), +1 );
252  }
253  delete map; map = 0;
254  }
255  tc = mCurrentEvent->TrackCollectionM();
256  for(Iter=tc->begin(); Iter!=tc->end(); ++Iter){
257  t = *Iter;
258  if ( (t->Eta() > mEtaMax+etaOff) || (mEtaMin+etaOff > t->Eta()) ) {
259  continue;
260  }
261  jEta = int(NETABINS*(t->Eta()-(mEtaMin+etaOff))/(mEtaMax-mEtaMin));
262  if ((jEta < 0) || (NETABINS <= jEta)) {
263  continue;
264  }
265  jPhi = int(NPHIBINS*(1.0 + t->Phi()/3.141592654)/2.0);
266  if ((jPhi < 0) || (NPHIBINS <= jPhi)) {
267  continue;
268  }
269  jPt = mCentralities->ptIndex( t->Pt() );
270 
271  ms->AddTrack( jPhi, jEta, jPt, -1, t->Pt() );
272  totMult++;
273  totPt += t->Pt();
274 
275  StTrackTopologyMap *map = new StTrackTopologyMap(t->TopologyMapData(0),t->TopologyMapData(1));
276  int iF=1, iL=45;
277  for (int ifirst=0;ifirst<46;ifirst++) {
278  if (map->hasHitInRow(kTpcId,ifirst)) {
279  iF = ifirst;
280  break;
281  }
282  }
283  for (int ilast=45;ilast>0;ilast--) {
284  if (map->hasHitInRow(kTpcId,ilast)) {
285  iL = ilast;
286  break;
287  }
288  }
289  mFluct[jCent]->fillEtaZ( mCurrentEvent->Vz(), t->Eta(), t->NMaxPoints(),
290  t->NFoundPoints(), t->NFitPoints(), iF, iL );
291  mFluct[jCent]->fillPtHist( t->Pt(), -1 );
292  mFluct[jCent]->fillPhiHist( t->Phi(), -1 );
293  mFluct[jCent]->fillEtaHist( t->Eta(), -1 );
294  int index = jPt + jPtCent*mnPts;
295  if ((-1 < index) && (index < mnPtCents*mnPts)) {
296  mPtFluct[index]->fillEtaZ( mCurrentEvent->Vz(), t->Eta(), t->NMaxPoints(),
297  t->NFoundPoints(), t->NFitPoints(), iF, iL );
298  mPtFluct[index]->fillPtHist( t->Pt(), -1 );
299  mPtFluct[index]->fillPtHist( t->Phi(), -1 );
300  mPtFluct[index]->fillPtHist( t->Eta(), -1 );
301  }
302  delete map;
303  }
304 
305  AddEvent();
306  hMultiplicity->Fill(totMult);
307  hMultiplicityBinned->Fill(pow((double)totMult,0.25));
308  hPt->Fill(totPt);
309  hPtBinned->Fill(pow((double)totPt,0.25));
310 }
311 void StEStructFluctAnal::AddEvent() {
312  double delEta, delPhi;
313  int jCent, jPtCent;
314 
315  mnTotEvents++;
316 
317  jCent = mCentralities->centrality( mCurrentEvent->Centrality() );
318  if ((jCent < 0) || (mnCents <= jCent)) {
319  return;
320  }
321  mnCentEvents[jCent]++;
322  jPtCent = mCentralities->ptCentrality( mCurrentEvent->Centrality() );
323 
324  // First two loops define the scale.
325  // To try getting better performance I move all variable declarations
326  // outside these loops.
327  int iPhi, jPhi, kPhi, lPhi, dPhi, iEta, jEta, kEta, lEta, dEta;
328  int jBin, jPt;
329  double NPlus, NMinus, PtPlus, PtMinus, Pt2Plus, Pt2Minus;
330  double ptNPlus, ptNMinus, ptPtPlus, ptPtMinus, ptPt2Plus, ptPt2Minus;
331  for (jPhi=0;jPhi<NPHIBINS;jPhi++) {
332  dPhi = jPhi + 1;
333  for (jEta=0;jEta<NETABINS;jEta++) {
334  dEta = jEta + 1;
335 
336  // Second two loops are over all bins at this scale
337  // Details of this are chosen by the summingMode.
338  jBin = offset[jPhi][jEta];
339  iPhi = 1;
340  while ( (kPhi=getPhiStart(iPhi,dPhi)) >= 0) {
341  iEta = 1;
342  while ( (kEta=getEtaStart(iEta,dEta)) >= 0) {
343 
344  // Next loop is over Pt binning.
345  // We keep bins that are summed over all pt in
346  // addition to bins for particular pt ranges.
347  //
348  // In case our pt binning doesn't cover entire
349  // pt cut range we accumulate `extra' in bin with jPt=mnPts.
350  NPlus = 0, NMinus = 0;
351  PtPlus = 0, PtMinus = 0;
352  Pt2Plus = 0, Pt2Minus = 0;
353  for (jPt=0;jPt<mnPts;jPt++) {
354  // Final two loops sum the small bins.
355  ptNPlus = 0, ptNMinus = 0;
356  ptPtPlus = 0, ptPtMinus = 0;
357  ptPt2Plus = 0, ptPt2Minus = 0;
358  for (lPhi=kPhi;lPhi<kPhi+dPhi;lPhi++) {
359  for (lEta=kEta;lEta<kEta+dEta;lEta++) {
360  ptNPlus += ms->mTrackBinPlus[jPt][lPhi][lEta][0];
361  ptNMinus += ms->mTrackBinMinus[jPt][lPhi][lEta][0];
362  ptPtPlus += ms->mTrackBinPlus[jPt][lPhi][lEta][1];
363  ptPtMinus += ms->mTrackBinMinus[jPt][lPhi][lEta][1];
364  ptPt2Plus += ms->mTrackBinPlus[jPt][lPhi][lEta][2];
365  ptPt2Minus += ms->mTrackBinMinus[jPt][lPhi][lEta][2];
366  }
367  }
368  int index = jPt + jPtCent*mnPts;
369  if ((-1 < index) && (index < mnPtCents*mnPts)) {
370  mPtFluct[index]->AddToBin( jBin,
371  ptNPlus, ptNMinus,
372  ptPtPlus, ptPtMinus,
373  ptPt2Plus, ptPt2Minus );
374  }
375  NPlus += ptNPlus;
376  NMinus += ptNMinus;
377  PtPlus += ptPtPlus;
378  PtMinus += ptPtMinus;
379  Pt2Plus += ptPt2Plus;
380  Pt2Minus += ptPt2Minus;
381  }
382 
383  mFluct[jCent]->AddToBin( jBin,
384  NPlus, NMinus,
385  PtPlus, PtMinus,
386  Pt2Plus, Pt2Minus );
387  jBin++;
388  iEta++;
389  }
390  iPhi++;
391  }
392  }
393  }
394 
395  // Increment occupancy histograms.
396  delEta = (mEtaMax-mEtaMin) / NETABINS;
397  delPhi = 2.0*3.1415926 / NPHIBINS;
398  double nplus = 0, nminus = 0, pplus = 0, pminus = 0;
399 
400  for (int jPt=0;jPt<mnPts;jPt++) {
401  mptnplus[jPt] = 0;
402  mptnminus[jPt] = 0;
403  mptpplus[jPt] = 0;
404  mptpminus[jPt] = 0;
405  }
406  for (int jPhi=0;jPhi<NPHIBINS;jPhi++) {
407  double dp = -3.1415926 + delPhi*(jPhi+0.5);
408  for (int jEta=0;jEta<NETABINS;jEta++) {
409  double de = mEtaMin + delEta*(jEta+0.5);
410  double nPlus = 0, nMinus = 0, pPlus = 0, pMinus = 0;
411  for (int jPt=0;jPt<=mnPts;jPt++) {
412  double np, nm, pp, pm;
413  np = ms->GetNPlus(jPhi,jEta,jPt);
414  nm = ms->GetNMinus(jPhi,jEta,jPt);
415  pp = ms->GetPtPlus(jPhi,jEta,jPt);
416  pm = ms->GetPtMinus(jPhi,jEta,jPt);
417  if (jPt<mnPts) {
418  if (jPtCent >= 0) {
419  int index = jPt + jPtCent*mnPts;
420  mPtFluct[index]->fillOccupancies( dp, de, np, nm, pp, pm );
421 
422  mptnplus[jPt] += np;
423  mptnminus[jPt] += nm;
424  mptpplus[jPt] += pp;
425  mptpminus[jPt] += pm;
426  }
427  }
428  nPlus += np;
429  nMinus += nm;
430  pPlus += pp;
431  pMinus += pm;
432  }
433  mFluct[jCent]->fillOccupancies( dp, de, nPlus, nMinus, pPlus, pMinus );
434 
435  nplus += nPlus;
436  nminus += nMinus;
437  pplus += pPlus;
438  pminus += pMinus;
439  }
440  }
441 
442  if (jPtCent >= 0) {
443  for (int jPt=0;jPt<mnPts;jPt++) {
444  double np, nm, pp, pm;
445  np = mptnplus[jPt];
446  nm = mptnminus[jPt];
447  pp = mptpplus[jPt];
448  pm = mptpminus[jPt];
449  int index = jPt + jPtCent*mnPts;
450  mPtFluct[index]->fillMults( np, nm, pp, pm );
451  }
452  }
453  mFluct[jCent]->fillMults( nplus, nminus, pplus, pminus );
454 }
455 // iEta runs from 1 up to the number of etaBins that fit in,
456 // according to the binning mode.
457 // Return starting bin (first bin is called 0.)
458 // When iEta is too big return -1.
459 int StEStructFluctAnal::getEtaStart( int iEta, int dEta ) {
460  if (dEta > NETABINS) {
461  return -1;
462  }
463  if (1 == mEtaSumMode) {
464  int nEta = NETABINS / dEta;
465  int oEta = NETABINS % dEta;
466  if ( iEta*dEta <= NETABINS ) {
467  return (iEta-1)*dEta;
468  }
469  if (0 == oEta) {
470  return -1;
471  }
472  if (oEta+(iEta-nEta)*dEta <= NETABINS) {
473  return oEta+(iEta-nEta-1)*dEta;
474  }
475  return -1;
476  } else if (2 == mEtaSumMode) {
477  if (iEta+dEta <= NETABINS) {
478  return iEta - 1;
479  } else {
480  return -1;
481  }
482  } else if (3 == mEtaSumMode) {
483  if (iEta > 1) {
484  return -1;
485  } else {
486  return 0;
487  }
488  } else if (4 == mEtaSumMode) {
489  if (iEta > 1) {
490  return -1;
491  } else {
492  return NETABINS-dEta-1;
493  }
494  } else if (5 == mEtaSumMode) {
495  if (iEta > 1) {
496  return -1;
497  } else {
498  return (NETABINS-dEta) / 2;
499  }
500  } else if (6 == mEtaSumMode) {
501  int nEta = NETABINS / dEta;
502  if (iEta > nEta) {
503  return -1;
504  }
505  int oEta = (NETABINS % dEta) / 2;
506  return oEta + (iEta-1)*dEta;
507  }
508  return -1;
509 }
510 int StEStructFluctAnal::getPhiStart( int iPhi, int dPhi ) {
511  if (dPhi > NPHIBINS) {
512  return -1;
513  }
514  if (1 == mPhiSumMode) {
515  int nPhi = NPHIBINS / dPhi;
516  int oPhi = NPHIBINS % dPhi;
517  if ( iPhi*dPhi <= NPHIBINS ) {
518  return (iPhi-1)*dPhi;
519  }
520  if (0 == oPhi) {
521  return -1;
522  }
523  if (oPhi+(iPhi-nPhi)*dPhi <= NPHIBINS) {
524  return oPhi+(iPhi-nPhi-1)*dPhi;
525  }
526  return -1;
527  } else if (2 == mPhiSumMode) {
528  if (iPhi+dPhi <= NPHIBINS) {
529  return iPhi - 1;
530  } else {
531  return -1;
532  }
533  } else if (3 == mPhiSumMode) {
534  if (iPhi > 1) {
535  return -1;
536  } else {
537  return 0;
538  }
539  } else if (4 == mPhiSumMode) {
540  if (iPhi > 1) {
541  return -1;
542  } else {
543  return NPHIBINS-dPhi - 1;
544  }
545  } else if (5 == mPhiSumMode) {
546  if (iPhi > 1) {
547  return -1;
548  } else {
549  return (NPHIBINS-dPhi) / 2;
550  }
551  } else if (6 == mPhiSumMode) {
552  int nPhi = NPHIBINS / dPhi;
553  if (iPhi > nPhi) {
554  return -1;
555  }
556  int oPhi = (NPHIBINS % dPhi) / 2;
557  return oPhi + (iPhi-1)*dPhi;
558  }
559  return -1;
560 }
561 int StEStructFluctAnal::getNumEtaBins( int dEta ) {
562  if (1 == mEtaSumMode) {
563  int nEta = NETABINS / dEta;
564  int oEta = NETABINS % dEta;
565  if ( 0 == oEta ) {
566  return nEta;
567  } else {
568  return 2 * nEta;
569  }
570  } else if (2 == mEtaSumMode) {
571  return NETABINS + 1 - dEta;
572  } else if (3 == mEtaSumMode) {
573  return 1;
574  } else if (4 == mEtaSumMode) {
575  return 1;
576  } else if (5 == mEtaSumMode) {
577  return 1;
578  } else if (5 == mEtaSumMode) {
579  int nEta = NETABINS / dEta;
580  return nEta;
581  }
582  return 0;
583 }
584 int StEStructFluctAnal::getNumPhiBins( int dPhi ) {
585  if (1 == mPhiSumMode) {
586  int nPhi = NPHIBINS / dPhi;
587  int oPhi = NPHIBINS % dPhi;
588  if ( 0 == oPhi ) {
589  return nPhi;
590  } else {
591  return 2 * nPhi;
592  }
593  } else if (2 == mPhiSumMode) {
594  return NPHIBINS + 1 - dPhi;
595  } else if (3 == mPhiSumMode) {
596  return 1;
597  } else if (4 == mPhiSumMode) {
598  return 1;
599  } else if (5 == mPhiSumMode) {
600  return 1;
601  } else if (5 == mPhiSumMode) {
602  int nPhi = NPHIBINS / dPhi;
603  return nPhi;
604  }
605  return 0;
606 }
607 
608 void StEStructFluctAnal::writeHistograms(){
609 
610  TH1F *hEtaLimits = new TH1F("EtaLimits","EtaLimits",2,1,2);
611  hEtaLimits->SetBinContent(1,mEtaMin);
612  hEtaLimits->SetBinContent(2,mEtaMax);
613  hEtaLimits->Write();
614  delete hEtaLimits; hEtaLimits = 0;
615  hMultiplicity->Write();
616  hMultiplicityBinned->Write();
617  hPt->Write();
618  hPtBinned->Write();
619 
620  for (int i=0;i<mnCents;i++) {
621  mFluct[i]->writeHistograms();
622  }
623  for (int i=0;i<mnPtCents;i++) {
624  for (int j=0;j<mnPts;j++) {
625  int index = j + i*mnPts;
626  mPtFluct[index]->writeHistograms();
627  }
628  }
629 
630  // Here I write out the statistics needed to combine all jobs
631  // and calculate \sigma^2/\bar n and the errors.
632  // Write this out to a seperate file.
633 
634  hnBins->Write();
635  hoffset->Write();
636  hfUnique->Write();
637 
638 
639  cout << "For this analysis we have used mEtaSumMode = " << mEtaSumMode << endl;
640  cout << "For this analysis we have used mPhiSumMode = " << mPhiSumMode << endl;
641  cout << "(1 = start at bin 0. Fit as many non-overlapping bins as possible" <<endl;
642  cout << " If it doesn't end evenly start at end and work back.)" << endl;
643  cout << "(2 = start at bin 0, shift over one bin until we hit the end.)" << endl;
644  cout << "(3 = use one bin at beginning.)" << endl;
645  cout << "(4 = use one bin at end.)" << endl;
646  cout << "(5 = use one bin near center.)" << endl;
647  cout << "(6 = fit as many non-overlapping bins in as possible.";
648  cout << " Coverage as centered as possible.)" << endl;
649  cout << endl;
650 
651  cout << "Looped over " << mnTotEvents << " total events" << endl;
652  cout << " For each centrality have ";
653  for (int jCent=0;jCent<mnCents;jCent++) {
654  cout << mnCentEvents[jCent] << " ";
655  }
656  cout << endl;
657 }
658 void StEStructFluctAnal::writeQAHists(TFile* qatf) {
659 
660  qatf->cd();
661 
662  // next line is currently never satisfied... must build structure
663  // so that local mQAHists are created per analysis object as in
664  // correlations. .... leave this here as a reminder only and for
665  // symmetry in correlations code reflected in doEStruct...
666 
667  if(mlocalQAHists) mQAHists->writeTrackHistograms(qatf);
668 
669  for (int i=0;i<mnCents;i++) {
670  mFluct[i]->writeQAHistograms();
671  }
672  for (int i=0;i<mnPtCents;i++) {
673  for (int j=0;j<mnPts;j++) {
674  int index = j + i*mnPts;
675  mPtFluct[index]->writeQAHistograms();
676  }
677  }
678 
679 }
680 
681 //--------------------------------------------------------------------------
682 void StEStructFluctAnal::initHistograms(){
683 
684  hMultiplicity = new TH1F("Multiplicity","Multiplicity",2000,1,2000);
685  hMultiplicityBinned = new TH1F("MultiplicityBinned","MultiplicityBinned",120,1.0,7.0);
686  hPt = new TH1F("Pt","Pt",2000,1,2000);
687  hPtBinned = new TH1F("PtBinned","PtBinned",120,0.0,6.0);
688 
689  // Now we allocate arrays to store information.
690  // Need to keep track of all bins at each scale.
691 
692  int off = 0;
693  for (int jPhi=0;jPhi<NPHIBINS;jPhi++) {
694  int dPhi = jPhi + 1;
695  for (int jEta=0;jEta<NETABINS;jEta++) {
696  int dEta = jEta + 1;
697  int iBin = 0;
698  double area = 0;
699  int iPhi = 1, kPhi;
700  while ( (kPhi=getPhiStart(iPhi,dPhi)) >= 0) {
701  int iEta = 1, kEta;
702  while ( (kEta=getEtaStart(iEta,dEta)) >= 0) {
703  area += double(dEta*dPhi);
704  iBin++;
705  iEta++;
706  }
707  iPhi++;
708  }
709  nBins[jPhi][jEta] = iBin;
710  if (area < NPHIBINS*NETABINS) {
711  fUnique[jPhi][jEta] = 1;
712  } else {
713  fUnique[jPhi][jEta] = double(NPHIBINS*NETABINS) / area;
714  }
715  offset[jPhi][jEta] = off;
716  off += iBin;
717  }
718  }
719  mnTotBins = off;
720 cout << "Creating histograms for bins, uniqueness etc. " << endl;
721  hnBins = new TH2F("nBins", "nBins", NPHIBINS,0.5,NPHIBINS+0.5,NETABINS,0.5,NETABINS+0.5);
722  hoffset = new TH2F("offset","offset",NPHIBINS,0.5,NPHIBINS+0.5,NETABINS,0.5,NETABINS+0.5);
723  hfUnique = new TH2F("fUnique","fUnique",NPHIBINS,0.5,NPHIBINS+0.5,NETABINS,0.5,NETABINS+0.5);
724  for (int jPhi=0;jPhi<NPHIBINS;jPhi++) {
725  for (int jEta=0;jEta<NETABINS;jEta++) {
726  hnBins->SetBinContent(jPhi+1,jEta+1,nBins[jPhi][jEta]);
727  hoffset->SetBinContent(jPhi+1,jEta+1,offset[jPhi][jEta]);
728  hfUnique->SetBinContent(jPhi+1,jEta+1,fUnique[jPhi][jEta]);
729  }
730  }
731 }
732 
733 void StEStructFluctAnal::deleteHistograms() {
734  if (hMultiplicity) {
735  delete hMultiplicity; hMultiplicity = 0;
736  }
737  if (hMultiplicityBinned) {
738  delete hMultiplicityBinned; hMultiplicityBinned = 0;
739  }
740  if (hPt) {
741  delete hPt; hPt = 0;
742  }
743  if (hPtBinned) {
744  delete hPtBinned; hPtBinned = 0;
745  }
746  if (hnBins) {
747  delete hnBins; hnBins = 0;
748  }
749  if (hoffset) {
750  delete hoffset; hoffset = 0;
751  }
752  if (hfUnique) {
753  delete hfUnique; hfUnique = 0;
754  }
755 }
756 float StEStructFluctAnal::etaOffset( float vz ) {
757  return 0;
758 // double eta1 = -log(tan(atan(160.0/(200+vz))/2));
759 // double eta2 = -log(tan(atan(160.0/(200-vz))/2));
760 // return (eta2-eta1)/2;
761 }
bool mlocalQAHists
for QA histogramming
StEStructQAHists * mQAHists
for pairs kine + all paircuts
float mEtaMin
toggle needed for who writes out
StEStructCentrality * mCentralities
pointer to EStruct2pt data