Separate libraries for MUONdep and MUONlite
[u/mrichter/AliRoot.git] / PWGUD / dNdPt / macros / plots / readAliceInel.C
1 Int_t readAliceInel() 
2 {
3 // read ALICE INEL data from file
4 //
5
6 cout << endl;
7 cout << "================================" << endl;
8 cout << endl;
9 cout << "read ALICE INEL data from file" <<endl;
10 cout << "Number of bins: " << binsInelAlice <<endl;
11 cout << "Filename:       " << filenameInelAlice <<endl;
12 cout << endl;
13 cout << "================================" << endl;
14 cout << endl;
15
16 ifstream fileInelAlice;
17 fileInelAlice.open(filenameInelAlice);
18
19 Int_t i = 0;
20 while(!fileInelAlice.eof()) {
21     if(i == binsInelAlice) break;    
22     fileInelAlice >> centerPtInelAlice[i] >>  inelAlice[i] >> statInelAlice[i] >> systInelAlice[i];
23     //systInelAlice[i] = 0.15*inelAlice[i]+1e-7; // sys error has to be provided, currently 10%
24     
25     // the width of the pt bins, currently hardwired....
26     widthPtInelAlice[i] = 0.05;
27     if (centerPtInelAlice[i] > 1) widthPtInelAlice[i] = 0.1;
28     if (centerPtInelAlice[i] > 2) widthPtInelAlice[i] = 0.2;
29     if (centerPtInelAlice[i] > 4) widthPtInelAlice[i] = 0.5;
30     if (centerPtInelAlice[i] > 7) widthPtInelAlice[i] = 1.0;
31     
32     ptInelAlice[i]       = centerPtInelAlice[i];
33     errPtInelAlice[i]    = widthPtInelAlice[i] / 2.0;
34     lowPtInelAlice[i]    = centerPtInelAlice[i] - errPtInelAlice[i];
35     highPtInelAlice[i]   = centerPtInelAlice[i] + errPtInelAlice[i];      
36             
37     lowStatInelAlice[i]  = inelAlice[i] - statInelAlice[i];
38     highStatInelAlice[i] = inelAlice[i] + statInelAlice[i];
39     relStatInelAlice[i]  = statInelAlice[i] / inelAlice[i];    
40     lowSystInelAlice[i]  = inelAlice[i] - systInelAlice[i];
41     highSystInelAlice[i] = inelAlice[i] + systInelAlice[i];
42     relSystInelAlice[i]  = systInelAlice[i] / inelAlice[i];    
43     errInelAlice[i]      = systInelAlice[i] + statInelAlice[i];
44     lowErrInelAlice[i]   = inelAlice[i] - errInelAlice[i];
45     highErrInelAlice[i]  = inelAlice[i] + errInelAlice[i];
46     relErrInelAlice[i]   = errInelAlice[i] / inelAlice[i];
47     err2InelAlice[i]     = sqrt(systInelAlice[i]*systInelAlice[i] + statInelAlice[i]*statInelAlice[i]);
48     lowErr2InelAlice[i]  = inelAlice[i] - err2InelAlice[i];
49     highErr2InelAlice[i] = inelAlice[i] + errInelAlice[i];
50     relErr2InelAlice[i]  = err2InelAlice[i] / inelAlice[i];
51     
52     
53     
54     ptInel2PiPtAlice[i]       = ptInelAlice[i];
55     centerPtInel2PiPtAlice[i] = centerPtInelAlice[i];
56     widthPtInel2PiPtAlice[i]  = widthPtInelAlice[i];
57     errPtInel2PiPtAlice[i]    = errPtInelAlice[i];
58     lowPtInel2PiPtAlice[i]    = lowPtInelAlice[i];
59     highPtInel2PiPtAlice[i]   = highPtInelAlice[i];
60
61     inel2PiPtAlice[i]         = inelAlice[i]*centerPtInelAlice[i]*2*M_PI;
62     statInel2PiPtAlice[i]     = statInelAlice[i]*centerPtInelAlice[i]*2*M_PI;
63     lowStatInel2PiPtAlice[i]  = lowStatInelAlice[i]*centerPtInelAlice[i]*2*M_PI;
64     highStatInel2PiPtAlice[i] = highStatInelAlice[i]*centerPtInelAlice[i]*2*M_PI;
65     relStatInel2PiPtAlice[i]  = relStatInelAlice[i];
66     systInel2PiPtAlice[i]     = systInelAlice[i]*centerPtInelAlice[i]*2*M_PI;
67     lowSystInel2PiPtAlice[i]  = lowSystInelAlice[i]*centerPtInelAlice[i]*2*M_PI;
68     highSystInel2PiPtAlice[i] = highSystInelAlice[i]*centerPtInelAlice[i]*2*M_PI;
69     relSystInel2PiPtAlice[i]  = relSystInelAlice[i];
70     errInel2PiPtAlice[i]      = errInelAlice[i]*centerPtInelAlice[i]*2*M_PI;
71     lowErrInel2PiPtAlice[i]   = lowErrInelAlice[i]*centerPtInelAlice[i]*2*M_PI;
72     highErrInel2PiPtAlice[i]  = highErrInelAlice[i]*centerPtInelAlice[i]*2*M_PI;
73     relErrInel2PiPtAlice[i]   = relErrInelAlice[i];
74     err2Inel2PiPtAlice[i]     = err2InelAlice[i]*centerPtInelAlice[i]*2*M_PI;
75     lowErr2Inel2PiPtAlice[i]  = lowErr2InelAlice[i]*centerPtInelAlice[i]*2*M_PI;
76     highErr2Inel2PiPtAlice[i] = highErr2InelAlice[i]*centerPtInelAlice[i]*2*M_PI;
77     relErr2Inel2PiPtAlice[i]  = relErr2InelAlice[i];
78     
79         
80     
81     cout << "ptInelAlice[" << i << "]          = " << ptInelAlice[i] <<endl;
82     cout << "   centerPtInelAlice[" << i << "] = " << centerPtInelAlice[i] <<endl;
83     cout << "   widthPtInelAlice[" << i << "]  = " << widthPtInelAlice[i] <<endl;
84     cout << "   errPtInelAlice[" << i << "]    = " << errPtInelAlice[i] <<endl;
85     cout << "   lowPtInelAlice[" << i << "]    = " << lowPtInelAlice[i] <<endl;
86     cout << "   highPtInelAlice[" << i << "]   = " << highPtInelAlice[i] <<endl;
87     cout << "inelAlice[" << i << "]            = " << inelAlice[i] <<endl;
88     cout << "   statInelAlice[" << i << "]     = " << statInelAlice[i] <<endl;
89     cout << "   lowStatInelAlice[" << i << "]  = " << lowStatInelAlice[i] <<endl;
90     cout << "   highStatInelAlice[" << i << "] = " << highStatInelAlice[i] <<endl;
91     cout << "   relStatInelAlice[" << i << "]  = " << relStatInelAlice[i] <<endl;
92     cout << "   systInelAlice[" << i << "]     = " << systInelAlice[i] <<endl;
93     cout << "   lowSystInelAlice[" << i << "]  = " << lowSystInelAlice[i] <<endl;
94     cout << "   highSystInelAlice[" << i << "] = " << highSystInelAlice[i] <<endl;
95     cout << "   relSystInelAlice[" << i << "]  = " << relSystInelAlice[i] <<endl;
96     cout << "errInelAlice[" << i << "]         = " << errInelAlice[i] <<endl;
97     cout << "   lowErrInelAlice[" << i << "]   = " << lowErrInelAlice[i] <<endl;
98     cout << "   highErrInelAlice[" << i << "]  = " << highErrInelAlice[i] <<endl;
99     cout << "   relErrInelAlice[" << i << "]   = " << relErrInelAlice[i] <<endl;
100     cout << "err2InelAlice[" << i << "]        = " << err2InelAlice[i] <<endl;
101     cout << "   lowErr2InelAlice[" << i << "]  = " << lowErr2InelAlice[i] <<endl;
102     cout << "   highErr2InelAlice[" << i << "] = " << highErr2InelAlice[i] <<endl;
103     cout << "   relErr2InelAlice[" << i << "]  = " << relErr2InelAlice[i] <<endl;
104     cout << endl;
105     /*
106     ptInelAliceFit[i]      = ptInelAlice[i];
107     InelInelAliceFit[i]     = InelInelAlice[i]*ptInelAlice[i];
108     errInelInelAliceFit[i]  = errInelInelAlice[i];
109     widthPtInelAliceFit[i] = widthPtInelAlice[i];
110     errPtInelAliceFit[i]  = 0; //errPtInelAlice[i];
111     lowPtInelAliceFit[i]  = lowPtInelAlice[i];
112     highPtInelAliceFit[i] = highPtInelAlice[i];
113     */
114         
115    i++;
116 } // while(!fileInelAlice.eof())
117 fileInelAlice.close();
118 //if (fileInelAlice) { delete fileInelAlice; }
119 //fileInelAlice=0;
120
121 cout << "================================" << endl;
122 cout << endl;
123 cout << "Finished reading ALICE INEL data" <<endl;
124 cout << "Number of bins read: " << i <<endl;
125 cout << endl;
126 cout << "================================" << endl;
127 cout << endl;
128
129 return i;
130 }