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
22Abstract 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 std::endl;
34
35
36
37////////////////////////////////////////////////////////////////////////////////
38/// Constructor
39
40RooAbsStudy::RooAbsStudy(const char *name, const char *title) : TNamed(name, title) {}
41
42////////////////////////////////////////////////////////////////////////////////
43/// Copy constructor
44
46 : TNamed(other),
47 _storeDetails(other._storeDetails),
48 _summaryData(other._summaryData),
49 _ownDetailData(other._ownDetailData)
50{
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Destructor
55
57{
58 if (_summaryData) delete _summaryData ;
61 delete _detailData ;
62 }
63}
64
65
66
67
68////////////////////////////////////////////////////////////////////////////////
69
71{
72 if (_summaryData) {
73 coutW(ObjectHandling) << "RooAbsStudy::registerSummaryOutput(" << GetName() << ") WARNING summary output already registered" << std::endl ;
74 return ;
75 }
76
77 std::string name = std::string(GetName()) + "_summary_data";
78 std::string title = std::string(GetTitle()) + " Summary Data";
80}
81
82
83////////////////////////////////////////////////////////////////////////////////
84
86{
87 if (!_summaryData) {
88 coutE(ObjectHandling) << "RooAbsStudy::storeSummaryOutput(" << GetName() << ") ERROR: no summary output data configuration registered" << std::endl ;
89 return ;
90 }
91 _summaryData->add(vars) ;
92}
93
94
95
96////////////////////////////////////////////////////////////////////////////////
97
98void RooAbsStudy::storeDetailedOutput(std::unique_ptr<TNamed> object)
99{
100 if (!_storeDetails) return;
101
102 if (!_detailData) {
104 _detailData->SetName(TString::Format("%s_detailed_data_list",GetName())) ;
105 //cout << "RooAbsStudy::ctor() detailData name = " << _detailData->GetName() << std::endl ;
106 }
107
108 object->SetName(TString::Format("%s_detailed_data_%d",GetName(),_detailData->GetSize())) ;
109 //cout << "storing detailed data with name " << object.GetName() << std::endl ;
110 _detailData->Add(object.release());
111}
112
113
114
115////////////////////////////////////////////////////////////////////////////////
116
118{
119 if (!chunkList) return ;
120
121 for(TObject * obj : *chunkList) {
122
123 //cout << "RooAbsStudy::aggregateSummaryOutput(" << GetName() << ") processing object " << obj->GetName() << std::endl ;
124
125 RooDataSet* data = dynamic_cast<RooDataSet*>(obj) ;
126 if (data) {
127 if (TString(data->GetName()).BeginsWith(Form("%s_summary_data",GetName()))) {
128 //cout << "RooAbsStudy::aggregateSummaryOutput(" << GetName() << ") found summary block " << data->GetName() << std::endl ;
129 if (!_summaryData) {
130 _summaryData = static_cast<RooDataSet*>(data->Clone(Form("%s_summary_data",GetName()))) ;
131 } else {
133 }
134 }
135 }
136
137 if (auto dlist = dynamic_cast<RooLinkedList*>(obj)) {
138 if (TString(dlist->GetName()).BeginsWith(Form("%s_detailed_data",GetName()))) {
139 for(auto * dobj : static_range_cast<TNamed*>(*dlist)) storeDetailedOutput(std::unique_ptr<TNamed>{dobj}) ;
140 }
141 }
142 }
143}
#define coutW(a)
#define coutE(a)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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:2489
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())
RooAbsStudy()=default
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:24
Container class to hold unbinned data.
Definition RooDataSet.h:34
void append(RooDataSet &data)
Add all data points of given data set to this data set.
void add(const RooArgSet &row, double weight, double weightError)
Add one ore more rows of data.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
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:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
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:2378
RooCmdArg StoreAsymError(const RooArgSet &aset)
RooCmdArg StoreError(const RooArgSet &aset)