--- PamCut/CollectionActions/Histo2DActions/Histo2DAction/Histo2DAction.h 2009/12/08 17:38:39 1.5 +++ PamCut/CollectionActions/Histo2DActions/Histo2DAction/Histo2DAction.h 2010/08/12 14:37:03 1.8 @@ -260,16 +260,23 @@ /*! @brief The ROOT histogram. */ TH2 *_rootHisto; + /*! @brief Base name of the output file. */ + TString _outFileBase; + /*! @brief Output file open mode (UPDATE or RECREATE, see documentation of TFile). */ + TString _mode; + /*! @brief Title for the ROOT histogram. */ + TString _title; + /*! @brief X axis label for the ROOT histogram. */ + TString _xLabel; + /*! @brief Y axis label for the ROOT histogram. */ + TString _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 +333,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 +350,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) { } @@ -583,11 +591,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(); } }