Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CDC_roc_hits.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: /CDC_roc_hits/cdc_num_events
6 // hnamepath: /CDC_roc_hits/cdc_hits_roc25
7 // hnamepath: /CDC_roc_hits/cdc_hits_roc26
8 // hnamepath: /CDC_roc_hits/cdc_hits_roc27
9 // hnamepath: /CDC_roc_hits/cdc_hits_roc28
10 
11 
12 {
13  // Get number of events
14  double Nevents = 1.0;
15  TDirectory *CDCdir = (TDirectory*)gDirectory->FindObjectAny("CDC_roc_hits");
16 
17  if(!CDCdir) return;
18 
19  CDCdir->cd();
20 
21  TH1I *cdc_nevents = (TH1I*)CDCdir->Get("cdc_nevents");
22  if(cdc_nevents) Nevents = (double)cdc_nevents->GetBinContent(1);
23 
24  // Just for testing
25  if(gPad == NULL){
26  TCanvas *c1 = new TCanvas("c1");
27  c1->cd(0);
28  c1->Draw();
29  c1->Update();
30  }
31 
32  if(!gPad) return;
33 
34  TCanvas *c1 = gPad->GetCanvas();
35  c1->Divide(2,2);
36 
37  for(unsigned int iroc=25; iroc<=28; iroc++){
38  c1->cd(iroc-24);
39  char hname[256];
40  sprintf(hname, "cdc_hits_roc%d", iroc);
41  TH2 *h = (TH2*)(CDCdir->Get(hname));
42 
43  if(h){
44  sprintf(hname, "cdc_hits_roc%d_norm", iroc);
45  TH2 *hh = (TH2*)h->Clone(hname);
46 
47  sprintf(hname, "%s, normalized",h->GetTitle());
48  hh->SetTitle(hname);
49 
50  hh->Scale(1.0/Nevents);
51  hh->SetStats(0);
52  hh->Draw("colz"); // draw remaining histos without overwriting color palette
53  c1->Update();
54 
55  TPaletteAxis *pal = (TPaletteAxis*)hh->GetListOfFunctions()->FindObject("palette");
56  pal->SetX2NDC(0.94);
57  pal->SetLabelSize(0.03);
58  // gPad->SetLogz();
59  gPad->Modified();
60 
61 
62  }
63  }
64 }
TDirectory * CDCdir
sprintf(text,"Post KinFit Cut")
Double_t c1[2][NMODULES]
Definition: tw_corr.C:68
TH1I * cdc_nevents
Definition: CDC_roc_amp.C:20
double Nevents