Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
bcal_hist_eff.C
Go to the documentation of this file.
1 
2 // File: bcal_hist_eff.C
3 // Created: 03/12/15
4 // Creator: Elton Smith
5 // Purpose: Display bcal efficiency plots
6 // Uses output of BCAL_Eff/DEventProcessor_BCAL_Eff.cc
7 
8 // hnamepath: /bcal_eff/h1eff_eff
9 // hnamepath: /bcal_eff/h1eff_cellideff
10 // hnamepath: /bcal_eff/h1eff2_eff2
11 // hnamepath: /bcal_eff/h1eff2_cellideff2
12 
13 // hnamepath: /bcal_eff/h1eff_layer
14 // hnamepath: /bcal_eff/h1eff_layertot
15 // hnamepath: /bcal_eff/h1eff2_layer
16 // hnamepath: /bcal_eff/h1eff2_layertot
17 // hnamepath: /bcal_eff/h1eff_cellid
18 // hnamepath: /bcal_eff/h1eff_cellidtot
19 // hnamepath: /bcal_eff/h1eff2_cellid
20 // hnamepath: /bcal_eff/h1eff2_cellidtot
21 
22 {
23  gStyle->SetPalette(1,0);
24  gStyle->SetOptStat(kFALSE);
25  gStyle->SetPadRightMargin(0.15);
26  gStyle->SetPadLeftMargin(0.15);
27  gStyle->SetPadBottomMargin(0.15);
28 
29  // get histograms from bcal_eff subdirectory
30 
31  TDirectory *dir = (TDirectory*)gDirectory->FindObjectAny("bcal_eff");
32  if(!dir){
33  cout << "Can't find bcal_eff TDirectory!" << endl;
34  return;
35  }
36 
37  TH1F *h1eff_eff = (TH1F*)dir->Get("h1eff_eff" );
38  TH1F *h1eff_cellideff = (TH1F*)dir->Get("h1eff_cellideff" );
39  TH1F *h1eff2_eff2 = (TH1F*)dir->Get("h1eff2_eff2" );
40  TH1F *h1eff2_cellideff2 = (TH1F*)dir->Get("h1eff2_cellideff2" );
41 
42  TH1F *h1eff_layer = (TH1F*)dir->Get("h1eff_layer" );
43  TH1F *h1eff_layertot = (TH1F*)dir->Get("h1eff_layertot" );
44  TH1F *h1eff2_layer = (TH1F*)dir->Get("h1eff2_layer" );
45  TH1F *h1eff2_layertot = (TH1F*)dir->Get("h1eff2_layertot" );
46  TH1F *h1eff_cellid = (TH1F*)dir->Get("h1eff_cellid" );
47  TH1F *h1eff_cellidtot = (TH1F*)dir->Get("h1eff_cellidtot" );
48  TH1F *h1eff2_cellid = (TH1F*)dir->Get("h1eff2_cellid" );
49  TH1F *h1eff2_cellidtot = (TH1F*)dir->Get("h1eff2_cellidtot" );
50 
51  if( !h1eff_eff ) { cout << "Can't find h1eff_eff!" << endl; return; }
52  if( !h1eff_cellideff ) { cout << "Can't find h1eff_cellideff!" << endl; return; }
53  if( !h1eff2_eff2 ) { cout << "Can't find h1eff2_eff2!" << endl; return; }
54  if( !h1eff2_cellideff2 ) { cout << "Can't find h1eff2_cellideff2!" << endl; return; }
55 
56  if( !h1eff_layer ) { cout << "Can't find h1eff_layer!" << endl; return; }
57  if( !h1eff_layertot ) { cout << "Can't find h1eff_layertot!" << endl; return; }
58  if( !h1eff2_layer ) { cout << "Can't find h1eff2_layer!" << endl; return; }
59  if( !h1eff2_layertot ) { cout << "Can't find h1eff2_layertot!" << endl; return; }
60  if( !h1eff_cellid ) { cout << "Can't find h1eff_cellid!" << endl; return; }
61  if( !h1eff_cellidtot ) { cout << "Can't find h1eff_cellidtot!" << endl; return; }
62  if( !h1eff2_cellid ) { cout << "Can't find h1eff2_cellid!" << endl; return; }
63  if( !h1eff2_cellidtot ) { cout << "Can't find h1eff2_cellidtot!" << endl; return; }
64 
65  // The efficiency hist definitions are grabbed from the remote
66  // process, but we calculate the ratio here using the cumulative
67  // histos. Note that the BCAL_Eff plugin does this in the fini
68  // method, but not during filling so the efficiency histos we grab
69  // for display in ROOTSpy are empty anyway.
70  h1eff_eff->Divide(h1eff_layer,h1eff_layertot,1,1,"B");
71  h1eff2_eff2->Divide(h1eff2_layer,h1eff2_layertot,1,1,"B");
72  h1eff_cellideff->Divide(h1eff_cellid,h1eff_cellidtot,1,1,"B");
73  h1eff2_cellideff2->Divide(h1eff2_cellid,h1eff2_cellidtot,1,1,"B");
74 
75  //
76  if(gPad == NULL){
77  TCanvas *c1 = new TCanvas("c1","c1 bcal_hist_eff ",200,10,700,700);
78  c1->cd(0);
79  c1->Draw();
80  c1->Update();
81  }
82 
83  if(!gPad) return;
84  TCanvas *c1 = gPad->GetCanvas();
85 
86  c1->SetBorderMode(0);
87  c1->SetFillColor(0);
88 
89  Double_t ymin=0.5;
90  // Double_t ymin=0.;
91  Double_t ymax=1.1;
92 
93  c1->SetGridx();
94  c1->SetGridy();
95  c1->SetBorderMode(0);
96  c1->SetFillColor(0);
97 
98  c1->Divide(2,2);
99  c1->cd(1);
100 
101  h1eff_eff->SetTitle("");
102  //h1eff_eff->GetXaxis()->SetRangeUser(xmin,xmax);
103  h1eff_eff->GetYaxis()->SetRangeUser(ymin,ymax);
104  h1eff_eff->GetXaxis()->SetTitleSize(0.05);
105  h1eff_eff->GetYaxis()->SetTitleSize(0.05);
106  //h1eff_eff->GetXaxis()->SetTitle("Layer");
107  h1eff_eff->GetYaxis()->SetTitle("Efficiency Clusters");
108  h1eff_eff->SetLineColor(2);
109  h1eff_eff->Draw("");
110 
111 
112  c1->cd(2);
113 
114  h1eff_cellideff->SetTitle("");
115  // h1eff_cellideff->GetXaxis()->SetRangeUser(xmin,xmax);
116  h1eff_cellideff->GetYaxis()->SetRangeUser(ymin,ymax);
117  h1eff_cellideff->GetXaxis()->SetTitleSize(0.05);
118  h1eff_cellideff->GetYaxis()->SetTitleSize(0.05);
119  //h1eff_cellideff->GetXaxis()->SetTitle("Layer");
120  h1eff_cellideff->GetYaxis()->SetTitle("Efficiency Clusters");
121  h1eff_cellideff->SetLineColor(2);
122  h1eff_cellideff->Draw("");
123 
124 
125  c1->cd(3);
126 
127  h1eff2_eff2->SetTitle("");
128  // h1eff2_eff2->GetXaxis()->SetRangeUser(xmin,xmax);
129  h1eff2_eff2->GetYaxis()->SetRangeUser(ymin,ymax);
130  h1eff2_eff2->GetXaxis()->SetTitleSize(0.05);
131  h1eff2_eff2->GetYaxis()->SetTitleSize(0.05);
132  //h1eff2_eff2->GetXaxis()->SetTitle("Layer");
133  h1eff2_eff2->GetYaxis()->SetTitle("Efficiency Enhanced Hits");
134  h1eff2_eff2->SetLineColor(2);
135  h1eff2_eff2->Draw("");
136 
137 
138  c1->cd(4);
139 
140  h1eff2_cellideff2->SetTitle("");
141  // h1eff2_cellideff2->GetXaxis()->SetRangeUser(xmin,xmax);
142  h1eff2_cellideff2->GetYaxis()->SetRangeUser(ymin,ymax);
143  h1eff2_cellideff2->GetXaxis()->SetTitleSize(0.05);
144  h1eff2_cellideff2->GetYaxis()->SetTitleSize(0.05);
145  //h1eff2_cellideff2->GetXaxis()->SetTitle("Layer");
146  h1eff2_cellideff2->GetYaxis()->SetTitle("Efficiency Enhanced Hits");
147  h1eff2_cellideff2->SetLineColor(2);
148  h1eff2_cellideff2->Draw("");
149 
150 }
151 
152 
TH1F * h1eff2_cellideff2
Definition: bcal_hist_eff.C:40
TH1F * h1eff2_layer
Definition: bcal_hist_eff.C:44
TH1F * h1eff2_eff2
Definition: bcal_hist_eff.C:39
Double_t c1[2][NMODULES]
Definition: tw_corr.C:68
TH1F * h1eff_cellidtot
Definition: bcal_hist_eff.C:47
TH1F * h1eff_layertot
Definition: bcal_hist_eff.C:43
TH1F * h1eff2_layertot
Definition: bcal_hist_eff.C:45
TH1F * h1eff_layer
Definition: bcal_hist_eff.C:42
TH1F * h1eff_cellideff
Definition: bcal_hist_eff.C:38
TH1F * h1eff_eff
Definition: bcal_hist_eff.C:37
TH1F * h1eff_cellid
Definition: bcal_hist_eff.C:46
Double_t ymin
Definition: bcal_hist_eff.C:89
TH1F * h1eff2_cellid
Definition: bcal_hist_eff.C:48
TH1F * h1eff2_cellidtot
Definition: bcal_hist_eff.C:49
Double_t ymax
Definition: bcal_hist_eff.C:91
TDirectory * dir
Definition: bcal_hist_eff.C:31