Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ccal_dig_pulse.C
Go to the documentation of this file.
1 // hnamepath: /ccal/digOcc2D
2 // hnamepath: /ccal/digN
3 // hnamepath: /ccal/digPeak
4 // hnamepath: /ccal/digIntVsPeak
5 
6 {
7 
8  TDirectory *dir = (TDirectory*)gDirectory->FindObjectAny("ccal");
9  if(dir) dir->cd();
10 
11  TH2F* digOcc2D = (TH2F*)gDirectory->FindObjectAny("digOcc2D");
12  TH1I* digN = (TH1I*)gDirectory->FindObjectAny("digN");
13  TH1I* digPeak = (TH1I*)gDirectory->FindObjectAny("digPeak");
14  TH2I* digIntVsPeak = (TH2I*)gDirectory->FindObjectAny("digIntVsPeak");
15 
16  double nEvents = ( digN ? digN->GetEntries() : 0 );
17 
18  if(gPad == NULL){
19 
20  TCanvas *c1 = new TCanvas( "c1", "CCAL Monitor", 800, 800 );
21  c1->cd(0);
22  c1->Draw();
23  c1->Update();
24  }
25 
26  if( !gPad ) return;
27  TCanvas* c1 = gPad->GetCanvas();
28  c1->Divide( 2, 2 );
29 
30  if( digN ){
31 
32  digN->SetStats( 0 );
33  digN->SetFillColor( kBlue );
34  c1->cd( 1 );
35  digN->Draw();
36  }
37 
38  if( digOcc2D ){
39 
40  TH2F* digOcc2DAvg = (TH2F*)digOcc2D->Clone( "digOcc2DAvg" );
41 
42  digOcc2DAvg->SetTitle( "CCAL Pulse Occupancy per Event" );
43 
44  for( int x = 1; x <= digOcc2DAvg->GetNbinsX(); ++x ){
45  for( int y = 1; y <= digOcc2DAvg->GetNbinsY(); ++y ){
46 
47  digOcc2DAvg->SetBinContent( x, y, digOcc2DAvg->GetBinContent( x, y ) / nEvents );
48  }
49  }
50 
51  digOcc2DAvg->SetStats( 0 );
52  c1->cd( 2 );
53  digOcc2DAvg->Draw( "colz" );
54  }
55 
56  if( digPeak ){
57 
58  digPeak->SetStats( 0 );
59  digPeak->GetXaxis()->SetRangeUser(0,2000);
60  digPeak->SetFillColor( kBlue );
61  //TPad *p3 = (TPad*)c1->cd( 3 );
62  //p3->SetLogy();
63  c1->cd( 3 );
64  digPeak->Draw();
65  }
66 
67  if( digIntVsPeak ){
68 
69  digIntVsPeak->SetStats( 0 );
70  digIntVsPeak->GetYaxis()->SetRangeUser(0,30000);
71  digIntVsPeak->GetYaxis()->SetTitleOffset(1.55);
72  TPad *p4 = (TPad*)c1->cd( 4 );
73  p4->SetLogz();
74  //c1->cd( 4 );
75  digIntVsPeak->Draw( "colz" );
76  }
77 
78 }
Double_t x[NCHANNELS]
Definition: st_tw_resols.C:39
#define y
Double_t c1[2][NMODULES]
Definition: tw_corr.C:68
TDirectory * dir
Definition: bcal_hist_eff.C:31