fix config name
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / Nuclei / B2 / macros / LHC10xMult.C
CommitLineData
2403d402 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16// LHC10x multiplicity config for protons and deuterons
17// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
18
19#include <TSystem.h>
20#include <TROOT.h>
21#include <TString.h>
22#include <TFileMerger.h>
23
24#include "AliLnDriver.h"
25#include "Config.h"
26
fe25d981 27Int_t LHC10xMult(const TString& species = "Proton",
2403d402 28 const TString& inputDir = "~/alice/input",
29 const TString& outputDir = "~/alice/output",
30 const TString& period = "lhc10d",
31 Int_t option = 2)
32{
33//
34// lhc10x multiplicity config
35// call Config_XXX for each multiplicity class
36//
fe25d981 37// if option = 0 then use Config_XXX_TPC
38// if option = 1 then use Config_XXX_TOF
39// if option = 2 then use Config_XXX_TPCTOF
2403d402 40//
41 using namespace B2mult;
42 using namespace std;
43
44 const Bool_t kNormToInel[kNmult] = { 1, 0 }; // only normalize first bin
45
46 Double_t ymin = (species=="Proton") ? 1.1e-6 : 1.1e-8;
47 Double_t ymax = (species=="Proton") ? 4.e-1 : 4.e-4;
48
49 TFileMerger m1,m2;
50
51 TString ratio[kNmult];
52 TString spectra[kNmult];
53
54 for(Int_t i=0; i<kNmult; ++i)
55 {
56 cout << endl;
57 cout << "Multiplicity class : " << kMultClass[i] << endl;
58 cout << "Period : " << period << endl;
59
60 TString outputTag = period + "-" + kMultClass[i];
61
62 TString arg = inputDir + "\","
63 + "\"" + outputDir + "\","
64 + "\"" + period + "\","
65 + "\"" + outputTag + "\","
66 + "\"" + "-" + kMultClass[i] + "\"," // data
67 + "\"" + ""; // same simulations for all mult
68
69 if(species=="Proton" && option==0)
70 {
71 cout << "Config_Proton_TPC_LHC10x.C" << endl << endl;
72 gROOT->ProcessLine(Form(".x Config_Proton_TPC_LHC10x.C+g(\"%s\",%d,0)", arg.Data(), kNormToInel[i]));
73 }
74 else if(species=="Proton" && option==1)
75 {
76 cout << "Config_Proton_TOF_LHC10x.C" << endl << endl;
77 gROOT->ProcessLine(Form(".x Config_Proton_TOF_LHC10x.C+g(\"%s\",%d,0)", arg.Data(), kNormToInel[i]));
78 }
79 else if(species=="Proton" && option==2)
80 {
81 cout << "Config_Proton_TPCTOF_LHC10x.C" << endl << endl;
82 gROOT->ProcessLine(Form(".x Config_Proton_TPCTOF_LHC10x.C+g(\"%s\",%d,0)", arg.Data(), kNormToInel[i]));
83 }
fe25d981 84 else if(species=="Deuteron" && option==0)
85 {
86 cout << "Config_Deuteron_TPC_LHC10x.C" << endl << endl;
8d68040f 87 gROOT->ProcessLine(Form(".x Config_Deuteron_TPC_LHC10x.C+g(\"%s\",%d,0)", arg.Data(), kNormToInel[i]));
fe25d981 88 }
89 else if(species=="Deuteron" && option==1)
2403d402 90 {
91 cout << "Config_Deuteron_TOF_LHC10x.C" << endl << endl;
92 gROOT->ProcessLine(Form(".x Config_Deuteron_TOF_LHC10x.C+g(\"%s\",%d,0)", arg.Data(), kNormToInel[i]));
93 }
fe25d981 94 else if(species=="Deuteron" && option==2)
95 {
96 cout << "Config_Deuteron_TPCTOF_LHC10x.C" << endl << endl;
97 gROOT->ProcessLine(Form(".x Config_Deuteron_TPCTOF_LHC10x.C+g(\"%s\",%d,0)", arg.Data(), kNormToInel[i]));
98 }
2403d402 99 else
100 {
101 cerr << "unknown species/option: " << species << "/" << option << endl;
102 cerr << "usage: Proton/0, Proton/1, Proton/2 or Deuteron" << endl;
103 exit(1);
104 }
105
106 ratio[i] = outputDir + "/" + species + "-" + outputTag + "-Ratio.root";
107 spectra[i] = outputDir + "/" + species + "-" + outputTag + "-Spectra.root";
108
109 m1.AddFile(ratio[i].Data(),0);
110 m2.AddFile(spectra[i].Data(),0);
111 }
112
113 // merge
114
115 TString allRatios = outputDir + "/" + species + "-" + period + "-Mult-Ratio.root";
116 TString allSpectra = outputDir + "/" + species + "-" + period + "-Mult-Spectra.root";
117
118 m1.OutputFile(allRatios.Data());
119 m2.OutputFile(allSpectra.Data());
120
121 m1.Merge();
122 m2.Merge();
123
124 // delete tmp files
125
126 for(Int_t i=0; i<kNmult; ++i)
127 {
128 gSystem->Exec(Form("rm -f %s", ratio[i].Data()));
129 gSystem->Exec(Form("rm -f %s", spectra[i].Data()));
130 }
131
132 // draw output
133
134 gROOT->ProcessLine(Form(".x DrawDir.C+g(\"%s\",\"Anti%s%s_Ratio_Pt\",\"\",0,4.5, 0., 1.8, \"p_{T} (GeV/c)\", \"#bar{p}/p\", 0, \"cRatio\",\"Particle ratio\")", allRatios.Data(),species.Data(),species.Data()));
135
136 DrawOutputSpectraMult(allSpectra, species, ymin, ymax);
137
138 return 0;
139}