ROOTPWA
plotGampMassDep.cc
Go to the documentation of this file.
1 
2 #include <iostream>
3 #include <string>
4 #include <complex>
5 #include <particle.h>
6 
7 #include <Vec.h>
8 #include <massDep.h>
9 #include <particleData.h>
10 
11 #include "TGraph.h"
12 #include "TAxis.h"
13 #include "TGaxis.h"
14 #include "TMath.h"
15 #include "TStyle.h"
16 #include "TCanvas.h"
17 #include "TApplication.h"
18 #include "TSystem.h"
19 #include "TROOT.h"
20 
21 using namespace std;
22 
24 
25 void dressGraph(TGraph *g, int font=132){
26 
27 
28  g->GetXaxis()->SetLabelFont(font);
29  g->GetXaxis()->SetTitleFont(font);
30  g->GetYaxis()->SetLabelFont(font);
31  g->GetYaxis()->SetTitleFont(font);
32 
33 }
34 
35 
36 
37 int main(int argc, char** argv){
38  string opt = "BW";
39  string part1 = "pi";
40  string part2 = "pi";
41  string part = "";
42  double mass(0.6);
43  double width(0.6);
44 
45  if (argc < 2){
46  cout << " usage: plotGampMassDep AMP|VES|KACH|LASS|RPRIME|BW [inv_mass(def 600MeV)] [width(def 600MeV)] [pi|K (def pi)] [pi|K (def pi)] [PDG name (mass and width will be ignored)]" << endl;
47  //return 0;
48  } else {
49  //cout << argc << endl;
50  if (argc > 1){
51  opt=(argv[1]);
52  }
53  if (argc > 2){
54  mass=atoi(argv[2])/1000.;
55  }
56  if (argc > 3){
57  width=atoi(argv[3])/1000.;
58  }
59  if (argc > 4){
60  part1=(argv[4]);
61  }
62  if (argc > 5){
63  part2=(argv[5]);
64  }
65  if (argc > 6){
66  part = (argv[6]);
67  cout << " using PDG values for " << part << endl;
68  }
69  }
70 
72  particle myp;
73  particle pi1;pi1.setMass(PDGtable.get(part1).Mass());pi1.setCharge(1);
74  particle pi2;pi2.setMass(PDGtable.get(part2).Mass());pi2.setCharge(-1);
75  if (part != ""){
76  mass = PDGtable.get(part).Mass();
77  width= PDGtable.get(part).Width();
78  }
79 
80  cout << " plotting " << opt << " with a mass of " << mass << " and width of " << width << " decaying into " << part1 << " " << part2 << endl;
81 
82  decay mydec;
83  mydec.setL(0);
84  mydec.setS(0);
85  mydec.addChild(pi1);
86  mydec.addChild(pi2);
87 
88 
89  myp.setDecay(mydec);
90  myp.setWidth(width);
91  myp.setMass(mass);
92 
93  massDep* dep;
94  if(opt=="AMP")dep=new AMP_M();
95  else if(opt=="VES")dep=new AMP_ves();
96  else if(opt=="KACH")dep=new AMP_kach();
97  else if(opt=="LASS")dep=new AMP_LASS();
98  else if(opt=="RPRIME")dep=new rhoPrime();
99  else if(opt=="BW")dep=new breitWigner();
100  else dep=new breitWigner();
101  dep->print();
102 
103  TApplication app("", 0, 0);
104  gROOT->SetStyle("Plain");
105 
106  unsigned int n=1000;
107  TGraph* intens=new TGraph(n);
108  TGraph* argand=new TGraph(n);
109  TGraph* phase=new TGraph(n);
110 
111  double mstart=0.1;
112  double mend=2.5;
113  double mstep=(mend-mstart)/(double)n;
114 
115 
116  for(unsigned int i=0; i<n; ++i){
117 
118  double mass=mstart+i*mstep;
119  myp.set4P(fourVec(mass,threeVec(0,0,0)));
120  complex<double> amp=dep->val(myp);
121  //cout << amp << endl;
122  intens->SetPoint(i,mass,norm(amp));
123  double phaseval=arg(amp);
124  if(phaseval<0)phaseval+=2*TMath::Pi();
125  phase->SetPoint(i,mass,phaseval);
126  double rho=2*myp.q()/mass;
127 
128  argand->SetPoint(i,rho*amp.real(),rho*amp.imag());
129 
130  }
131 
132 
133 
134 gStyle->SetOptStat(0);
135  gStyle->SetOptTitle(0);
136  gStyle->SetStripDecimals(1);
137  TGaxis::SetMaxDigits(3);
138 
139  Int_t font=132;
140 
141  gStyle->SetTextFont(font);
142  gStyle->SetLabelFont(font);
143 
144 
145 
146 
147  TCanvas* c=new TCanvas("c","Mass Dep",10,10,1200,600);
148  c->Divide(2,1);
149  c->cd(1);
150  intens->SetTitle("Intensity");
151  intens->Draw("APC");
152  dressGraph(intens);
153  intens->GetXaxis()->SetTitle("Mass of (#pi#pi) system (GeV/c^{2})");
154  intens->GetYaxis()->SetTitle("Intensity");
155  c->cd(2);
156  phase->SetTitle("Phase");
157  phase->Draw("APC");
158  dressGraph(phase);
159  phase->GetXaxis()->SetTitle("Mass of (#pi#pi) system (GeV/c^{2})");
160  phase->GetYaxis()->SetTitle("Phase");
161  /*c->cd(3);
162  argand->SetTitle("Argand plot");
163  argand->Draw("APC");
164  argand->SetMarkerStyle(2);
165  */
166  c->ForceUpdate();
167  c->Flush();
168 
169  gApplication->SetReturnFromRun(kFALSE);
170  gSystem->Run();
171 
172 
173 
174  return 0;
175 }