Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CDC_roc_netamp.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_amp_roc25
6 // hnamepath: /CDC_roc_hits/cdc_amp_roc26
7 // hnamepath: /CDC_roc_hits/cdc_amp_roc27
8 // hnamepath: /CDC_roc_hits/cdc_amp_roc28
9 
10 
11 {
12 
13  gStyle->SetOptStat(kFALSE);
14  gStyle->SetFillStyle(0);
15 
16 
17  // Get number of events
18  double Nevents = 1.0;
19  TDirectory *CDCdir = (TDirectory*)gDirectory->FindObjectAny("CDC_roc_hits");
20 
21  if(!CDCdir) return;
22 
23  CDCdir->cd();
24 
25  TH1I *cdc_nevents = (TH1I*)CDCdir->Get("cdc_nevents");
26  if(cdc_nevents) Nevents = (double)cdc_nevents->GetBinContent(1);
27 
28  // Just for testing
29  if(gPad == NULL){
30  TCanvas *c1 = new TCanvas("c1","c1 CDC_roc_hits",1600,800);
31  c1->cd(0);
32  c1->Draw();
33  c1->Update();
34  }
35 
36  if(!gPad) return;
37  TCanvas *c1 = gPad->GetCanvas();
38  c1->Divide(1,4);
39 
40  for(unsigned int iroc=25; iroc<=28; iroc++){
41  c1->cd(iroc-24);
42 
43  gPad->SetLeftMargin(0.001);
44  gPad->SetRightMargin(0.001);
45  gPad->SetBottomMargin(0.02);
46  gPad->SetTopMargin(0.02);
47 
48  char hname[256];
49  sprintf(hname, "cdc_netamp_roc%d", iroc);
50  TH2 *h = (TH2*)(CDCdir->Get(hname));
51 
52  if(h){
53  // sprintf(hname, "cdc_netamp_roc%d_norm", iroc);
54  // TH2 *hh = (TH2*)h->Clone(hname);
55  TH2 *hh = (TH2*)h->Clone();
56 
57  //hh->Scale(1.0/Nevents);
58  // hh->SetStats(0);
59 
60  hh->SetTitle("");
61  hh->GetXaxis()->SetTitle("");
62  hh->GetYaxis()->SetTitle("");
63 
64  hh->GetXaxis()->SetRangeUser(290,1780);
65  hh->GetYaxis()->SetRangeUser(0,4096);
66 
67  //hh->GetYaxis()->SetNdivisions(210,kFALSE);
68  hh->GetYaxis()->SetNdivisions(110);
69  hh->GetXaxis()->SetNdivisions(0);
70  hh->GetYaxis()->SetTickLength(0.001);
71 
72  hh->GetYaxis()->SetLabelSize(0); //0.05
73  hh->GetYaxis()->SetTitleSize(0);
74  hh->GetXaxis()->SetLabelSize(0); //0.05
75  hh->GetXaxis()->SetTitleSize(0);
76 
77  hh->Draw("col"); // draw remaining histos without overwriting color palette
78  c1->Update();
79 
80  int lastslot = 17;
81  if (iroc==26 || iroc==27) lastslot = 16;
82 
83  TPaveText *pt = new TPaveText(0.5,0.15,0.7,0.85,"NDC");
84  pt->AddText(Form("ROC %i",iroc));
85  pt->AddText("");
86  pt->AddText("Peak height - pedestal");
87  pt->AddText("vs channel");
88  pt->AddText("");
89  pt->AddText(Form("slots 3 to %i",lastslot));
90  pt->Draw();
91  pt->SetBorderSize(0);
92 
93  gPad->Modified();
94 
95 
96  }
97  }
98 
99 
100 }
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