/[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.2 by pam-fi, Tue Oct 27 10:17:48 2009 UTC revision 1.5 by pam-fi, Tue Dec 8 17:38:39 2009 UTC
# Line 143  public: Line 143  public:
143      return _histo;      return _histo;
144    }    }
145    
146      /*! @brief Returns a pointer to the ROOT histogram.
147       *
148       * @return A pointer to the root histogram
149       */
150      TH2 *GetRootHisto() {
151        return _rootHisto;
152      }
153    
154    /*! Fills the ROOT and the vector histogram.    /*! Fills the ROOT and the vector histogram.
155     *     *
156     * @param value The value of the X coordinate associated to the event.     * @param xValue The value of the X coordinate associated to the event.
157     * @param value The value of the Y coordinate associated to the event.     * @param yValue The value of the Y coordinate associated to the event.
158     * @param weight The weight which will be applied to the event.     * @param weight The weight which will be applied to the event.
159     */     */
160    void Fill(double xValue, double yValue, double weight = 1.);    void Fill(double xValue, double yValue, double weight = 1.);
# Line 273  void Histo2DAction<HistoType>::_CreateHi Line 281  void Histo2DAction<HistoType>::_CreateHi
281    _rootHisto = NULL;    _rootHisto = NULL;
282  }  }
283    
284    // Specializations for _CreateHistos(). See Histo2DAction.cpp
285    template<>
286    void Histo2DAction<Int_t>::_CreateHisto();
287    
288    template<>
289    void Histo2DAction<Float_t>::_CreateHisto();
290    
291    template<>
292    void Histo2DAction<Double_t>::_CreateHisto();
293    
294  template<class HistoType>  template<class HistoType>
295  void Histo2DAction<HistoType>::_InitHistos() {  void Histo2DAction<HistoType>::_InitHistos() {
296    
297    _CreateHisto();    _CreateHisto();
298      if (_xBins.size() < 2) // SetXAxis not called by the main program, or wrongly filled (only 1 bin limit)
299    if (_xBins.size() < 2) {      SetXAxis("Default X", 10, 0., 1.);
300      _xBins.resize(2);    if (_yBins.size() < 2) // SetYAxis not called by the main program, or wrongly filled (only 1 bin limit)
301      _xBins[0] = 0.;      SetYAxis("Default Y", 10, 0., 1.);
     _xBins[1] = 1.;  
   }  
   
   if (_yBins.size() < 2) {  
     _yBins.resize(2);  
     _yBins[0] = 0.;  
     _yBins[1] = 1.;  
   }  
302    
303    if (_rootHisto) {    if (_rootHisto) {
304      Double_t *auxXArray = new Double_t[_xBins.size()];      Double_t *auxXArray = new Double_t[_xBins.size()];
# Line 325  void Histo2DAction<HistoType>::_InitHist Line 335  void Histo2DAction<HistoType>::_InitHist
335    
336  template<class HistoType>  template<class HistoType>
337  Histo2DAction<HistoType>::~Histo2DAction() {  Histo2DAction<HistoType>::~Histo2DAction() {
338    
339      delete _rootHisto;
340      _rootHisto = NULL;
341  }  }
342    
343  template<class HistoType>  template<class HistoType>
# Line 455  void Histo2DAction<HistoType>::SetYAxis( Line 468  void Histo2DAction<HistoType>::SetYAxis(
468  }  }
469    
470  template<class HistoType>  template<class HistoType>
471  inline void Histo2DAction<HistoType>::Fill(double xValue, double yValue, double weight) {  void Histo2DAction<HistoType>::Fill(double xValue, double yValue, double weight) {
472    
473    _rootHisto->Fill(xValue, yValue, weight);    _rootHisto->Fill(xValue, yValue, weight);
474    
# Line 468  inline void Histo2DAction<HistoType>::Fi Line 481  inline void Histo2DAction<HistoType>::Fi
481      UOflow = true;      UOflow = true;
482    }    }
483    
484    if (xValue > _xBins.back()) {    if (xValue >= _xBins.back()) {
485      xBin = _xBins.size();      xBin = _xBins.size();
486      UOflow = true;      UOflow = true;
487    }    }
# Line 478  inline void Histo2DAction<HistoType>::Fi Line 491  inline void Histo2DAction<HistoType>::Fi
491      UOflow = true;      UOflow = true;
492    }    }
493    
494    if (yValue > _yBins.back()) {    if (yValue >= _yBins.back()) {
495      yBin = _yBins.size();      yBin = _yBins.size();
496      UOflow = true;      UOflow = true;
497    }    }

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

  ViewVC Help
Powered by ViewVC 1.1.23