Functions
HistogramAttr.cxx File Reference
#include "Header.h"
#include "HistogramAttr.h"

Go to the source code of this file.

Functions

 HistogramAttr1D (TH1 *h, char *title_x, char *title_y, Double_t binlowx, Double_t binhighx, Double_t binlowy, Double_t binhighy, Color_t lcolor)
 
void HistogramAttr2D (TH2 *h, char *titlx_x, char *titlx_y, char *titlx_z, Double_t binlowx, Double_t binhighx, Double_t binlowy, Double_t binhighy)
 
void Ratiohist (TH1 *h1, TH1 *h2, TH1 *hratio, Color_t color, Style_t mstyle, TString labelx, TString labely, Double_t lowy, Double_t highy)
 
void Ratiofit (TF1 *f1, TF1 *f2, TH1 *hratio, TString plane, TString cell, Color_t color, Style_t mstyle, TString labelx, TString labely, Double_t lowy, Double_t highy)
 

Function Documentation

HistogramAttr1D ( TH1 *  h,
char *  title_x,
char *  title_y,
Double_t  binlowx,
Double_t  binhighx,
Double_t  binlowy,
Double_t  binhighy,
Color_t  lcolor 
)

Definition at line 5 of file HistogramAttr.cxx.

Referenced by calibrationconstants(), corrected_PE(), Ratiofit(), Ratiohist(), thresholdshadowing(), and uncorrected_PE().

5  {
6 
7  h->SetLineColor(lcolor);
8 
9  h->GetXaxis()->SetTitle(title_x);
10  h->GetXaxis()->CenterTitle();
11  h->GetXaxis()->SetTitleSize(.05);
12  h->GetXaxis()->SetLabelSize(.04);
13  h->GetXaxis()->SetTitleOffset(0.75);
14 // h->GetXaxis()->SetRangeUser(binlowx, binhighx);
15 
16  h->GetYaxis()->SetTitle(title_y);
17  h->GetYaxis()->CenterTitle();
18  h->GetYaxis()->SetTitleOffset(0.96);
19  h->GetYaxis()->SetTitleSize(.05);
20  h->GetYaxis()->SetLabelSize(.04);
21 // h->GetYaxis()->SetRangeUser(binlowy, binhighy);
22 }//end of HistogramAttr1D(TH2* h, char*, char*, char*)
void HistogramAttr2D ( TH2 *  h,
char *  titlx_x,
char *  titlx_y,
char *  titlx_z,
Double_t  binlowx,
Double_t  binhighx,
Double_t  binlowy,
Double_t  binhighy 
)

Definition at line 24 of file HistogramAttr.cxx.

Referenced by calibrationconstants().

24  {
25  h->GetXaxis()->SetTitle(titlx_x);
26  h->GetXaxis()->CenterTitle();
27  h->GetXaxis()->SetTitleSize(.05);
28  h->GetXaxis()->SetLabelSize(.04);
29  h->GetXaxis()->SetTitleOffset(0.85);
30  h->GetXaxis()->SetRangeUser(binlowx, binhighx);
31 
32  h->GetYaxis()->SetTitle(titlx_y);
33  h->GetYaxis()->CenterTitle();
34  h->GetYaxis()->SetTitleOffset(0.90);
35  h->GetYaxis()->SetTitleSize(.05);
36  h->GetYaxis()->SetLabelSize(.04);
37  h->GetYaxis()->SetRangeUser(binlowy, binhighy);
38 
39  h->GetZaxis()->SetTitle(titlx_z);
40  h->GetZaxis()->CenterTitle();
41  h->GetZaxis()->SetLabelSize(.045);
42  h->GetZaxis()->SetLabelOffset(-0.008);
43 }//end of HistogramAttr1D()
void Ratiofit ( TF1 *  f1,
TF1 *  f2,
TH1 *  hratio,
TString  plane,
TString  cell,
Color_t  color,
Style_t  mstyle,
TString  labelx,
TString  labely,
Double_t  lowy,
Double_t  highy 
)

Definition at line 65 of file HistogramAttr.cxx.

References bin, HistogramAttr1D(), and w.

Referenced by corrected_PE().

65  {
66  //ratio of f1 to f2
67  Double_t w;
68  Double_t value1;
69  Double_t value2;
70  Double_t fitratio;
71 
72  for(Int_t bin = 1; bin < hratio->GetXaxis()->GetNbins(); bin++){
73  w = hratio->GetXaxis()->GetBinCenter(bin);
74  if(!f1 || !f2) {
75  fitratio = 0.0;
76  hratio->Fill(hratio->GetBinCenter(bin), fitratio);
77  continue;
78  }
79  value1 = f1->Eval(w);
80  value2 = f2->Eval(w);
81  if(value1==0) fitratio = 0.0;
82  else fitratio= value2/value1;
83  hratio->Fill(hratio->GetBinCenter(bin), fitratio);
84  }//end of for loop
85  hratio->SetMarkerStyle(mstyle);
86  hratio->SetMarkerColor(color);
87  hratio->SetMarkerSize(1.0);
88  hratio->SetLineColor(color);
89  HistogramAttr1D(hratio, labelx.Data(), labely.Data(), f1->GetXaxis()->GetBinCenter(1), f1->GetXaxis()->GetBinCenter(f1->GetXaxis()->GetNbins()), lowy, highy, color);
90  hratio->Draw("P same");
91 }//end of Ratiofit()
Float_t f2
Float_t f1
float bin[41]
Definition: plottest35.C:14
HistogramAttr1D(TH1 *h, char *title_x, char *title_y, Double_t binlowx, Double_t binhighx, Double_t binlowy, Double_t binhighy, Color_t lcolor)
Float_t w
Definition: plot.C:20
void Ratiohist ( TH1 *  h1,
TH1 *  h2,
TH1 *  hratio,
Color_t  color,
Style_t  mstyle,
TString  labelx,
TString  labely,
Double_t  lowy,
Double_t  highy 
)

Definition at line 45 of file HistogramAttr.cxx.

References HistogramAttr1D().

Referenced by corrected_PE(), thresholdshadowing(), and uncorrected_PE().

45  {
46  //Ratio of h2 wrt h1
47  // hratio->Sumw2();
48  Double_t content_ratio;
49  for(Int_t nbin = 1; nbin <=h1->GetXaxis()->GetNbins(); nbin++){
50  Double_t bincontent1 = h1->GetBinContent(nbin);
51  Double_t bincontent2 = h2->GetBinContent(nbin);
52  if(bincontent1==0) content_ratio = 0.0;
53  else content_ratio = (bincontent2)/(bincontent1);
54  hratio->Fill(h1->GetBinCenter(nbin), content_ratio);
55  }//end of for loop
56 
57  hratio->SetMarkerStyle(mstyle);
58  hratio->SetMarkerSize(1.0);
59  hratio->SetLineColor(color);
60  hratio->SetMarkerColor(color);
61  HistogramAttr1D(hratio, labelx.Data(), labely.Data(), h2->GetXaxis()->GetBinCenter(1), h2->GetXaxis()->GetBinCenter(h2->GetXaxis()->GetNbins()), lowy, highy, color);
62  hratio->Draw("P same");
63 }//end of Ratiohist(TH1*, TH1*)
TH1F * h2
Definition: plot.C:45
TH1F * h1
HistogramAttr1D(TH1 *h, char *title_x, char *title_y, Double_t binlowx, Double_t binhighx, Double_t binlowy, Double_t binhighy, Color_t lcolor)