]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/SPECTRA/Nuclei/B2/macros/LHC10xMult.C
rewrite d/p ratio and simplify some macros
[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
4ea666e1 39// if option = 2 then use Config_TPCTOF
2403d402 40//
df36ebb5 41 const Bool_t kINEL[kNmult] = { 1, 0 }; // only normalize first bin
42
43 Int_t lowbin = (species=="Proton") ? 5 : 4;
44 Int_t jointbin = (species=="Proton") ? 11 : 6;
45 Int_t hibin = (species=="Proton") ? 31 : 12;
46
47 Double_t ymin = (species=="Proton") ? 1.1e-6 : 1.1e-8;
48 Double_t ymax = (species=="Proton") ? 4.e-1 : 4.e-4;
49
2403d402 50 using namespace B2mult;
51 using namespace std;
52
df36ebb5 53 if( (option<0) || (option>2) || ((species != "Proton") && (species != "Deuteron")))
54 {
55 cerr << "unknown species/option: " << species << "/" << option << endl;
56 cerr << "species: Proton or Deuteron, options: 0 (TPC), 1 (TOF), 2 (TPCTOF)" << endl;
57 exit(1);
58 }
2403d402 59
60 TFileMerger m1,m2;
61
62 TString ratio[kNmult];
63 TString spectra[kNmult];
64
65 for(Int_t i=0; i<kNmult; ++i)
66 {
67 cout << endl;
68 cout << "Multiplicity class : " << kMultClass[i] << endl;
69 cout << "Period : " << period << endl;
70
71 TString outputTag = period + "-" + kMultClass[i];
72
73 TString arg = inputDir + "\","
74 + "\"" + outputDir + "\","
75 + "\"" + period + "\","
76 + "\"" + outputTag + "\","
77 + "\"" + "-" + kMultClass[i] + "\"," // data
78 + "\"" + ""; // same simulations for all mult
79
df36ebb5 80 switch(option)
2403d402 81 {
df36ebb5 82 case 0:
83 cout << "Config_" << species << "_TPC_LHC10x.C" << endl << endl;
84 gROOT->ProcessLine(Form(".x Config_%s_TPC_LHC10x.C+g(\"%s\", %d, 0)", species.Data(), arg.Data(), kINEL[i]));
85 break;
86 case 1:
87 cout << "Config_" << species << "_LHC10x.C" << endl << endl;
88 gROOT->ProcessLine(Form(".x Config_%s_TOF_LHC10x.C+g(\"%s\", %d, 0)", species.Data(), arg.Data(), kINEL[i]));
89 break;
90 case 2:
91 cout << "Config_TPCTOF_LHC10x.C" << endl << endl;
92 gROOT->ProcessLine(Form(".x Config_TPCTOF_LHC10x.C+g(\"%s\", %d, 0, \"%s\", %d, %d, %d)", arg.Data(), kINEL[i], species.Data(), lowbin, jointbin, hibin));
93 break;
2403d402 94 }
95
96 ratio[i] = outputDir + "/" + species + "-" + outputTag + "-Ratio.root";
97 spectra[i] = outputDir + "/" + species + "-" + outputTag + "-Spectra.root";
98
99 m1.AddFile(ratio[i].Data(),0);
100 m2.AddFile(spectra[i].Data(),0);
101 }
102
103 // merge
104
105 TString allRatios = outputDir + "/" + species + "-" + period + "-Mult-Ratio.root";
106 TString allSpectra = outputDir + "/" + species + "-" + period + "-Mult-Spectra.root";
107
108 m1.OutputFile(allRatios.Data());
109 m2.OutputFile(allSpectra.Data());
110
111 m1.Merge();
112 m2.Merge();
113
114 // delete tmp files
115
116 for(Int_t i=0; i<kNmult; ++i)
117 {
118 gSystem->Exec(Form("rm -f %s", ratio[i].Data()));
119 gSystem->Exec(Form("rm -f %s", spectra[i].Data()));
120 }
121
122 // draw output
123
124 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()));
125
126 DrawOutputSpectraMult(allSpectra, species, ymin, ymax);
127
128 return 0;
129}