45 const char* simFileName,
51 if (!(realFile =
OpenFile(realFileName)))
return 0;
52 if (!(simFile =
OpenFile(simFileName)))
return 0;
55 const char* base =
"MidRapidity";
59 realTop =
GetC(realFile, Form(
"%sMCResults", base));
62 "*********************************************\n" 63 "* Testing MC vs. MC: *\n" 64 "* 'Data' file: %23s *\n" 65 "* Simulation file: %23s *\n" 66 "*********************************************\n",
67 realFileName, simFileName);
70 outName.Append(
gSystem->BaseName(realFileName));
71 outName.ReplaceAll(
".root",
"");
73 outName.ReplaceAll(
".root",
"");
74 outName.Prepend(
"delta_");
75 outName.Append(
".root");
77 TH1* realCent =
GetH1(realTop,
"cent");
78 TH1* simCent =
GetH1(simTop,
"cent");
79 TH1* realIPz =
GetH1(realTop,
"ipz");
84 Warning(
"Post",
"Centrality bins are incompatible, giving up");
88 Warning(
"Post",
"IPz bins are incompatible, giving up");
92 TFile* out = TFile::Open(outName,
"RECREATE");
99 for (
Int_t i = 1; i <= realCent->GetNbinsX(); i++) {
100 Double_t c1 = realCent->GetXaxis()->GetBinLowEdge(i);
101 Double_t c2 = realCent->GetXaxis()->GetBinUpEdge (i);
103 ProcessBin(i, dimen, scaleToTail, c1, c2, realTop, simTop, weights);
108 Printf(
"Output writtten to %s", outName.Data());
119 for (
Int_t i = 1; i <= h->GetNbinsX(); i++) {
120 for (
Int_t j = 1; j <= h->GetNbinsZ(); j++) {
122 TH1* tmp = h->ProjectionY(Form(
"%s_%02d_%02d",
126 tmp->SetDirectory(0);
128 if (intg > 1e-3) tmp->Scale(tmp->GetNbinsX()*1./intg);
130 for (
Int_t k = 1; k <= h->GetNbinsY(); k++) {
131 h->SetBinContent(i, k, j, tmp->GetBinContent(k));
132 h->SetBinError (i, k, j, tmp->GetBinError (k));
151 TH1* realDelta =
GetH1(realMeas,
"delta");
152 TH1* simDelta =
GetH1(simMeas,
"delta");
161 Scale(simDelta, scale, scaleE);
164 TH1* ratio =
static_cast<TH1*
>(realDelta->Clone(
"tmp"));
165 ratio->Divide(simDelta);
183 TH2* realDelta =
GetH2(realMeas,
"etaDelta");
184 TH2* simDelta =
GetH2(simMeas,
"etaDelta");
186 TH1* realTail =
GetH1(realMeas,
"etaDeltaTail");
187 TH1* simTail =
GetH1(simMeas,
"etaDeltaTail");
188 TH1* scale =
static_cast<TH1*
>(realTail->Clone(
"scale"));
189 scale->Divide(simTail);
190 scale->SetDirectory(0);
191 Scale(simDelta, scale);
195 TH2* ratio =
static_cast<TH2*
>(realDelta->Clone(
"tmp"));
196 ratio->Divide(simDelta);
214 TH3* realDelta =
GetH3(realMeas,
"etaDeltaIPz");
215 TH3* simDelta =
GetH3(simMeas,
"etaDeltaIPz");
217 TH2* realTail =
GetH2(realMeas,
"etaIPzDeltaTail");
218 TH2* simTail =
GetH2(simMeas,
"etaIPzDeltaTail");
219 TH2* scale =
static_cast<TH2*
>(realTail->Clone(
"scale"));
220 scale->Divide(simTail);
221 scale->SetDirectory(0);
226 TH3* ratio =
static_cast<TH3*
>(realDelta->Clone(
"tmp"));
227 ratio->Divide(simDelta);
254 Printf(
" %5.2f-%5.2f%%", c1, c2);
259 if (!realBin || !simBin)
return false;
262 if (!realMeas || !simMeas)
return false;
266 ratio =
Weights2(realMeas, simMeas, scaleToTail);
269 ratio =
Weights3(realMeas, simMeas, scaleToTail);
272 ratio =
Weights1(realMeas, simMeas, scaleToTail);
275 if (!ratio)
return false;
277 ratio->SetName(name);
278 ratio->SetDirectory(0);
279 ratio->SetMarkerColor(color);
280 ratio->SetLineColor(color);
281 ratio->SetFillColor(color);
Int_t color[]
print message on plot with ok/not ok
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)