--- PamCut/CollectionActions/Histo2DActions/Histo2DAction/Histo2DAction.h 2009/12/08 17:38:39 1.5 +++ PamCut/CollectionActions/Histo2DActions/Histo2DAction/Histo2DAction.h 2010/03/11 19:14:03 1.6 @@ -260,16 +260,16 @@ /*! @brief The ROOT histogram. */ TH2 *_rootHisto; + TString _outFileBase; + TString _mode; + TString _title, _xLabel, _yLabel; + private: vector _xUnderflow, _xOverflow, _yUnderflow, _yOverflow; HistoType _xUnderYUnderflow, _xOverYOverflow, _xUnderYOverflow, _xOverYUnderflow; - TString _outFileBase; - TString _mode; - TString _title, _xLabel, _yLabel; bool _outRoot; bool _outText; - void _CreateHisto(); void _InitHistos(); }; @@ -326,10 +326,10 @@ /* The row index (first) corresponds to the position on the vertical (Y) axis. */ _histo.Resize(_yBins.size() - 1, _xBins.size() - 1); - _xUnderflow.resize(_yBins.size()); - _xOverflow.resize(_yBins.size()); - _yUnderflow.resize(_xBins.size()); - _yOverflow.resize(_xBins.size()); + _xUnderflow.resize(_yBins.size() - 1); + _xOverflow.resize(_yBins.size() - 1); + _yUnderflow.resize(_xBins.size() - 1); + _yOverflow.resize(_xBins.size() - 1); } @@ -343,9 +343,10 @@ template Histo2DAction::Histo2DAction(const char *actionName, TString title, TString outFileBase, TString mode, bool outRoot, bool outText) : - CollectionAction(actionName), _xBins(0), _yBins(0), _histo(0, 0), _rootHisto(NULL), _xUnderflow(0), _xOverflow(0), - _yUnderflow(0), _yOverflow(0), _outFileBase(outFileBase), _mode(mode), _title(title), _xLabel(""), _yLabel(""), - _outRoot(outRoot), _outText(outText) { + CollectionAction(actionName), _xBins(0), _yBins(0), _histo(0, 0), _rootHisto(NULL), _outFileBase(outFileBase), _mode( + mode), _title(title), _xLabel(""), _yLabel(""), _xUnderflow(0), _xOverflow(0), _yUnderflow(0), _yOverflow(0), + _xUnderYUnderflow((HistoType) 0), _xOverYOverflow((HistoType) 0), _xUnderYOverflow((HistoType) 0), + _xOverYUnderflow((HistoType) 0), _outRoot(outRoot), _outText(outText) { } @@ -527,6 +528,8 @@ else { if (yBin == (int) _yBins.size()) { _xUnderYOverflow += (HistoType) weight; + cout << "_xUnderYOverflow: " << GetXUnderYOverflow() << ", weight: " << weight << ", (HistoType) weight: " + << (HistoType) weight << endl; return; } else { @@ -583,11 +586,10 @@ ofstream outTextFile((_outFileBase + ".txt").Data(), ios_base::out); for (unsigned int i = 0; i < _histo.GetNRows(); i++) { for (unsigned int j = 0; j < _histo.GetNCols(); j++) { - outTextFile << _histo[i][j] << " "; + outTextFile << setw(7) << _histo[i][j] << " "; } outTextFile << "\n"; } - outTextFile << endl; outTextFile.close(); } }