Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plot_epics_dump.C
Go to the documentation of this file.
1 // Include livetime histograms from synch events
2 // and beam current from epics events
3 
4 
5 // hnamepath: /EPICS_dump/h1epics_trgbits
6 // hnamepath: /EPICS_dump/h1epics_AD00
7 // hnamepath: /EPICS_dump/h1epics_pos_inner
8 // hnamepath: /EPICS_dump/h1epics_pos_outer
9 // hnamepath: /EPICS_dump/h1epics_liveinst_VSevent
10 // hnamepath: /EPICS_dump/h1epics_AD00_VSevent
11 // hnamepath: /EPICS_dump/h1epics_entries1_VSevent
12 // hnamepath: /EPICS_dump/h1epics_entries2_VSevent
13 // hnamepath: /EPICS_dump/h1epics_liveinst
14 
15 
16 {
17  gStyle->SetPalette(1,0);
18  gStyle->SetOptStat(kTRUE);
19  gStyle->SetOptStat(111111);
20  gStyle->SetPadRightMargin(0.15);
21  gStyle->SetPadLeftMargin(0.15);
22  gStyle->SetPadBottomMargin(0.15);
23 
24  char string[256];
25  Int_t const nscalers=32;
26 
27  // TString filename = "outputfile_010707d";
28  // TFile* f = new TFile(filename+".root");
29 
30  // get histograms from trig subdirectory
31 
32  TDirectory *dir = (TDirectory*)gDirectory->FindObjectAny("EPICS_dump");
33  if(!dir){
34  cout << "Can't find EPICS_dump TDirectory!" << endl;
35  return;
36  }
37 
38  TH1F *h1epics_trgbits = (TH1F*)dir->Get("h1epics_trgbits" );
39  TH1F *h1epics_AD00 = (TH1F*)dir->Get("h1epics_AD00" );
40  TH1F *h1epics_pos_inner = (TH1F*)dir->Get("h1epics_pos_inner" );
41  TH1F *h1epics_pos_outer = (TH1F*)dir->Get("h1epics_pos_outer" );
42 
43  if( !h1epics_trgbits ) { cout << "Can't find h1epics_trgbits!" << endl; return; }
44  if( !h1epics_AD00 ) { cout << "Can't find h1epics_AD00" << endl; return; }
45  if( !h1epics_pos_inner ) { cout << "Can't find h1epics_pos_inner!" << endl; return; }
46  if( !h1epics_pos_outer ) { cout << "Can't find h1epics_pos_outer!" << endl; return; }
47 
48 
49  TH1F *h1epics_liveinst_VSevent = (TH1F*)dir->Get("h1epics_liveinst_VSevent");
50  TH1F *h1epics_AD00_VSevent = (TH1F*)dir->Get("h1epics_AD00_VSevent");
51  TH1F *h1epics_entries1_VSevent = (TH1F*)dir->Get("h1epics_entries1_VSevent");
52  TH1F *h1epics_entries2_VSevent = (TH1F*)dir->Get("h1epics_entries2_VSevent");
53  TH1F *h1epics_liveinst = (TH1F*)dir->Get("h1epics_liveinst");
54 
55  if( !h1epics_liveinst_VSevent ) { cout << "Can't find h1epics_liveinst_VSevent!" << endl; return; }
56  if( !h1epics_AD00_VSevent ) { cout << " Can't find h1epics_AD00_VSevent!" << endl; return; }
57  if( !h1epics_entries1_VSevent ) { cout << "Can't find h1epics_entries1_VSevent" << endl; return; }
58  if( !h1epics_entries2_VSevent ) { cout << "Can't find h1epics_entries2_VSevent" << endl; return; }
59  if( !h1epics_liveinst ) { cout << "Can't find h1epics_liveinst" << endl; return; }
60 
63 
64  for (Int_t j=0; j<nscalers;j++) {
65  sprintf (string,"Rates%d(kHz)",j);
66  h1_trig_rates[j] = (TH1I*)dir->Get(string);
67  sprintf (string,"Livetimes%d",j);
68  h1_trig_livetimes[j] = (TH1I*)dir->Get(string);
69  }
70 
71  TCanvas *c0 = new TCanvas("c0", "c0",200,10,700,700);
72 
73  c0->Divide(2,2);
74  c0->cd(1);
75  gPad->SetLogy();
76 
77  h1epics_trgbits->SetTitle(filename);
78  // h1epics_trgbits->GetXaxis()->SetRangeUser(xmin,xmax);
79  // h1epics_trgbits->GetYaxis()->SetRangeUser(ymin,ymax);
80  h1epics_trgbits->GetXaxis()->SetTitleSize(0.05);
81  h1epics_trgbits->GetYaxis()->SetTitleSize(0.05);
82  h1epics_trgbits->GetXaxis()->SetTitle("trig_mask || (20+fp_trig_mask/256)");
83  h1epics_trgbits->SetLineColor(2);
84  h1epics_trgbits->Draw("");
85 
86  c0->cd(2);
87 
88  h1epics_AD00->SetTitle(filename);
89  // h1epics_AD00->GetXaxis()->SetRangeUser(xmin,xmax);
90  // h1epics_AD00->GetYaxis()->SetRangeUser(ymin,ymax);
91  h1epics_AD00->GetXaxis()->SetTitleSize(0.05);
92  h1epics_AD00->GetYaxis()->SetTitleSize(0.05);
93  h1epics_AD00->GetXaxis()->SetTitle("Electron Current AD00 (nA)");
94  h1epics_AD00->SetLineColor(2);
95  h1epics_AD00->Draw("");
96 
97  c0->cd(3);
98 
99  // h1epics_pos_inner->SetTitle("");
100  // h1epics_pos_inner->GetXaxis()->SetRangeUser(xmin,xmax);
101  // h1epics_pos_inner->GetYaxis()->SetRangeUser(ymin,ymax);
102  h1epics_pos_inner->GetXaxis()->SetTitleSize(0.05);
103  h1epics_pos_inner->GetYaxis()->SetTitleSize(0.05);
104  // h1epics_pos_inner->GetXaxis()->SetTitle("Y vs X (Active outer)");
105  h1epics_pos_inner->SetLineColor(2);
106  h1epics_pos_inner->Draw("colz");
107 
108  c0->cd(4);
109 
110  // h1epics_pos_outer->SetTitle("");
111  // h1epics_pos_outer->GetXaxis()->SetRangeUser(xmin,xmax);
112  // h1epics_pos_outer->GetYaxis()->SetRangeUser(ymin,ymax);
113  h1epics_pos_outer->GetXaxis()->SetTitleSize(0.05);
114  h1epics_pos_outer->GetYaxis()->SetTitleSize(0.05);
115  // h1epics_pos_outer->GetXaxis()->SetTitle("Y vs X (Active outer)");
116  h1epics_pos_outer->SetLineColor(2);
117  h1epics_pos_outer->Draw("colz");
118 
119 
120  TCanvas *c1 = new TCanvas("c1", "c1",200,10,700,700);
121 
122  // h1epics_liveinst->SetTitle("");
123  // h1epics_liveinst->GetXaxis()->SetRangeUser(xmin,xmax);
124  // h1epics_liveinst->GetYaxis()->SetRangeUser(ymin,ymax);
125  h1epics_liveinst->GetXaxis()->SetTitleSize(0.05);
126  h1epics_liveinst->GetYaxis()->SetTitleSize(0.05);
127  h1epics_liveinst->GetXaxis()->SetTitle("Inst live time");
128  h1epics_liveinst->SetLineColor(2);
129  h1epics_liveinst->Draw("colz");
130 
131 
132  TCanvas *c2 = new TCanvas("c2", "c2",200,10,700,700);
133  c2->Divide(2,2);
134 
135  for (Int_t j=0; j<4;j++) {
136  c2->cd(j+1);
137  h1_trig_rates[j]->Draw();
138  sprintf (string,"Rate (kHz) for bit %d",j+1);
139  if (j == 0) {
140  h1_trig_rates[j]->SetTitle(filename);
141  }
142  else {
143  h1_trig_rates[j]->SetTitle("");
144  }
145  h1_trig_rates[j]->GetXaxis()->SetTitleSize(0.05);
146  h1_trig_rates[j]->GetYaxis()->SetTitleSize(0.05);
147  h1_trig_rates[j]->GetXaxis()->SetTitle(string);
148  }
149 
150 
151  TCanvas *c3 = new TCanvas("c3", "c3",200,10,700,700);
152  c3->Divide(2,2);
153 
154  for (Int_t j=0; j<4;j++) {
155  c3->cd(j+1);
156  h1_trig_livetimes[j]->Draw();
157  sprintf (string,"Live time for bit %d",j+1);
158  if (j == 0) {
159  h1_trig_livetimes[j]->SetTitle(filename);
160  }
161  else {
162  h1_trig_livetimes[j]->SetTitle("");
163  }
164  h1_trig_livetimes[j]->GetXaxis()->SetTitleSize(0.05);
165  h1_trig_livetimes[j]->GetYaxis()->SetTitleSize(0.05);
166  h1_trig_livetimes[j]->GetXaxis()->SetTitle(string);
167  }
168 
169 
170  TCanvas *c4 = new TCanvas("c4", "c4",200,10,700,700);
171 
172  c4->Divide(1,2);
173  c4->cd(1);
174 
175  h1epics_liveinst_VSevent->Divide(h1epics_entries1_VSevent);
176  h1epics_liveinst_VSevent->SetTitle(filename);
177  // h1epics_liveinst_VSevent->GetXaxis()->SetRangeUser(xmin,xmax);
178  // h1epics_liveinst_VSevent->GetYaxis()->SetRangeUser(ymin,ymax);
179  h1epics_liveinst_VSevent->GetXaxis()->SetTitleSize(0.05);
180  h1epics_liveinst_VSevent->GetYaxis()->SetTitleSize(0.05);
181  h1epics_liveinst_VSevent->GetXaxis()->SetTitle("Trigger number");
182  h1epics_liveinst_VSevent->SetLineColor(2);
183  h1epics_liveinst_VSevent->Draw("");
184 
185  c4->cd(2);
186 
187  // h1epics_AD00_VSevent->Divide(h1epics_entries2_VSevent);
188  h1epics_AD00_VSevent->SetTitle(filename);
189  // h1epics_AD00_VSevent->GetXaxis()->SetRangeUser(xmin,xmax);
190  // h1epics_AD00_VSevent->GetYaxis()->SetRangeUser(ymin,ymax);
191  h1epics_AD00_VSevent->GetXaxis()->SetTitleSize(0.05);
192  h1epics_AD00_VSevent->GetYaxis()->SetTitleSize(0.05);
193  h1epics_AD00_VSevent->GetXaxis()->SetTitle("Trigger number");
194  h1epics_AD00_VSevent->SetLineColor(2);
195  h1epics_AD00_VSevent->Draw("");
196 
197 
198  /*sprintf (string,"plot_epics_dump.pdf(");
199  c0->SaveAs(string);
200  sprintf (string,"plot_epics_dump.pdf");
201  c1->SaveAs(string);
202  sprintf (string,"plot_epics_dump.pdf");
203  c2->SaveAs(string);
204  sprintf (string,"plot_epics_dump.pdf");
205  c3->SaveAs(string);
206  sprintf (string,"plot_epics_dump.pdf)");
207  c4->SaveAs(string);*/
208 
209 
210 
211  }
Double_t c0[2][NMODULES]
Definition: tw_corr.C:67
TH1I * h1_trig_livetimes[nscalers]
sprintf(text,"Post KinFit Cut")
TString filename
TH1F * h1epics_AD00_VSevent
Double_t c1[2][NMODULES]
Definition: tw_corr.C:68
TH1F * h1epics_liveinst_VSevent
Double_t c2[2][NMODULES]
Definition: tw_corr.C:69
TH1F * h1epics_trgbits
TH1F * h1epics_AD00
TH1F * h1epics_pos_outer
TH1F * h1epics_pos_inner
Int_t const nscalers
TH1F * h1epics_entries2_VSevent
TH1F * h1epics_entries1_VSevent
TH1I * h1_trig_rates[nscalers]
TCanvas * c4
TH1F * h1epics_liveinst
TDirectory * dir
Definition: bcal_hist_eff.C:31
TCanvas * c3