]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/SPECTRA/Nuclei/B2/Config.h
fcf75a63d617645ea59f93ea72ec3bbaa0dcefe0
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / Nuclei / B2 / Config.h
1 #ifndef CONFIG_H
2 #define CONFIG_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 // functions for configs
8 // author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
9
10 #include <Riostream.h>
11 #include <TROOT.h>
12 #include <TString.h>
13 #include <TStyle.h>
14 #include <cstdlib>
15
16 namespace B2mult
17 {
18 //
19 // multiplicity classes
20 //
21         const Int_t kNmult = 6;
22         const TString kMultClass[kNmult]   = { "nch0002", "nch0204", "nch0408", "nch0811", "nch1120", "nch20xx" };
23         const Double_t kKNOmult[kNmult]    = { 0.20, 0.60, 1.01, 1.60, 2.60, 4.35 };
24         const Double_t kKNOmultErr[kNmult] = { 0, 0, 0, 0, 0, 0 };
25 };
26
27 Double_t GetVertexCorrection(const TString& period)
28 {
29 //
30 // vertex correction factor for |Vz| < 10 cm and LHC12a5x simulations
31 //
32         TString name = period;
33         name.ToLower();
34         
35         if(name == "lhc10c900")   return 1.0142;
36         if(name == "lhc10b")      return 1.0006;
37         if(name == "lhc10c")      return 1.0007;
38         if(name == "lhc10d")      return 1.0224;
39         if(name == "lhc10e")      return 1.0423;
40         if(name == "lhc11a_wsdd") return 1.0728;
41         
42         return 1;
43 }
44
45 TString GetCollSystem(const TString& period)
46 {
47 //
48 // translate period name into colliding system name
49 //
50         TString name = period;
51         name.ToLower();
52         
53         if(name == "lhc10c900")    return "pp0.9TeV";
54         if(name == "lhc10b_pass2") return "pp7TeV";
55         if(name == "lhc10c_pass2") return "pp7TeV";
56         if(name == "lhc10b")       return "pp7TeV";
57         if(name == "lhc10c")       return "pp7TeV";
58         if(name == "lhc10d")       return "pp7TeV";
59         if(name == "lhc10e")       return "pp7TeV";
60         if(name.Contains("lhc10")) return "pp7TeV";
61         if(name == "lhc11a_wsdd")  return "pp2.76TeV";
62         if(name == "lhc11a_wosdd") return "pp2.76TeV";
63         if(name.Contains("900"))   return "pp0.9TeV";
64         if(name.Contains("7000"))  return "pp7TeV";
65         if(name.Contains("2760"))  return "pp2.76TeV";
66         
67         return "unknown";
68 }
69
70 void GetInelXSection(Double_t xsection[3], const TString& period)
71 {
72 //
73 // inelastic cross section in mb and largest stat. and syst error
74 // measured by ALICE for the given colliding system
75 // http://arxiv.org/abs/1208.4968
76 //
77         TString collsystem = GetCollSystem(period);
78         
79         if( collsystem == "pp0.9TeV" )
80         {
81                 xsection[0] = 50.3;
82                 xsection[1] = 0.4;
83                 xsection[2] = 1.0;
84         }
85         else if( collsystem == "pp2.76TeV" )
86         {
87                 xsection[0] = 62.8;
88                 xsection[1] = 4.0;
89                 xsection[2] = 4.6;
90         }
91         else if( collsystem == "pp7TeV" )
92         {
93                 xsection[0] = 73.2;
94                 xsection[1] = 1.2;
95                 xsection[2] = 2.6;
96         }
97         else
98         {
99                 std::cerr << "Warning: unknown colliding system " << collsystem << " for period " << period << std::endl;
100         }
101 }
102
103 void GetTriggerEfficiency(Double_t trigeff[3], const TString& trigname, const TString& period)
104 {
105 //
106 // trigger efficiency for the given colliding system and largest stat. and syst. errors
107 // http://arxiv.org/abs/1208.4968
108 //
109         TString collsystem = GetCollSystem(period);
110         TString trigger = trigname;
111         trigger.ToLower();
112         
113         if( trigger == "mbor"  && collsystem == "pp0.9TeV" )
114         {
115                 trigeff[0] = 0.910;
116                 trigeff[1] = 0; // stat. error
117                 trigeff[2] = 0.032; // syst. error
118         }
119         else if( trigger == "mbor"  && collsystem == "pp2.76TeV")
120         {
121                 trigeff[0] = 0.881;
122                 trigeff[1] = 0;
123                 trigeff[2] = 0.059;
124         }
125         else if( trigger == "mbor"  && collsystem == "pp7TeV")
126         {
127                 trigeff[0] = 0.852;
128                 trigeff[1] = 0;
129                 trigeff[2] = 0.062;
130         }
131         else if( trigger == "mband" && collsystem == "pp0.9TeV" )
132         {
133                 trigeff[0] = 0.763;
134                 trigeff[1] = 0;
135                 trigeff[2] = 0.022;
136         }
137         else if( trigger == "mband" && collsystem == "pp2.76TeV")
138         {
139                 trigeff[0] = 0.760;
140                 trigeff[1] = 0;
141                 trigeff[2] = 0.052;
142         }
143         else if( trigger == "mband" && collsystem == "pp7TeV")
144         {
145                 trigeff[0] = 0.742;
146                 trigeff[1] = 0;
147                 trigeff[2] = 0.050;
148         }
149         else
150         {
151                 std::cerr << "Warning: unknown trigger/colliding system " << trigname << "/" << collsystem << " for period " << period << std::endl;
152         }
153 }
154
155 TString GetSimuPeriod(const TString& period)
156 {
157 //
158 // simulation code for the given period
159 //
160         TString name = period;
161         name.ToLower();
162         
163         if(period=="lhc10c900")   return "lhc10e13";
164         if(period=="lhc10b")      return "lhc10d1";
165         if(period=="lhc10c")      return "lhc10d4";
166         //if(period=="lhc10b")      return "lhc12a5bb";
167         //if(period=="lhc10c")      return "lhc12a5bc";
168         if(period=="lhc10d")      return "lhc10f6a";
169         if(period=="lhc10e")      return "lhc10e21";
170         if(period=="lhc11a_wsdd") return "lhc11e3a_wsdd";
171         
172         return "";
173 }
174
175 TString GetSimuFixPeriod(const TString& period)
176 {
177 //
178 // simulation fix code for the given period
179 //
180         TString name = period;
181         name.ToLower();
182         
183         if(period=="lhc10c900")   return "lhc12a5a";
184         if(period=="lhc10b")      return "lhc12a5bb";
185         if(period=="lhc10c")      return "lhc12a5bc";
186         if(period=="lhc10d")      return "lhc12a5bd";
187         if(period=="lhc10e")      return "lhc12a5be";
188         if(period=="lhc10bcde")   return "lhc12a5b";
189         if(period=="lhc11a_wsdd") return "lhc12a5c_wsdd";
190         
191         return "";
192 }
193
194 TString MakeInputName(const TString& species, const TString& period, const TString& trksel)
195 {
196 //
197 // make input name for data
198 //
199         return species + "-" + period + "-" + trksel;
200 }
201
202 TString MakeSimuName(const TString& species, const TString& period, const TString& trksel)
203 {
204 //
205 // make input name for simulation
206 //
207         TString simu = (species == "Proton") ? GetSimuPeriod(period) : GetSimuFixPeriod(period);
208         
209         if(simu=="")
210         {
211                 std::cerr << "No simulation for period: " << period << std::endl;
212                 exit(1);
213         }
214         
215         return species + "-" + simu + "-" + trksel;
216 }
217
218 TString MakeSimuFixName(const TString& species, const TString& period, const TString& trksel, Bool_t g3Fluka=0)
219 {
220 //
221 // make input name for simulation fix
222 //
223         TString simufix = (species == "Proton" && g3Fluka) ? GetSimuPeriod(period) : GetSimuFixPeriod(period);
224         
225         if(simufix=="")
226         {
227                 std::cerr << "No simulation fix for period: " << period << std::endl;
228                 exit(1);
229         }
230         
231         return species + "-" + simufix + "-" + trksel;
232 }
233
234 TString MakeOutputName(const TString& species, const TString& outputTag)
235 {
236 //
237 // make output name
238 //
239         return species + "-" + outputTag;
240 }
241
242 TStyle* GetDrawingStyle()
243 {
244 //
245 // define a default style for drawing
246 //
247         TStyle* st = new TStyle();
248         
249         //st->SetPalette(51);
250         st->SetPalette(1);
251         st->SetPadTickX(1);
252         st->SetPadTickY(1);
253         st->SetPadGridX(1);
254         st->SetPadGridY(1);
255         
256         st->SetCanvasColor(0);
257         st->SetFrameBorderMode(0);
258         st->SetStatBorderSize(1);
259         st->SetStatColor(0);
260         st->SetFrameFillColor(0);
261         st->SetTitleFillColor(0);
262         st->SetLabelFont(62,"XYZ");
263         st->SetTitleFont(62,"XYZ");
264         
265         //st->SetOptTitle(1);
266         st->SetOptStat(0);
267         
268         return st;
269 }
270
271 void DrawOutputCorr(const TString& species, const TString& corr, const TString& tag="")
272 {
273 //
274 // draw corrections for the given species
275 //
276         gROOT->ProcessLine(Form(".x DrawCorr.C+g(\"%s\",\"%s\",\"%s\")", species.Data(), corr.Data(), tag.Data()));
277 }
278
279 void DrawCorrDebug(const TString& sec, const TString& tag, const TString& species, Int_t lowbin=1, Int_t hibin=10, Double_t dcaxyMin=-1.5, Double_t dcaxyMax=1.5)
280 {
281 //
282 // draw correction for secondaries
283 //
284         const TString kParticle[] = { species, Form("Anti%s", species.Data())};
285         
286         for(Int_t i=0; i<2; ++i)
287         {
288                 gROOT->ProcessLine(Form(".x DrawSec.C+g(\"%s\",\"%s\",\"%s\", %d, %d, %f, %f)", sec.Data(), tag.Data(), kParticle[i].Data(), lowbin, hibin, dcaxyMin, dcaxyMax));
289         }
290 }
291
292 void DrawPtDebug(const TString& pt, const TString& tag, const TString& species, Bool_t m2pid=0, Int_t lowm2bin=9, Int_t him2bin=17)
293 {
294 //
295 // draw pt debug for the particle species
296 //
297         const TString kParticle[] = { species, Form("Anti%s", species.Data())};
298         
299         for(Int_t i=0; i<2; ++i)
300         {
301                 gROOT->ProcessLine(Form(".x DrawPt.C+g(\"%s\",\"%s\",\"%s\",%d,%d, %d)", pt.Data(), tag.Data(), kParticle[i].Data(), m2pid, lowm2bin, him2bin));
302         }
303 }
304
305 void DrawOutputRatio(const TString& ratio, const TString& tag, const TString& species)
306 {
307 //
308 // draw ratio antiparticle/particle
309 //
310         gROOT->ProcessLine(Form(".x DrawRatio.C+g(\"%s\",\"%s\",\"%s\")", ratio.Data(), tag.Data(), species.Data()));
311 }
312
313 void DrawOutputSpectra(const TString& spectra, const TString& tag, const TString& species)
314 {
315 //
316 // draw spectra for the particle species
317 //
318         const TString kParticle[] = { species, Form("Anti%s", species.Data())};
319         
320         for(Int_t i=0; i<2; ++i)
321         {
322                 gROOT->ProcessLine(Form(".x DrawSpectra.C+g(\"%s\",\"%s\",\"%s\")", spectra.Data(), tag.Data(), kParticle[i].Data()));
323         }
324 }
325
326 void DrawOutputSpectraMult(const TString& spectra, const TString& species, Double_t ymin, Double_t ymax, Int_t option=0, const TString& refdir="")
327 {
328 //
329 // draw spectra for each multiplicity class
330 //
331         const TString kParticle[] = { species, Form("Anti%s", species.Data())};
332         
333         for(Int_t i=0; i<2; ++i)
334         {
335                 gROOT->ProcessLine(Form(".x DrawDir.C+g(\"%s\",\"%s_InvDiffYield_Pt\",\"%s\",0,4.5, %g, %g, \"p_{T} (GeV/c)\", \"#frac{1}{2#piN_{inel}} #frac{d^{2}N}{p_{T}dp_{T}dy} (GeV^{-2}c^{3})\", %d, \"c%d\",\"%s\")", spectra.Data(), kParticle[i].Data(), refdir.Data(),ymin, ymax, option, i, kParticle[i].Data()));
336         }
337 }
338
339 #endif // CONFIG_H