AmpTools
Histogram.h
Go to the documentation of this file.
1
#if !defined(HISTOGRAM)
2
#define HISTOGRAM
3
4
//******************************************************************************
5
// This file is part of AmpTools, a package for performing Amplitude Analysis
6
//
7
// Copyright Trustees of Indiana University 2010, all rights reserved
8
//
9
// This software written by Matthew Shepherd, Ryan Mitchell, and
10
// Hrayr Matevosyan at Indiana University, Bloomington
11
//
12
// Redistribution and use in source and binary forms, with or without
13
// modification, are permitted provided that the following conditions
14
// are met:
15
// 1. Redistributions of source code must retain the above copyright
16
// notice and author attribution, this list of conditions and the
17
// following disclaimer.
18
// 2. Redistributions in binary form must reproduce the above copyright
19
// notice and author attribution, this list of conditions and the
20
// following disclaimer in the documentation and/or other materials
21
// provided with the distribution.
22
// 3. Neither the name of the University nor the names of its contributors
23
// may be used to endorse or promote products derived from this software
24
// without specific prior written permission.
25
//
26
// Creation of derivative forms of this software for commercial
27
// utilization may be subject to restriction; written permission may be
28
// obtained from the Trustees of Indiana University.
29
//
30
// INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES,
31
// EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA
32
// UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR
33
// FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR
34
// DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS,
35
// OR OTHER RIGHTS. Neither Indiana University nor the authors shall be
36
// held liable for any liability with respect to any claim by the user or
37
// any other party arising from use of the program.
38
//******************************************************************************
39
40
#include <vector>
41
42
#include "TH1F.h"
43
44
using namespace
std
;
45
46
#define MAXBINS 200*200
47
48
struct
HistStruct
{
49
int
nBins,nBinsX,
nBinsY
;
50
float
xLow
,xHigh;
51
float
yLow
,yHigh;
52
float
entries
;
53
float
contents[
MAXBINS
];
54
};
55
56
57
class
Histogram
58
{
59
60
public
:
61
62
Histogram
(
string
name =
"Histogram"
,
string
title =
"hist"
);
63
64
virtual
~Histogram
(){};
65
/*Pure virtual methods*/
66
virtual
void
fill( vector< double > value,
double
weight = 1.0 )= 0;
67
68
virtual
TH1* toRoot()
const
=0;
69
virtual
HistStruct
toStruct()
const
=0;
70
virtual
Histogram
* Clone()
const
=0;
71
72
void
normalize(
double
scaleFactor );
73
double
entries
(){
return
( m_entries ); }
74
void
clear();
75
void
operator+=(
HistStruct
& hStruct );
76
77
string
title
()
const
{
return
m_title; }
78
string
name
()
const
{
return
m_name; }
79
80
bool
empty
()
const
{
return
( m_entries == 0 ); }
81
82
protected
:
83
84
int
m_nBins,
m_nBinsX
;
85
double
m_xLow
;
86
double
m_xHigh
;
87
88
double
m_entries
;
89
vector< double >
m_binContents
;
90
double
m_binSizeX
;
91
92
int
m_dimensions
;
93
94
private
:
95
96
string
m_title;
97
string
m_name;
98
};
99
100
#endif
Histogram::m_nBinsX
int m_nBinsX
Definition:
Histogram.h:84
Histogram::m_dimensions
int m_dimensions
Definition:
Histogram.h:92
MAXBINS
#define MAXBINS
Definition:
Histogram.h:46
Histogram::entries
double entries()
Definition:
Histogram.h:73
std
Histogram::~Histogram
virtual ~Histogram()
Definition:
Histogram.h:64
Histogram::m_xLow
double m_xLow
Definition:
Histogram.h:85
HistStruct::xLow
float xLow
Definition:
Histogram.h:50
HistStruct::nBinsY
int nBinsY
Definition:
Histogram.h:49
Histogram::name
string name() const
Definition:
Histogram.h:78
Histogram::m_xHigh
double m_xHigh
Definition:
Histogram.h:86
HistStruct::yLow
float yLow
Definition:
Histogram.h:51
HistStruct
Definition:
Histogram.h:48
Histogram::m_binContents
vector< double > m_binContents
Definition:
Histogram.h:89
Histogram::empty
bool empty() const
Definition:
Histogram.h:80
Histogram::m_binSizeX
double m_binSizeX
Definition:
Histogram.h:90
Histogram
Definition:
Histogram.h:57
HistStruct::entries
float entries
Definition:
Histogram.h:52
Histogram::m_entries
double m_entries
Definition:
Histogram.h:88
Histogram::title
string title() const
Definition:
Histogram.h:77
AmpTools
IUAmpTools
Histogram.h
Generated on Sun May 7 2017 06:12:49 for AmpTools by
1.8.13