Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DIRC_occupancy.C
Go to the documentation of this file.
1 
2 // The following are special comments used by RootSpy to know
3 // which histograms to fetch for the macro.
4 //
5 // hnamepath: /occupancy/dirc_num_events
6 // hnamepath: /occupancy/dirc_tdc_pixel_N_occ
7 // hnamepath: /occupancy/dirc_tdc_pixel_S_occ
8 // hnamepath: /occupancy/dirc_tdc_pixel_N_occ_led
9 // hnamepath: /occupancy/dirc_tdc_pixel_S_occ_led
10 //
11 // e-mail: davidl@jlab.org
12 // e-mail: marki@jlab.org
13 // e-mail: tbritton@jlab.org
14 //
15 
16 {
17  // RootSpy saves the current directory and style before
18  // calling the macro and restores it after so it is OK to
19  // change them and not change them back.
20  TDirectory *savedir = gDirectory;
21  TDirectory *dir = (TDirectory*)gDirectory->FindObjectAny("occupancy");
22  if(dir) dir->cd();
23 
24  TH2I *dirc_tdc_pixel_N_occ_led = (TH2I*)gDirectory->FindObjectAny("dirc_tdc_pixel_N_occ_led");
25  TH2I *dirc_tdc_pixel_S_occ_led = (TH2I*)gDirectory->FindObjectAny("dirc_tdc_pixel_S_occ_led");
26  TH2I *dirc_tdc_pixel_N_occ = (TH2I*)gDirectory->FindObjectAny("dirc_tdc_pixel_N_occ");
27  TH2I *dirc_tdc_pixel_S_occ = (TH2I*)gDirectory->FindObjectAny("dirc_tdc_pixel_S_occ");
28 
29  // Just for testing
30  if(gPad == NULL){
31  TCanvas *c1 = new TCanvas("c1","DIRC Occupancy",600,400);
32  c1->cd(0);
33  c1->Draw();
34  c1->Update();
35  }
36  if(!gPad) {savedir->cd(); return;}
37 
38  TCanvas *c1 = gPad->GetCanvas();
39  c1->cd(0);
40  c1->Clear();
41 
42  TPad *p1 = (TPad*)gDirectory->FindObjectAny("dirc_occ_pad1");
43  if(!p1)p1 = new TPad("dirc_occ_pad1","p1",0.,0.5,1.,1.);
44  p1->Draw();
45  p1->cd();
46  gStyle->SetOptStat(0);
47  if(dirc_tdc_pixel_S_occ_led) dirc_tdc_pixel_S_occ_led->DrawCopy("colz");
48 
49  c1->cd(0);
50  TPad *p2 = (TPad*)gDirectory->FindObjectAny("dirc_occ_pad2");
51  if(!p2)p2 = new TPad("dirc_occ_pad2","p1",0.,0.,1.,0.5);
52  p2->Draw();
53  p2->cd();
54  gStyle->SetOptStat(0);
55  if(dirc_tdc_pixel_S_occ) dirc_tdc_pixel_S_occ->DrawCopy("colz");
56 }
Double_t c1[2][NMODULES]
Definition: tw_corr.C:68
TDirectory * savedir
TDirectory * dir
Definition: bcal_hist_eff.C:31