Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TH1DStat Class Reference

#include <TH1DStat.h>

List of all members.

Public Member Functions

 TH1DStat (TH1D *t)
 ~TH1DStat ()
void Fill (double v, double w, double s)
TH1D * GetTH1D (int withstats=1)
void Dump ()

Private Attributes

TH1D * th1d
TArrayD td
TArrayD pw
bool wasErrorAdjusted


Constructor & Destructor Documentation

TH1DStat::TH1DStat TH1D *  t  ) 
 

Definition at line 4 of file TH1DStat.cxx.

References pw, td, th1d, and wasErrorAdjusted.

00005 {
00006         th1d = t;
00007         
00008         td.Set(t->GetXaxis()->GetNbins()+2);
00009         td.Reset();
00010 
00011         pw.Set(t->GetXaxis()->GetNbins()+2);
00012         pw.Reset();
00013                 
00014         wasErrorAdjusted=false;
00015 }

TH1DStat::~TH1DStat  )  [inline]
 

Definition at line 13 of file TH1DStat.h.

00013 {};


Member Function Documentation

void TH1DStat::Dump  ) 
 

Definition at line 36 of file TH1DStat.cxx.

References pw, and td.

00037 {
00038         for(int i=0;i<td.GetSize();i++)
00039         {
00040                 printf("%d %d %f\n",i,(int)td.At(i),pw.At(i));
00041         }
00042 
00043 }

void TH1DStat::Fill double  v,
double  w,
double  s
 

Definition at line 18 of file TH1DStat.cxx.

References pw, td, th1d, and wasErrorAdjusted.

00019 {
00020         int b = th1d->Fill(v,w);
00021 
00022         if(b<0)
00023         {
00024                 b=0; //underflow
00025                 if(v>th1d->GetXaxis()->GetXmax())
00026                         b=pw.GetSize()-1; //overflow
00027         }
00028         
00029 
00030         td[b]++;
00031         pw[b]+=s;
00032         wasErrorAdjusted=false;
00033         
00034 }

TH1D * TH1DStat::GetTH1D int  withstats = 1  ) 
 

Definition at line 45 of file TH1DStat.cxx.

References pw, td, th1d, and wasErrorAdjusted.

00046 {
00047         if(!withstats || wasErrorAdjusted)return th1d;
00048         
00049         //put in statistical errors!
00050         for(int i=0;i<td.GetSize();i++)
00051         {
00052                 th1d->SetBinError(i,sqrt(td.At(i))*pw.At(i));
00053         }
00054         wasErrorAdjusted=true;
00055         return th1d;
00056 }


Member Data Documentation

TArrayD TH1DStat::pw [private]
 

Definition at line 23 of file TH1DStat.h.

Referenced by Dump(), Fill(), GetTH1D(), and TH1DStat().

TArrayD TH1DStat::td [private]
 

Definition at line 22 of file TH1DStat.h.

Referenced by Dump(), Fill(), GetTH1D(), and TH1DStat().

TH1D* TH1DStat::th1d [private]
 

Definition at line 20 of file TH1DStat.h.

Referenced by Fill(), GetTH1D(), and TH1DStat().

bool TH1DStat::wasErrorAdjusted [private]
 

Definition at line 25 of file TH1DStat.h.

Referenced by Fill(), GetTH1D(), and TH1DStat().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:22 2010 for loon by  doxygen 1.3.9.1