Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fcal_hit_energy.C
Go to the documentation of this file.
1 // hnamepath: /fcal/hitOcc2D
2 // hnamepath: /fcal/hitN
3 // hnamepath: /fcal/hitETot
4 // hnamepath: /fcal/hitE2D
5 
6 {
7 
8  TDirectory *dir = (TDirectory*)gDirectory->FindObjectAny("fcal");
9  if(dir) dir->cd();
10 
11  TH2F* hitOcc2D = (TH2F*)gDirectory->FindObjectAny("hitOcc2D");
12  TH1I* hitN = (TH1I*)gDirectory->FindObjectAny("hitN");
13  TH1I* hitETot = (TH1I*)gDirectory->FindObjectAny("hitETot");
14  TH2F* hitE2D = (TH2F*)gDirectory->FindObjectAny("hitE2D");
15 
16  double nEvents = ( hitETot ? hitETot->GetEntries() : 0 );
17 
18  if(gPad == NULL){
19 
20  TCanvas *c1 = new TCanvas( "c1", "FCAL 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( hitN ){
31 
32  hitN->SetStats( 0 );
33  hitN->SetFillColor( kYellow );
34  c1->cd( 1 );
35  hitN->Draw();
36  }
37 
38  if( hitETot ){
39 
40  hitETot->SetStats( 0 );
41  hitETot->SetFillColor( kYellow );
42  c1->cd( 2 );
43  hitETot->Draw();
44  }
45 
46  if( hitOcc2D ){
47 
48  TH2F* hitOcc2DAvg = (TH2F*)hitOcc2D->Clone( "hitOcc2DAvg" );
49 
50  hitOcc2DAvg->SetTitle( "FCAL Hit Occupancy per Event" );
51 
52  for( int x = 1; x <= hitOcc2DAvg->GetNbinsX(); ++x ){
53  for( int y = 1; y <= hitOcc2DAvg->GetNbinsY(); ++y ){
54 
55  hitOcc2DAvg->SetBinContent( x, y, hitOcc2DAvg->GetBinContent( x, y ) / nEvents );
56  }
57  }
58 
59  hitOcc2DAvg->SetStats( 0 );
60  c1->cd( 3 );
61  hitOcc2DAvg->Draw( "colz" );
62  }
63 
64  if( hitE2D && hitOcc2D ){
65 
66  TH2F* hitE2DAvg = (TH2F*)hitE2D->Clone( "hitE2DAvg" );
67  hitE2DAvg->Divide( hitOcc2D );
68  hitE2DAvg->SetStats( 0 );
69  hitE2DAvg->SetMinimum( 10 );
70  c1->cd( 4 );
71  hitE2DAvg->Draw( "colz" );
72  }
73 }
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