/[PAMELA software]/PamCut/CollectionActions/Histo2DActions/Histo2DAction/Histo2DAction.h
ViewVC logotype

Diff of /PamCut/CollectionActions/Histo2DActions/Histo2DAction/Histo2DAction.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by pam-fi, Tue Dec 8 17:38:39 2009 UTC revision 1.8 by pam-fi, Thu Aug 12 14:37:03 2010 UTC
# Line 260  protected: Line 260  protected:
260    /*! @brief The ROOT histogram. */    /*! @brief The ROOT histogram. */
261    TH2 *_rootHisto;    TH2 *_rootHisto;
262    
263      /*! @brief Base name of the output file. */
264      TString _outFileBase;
265      /*! @brief Output file open mode (UPDATE or RECREATE, see documentation of TFile). */
266      TString _mode;
267      /*! @brief Title for the ROOT histogram. */
268      TString _title;
269      /*! @brief X axis label for the ROOT histogram. */
270      TString _xLabel;
271      /*! @brief Y axis label for the ROOT histogram. */
272      TString _yLabel;
273    
274  private:  private:
275    
276    vector<HistoType> _xUnderflow, _xOverflow, _yUnderflow, _yOverflow;    vector<HistoType> _xUnderflow, _xOverflow, _yUnderflow, _yOverflow;
277    HistoType _xUnderYUnderflow, _xOverYOverflow, _xUnderYOverflow, _xOverYUnderflow;    HistoType _xUnderYUnderflow, _xOverYOverflow, _xUnderYOverflow, _xOverYUnderflow;
   TString _outFileBase;  
   TString _mode;  
   TString _title, _xLabel, _yLabel;  
278    bool _outRoot;    bool _outRoot;
279    bool _outText;    bool _outText;
   
280    void _CreateHisto();    void _CreateHisto();
281    void _InitHistos();    void _InitHistos();
282  };  };
# Line 326  void Histo2DAction<HistoType>::_InitHist Line 333  void Histo2DAction<HistoType>::_InitHist
333    /* The row index (first) corresponds to the position on the vertical (Y) axis. */    /* The row index (first) corresponds to the position on the vertical (Y) axis. */
334    _histo.Resize(_yBins.size() - 1, _xBins.size() - 1);    _histo.Resize(_yBins.size() - 1, _xBins.size() - 1);
335    
336    _xUnderflow.resize(_yBins.size());    _xUnderflow.resize(_yBins.size() - 1);
337    _xOverflow.resize(_yBins.size());    _xOverflow.resize(_yBins.size() - 1);
338    _yUnderflow.resize(_xBins.size());    _yUnderflow.resize(_xBins.size() - 1);
339    _yOverflow.resize(_xBins.size());    _yOverflow.resize(_xBins.size() - 1);
340    
341  }  }
342    
# Line 343  Histo2DAction<HistoType>::~Histo2DAction Line 350  Histo2DAction<HistoType>::~Histo2DAction
350  template<class HistoType>  template<class HistoType>
351  Histo2DAction<HistoType>::Histo2DAction(const char *actionName, TString title, TString outFileBase, TString mode,  Histo2DAction<HistoType>::Histo2DAction(const char *actionName, TString title, TString outFileBase, TString mode,
352      bool outRoot, bool outText) :      bool outRoot, bool outText) :
353    CollectionAction(actionName), _xBins(0), _yBins(0), _histo(0, 0), _rootHisto(NULL), _xUnderflow(0), _xOverflow(0),    CollectionAction(actionName), _xBins(0), _yBins(0), _histo(0, 0), _rootHisto(NULL), _outFileBase(outFileBase), _mode(
354        _yUnderflow(0), _yOverflow(0), _outFileBase(outFileBase), _mode(mode), _title(title), _xLabel(""), _yLabel(""),        mode), _title(title), _xLabel(""), _yLabel(""), _xUnderflow(0), _xOverflow(0), _yUnderflow(0), _yOverflow(0),
355        _outRoot(outRoot), _outText(outText) {        _xUnderYUnderflow((HistoType) 0), _xOverYOverflow((HistoType) 0), _xUnderYOverflow((HistoType) 0),
356          _xOverYUnderflow((HistoType) 0), _outRoot(outRoot), _outText(outText) {
357    
358  }  }
359    
# Line 583  void Histo2DAction<HistoType>::Finalize( Line 591  void Histo2DAction<HistoType>::Finalize(
591        ofstream outTextFile((_outFileBase + ".txt").Data(), ios_base::out);        ofstream outTextFile((_outFileBase + ".txt").Data(), ios_base::out);
592        for (unsigned int i = 0; i < _histo.GetNRows(); i++) {        for (unsigned int i = 0; i < _histo.GetNRows(); i++) {
593          for (unsigned int j = 0; j < _histo.GetNCols(); j++) {          for (unsigned int j = 0; j < _histo.GetNCols(); j++) {
594            outTextFile << _histo[i][j] << "  ";            outTextFile << setw(7) << _histo[i][j] << "  ";
595          }          }
596          outTextFile << "\n";          outTextFile << "\n";
597        }        }
       outTextFile << endl;  
598        outTextFile.close();        outTextFile.close();
599      }      }
600    }    }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.23