Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
33using namespace std ;
34
36 ;
37
38
39////////////////////////////////////////////////////////////////////////////////
40/// Constructor
41
42RooAbsStudy::RooAbsStudy(const char* name, const char* title) : TNamed(name,title), _storeDetails(0), _summaryData(0), _detailData(0), _ownDetailData(true)
43{
44}
45
46
47
48////////////////////////////////////////////////////////////////////////////////
49/// Copy constructor
50
51RooAbsStudy::RooAbsStudy(const RooAbsStudy& other) : TNamed(other), _storeDetails(other._storeDetails), _summaryData(other._summaryData),
52 _detailData(0), _ownDetailData(other._ownDetailData)
53{
54}
55
56
57
58////////////////////////////////////////////////////////////////////////////////
59/// Destructor
60
62{
63 if (_summaryData) delete _summaryData ;
66 delete _detailData ;
67 }
68}
69
70
71
72
73////////////////////////////////////////////////////////////////////////////////
74
75void RooAbsStudy::registerSummaryOutput(const RooArgSet& allVars, const RooArgSet& varsWithError, const RooArgSet& varsWithAsymError)
76{
77 if (_summaryData) {
78 coutW(ObjectHandling) << "RooAbsStudy::registerSummaryOutput(" << GetName() << ") WARNING summary output already registered" << endl ;
79 return ;
80 }
81
82 string name = Form("%s_summary_data",GetName()) ;
83 string title = Form("%s Summary Data",GetTitle()) ;
84 _summaryData = new RooDataSet(name.c_str(),title.c_str(),allVars,RooFit::StoreError(varsWithError),RooFit::StoreAsymError(varsWithAsymError)) ;
85}
86
87
88////////////////////////////////////////////////////////////////////////////////
89
91{
92 if (!_summaryData) {
93 coutE(ObjectHandling) << "RooAbsStudy::storeSummaryOutput(" << GetName() << ") ERROR: no summary output data configuration registered" << endl ;
94 return ;
95 }
96 _summaryData->add(vars) ;
97}
98
99
100
101////////////////////////////////////////////////////////////////////////////////
102
103void RooAbsStudy::storeDetailedOutput(std::unique_ptr<TNamed> object)
104{
105 if (!_storeDetails) return;
106
107 if (!_detailData) {
109 _detailData->SetName(TString::Format("%s_detailed_data_list",GetName())) ;
110 //cout << "RooAbsStudy::ctor() detailData name = " << _detailData->GetName() << endl ;
111 }
112
113 object->SetName(TString::Format("%s_detailed_data_%d",GetName(),_detailData->GetSize())) ;
114 //cout << "storing detailed data with name " << object.GetName() << endl ;
115 _detailData->Add(object.release());
116}
117
118
119
120////////////////////////////////////////////////////////////////////////////////
121
123{
124 if (!chunkList) return ;
125
126 for(TObject * obj : *chunkList) {
127
128 //cout << "RooAbsStudy::aggregateSummaryOutput(" << GetName() << ") processing object " << obj->GetName() << endl ;
129
130 RooDataSet* data = dynamic_cast<RooDataSet*>(obj) ;
131 if (data) {
132 if (TString(data->GetName()).BeginsWith(Form("%s_summary_data",GetName()))) {
133 //cout << "RooAbsStudy::aggregateSummaryOutput(" << GetName() << ") found summary block " << data->GetName() << endl ;
134 if (!_summaryData) {
135 _summaryData = (RooDataSet*) data->Clone(Form("%s_summary_data",GetName())) ;
136 } else {
138 }
139 }
140 }
141
142 if (auto dlist = dynamic_cast<RooLinkedList*>(obj)) {
143 if (TString(dlist->GetName()).BeginsWith(Form("%s_detailed_data",GetName()))) {
144 for(auto * dobj : static_range_cast<TNamed*>(*dlist)) storeDetailedOutput(std::unique_ptr<TNamed>{dobj}) ;
145 }
146 }
147 }
148}
#define coutW(a)
#define coutE(a)
#define ClassImp(name)
Definition Rtypes.h:377
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:2467
RooAbsStudy is an abstract base class for RooStudyManager modules.
Definition RooAbsStudy.h:33
void storeDetailedOutput(bool flag)
Definition RooAbsStudy.h:47
~RooAbsStudy() override
Destructor.
void storeSummaryOutput(const RooArgSet &vars)
bool _ownDetailData
Definition RooAbsStudy.h:70
void aggregateSummaryOutput(TList *chunkList)
RooDataSet * _summaryData
!
Definition RooAbsStudy.h:68
void registerSummaryOutput(const RooArgSet &allVars, const RooArgSet &varsWithError=RooArgSet(), const RooArgSet &varsWithAsymError=RooArgSet())
bool _storeDetails
Definition RooAbsStudy.h:67
RooLinkedList * _detailData
!
Definition RooAbsStudy.h:69
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
RooDataSet is a container class to hold unbinned data.
Definition RooDataSet.h:57
void add(const RooArgSet &row, double weight=1.0, double weightError=0.0) override
Add one ore more rows of data.
void append(RooDataSet &data)
Add all data points of given data set to this data set.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Int_t GetSize() const
void SetName(const char *name)
void Delete(Option_t *o=nullptr) override
Remove all elements in collection and delete all elements NB: Collection does not own elements,...
virtual void Add(TObject *arg)
A doubly linked list.
Definition TList.h:38
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:41
Basic string class.
Definition TString.h:139
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:2356
RooCmdArg StoreAsymError(const RooArgSet &aset)
RooCmdArg StoreError(const RooArgSet &aset)