AliPhysics  ec7afe5 (ec7afe5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MakeStrange.C
Go to the documentation of this file.
1 
22 void
24 {
25  gSystem->AddIncludePath("-I${ALICE_ROOT}/include -I${ALICE_PHYSICS}/include");
26  gROOT->LoadMacro("AliAODTracklet.C+g");
27  gROOT->LoadMacro("AliTrackletWeights.C+g");
28 
30 
31  Double_t c2Bins[] = { 0, 2.5, 5, 7.5, 10, 20, 30,
32  40, 50, 60, 70, 80, 90, 100 };
33 
34  TFile* pidFile = TFile::Open("../tracklets/REWEIGHTpid.root","READ");
35  Double_t c2Bins[] = { 0, 2.5, 5, 7.5, 10, 20, 30,
36  40, 50, 60, 70, 80, 90, 100 };
37  Short_t pids[] = { 321 };
38  for (Int_t i = 0; i < 1; i++) {
39  TString histName;
40  Short_t pdg = pids[i];
41  histName.Form("pidWeight_%s", (pdg == 211 ? "pi" :
42  pdg == 321 ? "ka" :
43  "pr"));
44  TH1* hist = static_cast<TH1*>(pidFile->Get(histName));
45  if (!hist) {
46  Warning("MakeWeight", "pid histogram %s not found", histName.Data());
47  continue;
48  }
49  TH1D* out = new TH1D(Form("w%d", pdg), Form("PID %d weight", pdg),
50  13, c2Bins);
51  for (Int_t j = 1; j <= out->GetNbinsX(); j++) {
52  out->SetBinContent(j, hist->GetBinContent(j));
53  out->SetBinError (j, hist->GetBinError (j));
54  }
55  weights->AddAbundanceWeight(pdg, out);
56  }
57 
58  TFile* strFile = TFile::Open("../tracklets/REWEIGHTstr.root","READ");
59  Short_t strs[] = { 321, 310, 3122, 3112, 3222, 3312 /* 3212, 3322 */};
60  for (Int_t i = 0; i < 6; i++) {
61  TString histName;
62  Short_t pdg = strs[i];
63  histName.Form("strWeight_%s", (pdg == 211 ? "pi" :
64  pdg == 321 ? "ka" :
65  pdg == 2212 ? "pr" :
66  pdg == 310 ? "k0" :
67  pdg == 3122 ? "la" :
68  pdg == 3112 ? "si" :
69  pdg == 3222 ? "si" :
70  pdg == 3212 ? "si" :
71  pdg == 3312 ? "xi" :
72  pdg == 3322 ? "xi" : ""));
73  TH1* hist = static_cast<TH1*>(strFile->Get(histName));
74  if (!hist) {
75  Warning("MakeWeight", "strangeness histogram %s not found",
76  histName.Data());
77  continue;
78  }
79  TH1D* out = new TH1D(Form("w%d", pdg), Form("Strangeness %d weight", pdg),
80  13, c2Bins);
81  for (Int_t j = 1; j <= out->GetNbinsX(); j++) {
82  out->SetBinContent(j, hist->GetBinContent(j));
83  out->SetBinError (j, hist->GetBinError (j));
84  }
85  weights->AddStrangenessWeight(pdg, out);
86  }
87 
88 
89 
90 
91  new TBrowser;
92 
93  TFile* outW = TFile::Open("str.root", "RECREATE");
94  weights->Write();
95  outW->Write();
96  weights->Draw();
97  weights->Print();
98 }
99 /* @} */
100 //
101 // EOF
102 //
Int_t pdg
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