Fix in AliTrackerBase::PropagateTo... routines: length integral was not correctly...
[u/mrichter/AliRoot.git] / PWGUD / dNdPt / macros / plots / readAliceNsd.C
1 Int_t readAliceNsd() 
2 {
3 // read ALICE NSD data from file
4 //
5
6 cout << endl;
7 cout << "================================" << endl;
8 cout << endl;
9 cout << "read ALICE NSD data from file" <<endl;
10 cout << "Number of bins: " << binsNsdAlice <<endl;
11 cout << "Filename:       " << filenameNsdAlice <<endl;
12 cout << endl;
13 cout << "================================" << endl;
14 cout << endl;
15
16 ifstream fileNsdAlice;
17 fileNsdAlice.open(filenameNsdAlice);
18
19 Int_t i = 0;
20 while(!fileNsdAlice.eof()) {
21     if(i == binsNsdAlice) break;
22     // textfile content: pt_bin_center:NSD_yield:errNSD_yield
23     fileNsdAlice >> centerPtNsdAlice[i] >>  nsdAlice[i] >> statNsdAlice[i] >> systNsdAlice[i];
24     //systNsdAlice[i] = 0.15*nsdAlice[i]+1e-7; // sys error has to be provided, currently 10%
25     
26     // the width of the pt bins, currently hardwired....
27     widthPtNsdAlice[i] = 0.05;
28     if (centerPtNsdAlice[i] > 1) widthPtNsdAlice[i] = 0.1;
29     if (centerPtNsdAlice[i] > 2) widthPtNsdAlice[i] = 0.2;
30     if (centerPtNsdAlice[i] > 4) widthPtNsdAlice[i] = 0.5;
31     if (centerPtNsdAlice[i] > 7) widthPtNsdAlice[i] = 1.0;
32     
33     ptNsdAlice[i]       = centerPtNsdAlice[i];
34     errPtNsdAlice[i]    = widthPtNsdAlice[i] / 2.0;
35     lowPtNsdAlice[i]    = centerPtNsdAlice[i] - errPtNsdAlice[i];
36     highPtNsdAlice[i]   = centerPtNsdAlice[i] + errPtNsdAlice[i];      
37             
38     lowStatNsdAlice[i]  = nsdAlice[i] - statNsdAlice[i];
39     highStatNsdAlice[i] = nsdAlice[i] + statNsdAlice[i];
40     relStatNsdAlice[i]  = statNsdAlice[i] / nsdAlice[i];    
41     lowSystNsdAlice[i]  = nsdAlice[i] - systNsdAlice[i];
42     highSystNsdAlice[i] = nsdAlice[i] + systNsdAlice[i];
43     relSystNsdAlice[i]  = systNsdAlice[i] / nsdAlice[i];    
44     errNsdAlice[i]      = systNsdAlice[i] + statNsdAlice[i];
45     lowErrNsdAlice[i]   = nsdAlice[i] - errNsdAlice[i];
46     highErrNsdAlice[i]  = nsdAlice[i] + errNsdAlice[i];
47     relErrNsdAlice[i]   = errNsdAlice[i] / nsdAlice[i];
48     err2NsdAlice[i]     = sqrt(systNsdAlice[i]*systNsdAlice[i] + statNsdAlice[i]*statNsdAlice[i]);
49     lowErr2NsdAlice[i]  = nsdAlice[i] - err2NsdAlice[i];
50     highErr2NsdAlice[i] = nsdAlice[i] + errNsdAlice[i];
51     relErr2NsdAlice[i]  = err2NsdAlice[i] / nsdAlice[i];
52         
53         
54         
55         
56     ptNsd2PiPtAlice[i]       = ptNsdAlice[i];
57     centerPtNsd2PiPtAlice[i] = centerPtNsdAlice[i];
58     widthPtNsd2PiPtAlice[i]  = widthPtNsdAlice[i];
59     errPtNsd2PiPtAlice[i]    = errPtNsdAlice[i];
60     lowPtNsd2PiPtAlice[i]    = lowPtNsdAlice[i];
61     highPtNsd2PiPtAlice[i]   = highPtNsdAlice[i];
62
63     nsd2PiPtAlice[i]         = nsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
64     statNsd2PiPtAlice[i]     = statNsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
65     lowStatNsd2PiPtAlice[i]  = lowStatNsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
66     highStatNsd2PiPtAlice[i] = highStatNsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
67     relStatNsd2PiPtAlice[i]  = relStatNsdAlice[i];
68     systNsd2PiPtAlice[i]     = systNsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
69     lowSystNsd2PiPtAlice[i]  = lowSystNsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
70     highSystNsd2PiPtAlice[i] = highSystNsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
71     relSystNsd2PiPtAlice[i]  = relSystNsdAlice[i];
72     errNsd2PiPtAlice[i]      = errNsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
73     lowErrNsd2PiPtAlice[i]   = lowErrNsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
74     highErrNsd2PiPtAlice[i]  = highErrNsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
75     relErrNsd2PiPtAlice[i]   = relErrNsdAlice[i];
76     err2Nsd2PiPtAlice[i]     = err2NsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
77     lowErr2Nsd2PiPtAlice[i]  = lowErr2NsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
78     highErr2Nsd2PiPtAlice[i] = highErr2NsdAlice[i]*centerPtNsdAlice[i]*2*M_PI;
79     relErr2Nsd2PiPtAlice[i]  = relErr2NsdAlice[i];        
80         
81         
82         
83         
84         
85         
86         
87     
88     cout << "ptNsdAlice[" << i << "]          = " << ptNsdAlice[i] <<endl;
89     cout << "   centerPtNsdAlice[" << i << "] = " << centerPtNsdAlice[i] <<endl;
90     cout << "   widthPtNsdAlice[" << i << "]  = " << widthPtNsdAlice[i] <<endl;
91     cout << "   errPtNsdAlice[" << i << "]    = " << errPtNsdAlice[i] <<endl;
92     cout << "   lowPtNsdAlice[" << i << "]    = " << lowPtNsdAlice[i] <<endl;
93     cout << "   highPtNsdAlice[" << i << "]   = " << highPtNsdAlice[i] <<endl;
94     cout << "nsdAlice[" << i << "]            = " << nsdAlice[i] <<endl;
95     cout << "   statNsdAlice[" << i << "]     = " << statNsdAlice[i] <<endl;
96     cout << "   lowStatNsdAlice[" << i << "]  = " << lowStatNsdAlice[i] <<endl;
97     cout << "   highStatNsdAlice[" << i << "] = " << highStatNsdAlice[i] <<endl;
98     cout << "   relStatNsdAlice[" << i << "]  = " << relStatNsdAlice[i] <<endl;
99     cout << "   systNsdAlice[" << i << "]     = " << systNsdAlice[i] <<endl;
100     cout << "   lowSystNsdAlice[" << i << "]  = " << lowSystNsdAlice[i] <<endl;
101     cout << "   highSystNsdAlice[" << i << "] = " << highSystNsdAlice[i] <<endl;
102     cout << "   relSystNsdAlice[" << i << "]  = " << relSystNsdAlice[i] <<endl;
103     cout << "errNsdAlice[" << i << "]         = " << errNsdAlice[i] <<endl;
104     cout << "   lowErrNsdAlice[" << i << "]   = " << lowErrNsdAlice[i] <<endl;
105     cout << "   highErrNsdAlice[" << i << "]  = " << highErrNsdAlice[i] <<endl;
106     cout << "   relErrNsdAlice[" << i << "]   = " << relErrNsdAlice[i] <<endl;
107     cout << "err2NsdAlice[" << i << "]        = " << err2NsdAlice[i] <<endl;
108     cout << "   lowErr2NsdAlice[" << i << "]  = " << lowErr2NsdAlice[i] <<endl;
109     cout << "   highErr2NsdAlice[" << i << "] = " << highErr2NsdAlice[i] <<endl;
110     cout << "   relErr2NsdAlice[" << i << "]  = " << relErr2NsdAlice[i] <<endl;
111     cout << endl;
112     /*
113     ptNsdAliceFit[i]      = ptNsdAlice[i];
114     NsdNsdAliceFit[i]     = NsdNsdAlice[i]*ptNsdAlice[i];
115     errNsdNsdAliceFit[i]  = errNsdNsdAlice[i];
116     widthPtNsdAliceFit[i] = widthPtNsdAlice[i];
117     errPtNsdAliceFit[i]  = 0; //errPtNsdAlice[i];
118     lowPtNsdAliceFit[i]  = lowPtNsdAlice[i];
119     highPtNsdAliceFit[i] = highPtNsdAlice[i];
120     */
121         
122    i++;
123 } // while(!fileNsdAlice.eof())
124 fileNsdAlice.close();
125 //if (fileNsdAlice) { delete fileNsdAlice; }
126 //fileNsdAlice=0;
127
128 cout << "================================" << endl;
129 cout << endl;
130 cout << "Finished reading ALICE NSD data" <<endl;
131 cout << "Number of bins read: " << i <<endl;
132 cout << endl;
133 cout << "================================" << endl;
134 cout << endl;
135
136 return i;
137 }