ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
analyse_ch_eff.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file analyse_ch_eff.C
1 // Function for the computation of the channeling efficiency
3 
4  Double_t vXMin = fPar[1] - 3. * fPar[2];
5  Double_t vXMax = fPar[1] + 3. * fPar[2];
6 
7  Int_t vBinMin = h1->FindBin(vXMin);
8  Int_t vBinMed = h1->FindBin(fPar[1]);
9  Int_t vBinMax = h1->FindBin(vXMax);
10 
11  Double_t vEfficiency = h1->Integral(vBinMin+1,vBinMax-1);
12  vEfficiency += h1->GetBinContent(vBinMin)*(h1->GetBinLowEdge(vBinMin+1)-vXMin)/h1->GetBinWidth(vBinMin);
13  vEfficiency += h1->GetBinContent(vBinMax)*(-h1->GetBinLowEdge(vBinMax)+vXMax)/h1->GetBinWidth(vBinMax);
14  vEfficiency /= h1->Integral(0,-1);
15  vEfficiency *= 100.;
16 
17  return vEfficiency;
18 }
19 
20 // Function for the computation of channeling efficiency at various incoming angle
21 Int_t AnalyseChannelingEfficiency(TTree *fTree,Float_t fChannelingMinimum = 35., Float_t fChannelingMaximum = 70.){
22  //**//Channeling Gaussian Fit Function
23  TF1 *vChanneling = new TF1("vChanneling","gaus",fChannelingMinimum,fChannelingMaximum);
24  vChanneling->SetParNames("Const","Mean","Sigma");
25  vChanneling->SetLineColor(4);
26  vChanneling->SetLineStyle(2);
27 
28  TH2D *hChannelingPlot = new TH2D("hChannelingPlot","Deflection Angle vs. Incoming Angle;Horizontal Incoming Angle [#murad];Horizontal Deflection Angle [#murad]",21,-10.5,10.5,256,-127.5,128.5);
29 
30  TH1F *hChannelingEfficiency = new TH1F("hChannelingEfficiency","G4Channeling;Horizontal Incoming Angle [#murad];Efficiency [%]",21,-10.5,10.5);
31 
32  fTree->Draw("(angXout-angXin):angXin>>hChannelingPlot");
33 
34  Double_t vNormalizationToAmorphous = 0.965; // Normalization for channeling efficiency, see PRSTAB 11, 063501 (2008)
35 
36  for(int i=2;i<=21;i++){
37  TH1D* h1 = hChannelingPlot->ProjectionY("h1",i,i);
38  h1->Fit(vChanneling,"QR");
39  Double_t *vChannelingParameters;
40  vChannelingParameters = vChanneling->GetParameters();
41  hChannelingEfficiency->SetBinContent(i,ComputeEfficiency(h1,vChannelingParameters)/vNormalizationToAmorphous);
42  h1->Delete();
43  }
44  hChannelingEfficiency->SetLineColor(3);
45  hChannelingEfficiency->SetLineStyle(4);
46  hChannelingEfficiency->SetMarkerColor(3);
47  hChannelingEfficiency->SetFillStyle(0);
48  hChannelingEfficiency->SetMarkerStyle(20);
49  hChannelingEfficiency->Draw("PL");
50 
51  TGraph* gRoughExperimentalData = new TGraph(11);
52  gRoughExperimentalData->SetPoint( 0 , -10 , 20 );
53  gRoughExperimentalData->SetPoint( 1 , -8 , 38 );
54  gRoughExperimentalData->SetPoint( 2 , -6 , 56 );
55  gRoughExperimentalData->SetPoint( 3 , -4 , 72 );
56  gRoughExperimentalData->SetPoint( 4 , -2 , 80 );
57  gRoughExperimentalData->SetPoint( 5 , 0 , 84 );
58  gRoughExperimentalData->SetPoint( 6 , 2 , 82 );
59  gRoughExperimentalData->SetPoint( 7 , 4 , 78 );
60  gRoughExperimentalData->SetPoint( 8 , 6 , 66 );
61  gRoughExperimentalData->SetPoint( 9 , 8 , 52 );
62  gRoughExperimentalData->SetPoint( 10 , 10 , 37 );
63 
64  gRoughExperimentalData->SetLineColor(4);
65  gRoughExperimentalData->SetLineStyle(3);
66  gRoughExperimentalData->SetFillStyle(0);
67  gRoughExperimentalData->SetFillColor(0);
68  gRoughExperimentalData->SetMarkerColor(4);
69  gRoughExperimentalData->SetMarkerStyle(21);
70  gRoughExperimentalData->SetTitle("Phys. Lett. B 680, 129");
71 
72  gRoughExperimentalData->Draw("sameCP");
73 
74  TLegend *aLegend = new TLegend(0.30,0.15,0.55,0.3);
75  aLegend->AddEntry(hChannelingEfficiency);
76  aLegend->AddEntry(gRoughExperimentalData);
77  aLegend->SetFillStyle(0);
78  aLegend->SetLineColor(0);
79  aLegend->Draw();
80 
81  return 0;
82 }