Last active
December 20, 2015 17:19
-
-
Save musinsky/6168144 to your computer and use it in GitHub Desktop.
PrintWiki function for ROOT TH1 class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void TH1::PrintWiki(Option_t * /*option*/) const | |
{ | |
if (fDimension > 1) { | |
Info("PrintWiki", "only for 1D histo"); | |
return; | |
} | |
Int_t binx; | |
Int_t firstx = 0, lastx = fXaxis.GetNbins()+1; | |
Double_t x, bc, be, bsw2; | |
Printf("{| class=\"wikitable\" style=\"text-align:center; font-family:monospace;\""); | |
Printf("! colspan=\"4\" | %s, %s", GetName(), GetTitle()); | |
Printf("|-"); | |
Printf("| x[bin] || BinContent || BinSumw2 || BinError"); | |
for (binx = firstx; binx <= lastx; binx++) { | |
x = fXaxis.GetBinCenter(binx); | |
bc = GetBinContent(binx); | |
be = GetBinError(binx); | |
if(fSumw2.fN) bsw2 = fSumw2.fArray[binx]; | |
else bsw2 = TMath::Abs(0.0/0.0); // force NaN | |
Printf("|-"); | |
Printf("| [%02d]=%g || %g || %g || %g", binx, x, bc, bsw2, be); | |
} | |
Printf("|-\n|\n|-"); | |
Printf("| fTsumw || fTsumw2 || fTsumwx || fTsumwx2"); | |
Printf("|-"); | |
Printf("| %g || %g || %g || %g", fTsumw, fTsumw2, fTsumwx, fTsumwx2); | |
Printf("|-"); | |
Printf("| fEntries || Effective || RMS || Mean"); | |
Printf("|-"); | |
Printf("| %g || %g || %g || %g", fEntries, GetEffectiveEntries(), GetRMS(), GetMean()); | |
Printf("|}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment