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4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 // Function for the computation of the channeling efficiency
  2 Double_t ComputeEfficiency(TH1D *h1,Double_t *fPar){
  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 }
 83