Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CDC_roc_ped.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_ped_roc25
6 // hnamepath: /CDC_roc_hits/cdc_ped_roc26
7 // hnamepath: /CDC_roc_hits/cdc_ped_roc27
8 // hnamepath: /CDC_roc_hits/cdc_ped_roc28
9 
10 
11 {
12  // Get number of events
13  double Nevents = 1.0;
14  TDirectory *CDCdir = (TDirectory*)gDirectory->FindObjectAny("CDC_roc_hits");
15 
16  if(!CDCdir) return;
17 
18  CDCdir->cd();
19 
20  TH1I *cdc_nevents = (TH1I*)CDCdir->Get("cdc_nevents");
21  if(cdc_nevents) Nevents = (double)cdc_nevents->GetBinContent(1);
22 
23  // Just for testing
24  if(gPad == NULL){
25  TCanvas *c1 = new TCanvas("c1");
26  c1->cd(0);
27  c1->Draw();
28  c1->Update();
29  }
30 
31  if(!gPad) return;
32 
33  TCanvas *c1 = gPad->GetCanvas();
34  c1->Divide(1,4);
35 
36  for(unsigned int iroc=25; iroc<=28; iroc++){
37  c1->cd(iroc-24);
38  char hname[256];
39  sprintf(hname, "cdc_ped_roc%d", iroc);
40  TH2 *h = (TH2*)(CDCdir->Get(hname));
41 
42  if(h){
43  sprintf(hname, "cdc_ped_roc%d_norm", iroc);
44  TH2 *hh = (TH2*)h->Clone(hname);
45 
46  hh->Scale(1.0/Nevents);
47  hh->SetStats(0);
48  hh->Draw("colz"); // draw remaining histos without overwriting color palette
49  c1->Update();
50 
51  hh->GetXaxis()->SetRangeUser(290,1780);
52  hh->GetYaxis()->SetRangeUser(0,255);
53  hh->GetYaxis()->SetNdivisions(210,kFALSE);
54  hh->GetYaxis()->SetTickLength(0.001);
55 
56  hh->GetYaxis()->SetLabelSize(0.05);
57  hh->GetYaxis()->SetTitleSize(0.05);
58  hh->GetXaxis()->SetLabelSize(0.05);
59  hh->GetXaxis()->SetTitleSize(0.05);
60 
61  hh->GetZaxis()->SetLabelSize(0.05);
62 
63  gPad->Modified();
64 
65 
66  }
67  }
68 }
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