AliPhysics  32b88a8 (32b88a8)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MakeStrange.C
Go to the documentation of this file.
1 void
3 {
4  gSystem->AddIncludePath("-I${ALICE_ROOT}/include -I${ALICE_PHYSICS}/include");
5  gROOT->LoadMacro("AliAODTracklet.C+g");
6  gROOT->LoadMacro("AliTrackletWeights.C+g");
7 
9 
10  Double_t c2Bins[] = { 0, 2.5, 5, 7.5, 10, 20, 30,
11  40, 50, 60, 70, 80, 90, 100 };
12 
13  TFile* pidFile = TFile::Open("../tracklets/REWEIGHTpid.root","READ");
14  Double_t c2Bins[] = { 0, 2.5, 5, 7.5, 10, 20, 30,
15  40, 50, 60, 70, 80, 90, 100 };
16  Short_t pids[] = { 321 };
17  for (Int_t i = 0; i < 1; i++) {
18  TString histName;
19  Short_t pdg = pids[i];
20  histName.Form("pidWeight_%s", (pdg == 211 ? "pi" :
21  pdg == 321 ? "ka" :
22  "pr"));
23  TH1* hist = static_cast<TH1*>(pidFile->Get(histName));
24  if (!hist) {
25  Warning("MakeWeight", "pid histogram %s not found", histName.Data());
26  continue;
27  }
28  TH1D* out = new TH1D(Form("w%d", pdg), Form("PID %d weight", pdg),
29  13, c2Bins);
30  for (Int_t j = 1; j <= out->GetNbinsX(); j++) {
31  out->SetBinContent(j, hist->GetBinContent(j));
32  out->SetBinError (j, hist->GetBinError (j));
33  }
34  weights->AddAbundanceWeight(pdg, out);
35  }
36 
37  TFile* strFile = TFile::Open("../tracklets/REWEIGHTstr.root","READ");
38  Short_t strs[] = { 321, 310, 3122, 3212, 3322 };
39  for (Int_t i = 0; i < 5; i++) {
40  TString histName;
41  Short_t pdg = strs[i];
42  histName.Form("strWeight_%s", (pdg == 211 ? "pi" :
43  pdg == 321 ? "ka" :
44  pdg == 2212 ? "pr" :
45  pdg == 310 ? "k0" :
46  pdg == 3122 ? "la" :
47  pdg == 3212 ? "si" :
48  pdg == 3322 ? "xi" : ""));
49  TH1* hist = static_cast<TH1*>(strFile->Get(histName));
50  if (!hist) {
51  Warning("MakeWeight", "strangeness histogram %s not found",
52  histName.Data());
53  continue;
54  }
55  TH1D* out = new TH1D(Form("w%d", pdg), Form("Strangeness %d weight", pdg),
56  13, c2Bins);
57  for (Int_t j = 1; j <= out->GetNbinsX(); j++) {
58  out->SetBinContent(j, hist->GetBinContent(j));
59  out->SetBinError (j, hist->GetBinError (j));
60  }
61  weights->AddStrangenessWeight(pdg, out);
62  }
63 
64 
65 
66 
67  new TBrowser;
68 
69  TFile* outW = TFile::Open("str.root", "RECREATE");
70  weights->Write();
71  outW->Write();
72  weights->Draw();
73  weights->Print();
74 }
Int_t pdg
void MakeStrange()
Definition: MakeStrange.C:2
double Double_t
Definition: External.C:58
Bool_t AddAbundanceWeight(Short_t pdg, const TH1D *h, UShort_t mode=0)
Bool_t AddStrangenessWeight(Short_t pdg, const TH1D *h, UShort_t mode=0)
TSystem * gSystem
void Print(Option_t *option="") const
void Draw(Option_t *option="")
int Int_t
Definition: External.C:63
Definition: External.C:212
short Short_t
Definition: External.C:23
Definition: External.C:196