FairRoot/PandaRoot
Pic_OmegaQuadrupoleComparison.C
Go to the documentation of this file.
2 {
3  const int nFiles = 3;
4  TString RootInputFiles[nFiles];
5  RootInputFiles[0] = "/data/work/kpha1/steinen/Gamma/Ana/CombinedData/OmegaResults/mu-2.0_Q0.0__Psf1.root";
6  RootInputFiles[1] = "/data/work/kpha1/steinen/Gamma/Ana/CombinedData/OmegaResults/mu-2.0_Q-2.0__Psf1.root";
7  RootInputFiles[2] = "/data/work/kpha1/steinen/Gamma/Ana/CombinedData/OmegaResults/mu-2.0_Q-4.0__Psf1.root";
8  TF1 *fTemporary[nFiles];
9 
10 
11  TString PicRootDir = gSystem->Getenv("PICTUREDIR");
12  andi::setCustomStyle();
13  TString HistoTitleMean = "Mean;#Omega Quadrupole moment [10^{-2}fm^{2}e]; Mean [MeV]";
14  TString HistoTitleVariance = "Variance;#Omega Quadrupole moment [10^{-2}fm^{2}e]; Variance [MeV^{2}]";
15  TString HistoTitleSkewness = "Skewness;#Omega Quadrupole moment [10^{-2}fm^{2}e]; Skewness [MeV^{3}]";
16  TString HistoTitleKurtosis = "Kurtosis;#Omega Quadrupole moment [10^{-2}fm^{2}e]; Kurtosis [MeV^{4}]";
17  TString HistoTitleMaxX = "Position of Maximum;#Omega Quadrupole moment [10^{-2}fm^{2}e]; Position of Maximum [MeV]";
18  const int nPsf = 2;
19  const int nPsfPlot = 1;
20  const int nPoints = 22;
21  TString PicName = "FEPcomparison_IronLead_Omega";
22  Double_t aQ[nPsf][nPoints],
23  aMean[nPsf][nPoints],
24  aVariance[nPsf][nPoints],
25  aSkewness[nPsf][nPoints],
26  aKurtosis[nPsf][nPoints],
27  aMaxX[nPsf][nPoints];
28  Int_t TargetNumbers[nPsf] = {13,43};
29  Int_t counter[nPsf] = {0,0};
30  Color_t ColorArrray[nPsf] = {kBlack, kRed};
31  Color_t ColorArrrayFunction[nFiles] = {kBlack, kRed, kGreen};
32  TString TargetMaterialStrings[nPsf] = {"Psf 1","Psf 1.5"};
33  Double_t Loss[nPoints];
34  TGraphErrors *graphMean[nPsf];
35  TGraphErrors *graphVariance[nPsf];
36  TGraphErrors *graphSkewness[nPsf];
37  TGraphErrors *graphKurtosis[nPsf];
38  TGraphErrors *graphMaxX[nPsf];
39  ifstream Inputfile("/data/work/kpha1/steinen/Gamma/Ana/CombinedData/OmegaResults/OmegaResults.txt");
40 
41  Double_t mu, Q, Psf;
42  Double_t MeanPos,StandardDev, Skewness,Kurtosis,MaxX;
43  char InputName[100];
44 
45  char buffer[100];
46  Inputfile.getline(buffer,100);
47  while(Inputfile >> mu >> Q >> Psf >>
48  MeanPos >> StandardDev >> Skewness>>Kurtosis >>MaxX)
49  {
50  if (mu == -2)
51  {
52  if(Psf == 1)
53  {
54  aQ[0][counter[0]] = Q;
55  aMean[0][counter[0]] = MeanPos;
56  aVariance[0][counter[0]] = StandardDev*StandardDev;
57  aSkewness[0][counter[0]] = Skewness;
58  aKurtosis[0][counter[0]] = Kurtosis;
59  aMaxX[0][counter[0]] = MaxX;
60  cout << mu << Q << Psf << MeanPos << StandardDev << Skewness << Kurtosis << MaxX<< endl;
61  counter[0]++;
62  }
63  else if (Psf == 1.5)
64  {
65  aQ[1][counter[1]] = Q;
66  aMean[1][counter[1]] = MeanPos;
67  aVariance[1][counter[1]] = StandardDev;
68  aSkewness[1][counter[1]] = Skewness;
69  aKurtosis[1][counter[1]] = Kurtosis;
70  aMaxX[1][counter[1]] = MaxX;
71  counter[1]++;
72  cout << "bla" << mu << Q << Psf << MeanPos << StandardDev << Skewness << Kurtosis<< MaxX<< endl;
73  }
74  }
75  }
76 
77 
78  Inputfile.close();
79 
80  TCanvas *c1[5];
81  for (int i = 0; i<5; i++)
82  {
83  sprintf(buffer,"c%i",i);
84  c1[i] = new TCanvas(buffer,buffer,1200,800);
85  c1[i]->SetGridx(1);
86  c1[i]->SetGridy(1);
87  c1[i]->SetTicks();
88  }
89  TLegend* leg = new TLegend(0.7,0.7,0.9,0.9);
90  //TGraph *graph = new TGraph(10,x,y);
91  for (int i = 0; i< nPsf; i++)
92  {
93  graphMean[i] = new TGraphErrors(counter[i],aQ[i],aMean[i],0,0);
94  graphMean[i]->Sort();
95  graphMean[i]->SetMarkerColor(i+1);
96  graphMean[i]->SetMarkerSize(1);
97  graphMean[i]->SetMarkerStyle(20);
98  graphMean[i]->SetLineStyle(2);
99  graphMean[i]->SetLineColor(i+1);
100 
101 
102  graphVariance[i] = new TGraphErrors(counter[i],aQ[i],aVariance[i],0,0);
103  graphVariance[i]->Sort();
104  graphVariance[i]->SetMarkerColor(i+1);
105  graphVariance[i]->SetMarkerSize(1);
106  graphVariance[i]->SetMarkerStyle(20);
107  graphVariance[i]->SetLineStyle(2);
108  graphVariance[i]->SetLineColor(i+1);
109 
110  graphSkewness[i] = new TGraphErrors(counter[i],aQ[i],aSkewness[i],0,0);
111  graphSkewness[i]->Sort();
112  graphSkewness[i]->SetMarkerColor(i+1);
113  graphSkewness[i]->SetMarkerSize(1);
114  graphSkewness[i]->SetMarkerStyle(20);
115  graphSkewness[i]->SetLineStyle(2);
116  graphSkewness[i]->SetLineColor(i+1);
117 
118  graphKurtosis[i] = new TGraphErrors(counter[i],aQ[i],aKurtosis[i],0,0);
119  graphKurtosis[i]->Sort();
120  graphKurtosis[i]->SetMarkerColor(i+1);
121  graphKurtosis[i]->SetMarkerSize(1);
122  graphKurtosis[i]->SetMarkerStyle(20);
123  graphKurtosis[i]->SetLineStyle(2);
124  graphKurtosis[i]->SetLineColor(i+1);
125 
126  graphMaxX[i] = new TGraphErrors(counter[i],aQ[i],aMaxX[i],0,0);
127  graphMaxX[i]->Sort();
128  graphMaxX[i]->SetMarkerColor(i+1);
129  graphMaxX[i]->SetMarkerSize(1);
130  graphMaxX[i]->SetMarkerStyle(20);
131  graphMaxX[i]->SetLineStyle(2);
132  graphMaxX[i]->SetLineColor(i+1);
133 
134  }
135  for (int i = 0; i< nPsfPlot; i++)
136  {
137  leg->AddEntry(graphMean[i],TargetMaterialStrings[i],"p");
138  }
139 
140 
141  graphMean[0]->SetTitle(HistoTitleMean);
142  graphMean[0]->GetXaxis()->SetTitleOffset(graphMean[0]->GetXaxis()->GetTitleOffset()*1.2);
143  graphMean[0]->GetYaxis()->SetTitleOffset(graphMean[0]->GetYaxis()->GetTitleOffset()*0.8);
144  graphMean[0]->GetYaxis()->SetRangeUser(0.52,0.5202);
145 
146  graphVariance[0]->SetTitle(HistoTitleVariance);
147  graphVariance[0]->GetXaxis()->SetTitleOffset(graphVariance[0]->GetXaxis()->GetTitleOffset()*1.2);
148  graphVariance[0]->GetYaxis()->SetTitleOffset(graphVariance[0]->GetYaxis()->GetTitleOffset()*0.8);
149  //graphVariance[0]->GetYaxis()->SetRangeUser(0.52,0.5202);
150 
151  graphSkewness[0]->SetTitle(HistoTitleSkewness);
152  graphSkewness[0]->GetXaxis()->SetTitleOffset(graphSkewness[0]->GetXaxis()->GetTitleOffset()*1.2);
153  graphSkewness[0]->GetYaxis()->SetTitleOffset(graphSkewness[0]->GetYaxis()->GetTitleOffset()*0.8);
154  //graphSkewness[0]->GetYaxis()->SetRangeUser(0.52,0.5202);
155 
156  graphKurtosis[0]->SetTitle(HistoTitleKurtosis);
157  graphKurtosis[0]->GetXaxis()->SetTitleOffset(graphKurtosis[0]->GetXaxis()->GetTitleOffset()*1.2);
158  graphKurtosis[0]->GetYaxis()->SetTitleOffset(graphKurtosis[0]->GetYaxis()->GetTitleOffset()*0.8);
159  //graphKurtosis[0]->GetYaxis()->SetRangeUser(0.52,0.5202);
160 
161  graphMaxX[0]->SetTitle(HistoTitleMaxX);
162  graphMaxX[0]->GetXaxis()->SetTitleOffset(graphMaxX[0]->GetXaxis()->GetTitleOffset()*1.2);
163  graphMaxX[0]->GetYaxis()->SetTitleOffset(graphMaxX[0]->GetYaxis()->GetTitleOffset()*0.8);
164  //graphMaxX[0]->GetYaxis()->SetRangeUser(0.52,0.5202);
165 
166  //graphMean[0]->SetLineStyle(2);
167  c1[0]->cd();
168  graphMean[0]->Draw("ALP");
169  for (int i = 1; i< nPsfPlot; i++)
170  {
171  graphMean[i]->Draw("LP");
172  }
173  //leg->Draw();
174  c1[1]->cd();
175  graphVariance[0]->Draw("ALP");
176  for (int i = 1; i< nPsfPlot; i++)
177  {
178  graphVariance[i]->Draw("LP");
179  }
180  //leg->Draw();
181  c1[2]->cd();
182  graphSkewness[0]->Draw("ALP");
183  for (int i = 1; i< nPsfPlot; i++)
184  {
185  graphSkewness[i]->Draw("LP");
186  }
187  //leg->Draw();
188  c1[3]->cd();
189  graphKurtosis[0]->Draw("ALP");
190  for (int i = 1; i< nPsfPlot; i++)
191  {
192  graphKurtosis[i]->Draw("LP");
193  }
194  //leg->Draw();
195 
196  c1[4]->cd();
197  graphMaxX[0]->Draw("ALP");
198  for (int i = 1; i< nPsfPlot; i++)
199  {
200  graphMaxX[i]->Draw("LP");
201  }
202  //leg->Draw();
203 
204  //cout << PicRootDir.Data() << endl;
205 
206 
207  TFile *RootInfile[nFiles];
208  for (int i = 0;i<nFiles;i++)
209  {
210  RootInfile[i]= new TFile(RootInputFiles[i].Data());
211  RootInfile[i]->GetObject("fGausFitCombined;1",fTemporary[i]);
212  //fTemporary[i]->SetDirectory(0);
213  fTemporary[i]->SetLineColor(ColorArrrayFunction[i]);
214  RootInfile[i]->Close();
215  }
216  TCanvas *cComparison = new TCanvas("cComparison","direct Comparison",1200,800);
217  cComparison->SetGrid();
218  cComparison->SetTicks();
219  cComparison->SetLeftMargin(0.12);
220  cComparison->SetBottomMargin(0.10);
221  TLegend* leg2 = new TLegend(0.7,0.7,0.9,0.9);
222  leg2->AddEntry(fTemporary[0],"Q = 0.00 fm^{2}e","l");
223  leg2->AddEntry(fTemporary[1],"Q = -0.02 fm^{2}e","l");
224  leg2->AddEntry(fTemporary[2],"Q = -0.04 fm^{2}e","l");
225  fTemporary[0]->SetTitle("");
226  fTemporary[0]->GetXaxis()->SetTitle("Energy [MeV]");
227  fTemporary[0]->GetXaxis()->SetTitleOffset(1.05);
228  fTemporary[0]->GetYaxis()->SetTitle("Counts [a.u.]");
229  fTemporary[0]->GetYaxis()->SetTitleOffset(1.3);
230  fTemporary[0]->Draw();
231  for (int i = 1;i<nFiles;i++)
232  {
233  fTemporary[i]->Draw("same");
234  }
235  leg2->Draw();
236 
237  andi::saveCanvas_allFileNames(c1[0],TString::Format("%s/OmegaQuadrupole/%s",PicRootDir.Data(),"Mean"));
238  andi::saveCanvas_allFileNames(c1[1],TString::Format("%s/OmegaQuadrupole/%s",PicRootDir.Data(),"Variance"));
239  andi::saveCanvas_allFileNames(c1[2],TString::Format("%s/OmegaQuadrupole/%s",PicRootDir.Data(),"Skewness"));
240  andi::saveCanvas_allFileNames(c1[3],TString::Format("%s/OmegaQuadrupole/%s",PicRootDir.Data(),"Kurtosis"));
241  andi::saveCanvas_allFileNames(c1[4],TString::Format("%s/OmegaQuadrupole/%s",PicRootDir.Data(),"MaxX"));
242  andi::saveCanvas_allFileNames(cComparison,TString::Format("%s/OmegaQuadrupole/%s",PicRootDir.Data(),"ShapeComparison"));
243  return 0;
244 }
Int_t i
Definition: run_full.C:25
hz_h GetYaxis() -> SetTitle("Counts")
hz_h GetXaxis() -> SetTitle("Z position")
int counter
Definition: ZeeAnalysis.C:59
Double_t
c1
Definition: plot_dirc.C:35
int Pic_OmegaQuadrupoleComparison()