4 char *tCutL[totC]={
"Pt16",
"PtLMH",
"EtaBF",
"Qpn"};
7 char *ampL[mxAmp]={
"a1:P",
"-b1:Q",
"c0:PQ",
"c2:PQ"};
10 TGraphErrors * grL[mxGr];
12 TString wrkDir=
"final/fixMe/";
14 endPlot(
char *path=
"") {
31 gStyle->SetOptStat(1111);
33 createTgr(wrkDir+
"endVer1.hist.root");
36 TString fname=wrkDir+
"asyVer1.hist.root";
37 inpH=
new TFile(fname);
38 assert(inpH->IsOpen());
41 const int mxC2=6, mxC3=3, mxC4=4, mxC5=2;
42 char *cut2L[mxC2]={
"Pt1",
"Pt2",
"Pt3",
"Pt4",
"Pt5",
"Pt6"};
43 float cut2XM[mxC2]={ 0.7,1.5,2.5,3.5,4.5,5.5};
44 float cut2XH[mxC2]={ 0.3,.5,.5,.5,.5,.5};
45 sortCoef(cut2L, mxC2,
"Pt16", cut2XM, cut2XH );
47 char *cut3L[mxC3]={
"PtL",
"PtM",
"PtH"};
48 float cut3XM[mxC3]={ 0.55, 0.85, 2.};
49 float cut3XH[mxC3]={ 0.15, 0.15, 1.};
50 sortCoef(cut3L, mxC3,
"PtLMH", cut3XM, cut3XH );
52 char *cut4L[mxC4]={
"EtaBB",
"EtaBc",
"EtaFc",
"EtaFF" };
53 float cut4XM[mxC4]={ -.75, -.25, .25, .75};
54 float cut4XH[mxC4]={ .25,.25,.25.,.25};
57 sortCoef(cut4L, mxC4,
"EtaBF", cut4XM, cut4XH );
59 char *cut5L[mxC5]={
"Qneg",
"Qpos"};
60 float cut5XM[mxC5]={ -1, 1};
61 float cut5XH[mxC5]={ 0., 0.};
62 sortCoef(cut5L, mxC5,
"Qpn", cut5XM, cut5XH );
66 gr=appendTG(
"a1:P*Pt16",
"-b1:Q*Pt16"); gr->SetName(
"A_n*Pt16");
67 gr=appendTG(
"a1:P*PtLMH",
"-b1:Q*PtLMH");gr->SetName(
"A_n*PtLMH");
68 gr=appendTG(
"a1:P*Qpn",
"-b1:Q*Qpn");gr->SetName(
"A_n*Qpn");
69 gr=appendTG(
"a1:P*EtaBF",
"-b1:Q*EtaBF");gr->SetName(
"A_n*EtaBF");
72 fetchTG(
"c0:PQ*Pt16")->SetName(
"A_s*Pt16");
73 fetchTG(
"c0:PQ*PtLMH")->SetName(
"A_s*PtLMH");
74 fetchTG(
"c0:PQ*Qpn")->SetName(
"A_s*Qpn");
75 takeModuleEta(
"c0:PQ*EtaBF",
"A_s*EtaBF");
77 fetchTG(
"c2:PQ*Pt16")->SetName(
"A_d*Pt16");
78 fetchTG(
"c2:PQ*PtLMH")->SetName(
"A_d*PtLMH");
79 fetchTG(
"c2:PQ*Qpn")->SetName(
"A_d*Qpn");
80 takeModuleEta(
"c2:PQ*EtaBF",
"A_d*EtaBF");
91 if(outH->Get(grL[i]->GetName()))
continue;
106 TGraphErrors * fetchTG(TString name) {
110 for(i=0;i<nGr && gr==0;i++) {
111 if(!name.Contains(grL[i]->GetName()))
continue;
121 void createTgr(TString fname) {
122 outH=
new TFile(fname,
"RECREATE");
123 assert(outH->IsOpen());
124 printf(
"save outH -->%s\n", fname.Data());
126 char *ampTit[mxAmp]={
"An",
"AnYell",
"A#Sigma",
"A#Delta"};
127 int ampCol[mxAmp]={kBlue, kYellow, kGreen, kMagenta};
130 for (ic=0;ic<totC;ic++) {
131 for (iam=0;iam<mxAmp;iam++) {
133 sprintf(name,
"%s*%s",ampL[iam],tCutL[ic]);
135 TGraphErrors *gr =
new TGraphErrors;
137 gr->SetTitle(ampTit[iam]);
138 gr->SetMarkerColor(ampCol[iam]);
139 gr->SetMarkerSize(0.8);
140 gr->SetMarkerStyle(21);
150 TGraphErrors * appendTG(
char *basket,
char *apple,
float eps=0.){
152 TGraphErrors *gr1=fetchTG(basket);
153 TGraphErrors *gr2=fetchTG(apple);
155 for(i=0;i<gr2->GetN();i++) {
156 double erX=gr2->GetErrorX(i);
157 double erY=gr2->GetErrorY(i);
159 gr2->GetPoint(i,x,y);
162 gr1->SetPoint(n,x+eps,y);
163 gr1->SetPointError(n,erX,erY);
171 takeModuleEta(
char *inp,
char *out) {
172 TGraphErrors *gr= (TGraphErrors *)fetchTG(inp)->Clone();
177 for(i=0;i<gr->GetN();i++) {
181 gr->SetPoint(i,-x,y);
192 void sortCoef(
char **cutL,
int nC,
char *tCut,
float *xMean,
float *xErr){
194 printf(
"sortCoef(%s)\n",tCut);
197 for(iam=0;iam<mxAmp;iam++) {
198 TString outG=ampL[iam];
201 TGraphErrors * grOut=fetchTG(outG);
204 for(ic=0;ic<nC;ic++){
205 TString inpG=ampL[iam];
208 printf(
"%d '%s' -->%s xM=%f xEr=%f\n",ic,cutL[ic],inpG.Data(),xMean[ic], xErr[ic]);
209 TGraphErrors * gr=(TGraphErrors *)inpH->Get(inpG);
211 TF1 *ff=gr->GetFunction(
"pol0");
213 float val=ff->GetParameter(0);
214 float err=ff->GetParError(0);
217 if(strstr(inpG.Data(),
"-b1:Q*Eta")) x=-x;
218 grOut->SetPoint(n,x,val);
219 grOut->SetPointError(n,xErr[ic],err);
227 void plotObs(
char *obs=
"c0:PQ",
int flag=0) {
228 printf(
"plot Obs -->%s\n",obs);
229 char *tCutX[totC]={
"pT (GeV/c), 1 GeV/c bins",
" pT (GeV/c), rebinned",
"pseudorapidity",
"charge"};
231 c=
new TCanvas(obs,obs,600,500);
235 for (it=0;it<totC;it++) {
237 sprintf(name,
"%s*%s",obs,tCutL[it]);
238 TGraphErrors * gr=fetchTG(name);
240 printf(
"\nit=%d name='%s', N=%d\n",it,name,n);
247 TAxis *ax=gr->GetXaxis();
248 ax->SetTitle(tCutX[it]);
256 TF1 *ff=gr->GetFunction(
"pol0");
258 TString aaa=
"avr"; aaa+=name;
261 if(strstr(obs,
"A_n")) {
262 sprintf(name,
"%s*%s",
"-b1:Q",tCutL[it]);
263 TGraphErrors * gr=fetchTG(name);
264 if(gr->GetN()<=0)
continue;
266 }
else if(strstr(tCutL[it],
"EtaBF")) {
267 if(strstr(obs,
"A_s")) sprintf(name,
"c0:PQ*EtaBF");
268 if(strstr(obs,
"A_d")) sprintf(name,
"c2:PQ*EtaBF");
269 TGraphErrors * gr=fetchTG(name);
270 if(gr->GetN()<=0)
continue;
272 gr->SetMarkerColor(kBlack);
273 gr->SetMarkerStyle(25);
277 float val=ff->GetParameter(0);
278 float err=ff->GetParError(0);
282 chi2ndf=ff->GetChisquare()/ff->GetNDF();
284 float xSig=fabs(val)/err;
288 printf(
"## , %s , %s , %f , %f , %f %s\n",
289 tCutL[it], obs, val,err, chi2ndf,ff->GetName());
293 TString outFig=wrkDir+obs;
294 if(flag&1) c->Print(outFig+
".ps");
295 if(flag&2) c->Print(outFig+
".gif");
302 TPaveStats *st1 =( TPaveStats *)gPad->GetPrimitive(
"stats");
305 st1 =( TPaveStats *)gPad->GetPrimitive(
"title");
313 void drawFitError( TGraphErrors * gr) {
316 TF1 *ff=gr->GetFunction(
"pol0");
319 ff->SetLineColor(col);
320 ff->SetParName(0,
"avr");
322 float val=ff->GetParameter(0);
323 float err=ff->GetParError(0);
324 float upY=val+err, dwY=val-err;
326 TAxis *ax=gr->GetXaxis();
327 float x1=ax->GetXmin();
328 float x2=ax->GetXmax();
330 TLine *ln0=
new TLine(x1,0.,x2,0.);
334 TLine *upL=
new TLine(x1,upY,x2,upY);
335 TLine *dwL=
new TLine(x1,dwY,x2,dwY);
336 upL->SetLineStyle(3);
337 dwL->SetLineStyle(3);
339 upL->SetLineColor(col);
340 dwL->SetLineColor(col);