Logo ROOT   6.16/01
Reference Guide
RooAbsDataStore.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/**
18\file RooAbsDataStore.cxx
19\class RooAbsDataStore
20\ingroup Roofitcore
21
22RooAbsDataStore is the abstract base class for data collection that
23use a TTree as internal storage mechanism
24**/
25
26#include "RooFit.h"
27#include "RooMsgService.h"
28#include "RooAbsDataStore.h"
29
30#include "Riostream.h"
31#include <iomanip>
32#include "TClass.h"
33
34using namespace std ;
35
37;
38
39
40////////////////////////////////////////////////////////////////////////////////
41/// Default constructor
42
44{
48}
49
50
51
52
53////////////////////////////////////////////////////////////////////////////////
54/// Default constructor
55
56RooAbsDataStore::RooAbsDataStore(const char* name, const char* title, const RooArgSet& vars) :
57 TNamed(name,title)
58{
59 // clone the fundamentals of the given data set into internal buffer
60 _vars.add(vars) ;
61
65}
66
67
68
69
70////////////////////////////////////////////////////////////////////////////////
71
72RooAbsDataStore::RooAbsDataStore(const RooAbsDataStore& other, const char* newname) : TNamed(other), RooPrintable(other)
73{
74 if (newname) {
75 SetName(newname) ;
76 }
77 _vars.add(other._vars) ;
81}
82
83
84
85////////////////////////////////////////////////////////////////////////////////
86
87RooAbsDataStore::RooAbsDataStore(const RooAbsDataStore& other, const RooArgSet& vars, const char* newname) : TNamed(other), RooPrintable(other)
88{
89 if (newname) {
90 SetName(newname) ;
91 }
92 _vars.add(vars) ;
96}
97
98
99
100////////////////////////////////////////////////////////////////////////////////
101/// Destructor
102
104{
105 delete _iterator ;
106 delete _cacheIter ;
107}
108
109
110
111////////////////////////////////////////////////////////////////////////////////
112/// Return true if currently loaded coordinate is considered valid within
113/// the current range definitions of all observables
114
116{
117 return kTRUE ;
118}
119
120
121////////////////////////////////////////////////////////////////////////////////
122/// Print name of dataset
123
124void RooAbsDataStore::printName(ostream& os) const
125{
126 os << GetName() ;
127}
128
129
130
131////////////////////////////////////////////////////////////////////////////////
132/// Print title of dataset
133
134void RooAbsDataStore::printTitle(ostream& os) const
135{
136 os << GetTitle() ;
137}
138
139
140
141////////////////////////////////////////////////////////////////////////////////
142/// Print class name of dataset
143
144void RooAbsDataStore::printClassName(ostream& os) const
145{
146 os << IsA()->GetName() ;
147}
148
149
150
151////////////////////////////////////////////////////////////////////////////////
152/// Print value of the dataset, i.e. the sum of weights contained in the dataset
153
154void RooAbsDataStore::printValue(ostream& os) const
155{
156 os << numEntries() << " entries" ;
157}
158
159
160
161////////////////////////////////////////////////////////////////////////////////
162/// Print argument of dataset, i.e. the observable names
163
164void RooAbsDataStore::printArgs(ostream& os) const
165{
166 os << "[" ;
167 _iterator->Reset() ;
168 RooAbsArg* arg ;
170 while((arg=(RooAbsArg*)_iterator->Next())) {
171 if (first) {
172 first=kFALSE ;
173 } else {
174 os << "," ;
175 }
176 os << arg->GetName() ;
177 }
178 os << "]" ;
179}
180
181
182
183
184
185
186////////////////////////////////////////////////////////////////////////////////
187/// Define default print options, for a given print style
188
190{
192}
193
194
195
196
197
198////////////////////////////////////////////////////////////////////////////////
199/// Detailed printing interface
200
201void RooAbsDataStore::printMultiline(ostream& os, Int_t /*content*/, Bool_t verbose, TString indent) const
202{
203 os << indent << "DataStore " << GetName() << " (" << GetTitle() << ")" << endl ;
204 os << indent << " Contains " << numEntries() << " entries" << endl;
205
206 if (!verbose) {
207 os << indent << " Observables " << _vars << endl ;
208 } else {
209 os << indent << " Observables: " << endl ;
211 }
212
213 if(verbose) {
214 if (_cachedVars.getSize()>0) {
215 os << indent << " Caches " << _cachedVars << endl ;
216 }
217// if(_truth.getSize() > 0) {
218// os << indent << " Generated with ";
219// TString deeper(indent) ;
220// deeper += " " ;
221// _truth.printStream(os,kName|kValue,kStandard,deeper) ;
222// }
223 }
224}
225
226
227
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:363
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
Int_t getSize() const
TIterator * createIterator(Bool_t dir=kIterForward) const
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
virtual void printName(std::ostream &os) const
Print name of dataset.
RooAbsDataStore()
Default constructor.
TIterator * _cacheIter
Iterator over dimension variables.
void printMultiline(std::ostream &os, Int_t content, Bool_t verbose, TString indent) const
Detailed printing interface.
virtual void printClassName(std::ostream &os) const
Print class name of dataset.
Bool_t _doDirtyProp
Iterator over cached variables.
virtual void printTitle(std::ostream &os) const
Print title of dataset.
TIterator * _iterator
virtual void printArgs(std::ostream &os) const
Print argument of dataset, i.e. the observable names.
RooArgSet _cachedVars
virtual Int_t defaultPrintContents(Option_t *opt) const
Define default print options, for a given print style.
virtual Bool_t valid() const =0
Return true if currently loaded coordinate is considered valid within the current range definitions o...
virtual ~RooAbsDataStore()
Destructor.
virtual Int_t numEntries() const =0
virtual void printValue(std::ostream &os) const
Print value of the dataset, i.e. the sum of weights contained in the dataset.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
Definition: RooArgSet.h:88
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
Definition: RooPrintable.h:25
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
virtual void Reset()=0
virtual TObject * Next()=0
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Definition: first.py:1
STL namespace.