10 #include <TApplication.h>
13 #include <TGListBox.h>
19 #include <TGraphErrors.h>
42 MyMainFrame(
const TGWindow *
p, UInt_t w, UInt_t h, TTree* tree);
54 Printf(
"Slot DoSelect()");
59 Printf(
"Slot DoExit()");
60 gApplication->Terminate(0);
71 string branchname(
"fitResult_v2");
72 if(tree->FindBranch(branchname.c_str())==NULL){
73 cerr <<
"Invalid branch ."<<branchname<<endl;
77 tree->SetBranchAddress(branchname.c_str(),&res);
78 cout <<
"Entries: " <<tree->GetEntries() << endl;
102 AddFrame(
fListBox,
new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
103 AddFrame(
fListBox2,
new TGLayoutHints(kLHintsTop | kLHintsRight| kLHintsExpandX, 5, 5, 5, 5));
107 fCheckMulti =
new TGCheckButton(
this,
"&Mutliple selection", 10);
108 AddFrame(
fCheckMulti,
new TGLayoutHints(kLHintsTop | kLHintsLeft,
110 fCheckMulti->Connect(
"Clicked()",
"MyMainFrame",
this,
"HandleButtons()");
112 TGHorizontalFrame *hframe =
new TGHorizontalFrame(
this, 400, 20, kFixedWidth);
113 TGTextButton *show =
new TGTextButton(hframe,
"&Show");
114 show->SetToolTipText(
"Click here to print the selection you made");
115 show->Connect(
"Pressed()",
"MyMainFrame",
this,
"PrintSelected()");
116 hframe->AddFrame(show,
new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
117 TGTextButton *
exit =
new TGTextButton(hframe,
"&Exit ");
118 exit->Connect(
"Pressed()",
"MyMainFrame",
this,
"DoExit()");
119 hframe->AddFrame(exit,
new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
120 AddFrame(hframe,
new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 1));
123 SetWindowName(
"List Box");
127 Resize(GetDefaultSize());
149 TGButton *btn = (TGButton *) gTQSender;
150 id = btn->WidgetId();
152 printf(
"HandleButton: id = %d\n",
id);
167 unsigned int n=
fTree->GetEntries();
170 double binwidth=0.060;
172 TGraphErrors* gph =
new TGraphErrors(n*3);
173 stringstream graphName;
174 graphName <<
"PHI"<<w1<<
"---"<<
"PHI"<<w2;
175 cout <<
"creating graph " << graphName.str() << endl;
176 gph->SetName (graphName.str().c_str());
177 gph->SetTitle(graphName.str().c_str());
178 gph->SetMarkerStyle(21);
179 gph->SetMarkerSize(0.5);
180 gph->SetMarkerColor(colour);
181 gph->SetLineColor(colour);
182 TGraphErrors* gRe =
new TGraphErrors(n);
185 graphName <<
"RE_"<<w1<<
"---"<<
""<<w2;
186 cout <<
"creating graph " << graphName.str() << endl;
187 gRe->SetName (graphName.str().c_str());
188 gRe->SetTitle(graphName.str().c_str());
189 gRe->SetMarkerStyle(21);
190 gRe->SetMarkerSize(0.5);
191 gRe->SetMarkerColor(colour);
192 gRe->SetLineColor(colour);
194 TGraphErrors* gIm =
new TGraphErrors(n);
197 graphName <<
"IM_"<<w1<<
"---"<<
""<<w2;
198 cout <<
"creating graph " << graphName.str() << endl;
199 gIm->SetName (graphName.str().c_str());
200 gIm->SetTitle(graphName.str().c_str());
201 gIm->SetMarkerStyle(21);
202 gIm->SetMarkerSize(0.5);
203 gIm->SetMarkerColor(colour);
204 gIm->SetLineColor(colour);
206 TGraphErrors*
g1 =
new TGraphErrors(n);
210 g1->SetName (graphName.str().c_str());
211 g1->SetTitle(graphName.str().c_str());
212 g1->SetMarkerStyle(21);
213 g1->SetMarkerSize(0.5);
214 TGraphErrors* g2 =
new TGraphErrors(n);
218 g2->SetName (graphName.str().c_str());
219 g2->SetTitle(graphName.str().c_str());
220 g2->SetMarkerStyle(21);
221 g2->SetMarkerSize(0.5);
227 fTree->SetBranchAddress(
"fitResult_v2",&result);
231 for(
unsigned int i=0;
i<
n;++
i){
237 double intensity1=result->
intensity(w1.c_str());
238 if((numeric_limits<double>::has_infinity && intensity1 == numeric_limits<double>::infinity()) || intensity1!=intensity1)
continue;
247 double intensity2=result->
intensity(w2.c_str());
248 if((numeric_limits<double>::has_infinity && intensity2 == numeric_limits<double>::infinity()) || intensity2!=intensity2)
continue;
259 double ph=result->
phase(w1.c_str(),w2.c_str());
260 double pherr=result->
phaseErr(w1.c_str(),w2.c_str());
266 gph->GetPoint(
i-3,mpre,phpre);
267 double diff1=fabs(ph-phpre);
268 double diff2=fabs(ph+360-phpre);
269 double diff3=fabs(ph-360-phpre);
270 if(diff2<diff1 && diff2<diff3)ph+=360;
271 else if(diff3<diff1 && diff3<diff2)ph-=360;
279 gph->SetPointError(
i*3,
287 gph->SetPointError(
i*3+1,
294 gph->SetPointError(
i*3+2,
305 gRe->SetPointError(
i,
314 gIm->SetPointError(
i,
322 TCanvas*c=
new TCanvas(
"c",
"c",10,10,1200,800);
326 gph->GetXaxis()->SetTitle(
"5#pi mass (GeV/c^2)");
327 gph->GetYaxis()->SetTitle(
"Phase difference");
328 gph->GetYaxis()->SetRangeUser(-270,270);
331 g1->GetXaxis()->SetTitle(
"5#pi mass (GeV/c^2)");
332 g1->GetYaxis()->SetTitle(
"Intensity");
335 g2->GetXaxis()->SetTitle(
"5#pi mass (GeV/c^2)");
336 g2->GetYaxis()->SetTitle(
"Intensity");
340 gRe->GetXaxis()->SetTitle(
"5#pi mass (GeV/c^2)");
341 gRe->GetYaxis()->SetTitle(
"Re(#rho_{ij})");
344 gIm->GetXaxis()->SetTitle(
"5#pi mass (GeV/c^2)");
345 gIm->GetYaxis()->SetTitle(
"Im(#rho_{ij})");
353 TFile* infile=TFile::Open(infilename,
"READ");
355 cerr <<
"File " << infilename <<
" not found!"<< endl;
358 TTree* pwa=(TTree*)infile->FindObjectAny(
"pwa");
360 cerr <<
"Tree not found!"<< endl;