Transition PWG0 -> PWGUD
[u/mrichter/AliRoot.git] / PWGUD / dNdPt / macros / plots / readUa1.C
1 Int_t readUa1() 
2 {
3 // read UA1 data from file
4 //
5
6 cout << endl;
7 cout << "================================" << endl;
8 cout << endl;
9 cout << "read UA1 YIELD data from file" <<endl;
10 cout << "Number of bins: " << binsUa1 <<endl;
11 cout << "Filename:       " << filenameUa1 <<endl;
12 cout << endl;
13 cout << "================================" << endl;
14 cout << endl;
15
16 ifstream fileCrossUa1;
17 fileCrossUa1.open(filenameUa1);
18
19 Int_t i = 0;
20 while(!fileCrossUa1.eof()) {
21     if(i == binsUa1) break;
22     // textfile content: pt:cross_yield:(stat + syst error added linerarly)
23     fileCrossUa1 >> centerPtUa1[i] >> crossUa1[i] >> errCrossUa1[i];
24     
25     ptUa1[i]          = centerPtUa1[i];
26     
27     // the width of the pt bins, currently hardwired....
28     widthPtUa1[i] = 0.1;
29     if (centerPtUa1[i] > 4) widthPtUa1[i] = 0.2;
30     if (centerPtUa1[i] > 6) widthPtUa1[i] = 1.0;
31     
32     errPtUa1[i]       = widthPtUa1[i] / 2.0;              
33     lowPtUa1[i]       = centerPtUa1[i] - errPtUa1[i];
34     highPtUa1[i]      = centerPtUa1[i] + errPtUa1[i];
35     
36     /*
37     lowStatCrossUa1[i]  = crossUa1[i] - statCrossUa1[i];
38     highStatCrossUa1[i] = crossUa1[i] + statCrossUa1[i];
39     relStatCrossUa1[i]  = statCrossUa1[i] / crossUa1[i];    
40     lowSystCrossUa1[i]  = crossUa1[i] - systCrossUa1[i];
41     highSystCrossUa1[i] = crossUa1[i] + systCrossUa1[i];
42     relSystCrossUa1[i]  = systCrossUa1[i] / crossUa1[i];    
43     */    
44     lowErrCrossUa1[i]   = crossUa1[i] - errCrossUa1[i];
45     highErrCrossUa1[i]  = crossUa1[i] + errCrossUa1[i];
46     relErrCrossUa1[i]   = errCrossUa1[i] / crossUa1[i];
47     err2CrossUa1[i]     = errCrossUa1[i];
48     lowErr2CrossUa1[i]  = lowErrCrossUa1[i];
49     highErr2CrossUa1[i] = highErrCrossUa1[i];
50     relErr2CrossUa1[i]  = relErrCrossUa1[i];
51     
52     yieldUa1[i]         = crossUa1[i] * (avgToHadr / sigmaInelUa1);
53     /*
54     statYieldUa1[i]     = 
55     lowStatYieldUa1[i]  = 
56     highStatYieldUa1[i] = 
57     relStatYieldUa1[i]  = 
58     systYieldUa1[i]     = 
59     lowSystYieldUa1[i]  = 
60     highSystYieldUa1[i] = 
61     relSystYieldUa1[i]  = 
62     */
63     errYieldUa1[i]      = errCrossUa1[i] * (avgToHadr / sigmaInelUa1);
64     lowErrYieldUa1[i]   = yieldUa1[i] - errYieldUa1[i];
65     highErrYieldUa1[i]  = yieldUa1[i] + errYieldUa1[i];
66     relErrYieldUa1[i]   = errYieldUa1[i] / yieldUa1[i];
67     err2YieldUa1[i]     = errYieldUa1[i];
68     lowErr2YieldUa1[i]  = lowErrYieldUa1[i];
69     highErr2YieldUa1[i] = highErrYieldUa1[i];
70     relErr2YieldUa1[i]  = relErrYieldUa1[i];
71         
72     cout << "ptUa1[" << i << "]               = " << ptUa1[i] <<endl;
73     cout << "   centerPtUa1[" << i << "]      = " << centerPtUa1[i] <<endl;
74     cout << "   widthPtUa1[" << i << "]       = " << widthPtUa1[i] <<endl;
75     cout << "   errPtUa1[" << i << "]         = " << errPtUa1[i] <<endl;
76     cout << "   lowPtUa1[" << i << "]         = " << lowPtUa1[i] <<endl;
77     cout << "   highPtUa1[" << i << "]        = " << highPtUa1[i] <<endl;
78     cout << "crossUa1[" << i << "]            = " << crossUa1[i] <<endl;
79     /*
80     cout << "   statCrossUa1[" << i << "]     = " << statCrossUa1[i] <<endl;
81     cout << "   lowStatCrossUa1[" << i << "]  = " << lowStatCrossUa1[i] <<endl;
82     cout << "   highStatCrossUa1[" << i << "] = " << highStatCrossUa1[i] <<endl;
83     cout << "   relStatCrossUa1[" << i << "]  = " << relStatCrossUa1[i] <<endl;
84     cout << "   systCrossUa1[" << i << "]     = " << systCrossUa1[i] <<endl;
85     cout << "   lowSystCrossUa1[" << i << "]  = " << lowSystCrossUa1[i] <<endl;
86     cout << "   highSystCrossUa1[" << i << "] = " << highSystCrossUa1[i] <<endl;
87     cout << "   relSystCrossUa1[" << i << "]  = " << relSystCrossUa1[i] <<endl;
88     */
89     cout << "errCrossUa1[" << i << "]         = " << errCrossUa1[i] <<endl;
90     cout << "   lowErrCrossUa1[" << i << "]   = " << lowErrCrossUa1[i] <<endl;
91     cout << "   highErrCrossUa1[" << i << "]  = " << highErrCrossUa1[i] <<endl;
92     cout << "   relErrCrossUa1[" << i << "]   = " << relErrCrossUa1[i] <<endl;
93     cout << "err2CrossUa1[" << i << "]        = " << err2CrossUa1[i] <<endl;
94     cout << "   lowErr2CrossUa1[" << i << "]  = " << lowErr2CrossUa1[i] <<endl;
95     cout << "   highErr2CrossUa1[" << i << "] = " << highErr2CrossUa1[i] <<endl;
96     cout << "   relErr2CrossUa1[" << i << "]  = " << relErr2CrossUa1[i] <<endl;
97
98     cout << "yieldUa1[" << i << "]            = " << yieldUa1[i] <<endl;
99     /*
100     cout << "   statYieldUa1[" << i << "]     = " << statYieldUa1[i] <<endl;
101     cout << "   lowStatYieldUa1[" << i << "]  = " << lowStatYieldUa1[i] <<endl;
102     cout << "   highStatYieldUa1[" << i << "] = " << highStatYieldUa1[i] <<endl;
103     cout << "   relStatYieldUa1[" << i << "]  = " << relStatYieldUa1[i] <<endl;
104     cout << "   systYieldUa1[" << i << "]     = " << systYieldUa1[i] <<endl;
105     cout << "   lowSystYieldUa1[" << i << "]  = " << lowSystYieldUa1[i] <<endl;
106     cout << "   highSystYieldUa1[" << i << "] = " << highSystYieldUa1[i] <<endl;
107     cout << "   relSystYieldUa1[" << i << "]  = " << relSystYieldUa1[i] <<endl;
108     */
109     cout << "errYieldUa1[" << i << "]         = " << errYieldUa1[i] <<endl;
110     cout << "   lowErrYieldUa1[" << i << "]   = " << lowErrYieldUa1[i] <<endl;
111     cout << "   highErrYieldUa1[" << i << "]  = " << highErrYieldUa1[i] <<endl;
112     cout << "   relErrYieldUa1[" << i << "]   = " << relErrYieldUa1[i] <<endl;
113     cout << "err2YieldUa1[" << i << "]        = " << err2YieldUa1[i] <<endl;
114     cout << "   lowErr2YieldUa1[" << i << "]  = " << lowErr2YieldUa1[i] <<endl;
115     cout << "   highErr2YieldUa1[" << i << "] = " << highErr2YieldUa1[i] <<endl;
116     cout << "   relErr2YieldUa1[" << i << "]  = " << relErr2YieldUa1[i] <<endl;
117     cout << endl;
118      
119    i++;
120 } // while(!fileCrossUa1.eof())
121 fileCrossUa1.close();
122 //if (fileCrossUa1) { delete fileCrossUa1; }
123 //fileCrossUa1=0;
124
125 cout << "================================" << endl;
126 cout << endl;
127 cout << "Finished reading UA1 YIELD data" <<endl;
128 cout << "Number of bins read: " << i <<endl;
129 cout << endl;
130 cout << "================================" << endl;
131 cout << endl;
132
133 return i;
134 }