17 gStyle->SetCanvasDefW(1000);
18 gStyle->SetCanvasDefH(1000);
19 gStyle->SetOptStat(0);
21 gStyle->SetFuncWidth(1);
22 gStyle->SetFuncColor(6);
25 TDirectory *
CDCdir = (TDirectory*)gDirectory->FindObjectAny(
"CDC_dedx");
26 if (!CDCdir)
printf(
"Cannot find directory CDC_dedx\n");
36 sprintf(hname_pos,
"dedx_p_pos");
37 sprintf(hname_neg,
"dedx_p_neg");
40 sprintf(hname_pos,
"intdedx_p_pos");
41 sprintf(hname_neg,
"intdedx_p_neg");
44 TH2I *
h = (TH2I*)CDCdir->Get(hname_pos);
45 if (!h)
printf(
"Cannot find histogram %s\n",hname_pos);
48 TH2I *hn = (TH2I*)CDCdir->Get(hname_neg);
49 if (!hn)
printf(
"Cannot find histogram %s\n",hname_neg);
53 TCanvas *
c1 =
new TCanvas(
"c1");
61 TCanvas *
c1 = gPad->GetCanvas();
80 TF1 *g =
new TF1(
"gaus",
"gaus",0,ymax);
91 int pbin = h->GetXaxis()->FindBin(pcut);
93 TH1D *p = h->ProjectionY(
"p1",pbin,pbin);
95 p->SetTitle(Form(
"CDC q+ dE/dx%s at %.2f GeV/c",whichdedx,pcut));
96 p->GetXaxis()->SetRangeUser(ymin,ymax);
99 double fitstat = p->Fit(g,
"Q0WE");
103 g->GetParameters(&pars[0]);
104 res = 2.0*pars[2]/pars[1];
110 TPaveText *
txt1 =
new TPaveText(0.4,0.75,0.8,0.85,
"NDC");
111 txt1->AddText(Form(
"Mean %.2f width %.2f res %.2f",pars[1],2*pars[2],res));
112 txt1->SetBorderSize(0);
113 txt1->SetFillStyle(0);
124 pbin = h->GetXaxis()->FindBin(pcut);
125 p = h->ProjectionY(
"p1",pbin,pbin);
127 p->SetTitle(Form(
"CDC q+ dE/dx%s at %.2f GeV/c",whichdedx,pcut));
128 p->GetXaxis()->SetRangeUser(ymin,ymax);
131 if (mean ==0)
return;
133 TPaveText *
txt2 =
new TPaveText(0.4,0.75,0.8,0.85,
"NDC");
134 txt2->SetBorderSize(0);
135 txt2->SetFillStyle(0);
138 fitstat = p->Fit(g,
"Q0WE",
"",0,2*mean);
141 g->GetParameters(&pars[0]);
142 respi = 2.0*pars[2]/pars[1];
146 txt2->AddText(Form(
"Mean %.2f width %.2f res %.2f",pars[1],2*pars[2],respi));
151 fitstat = p->Fit(g,
"Q0WE",
"",2*mean,ymax);
154 g->GetParameters(&pars[0]);
155 resp = 2.0*pars[2]/pars[1];
160 txt2->AddText(Form(
"Mean %.2f width %.2f res %.2f",pars[1],2*pars[2],resp));
sprintf(text,"Post KinFit Cut")
void CDC_dedx(int integral=0)
printf("string=%s", string)