/[PAMELA software]/PamCut/CollectionActions/Histo1DActions/Histo1DAction/Histo1DAction.h
ViewVC logotype

Diff of /PamCut/CollectionActions/Histo1DActions/Histo1DAction/Histo1DAction.h

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

revision 1.1 by pam-fi, Fri Sep 25 15:36:36 2009 UTC revision 1.5 by pam-fi, Thu Mar 11 19:14:03 2010 UTC
# Line 85  public: Line 85  public:
85    
86    /*! @brief Sets up the histogram    /*! @brief Sets up the histogram
87     *     *
88     * This routine effectively prepares the histogram, after the desired parameters has been set by #SetXAxis() and #SetYAxis().     * This routine effectively prepares the histogram, after the desired parameters has been set by #SetXAxis().
89     *     *
90     * @param events Pointer to PamLevel2 events (unused).     * @param events Pointer to PamLevel2 events (unused).
91     */     */
# Line 108  public: Line 108  public:
108      return _histo;      return _histo;
109    }    }
110    
111    /*! Fills the ROOT and the vector histogram. */    /*! Fills the ROOT and the vector histogram.
112       *
113       * @param value The value of the X coordinate associated to the event.
114       * @param weight The weight which will be applied to the event.
115       */
116    void Fill(double value, double weight = 1.);    void Fill(double value, double weight = 1.);
117    
118    /*! @brief The number of events which fell below the lower histogram limit. */    /*! @brief The number of events which fell below the lower histogram limit. */
# Line 123  public: Line 127  public:
127    
128  protected:  protected:
129    
130      /*! @brief The vector containing the limits of the bins(from lower to higher). */
131    std::vector<float> _bins;    std::vector<float> _bins;
132      /*! @brief A vector containing the value of the histogram for each bin. */
133    vector<HistoType> _histo;    vector<HistoType> _histo;
134      /*! @brief The ROOT histogram. */
135    TH1 *_rootHisto;    TH1 *_rootHisto;
136    
 private:  
   
   unsigned int _underflow, _overflow;  
   
137    TString _outFileBase;    TString _outFileBase;
138    TString _mode;    TString _mode;
139    TString _title, _xLabel;    TString _title, _xLabel;
140    
141    private:
142    
143      HistoType _underflow, _overflow;
144    bool _outRoot;    bool _outRoot;
145    bool _outText;    bool _outText;
   
146    void _CreateHisto();    void _CreateHisto();
147    void _InitHistos();    void _InitHistos();
148  };  };
# Line 147  void Histo1DAction<HistoType>::_CreateHi Line 153  void Histo1DAction<HistoType>::_CreateHi
153    // No ROOT histogram for generic type; see template specializations in .cpp file.    // No ROOT histogram for generic type; see template specializations in .cpp file.
154    _rootHisto = NULL;    _rootHisto = NULL;
155  }  }
156    // Specializations for _CreateHistos(). See Histo1DAction.cpp
157    template<>
158    void Histo1DAction<Int_t>::_CreateHisto();
159    
160    template<>
161    void Histo1DAction<Float_t>::_CreateHisto();
162    
163    template<>
164    void Histo1DAction<Double_t>::_CreateHisto();
165    
166  template<class HistoType>  template<class HistoType>
167  void Histo1DAction<HistoType>::_InitHistos() {  void Histo1DAction<HistoType>::_InitHistos() {
168    
169    _CreateHisto();    _CreateHisto();
170      if (_bins.size() < 2) // SetXAxis not called by the main program, or wrongly filled (only 1 bin limit)
171        SetXAxis("Default X", 10, 0., 1.);
172    
173    if (_rootHisto) {    if (_rootHisto) {
174      Double_t *auxArray = new Double_t[_bins.size()];      Double_t *auxArray = new Double_t[_bins.size()];
# Line 176  void Histo1DAction<HistoType>::_InitHist Line 193  void Histo1DAction<HistoType>::_InitHist
193    
194  template<class HistoType>  template<class HistoType>
195  Histo1DAction<HistoType>::~Histo1DAction() {  Histo1DAction<HistoType>::~Histo1DAction() {
196    
197      delete _rootHisto;
198      _rootHisto = NULL;
199    
200  }  }
201    
202  template<class HistoType>  template<class HistoType>
203  Histo1DAction<HistoType>::Histo1DAction(const char *actionName, TString title, TString outFileBase, TString mode,  Histo1DAction<HistoType>::Histo1DAction(const char *actionName, TString title, TString outFileBase, TString mode,
204      bool outRoot, bool outText) :      bool outRoot, bool outText) :
205    CollectionAction(actionName), _bins(0), _histo(0), _rootHisto(NULL), _outFileBase(outFileBase), _mode(mode), _title(    CollectionAction(actionName), _bins(0), _histo(0), _rootHisto(NULL), _outFileBase(outFileBase), _mode(mode), _title(
206        title), _xLabel(""), _outRoot(outRoot), _outText(outText) {        title), _xLabel(""), _underflow(0), _overflow(0), _outRoot(outRoot), _outText(outText) {
207    
208  }  }
209    

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

  ViewVC Help
Powered by ViewVC 1.1.23