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(0);
76 gStyle->SetPadTickY(0);
86 TString inames[] = {
"CanvasW",
"CanvasH"};
87 TString fnames[] = {
"TextSize",
"TitleSize",
"LabelSize",
"PadRightMargin",
"PadTopMargin",
"PadBottomMargin",
88 "xTitleOffset",
"PadLeftMargin",
"yTitleOffset",
"zTitleOffset"};
97 float maxi = h->GetMaximum()*1.15;
98 int digits =
static_cast<int>((log(maxi)/log(10.)+0.001)+1);
99 if(digits<2) digits = 2;
100 TString Section =
Group; Section +=
"_Digits_"; Section += digits;
101 TString fnames[] = {
"PadLeftMargin",
"yTitleOffset"};
105 h->SetTitleOffset(yTitleOffset,
"y");
114 TH1* h =
new TH1F(
"h",
"h", 50, 0, 50);
116 for (
int i=1; i<=50; i++) {
117 double value = scale*exp(-0.5*pow(((i-25.)/5.),2));
118 h->SetBinContent(i, value);
122 if(
nPads == 2) c.Divide(2);
123 if(
nPads == 3) c.Divide(3);
124 if(
nPads == 4) c.Divide(2,2);
125 if(
nPads == 6) c.Divide(3,2);
126 TPad *cPad =
static_cast<TPad *
>(c.cd(1)); h->Draw();
128 setTitles(h,
"D^{(*)0/+} channels",
"xlabel^{2}_{miss} (GeV^{2})",
"Events/(10 MeV^{2})");
129 float scales[] = {0.1, 10, 0.01};
130 for(
int pads = 2; pads<=4; pads++){
132 cPad =
static_cast<TPad*
>(c.cd(pads));
133 hc[pads-2] =
static_cast<TH1F*
>(h->Clone());
134 hc[pads-2]->Scale(scales[pads-2]);
137 setTitles(hc[pads-2],
"D^{(*)0/+} channels",
"xlabel^{2}_{miss} (GeV^{2})",
"Events/(1000 MeV^{2})");
140 TString epsName =
"babar_code/styles/Plot_"; epsName +=
nPads; epsName +=
"Pads.eps";
146 cout<<
"nFont = " <<
nFont << endl;
147 cout<<
"nPads = " <<
nPads << endl;
149 cout<<
"CanvasW = " <<
CanvasW << endl;
150 cout<<
"CanvasH = " <<
CanvasH << endl;
151 cout<<
"TextSize = " <<
TextSize << endl;
152 cout<<
"TitleSize = " <<
TitleSize << endl;
153 cout<<
"LabelSize = " <<
LabelSize << endl;
166 h->SetMarkerStyle(Mstyle);
167 h->SetMarkerSize(Msize);
173 cout <<
" Histogram not defined" << endl;
175 h->SetTitle(
""); h->SetXTitle(xTitle); h->SetYTitle(yTitle);
176 TLatex label; label.SetNDC(kTRUE);
177 label.SetTextAlign(13);
179 label.SetTextAlign(33);
186 Int_t symbol, Double_t size, Int_t width) {
187 h->SetLineColor(color);
188 h->SetLineWidth(width);
189 h->SetMarkerColor(color);
190 h->SetMarkerStyle(symbol);
191 h->SetMarkerSize(size);
193 h->SetFillStyle(fillstyle);
194 h->SetFillColor(color);
199 float xoff,
float yoff,
int divisions) {
201 cout <<
" Histogram not defined" << endl;
203 h->SetTitleOffset(xoff,
"x"); h->SetTitleOffset(yoff,
"y");
204 h->SetTitleSize(size,
"x"); h->SetTitleSize(size,
"y");
205 h->SetLabelSize(lsize,
"x"); h->SetLabelSize(lsize,
"y");
206 h->SetLabelFont(font,
"x"); h->SetLabelFont(font,
"y");
207 h->GetXaxis()->SetTitleFont(font); h->GetYaxis()->SetTitleFont(font);
208 h->SetNdivisions(divisions,
"X"); h->SetNdivisions(divisions,
"Y");
213 TString inames[],
int *ivalues[],
int nInt){
215 TString word, s_value;
217 if(word.Contains(
"[")) {
218 word.ReplaceAll(
"[",
""); word.ReplaceAll(
"]",
"");
221 if(word.Contains(
"["))
break;
222 file >> s_value; file >> s_value;
223 for(
int var(0); var < nFloat; var++){
224 if(word == fnames[var]){
225 *fvalues[var] = s_value.Atof();
229 for(
int var(0); var < nInt; var++){
230 if(word == inames[var]){
231 *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 setTitleSizes(TH1 *h, float size, float lsize, int font=62, float xoff=1., float yoff=1., int divisions=405)
void setGroup(TString group)
void fixYAxis(TH1 *h, TPad *pad)
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")