plot_pi0_xcheck.C
Go to the documentation of this file.
1 
2 #include <sstream>
3 #include <iomanip>
4 #include <fstream>
5 
6 #include "TCanvas.h"
7 #include "TH1.h"
8 #include "TF1.h"
9 #include "TFile.h"
10 #include "TLegend.h"
11 #include "TLegendEntry.h"
12 #include "TArrayD.h"
13 #include "TAxis.h"
14 #include "TLatex.h"
15 #include "TStyle.h"
16 #include "TLine.h"
17 #include "TProfile.h"
18 
19 #include "CAFAna/Core/Cut.h"
21 #include "CAFAna/Cuts/NueCutsFirstAna.h"
23 #include "CAFAna/Analysis/Plots.h"
24 #include "CAFAna/Analysis/Style.h"
26 #include "CAFAna/Core/Spectrum.h"
27 #include "CAFAna/Cuts/SpillCuts.h"
28 #include "CAFAna/Vars/Vars.h"
30 
32 
33 #include "/nova/app/users/grohmc/pi_S18-02-09/CAFAna/nue/pi0xcheck/make_pi0_xcheck.h"
34 
35 using namespace ana;
36 
37 // Put a "NOvA Preliminary" tag in the corner
39 {
40  TLatex* prelim = new TLatex(.9, .95, "NOvA Preliminary");
41  prelim->SetTextColor(kAzure);
42  prelim->SetNDC();
43  prelim->SetTextSize(2/30.);
44  prelim->SetTextAlign(32);
45  prelim->Draw();
46 }
47 
48 void legend(TH1* data, TH1* mc, TH1* bkgd,double x1=0.58,double y1=0.64,double x2=0.86,double y2=0.84,bool isData=1){
49  TLegend *leg = new TLegend(x1,y1,x2,y2);
50 
51  if(isData){
52  TLegendEntry* dl = leg->AddEntry(data,"Near Det Data","lpe");
53  dl->SetTextColor(data->GetLineColor());
54  }
55  TLegendEntry* ml = leg->AddEntry(mc,"MC #pi^{0} Signal","l");
56  ml->SetTextColor(mc->GetLineColor());
57  TLegendEntry* bl = leg->AddEntry(bkgd,"MC Background","f");
58  bl->SetTextColor(bkgd->GetLineColor());
59  leg->SetBorderSize(0); //no border for legend
60  leg->SetFillColor(0); //fill colour is white
61  leg->Draw();
62 }
63 
64 void HCtag(TString tag,double pot,double size=0.8)
65 {
66  std::stringstream out;
67  out << std::setprecision(3);
68  out << pot;
69  std::string potstr = out.str();
70  std::string coef = out.str().substr(0,4);
71  std::string power = out.str().substr(6,2);
72  potstr = coef+"x10^{"+power+"}";
73  //potstr = "3.10x10^{20}";
74 
75  TLatex* tex = new TLatex(.125, .85, "#scale["+std::to_string(size)+"]{"+potstr+" POT-equiv "+tag+"}");
76  tex->SetNDC();
77  tex->SetTextSize(0.043);
78  tex->SetTextFont(42);
79  tex->SetTextAlign(12);
80  tex->Draw();
81 }
82 
84  TLatex* tex = new TLatex(.1, .925, str.c_str());
85 
86  tex->SetNDC();
87  tex->SetTextSize(0.043);
88  tex->SetTextFont(42);
89  tex->SetTextAlign(12);
90  tex->Draw();
91 }
92 
93 void FitValues(TF1* data, TF1* mc, TH1* hdata, TH1* hmc,double x1=0.50,double y1=0.30,double x2=0.85,double y2=0.55) {
94 
95  TLegend *leg_dm = new TLegend(x1,y1,x2,y2);
96 
97  char dmean[50], dsigma[50], mmean[50], msigma[50];
98  sprintf(dmean, "Data #mu: #bf{%2.1f} #pm %2.1f MeV", data->GetParameter(1), data->GetParError(1));
99  sprintf(dsigma,"Data #sigma: %2.1f #pm %2.1f MeV", data->GetParameter(2), data->GetParError(2));
100  sprintf(mmean, "MC #mu: #bf{%2.1f} #pm %2.1f MeV", mc->GetParameter(1), mc->GetParError(1));
101  sprintf(msigma,"MC #sigma: %2.1f #pm %2.1f MeV", mc->GetParameter(2), mc->GetParError(2));
102 
103  TLegendEntry* dm = leg_dm->AddEntry((TObject*)0, dmean, "");
104  dm->SetTextColor(hdata->GetLineColor());
105  TLegendEntry* ds = leg_dm->AddEntry((TObject*)0, dsigma, "");
106  ds->SetTextColor(hdata->GetLineColor());
107  TLegendEntry* mm = leg_dm->AddEntry((TObject*)0, mmean, "");
108  mm->SetTextColor(hmc->GetLineColor());
109  TLegendEntry* ms = leg_dm->AddEntry((TObject*)0, msigma, "");
110  ms->SetTextColor(hmc->GetLineColor());
111 
112  leg_dm->SetBorderSize(0); //no border for legend
113  leg_dm->SetFillColor(0); //fill colour is white
114  //leg_dm->SetTextSize(2/40.);
115  leg_dm->Draw();
116 
117 }
118 
120  std::stringstream out;
121  out << std::setprecision(3);
122  out << value;
123  return out.str();
124 }
125 
126 //edited from CAFAna/shared/Ana2017/draw_plots_util.h
127 TCanvas * RatioPlot (std::vector<TH1*> topHistos,
128  std::vector<TString> topOption,
129  std::vector<TH1*> bottomHistos,
130  std::vector<TString> bottomOption)
131 {
132  gStyle->SetTitleStyle(0);
133  TCanvas *c = new TCanvas("c", "canvas", 600, 700);
134  //define top and bottom pads
135  TPad* p1 = new TPad("", "", 0, 0, 1, 1);
136  TPad* p2 = new TPad("", "", 0, 0, 1, 1);
137  p1->SetBottomMargin(.3);
138  p2->SetTopMargin(.7);
139 
140  for(auto p:{p1,p2}){
141  p->SetFillStyle(0);
142  p->Draw();
143  }
144 
145  // format histograms
146  auto h1 = (TH1*) topHistos[0]->Clone();
147  auto h3 = (TH1*) bottomHistos[0]->Clone();
148 
149  for(auto & h:{h1,h3}){
150  h->SetStats(0);
151 
152  h->GetYaxis()->SetTitleSize(26);
153  h->GetYaxis()->SetTitleFont(43);
154  h->GetYaxis()->SetTitleOffset(1.3);
155  h->GetYaxis()->SetLabelFont(43);
156 
157  h->GetXaxis()->SetTitleOffset(1.2);
158  h->GetXaxis()->SetTitleSize(28);
159  h->GetXaxis()->SetTitleFont(43);
160  h->GetXaxis()->SetLabelFont(43);
161  }
162 
163  h1->GetYaxis()->SetLabelSize(18);
164 
165  h1->GetXaxis()->SetLabelSize(0);
166  h1->GetXaxis()->SetTitleSize(0);
167 
168  h3->SetTitle("");
169  h3->GetYaxis()->SetTitle("Data/MC");
170  h3->GetYaxis()->SetRangeUser(0.5,1.5);
171  h3->GetYaxis()->SetLabelSize(15);
172  h3->GetYaxis()->SetDecimals();
173 
174  h3->GetXaxis()->SetTitle(h1->GetXaxis()->GetTitle());
175  h3->GetXaxis()->SetLabelSize(18);
176  h3->GetXaxis()->SetLabelOffset(0.005);
177 
178  p1->cd();
179 
180  h1->Draw(topOption[0]);
181 
182  for(unsigned int ii = 1; ii < topHistos.size(); ++ii) {
183  topHistos[ii]->Draw("same "+topOption[ii]);
184  }
185  h1->Draw("same "+topOption[0]);
186 
187  p1->RedrawAxis(); //white histograms cover axes
188 
189  p2->cd();
190  h3->Draw(bottomOption[0]);
191  for(unsigned int ii = 1; ii < bottomHistos.size(); ++ii){
192  bottomHistos[ii]->Draw("same " + bottomOption[ii]);
193  }
194  h3->Draw("same " + bottomOption[0]);
195 
196  TLine *lone = new TLine();
197  lone->SetLineStyle(3);
198  lone->SetLineColor(kGray+3);
199  p2->Update();
200  lone->DrawLine(p2->GetUxmin(),1.0,p2->GetUxmax(),1.0);
201  lone->DrawLine(p2->GetUxmin(),1.2,p2->GetUxmax(),1.2);
202  lone->DrawLine(p2->GetUxmin(),0.8,p2->GetUxmax(),0.8);
203  p2->RedrawAxis();
204 
205  return c;
206 }
207 
208 void plot_pi0_xcheck(const std::string inFile, const bool isFHC)
209 {
210  const std::string tag = isFHC ? "FHC" : "RHC";
211 
212  Spectrum* dataSpects[kNSels][kNPlots+kNMulti];
213  Spectrum* mcSpects[kNSels][kNPlots+kNMulti];
214  Spectrum* bkgSpects[kNSels][kNPlots+kNMulti];
215 
216  TFile fout(("plot_pi0_xcheck_output_"+tag+".root").c_str(), "RECREATE");
217 
218  double integrals[kNSels][kNPlots+kNMulti][3];
219  double fwhmlo[kNSels];
220  double fwhmhi[kNSels];
221 
222  for(unsigned int j=0;j<kNPlots+kNMulti;++j){
223  for(unsigned int i=0;i<kNSels;++i){
224  std::string mysuffix;
225  if( j < kNPlots) mysuffix = plots[j].suffix + "_" + sels[i].suffix;
226  else mysuffix = plotsMulti[j-kNPlots].suffix + "_" + sels[i].suffix;
227 
228  std::string d = tag+"_data_"+mysuffix;
229  std::string m = tag+"_mc_"+mysuffix;
230  std::string b = tag+"_bg_"+mysuffix;
231 
232  dataSpects[i][j] = LoadFromFile<Spectrum>(inFile, d).release();
233  mcSpects[i][j] = LoadFromFile<Spectrum>(inFile, m).release();
234  bkgSpects[i][j] = LoadFromFile<Spectrum>(inFile, b).release();
235 
236  TCanvas *c = new TCanvas(mysuffix.c_str(),mysuffix.c_str());
237  TH1* hMC = mcSpects[i][j]->ToTH1(dataSpects[i][j]->POT());
238  hMC->SetLineColor(kTotalMCColor);
239 
240  TH1* hData = dataSpects[i][j]->ToTH1(dataSpects[i][j]->POT());
241  hData->SetMarkerStyle(kFullCircle);
242 
243  double mean, bin1, bin2, fwhm;
244  mean = hData->GetBinCenter(hData->GetMaximumBin());
245  bin1 = hData->FindFirstBinAbove(hData->GetMaximum()/2);
246  bin2 = hData->FindLastBinAbove(hData->GetMaximum()/2);
247  fwhm = hData->GetBinCenter(bin2) - hData->GetBinCenter(bin1);
248  if(j==1){
249  fwhmlo[i]=mean-fwhm/2;
250  fwhmhi[i]=mean+fwhm/2;
251  }
252 
253  TF1 *fData = new TF1("fData","gaus", mean-fwhm/2 , mean+fwhm/2);
254  fData->SetLineColor(kBlack);
255  if(j==1) hData->Fit("fData","R0","");
256 
257  mean = hMC->GetBinCenter(hMC->GetMaximumBin());
258  bin1 = hMC->FindFirstBinAbove(hMC->GetMaximum()/2);
259  bin2 = hMC->FindLastBinAbove(hMC->GetMaximum()/2);
260  fwhm = hMC->GetBinCenter(bin2) - hMC->GetBinCenter(bin1);
261 
262  TF1 *fMC = new TF1("fMC","gaus", mean-fwhm/2 , mean+fwhm/2);
263  fMC->SetLineColor(kTotalMCColor);
264  if(j==1) hMC->Fit("fMC","R0+","");
265 
266  TH1* h = bkgSpects[i][j]->ToTH1(dataSpects[i][j]->POT());
267  h->SetLineColor(kTotalBackgroundColor);
268  FillWithDimColor(h);
269 
270  hMC->GetYaxis()->SetRangeUser(0,1.2*hMC->GetMaximum());
271  if(j==1) hMC->GetYaxis()->SetTitle(("Events / "+ToString(hMC->GetBinWidth(1))+" MeV").c_str());
272  else hMC->GetYaxis()->SetTitle("Events");
273 
274  hMC->Draw("hist");
275  hData->Draw("ep same");
276  h->Draw("hist same");
277 
278  CenterTitles(hMC);
279  CenterTitles(hData);
280  CenterTitles(h);
281 
282  if(j==1) FitValues(fData, fMC, hData, hMC);
283  legend(hData,hMC,h);
284  Preliminary();
285  HCtag(tag,dataSpects[i][j]->POT());
286 
287  double mData = fData->GetParameter(1);
288  double meData = fData->GetParError(1);
289  double sData = fData->GetParameter(2);
290  double seData = fData->GetParError(2);
291 
292  std::cout << "Data Mean: " << mData << " +- " << meData << "\n";
293  std::cout << "Data Sigma: " << sData << " +- " << seData << "\n";
294 
295  integrals[i][j][0] = hData->Integral();
296  integrals[i][j][1] = hMC->Integral();
297  integrals[i][j][2] = h->Integral();
298 
299  double mMC = fMC->GetParameter(1);
300  double meMC = fMC->GetParError(1);
301  double sMC = fMC->GetParameter(2);
302  double seMC = fMC->GetParError(2);
303 
304  std::cout << "MC Mean: " << mMC << " +- " << meMC << "\n";
305  std::cout << "MC Sigma: " << sMC << " +- " << seMC << "\n";
306 
307  gPad->RedrawAxis();
308 
309  fout.cd();
310  c->Write();
311  c->Print(("plots/data_mc_"+mysuffix+"_"+tag+".root").c_str());
312  c->Print(("plots/data_mc_"+mysuffix+"_"+tag+".pdf").c_str());
313 
314  //if(j == 1){
315  TH1 *hRat = (TH1*)hData->Clone("hRat");
316  hRat->Divide(hMC);
317  TCanvas *rc = RatioPlot({hMC,hData,h},{"hist","ep","hist"},{hRat},{"ep"});
318 
319  if(j == 1) FitValues(fData, fMC, hData, hMC,0.48,0.40,0.85,0.55);
320  legend(hData,hMC,h,0.56,0.64,0.86,0.79);
321  HCtag(tag,dataSpects[i][j]->POT(),0.5);
322 
323  fout.cd();
324  rc->Write();
325  rc->Print(("plots/data_mc_rat_"+mysuffix+"_"+tag+".root").c_str());
326  rc->Print(("plots/data_mc_rat_"+mysuffix+"_"+tag+".pdf").c_str());
327  //}
328  }
329  }
330 
331  gStyle->SetPalette(51);
332 
333  Spectrum* dataSpect2d[kNSels][kN2D];
334  Spectrum* mcSpect2d[kNSels][kN2D];
335  Spectrum* bkgSpect2d[kNSels][kN2D];
336 
337  for(int j = 0;j < kN2D; ++j){
338  for(int i = 0;i < kNSels; ++i){
339  std::string mysuffix = plots2d[j].suffix + "_" + sels[i].suffix;
340  dataSpect2d[i][j] = LoadFromFile<Spectrum>(inFile, (tag+"_data_"+plots2d[j].suffix+"_"+sels[i].suffix).c_str()).release();
341  mcSpect2d[i][j] = LoadFromFile<Spectrum>(inFile, (tag+"_mc_"+plots2d[j].suffix+"_"+sels[i].suffix).c_str()).release();
342  bkgSpect2d[i][j] = LoadFromFile<Spectrum>(inFile, (tag+"_bg_"+plots2d[j].suffix+"_"+sels[i].suffix).c_str()).release();
343 
344  TH2* hData = dataSpect2d[i][j]->ToTH2(dataSpect2d[i][j]->POT());
345  TH2* hMC = mcSpect2d[i][j]->ToTH2(dataSpect2d[i][j]->POT());
346  TH2* h = bkgSpect2d[i][j]->ToTH2(dataSpect2d[i][j]->POT());
347 
348  if(j>2){
349  TCanvas *c = new TCanvas(mysuffix.c_str(),mysuffix.c_str());
350  TH1D *pData = new TH1D("pData","pData",plots2d[j].bins1.NBins(),plots2d[j].bins1.Min(),plots2d[j].bins1.Max());
351  TH1D *pMC = new TH1D("pMC","pMC",plots2d[j].bins1.NBins(),plots2d[j].bins1.Min(),plots2d[j].bins1.Max());
352 
353  for(int k=1;k<hData->GetNbinsX();++k){
354  TH1D *hProj = hData->ProjectionY("test",k,k);
355 
356  double mean, bin1, bin2, fwhm;
357  mean = hProj->GetBinCenter(hProj->GetMaximumBin());
358  bin1 = hProj->FindFirstBinAbove(hProj->GetMaximum()/2);
359  bin2 = hProj->FindLastBinAbove(hProj->GetMaximum()/2);
360  fwhm = hProj->GetBinCenter(bin2) - hProj->GetBinCenter(bin1);
361 
362  TF1 *f = new TF1("f","gaus", mean-fwhm/2 , mean+fwhm/2);
363  if(hProj->GetEntries() != 0){
364  hProj->Fit("f","RQ0","");
365  pData->SetBinContent(k,f->GetParameter(1));
366  pData->SetBinError(k,f->GetParameter(2));
367  }
368  }
369  for(int k=1;k<hData->GetNbinsX();++k){
370  TH1D *hProj = hMC->ProjectionY("test",k,k);
371 
372  double mean, bin1, bin2, fwhm;
373  mean = hProj->GetBinCenter(hProj->GetMaximumBin());
374  bin1 = hProj->FindFirstBinAbove(hProj->GetMaximum()/2);
375  bin2 = hProj->FindLastBinAbove(hProj->GetMaximum()/2);
376  fwhm = hProj->GetBinCenter(bin2) - hProj->GetBinCenter(bin1);
377 
378  TF1 *f = new TF1("f","gaus", mean-fwhm/2 , mean+fwhm/2);
379  if(hProj->GetEntries() != 0){
380  hProj->Fit("f","RQ0","");
381  pMC->SetBinContent(k,f->GetParameter(1));
382  pMC->SetBinError(k,f->GetParameter(2));
383  }
384  }
385 
386  pData->SetMarkerStyle(kFullCircle);
387  pMC->SetLineColor(kTotalMCColor);
388 
389  pMC->SetTitle("");
390  pMC->GetYaxis()->SetRangeUser(0,500);
391  pMC->GetXaxis()->SetTitle(plots2d[j].label1.c_str());
392  pMC->GetYaxis()->SetTitle(plots2d[j].label2.c_str());
393 
394  pMC->Draw("ep");
395  pData->Draw("ep same");
396 
397  c->Update();
398 
399  TLine *lone = new TLine();
400  lone->SetLineStyle(3);
401  lone->SetLineColor(kGray+3);
402  lone->DrawLine(c->GetUxmin(),fwhmlo[i],c->GetUxmax(),fwhmlo[i]);
403  lone->DrawLine(c->GetUxmin(),fwhmhi[i],c->GetUxmax(),fwhmhi[i]);
404 
405  fout.cd();
406  c->Write();
407  c->Print(("plots/data_mc_"+mysuffix+"_"+tag+"_prof.root").c_str());
408  c->Print(("plots/data_mc_"+mysuffix+"_"+tag+"_prof.pdf").c_str());
409  }
410  TCanvas *c1 = new TCanvas((mysuffix+"1").c_str(),(mysuffix+"1").c_str());
411  hData->Draw("COLZ");
412  tex("Data");
413  gPad->SetLogz();
414  fout.cd();
415  c1->Write();
416  c1->Print(("plots/data_mc_"+mysuffix+"_"+tag+"_data.root").c_str());
417  c1->Print(("plots/data_mc_"+mysuffix+"_"+tag+"_data.pdf").c_str());
418 
419  TCanvas *c2 = new TCanvas((mysuffix+"2").c_str(),(mysuffix+"2").c_str());
420  hMC->Draw("COLZ");
421  tex("MC");
422  gPad->SetLogz();
423  fout.cd();
424  c2->Write();
425  c2->Print(("plots/data_mc_"+mysuffix+"_"+tag+"_mc.root").c_str());
426  c2->Print(("plots/data_mc_"+mysuffix+"_"+tag+"_mc.pdf").c_str());
427 
428  TCanvas *c3 = new TCanvas((mysuffix+"3").c_str(),(mysuffix+"3").c_str());
429  h->Draw("COLZ");
430  tex("Background");
431  gPad->SetLogz();
432  fout.cd();
433  c3->Write();
434  c3->Print(("plots/data_mc_"+mysuffix+"_"+tag+"_bkg.root").c_str());
435  c3->Print(("plots/data_mc_"+mysuffix+"_"+tag+"_bkg.pdf").c_str());
436 
437  }
438  }
439 
440  ofstream txtout;
441  txtout.open("integrals.csv");
442 
443  txtout<<"Selection,Plot,Data,MC,Bkg,Signal,\n";
444  for(unsigned int s=0;s<kNPlots+kNMulti;++s){
445  for(unsigned int k=0;k<kNSels;++k){
446  if( s < kNPlots ) txtout<<sels[k].suffix+","+plots[s].suffix+",";
447  else txtout<<sels[k].suffix+","+plotsMulti[s-kNPlots].suffix+",";
448  for(unsigned int i=0;i<3;++i){
449  txtout<<integrals[k][s][i]<<",";
450  if(i == 2){
451  txtout<<integrals[k][s][1]-integrals[k][s][2]<<",";
452  }
453  }
454  txtout<<"\n";
455  }
456  }
457  txtout.close();
458 
459 }
std::vector< PlotDef2D > plots2d
static constexpr Double_t ms
Definition: Munits.h:192
TH2 * ToTH2(double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Spectrum must be 2D to obtain TH2.
Definition: Spectrum.cxx:165
void legend(TH1 *data, TH1 *mc, TH1 *bkgd, double x1=0.58, double y1=0.64, double x2=0.86, double y2=0.84, bool isData=1)
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
Float_t y1[n_points_granero]
Definition: compare.C:5
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
const unsigned int kN2D
Float_t x1[n_points_granero]
Definition: compare.C:5
TH1F * h3
Definition: berger.C:36
const char * p
Definition: xmltok.h:285
const unsigned int kNSels
const unsigned int kNPlots
void CenterTitles(TH1 *histo)
Definition: Plots.cxx:1481
void HCtag(TString tag, double pot, double size=0.8)
const Color_t kTotalBackgroundColor
Definition: Style.h:21
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
const XML_Char const XML_Char * data
Definition: expat.h:268
c2
Definition: demo5.py:33
ifstream inFile
Definition: AnaPlotMaker.h:34
const XML_Char * s
Definition: expat.h:262
void tex(std::string str)
const XML_Char int const XML_Char * value
Definition: expat.h:331
const Cut sels[kNumSels]
Definition: vars.h:44
std::string ToString(double value)
void FitValues(TF1 *data, TF1 *mc, TH1 *hdata, TH1 *hmc, double x1=0.50, double y1=0.30, double x2=0.85, double y2=0.55)
const std::vector< Plot > plots
#define pot
Float_t d
Definition: plot.C:236
const double j
Definition: BetheBloch.cxx:29
TLatex * prelim
Definition: Xsec_final.C:133
A very simple service to remember what detector we&#39;re working in.
static bool isFHC
OStream cout
Definition: OStream.cxx:6
std::vector< double > POT
const std::vector< PlotDefMulti > plotsMulti
static constexpr Double_t mm
Definition: Munits.h:136
TH1F * h1
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
const unsigned int kNMulti
void plot_pi0_xcheck(const std::string inFile, const bool isFHC)
const hit & b
Definition: hits.cxx:21
c1
Definition: demo5.py:24
const Color_t kTotalMCColor
Definition: Style.h:16
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
TCanvas * RatioPlot(std::vector< TH1 * > topHistos, std::vector< TString > topOption, std::vector< TH1 * > bottomHistos, std::vector< TString > bottomOption, TString pidtag, bool pidaxis=false)
void FillWithDimColor(TH1 *h, bool usealpha, float dim)
void Preliminary()