ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitCommon/DataFormats/src/TH2DAsymErr.cc
Revision: 1.2
Committed: Tue Aug 11 09:02:24 2009 UTC (15 years, 8 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_011a, Mit_008, Mit_011, Mit_010a
Changes since 1.1: +52 -81 lines
Log Message:
Simplification and cleanup.

File Contents

# User Rev Content
1 loizides 1.2 // $Id: TH2DAsymErr.cc,v 1.1 2009/08/10 16:04:51 phedex Exp $
2 phedex 1.1
3     #include "MitCommon/DataFormats/interface/TH2DAsymErr.h"
4     #include <TList.h>
5    
6     ClassImp(mithep::TH2DAsymErr)
7    
8     using namespace mithep;
9    
10     //--------------------------------------------------------------------------------------------------
11 loizides 1.2 TH2DAsymErr::TH2DAsymErr(const char *name, const char *title,
12     Int_t nbinsx, Double_t xlow, Double_t xup
13     ,Int_t nbinsy, Double_t ylow, Double_t yup) :
14     TH2D(name, title, nbinsx, xlow, xup , nbinsy, ylow, yup),
15     fStatErrorLow(fNcells),
16     fStatErrorHigh(fNcells),
17     fSysErrorLow(fNcells),
18     fSysErrorHigh(fNcells)
19 phedex 1.1 {
20     // Constructor.
21     }
22    
23 loizides 1.2 TH2DAsymErr::TH2DAsymErr(const TH2D &h2d) :
24     TH2D(h2d),
25     fStatErrorLow(fNcells),
26     fStatErrorHigh(fNcells),
27     fSysErrorLow(fNcells),
28     fSysErrorHigh(fNcells)
29 phedex 1.1 {
30     // Constructor.
31     }
32    
33     //--------------------------------------------------------------------------------------------------
34 loizides 1.2 Double_t TH2DAsymErr::GetError(Double_t x, Double_t y, EErrType t)
35 phedex 1.1 {
36 loizides 1.2 // Get error corresponding to x and y for given error type.
37 phedex 1.1
38 loizides 1.2 Int_t bin = FindBin(x,y);
39     switch (t) {
40     case kStatErrLow:
41     return fStatErrorLow.fArray[bin];
42     break;
43     case kStatErrHigh:
44     return fStatErrorHigh.fArray[bin];
45     break;
46     case kSysErrLow:
47     return fSysErrorLow.fArray[bin];
48     break;
49     case kSysErrHigh:
50     return fSysErrorHigh.fArray[bin];
51     break;
52     }
53     return 0;
54 phedex 1.1 }
55    
56     //--------------------------------------------------------------------------------------------------
57 loizides 1.2 void TH2DAsymErr::SetBinContent(Int_t binx, Int_t biny, Double_t value,
58     Double_t statErrorLow, Double_t statErrorHigh,
59     Double_t sysErrorLow, Double_t sysErrorHigh)
60 phedex 1.1 {
61 loizides 1.2 // Set bin content for given bin and value.
62 phedex 1.1
63 loizides 1.2 Int_t bin = GetBin(binx,biny);
64     SetBinContent(bin,value);
65 phedex 1.1
66 loizides 1.2 fStatErrorLow.fArray[bin] = statErrorLow;
67     fStatErrorHigh.fArray[bin] = statErrorHigh;
68     fSysErrorLow.fArray[bin] = sysErrorLow;
69     fSysErrorHigh.fArray[bin] = sysErrorHigh;
70 phedex 1.1 }
71    
72     //--------------------------------------------------------------------------------------------------
73 loizides 1.2 void TH2DAsymErr::SetBinError(Int_t binx, Int_t biny,
74     Double_t statErrorLow, Double_t statErrorHigh,
75     Double_t sysErrorLow, Double_t sysErrorHigh)
76 phedex 1.1 {
77 loizides 1.2 // Set bin error for asymetric errors.
78 phedex 1.1
79 loizides 1.2 Int_t bin = GetBin(binx,biny);
80 phedex 1.1
81 loizides 1.2 fStatErrorLow.fArray[bin] = statErrorLow;
82     fStatErrorHigh.fArray[bin] = statErrorHigh;
83     fSysErrorLow.fArray[bin] = sysErrorLow;
84     fSysErrorHigh.fArray[bin] = sysErrorHigh;
85 phedex 1.1 }