1 void verticleRapidity(TH2F* h){
3 for(
int ix=1;ix<=h->GetNbinsX();ix++){
4 for(
int iy=1;iy<=h->GetNbinsY();iy++){
5 float xval=h->GetBinContent(ix,iy);
6 float zval=log(sqrt(1+xval*xval/0.01)+xval/0.1);
7 h->SetBinContent(ix,iy,zval);
14 int findAxisNames(
const char* hname,
int& prefixid,
int* varid,
int* combid){
19 char* prenames[]={
"LS",
"US",
"CD",
"CI",
"pp"};
23 if((preptr=strstr(hname,prenames[i])))
break;
28 newname=
new char[strlen(preptr)+1];
29 strcpy(newname,preptr);
33 char* tnames[]={
"Yt",
"Eta",
"Phi",
"Pt",
"Xt"};
35 char* ptr1[2]={NULL,NULL};
37 int nameid[2]={-1,-1};
40 ptr[i]=strstr(newname,tnames[i]);
48 if(icount==0)
return 1;
53 ptr1[1]=strstr(tmpstr,tnames[nameid[0]]);
54 if(ptr1[1])nameid[1]=nameid[0];
57 if(icount==1)
return 1;
68 for(
int i=0;i<2;i++)varid[i]=nameid[i];
73 char* n2names[]={NULL,
"D",
"S"};
75 if(strcmp(ptr1[0],newname)==0){
84 if((tmp3=strstr(tmp2,n2names[i])) && tmp3==tmp2){
91 for(
int i=0;i<2;i++) {
92 if(n2id[i]==-1)
return 2;
98 bool makePlots4P(TH2F** hists,
const char* plttype,
int opt=0){
103 int itest=findAxisNames(hists[0]->GetName(),prefixid,varid,combid);
106 cout<<
"Failed to find valid name from "<<hists[0]->GetName();
107 cout<<
" errorid="<<itest<<endl;
116 if(prefixid>3)ititle=1;
120 char* tlNames[]={
"y_{t,",
"#eta_{",
"#phi_{",
"p_{t,",
"X_{t,"};
121 char* tl2Names[]={
"#Delta}",
"#Sigma}"};
122 char* xvsy[]={
"1}",
"2}"};
124 TString* axislabel[2];
125 for(
int i=0;i<2;i++){
126 axislabel[i]=
new TString(tlNames[varid[i]]);
128 *axislabel[i]+=xvsy[i];
130 *axislabel[i]+=tl2Names[combid[i]-1];
134 char* atitle[]={
"Like-sign (LS)",
"Unlike-sign (US)",
" CD=LS-US",
" CI=LS+US"};
135 char* btitle[]={
"Pos.Pairs (++)",
"Unlike Sign (US)",
" Neg.Pairs (--)",
"LS diff. = ++ - --"};
137 float xvl[4]={0.01,0.5,0.28,0.8};
138 float yvl[4]={0.5,0.02,0.12,0.15};
140 for(
int i=0;i<4;i++){
141 TH2F* h=(TH2F*)hists[i]->Clone();
142 cout<<
"hist ="<<h->GetName();
143 cout<<
" max = "<<h->GetMaximum()<<
" min = "<<h->GetMinimum()<<endl;
145 if(opt>0)verticleRapidity(h);
147 tl.SetTextSize(0.05);
148 h->SetNdivisions(5,
"Z");
151 if(strstr(plttype,
"surf")){
159 tl.DrawLatex(0.31,0.91,atitle[i]);
161 tl.DrawLatex(0.31,0.91,btitle[i]);
164 tl.SetTextSize(0.08);
166 tl.DrawLatex(xvl[ivl],yvl[ivl],axislabel[1]->Data());
167 tl.DrawLatex(xvl[ivl+1],yvl[ivl+1],axislabel[0]->Data());
176 void makePlots(TH2F** hists,
int itype=0){
185 cout<<
"What? input NULL ** hists? we'll give this back to you"<<endl;
193 const char* plttype=
"surf1";
194 isok=makePlots4P(hists,plttype);
196 isok=makePlots4P(hists,
"colz");
198 isok=makePlots4P(hists,
"colz",1);
200 cout<<
" undefined itype="<<itype<<endl;
203 if(!isok)cout<<
"plotting failed "<<endl;