Transition PWG0 -> PWGUD
[u/mrichter/AliRoot.git] / PWGUD / dNdPt / macros / plots / readPythia320.C
CommitLineData
2803ac99 1Int_t readPythia320()
2{
3// read PYTHIA 320 INEL data from file
4
5cout << endl;
6cout << "================================" << endl;
7cout << endl;
8cout << "read PHYTIA 320 INEL data from file" <<endl;
9cout << "Number of bins: " << binsPythia320 <<endl;
10cout << "Filename: " << filenamePythia320 <<endl;
11cout << endl;
12cout << "================================" << endl;
13cout << endl;
14
15TFile* filePythia320 = new TFile(filenamePythia320,"OPEN");
16nEventsPythia320 = ((TH1F*)filePythia320->Get("eventsINEL"))->GetBinContent(1);
17
18TH1F* histPythia320 = (TH1F*)filePythia320->Get("ptINEL");
19
20int bins = 0;
21for (int i=0; i < histPythia320->GetNbinsX(); i++) {
22 if (histPythia320->GetBinContent(i) > 0 ) {
23 centerPtPythia320[bins] = histPythia320->GetBinCenter(i);
24 ptPythia320[bins] = centerPtPythia320[bins];
25 widthPtPythia320[bins] = histPythia320->GetBinWidth(i);
26 errPtPythia320[bins] = widthPtPythia320[bins] / 2.0;
27 lowPtPythia320[bins] = centerPtPythia320[bins] - errPtPythia320[bins];
28 highPtPythia320[bins] = centerPtPythia320[bins] + errPtPythia320[bins];
29
30 inelPythia320[bins] = histPythia320->GetBinContent(i) / (nEventsPythia320 * etaRange * 2 * M_PI * ptPythia320[bins]);
31 errInelPythia320[bins] = histPythia320->GetBinError(i) / (nEventsPythia320 * etaRange * 2 * M_PI * ptPythia320[bins]);
32 lowErrInelPythia320[bins] = inelPythia320[bins] - errInelPythia320[bins];
33 highErrInelPythia320[bins] = inelPythia320[bins] + errInelPythia320[bins];
34 relErrInelPythia320[bins] = errInelPythia320[bins] / inelPythia320[bins];
35
36
37
38
39
40
41 centerPt2PiPtPythia320[bins] = histPythia320->GetBinCenter(i);
42 pt2PiPtPythia320[bins] = centerPt2PiPtPythia320[bins];
43 widthPt2PiPtPythia320[bins] = histPythia320->GetBinWidth(i);
44 errPt2PiPtPythia320[bins] = widthPt2PiPtPythia320[bins] / 2.0;
45 lowPt2PiPtPythia320[bins] = centerPt2PiPtPythia320[bins] - errPt2PiPtPythia320[bins];
46 highPt2PiPtPythia320[bins] = centerPt2PiPtPythia320[bins] + errPt2PiPtPythia320[bins];
47 inel2PiPtPythia320[bins] = histPythia320->GetBinContent(i) / (nEventsPythia320 * etaRange);
48 errInel2PiPtPythia320[bins] = histPythia320->GetBinError(i) / (nEventsPythia320 * etaRange);
49 lowErrInel2PiPtPythia320[bins] = inel2PiPtPythia320[bins] - errInel2PiPtPythia320[bins];
50 highErrInel2PiPtPythia320[bins] = inel2PiPtPythia320[bins] + errInel2PiPtPythia320[bins];
51 relErrInel2PiPtPythia320[bins] = errInel2PiPtPythia320[bins] / inel2PiPtPythia320[bins];
52
53
54
55
56
57
58 cout << "ptPythia320[" << bins << "] = " << ptPythia320[bins] <<endl;
59 cout << " centerPtPythia320[" << bins << "] = " << centerPtPythia320[bins] <<endl;
60 cout << " widthPtPythia320[" << bins << "] = " << widthPtPythia320[bins] <<endl;
61 cout << " errPtPythia320[" << bins << "] = " << errPtPythia320[bins] <<endl;
62 cout << " lowPtPythia320[" << bins << "] = " << lowPtPythia320[bins] <<endl;
63 cout << " highPtPythia320[" << bins << "] = " << highPtPythia320[bins] <<endl;
64 cout << "inelPythia320[" << bins << "] = " << inelPythia320[bins] <<endl;
65 cout << "errInelPythia320[" << bins << "] = " << errInelPythia320[bins] <<endl;
66 cout << " lowErrInelPythia320[" << bins << "] = " << lowErrInelPythia320[bins] <<endl;
67 cout << " highErrInelPythia320[" << bins << "] = " << highErrInelPythia320[bins] <<endl;
68 cout << " relErrInelPythia320[" << bins << "] = " << relErrInelPythia320[bins] <<endl;
69 cout << endl;
70 bins++;
71 }
72}
73
74filePythia320->Close();
75
76cout << "================================" << endl;
77cout << endl;
78cout << "Finished reading PYTHIA 320 INEL data" <<endl;
79cout << "Number of bins read: " << bins <<endl;
80cout << endl;
81cout << "================================" << endl;
82cout << endl;
83
84return bins;
85}