StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEStructFluctuations.cxx
1 
2 #include <math.h>
3 #include "StEStructFluctuations.h"
4 
5 #include "TH1F.h"
6 #include "TH2F.h"
7 #include "TFile.h"
8 
9 #include <stdlib.h>
10 
11 
12 ClassImp(StEStructFluct)
13 
14 //--------------------------------------------------------------------------
15 StEStructFluct::StEStructFluct( char *key, int totBins,
16  float EtaMin, float EtaMax,
17  float PtMin, float PtMax ) {
18  mKey = strdup(key);
19  mTotBins = totBins;
20  mEtaMin = EtaMin;
21  mEtaMax = EtaMax;
22  mPtMin = PtMin;
23  mPtMax = PtMax;
24  initArrays();
25 }
26 
27 //--------------------------------------------------------------------------
28 StEStructFluct::~StEStructFluct() {
29  deleteArrays();
30  deleteHistograms();
31  free( mKey );
32 }
33 
34 void StEStructFluct::AddToBin( int jBin,
35  double Nplus, double Nminus,
36  double Ptplus, double Ptminus,
37  double PtSqplus, double PtSqminus ) {
38  TotEvents[0][jBin]++;
39 
40  // This routine is called in an inner loop.
41  // Although the compiler should do the optimizations I try
42  // minimizing number of sqrt() and eliminating pow()
43  double Nsum = Nplus + Nminus;
44  if (Nsum < 0) {
45  return;
46  }
47 
48  double Ndiff = Nplus - Nminus;
49  double Ptsum = Ptplus + Ptminus;
50  double Ptdiff = Ptplus - Ptminus;
51  double PtSqsum = PtSqplus + PtSqminus;
52  double sqs = sqrt(Nsum);
53  double sqp = sqrt(Nplus);
54  double sqm = sqrt(Nminus);
55  double r;
56 
57 // Doing some tests for Jamie to alleive his concernes over nu_dynamical calculation.
58  if (Nsum > 0) {
59  TotEvents[1][jBin]++;
60 
61  NSum[0][jBin] += Nplus;
62  NSum[1][jBin] += Nminus;
63  NSum[2][jBin] += Nplus*Nplus;
64  NSum[3][jBin] += Nplus*Nminus;
65  NSum[4][jBin] += Nminus*Nminus;
66  NSum[5][jBin] += Nplus*Nplus/Nsum;
67  NSum[6][jBin] += Nplus*Nminus/Nsum;
68  NSum[7][jBin] += Nminus*Nminus/Nsum;
69  NSum[8][jBin] += Nplus*Nplus/(Nsum*Nsum);
70  NSum[9][jBin] += Nplus*Nminus/(Nsum*Nsum);
71  NSum[10][jBin] += Nminus*Nminus/(Nsum*Nsum);
72  NSum[11][jBin] += Nplus/sqs;
73  NSum[12][jBin] += Nplus*sqs;
74  NSum[13][jBin] += Nminus/sqs;
75  NSum[14][jBin] += Nminus*sqs;
76 
77  r = Ptsum*Ptsum/Nsum;
78  PSum[0][jBin] += PtSqsum;
79  PSum[1][jBin] += Ptplus;
80  PSum[2][jBin] += Ptminus;
81  PSum[3][jBin] += Nplus*Ptsum;
82  PSum[4][jBin] += Nminus*Ptsum;
83  PSum[5][jBin] += Ptsum*Ptsum;
84  PSum[6][jBin] += Nplus*Ptsum/Nsum;
85  PSum[7][jBin] += Nminus*Ptsum/Nsum;
86  PSum[8][jBin] += Ptsum*Ptsum/Nsum;
87  PSum[12][jBin] += r*Ptsum/Nsum;
88  PSum[13][jBin] += r*r/Nsum;
89  PSum[14][jBin] += Ptsum/sqs;
90  PSum[15][jBin] += Ptsum*sqs;
91 
92 
93  NDiff[0][jBin] += Nplus*Ndiff/sqs;
94  NDiff[1][jBin] += Nminus*Ndiff/sqs;
95 
96  double r1 = Ptdiff*Ptdiff/Nsum;
97  double r2 = Ptdiff*Ndiff/Nsum;
98  double r3 = Ndiff*Ndiff/Nsum;
99  PDiff[0][jBin] += Nplus*Ptdiff;
100  PDiff[1][jBin] += Nminus*Ptdiff;
101  PDiff[2][jBin] += Ptdiff*Ptdiff;
102  PDiff[3][jBin] += Nplus*Ptdiff/Nsum;
103  PDiff[4][jBin] += Nminus*Ptdiff/Nsum;
104  PDiff[5][jBin] += Ptdiff*Ptdiff/Nsum;
105  PDiff[6][jBin] += Nplus*Ptdiff/(Nsum*Nsum);
106  PDiff[7][jBin] += Nminus*Ptdiff/(Nsum*Nsum);
107  PDiff[8][jBin] += Ptdiff*Ptdiff/(Nsum*Nsum);
108  PDiff[9][jBin] += Ptdiff/sqs;
109  PDiff[10][jBin] += Ndiff*Ptdiff/sqs;
110  PDiff[11][jBin] += r1*r1/Nsum;
111  PDiff[12][jBin] += r1*r2/Nsum;
112  PDiff[13][jBin] += r1*r3/Nsum;
113  PDiff[14][jBin] += r2*r3/Nsum;
114  PDiff[15][jBin] += r3*r3/Nsum;
115  }
116  if (Nsum > 1) {
117  TotEvents[5][jBin]++;
118  NSum[15][jBin] += 1.0/(Nsum-1.0);
119  PSum[9][jBin] += Nsum/(Nsum-1.0);
120  PSum[10][jBin] += Ptsum/(Nsum-1.0);
121  PSum[11][jBin] += Ptsum*Ptsum/(Nsum*(Nsum-1.0));
122  PSum[16][jBin] += Nsum;
123  PSum[17][jBin] += Ptsum;
124  PSum[18][jBin] += PtSqsum;
125  PSum[19][jBin] += PtSqsum/(Nsum*(Nsum-1.0));
126  PSum[20][jBin] += Ptsum/(Nsum*(Nsum-1.0));
127  }
128 
129  if (Nplus > 0) {
130  TotEvents[2][jBin]++;
131 
132  NPlus[0][jBin] += Nplus;
133  NPlus[1][jBin] += Nplus*Nplus;
134  NPlus[2][jBin] += sqp;
135  NPlus[3][jBin] += Nplus*sqp;
136  NPlus[4][jBin] += 1/Nplus;
137 
138  r = Ptplus*Ptplus/Nplus;
139  PPlus[0][jBin] += PtSqplus;
140  PPlus[1][jBin] += Ptplus;
141  PPlus[2][jBin] += Ptplus*Nplus;
142  PPlus[3][jBin] += Ptplus/Nplus;
143  PPlus[4][jBin] += Ptplus*Ptplus;
144  PPlus[5][jBin] += r;
145  PPlus[6][jBin] += r/Nplus;
146  PPlus[7][jBin] += r*Ptplus/Nplus;
147  PPlus[8][jBin] += r*r/Nplus;
148  PPlus[9][jBin] += Ptplus/sqp;
149  PPlus[10][jBin] += Ptplus*sqp;
150  }
151 
152  if (Nminus > 0) {
153  TotEvents[3][jBin]++;
154 
155  NMinus[0][jBin] += Nminus;
156  NMinus[1][jBin] += Nminus*Nminus;
157  NMinus[2][jBin] += sqm;
158  NMinus[3][jBin] += Nminus*sqm;
159  NMinus[4][jBin] += 1/Nminus;
160 
161  r = Ptminus*Ptminus/Nminus;
162  PMinus[0][jBin] += PtSqminus;
163  PMinus[1][jBin] += Ptminus;
164  PMinus[2][jBin] += Ptminus*Nminus;
165  PMinus[3][jBin] += Ptminus/Nminus;
166  PMinus[4][jBin] += Ptminus*Ptminus;
167  PMinus[5][jBin] += r;
168  PMinus[6][jBin] += r/Nminus;
169  PMinus[7][jBin] += r*Ptminus/Nminus;
170  PMinus[8][jBin] += r*r/Nminus;
171  PMinus[9][jBin] += Ptminus/sqm;
172  PMinus[10][jBin] += Ptminus*sqm;
173  }
174 
175  if ((Nplus > 0) || (Nminus > 0)) {
176  TotEvents[4][jBin]++;
177 
178  NPlusMinus[0][jBin] += Nplus;
179  NPlusMinus[1][jBin] += Nminus;
180  NPlusMinus[2][jBin] += Nplus*Nminus;
181  NPlusMinus[3][jBin] += sqp;
182  NPlusMinus[4][jBin] += sqm;
183  NPlusMinus[5][jBin] += sqp*sqm;
184  NPlusMinus[6][jBin] += Nminus*sqp;
185  NPlusMinus[7][jBin] += Nplus*sqm;
186 
187  PPlusMinus[0][jBin] += Ptplus;
188  PPlusMinus[1][jBin] += Ptminus;
189  PPlusMinus[4][jBin] += Nplus*Ptminus;
190  PPlusMinus[5][jBin] += Nminus*Ptplus;
191  PPlusMinus[14][jBin] += Ptplus*Ptminus;
192  if (Nplus > 0) {
193  PPlusMinus[2][jBin] += Ptplus/Nplus;
194  PPlusMinus[6][jBin] += Ptplus/sqp;
195  PPlusMinus[8][jBin] += Ptplus*Nminus/Nplus;
196  PPlusMinus[10][jBin] += Ptplus*sqm/sqp;
197  PPlusMinus[12][jBin] += Ptplus*Nminus/sqp;
198  }
199  if (Nminus > 0) {
200  PPlusMinus[3][jBin] += Ptminus/Nminus;
201  PPlusMinus[7][jBin] += Ptminus/sqm;
202  PPlusMinus[9][jBin] += Ptminus*Nplus/Nminus;
203  PPlusMinus[11][jBin] += Ptminus*sqp/sqm;
204  PPlusMinus[13][jBin] += Ptminus*Nplus/sqm;
205  }
206  if ((Nplus > 0) && (Nminus > 0)) {
207  PPlusMinus[15][jBin] += Ptplus*Ptminus/(Nplus*Nminus);
208  PPlusMinus[16][jBin] += Ptplus*Ptminus/(sqp*sqm);
209  }
210  }
211 }
212 void StEStructFluct::fillOccupancies( double dPhi, double dEta,
213  double nPlus, double nMinus,
214  double pPlus, double pMinus ) {
215  double ns = nPlus + nMinus;
216  double nd = nPlus - nMinus;
217  double ps = pPlus + pMinus;
218  double pd = pPlus - pMinus;
219  occNSum->Fill(dPhi,dEta,ns);
220  occNPlus->Fill(dPhi,dEta,nPlus);
221  occNMinus->Fill(dPhi,dEta,nMinus);
222  occNDiff->Fill(dPhi,dEta,nd);
223  occPSum->Fill(dPhi,dEta,ps);
224  occPPlus->Fill(dPhi,dEta,pPlus);
225  occPMinus->Fill(dPhi,dEta,pMinus);
226  occPDiff->Fill(dPhi,dEta,pd);
227  occPNSum->Fill(dPhi,dEta,ns*ps);
228  occPNPlus->Fill(dPhi,dEta,nPlus*pPlus);
229  occPNMinus->Fill(dPhi,dEta,nMinus*pMinus);
230  occPNDiff->Fill(dPhi,dEta,nd*pd);
231 }
232 void StEStructFluct::fillMults( double nPlus, double nMinus,
233  double pPlus, double pMinus ) {
234  double ns = nPlus + nMinus;
235  double nd = nPlus - nMinus;
236  double ps = pPlus + pMinus;
237  double pd = pPlus - pMinus;
238  multNSum->Fill(ns);
239  multNPlus->Fill(nPlus);
240  multNMinus->Fill(nMinus);
241  multNDiff->Fill(nd);
242  multPSum->Fill(ps);
243  multPPlus->Fill(pPlus);
244  multPMinus->Fill(pMinus);
245  multPDiff->Fill(pd);
246 }
247 void StEStructFluct::fillEtaZ( float z, float eta,
248  int maxFitPoints, int foundPoints, int nFitPoints,
249  int iF, int iL ) {
250  EtaZNTracks->Fill(z,eta);
251  EtaZNMaxPoints->Fill(z,eta,maxFitPoints);
252  EtaZNFoundPoints->Fill(z,eta,foundPoints);
253  EtaZNFitPoints->Fill(z,eta,nFitPoints);
254  InnerRow->Fill(z,eta,iF);
255  OuterRow->Fill(z,eta,iL);
256 }
257 void StEStructFluct::fillPtHist( double Pt, int sign ) {
258  ptAll->Fill(Pt);
259  if (sign > 0) {
260  ptPlus->Fill(Pt);
261  }
262  if (sign < 0) {
263  ptMinus->Fill(Pt);
264  }
265 }
266 void StEStructFluct::fillPhiHist( double Phi, int sign ) {
267  if (sign > 0) {
268  phiPlus->Fill(Phi);
269  }
270  if (sign < 0) {
271  phiMinus->Fill(Phi);
272  }
273 }
274 void StEStructFluct::fillEtaHist( double Eta, int sign ) {
275  if (sign > 0) {
276  etaPlus->Fill(Eta);
277  }
278  if (sign < 0) {
279  etaMinus->Fill(Eta);
280  }
281 }
282 //--------------------------------------------------------------------------
283 //
284 //------------ Below are init, delete, write functions -------///
285 //
286 
287 
288 void StEStructFluct::writeHistograms() {
289 
290  initHistograms();
291  fillHistograms();
292 
293  for (int jStat=0;jStat<6;jStat++) {
294  hTotEvents[jStat]->Write();
295  }
296 
297  for (int jStat=0;jStat<16;jStat++) {
298  hNSum[jStat]->Write();
299  }
300  for (int jStat=0;jStat<2;jStat++) {
301  hNDiff[jStat]->Write();
302  }
303  for (int jStat=0;jStat<5;jStat++) {
304  hNPlus[jStat]->Write();
305  hNMinus[jStat]->Write();
306  }
307  for (int jStat=0;jStat<8;jStat++) {
308  hNPlusMinus[jStat]->Write();
309  }
310  for (int jStat=0;jStat<21;jStat++) {
311  hPSum[jStat]->Write();
312  }
313  for (int jStat=0;jStat<16;jStat++) {
314  hPDiff[jStat]->Write();
315  }
316  for (int jStat=0;jStat<11;jStat++) {
317  hPPlus[jStat]->Write();
318  hPMinus[jStat]->Write();
319  }
320  for (int jStat=0;jStat<17;jStat++) {
321  hPPlusMinus[jStat]->Write();
322  }
323 }
324 void StEStructFluct::fillHistograms() {
325 
326  // Here I copy from arrays top histograms so I can write the histograms.
327 
328  for (int jStat=0;jStat<6;jStat++) {
329  for (int jBin=0;jBin<mTotBins;jBin++) {
330  hTotEvents[jStat]->SetBinContent(jBin+1,TotEvents[jStat][jBin]);
331  }
332  }
333 
334  for (int jStat=0;jStat<16;jStat++) {
335  for (int jBin=0;jBin<mTotBins;jBin++) {
336  hNSum[jStat]->SetBinContent(jBin+1,NSum[jStat][jBin]);
337  }
338  }
339  for (int jStat=0;jStat<2;jStat++) {
340  for (int jBin=0;jBin<mTotBins;jBin++) {
341  hNDiff[jStat]->SetBinContent(jBin+1,NDiff[jStat][jBin]);
342  }
343  }
344  for (int jStat=0;jStat<5;jStat++) {
345  for (int jBin=0;jBin<mTotBins;jBin++) {
346  hNPlus[jStat]->SetBinContent(jBin+1,NPlus[jStat][jBin]);
347  hNMinus[jStat]->SetBinContent(jBin+1,NMinus[jStat][jBin]);
348  }
349  }
350  for (int jStat=0;jStat<8;jStat++) {
351  for (int jBin=0;jBin<mTotBins;jBin++) {
352  hNPlusMinus[jStat]->SetBinContent(jBin+1,NPlusMinus[jStat][jBin]);
353  }
354  }
355  for (int jStat=0;jStat<21;jStat++) {
356  for (int jBin=0;jBin<mTotBins;jBin++) {
357  hPSum[jStat]->SetBinContent(jBin+1,PSum[jStat][jBin]);
358  }
359  }
360  for (int jStat=0;jStat<16;jStat++) {
361  for (int jBin=0;jBin<mTotBins;jBin++) {
362  hPDiff[jStat]->SetBinContent(jBin+1,PDiff[jStat][jBin]);
363  }
364  }
365  for (int jStat=0;jStat<11;jStat++) {
366  for (int jBin=0;jBin<mTotBins;jBin++) {
367  hPPlus[jStat]->SetBinContent(jBin+1,PPlus[jStat][jBin]);
368  hPMinus[jStat]->SetBinContent(jBin+1,PMinus[jStat][jBin]);
369  }
370  }
371  for (int jStat=0;jStat<17;jStat++) {
372  for (int jBin=0;jBin<mTotBins;jBin++) {
373  hPPlusMinus[jStat]->SetBinContent(jBin+1,PPlusMinus[jStat][jBin]);
374  }
375  }
376 }
377 void StEStructFluct::writeQAHistograms() {
378  occNSum->Write();
379  occNPlus->Write();
380  occNMinus->Write();
381  occNDiff->Write();
382  occPSum->Write();
383  occPPlus->Write();
384  occPMinus->Write();
385  occPDiff->Write();
386  occPNSum->Write();
387  occPNPlus->Write();
388  occPNMinus->Write();
389  occPNDiff->Write();
390  EtaZNTracks->Write();
391  EtaZNFitPoints->Write();
392  EtaZNMaxPoints->Write();
393  EtaZNFoundPoints->Write();
394  InnerRow->Write();
395  OuterRow->Write();
396  multNSum->Write();
397  multNPlus->Write();
398  multNMinus->Write();
399  multNDiff->Write();
400  multPSum->Write();
401  multPPlus->Write();
402  multPMinus->Write();
403  multPDiff->Write();
404  ptAll->Write();
405  ptPlus->Write();
406  ptMinus->Write();
407  phiPlus->Write();
408  phiMinus->Write();
409  etaPlus->Write();
410  etaMinus->Write();
411 }
412 
413 //--------------------------------------------------------------------------
414 void StEStructFluct::initArrays() {
415  char line[255];
416 
417  // Here are histograms toward uniform occupancy of bins.
418  sprintf( line, "occNSum_%s", mKey );
419  occNSum = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
420  sprintf( line, "occNPlus_%s", mKey );
421  occNPlus = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
422  sprintf( line, "occNMinus_%s", mKey );
423  occNMinus = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
424  sprintf( line, "occNDiff_%s", mKey );
425  occNDiff = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
426  sprintf( line, "occPSum_%s", mKey );
427  occPSum = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
428  sprintf( line, "occPPlus_%s", mKey );
429  occPPlus = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
430  sprintf( line, "occPMinus_%s", mKey );
431  occPMinus = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
432  sprintf( line, "occPDiff_%s", mKey );
433  occPDiff = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
434  sprintf( line, "occPNSum_%s", mKey );
435  occPNSum = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
436  sprintf( line, "occPNPlus_%s", mKey );
437  occPNPlus = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
438  sprintf( line, "occPNMinus_%s", mKey );
439  occPNMinus = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
440  sprintf( line, "occPNDiff_%s", mKey );
441  occPNDiff = new TH2F(line,line,NPHIBINS,-3.1415926,3.1415926,NETABINS,mEtaMin,mEtaMax);
442 
443  sprintf( line, "EtaZNTracks_%s", mKey );
444  EtaZNTracks = new TH2F(line,line,60,-30,30,50,mEtaMin,mEtaMax);
445  sprintf( line, "EtaZNFitPoints_%s", mKey );
446  EtaZNFitPoints = new TH2F(line,line,60,-30,30,50,mEtaMin,mEtaMax);
447  sprintf( line, "EtaZNMaxPoints_%s", mKey );
448  EtaZNMaxPoints = new TH2F(line,line,60,-30,30,50,mEtaMin,mEtaMax);
449  sprintf( line, "EtaZNFoundPoints_%s", mKey );
450  EtaZNFoundPoints = new TH2F(line,line,60,-30,30,50,mEtaMin,mEtaMax);
451  sprintf( line, "InnerRow_%s", mKey );
452  InnerRow = new TH2F(line,line,60,-30,30,50,mEtaMin,mEtaMax);
453  sprintf( line, "OuterRow_%s", mKey );
454  OuterRow = new TH2F(line,line,60,-30,30,50,mEtaMin,mEtaMax);
455 
456  sprintf( line, "multNSum_%s", mKey );
457  multNSum = new TH1F(line,line,150,0,1500);
458  sprintf( line, "multNPlus_%s", mKey );
459  multNPlus = new TH1F(line,line,100,0,1000);
460  sprintf( line, "multNMinus_%s", mKey );
461  multNMinus = new TH1F(line,line,100,0,1000);
462  sprintf( line, "multNDiff_%s", mKey );
463  multNDiff = new TH1F(line,line,100,-200,200);
464  sprintf( line, "multPSum_%s", mKey );
465  multPSum = new TH1F(line,line,100,0,1000);
466  sprintf( line, "multPPlus_%s", mKey );
467  multPPlus = new TH1F(line,line,100,0,1000);
468  sprintf( line, "multPMinus_%s", mKey );
469  multPMinus = new TH1F(line,line,100,0,1000);
470  sprintf( line, "multPDiff_%s", mKey );
471  multPDiff = new TH1F(line,line,100,-200,200);
472 
473  sprintf( line, "ptAll_%s", mKey );
474  ptAll = new TH1F(line,line,100,mPtMin,mPtMax);
475  sprintf( line, "ptPlus_%s", mKey );
476  ptPlus = new TH1F(line,line,100,mPtMin,mPtMax);
477  sprintf( line, "ptMinus_%s", mKey );
478  ptMinus = new TH1F(line,line,100,mPtMin,mPtMax);
479  sprintf( line, "phiPlus_%s", mKey );
480  phiPlus = new TH1F(line,line,100,-3.1415926,3.1415926);
481  sprintf( line, "phiMinus_%s", mKey );
482  phiMinus = new TH1F(line,line,100,-3.1415926,3.1415926);
483  sprintf( line, "etaPlus_%s", mKey );
484  etaPlus = new TH1F(line,line,100,mEtaMin,mEtaMax);
485  sprintf( line, "etaMinus_%s", mKey );
486  etaMinus = new TH1F(line,line,100,mEtaMin,mEtaMax);
487 
488  printf("Allocating arrays to store info.\n");
489  for (int jStat=0;jStat<6;jStat++) {
490  TotEvents[jStat] = new double[mTotBins];
491  memset(TotEvents[jStat], 0, sizeof(double)*mTotBins );
492  }
493 
494  for (int jStat=0;jStat<16;jStat++) {
495  NSum[jStat] = new double[mTotBins];
496  memset(NSum[jStat], 0, sizeof(double)*mTotBins );
497  }
498  for (int jStat=0;jStat<2;jStat++) {
499  NDiff[jStat] = new double[mTotBins];
500  memset(NDiff[jStat], 0, sizeof(double)*mTotBins );
501  }
502  for (int jStat=0;jStat<5;jStat++) {
503  NPlus[jStat] = new double[mTotBins];
504  memset(NPlus[jStat], 0, sizeof(double)*mTotBins );
505  NMinus[jStat] = new double[mTotBins];
506  memset(NMinus[jStat], 0, sizeof(double)*mTotBins );
507  }
508  for (int jStat=0;jStat<8;jStat++) {
509  NPlusMinus[jStat] = new double[mTotBins];
510  memset(NPlusMinus[jStat], 0, sizeof(double)*mTotBins );
511  }
512  for (int jStat=0;jStat<21;jStat++) {
513  PSum[jStat] = new double[mTotBins];
514  memset(PSum[jStat], 0, sizeof(double)*mTotBins );
515  }
516  for (int jStat=0;jStat<16;jStat++) {
517  PDiff[jStat] = new double[mTotBins];
518  memset(PDiff[jStat], 0, sizeof(double)*mTotBins );
519  }
520  for (int jStat=0;jStat<11;jStat++) {
521  PPlus[jStat] = new double[mTotBins];
522  memset(PPlus[jStat], 0, sizeof(double)*mTotBins );
523  PMinus[jStat] = new double[mTotBins];
524  memset(PMinus[jStat], 0, sizeof(double)*mTotBins );
525  }
526  for (int jStat=0;jStat<17;jStat++) {
527  PPlusMinus[jStat] = new double[mTotBins];
528  memset(PPlusMinus[jStat], 0, sizeof(double)*mTotBins );
529  }
530 }
531 
532 //--------------------------------------------------------------------------
533 void StEStructFluct::deleteArrays() {
534 
535  printf("Deleting occupancy histograms.\n");
536  delete occNSum;
537  delete occNPlus;
538  delete occNMinus;
539  delete occNDiff;
540  delete occPSum;
541  delete occPPlus;
542  delete occPMinus;
543  delete occPDiff;
544  delete occPNSum;
545  delete occPNPlus;
546  delete occPNMinus;
547  delete occPNDiff;
548  delete EtaZNTracks;
549  delete EtaZNFitPoints;
550  delete EtaZNMaxPoints;
551  delete EtaZNFoundPoints;
552  delete InnerRow;
553  delete OuterRow;
554  delete multNSum;
555  delete multNPlus;
556  delete multNMinus;
557  delete multNDiff;
558  delete multPSum;
559  delete multPPlus;
560  delete multPMinus;
561  delete multPDiff;
562  delete ptAll;
563  delete ptPlus;
564  delete ptMinus;
565  delete phiPlus;
566  delete phiMinus;
567  delete etaPlus;
568  delete etaMinus;
569 
570  printf("freeing Arrays.\n");
571  for (int jStat=0;jStat<6;jStat++) {
572  delete [] TotEvents[jStat];
573  }
574 
575  for (int jStat=0;jStat<16;jStat++) {
576  delete [] NSum[jStat];
577  }
578  for (int jStat=0;jStat<2;jStat++) {
579  delete [] NDiff[jStat];
580  }
581  for (int jStat=0;jStat<5;jStat++) {
582  delete [] NPlus[jStat];
583  delete [] NMinus[jStat];
584  }
585  for (int jStat=0;jStat<8;jStat++) {
586  delete [] hNPlusMinus[jStat];
587  }
588  for (int jStat=0;jStat<21;jStat++) {
589  delete [] PSum[jStat];
590  }
591  for (int jStat=0;jStat<16;jStat++) {
592  delete [] PDiff[jStat];
593  }
594  for (int jStat=0;jStat<11;jStat++) {
595  delete [] PPlus[jStat];
596  delete [] PMinus[jStat];
597  }
598  for (int jStat=0;jStat<17;jStat++) {
599  delete [] PPlusMinus[jStat];
600  }
601 }
602 
603 
604 void StEStructFluct::initHistograms() {
605  char line[255];
606 
607  printf("Allocating histograms for I/O for key %s\n", mKey);
608  sprintf( line, "TotalEvents_%s", mKey);
609  hTotEvents[0] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
610  sprintf( line, "TotalSumEvents_%s", mKey);
611  hTotEvents[1] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
612  sprintf( line, "TotalPlusEvents_%s", mKey);
613  hTotEvents[2] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
614  sprintf( line, "TotalMinusEvents_%s", mKey);
615  hTotEvents[3] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
616  sprintf( line, "TotalPlusMinusEvents_%s", mKey);
617  hTotEvents[4] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
618  sprintf( line, "TotalEventsForSig2Dyn_%s", mKey);
619  hTotEvents[5] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
620 
621  for (int jStat=0;jStat<16;jStat++) {
622  sprintf( line, "NSum%s_%i", mKey, jStat );
623  hNSum[jStat] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
624  }
625  for (int jStat=0;jStat<2;jStat++) {
626  sprintf( line, "NDiff%s_%i", mKey, jStat );
627  hNDiff[jStat] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
628  }
629  for (int jStat=0;jStat<5;jStat++) {
630  sprintf( line, "NPlus%s_%i", mKey, jStat );
631  hNPlus[jStat] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
632  sprintf( line, "NMinus%s_%i", mKey, jStat );
633  hNMinus[jStat] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
634  }
635  for (int jStat=0;jStat<8;jStat++) {
636  sprintf( line, "NPlusMinus%s_%i", mKey, jStat );
637  hNPlusMinus[jStat] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
638  }
639  for (int jStat=0;jStat<21;jStat++) {
640  sprintf( line, "PSum%s_%i", mKey, jStat );
641  hPSum[jStat] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
642  }
643  for (int jStat=0;jStat<16;jStat++) {
644  sprintf( line, "PDiff%s_%i", mKey, jStat );
645  hPDiff[jStat] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
646  }
647  for (int jStat=0;jStat<11;jStat++) {
648  sprintf( line, "PPlus%s_%i", mKey, jStat );
649  hPPlus[jStat] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
650  sprintf( line, "PMinus%s_%i", mKey, jStat );
651  hPMinus[jStat] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
652  }
653  for (int jStat=0;jStat<17;jStat++) {
654  sprintf( line, "PPlusMinus%s_%i", mKey, jStat );
655  hPPlusMinus[jStat] = new TH1D(line,line,mTotBins,0.5,mTotBins+0.5);
656  }
657 }
658 
659 //--------------------------------------------------------------------------
660 void StEStructFluct::deleteHistograms() {
661 
662  printf("freeing h Array histograms.\n");
663  for (int jStat=0;jStat<6;jStat++) {
664  delete hTotEvents[jStat];
665  }
666 
667  for (int jStat=0;jStat<16;jStat++) {
668  delete hNSum[jStat];
669  }
670  for (int jStat=0;jStat<2;jStat++) {
671  delete hNDiff[jStat];
672  }
673  for (int jStat=0;jStat<5;jStat++) {
674  delete hNPlus[jStat];
675  delete hNMinus[jStat];
676  }
677  for (int jStat=0;jStat<8;jStat++) {
678  delete hNPlusMinus[jStat];
679  }
680  for (int jStat=0;jStat<21;jStat++) {
681  delete hPSum[jStat];
682  }
683  for (int jStat=0;jStat<16;jStat++) {
684  delete hPDiff[jStat];
685  }
686  for (int jStat=0;jStat<11;jStat++) {
687  delete hPPlus[jStat];
688  delete hPMinus[jStat];
689  }
690  for (int jStat=0;jStat<17;jStat++) {
691  delete hPPlusMinus[jStat];
692  }
693 }