Logo ROOT   6.16/01
Reference Guide
HistRef.h
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2// Author: L. Moneta
3/*************************************************************************
4 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef HISTFACTORY_HISTREF_H
12#define HISTFACTORY_HISTREF_H
13
14
15class TH1;
16
17namespace RooStats{
18namespace HistFactory {
19
20
21// Internal class wrapping an histogram and managing its content.
22// conveninet for dealing with histogram pointers in the
23// HistFactory class
24class HistRef {
25
26public:
27
28
29 /// constructor - use gives away ownerhip of the given pointer
30 HistRef(TH1 * h = 0) : fHist(h) {}
31
32 HistRef( const HistRef& other ) :
33 fHist(0) {
34 if (other.fHist) fHist = CopyObject(other.fHist);
35 }
36
39 }
40
41 /// assignment operator (delete previous contained histogram)
42 HistRef & operator= (const HistRef & other) {
43 if (this == &other) return *this;
45 fHist = CopyObject(other.fHist);
46 return *this;
47 }
48
49 TH1 * GetObject() const { return fHist; }
50
51 /// set the object - user gives away the ownerhisp
52 void SetObject(TH1 *h) {
54 fHist = h;
55 }
56
57 /// operator= passing an object pointer : user gives away its ownerhisp
58 void operator= (TH1 * h) { SetObject(h); }
59
60 static TH1 * CopyObject(TH1 * h);
61 static void DeleteObject(TH1 * h);
62
63protected:
64
65 TH1 * fHist; // pointer to contained histogram
66};
67
68}
69}
70
71#endif
#define h(i)
Definition: RSha256.hxx:106
Internal class wrapping an histogram and managing its content.
Definition: HistRef.h:24
HistRef & operator=(const HistRef &other)
assignment operator (delete previous contained histogram)
Definition: HistRef.h:42
HistRef(const HistRef &other)
Definition: HistRef.h:32
void SetObject(TH1 *h)
set the object - user gives away the ownerhisp
Definition: HistRef.h:52
static TH1 * CopyObject(TH1 *h)
Definition: HistRef.cxx:24
HistRef(TH1 *h=0)
constructor - use gives away ownerhip of the given pointer
Definition: HistRef.h:30
static void DeleteObject(TH1 *h)
Definition: HistRef.cxx:31
The TH1 histogram class.
Definition: TH1.h:56
@(#)root/roostats:$Id$ Author: George Lewis, Kyle Cranmer
Definition: Asimov.h:20