6 #include "TLorentzVector.h"
8 #include "TLorentzRotation.h"
11 #include "TGraphErrors.h"
12 #include "TClonesArray.h"
26 #define MCOLOR kOrange-3
28 TGraphErrors*
buildGraph(vector<TH1D*> histo,
unsigned int n){
29 unsigned int nbins=histo[0]->GetNbinsX();
31 TGraphErrors* g=
new TGraphErrors(nbins);
32 for(
unsigned int ib=0;ib<nbins;++ib){
33 double x=histo[0]->GetBinCenter(ib+1);
34 double val=histo[0]->GetBinContent(ib+1);
35 double dx=histo[0]->GetBinWidth(ib+1)*0.5;
36 g->SetPoint(ib,x,val);
39 for(
unsigned int ih=0;ih<
n;++ih){
40 double xi=val-histo[ih]->GetBinContent(ib+1);
44 double sigmastat=histo[0]->GetBinError(ib+1);
46 g->SetPointError(ib,dx,sqrt(sigma+sigmastat));
55 TCanvas*
plotAccu(TString histoname, TString xtitle, vector<TString> bins,
unsigned int nsamples,TFile* infile, TString plotdir){
57 TString mcname=histoname+
"MC";
58 TString dataname=histoname+
"Data";
59 TString apsname=histoname+
"APS";
60 TString range=bins[0](2,4)+
"."+bins.back()(7,4);
64 vector<TH1D*> mcplots(nsamples);
69 for(
unsigned int ib=0;ib<bins.size();++ib){
71 TString name=dataname+bins[ib];
73 TH1D* datahisto=(TH1D*)infile->Get(name);
74 name=apsname+bins[ib];
76 TH1D* apshisto=(TH1D*)infile->Get(name);
78 if(datahisto==NULL || apshisto==NULL){
84 TString accname=dataname+range;
85 dataplot=(TH1D*)datahisto->Clone(accname);
86 TString accuapsname=apsname+range;
87 apsplot=(TH1D*)apshisto->Clone(accuapsname);
90 dataplot->Add(datahisto);
91 apsplot->Add(apshisto);
95 for(
unsigned int is=0;is<nsamples;++is){
97 TString name=mcname+bins[ib]+
"_";name+=is;
99 TH1D* mchisto=(TH1D*)infile->Get(name);
100 if(mchisto==NULL)
return 0;
102 TString accname=mcname+range+
"_";accname+=is;
103 mcplots[is]=(TH1D*)mchisto->Clone(accname);
106 mcplots[is]->Add(mchisto);
108 mcplots[is]->SetLineColor(kRed);
115 g->SetMarkerColor(
MCOLOR);
117 TCanvas* c=
new TCanvas(histoname+range,histoname+range,10,10,700,700);
122 dataplot->Draw(
"same E");
123 dataplot->GetYaxis()->SetRangeUser(0,dataplot->GetMaximum()*1.5);
124 dataplot->GetXaxis()->SetTitle(xtitle);
129 double xc=xcenter+0.05;
131 double yc=ycenter+0.35;
132 TLatex* com04=
new TLatex(xc,yc,
"COMPASS 2004");
134 com04->SetTextSize(0.05);
141 TLatex* react=
new TLatex(xc,yc,
"#pi^{-} Pb #rightarrow #pi^{-}#pi^{+}#pi^{-}#pi^{+}#pi^{-} Pb");
143 react->SetTextSize(0.039);
146 TLatex*
dat=
new TLatex(xc,yc,
"Data vs");
148 dat->SetTextSize(0.039);
156 TPaveText* mc=
new TPaveText(xc+0.114,yc-0.009,xc+0.325,yc+0.031,
"NDC");
158 mc->SetBorderSize(0);
159 mc->SetTextSize(0.039);
162 mc->AddText(
"weighted MC");
166 TString rangelable(
"m_{5#pi} #in [");rangelable+=range;rangelable+=
"] MeV/c^{2}";rangelable.ReplaceAll(
".",
",");
167 TLatex*
bin=
new TLatex(xc,yc,rangelable);
169 bin->SetTextSize(0.032);
172 range.ReplaceAll(
".",
"_");
173 c->SaveAs(plotdir+histoname+range+
".eps");
175 TCanvas* c2=
new TCanvas(apsname+range,apsname+range,10,10,700,700);
177 apsplot->SetFillColor(
MCOLOR);
178 apsplot->GetYaxis()->SetRangeUser(0,apsplot->GetMaximum()*1.5);
179 apsplot->GetXaxis()->SetTitle(xtitle);
183 TLatex* dat2=
new TLatex(xc,yc,
"accepted phase-space MC");
185 dat2->SetTextSize(0.034);
189 c2->SaveAs(plotdir+apsname+range+
".eps");
204 TFile* infile=TFile::Open(plotsfile.Data(),
"READ");
206 gStyle->SetTextFont(font);
207 gStyle->SetLabelFont(font,
"xy");
208 gStyle->SetTitleFont(font,
"xy");
209 gStyle->SetOptStat(0);
210 gStyle->SetOptTitle(0);
211 gStyle->SetStripDecimals(1);
212 TGaxis::SetMaxDigits(4);
213 gStyle->SetFrameFillStyle(0);
214 gStyle->SetFrameBorderMode(0);
219 unsigned int nbins=7;
220 vector<vector<TString> > bins(nbins);
221 int dm=60;
int mstart=1360;
224 for(
unsigned int ib=0;ib<nbins;++ib){
225 cout <<
"Bin " << ib <<
" : " << endl;
226 for(
unsigned int ia=0;ia<nacc;++ia){
227 TString masslabel(
"_m");
228 masslabel+=
mass;masslabel+=
".";masslabel+=(mass+dm);
229 bins[ib].push_back(masslabel);
230 cout << masslabel << endl;
236 plotAccu(
"hMIsobar",
"invariant mass of #pi^{-}#pi^{+}#pi^{-}#pi^{+} system (GeV/c^{2})", bins[
bin],100,infile,outdir);
237 plotAccu(
"hMIsobar2",
"invariant mass of #pi^{-}#pi^{+}#pi^{-} system (GeV/c^{2})", bins[bin],100,infile,outdir);
238 plotAccu(
"hMIsobar3",
"invariant mass of #pi^{-}#pi^{+} system (GeV/c^{2})", bins[bin],100,infile,outdir);
240 plotAccu(
"hGJ",
"cos #theta_{GJ}(#pi^{-}#pi^{+}#pi^{-}#pi^{+})", bins[bin],100,infile,outdir);
241 plotAccu(
"hTY",
"#phi_{TY}(#pi^{-}#pi^{+}#pi^{-}#pi^{+})", bins[bin],100,infile,outdir);
243 plotAccu(
"hGJ2",
"cos #theta_{GJ}(#pi^{+}#pi^{-}#pi^{-})" ,bins[bin],100,infile,outdir);
244 plotAccu(
"hHe22Th",
"cos #theta_{Hel}(#pi^{-}#pi^{+})(#pi^{-}#pi^{+})" ,bins[bin],100,infile,outdir);
245 plotAccu(
"hHe21Th",
"cos #theta_{Hel}(#pi^{-}#pi^{+})(#pi^{-})" ,bins[bin],100,infile,outdir);
246 plotAccu(
"hHe31Th",
"cos #theta_{Hel}(#pi^{-}#pi^{+}#pi^{-})(#pi^{+})" ,bins[bin],100,infile,outdir);
247 plotAccu(
"hHe22Phi",
"#phi_{Hel}(#pi^{-}#pi^{+})(#pi^{-}#pi^{+})" ,bins[bin],100,infile,outdir);
248 plotAccu(
"hHe21Phi",
"#phi_{Hel}(#pi^{-}#pi^{+})(#pi^{-})" ,bins[bin],100,infile,outdir);
249 plotAccu(
"hHe31Phi",
"#phi_{Hel}(#pi^{-}#pi^{+}#pi^{-})(#pi^{+})" ,bins[bin],100,infile,outdir);