StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
showHistos5.C
1 // This is an example macro reading the \Delta\rho/sqrt(\rho) files and
2 // putting them into histogram arrays. This makes it easier to plot
3 // specific histograms on a local computer.
4 
5 // This particular file grabs a subset of the pid histograms.
6 
7 TFile *data = new TFile("CuCu200GeV_histos.root");
8 
9 const char* pidName[] = {"all", "pipi", "piK", "pip", "KK", "KP", "pp", "oo"};
10 const char* chargeName[] = {"_LS_", "_US_", "_CD_", "_CI_"};
11 const char* chargeType[] = {"_PP_", "_PM_", "_MP_", "_MM_"};
12 
13 int nCent = 6;
14 TH2D *dedp[nCent][8][4];
15 TH2D *dedpC[nCent][8][4];
16 TH2D *ptdedp[nCent][8][4];
17 TH2D *ptdedpC[nCent][8][4];
18 TH2D *ytyt[nCent][8][4];
19 TH2D *ytytC[nCent][8][4];
20 TH2D *etaeta[nCent][8][4];
21 TH2D *etaetaC[nCent][8][4];
22 TH2D *ptetaeta[nCent][8][4];
23 TH2D *ptetaetaC[nCent][8][4];
24 TH2D *phiphi[nCent][8][4];
25 TH2D *phiphiC[nCent][8][4];
26 TH2D *ptphiphi[nCent][8][4];
27 TH2D *ptphiphiC[nCent][8][4];
28 
29 {
30  for (int ipid=0;ipid<8;ipid++) {
31  for (int ic=0;ic<nCent;ic++) {
32  for (int icharge=0;icharge<4;icharge++) {
33  TString name(pidName[ipid]);
34  name += "_NDEtaDPhi"; name += chargeName[icharge]; name += ic;
35  dedp[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
36  TString name(pidName[ipid]);
37  name += "_PtDEtaDPhi"; name += chargeName[icharge]; name += ic;
38  ptdedp[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
39  TString name(pidName[ipid]);
40  name += "_YtYt"; name += chargeName[icharge]; name += ic;
41  ytyt[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
42 
43  TString name(pidName[ipid]);
44  name += "_NDEtaDPhi"; name += chargeType[icharge]; name += ic;
45  dedpC[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
46  TString name(pidName[ipid]);
47  name += "_PtDEtaDPhi"; name += chargeType[icharge]; name += ic;
48  ptdedpC[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
49  TString name(pidName[ipid]);
50  name += "_YtYt"; name += chargeType[icharge]; name += ic;
51  ytytC[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
52 
53 
54  TString name(pidName[ipid]);
55  name += "_NEtaEta"; name += chargeName[icharge]; name += ic;
56  etaeta[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
57  TString name(pidName[ipid]);
58  name += "_PtEtaEta"; name += chargeName[icharge]; name += ic;
59  ptetaeta[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
60 
61  TString name(pidName[ipid]);
62  name += "_NEtaEta"; name += chargeType[icharge]; name += ic;
63  etaetaC[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
64  TString name(pidName[ipid]);
65  name += "_PtEtaEta"; name += chargeType[icharge]; name += ic;
66  ptetaetaC[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
67 
68 
69  TString name(pidName[ipid]);
70  name += "_NPhiPhi"; name += chargeName[icharge]; name += ic;
71  phiphi[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
72  TString name(pidName[ipid]);
73  name += "_PtPhiPhi"; name += chargeName[icharge]; name += ic;
74  ptphiphi[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
75 
76  TString name(pidName[ipid]);
77  name += "_NPhiPhi"; name += chargeType[icharge]; name += ic;
78  phiphiC[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
79  TString name(pidName[ipid]);
80  name += "_PtPhiPhi"; name += chargeType[icharge]; name += ic;
81  ptphiphiC[ic][ipid][icharge] = (TH2D *) gDirectory->Get(name.Data());
82 
83  }
84  }
85  }
86 }
87 
88 TCanvas* c1=new TCanvas("c1");
89 gStyle->SetPalette(1); // set up the colors
90 c1->Clear();
91 
92 c1->SetWindowSize(750,500);
93 c1->Divide(3,2);
94 
95 gStyle->SetOptTitle(0);
96 gStyle->SetOptStat(0);
97 
98 
99 int ipid = 6;
100 int icharge = 1;
101 {
102  for (int ic=0;ic<nCent;ic++) {
103  c1->cd(ic+1);
104  gPad->SetPhi(30);
105  gPad->SetTheta(50);
106  ytyt[ic][ipid][icharge]->Draw("surf1");
107  }
108 }
109 
110 
111 // Minimize e+e- peak in all
112 int ipid = 0;
113 {
114  for (int ic=0;ic<nCent;ic++) {
115  dedp[ic][ipid][1]->SetBinContent(13,7,0);
116  dedp[ic][ipid][2]->SetBinContent(13,7,0);
117  dedp[ic][ipid][3]->SetBinContent(13,7,0);
118  }
119 }
120 
121 c1->Clear();
122 c1->SetWindowSize(350,350);
123 gStyle->SetOptTitle();
124 gStyle->SetTitleBorderSize(0)
125 
126 char label[1024];
127 const char* texPidName[]={"all","#pi#pi","#piK","#piP","KK","KP","PP","noPID",};
128 const char* pidName[]={"all","pipi","piK","piP","KK","KP","PP","noPID",};
129 const char* chargeName[] = {"LS", "US", "CD", "CI"};
130 const char* centName[] = {"0-17", "17-33", "33-50", "50-67", "67-83", "83-100"};
131 char fileName[1024]
132 {
133  for (int ipid=0;ipid<8;ipid++) {
134  for (int icharge=0;icharge<4;icharge++) {
135  for (int ic=0;ic<nCent;ic++) {
136  sprintf(label,"P: %s, %s, multiplicity %s",texPidName[ipid],chargeName[icharge],centName[ic]);
137  ptdedp[ic][ipid][icharge]->SetTitle(label);
138  TAxis *x = ptdedp[ic][ipid][icharge]->GetXaxis();
139  TAxis *y = ptdedp[ic][ipid][icharge]->GetYaxis();
140  x->SetTitleSize(0.07);
141  x->SetTitleColor(1);
142  x->SetTitleOffset(1.0);
143  x->SetNdivisions(505);
144  x->SetLabelSize(0.05);
145  x->SetTitle("#eta_{#Delta}");
146  y->SetTitleSize(0.07);
147  y->SetTitleOffset(1.0);
148  y->SetTitleColor(1);
149  y->SetNdivisions(505);
150  y->SetLabelSize(0.05);
151  y->SetTitle("#phi_{#Delta}");
152  gPad->SetPhi(30);
153  gPad->SetTheta(50);
154  ptdedp[ic][ipid][icharge]->Draw("surf1");
155  sprintf(fileName,"auto_P_%s-%s_%s.gif",pidName[ipid],chargeName[icharge],centName[ic]);
156  c1->Print(fileName);
157  }
158  }
159  }
160 }
161 
162 
163 char textFileName[1024]
164 FILE *out;
165 {
166  for (int ipid=0;ipid<8;ipid++) {
167  for (int icharge=0;icharge<4;icharge++) {
168  for (int ic=0;ic<nCent;ic++) {
169  sprintf( textFileName, "auto_N_%s-%s_%s.txt",pidName[ipid],chargeName[icharge],centName[ic]);
170  out = fopen(textFileName,"w");
171  for (int ix=1;ix<dedp[ic][ipid][icharge]->GetNbinsX();ix++) {
172  for (int iy=1;iy<dedp[ic][ipid][icharge]->GetNbinsY();iy++) {
173  fprintf(out,"%i %i %f\n",ix,iy,dedp[ic][ipid][icharge]->GetBinContent(ix,iy));
174  }
175  }
176  fclose(out);
177  }
178  }
179  }
180 }
181 
182