PWGUD/dNdPt -> PWGLF/SPECTRA/ChargedHadrons/dNdPt
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / ChargedHadrons / dNdPt / macros / plots / readCms.C
1 Int_t readCms() 
2 {
3 // read CMS NSD data from file
4 //
5
6 cout << endl;
7 cout << "================================" << endl;
8 cout << endl;
9 cout << "read CMS NSD data from file" <<endl;
10 cout << "Number of bins: " << binsCms <<endl;
11 cout << "Filename:       " << filenameCms <<endl;
12 cout << endl;
13 cout << "================================" << endl;
14 cout << endl;
15
16 ifstream fileNsdCms;
17 fileNsdCms.open(filenameCms);
18
19 Int_t i = 0;
20 while(!fileNsdCms.eof()) {
21     if(i == binsCms) break;
22     // textfile content: pt:NSD_yield:(stat + syst error added linerarly)
23     fileNsdCms >> centerPtCms[i] >> nsdCms[i] >> errNsdCms[i];
24     
25     ptCms[i]          = centerPtCms[i];
26     
27     // the width of the pt bins, currently hardwired....
28     widthPtCms[i] = 0.1;
29     if (centerPtCms[i] > 1) widthPtCms[i] = 0.2;
30     
31     errPtCms[i]       = widthPtCms[i] / 2.0;              
32     lowPtCms[i]       = centerPtCms[i] - errPtCms[i];
33     highPtCms[i]      = centerPtCms[i] + errPtCms[i];
34     
35     /*
36     lowStatNsdCms[i]  = nsdCms[i] - statNsdCms[i];
37     highStatNsdCms[i] = nsdCms[i] + statNsdCms[i];
38     relStatNsdCms[i]  = statNsdCms[i] / nsdCms[i];    
39     lowSystNsdCms[i]  = nsdCms[i] - systNsdCms[i];
40     highSystNsdCms[i] = nsdCms[i] + systNsdCms[i];
41     relSystNsdCms[i]  = systNsdCms[i] / nsdCms[i];    
42     */    
43     lowErrNsdCms[i]   = nsdCms[i] - errNsdCms[i];
44     highErrNsdCms[i]  = nsdCms[i] + errNsdCms[i];
45     relErrNsdCms[i]   = errNsdCms[i] / nsdCms[i];
46     err2NsdCms[i]     = errNsdCms[i];
47     lowErr2NsdCms[i]  = lowErrNsdCms[i];
48     highErr2NsdCms[i] = highErrNsdCms[i];
49     relErr2NsdCms[i]  = relErrNsdCms[i];
50         
51     cout << "ptCms[" << i << "]             = " << ptCms[i] <<endl;
52     cout << "   centerPtCms[" << i << "]    = " << centerPtCms[i] <<endl;
53     cout << "   widthPtCms[" << i << "]     = " << widthPtCms[i] <<endl;
54     cout << "   errPtCms[" << i << "]       = " << errPtCms[i] <<endl;
55     cout << "   lowPtCms[" << i << "]       = " << lowPtCms[i] <<endl;
56     cout << "   highPtCms[" << i << "]      = " << highPtCms[i] <<endl;
57     cout << "nsdCms[" << i << "]            = " << nsdCms[i] <<endl;
58     /*
59     cout << "   statNsdCms[" << i << "]     = " << statNsdCms[i] <<endl;
60     cout << "   lowStatNsdCms[" << i << "]  = " << lowStatNsdCms[i] <<endl;
61     cout << "   highStatNsdCms[" << i << "] = " << highStatNsdCms[i] <<endl;
62     cout << "   relStatNsdCms[" << i << "]  = " << relStatNsdCms[i] <<endl;
63     cout << "   systNsdCms[" << i << "]     = " << systNsdCms[i] <<endl;
64     cout << "   lowSystNsdCms[" << i << "]  = " << lowSystNsdCms[i] <<endl;
65     cout << "   highSystNsdCms[" << i << "] = " << highSystNsdCms[i] <<endl;
66     cout << "   relSystNsdCms[" << i << "]  = " << relSystNsdCms[i] <<endl;
67     */
68     cout << "errNsdCms[" << i << "]         = " << errNsdCms[i] <<endl;
69     cout << "   lowErrNsdCms[" << i << "]   = " << lowErrNsdCms[i] <<endl;
70     cout << "   highErrNsdCms[" << i << "]  = " << highErrNsdCms[i] <<endl;
71     cout << "   relErrNsdCms[" << i << "]   = " << relErrNsdCms[i] <<endl;
72     cout << "err2NsdCms[" << i << "]        = " << err2NsdCms[i] <<endl;
73     cout << "   lowErr2NsdCms[" << i << "]  = " << lowErr2NsdCms[i] <<endl;
74     cout << "   highErr2NsdCms[" << i << "] = " << highErr2NsdCms[i] <<endl;
75     cout << "   relErr2NsdCms[" << i << "]  = " << relErr2NsdCms[i] <<endl;
76     cout << endl;
77      
78    i++;
79 } // while(!fileNsdCms.eof())
80 fileNsdCms.close();
81 //if (fileNsdCms) { delete fileNsdCms; }
82 //fileNsdCms=0;
83
84 cout << "================================" << endl;
85 cout << endl;
86 cout << "Finished reading CMS NSD data" <<endl;
87 cout << "Number of bins read: " << i <<endl;
88 cout << endl;
89 cout << "================================" << endl;
90 cout << endl;
91
92 return i;
93 }