Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ReadHistFromJobFile.C
Go to the documentation of this file.
1 //
2 // read & display diagnostic histogram from job supercluster file
3 // Author : Gabriele Vedovato
4 
5 {
6  #define JOB_SUPERCLUSTER_FILE "data/supercluster_931158378_44_ADV_SIM_SGQ9_L1H1V1_2G_MSA_30_job1.root"
7  #define APPLY_CUT
8 
10 
11  // open input job file
12  TFile* jfile = new TFile(jname);
13  if(jfile==NULL||!jfile->IsOpen())
14  {cout << "Error : file " << jname << " not found" << endl;exit(1);}
15 
16  // read diagnostic histogram from supercluster job file
17  TH2F* ph = (TH2F*)jfile->Get("hdng");
18  if(ph==NULL) {cout<<"Error : diagnostic histogram not present"<<endl;exit(1);}
19 
20  // draw diagnostic histogram
21  TCanvas* canvas;
22  canvas = new TCanvas("hdng", "hdng", 35, 46, 600, 600);
23  canvas->Clear();
24  canvas->ToggleEventStatus();
25  canvas->SetGridx(true);
26  canvas->SetGridy(true);
27  canvas->SetLogz(true);
28  canvas->SetFillColor(kWhite);
29  canvas->SetLeftMargin(0.08);
30  canvas->SetBottomMargin(0.13);
31  canvas->SetBorderMode(0);
32 
33  gStyle->SetTitleH(0.050);
34  gStyle->SetTitleW(0.95);
35  gStyle->SetTitleY(0.98);
36  gStyle->SetTitleFont(12,"D");
37 
38  ph->SetTitle("subNetCut Diagnostic Histogram");
39  ph->SetStats(kFALSE);
40 
41  ph->GetXaxis()->SetTitle("(Lm-Nm*Es)/(Em-Nm*Es)");
42  ph->GetXaxis()->SetLabelFont(42);
43  ph->GetXaxis()->SetLabelSize(0.03);
44  ph->GetXaxis()->SetTitleFont(42);
45  ph->GetXaxis()->SetTitleSize(0.03);
46  ph->GetXaxis()->SetTitleOffset(1.5);
47  ph->GetXaxis()->CenterTitle(true);
48  ph->GetXaxis()->SetRangeUser(0,1);
49 
50  ph->GetYaxis()->SetTitle("STAT/Em");
51  ph->GetYaxis()->SetLabelFont(42);
52  ph->GetYaxis()->SetLabelSize(0.03);
53  ph->GetYaxis()->SetTitleFont(42);
54  ph->GetYaxis()->SetTitleSize(0.03);
55  ph->GetYaxis()->SetTitleOffset(1.2);
56  ph->GetYaxis()->CenterTitle(false);
57  ph->GetYaxis()->SetRangeUser(0,1);
58 
59  ph->GetZaxis()->SetLabelFont(42);
60  ph->GetZaxis()->SetLabelSize(0.025);
61 
62  ph->Draw("colz");
63 
64  // compute entries
65  int NPIX=0;
66  int npix=0;
67  for (int i=0;i<=ph->GetNbinsX();i++) {
68  for (int j=0;j<=ph->GetNbinsY();j++) {
69  double X = ph->GetXaxis()->GetBinCenter(i)+ph->GetXaxis()->GetBinWidth(i)/2.;
70  double Y = ph->GetYaxis()->GetBinCenter(i)+ph->GetYaxis()->GetBinWidth(i)/2.;
71  double Z = ph->GetBinContent(i,j);
72  if(X+Y>1) npix+=Z;
73  NPIX+=Z;
74  }
75  }
76  cout << "npix/NPIX : " << npix << " / " << NPIX << endl;
77 }
TString("c")
TH2F * ph
TFile * jfile
int NPIX
int j
Definition: cwb_net.C:10
i drho i
int npix
TCanvas * canvas
TString jname
#define JOB_SUPERCLUSTER_FILE
exit(0)