]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/SPECTRA/Nuclei/B2/macros/LHC10xMult.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / Nuclei / B2 / macros / LHC10xMult.C
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 #if !defined(__CINT__) || defined(__MAKECINT__)
20 #include <TSystem.h>
21 #include <TROOT.h>
22 #include <TString.h>
23 #include <TFileMerger.h>
24 #include "AliLnDriver.h"
25 #endif
26
27 #include "Config.h"
28
29 Int_t LHC10xMult(  const TString& species   = "Deuteron"
30                  , const TString& inputDir  = "~/alice/input"
31                  , const TString& outputDir = "~/alice/output"
32                  , const TString& period    = "lhc10d"
33                  , const TString& otag      = "lhc10d"
34                  , const TString& trkselTag = "-tpc3-nsd-moc"
35                  , Double_t       ymax      = 0.5
36                  , Int_t          option    = 2)
37 {
38 //
39 // lhc10x multiplicity config
40 // call Config_XXX for each multiplicity class
41 //
42 // if option = 0 then use Config_XXX_TPC
43 // if option = 1 then use Config_XXX_TOF
44 // if option = 2 then use Config_TPCTOF
45 //
46         using namespace B2mult;
47         using namespace std;
48         
49         const Bool_t  kINEL[kNmult] = { 0 };
50         
51         Double_t ptmin   = (species=="Proton") ? 0.4 : 0.7;
52         Double_t ptjoint = (species=="Proton") ? 1.0 : 1.0;
53         Double_t ptmax   = (species=="Proton") ? 2.0 : 2.5;
54         Double_t ptpid   = (species=="Proton") ? 0.4 : 1.3;
55         
56         if( (option<0) || (option>2) || ((species != "Proton") && (species != "Deuteron")))
57         {
58                 cerr << "unknown species/option: " << species << "/" << option << endl;
59                 cerr << "species: Proton or Deuteron, options: 0 (TPC), 1 (TOF), 2 (TPCTOF)" << endl;
60                 exit(1);
61         }
62         
63         TFileMerger m1,m2;
64         
65         TString ratio[kNmult];
66         TString spectra[kNmult];
67         
68         for(Int_t i=0; i<kNmult; ++i)
69         {
70                 // limit the ptmax value for deuterons
71                 if(species == "Deuteron") ptmax = kDtrPtMax[i];
72                 
73                 cout << endl;
74                 cout << "Multiplicity class : " << kMultTag[i] << endl;
75                 cout << "Period             : " << period << endl;
76                 
77                 TString outputTag = otag + kMultTag[i];
78                 
79                 TString arg =          inputDir    + "\","
80                               + "\"" + outputDir   + "\","
81                               + "\"" + period      + "\","
82                               + "\"" + outputTag   + "\","
83                               + "\"" + trkselTag   + "\","
84                               + "\"" + kMultTag[i] + "\"," // data
85                               + "\"" + "";          // same simulations for all mult
86                         
87                 switch(option)
88                 {
89                         case 0:
90                                 cout << "Config_" << species << "_TPC_LHC10x.C" << endl << endl;
91                                 gROOT->ProcessLine(Form(".x Config_%s_TPC_LHC10x.C+g(\"%s\", %f, %d, 0, %f, %f)", species.Data(), arg.Data(), ymax, kINEL[i], ptmin, ptmax));
92                                 break;
93                         case 1:
94                                 cout << "Config_" << species << "_LHC10x.C" << endl << endl;
95                                 gROOT->ProcessLine(Form(".x Config_%s_TOF_LHC10x.C+g(\"%s\", %f, %d, 0, %f, %f, %f)", species.Data(), arg.Data(), ymax, kINEL[i], ptmin, ptmax, ptpid));
96                                 break;
97                         case 2:
98                                 cout << "Config_TPCTOF_LHC10x.C" << endl << endl;
99                                 gROOT->ProcessLine(Form(".x Config_TPCTOF_LHC10x.C+g(\"%s\", %f, %d, 0, \"%s\", %f, %f, %f, %f)", arg.Data(), ymax, kINEL[i], species.Data(), ptmin, ptjoint, ptmax, ptpid));
100                                 break;
101                 }
102                 
103                 ratio[i]   = outputDir + "/" + species + "-" + outputTag + "-Ratio.root";
104                 spectra[i] = outputDir + "/" + species + "-" + outputTag + "-Spectra.root";
105                 
106                 m1.AddFile(ratio[i].Data(),0);
107                 m2.AddFile(spectra[i].Data(),0);
108         }
109         
110         // merge
111         
112         TString allRatios  = outputDir + "/" + species + "-" + otag + "-Mult-Ratio.root";
113         TString allSpectra = outputDir + "/" + species + "-" + otag + "-Mult-Spectra.root";
114         
115         m1.OutputFile(allRatios.Data());
116         m2.OutputFile(allSpectra.Data());
117         
118         m1.Merge();
119         m2.Merge();
120         
121         // delete tmp files
122         
123         for(Int_t i=0; i<kNmult; ++i)
124         {
125                 gSystem->Exec(Form("rm -f %s", ratio[i].Data()));
126                 gSystem->Exec(Form("rm -f %s", spectra[i].Data()));
127         }
128         
129         // draw output
130         
131         gROOT->ProcessLine(Form(".x DrawDir.C+g(\"%s\",\"Anti%s%s_Ratio_Pt\",\"\",0,4.5, 0., 1.8, \"#it{p}_{T} (GeV/c)\", \"#bar{p}/p\", 0, \"cRatio\",\"Particle ratio\")", allRatios.Data(),species.Data(),species.Data()));
132         
133         Double_t minYield = (species=="Proton") ? 1.1e-6 : 1.1e-8;
134         Double_t maxYield = (species=="Proton") ? 4.e-1  : 7.e-4;
135         
136         DrawOutputSpectraMult(allSpectra, species, minYield, maxYield);
137         
138         return 0;
139 }