8 #include <TGraphErrors.h>
18 Double_t
CBcalc(Double_t *xx, Double_t *par)
27 double alpha = par[0];
29 double x_mean = par[2];
30 double sigma = par[3];
34 double A = pow( (n/TMath::Abs(alpha)),n) * exp(-pow(alpha,2)/2.0);
35 double B = n/TMath::Abs(alpha) - TMath::Abs(alpha);
38 if( (x-x_mean)/sigma > -alpha)
40 f = N * exp( -pow(x-x_mean,2) / (2.0*pow(sigma,2)));
44 f = N * A * pow(B - (x-x_mean)/sigma, -n);
59 double alpha = par[0];
61 double x_mean = par[2];
62 double sigma = par[3];
66 double slope = par[6];
69 double A = pow( (n/TMath::Abs(alpha)),n) * exp(-pow(alpha,2)/2.0);
70 double B = n/TMath::Abs(alpha) - TMath::Abs(alpha);
73 if( (x-x_mean)/sigma > -alpha)
75 f = N * exp( -pow(x-x_mean,2) / (2.0*pow(sigma,2)));
79 f = N * A * pow(B - (x-x_mean)/sigma, -n);
82 f += Nexp * exp(slope * x);
95 double alpha = par[0];
97 double x_mean = par[2];
98 double sigma = par[3];
101 double Nexp = par[5];
102 double slope = par[6];
117 double A = pow( (n/TMath::Abs(alpha)),n) * exp(-pow(alpha,2)/2.0);
118 double B = n/TMath::Abs(alpha) - TMath::Abs(alpha);
121 if( (x-x_mean)/sigma > -alpha)
123 f = N * exp( -pow(x-x_mean,2) / (2.0*pow(sigma,2)));
127 f = N * A * pow(B - (x-x_mean)/sigma, -n);
130 f += Nexp * exp(slope * x);
135 double bg12 =
recomassBG->GetBinContent(ibin);
147 double alpha1s = par[0];
149 double sigma1s = par[2];
156 double Nexp = par[9];
157 double slope = par[10];
161 TF1 *
f1 =
new TF1(
"f1",
CBcalc,7,11,5);
162 f1->SetParameter(0,alpha1s);
163 f1->SetParameter(1,n1s);
164 f1->SetParameter(2,m1s);
165 f1->SetParameter(3,sigma1s);
166 f1->SetParameter(4,N1s);
168 TF1 *
f2 =
new TF1(
"f2",
CBcalc,7,11,5);
169 f2->SetParameter(0,alpha1s);
170 f2->SetParameter(1,n1s);
171 f2->SetParameter(2,m2s);
172 f2->SetParameter(3,sigma1s);
173 f2->SetParameter(4,N2s);
175 TF1 *
f3 =
new TF1(
"f3",
CBcalc,7,11,5);
176 f3->SetParameter(0,alpha1s);
177 f3->SetParameter(1,n1s);
178 f3->SetParameter(2,m3s);
179 f3->SetParameter(3,sigma1s);
180 f3->SetParameter(4,N3s);
182 TF1 *fexp =
new TF1(
"fexp",
"[0]*exp([1]*x)",7,11);
183 fexp->SetParameter(0,Nexp);
184 fexp->SetParameter(1,slope);
187 double mass = f1->Eval(x) + f2->Eval(x) + f3->Eval(x) + fexp->Eval(x);
194 gROOT->SetStyle(
"Plain");
195 gStyle->SetOptStat(0);
196 gStyle->SetOptFit(0);
197 gStyle->SetOptTitle(0);
201 double maxmass = 3.7;
202 double minmass = 2.4;
205 file1S =
new TFile(
"Runcuts_DIMU_MUTRONLY_Run15pp200_JPSISIM_NOEMBED_C_PTBIN0_0_NONE.root");
208 cout <<
" Failed to open input root file" << endl;
214 for(
int iarm = 0; iarm < 2; ++iarm)
218 sprintf(hname,
"mass_y_same_arm%i_chg0", iarm);
219 recomass2D[iarm] = (TH2D *)file1S->Get(hname);
221 if(!recomass2D[iarm])
222 cout <<
"Failed to get 2D histogram " << endl;
225 for(
int irap =0; irap < 4; ++irap)
228 sprintf(h1dname,
"recomass%i%i", iarm, irap);
229 recomass[iarm][irap] = recomass2D[iarm]->ProjectionX(h1dname, irap+1, irap+1);
234 TCanvas *cups =
new TCanvas(
"cups",
"cups",5,5,1600,800);
236 for(
int iarm = 0; iarm<2; ++iarm)
238 for(
int irap = 0; irap < 4; ++irap)
240 cout <<
"Fit for iarm = " << iarm <<
" irap = " << irap << endl;
242 cups->cd(irap + iarm*4 + 1);
243 recomass[iarm][irap]->Draw();
246 sprintf(fname,
"f1S%i%i", iarm, irap);
247 f1S[iarm][irap] =
new TF1(fname,
CBcalc, minmass, maxmass, 5);
249 f1S[iarm][irap]->SetParameter(0, 1.5);
250 f1S[iarm][irap]->SetParameter(1, 100.0);
251 f1S[iarm][irap]->SetParameter(2, 3.12);
252 f1S[iarm][irap]->SetParameter(3, 0.13);
253 f1S[iarm][irap]->SetParameter(4, 300);
254 f1S[iarm][irap]->SetParNames(
"alpha1S",
"n1S",
"m1S",
"sigma1S",
"N1S");
255 f1S[iarm][irap]->SetLineColor(kBlue);
256 f1S[iarm][irap]->SetLineWidth(3);
257 f1S[iarm][irap]->SetLineStyle(kDashed);
259 recomass[iarm][irap]->GetXaxis()->SetRangeUser(2.2,3.8);
260 recomass[iarm][irap]->Fit(f1S[iarm][irap]);
262 recomass[iarm][irap]->DrawCopy();
263 f1S[iarm][irap]->Draw(
"same");
269 TCanvas *cgr =
new TCanvas(
"cgr",
"cgr", 5, 5, 1600, 800);
273 double rap[2][4] = {-2.075, -1.825, -1.575, -1.325, 1.325, 1.575, 1.825, 2.075};
274 double rap_err[4] = {0};
277 TGraphErrors *grmean[2];
278 TGraphErrors *grsigma[2];
281 double mean_err[2][4];
282 double sigma_err[2][4];
283 for(
int iarm = 0; iarm < 2; ++iarm)
285 for(
int irap = 0; irap < 4; ++irap)
287 mean[iarm][irap] = f1S[iarm][irap]->GetParameter(2);
288 mean_err[iarm][irap] = f1S[iarm][irap]->GetParError(2);
289 sigma[iarm][irap] = f1S[iarm][irap]->GetParameter(3);
290 sigma_err[iarm][irap] = f1S[iarm][irap]->GetParError(3);
292 grmean[iarm] =
new TGraphErrors(4, rap[iarm], mean[iarm], rap_err, mean_err[iarm]);
293 grsigma[iarm] =
new TGraphErrors(4, rap[iarm], sigma[iarm], rap_err, sigma_err[iarm]);
296 grmean[iarm]->SetMarkerStyle(20);
297 grmean[iarm]->SetMarkerSize(2);
298 grmean[iarm]->GetYaxis()->SetTitle(
"mass (GeV/c^{2})");
299 grmean[iarm]->GetYaxis()->SetTitleSize(0.05);
300 grmean[iarm]->GetXaxis()->SetTitle(
"y");
301 grmean[iarm]->GetXaxis()->SetTitleSize(0.05);
302 grmean[iarm]->Draw();
305 sprintf(arm,
"arm %i",iarm);
306 lab[iarm] =
new TLatex(0.2, 0.350, arm);
308 lab[iarm]->SetTextSize(0.1);
312 grsigma[iarm]->SetMarkerStyle(20);
313 grsigma[iarm]->SetMarkerSize(2);
314 grsigma[iarm]->GetYaxis()->SetTitle(
"width (GeV/c^{2})");
315 grsigma[iarm]->GetYaxis()->SetTitleSize(0.05);
316 grsigma[iarm]->GetXaxis()->SetTitle(
"y");
317 grsigma[iarm]->GetYaxis()->SetTitleSize(0.05);
318 grsigma[iarm]->Draw();