PWGUD/dNdPt -> PWGLF/SPECTRA/ChargedHadrons/dNdPt
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / ChargedHadrons / dNdPt / macros / plots / readAtlas.C
CommitLineData
2803ac99 1Int_t readAtlas()
2{
3// read ATLAS NSD data from file
4//
5
6cout << endl;
7cout << "================================" << endl;
8cout << endl;
9cout << "read ATLAS NSD data from file" <<endl;
10cout << "Number of bins: " << binsAtlas <<endl;
11cout << "Filename: " << filenameAtlas <<endl;
12cout << endl;
13cout << "================================" << endl;
14cout << endl;
15
16ifstream fileNsdAtlas;
17fileNsdAtlas.open(filenameAtlas);
18
19Int_t i = 0;
20while(!fileNsdAtlas.eof()) {
21 if(i == binsAtlas) break;
22 // textfile content: pt:pt_low:pt_high:NSD_yield:stat_error:syst_error
23 fileNsdAtlas >> ptAtlas[i] >> lowPtAtlas[i] >> highPtAtlas[i] >> nsdAtlas[i] >> statNsdAtlas[i] >> systNsdAtlas[i];
24
25 centerPtAtlas[i] = (highPtAtlas[i] + lowPtAtlas[i]) / 2.0;
26 widthPtAtlas[i] = highPtAtlas[i] - lowPtAtlas[i];
27 errPtAtlas[i] = widthPtAtlas[i] / 2.0;
28 lowErrPtAtlas[i] = ptAtlas[i] - lowPtAtlas[i];
29 highErrPtAtlas[i] = highPtAtlas[i] - ptAtlas[i];
30
31 lowStatNsdAtlas[i] = nsdAtlas[i] - statNsdAtlas[i];
32 highStatNsdAtlas[i] = nsdAtlas[i] + statNsdAtlas[i];
33 relStatNsdAtlas[i] = statNsdAtlas[i] / nsdAtlas[i];
34 lowSystNsdAtlas[i] = nsdAtlas[i] - systNsdAtlas[i];
35 highSystNsdAtlas[i] = nsdAtlas[i] + systNsdAtlas[i];
36 relSystNsdAtlas[i] = systNsdAtlas[i] / nsdAtlas[i];
37 errNsdAtlas[i] = systNsdAtlas[i] + statNsdAtlas[i];
38 lowErrNsdAtlas[i] = nsdAtlas[i] - errNsdAtlas[i];
39 highErrNsdAtlas[i] = nsdAtlas[i] + errNsdAtlas[i];
40 relErrNsdAtlas[i] = errNsdAtlas[i] / nsdAtlas[i];
41 err2NsdAtlas[i] = sqrt(systNsdAtlas[i]*systNsdAtlas[i] + statNsdAtlas[i]*statNsdAtlas[i]);
42 lowErr2NsdAtlas[i] = nsdAtlas[i] - err2NsdAtlas[i];
43 highErr2NsdAtlas[i] = nsdAtlas[i] + errNsdAtlas[i];
44 relErr2NsdAtlas[i] = err2NsdAtlas[i] / nsdAtlas[i];
45
46 cout << "ptAtlas[" << i << "] = " << ptAtlas[i] <<endl;
47 cout << " centerPtAtlas[" << i << "] = " << centerPtAtlas[i] <<endl;
48 cout << " widthPtAtlas[" << i << "] = " << widthPtAtlas[i] <<endl;
49 cout << " errPtAtlas[" << i << "] = " << errPtAtlas[i] <<endl;
50 cout << " lowErrPtAtlas[" << i << "] = " << lowErrPtAtlas[i] <<endl;
51 cout << " highErrPtAtlas[" << i << "] = " << highErrPtAtlas[i] <<endl;
52 cout << " lowPtAtlas[" << i << "] = " << lowPtAtlas[i] <<endl;
53 cout << " highPtAtlas[" << i << "] = " << highPtAtlas[i] <<endl;
54 cout << "nsdAtlas[" << i << "] = " << nsdAtlas[i] <<endl;
55 cout << " statNsdAtlas[" << i << "] = " << statNsdAtlas[i] <<endl;
56 cout << " lowStatNsdAtlas[" << i << "] = " << lowStatNsdAtlas[i] <<endl;
57 cout << " highStatNsdAtlas[" << i << "] = " << highStatNsdAtlas[i] <<endl;
58 cout << " relStatNsdAtlas[" << i << "] = " << relStatNsdAtlas[i] <<endl;
59 cout << " systNsdAtlas[" << i << "] = " << systNsdAtlas[i] <<endl;
60 cout << " lowSystNsdAtlas[" << i << "] = " << lowSystNsdAtlas[i] <<endl;
61 cout << " highSystNsdAtlas[" << i << "] = " << highSystNsdAtlas[i] <<endl;
62 cout << " relSystNsdAtlas[" << i << "] = " << relSystNsdAtlas[i] <<endl;
63 cout << "errNsdAtlas[" << i << "] = " << errNsdAtlas[i] <<endl;
64 cout << " lowErrNsdAtlas[" << i << "] = " << lowErrNsdAtlas[i] <<endl;
65 cout << " highErrNsdAtlas[" << i << "] = " << highErrNsdAtlas[i] <<endl;
66 cout << " relErrNsdAtlas[" << i << "] = " << relErrNsdAtlas[i] <<endl;
67 cout << "err2NsdAtlas[" << i << "] = " << err2NsdAtlas[i] <<endl;
68 cout << " lowErr2NsdAtlas[" << i << "] = " << lowErr2NsdAtlas[i] <<endl;
69 cout << " highErr2NsdAtlas[" << i << "] = " << highErr2NsdAtlas[i] <<endl;
70 cout << " relErr2NsdAtlas[" << i << "] = " << relErr2NsdAtlas[i] <<endl;
71 cout << endl;
72
73 i++;
74} // while(!fileNsdAtlas.eof())
75fileNsdAtlas.close();
76//if (fileNsdAtlas) { delete fileNsdAtlas; }
77//fileNsdAtlas=0;
78
79cout << "================================" << endl;
80cout << endl;
81cout << "Finished reading ATLAS NSD data" <<endl;
82cout << "Number of bins read: " << i <<endl;
83cout << endl;
84cout << "================================" << endl;
85cout << endl;
86
87return i;
88}