14 #include "TMultiGraph.h"
29 map<TString, TString> isobars;
30 isobars[
"pi+" ] =
"\\pi^{+}";
31 isobars[
"pi-" ] =
"\\pi^{-}";
32 isobars[
"pi+-" ] =
"\\pi^{\\pm}";
33 isobars[
"pi-+" ] =
"\\pi^{\\mp}";
34 isobars[
"sigma" ] =
"\\sigma";
35 isobars[
"rho770" ] =
"\\rho(770)";
36 isobars[
"a11269" ] =
"a_{1}(1269)";
37 isobars[
"a21320" ] =
"a_{2}(1320)";
38 isobars[
"rho1450" ] =
"\\rho(1450)";
39 isobars[
"rho1700" ] =
"\\rho(1700)";
40 isobars[
"pi1300" ] =
"\\pi(1300)";
41 isobars[
"pi1800" ] =
"\\pi(1800)";
42 isobars[
"pi21670" ] =
"\\pi_2(1670)";
43 isobars[
"f01370" ] =
"f_{0}(1370)";
44 isobars[
"f01500" ] =
"f_{0}(1500)";
45 isobars[
"f01700" ] =
"f_{0}(1700)";
46 isobars[
"f11285" ] =
"f_{1}(1285)";
47 isobars[
"f11420" ] =
"f_{1}(1420)";
48 isobars[
"b11235" ] =
"b_{1}(1235)";
49 isobars[
"b21800" ] =
"b_{2}(1800)";
50 isobars[
"b11800" ] =
"b_{1}(1800)";
51 isobars[
"b11500" ] =
"b_{1}(1500)";
52 isobars[
"f21270" ] =
"f_{2}(1270)";
53 isobars[
"f21950" ] =
"f_{2}(1950)";
54 isobars[
"f21565" ] =
"f_{2}(1565)";
55 isobars[
"f21270" ] =
"f_{2}(1270)";
56 isobars[
"f22010" ] =
"f_{2}(2010)";
57 isobars[
"f11420" ] =
"f_{1}(1420)";
58 isobars[
"eta1440" ] =
"\\eta(1420)";
59 isobars[
"eta11600" ] =
"\\eta_{1}(1600)";
60 isobars[
"eta21645"] =
"\\eta_{2}(1645)";
61 isobars[
"rho31690"] =
"\\rho_{3}(1690)";
62 isobars[
"rho1600"] =
"\\rho(1600)";
65 l.Remove(l.Length() - 4);
67 const TString head = l(0, 7);
68 const TString I = head(0, 1);
69 const TString G = head(1, 1);
70 const TString J = head(2, 1);
71 const TString P = head(3, 1);
72 const TString C = head(4, 1);
73 const TString
M = head(5, 1);
74 const TString refl = head(6, 1);
79 res << I <<
"^{" << G <<
"}(" << J <<
"^{" << P << C <<
"}" << M <<
"^{" << refl <<
"})";
82 TObjArray* tokens = l.Tokenize(
"_=");
84 unsigned int counter=0;
85 for (
int i = 0;
i < tokens->GetEntries(); ++
i) {
86 const TString token = ((TObjString*)tokens->At(
i))->GetString();
87 cerr <<
" " << mode <<
": '" << token <<
"'" << endl;
89 if (isobars.find(token) != isobars.end())
90 res << isobars[token];
95 l.Remove(0, token.Length());
100 }
else if (mode == 1) {
101 if (token.Length() == 1)
102 res <<
"[" << token <<
"] ";
104 res <<
"\\left[#splitline{" << token(0, 1) <<
"}{"
105 << token(1, 1) <<
"}\\right]";
106 l.Remove(0, token.Length());
108 }
else if (mode == 2) {
109 if(level<=counter)
break;
111 res <<
"\\rightarrow ";
112 if (isobars.find(token) != isobars.end())
113 res << isobars[token];
117 l.Remove(0, token.Length());
129 TString result(res.str().c_str());
143 double x=xcenter-0.2;
144 double y=xcenter-0.2;
147 TLatex* prelim=
new TLatex(x,y,
"preliminary");
149 prelim->SetTextColor(kGray);
150 prelim->SetTextSize(0.1);
151 prelim->SetTextAngle(20);
155 double xc=xcenter+0.08;
157 double yc=ycenter+0.35;
158 TLatex* com04=
new TLatex(xc,yc,
"COMPASS 2004");
160 com04->SetTextSize(0.05);
167 TLatex* react=
new TLatex(xc,yc,
"#pi^{-} Pb #rightarrow #pi^{-}#pi^{+}#pi^{-}#pi^{+}#pi^{-} Pb");
169 react->SetTextSize(0.039);
173 cout <<
"####### Title:" << endl;
174 TMultiGraph* gr=
dynamic_cast<TMultiGraph*
>(pad->GetListOfPrimitives()->At(0));
175 TH2D* h2=
dynamic_cast<TH2D*
>(pad->GetListOfPrimitives()->At(0));
184 cout << title << endl;
187 if(title.Contains(
"amp")){
188 if(!title.Contains(
"---")){
189 cout <<
"Processing Intensity:" << endl;
191 cout << wave << endl;
196 unsigned int i = title.Index(
"---");
197 TString wave1=title(3,i-3);
198 TString wave2=title(i+3,title.Length());
205 wave=
"#splitline{Interference - ";
206 wave+= title.Contains(
"Re") ?
"real part" :
"imaginary part";
207 wave+=
"}{#splitline{";
213 double max=gr->GetYaxis()->GetXmax();
214 double min=gr->GetYaxis()->GetXmin();
216 TGraph* g=(TGraph*)gr->GetListOfGraphs()->At(0);
218 g->GetPoint((
int)(g->GetN()*0.6),xg,yg);
219 if(fabs(max-yg)>fabs(min-yg)){
235 TLatex* waveL=
new TLatex(xc,yc,wave);
237 waveL->SetTextSize(0.03);
251 xmax=gr->GetXaxis()->GetXmax();
252 xmin=gr->GetXaxis()->GetXmin();
255 xmax=h2->GetXaxis()->GetXmax();
256 xmin=h2->GetXaxis()->GetXmin();
260 TLine* zeroline=
new TLine(xmin,0,xmax,0);
261 zeroline->SetLineStyle(7);
265 gr->GetXaxis()->SetTitle(
"mass (GeV/c^{2})");
269 h2->GetXaxis()->SetTitle(
"mass (GeV/c^{2})");
272 pad->UseCurrentStyle();
285 void roottops(
const TString& infilename,
const TString& plotdir=
"",
const TString& normfilename=
""){
287 gStyle->SetFrameFillStyle(4000);
289 bool savePlots=plotdir.Length()>1;
292 TString name=infilename;
293 name.ReplaceAll(
".root",
"");
295 const int nmbPadsPerCanvMin = 6;
297 TFile* infile=TFile::Open(infilename,
"READ");
300 gStyle->SetTextFont(font);
301 gStyle->SetLabelFont(font,
"xyz");
302 gStyle->SetTitleFont(font,
"xyz");
303 gStyle->SetOptStat(0);
304 gStyle->SetOptTitle(0);
305 gStyle->SetStripDecimals(1);
306 TGaxis::SetMaxDigits(4);
314 if(normfilename.Length()>1)normfile=TFile::Open(normfilename,
"READ");
316 TList* keylist=infile->GetListOfKeys();
317 unsigned int num=keylist->GetEntries();
319 cout << num <<
" entries in keylist." << endl;
321 const int nmbPadsHor = (
int)floor(sqrt(nmbPadsPerCanvMin));
322 const int nmbPadsVert = (
int)ceil((
double)nmbPadsPerCanvMin / (double)nmbPadsHor);
323 const int nmbPadsPerCanv = nmbPadsHor * nmbPadsVert;
326 vector<TCanvas*> canvases;
327 TCanvas* current=NULL;
328 unsigned int padcounter=0;
329 for(
unsigned int i=0;
i<num;++
i){
331 if(padcounter%(nmbPadsPerCanv+1) ==0){
332 TString cname=name;cname+=canvases.size();
333 current=
new TCanvas(cname,cname, 10, 10, 800, 1000);
334 current->Divide(nmbPadsHor,nmbPadsVert);
335 canvases.push_back(current);
338 current->cd(padcounter);
342 TString type(
"TH2D");
346 if(TString(((TKey*)keylist->At(
i))->GetClassName())==type){
347 cout <<
"Found " << type << endl;
348 TString keyname(((TKey*)keylist->At(
i))->GetName());
349 if(keyname.Contains(
"PHI"))
continue;
351 ((TKey*)keylist->At(
i))->ReadObj()->Draw(
"COL");
352 if(keyname.Contains(
"rho1")){
353 ((TH2D*)(((TKey*)keylist->At(
i))->ReadObj()))->GetYaxis()->SetRangeUser(-100,15000);}
355 else ((TKey*)keylist->At(
i))->ReadObj()->Draw(
"AP");
358 TPad* mypad=(TPad*)gPad;
360 TString
filename=plotdir+
"plot_"+keyname;
361 filename.ReplaceAll(
".amp",
".eps");
362 filename.ReplaceAll(
"+",
"p");
363 filename.ReplaceAll(
"-",
"m");
364 filename.ReplaceAll(
"=",
"_to_");
365 TCanvas* cplot=
new TCanvas(
"cplot",
"cplot",10,10,700,700);
367 TVirtualPad* clone=(TVirtualPad*)mypad->Clone();
369 clone->SetPad(
"pu",
"PopUp",0,0,1,1,0);
372 cplot->SaveAs(filename);
377 TString name=((TKey*)keylist->At(
i))->ReadObj()->GetName();
378 if(name.Contains(
"amp")){
379 TH2D* h=(TH2D*)((TKey*)keylist->At(
i))->ReadObj();
380 double xmin=h->GetXaxis()->GetXmin()*1000;
381 double xmax=h->GetXaxis()->GetXmax()*1000;
382 cout << xmin <<
" " << xmax << endl;
383 TString wavename=name(1,name.Length());
384 TGraph* g=(TGraph*)normfile->Get(wavename);
386 TPad* p2=
new TPad(
"pad",
"PS",gPad->GetX1(),gPad->GetY1(),gPad->GetX2(),gPad->GetY2());
388 p2->SetFillStyle(4000);
392 g->GetXaxis()->SetRangeUser(xmin,xmax);
393 g->GetXaxis()->SetTitle(
"Mass (GeV/c^{2}");
400 int nc1=canvases.size();
402 for(
unsigned int i=0;
i<num;++
i){
403 TString keyname(((TKey*)keylist->At(
i))->GetName());
404 if(keyname.Contains(
"PHI")){
406 TMultiGraph* g=(TMultiGraph*)((TKey*)keylist->At(
i))->ReadObj();
408 cout <<
"found Phase Graph!" << TString(((TKey*)keylist->At(
i))->GetName()) << endl;
409 int divider=keyname.Index(
"---");
410 TString key1=keyname(3,divider-3);
411 TString key2=keyname(divider+6,keyname.Length());
412 cout << key1 << endl;
413 cout << key2 << endl;
414 TMultiGraph*
g1=(TMultiGraph*) infile->Get(key1);
415 TMultiGraph* g2=(TMultiGraph*) infile->Get(key2);
416 if(g1==NULL || g2==NULL)
continue;
417 current=
new TCanvas(
"C"+keyname,
"C"+keyname, 10, 10, 800, 1000);
418 current->Divide(1,3);
419 canvases.push_back(current);
424 if(g->GetListOfGraphs()->GetSize()==0){}
430 g->GetYaxis()->SetRangeUser(-200,200);
436 current->cd(2);
if(g1!=NULL)g1->Draw(
"APC");
437 current->cd(3);
if(g2!=NULL)g2->Draw(
"APC");
442 TString psFileName = name; psFileName +=
".ps";
443 TCanvas dummyCanv(
"dummy",
"dummy");
444 TString option=
"Portrait";
445 dummyCanv.Print((psFileName +
"["),option);
446 for(
unsigned int ic=0;
ic<canvases.size();++
ic){
447 if(
ic>=nc1)option=
"Portrait";
448 canvases[
ic]->Print(psFileName,option);
451 dummyCanv.Print((psFileName +
"]"),option);
452 gSystem->Exec((
"gv " + psFileName));