Logo ROOT  
Reference Guide
RooAbsStudy.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 RooAbsStudy.cxx
19\class RooAbsStudy
20\ingroup Roofitcore
21
22RooAbsStudy is an abstract base class for RooStudyManager modules
23
24**/
25
26#include "Riostream.h"
27
28#include "RooAbsStudy.h"
29#include "RooMsgService.h"
30#include "RooDataSet.h"
31#include "TList.h"
32#include "TClass.h"
33
34using namespace std ;
35
37 ;
38
39
40////////////////////////////////////////////////////////////////////////////////
41/// Constructor
42
43RooAbsStudy::RooAbsStudy(const char* name, const char* title) : TNamed(name,title), _storeDetails(0), _summaryData(0), _detailData(0), _ownDetailData(kTRUE)
44{
45}
46
47
48
49////////////////////////////////////////////////////////////////////////////////
50/// Copy constructor
51
52RooAbsStudy::RooAbsStudy(const RooAbsStudy& other) : TNamed(other), _storeDetails(other._storeDetails), _summaryData(other._summaryData),
53 _detailData(0), _ownDetailData(other._ownDetailData)
54{
55}
56
57
58
59////////////////////////////////////////////////////////////////////////////////
60/// Destructor
61
63{
64 if (_summaryData) delete _summaryData ;
67 delete _detailData ;
68 }
69}
70
71
72
73
74////////////////////////////////////////////////////////////////////////////////
75
76void RooAbsStudy::registerSummaryOutput(const RooArgSet& allVars, const RooArgSet& varsWithError, const RooArgSet& varsWithAsymError)
77{
78 if (_summaryData) {
79 coutW(ObjectHandling) << "RooAbsStudy::registerSummaryOutput(" << GetName() << ") WARNING summary output already registered" << endl ;
80 return ;
81 }
82
83 string name = Form("%s_summary_data",GetName()) ;
84 string title = Form("%s Summary Data",GetTitle()) ;
85 _summaryData = new RooDataSet(name.c_str(),title.c_str(),allVars,RooFit::StoreError(varsWithError),RooFit::StoreAsymError(varsWithAsymError)) ;
86}
87
88
89////////////////////////////////////////////////////////////////////////////////
90
92{
93 if (!_summaryData) {
94 coutE(ObjectHandling) << "RooAbsStudy::storeSummaryOutput(" << GetName() << ") ERROR: no summary output data configuration registered" << endl ;
95 return ;
96 }
97 _summaryData->add(vars) ;
98}
99
100
101
102////////////////////////////////////////////////////////////////////////////////
103
105{
106 if (_storeDetails) {
107
108 if (!_detailData) {
110 _detailData->SetName(TString::Format("%s_detailed_data_list",GetName())) ;
111 //cout << "RooAbsStudy::ctor() detailData name = " << _detailData->GetName() << endl ;
112 }
113
114 object.SetName(TString::Format("%s_detailed_data_%d",GetName(),_detailData->GetSize())) ;
115 //cout << "storing detailed data with name " << object.GetName() << endl ;
116 _detailData->Add(&object) ;
117 } else {
118 delete &object ;
119 }
120}
121
122
123
124////////////////////////////////////////////////////////////////////////////////
125
127{
128 if (!chunkList) return ;
129
130 TIter iter = chunkList->MakeIterator() ;
131 TObject* obj ;
132 while((obj=iter.Next())) {
133
134 //cout << "RooAbsStudy::aggregateSummaryOutput(" << GetName() << ") processing object " << obj->GetName() << endl ;
135
136 RooDataSet* data = dynamic_cast<RooDataSet*>(obj) ;
137 if (data) {
138 if (TString(data->GetName()).BeginsWith(Form("%s_summary_data",GetName()))) {
139 //cout << "RooAbsStudy::aggregateSummaryOutput(" << GetName() << ") found summary block " << data->GetName() << endl ;
140 if (!_summaryData) {
141 _summaryData = (RooDataSet*) data->Clone(Form("%s_summary_data",GetName())) ;
142 } else {
144 }
145 }
146 }
147
148 if (auto dlist = dynamic_cast<RooLinkedList*>(obj)) {
149 if (TString(dlist->GetName()).BeginsWith(Form("%s_detailed_data",GetName()))) {
150 for(auto * dobj : static_range_cast<TNamed*>(*dlist)) storeDetailedOutput(*dobj) ;
151 }
152 }
153 }
154}
#define coutW(a)
Definition: RooMsgService.h:32
#define coutE(a)
Definition: RooMsgService.h:33
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassImp(name)
Definition: Rtypes.h:375
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
char name[80]
Definition: TGX11.cxx:110
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition: TString.cxx:2447
RooAbsStudy is an abstract base class for RooStudyManager modules.
Definition: RooAbsStudy.h:33
~RooAbsStudy() override
Destructor.
Definition: RooAbsStudy.cxx:62
void storeSummaryOutput(const RooArgSet &vars)
Definition: RooAbsStudy.cxx:91
void storeDetailedOutput(Bool_t flag)
Definition: RooAbsStudy.h:47
void aggregateSummaryOutput(TList *chunkList)
Bool_t _storeDetails
Definition: RooAbsStudy.h:67
RooDataSet * _summaryData
!
Definition: RooAbsStudy.h:68
Bool_t _ownDetailData
Definition: RooAbsStudy.h:70
void registerSummaryOutput(const RooArgSet &allVars, const RooArgSet &varsWithError=RooArgSet(), const RooArgSet &varsWithAsymError=RooArgSet())
Definition: RooAbsStudy.cxx:76
RooLinkedList * _detailData
!
Definition: RooAbsStudy.h:69
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:55
void append(RooDataSet &data)
Add all data points of given data set to this data set.
void add(const RooArgSet &row, Double_t weight=1.0, Double_t weightError=0) override
Add one ore more rows of data.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:38
Int_t GetSize() const
Definition: RooLinkedList.h:63
void SetName(const char *name)
Definition: RooLinkedList.h:99
void Delete(Option_t *o=0) override
Remove all elements in collection and delete all elements NB: Collection does not own elements,...
virtual void Add(TObject *arg)
Definition: RooLinkedList.h:67
TObject * Next()
Definition: TCollection.h:251
A doubly linked list.
Definition: TList.h:44
TIterator * MakeIterator(Bool_t dir=kIterForward) const override
Return a list iterator.
Definition: TList.cxx:722
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
const char * GetTitle() const override
Returns title of object.
Definition: TNamed.h:48
Mother of all ROOT objects.
Definition: TObject.h:37
Basic string class.
Definition: TString.h:136
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:615
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2336
RooCmdArg StoreAsymError(const RooArgSet &aset)
RooCmdArg StoreError(const RooArgSet &aset)
bool BeginsWith(const std::string &theString, const std::string &theSubstring)
@ ObjectHandling
Definition: RooGlobalFunc.h:64