Logo ROOT   6.18/05
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{
46}
47
48
49
50
51////////////////////////////////////////////////////////////////////////////////
52/// Default constructor
53
54RooAbsDataStore::RooAbsDataStore(const char* name, const char* title, const RooArgSet& vars) :
55 TNamed(name,title)
56{
57 // clone the fundamentals of the given data set into internal buffer
58 _vars.add(vars) ;
59
61}
62
63
64
65
66////////////////////////////////////////////////////////////////////////////////
67
68RooAbsDataStore::RooAbsDataStore(const RooAbsDataStore& other, const char* newname) : TNamed(other), RooPrintable(other)
69{
70 if (newname) {
71 SetName(newname) ;
72 }
73 _vars.add(other._vars) ;
75}
76
77
78
79////////////////////////////////////////////////////////////////////////////////
80
81RooAbsDataStore::RooAbsDataStore(const RooAbsDataStore& other, const RooArgSet& vars, const char* newname) : TNamed(other), RooPrintable(other)
82{
83 if (newname) {
84 SetName(newname) ;
85 }
86 _vars.add(vars) ;
88}
89
90
91
92////////////////////////////////////////////////////////////////////////////////
93/// Destructor
94
96{
97
98}
99
100
101
102////////////////////////////////////////////////////////////////////////////////
103/// Return true if currently loaded coordinate is considered valid within
104/// the current range definitions of all observables
105
107{
108 return kTRUE ;
109}
110
111
112////////////////////////////////////////////////////////////////////////////////
113/// Print name of dataset
114
115void RooAbsDataStore::printName(ostream& os) const
116{
117 os << GetName() ;
118}
119
120
121
122////////////////////////////////////////////////////////////////////////////////
123/// Print title of dataset
124
125void RooAbsDataStore::printTitle(ostream& os) const
126{
127 os << GetTitle() ;
128}
129
130
131
132////////////////////////////////////////////////////////////////////////////////
133/// Print class name of dataset
134
135void RooAbsDataStore::printClassName(ostream& os) const
136{
137 os << IsA()->GetName() ;
138}
139
140
141
142////////////////////////////////////////////////////////////////////////////////
143/// Print value of the dataset, i.e. the sum of weights contained in the dataset
144
145void RooAbsDataStore::printValue(ostream& os) const
146{
147 os << numEntries() << " entries" ;
148}
149
150
151
152////////////////////////////////////////////////////////////////////////////////
153/// Print argument of dataset, i.e. the observable names
154
155void RooAbsDataStore::printArgs(ostream& os) const
156{
157 os << "[" ;
159 for (const auto arg : _vars) {
160 if (first) {
161 first=kFALSE ;
162 } else {
163 os << "," ;
164 }
165 os << arg->GetName() ;
166 }
167 os << "]" ;
168}
169
170
171
172
173
174
175////////////////////////////////////////////////////////////////////////////////
176/// Define default print options, for a given print style
177
179{
181}
182
183
184
185
186
187////////////////////////////////////////////////////////////////////////////////
188/// Detailed printing interface
189
190void RooAbsDataStore::printMultiline(ostream& os, Int_t /*content*/, Bool_t verbose, TString indent) const
191{
192 os << indent << "DataStore " << GetName() << " (" << GetTitle() << ")" << endl ;
193 os << indent << " Contains " << numEntries() << " entries" << endl;
194
195 if (!verbose) {
196 os << indent << " Observables " << _vars << endl ;
197 } else {
198 os << indent << " Observables: " << endl ;
200 }
201
202 if(verbose) {
203 if (_cachedVars.getSize()>0) {
204 os << indent << " Caches " << _cachedVars << endl ;
205 }
206// if(_truth.getSize() > 0) {
207// os << indent << " Generated with ";
208// TString deeper(indent) ;
209// deeper += " " ;
210// _truth.printStream(os,kName|kValue,kStandard,deeper) ;
211// }
212 }
213}
214
215
216
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:365
static void indent(ostringstream &buf, int indent_level)
char name[80]
Definition: TGX11.cxx:109
Int_t getSize() 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.
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.
virtual void printTitle(std::ostream &os) const
Print title of dataset.
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,...
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
Basic string class.
Definition: TString.h:131
Definition: first.py:1