27 TString inames[] = {
"nFont",
"nDivisions"};
54 gStyle->SetTitleFont(
nFont,
"xyz");
55 gStyle->SetLabelFont(
nFont,
"xyz");
56 gStyle->SetTextFont(
nFont);
67 h->SetTitleFont(
nFont,
"xyz");
68 h->SetLabelFont(
nFont,
"xyz");
73 gStyle->SetPalette(1);
74 gStyle->SetOptStat(0);
75 gStyle->SetPadTickX(1);
76 gStyle->SetPadTickY(1);
86 TString inames[] = {
"CanvasW",
"CanvasH"};
87 TString fnames[] = {
"LegendSize",
"TitleSize",
"LabelSize",
"PadRightMargin",
"PadTopMargin",
"PadBottomMargin",
88 "xTitleOffset",
"PadLeftMargin",
"yTitleOffset",
"zTitleOffset"};
97 int digits =
static_cast<int>((log(maxi)/log(10.)+0.001)+1);
98 if(digits<2) digits = 2;
99 TString Section =
Group;
100 if(isLog)Section +=
"_Log";
101 else {Section +=
"_Digits_"; Section += digits; }
102 TString fnames[] = {
"PadLeftMargin",
"yTitleOffset"};
106 h->SetTitleOffset(yTitleOffset,
"y");
115 TH1* h =
new TH1F(
"h",
"h", 50, 0, 50);
117 for (
int i=1; i<=50; i++) {
118 double value = scale*exp(-0.5*pow(((i-25.)/5.),2));
119 h->SetBinContent(i, value);
123 if(
nPads == 2) c.Divide(2);
124 if(
nPads == 3) c.Divide(3);
125 if(
nPads == 4) c.Divide(2,2);
126 if(
nPads == 6) c.Divide(3,2);
130 setTitles(h,
"D^{(*)0/+} channels",
"xlabel^{2}_{miss} (GeV^{2})",
"Events/(10 MeV^{2})");
131 float scales[] = {0.1, 10, 0.01};
132 for(
int pads = 2; pads<=4; pads++){
135 hc[pads-2] =
static_cast<TH1F*
>(h->Clone());
136 hc[pads-2]->Scale(scales[pads-2]);
139 setTitles(hc[pads-2],
"D^{(*)0/+} channels",
"xlabel^{2}_{miss} (GeV^{2})",
"Events/(1000 MeV^{2})");
142 TString epsName =
"babar_code/styles/Plot_"; epsName +=
nPads; epsName +=
"Pads.eps";
148 cout<<
"nFont = " <<
nFont << endl;
149 cout<<
"nPads = " <<
nPads << endl;
151 cout<<
"CanvasW = " <<
CanvasW << endl;
152 cout<<
"CanvasH = " <<
CanvasH << endl;
154 cout<<
"TitleSize = " <<
TitleSize << endl;
155 cout<<
"LabelSize = " <<
LabelSize << endl;
168 h->SetMarkerStyle(Mstyle);
169 h->SetMarkerSize(Msize);
175 cout <<
" Histogram not defined" << endl;
177 h->SetXTitle(xTitle); h->SetYTitle(yTitle);
178 TLatex label; label.SetNDC(kTRUE);
179 label.SetTextSize(0.06);
180 label.SetTextAlign(11);
182 label.SetTextAlign(31);
189 Int_t symbol, Double_t size, Int_t width) {
190 h->SetLineColor(color);
191 h->SetLineWidth(width);
192 h->SetMarkerColor(color);
193 h->SetMarkerStyle(symbol);
194 h->SetMarkerSize(size);
196 h->SetFillStyle(fillstyle);
197 h->SetFillColor(color);
202 float xoff,
float yoff,
int divisions) {
204 cout <<
" Histogram not defined" << endl;
206 h->SetTitleOffset(xoff,
"x"); h->SetTitleOffset(yoff,
"y");
207 h->SetTitleSize(size,
"x"); h->SetTitleSize(size,
"y");
208 h->SetLabelSize(lsize,
"x"); h->SetLabelSize(lsize,
"y");
209 h->SetLabelFont(font,
"x"); h->SetLabelFont(font,
"y");
210 h->GetXaxis()->SetTitleFont(font); h->GetYaxis()->SetTitleFont(font);
211 h->SetNdivisions(divisions,
"X"); h->SetNdivisions(divisions,
"Y");
216 TString inames[],
int *ivalues[],
int nInt){
218 TString word, s_value;
220 if(word.Contains(
"[")) {
221 word.ReplaceAll(
"[",
""); word.ReplaceAll(
"]",
"");
224 if(word.Contains(
"["))
break;
225 file >> s_value; file >> s_value;
226 for(
int var(0); var < nFloat; var++){
227 if(word == fnames[var]){
228 *fvalues[var] = s_value.Atof();
232 for(
int var(0); var < nInt; var++){
233 if(word == inames[var]){
234 *ivalues[var] = s_value.Atoi();
void styleHist(TH1 *h, Int_t color=1, Int_t fillstyle=0, Int_t symbol=8, Double_t size=0.7, Int_t width=1)
void parseStyleFile(TString group, TString fnames[], float *fvalues[], int nFloat, TString inames[], int *ivalues[], int nInt)
void moveYAxisLabel(TH1 *h, float maxi, bool isLog=false)
void setTitleSizes(TH1 *h, float size, float lsize, int font=62, float xoff=1., float yoff=1., int divisions=405)
void setGroup(TString group)
void setHistoStyle(TH1 *h)
void setMarkers(TH1 *h, float Msize=0.6, int Mstyle=20)
void setTitles(TH1 *h, TString xTitle="", TString yTitle="", TString Left="", TString Right="")
void testGlobalStyle(bool fixY=true, float scale=1000.)
styles(TString group="Standard")