44 const char* simFileName,
50 if (!(realFile =
OpenFile(realFileName)))
return 0;
51 if (!(simFile =
OpenFile(simFileName)))
return 0;
54 const char* base =
"MidRapidity";
58 realTop =
GetC(realFile, Form(
"%sMCResults", base));
61 "*********************************************\n"
62 "* Testing MC vs. MC: *\n"
63 "* 'Data' file: %23s *\n"
64 "* Simulation file: %23s *\n"
65 "*********************************************\n",
66 realFileName, simFileName);
69 outName.Append(
gSystem->BaseName(realFileName));
70 outName.ReplaceAll(
".root",
"");
72 outName.ReplaceAll(
".root",
"");
73 outName.Prepend(
"delta_");
74 outName.Append(
".root");
76 TH1* realCent =
GetH1(realTop,
"cent");
77 TH1* simCent =
GetH1(simTop,
"cent");
78 TH1* realIPz =
GetH1(realTop,
"ipz");
83 Warning(
"Post",
"Centrality bins are incompatible, giving up");
87 Warning(
"Post",
"IPz bins are incompatible, giving up");
91 TFile* out = TFile::Open(outName,
"RECREATE");
98 for (
Int_t i = 1; i <= realCent->GetNbinsX(); i++) {
99 Double_t c1 = realCent->GetXaxis()->GetBinLowEdge(i);
100 Double_t c2 = realCent->GetXaxis()->GetBinUpEdge (i);
102 ProcessBin(i, dimen, scaleToTail, c1, c2, realTop, simTop, weights);
107 Printf(
"Output writtten to %s", outName.Data());
118 for (
Int_t i = 1; i <= h->GetNbinsX(); i++) {
119 for (
Int_t j = 1; j <= h->GetNbinsZ(); j++) {
121 TH1* tmp = h->ProjectionY(Form(
"%s_%02d_%02d",
125 tmp->SetDirectory(0);
127 if (intg > 1e-3) tmp->Scale(tmp->GetNbinsX()*1./intg);
129 for (
Int_t k = 1; k <= h->GetNbinsY(); k++) {
130 h->SetBinContent(i, k, j, tmp->GetBinContent(k));
131 h->SetBinError (i, k, j, tmp->GetBinError (k));
150 TH1* realDelta =
GetH1(realMeas,
"delta");
151 TH1* simDelta =
GetH1(simMeas,
"delta");
160 Scale(simDelta, scale, scaleE);
163 TH1* ratio =
static_cast<TH1*
>(realDelta->Clone(
"tmp"));
164 ratio->Divide(simDelta);
182 TH2* realDelta =
GetH2(realMeas,
"etaDelta");
183 TH2* simDelta =
GetH2(simMeas,
"etaDelta");
185 TH1* realTail =
GetH1(realMeas,
"etaDeltaTail");
186 TH1* simTail =
GetH1(simMeas,
"etaDeltaTail");
187 TH1* scale =
static_cast<TH1*
>(realTail->Clone(
"scale"));
188 scale->Divide(simTail);
189 scale->SetDirectory(0);
190 Scale(simDelta, scale);
194 TH2* ratio =
static_cast<TH2*
>(realDelta->Clone(
"tmp"));
195 ratio->Divide(simDelta);
213 TH3* realDelta =
GetH3(realMeas,
"etaDeltaIPz");
214 TH3* simDelta =
GetH3(simMeas,
"etaDeltaIPz");
216 TH2* realTail =
GetH2(realMeas,
"etaIPzDeltaTail");
217 TH2* simTail =
GetH2(simMeas,
"etaIPzDeltaTail");
218 TH2* scale =
static_cast<TH2*
>(realTail->Clone(
"scale"));
219 scale->Divide(simTail);
220 scale->SetDirectory(0);
225 TH3* ratio =
static_cast<TH3*
>(realDelta->Clone(
"tmp"));
226 ratio->Divide(simDelta);
253 Printf(
" %5.2f-%5.2f%%", c1, c2);
258 if (!realBin || !simBin)
return false;
261 if (!realMeas || !simMeas)
return false;
265 ratio =
Weights2(realMeas, simMeas, scaleToTail);
268 ratio =
Weights3(realMeas, simMeas, scaleToTail);
271 ratio =
Weights1(realMeas, simMeas, scaleToTail);
274 if (!ratio)
return false;
276 ratio->SetName(name);
277 ratio->SetDirectory(0);
278 ratio->SetMarkerColor(color);
279 ratio->SetLineColor(color);
280 ratio->SetFillColor(color);
TH2 * Weights2(Container *realMeas, Container *simMeas, Bool_t scaleToTail)
Bool_t SetHisto(Int_t bin, TH1 *h)
static TFile * OpenFile(const char *filename)
static TH1 * GetH1(Container *parent, const char *name, Bool_t verb=true)
static const char * CentName(Double_t c1, Double_t c2)
static TH3 * ScaleDelta(TH3 *h, TH2 *scale)
TH1 * Weights1(Container *realMeas, Container *simMeas, Bool_t scaleToTail)
static Double_t GetD(Container *parent, const char *name, Double_t def=-1, Bool_t verb=true)
static Bool_t CheckConsistency(const TH1 *h1, const TH1 *h2)
static TH1 * Scale(TH1 *h, Double_t x, Double_t xe)
Utilities for midrapidity analysis.
void SetCentAxis(const TAxis &axis)
Encode simulation weights for 2nd pass.
static Color_t CentColor(const TAxis &axis, Double_t c1, Double_t c2)
static TH3 * GetH3(Container *parent, const char *name, Bool_t verb=true)
static Double_t RatioE(Double_t n, Double_t en, Double_t d, Double_t ed, Double_t &er)
static TH2 * GetH2(Container *parent, const char *name, Bool_t verb=true)
AliTrackletDeltaWeights * Run(const char *realFileName, const char *simFileName, Int_t dimen=2, Bool_t scaleToTail=true)
TH3 * Weights3(Container *realMeas, Container *simMeas, Bool_t scaleToTail)
static Container * GetC(Container *parent, const char *name, Bool_t verb=true)
Bool_t ProcessBin(Int_t bin, Int_t dimen, Bool_t scaleToTail, Double_t c1, Double_t c2, Container *realTop, Container *simTop, AliTrackletDeltaWeights *weights)