FairRoot/PandaRoot
Pic_FEP_DEGASComparison.C
Go to the documentation of this file.
2 {
3  andi::setCustomStyle();
4  //TString HistoTitle = "Simulation of full-energy-peak-efficiency;#gamma energy [MeV]; Full-energy-peak-efficiency [%]";
5  TString HistoTitle = ";#gamma energy [MeV]; Full-energy-peak-efficiency [%]";
6  const int nGeometries = 3;
7  const int nPoints = 38;
8  TString PicName = "FEPcomparison_NewGeometries";
9  TString PicName2 = "FEPRatios_NewGeometries";
10  Double_t x[nGeometries][nPoints],y[nGeometries][nPoints],yE[nGeometries][nPoints]; //without target
11  Int_t TargetNumbers[nGeometries] = {36,41,42};
12  Int_t counter[nGeometries] = {0,0};
13  Color_t ColorArrray[nGeometries] = {kBlack, kRed,kBlue};
14  TString TargetMaterialStrings[nGeometries] = {"old Geometry (16)","DEGAS straight (20)","DEGAS Ball (18)"};
15  TString ComparisonStrings[nGeometries] = {"straight/old","ball/old","straight/ball"};
16  Double_t Loss[nPoints];
17  TGraphErrors *graphTr4020[nGeometries];
18  ifstream Inputfile("/data/work/kpha1/steinen/Gamma/Ana/CombinedData/Fitted/FittedDataNewGeometry.txt");
19 
20  Int_t Geometry, Sektar, nEvents;
21  Double_t Energy, FullEnergyPeakEff, FullEnergyPeakEffError, FWHM, FWHMError,FullEnergyPeakEffSEP, FullEnergyPeakEffSEPError,FullEnergyPeakEffSEPDEP, FullEnergyPeakEffSEPDEPError;
22  char InputName[100];
23 
24  bool useNoTargetComparison = 1;
25  while(Inputfile >> Geometry >> Sektar >> Energy >> nEvents >> FullEnergyPeakEff >> FullEnergyPeakEffError >>FWHM >> FWHMError>> FullEnergyPeakEffSEP >> FullEnergyPeakEffSEPError>>FullEnergyPeakEffSEPDEP >> FullEnergyPeakEffSEPDEPError )
26  {
27  for (int i = 0; i < nGeometries; i++)
28  {
29  if (Geometry == TargetNumbers[i])
30  {
31  x[i][counter[i]] = Energy;
32  y[i][counter[i]] = FullEnergyPeakEff;
33  yE[i] [counter[i]]= FullEnergyPeakEffError;
34  cout <<counter[i] << " "<< Sektar << " " << x[i][counter[i] ] <<" " <<y[i][counter[i] ] << " " <<yE[i][counter[i] ]<<endl;
35  counter[i]++;
36  }
37  }
38  }
39 
40 
41  Inputfile.close();
42  TCanvas *c1 = new TCanvas("c1","c1",800,600);
43  c1->SetGridx(1);
44  c1->SetGridy(1);
45  TLegend* leg = new TLegend(0.7,0.7,0.9,0.9);
46  //TGraph *graph = new TGraph(10,x,y);
47  for (int i = 0; i< nGeometries; i++)
48  {
49  graphTr4020[i] = new TGraphErrors(nPoints,x[i],y[i],0,yE[i]);
50  graphTr4020[i]->SetMarkerColor(i+1);
51  graphTr4020[i]->SetMarkerSize(1);
52  graphTr4020[i]->SetMarkerStyle(20);
53  graphTr4020[i]->SetLineStyle(2);
54  graphTr4020[i]->SetLineColor(i+1);
55  graphTr4020[i]->SetTitle(HistoTitle);
56  graphTr4020[i]->GetXaxis()->SetTitleOffset(graphTr4020[i]->GetXaxis()->GetTitleOffset()*1.2);
57  graphTr4020[i]->GetYaxis()->SetTitleOffset(graphTr4020[i]->GetYaxis()->GetTitleOffset()*0.8);
58  graphTr4020[i]->GetYaxis()->SetRangeUser(0,12);
59 
60  leg->AddEntry(graphTr4020[i],TargetMaterialStrings[i],"p");
61 
62  }
63 
64 
65  //graphTr4020[0]->SetLineStyle(2);
66  //graphTr4020[0]->Draw("ALP");
67  for (int i = 1; i< nGeometries-1; i++)
68  {
69  graphTr4020[i]->Sort();
70  if (i ==0)
71  graphTr4020[0]->Draw("ALP");
72  else
73  graphTr4020[i]->Draw("ALP");
74  }
75  //leg->Draw();
76 
77  TString PicRootDir = gSystem->Getenv("PICTUREDIR");
78  cout << PicRootDir.Data() << endl;
79  andi::saveCanvas_allFileNames(c1,TString::Format("%s/XiAtoms/Gamma/%s",PicRootDir.Data(),PicName.Data()));
80 
81  // now plots to compare the values of the geometries
82 
83  Double_t CompArray[nGeometries][nPoints]; // 0 = 41/36 ; 1 = 42/36 ; 2 = 41/42
84 
85  for (int j = 0; j < nPoints; j++)
86  {
87  CompArray[0][j]= y[1][j]/y[0][j]*100;
88  CompArray[1][j]= y[2][j]/y[0][j]*100;
89  CompArray[2][j]= y[1][j]/y[2][j]*100;
90  cout << CompArray[1][j] << endl;
91  }
92  TGraph *graphComp[nGeometries];
93 
94  TCanvas *c2 = new TCanvas("c2","c2",800,600);
95  c2->SetGridx(1);
96  c2->SetGridy(1);
97  TLegend* leg2 = new TLegend(0.7,0.7,0.9,0.9);
98  for (int i = 0; i< nGeometries; i++)
99  {
100  graphComp[i] =new TGraph(nPoints,x[i],CompArray[i]);
101  graphComp[i]->SetMarkerColor(i+2);
102  graphComp[i]->SetMarkerSize(1);
103  graphComp[i]->SetMarkerStyle(20);
104  graphComp[i]->SetLineStyle(2);
105  graphComp[i]->SetLineColor(i+1);
106  if (i ==0)
107  leg2->AddEntry(graphComp[i],ComparisonStrings[i],"p");
108  }
109  TString CompTitle = "Comparison of full-energy-peak-efficiency;#gamma energy [MeV]; Ratio of fep [%]";
110  graphComp[0]->SetTitle(CompTitle);
111  graphComp[0]->GetXaxis()->SetTitleOffset(graphComp[0]->GetXaxis()->GetTitleOffset()*1.2);
112  graphComp[0]->GetYaxis()->SetTitleOffset(graphComp[0]->GetYaxis()->GetTitleOffset()*0.8);
113  graphComp[0]->GetYaxis()->SetRangeUser(100,130);
114 
115  for (int i = 0; i< nGeometries; i++)
116  {
117  graphComp[i]->Sort();
118  if (i ==0)
119  graphComp[0]->Draw("ALP");
120  //else
121  //graphComp[i]->Draw("LP");
122  }
123  leg2->Draw();
124 
125  andi::saveCanvas_allFileNames(c2,TString::Format("%s/XiAtoms/Gamma/%s",PicRootDir.Data(),PicName2.Data()));
126  return 0;
127 }
Int_t i
Definition: run_full.C:25
c2
Definition: plot_dirc.C:39
hz_h GetYaxis() -> SetTitle("Counts")
hz_h GetXaxis() -> SetTitle("Z position")
int counter
Definition: ZeeAnalysis.C:59
Double_t
Int_t nEvents
Definition: hit_dirc.C:11
c1
Definition: plot_dirc.C:35
Double_t x
Double_t y
int Pic_FEP_DEGASComparison()