Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TAG_eff.C
Go to the documentation of this file.
1 // The following are special comments used by RootSpy to know
2 // which histograms to fetch for the macro.
3 //
4 
5 // hnamepath: /PSPair/PSC_PS_TAGH/PSTAGH_E
6 // hnamepath: /PSPair/PSC_PS_TAGM/PSTAGM_E
7 // hnamepath: /PSPair/PSC_PS/PS_E
8 
9 {
10  TDirectory *dir = (TDirectory*)gDirectory->FindObjectAny("PSPair");
11  if(dir) dir->cd();
12 
13  TH1F *E_tagh =(TH1F*)gDirectory->Get("PSC_PS_TAGH/PSTAGH_E");
14  TH1F *E_tagm =(TH1F*)gDirectory->Get("PSC_PS_TAGM/PSTAGM_E");
15  TH1F *E_ps =(TH1F*)gDirectory->Get("PSC_PS/PS_E");
16 
17  TH1F *eff_tagh = (TH1F*)E_tagh->Clone();
18  TH1F *eff_tagm = (TH1F*)E_tagm->Clone();
19  eff_tagh->Sumw2();
20  eff_tagm->Sumw2();
21  eff_tagh->Divide(E_tagh,E_ps);
22  eff_tagm->Divide(E_tagm,E_ps);
23 
24  if(gPad == NULL){
25  TCanvas *c1 = new TCanvas("c1","Tagger Efficiency",150,10,990,660);
26  c1->cd(0);
27  c1->Draw();
28  c1->Update();
29  }
30 
31  if(!gPad) return;
32  TCanvas* c1 = gPad->GetCanvas();
33 
34  gStyle->SetOptStat("");
35  TLegend *tleg = new TLegend(0.75,0.75,0.90,0.90);
36  tleg->SetTextSize(0.045);
37  tleg->AddEntry(eff_tagm,"TAGM","l");
38  tleg->AddEntry(eff_tagh,"TAGH","l");
39  eff_tagh->SetTitle("Tagger Efficiency");
40  eff_tagh->SetTitleSize(0.045);
41  eff_tagh->GetXaxis()->SetTitleSize(0.045);
42  eff_tagh->GetYaxis()->SetTitleSize(0.045);
43  eff_tagh->GetXaxis()->SetTitle("PS energy [GeV]");
44  eff_tagh->GetYaxis()->SetTitle("N(TAGX,PSC,PS) / N(PSC,PS)");
45  eff_tagh->GetXaxis()->SetRange(eff_tagh->FindFirstBinAbove(0.001),eff_tagh->FindLastBinAbove(0.001));
46  eff_tagh->SetAxisRange(0.0,1.0,"Y");
47  eff_tagh->SetLineColor(kGreen);
48  eff_tagh->Draw();
49  eff_tagm->SetLineColor(kRed);
50  eff_tagm->Draw("same");
51  tleg->Draw();
52 
53 }
TLegend * tleg
Definition: TAG_eff.C:35
Double_t c1[2][NMODULES]
Definition: tw_corr.C:68
TDirectory * dir
Definition: bcal_hist_eff.C:31