36 TString dir = gSystem->UnixPathName(__FILE__);
37 dir.ReplaceAll(
"TestSPlot.C",
"");
38 dir.ReplaceAll(
"/./",
"/");
39 TString dataFile = Form(
"%sTestSPlot_toyMC.dat",dir.Data());
42 TTree *datatree =
new TTree(
"datatree",
"datatree");
43 datatree->ReadFile(dataFile,
44 "Mes/D:dE/D:F/D:MesSignal/D:MesBackground/D:dESignal/D:dEBackground/D:FSignal/D:FBackground/D",
' ');
46 TSPlot *splot =
new TSPlot(0, 3, 5420, 2, datatree);
54 splot->SetTreeSelection(
55 "Mes:dE:F:MesSignal:dESignal:FSignal:MesBackground:"
56 "dEBackground:FBackground");
61 ne[0]=500; ne[1]=5000;
62 splot->SetInitialNumbersOfSpecies(ne);
68 splot->FillSWeightsHists(25);
83 TCanvas *myc =
new TCanvas(
"myc",
84 "sPlots of Mes and F signal and background", 800, 600);
85 myc->SetFillColor(40);
87 TPaveText *pt =
new TPaveText(0.02,0.85,0.98,0.98);
91 pt->AddText(
"sPlots of Mes and F signal and background,");
92 pt->AddText(
"obtained by the tutorial TestSPlot.C on BABAR MC "
93 "data (sPlot_toyMC.fit)");
94 TText *t3=pt->AddText(
95 "M. Pivk and F. R. Le Diberder, Nucl.Inst.Meth.A, physics/0402083");
100 TPad* pad1 =
new TPad(
"pad1",
"Mes signal",0.02,0.43,0.48,0.83,33);
101 TPad* pad2 =
new TPad(
"pad2",
"Mes background",0.5,0.43,0.98,0.83,33);
102 TPad* pad3 =
new TPad(
"pad3",
"F signal", 0.02, 0.02, 0.48, 0.41,33);
103 TPad* pad4 =
new TPad(
"pad4",
"F background", 0.5, 0.02, 0.98, 0.41,33);
111 TH1D *sweight00 = splot->GetSWeightsHist(-1, 0, 0);
112 sweight00->SetTitle(
"Mes signal");
113 sweight00->SetStats(kFALSE);
114 sweight00->Draw(
"e");
115 sweight00->SetMarkerStyle(21);
116 sweight00->SetMarkerSize(0.7);
117 sweight00->SetMarkerColor(2);
118 sweight00->SetLineColor(2);
119 sweight00->GetXaxis()->SetLabelSize(0.05);
120 sweight00->GetYaxis()->SetLabelSize(0.06);
121 sweight00->GetXaxis()->SetLabelOffset(0.02);
125 TH1D *sweight10 = splot->GetSWeightsHist(-1, 1, 0);
126 sweight10->SetTitle(
"Mes background");
127 sweight10->SetStats(kFALSE);
128 sweight10->Draw(
"e");
129 sweight10->SetMarkerStyle(21);
130 sweight10->SetMarkerSize(0.7);
131 sweight10->SetMarkerColor(2);
132 sweight10->SetLineColor(2);
133 sweight10->GetXaxis()->SetLabelSize(0.05);
134 sweight10->GetYaxis()->SetLabelSize(0.06);
135 sweight10->GetXaxis()->SetLabelOffset(0.02);
139 TH1D *sweight02 = splot->GetSWeightsHist(-1, 0, 2);
140 sweight02->SetTitle(
"F signal");
141 sweight02->SetStats(kFALSE);
142 sweight02->Draw(
"e");
143 sweight02->SetMarkerStyle(21);
144 sweight02->SetMarkerSize(0.7);
145 sweight02->SetMarkerColor(2);
146 sweight02->SetLineColor(2);
147 sweight02->GetXaxis()->SetLabelSize(0.06);
148 sweight02->GetYaxis()->SetLabelSize(0.06);
149 sweight02->GetXaxis()->SetLabelOffset(0.01);
153 TH1D *sweight12 = splot->GetSWeightsHist(-1, 1, 2);
154 sweight12->SetTitle(
"F background");
155 sweight12->SetStats(kFALSE);
156 sweight12->Draw(
"e");
157 sweight12->SetMarkerStyle(21);
158 sweight12->SetMarkerSize(0.7);
159 sweight12->SetMarkerColor(2);
160 sweight12->SetLineColor(2);
161 sweight12->GetXaxis()->SetLabelSize(0.06);
162 sweight12->GetYaxis()->SetLabelSize(0.06);
163 sweight02->GetXaxis()->SetLabelOffset(0.01);