ROOTPWA
plotPdg.C
Go to the documentation of this file.
1 #include "TFile.h"
2 #include "TTree.h"
3 #include "TPDGEntry.h"
4 #include "TMultiGraph.h"
5 #include "TGraphErrors.h"
6 #include "TString.h"
7 #include "TLegend.h"
8 #include "TH1D.h"
9 #include <vector>
10 using namespace std;
11 
12 
13 bool cut(TPDGEntry* entry){
14  TString excludes[10]={"rho(1570)","f(1)(1510)","eta(1475)","f(2)(1430)","f(1)(1420)","eta(1405)","phi(1020)","f(0)(1500)","f(2)'(1525)"};
15 
16  bool excluded=false;
17  for(unsigned int i=0;i<9;++i){
18  if(entry->name().Contains(excludes[i])){
19  excluded=true;
20  cout << "Excluding " << entry->name() << endl;
21  break;
22  }
23  }
24 
25  return !entry->isLightMeson() || entry->J()<0 || entry->J()==0.5 || entry->mass()>2500 || entry->status()<0 || entry->isExotic() || entry->name().Contains("X") || entry->q()!=0;
26 }
27 
28 
29 int
30 plotPdg(TString file){
31  TFile* infile=TFile::Open(file,"READ");
32 
33  TTree* tree=(TTree*)infile->Get("pdg");
34 
35  tree->Print();
36 
37  TPDGEntry* entry=new TPDGEntry();
38  tree->SetBranchAddress("TPDGEntry",&entry);
39 
40 
41  TH1D* hm=new TH1D("hm","mass",100,0,6);
42 
43 
44  unsigned int nI0Pp=0;
45  unsigned int nI0Pm=0;
46  unsigned int nI1Pp=0;
47  unsigned int nI1Pm=0;
48  unsigned int n=0;
49 
50  unsigned int nentries=tree->GetEntries();
51  for(unsigned int i=0;i<nentries;++i){
52  tree->GetEntry(i);
53  if(cut(entry))continue;
54  hm->Fill(entry->mass()/1000);
55 
56  if(entry->I()==0){
57  if(entry->P()==1)++nI0Pp;
58  else if(entry->P()==-1)++nI0Pm;
59 
60  }
61  else if(entry->I()==1){
62  if(entry->P()==1)++nI1Pp;
63  else if(entry->P()==-1)++nI1Pm;
64  }
65 
66  n++;
67 
68  }
69 
70  TGraphErrors* gRegge=new TGraphErrors(n);
71  TGraphErrors* gReggeI0Pp=new TGraphErrors(nI0Pp);
72  TGraphErrors* gReggeI0Pm=new TGraphErrors(nI0Pm);
73  TGraphErrors* gReggeI1Pp=new TGraphErrors(nI1Pp);
74  TGraphErrors* gReggeI1Pm=new TGraphErrors(nI1Pm);
75  TMultiGraph* mg=new TMultiGraph();
76  mg->Add(gReggeI0Pp);
77  mg->Add(gReggeI0Pm);
78  mg->Add(gReggeI1Pp);
79  mg->Add(gReggeI1Pm);
80  TLegend* leg=new TLegend(0.58,0.15,0.88,0.4);
81  leg->SetFillColor(0);
82  leg->AddEntry(gReggeI0Pp,"I=0, P=+","P");
83  leg->AddEntry(gReggeI0Pm,"I=0, P=-","P");
84  leg->AddEntry(gReggeI1Pp,"I=1, P=+","P");
85  leg->AddEntry(gReggeI1Pm,"I=1, P=-","P");
86 
87 
88 
89  unsigned int counter=0;
90  unsigned int cI0Pp=0;
91  unsigned int cI0Pm=0;
92  unsigned int cI1Pp=0;
93  unsigned int cI1Pm=0;
94 
95 
96  for(unsigned int i=0;i<nentries;++i){
97  tree->GetEntry(i);
98  if(cut(entry))continue;
99 
100  gRegge->SetPoint(counter,entry->J(),entry->mass()*entry->mass()*1E-6);
101  gRegge->SetPointError(counter,0,2.*entry->mass()*1E-6*entry->mass_er());
102  ++counter;
103  entry->Print();
104 
105  if(entry->I()==0){
106  if(entry->P()==1){
107  gReggeI0Pp->SetPoint(cI0Pp,entry->J()-0.15,entry->mass()*entry->mass()*1E-6);
108  gReggeI0Pp->SetPointError(cI0Pp,0,2.*entry->mass()*1E-6*entry->mass_er());
109  ++cI0Pp;
110  }
111  else if(entry->P()==-1){
112  gReggeI0Pm->SetPoint(cI0Pm,entry->J()-0.05,entry->mass()*entry->mass()*1E-6);
113  gReggeI0Pm->SetPointError(cI0Pm,0,2.*entry->mass()*1E-6*entry->mass_er());
114  ++cI0Pm;
115  }
116 
117  }
118  else if(entry->I()==1){
119  if(entry->P()==1){
120  gReggeI1Pp->SetPoint(cI1Pp,entry->J()+0.05,entry->mass()*entry->mass()*1E-6);
121  gReggeI1Pp->SetPointError(cI1Pp,0,2.*entry->mass()*1E-6*entry->mass_er());
122  ++cI1Pp;
123  }
124  else if(entry->P()==-1){
125  gReggeI1Pm->SetPoint(cI1Pm,entry->J()+0.15,entry->mass()*entry->mass()*1E-6);
126  gReggeI1Pm->SetPointError(cI1Pm,0,2.*entry->mass()*1E-6*entry->mass_er());
127  ++cI1Pm;
128  }
129  }
130 
131 
132 
133  }
134 
135  gRegge->SetMarkerStyle(20);
136  //gRegge->Draw("AP");
137 
138  gReggeI0Pp->SetMarkerStyle(24);
139  gReggeI0Pm->SetMarkerStyle(20);
140  gReggeI1Pp->SetMarkerStyle(30);
141  gReggeI1Pm->SetMarkerStyle(29);gReggeI1Pm->SetMarkerSize(1.5);
142 
143  mg->Draw("AP");
144  mg->GetXaxis()->SetTitle("J");
145  mg->GetYaxis()->SetTitle("m^{2} (GeV^{2}/c^{4})");
146  leg->Draw();
147  //hm->DrawClone();
148 
149  return 0;
150 
151 
152 
153 
154 
155 }