Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:57:34

0001 // @(#)root/hist:$Id$
0002 // Author: Victor Perevoztchikov <perev@bnl.gov>  21/02/2001
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TH1K
0013 #define ROOT_TH1K
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TH1K                                                                 //
0019 //                                                                      //
0020 // 1-Dim histogram nearest K Neighbour class.                           //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include "TH1.h"
0025 
0026 class TH1K : public TH1, public TArrayF {
0027 
0028 private:
0029    void Sort();
0030 protected:
0031    Int_t fReady;  //!
0032    Int_t fNIn;
0033    Int_t fKOrd;   //!
0034    Int_t fKCur;   //!
0035 
0036    Double_t RetrieveBinContent(Int_t bin) const override { return GetBinContent(bin); }
0037 
0038 public:
0039    TH1K();
0040    TH1K(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup,Int_t k=0);
0041    ~TH1K() override;
0042 
0043    void      Copy(TObject &obj) const override;
0044    Int_t     Fill(Double_t x) override;
0045    Int_t     Fill(Double_t x,Double_t w) override{return TH1::Fill(x,w);}
0046    Int_t     Fill(const char *name,Double_t w) override{return TH1::Fill(name,w);}
0047    Double_t  GetBinContent(Int_t bin) const override;
0048    Double_t  GetBinContent(Int_t bin,Int_t) const override {return GetBinContent(bin);}
0049    Double_t  GetBinContent(Int_t bin,Int_t,Int_t) const override {return GetBinContent(bin);}
0050 
0051    Double_t  GetBinError(Int_t bin) const override;
0052    Double_t  GetBinError(Int_t bin,Int_t) const override {return GetBinError(bin);}
0053    Double_t  GetBinError(Int_t bin,Int_t,Int_t) const override {return GetBinError(bin);}
0054 
0055 
0056    void      Reset(Option_t *option="") override;
0057    void      SavePrimitive(std::ostream &out, Option_t *option = "") override;
0058 
0059    void    SetKOrd(Int_t k){fKOrd=k;}
0060 
0061    ClassDefOverride(TH1K,2)  //1-Dim Nearest Kth neighbour method
0062 };
0063 
0064 #endif