Logo ROOT  
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 
22 RooAbsDataStore is the abstract base class for data collection that
23 use 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 
34 using namespace std ;
35 
37 ;
38 
39 
40 ////////////////////////////////////////////////////////////////////////////////
41 /// Default constructor
42 
44 {
45  _doDirtyProp = kTRUE ;
46 }
47 
48 
49 
50 
51 ////////////////////////////////////////////////////////////////////////////////
52 /// Default constructor
53 
54 RooAbsDataStore::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 
68 RooAbsDataStore::RooAbsDataStore(const RooAbsDataStore& other, const char* newname) : TNamed(other), RooPrintable(other)
69 {
70  if (newname) {
71  SetName(newname) ;
72  }
73  _vars.add(other._vars) ;
74  _doDirtyProp = other._doDirtyProp ;
75 }
76 
77 
78 
79 ////////////////////////////////////////////////////////////////////////////////
80 
81 RooAbsDataStore::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) ;
87  _doDirtyProp = other._doDirtyProp ;
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 
115 void RooAbsDataStore::printName(ostream& os) const
116 {
117  os << GetName() ;
118 }
119 
120 
121 
122 ////////////////////////////////////////////////////////////////////////////////
123 /// Print title of dataset
124 
125 void RooAbsDataStore::printTitle(ostream& os) const
126 {
127  os << GetTitle() ;
128 }
129 
130 
131 
132 ////////////////////////////////////////////////////////////////////////////////
133 /// Print class name of dataset
134 
135 void 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 
145 void 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 
155 void RooAbsDataStore::printArgs(ostream& os) const
156 {
157  os << "[" ;
158  Bool_t first(kTRUE) ;
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 {
180  return kName|kClassName|kArgs|kValue ;
181 }
182 
183 
184 
185 
186 
187 ////////////////////////////////////////////////////////////////////////////////
188 /// Detailed printing interface
189 
190 void 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 
first
Definition: first.py:1
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
RooPrintable::kVerbose
@ kVerbose
Definition: RooPrintable.h:34
RooMsgService.h
RooAbsDataStore::printClassName
virtual void printClassName(std::ostream &os) const
Print class name of dataset.
Definition: RooAbsDataStore.cxx:135
TNamed::SetName
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
Option_t
const char Option_t
Definition: RtypesCore.h:66
RooFit.h
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
TClass.h
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
RooAbsDataStore::RooAbsDataStore
RooAbsDataStore()
Default constructor.
Definition: RooAbsDataStore.cxx:43
TString
Basic string class.
Definition: TString.h:136
RooAbsDataStore::_cachedVars
RooArgSet _cachedVars
Definition: RooAbsDataStore.h:131
RooPrintable
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
Definition: RooPrintable.h:25
RooAbsDataStore::printTitle
virtual void printTitle(std::ostream &os) const
Print title of dataset.
Definition: RooAbsDataStore.cxx:125
bool
RooAbsDataStore::defaultPrintContents
virtual Int_t defaultPrintContents(Option_t *opt) const
Define default print options, for a given print style.
Definition: RooAbsDataStore.cxx:178
RooAbsDataStore::printValue
virtual void printValue(std::ostream &os) const
Print value of the dataset, i.e. the sum of weights contained in the dataset.
Definition: RooAbsDataStore.cxx:145
RooPrintable::kName
@ kName
Definition: RooPrintable.h:33
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
RooAbsDataStore::_vars
RooArgSet _vars
Definition: RooAbsDataStore.h:126
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
RooArgSet::add
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
Definition: RooArgSet.cxx:261
RooPrintable::kArgs
@ kArgs
Definition: RooPrintable.h:33
RooAbsDataStore::~RooAbsDataStore
virtual ~RooAbsDataStore()
Destructor.
Definition: RooAbsDataStore.cxx:95
RooPrintable::kValue
@ kValue
Definition: RooPrintable.h:33
RooAbsDataStore::printName
virtual void printName(std::ostream &os) const
Print name of dataset.
Definition: RooAbsDataStore.cxx:115
RooAbsDataStore.h
RooAbsDataStore::printArgs
virtual void printArgs(std::ostream &os) const
Print argument of dataset, i.e. the observable names.
Definition: RooAbsDataStore.cxx:155
RooAbsDataStore::numEntries
virtual Int_t numEntries() const =0
RooAbsDataStore::_doDirtyProp
Bool_t _doDirtyProp
Definition: RooAbsDataStore.h:133
RooPrintable::kClassName
@ kClassName
Definition: RooPrintable.h:33
RooAbsDataStore::valid
virtual Bool_t valid() const =0
Return true if currently loaded coordinate is considered valid within the current range definitions o...
Definition: RooAbsDataStore.cxx:106
RooPrintable::kExtras
@ kExtras
Definition: RooPrintable.h:33
name
char name[80]
Definition: TGX11.cxx:110
RooAbsDataStore::printMultiline
void printMultiline(std::ostream &os, Int_t content, Bool_t verbose, TString indent) const
Detailed printing interface.
Definition: RooAbsDataStore.cxx:190
RooPrintable::kTitle
@ kTitle
Definition: RooPrintable.h:33
RooPrintable::printStream
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,...
Definition: RooPrintable.cxx:75
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
RooAbsDataStore
RooAbsDataStore is the abstract base class for data collection that use a TTree as internal storage m...
Definition: RooAbsDataStore.h:34
Riostream.h
RooAbsCollection::getSize
Int_t getSize() const
Definition: RooAbsCollection.h:182
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
int