10 #include "Riostream.h" 46 TString topPath =
"/";
49 TFile*
inFile =
new TFile(file);
53 baseFile.erase(0, baseFile.rfind(
"/"));
68 gSystem->Exec(
"mkdir html_out/");
70 char commandHelper[256];
71 sprintf(commandHelper,
"mkdir html_out/%s/", file);
72 gSystem->Exec(commandHelper);
74 sprintf(commandHelper,
"html_out/%s/", file);
78 *
histhtml <<
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" 79 <<
"<html>\n <head>\n" 80 <<
"<title>" << file <<
"</title>\n" 81 <<
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n" 84 *
histhtml <<
"<a name=\"pagetop\" ></a>\n" 85 <<
"<h1>" << file <<
"</h1>\n" <<
std::endl;
96 TDirectory* current_sourcedir = gDirectory;
99 TIter nextkey(current_sourcedir->GetListOfKeys());
103 while((key = (TKey*)nextkey())) {
105 if(oldkey && !strcmp(oldkey->GetName(),key->GetName())) {
continue; }
109 TObject* obj = key->ReadObj();
111 if(obj->IsA()->InheritsFrom(TDirectory::Class())) {
128 if(inFile->cd(inPath)) {
129 TKey* keyPOT = (TKey*)gDirectory->GetListOfKeys()->FindObject(histPOT.c_str());
132 TH1* hPOT = (TH1*)keyPOT->ReadObj();
154 TDirectory* current_sourcedir = gDirectory;
157 TIter nextkey(current_sourcedir->GetListOfKeys());
161 while((key = (TKey*)nextkey())) {
163 if(oldkey && !strcmp(oldkey->GetName(),key->GetName())) {
continue; }
167 TObject* obj = key->ReadObj();
169 if(obj->IsA()->InheritsFrom(TH1::Class())) {
171 TH1*
hist = (TH1*)obj;
173 TCanvas*
c =
new TCanvas(
"c",
"c", 800, 600);
176 TImage*
img = TImage::Create();
179 if(strstr(hist->GetName(),
"CosZ") || strstr(hist->GetName(),
"CosNu")) {
180 hist->GetXaxis()->SetRangeUser(0.5, 1.);
184 if(strstr(hist->GetName(),
"Enu")) {
185 char yAxisLabel[256];
187 hist->GetYaxis()->SetTitle(yAxisLabel);
191 if(obj->IsA()->InheritsFrom(TH2::Class())) {
199 img->WriteImage(
htmlpath + saveName + hist->GetName() +
".png");
202 *
histhtml <<
"<p><p><img src=\"" << saveName + hist->GetName() <<
".png\">" <<
std::endl;
208 else if(obj->IsA()->InheritsFrom(TDirectory::Class())) {
219 TString newDir = obj->GetName();
224 std::cout <<
"Unknown object type, name: " << obj->GetName()
225 <<
" title: " << obj->GetTitle() <<
std::endl;
void GetPOTInfo(TString inPath, TFile *inFile)
Get the amount of POT from input file.
ofstream * histhtml
Stream to send html code/text/commands to html file.
double NormPOTCurrent
Amount of POT used to generate input file.
void HtmlGenie(char *file)
TString subDir
Name of current subdirectory.
void WriteDirectoryStruct(TString inPath, TFile *inFile)
Set up subdirectory structure of html file and local area.
TString htmlpath
Path to html page and local location of saved images.
void ScanRootfile(TString inPath, TFile *inFile)
Recursively look for each histogram in the inPath directory.
void Finalize()
Write the final lines of the html file.
void InitializeHtml(char *file)
Write the initial portion of the html file and set up top level directory.