Logo ROOT  
Reference Guide
RooSimWSTool.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/// \class RooSimWSTool
19/// The RooSimWSTool is a tool operating on RooWorkspace objects that
20/// can clone PDFs into a series of variations that are joined together
21/// into a RooSimultanous PDF.
22///
23/// ## Splitting a single PDF
24/// The simplest use case is to take a workspace PDF as prototype and
25/// "split" a parameter of that PDF into two specialized parameters
26/// depending on a category in the dataset.
27///
28/// For example, given a Gaussian
29/// PDF \f$ G(x \,|\, m,s) \f$ we want to construct a \f$ G_a(x \,|\, m_a,s) \f$ and a \f$ G_b(x \,|\, m_b,s) \f$
30/// with different mean parameters to be fit to a dataset with observables
31/// \f$ (x,c) \f$ where \f$ c \f$ is a category with states 'a' and 'b'.
32///
33/// Using RooSimWSTool, one can create a simultaneous PDF from \f$ G_a \f$ and \f$ G_b \f$
34/// from \f$ G \f$ with the following commands:
35/// ```
36/// RooSimWSTool wst(wspace);
37/// wst.build("G_sim", "G", SplitParam("m","c"));
38/// ```
39///
40/// #### Splitting using a product category
41/// From this simple example one can go to builds of arbitrary complexity
42/// by specifying multiple SplitParam arguments on multiple parameters
43/// involving multiple splitting categories. Splits can also be performed
44/// in the product of multiple categories, *i.e.*,
45/// ```
46/// wst.build("G_sim", "G", SplitParam("m","c,d"));
47/// ```
48/// splits the parameter \f$ m \f$ in the product of the states of \f$ c \f$ and
49/// \f$ d \f$.
50///
51/// #### Constrained split
52/// Another possibility
53/// is the "constrained" split, which clones the parameter for all but one state
54/// and inserts a formula specialization in a chosen state that evaluates
55/// to \f$ 1 - \sum_i(a_i) \f$ where \f$ a_i \f$ are all other specializations. For example,
56/// given a category \f$ c \f$ with the states `"A","B","C","D"`, the specification
57/// ```
58/// SplitParamConstrained("m","c","D")
59/// ```
60/// will create the parameters \f$ m_A,m_B,m_C \f$ and a formula expression \f$ m_D \f$
61/// that evaluates to \f$ (1-(m_A+m_B+m_C)) \f$. Constrained splits can also be
62/// specified in the product of categories. In that case, the name of the
63/// remainder state follows the syntax `"{State1;State2}"`, where `State1` and
64/// `State2` are the state names of the two spitting categories.
65///
66/// ## Splitting multiple PDFs
67/// The examples so far deal with a single prototype PDF. It is also
68/// possible to build with multiple prototype PDFs by specifying a
69/// mapping between the prototype to use and the names of states of
70/// a "master" splitting category. To specify these configurations,
71/// an intermediate `MultiBuildConfig` must be composed with all
72/// the necessary specifications. This, for example,
73/// ```
74/// RooSimWSTool::MultiBuildConfig mbc("mc");
75/// mbc.addPdf("I","G",SplitParam("m,s","c"));
76/// mbc.addPdf("II,III","F",SplitParam("a","c,d"));
77/// ```
78/// configures a build with two prototype PDFs \f$ G \f$ and \f$ F \f$.
79/// Prototype \f$ G \f$ is used for state `"I"` of the master split category
80/// `mc` and prototype \f$ F \f$ is used for states `"II"` and `"III"` of the
81/// master split category `mc`. Furthermore, the parameters \f$ m,s \f$ of
82/// prototype \f$ G \f$ are split
83/// in category \f$ c \f$ while the parameter \f$ a \f$ of prototype \f$ F \f$ is split in
84/// the product of the categories \f$ c \f$ and \f$ d \f$. The actual build is then
85/// performed by passing the build configuration to RooSimWSTool, *e.g.*,
86/// ```
87/// wst.build("MASTER", mbc);
88/// ```
89/// By default, a specialisation is built for each permutation of
90/// states of the splitting categories that are used. It is possible
91/// to restrict the building of specialised PDFs to a subset of states
92/// by adding a restriction on the number of states to build as follows:
93/// ```
94/// mbc.restrictBuild("c","A,B");
95/// ```
96/// The restrictBuild method can be called multiple times, but at most
97/// once for each splitting category in use. For simple builds with a single
98/// prototype, restriction can be specified with a Restrict() argument
99/// on the build command line.
100///
101
102
103#include "RooSimWSTool.h"
104
106#include "RooMsgService.h"
107#include "RooCategory.h"
108#include "RooRealVar.h"
109#include "RooAbsPdf.h"
110#include "RooSuperCategory.h"
111#include "RooCustomizer.h"
112#include "RooMultiCategory.h"
113#include "RooSimultaneous.h"
114#include "RooGlobalFunc.h"
115#include "RooFracRemainder.h"
116#include "RooFactoryWSTool.h"
117
124;
125
126using namespace std ;
127
128namespace {
129
130static Int_t init();
131
132Int_t dummy = init() ;
133
134static Int_t init()
135{
137 RooFactoryWSTool::registerSpecial("SIMCLONE",iface) ;
138 RooFactoryWSTool::registerSpecial("MSIMCLONE",iface) ;
139 (void) dummy;
140 return 0 ;
141}
142
143}
144
145////////////////////////////////////////////////////////////////////////////////
146/// Constructor of SimWSTool on given workspace. All input is taken from the workspace
147/// All output is stored in the workspace
148
150{
151}
152
153
154
155////////////////////////////////////////////////////////////////////////////////
156/// Destructor
157
159{
160}
161
162
163
164////////////////////////////////////////////////////////////////////////////////
165/// Build a RooSimultaneous PDF with name simPdfName from cloning specializations of protytpe PDF protoPdfName.
166/// <table>
167/// <tr><th> Optional Arguments <th> Effect
168/// <tr><td> SplitParam(varname, catname) <td> Split parameter(s) with given name(s) in category(s) with given names
169/// <tr><td> SplitParam(var, cat) <td> Split given parameter(s) in givem category(s)
170/// <tr><td> SplitParamConstrained(vname, cname, remainder) <td> Make constrained split in parameter(s) with given name(s) in category(s) with given names
171/// putting remainder fraction formula in state with name "remainder"
172/// <tr><td> SplitParamConstrained(var,cat,remainder) <td> Make constrained split in parameter(s) with given name(s) in category(s) with given names
173/// putting remainder fraction formula in state with name "remainder"
174/// <tr><td> Restrict(catName,stateNameList) <td> Restrict build by only considered listed state names of category with given name
175
176RooSimultaneous* RooSimWSTool::build(const char* simPdfName, const char* protoPdfName, const RooCmdArg& arg1,const RooCmdArg& arg2,
177 const RooCmdArg& arg3,const RooCmdArg& arg4, const RooCmdArg& arg5,const RooCmdArg& arg6)
178{
179 BuildConfig bc(protoPdfName,arg1,arg2,arg3,arg4,arg5,arg6) ;
180 return build(simPdfName,bc) ;
181}
182
183
184
185////////////////////////////////////////////////////////////////////////////////
186/// Build a RooSimultaneous PDF with name simPdfName from cloning specializations of protytpe PDF protoPdfName.
187/// Use the provided BuildConfig or MultiBuildConfig object to configure the build
188
189RooSimultaneous* RooSimWSTool::build(const char* simPdfName,BuildConfig& bc, bool verbose)
190{
191 ObjBuildConfig* obc = validateConfig(bc) ;
192 if (!obc) return 0 ;
193
194 if (verbose) {
195 obc->print() ;
196 }
197
198 RooSimultaneous* ret = executeBuild(simPdfName,*obc,verbose) ;
199
200 delete obc ;
201 return ret ;
202}
203
204
205
206////////////////////////////////////////////////////////////////////////////////
207/// Validate build configuration. If not syntax errors or missing objects are found,
208/// return an ObjBuildConfig in which all names are replaced with object pointers.
209
211{
212 // Create empty object version of build config
213 ObjBuildConfig* obc = new ObjBuildConfig ;
214
215 if (bc._masterCatName.length()>0) {
216 obc->_masterCat = _ws->cat(bc._masterCatName) ;
217 if (!obc->_masterCat) {
218 coutE(ObjectHandling) << "RooSimWSTool::build(" << GetName() << ") ERROR: associated workspace " << _ws->GetName()
219 << " does not contain a category named " << bc._masterCatName
220 << " that was designated as master index category in the build configuration" << endl ;
221 delete obc ;
222 return 0 ;
223 }
224 } else {
225 obc->_masterCat = 0 ;
226 }
227
228 map<string,SplitRule>::iterator pdfiter ;
229 // Check that we have the p.d.f.s
230 for (pdfiter = bc._pdfmap.begin() ; pdfiter != bc._pdfmap.end() ; ++pdfiter) {
231
232 // Check that p.d.f exists
233 RooAbsPdf* pdf = _ws->pdf(pdfiter->second.GetName()) ;
234 if (!pdf) {
235 coutE(ObjectHandling) << "RooSimWSTool::build(" << GetName() << ") ERROR: associated workspace " << _ws->GetName()
236 << " does not contain a pdf named " << pdfiter->second.GetName() << endl ;
237 delete obc ;
238 return 0 ;
239 }
240
241 // Create empty object version of split rule set
242 ObjSplitRule osr ;
243
244 // Convert names of parameters and splitting categories to objects in workspace, fill object split rule
245 SplitRule& sr = pdfiter->second ;
246
247 map<string, pair<list<string>,string> >::iterator pariter ;
248 for (pariter=sr._paramSplitMap.begin() ; pariter!=sr._paramSplitMap.end() ; ++pariter) {
249
250 // Check that variable with given name exists in workspace
251 RooAbsArg* farg = _ws->fundArg(pariter->first) ;
252 if (!farg) {
253 coutE(ObjectHandling) << "RooSimWSTool::build(" << GetName() << ") ERROR: associated workspace " << _ws->GetName()
254 << " does not contain a variable named " << pariter->first.c_str()
255 << " as specified in splitting rule of parameter " << pariter->first << " of p.d.f " << pdf << endl ;
256 delete obc ;
257 return 0 ;
258 }
259
260 // Check that given variable is indeed related to given p.d.f
261 if (!pdf->dependsOn(*farg)) {
262 coutE(ObjectHandling) << "RooSimWSTool::build(" << GetName() << ") ERROR: specified parameter " << pariter->first
263 << " in split is not function of p.d.f " << pdf->GetName() << endl ;
264 delete obc ;
265 return 0 ;
266 }
267
268
269 RooArgSet splitCatSet ;
270 list<string>::iterator catiter ;
271 for (catiter = pariter->second.first.begin() ; catiter!=pariter->second.first.end() ; ++catiter) {
272 RooAbsCategory* cat = _ws->catfunc(catiter->c_str()) ;
273 if (!cat) {
274 coutE(ObjectHandling) << "RooSimWSTool::build(" << GetName() << ") ERROR: associated workspace " << _ws->GetName()
275 << " does not contain a category named " << catiter->c_str()
276 << " as specified in splitting rule of parameter " << pariter->first << " of p.d.f " << pdf << endl ;
277 delete obc ;
278 return 0 ;
279 }
280 splitCatSet.add(*cat) ;
281 }
282
283 // Check if composite splitCatSet does not contain category functions that depend on other categories used in the same split
284 for(RooAbsArg * arg : splitCatSet) {
285 RooArgSet tmp(splitCatSet) ;
286 tmp.remove(*arg) ;
287 if (arg->dependsOnValue(tmp)) {
288 coutE(InputArguments) << "RooSimWSTool::build(" << GetName() << ") ERROR: Ill defined split: splitting category function " << arg->GetName()
289 << " used in composite split " << splitCatSet << " of parameter " << farg->GetName() << " of pdf " << pdf->GetName()
290 << " depends on one or more of the other splitting categories in the composite split" << endl ;
291 delete obc ;
292 return 0 ;
293 }
294 }
295
296 // If a constrained split is specified, check that split parameter is a real-valued type
297 if (pariter->second.second.size()>0) {
298 if (!dynamic_cast<RooAbsReal*>(farg)) {
299 coutE(InputArguments) << "RooSimWSTool::build(" << GetName() << ") ERROR: Constrained split specified in non real-valued parameter " << farg->GetName() << endl ;
300 delete obc ;
301 return 0 ;
302 }
303 }
304
305 // Fill object build config with object split rule
306 osr._paramSplitMap[farg].first.add(splitCatSet) ;
307 osr._paramSplitMap[farg].second = pariter->second.second ;
308
309 // For multi-pdf configurations, check that the master index state name associated with this p.d.f exists as a state in the master category
310 if (obc->_masterCat) {
311 list<string>::iterator misi ;
312 for (misi=sr._miStateNameList.begin() ; misi!=sr._miStateNameList.end() ; ++misi) {
313 const RooCatType* ctype = obc->_masterCat->lookupType(misi->c_str(),false) ;
314 if (ctype==0) {
315 coutE(ObjectHandling) << "RooSimWSTool::build(" << GetName() << ") ERROR: master index category " << obc->_masterCat->GetName()
316 << " does not have a state named " << *misi << " which was specified as state associated with p.d.f "
317 << sr.GetName() << endl ;
318 delete obc ;
319 return 0 ;
320 }
321 osr._miStateList.push_back(ctype) ;
322 }
323 }
324
325 // Add specified split cats to global list of all splitting categories
326 obc->_usedSplitCats.add(splitCatSet,true) ;
327
328 }
329 // Need to add clause here for SplitRules without any split (which can happen in MultiBuildConfigs)
330 if (sr._paramSplitMap.empty()) {
331
332 if (obc->_masterCat) {
333 list<string>::iterator misi ;
334 for (misi=sr._miStateNameList.begin() ; misi!=sr._miStateNameList.end() ; ++misi) {
335 const RooCatType* ctype = obc->_masterCat->lookupType(misi->c_str(),false) ;
336 if (ctype==0) {
337 coutE(ObjectHandling) << "RooSimWSTool::build(" << GetName() << ") ERROR: master index category " << obc->_masterCat->GetName()
338 << " does not have a state named " << *misi << " which was specified as state associated with p.d.f "
339 << sr.GetName() << endl ;
340 delete obc ;
341 return 0 ;
342 }
343 osr._miStateList.push_back(ctype) ;
344 }
345 }
346 }
347
348 obc->_pdfmap[pdf] = osr ;
349
350 }
351
352 // Check validity of build restriction specifications, if any
353 map<string,string>::iterator riter ;
354 for (riter=bc._restr.begin() ; riter!=bc._restr.end() ; ++riter) {
355 RooCategory* cat = _ws->cat(riter->first) ;
356 if (!cat) {
357 coutE(ObjectHandling) << "RooSimWSTool::build(" << GetName() << ") ERROR: associated workspace " << _ws->GetName()
358 << " does not contain a category named " << riter->first
359 << " for which build was requested to be restricted to states " << riter->second << endl ;
360 delete obc ;
361 return 0 ;
362 }
363
364 char buf[4096] ;
365 list<const RooCatType*> rlist ;
366 strlcpy(buf,riter->second.c_str(),4096) ;
367
368 char* tok = strtok(buf,"{,}") ;
369 while(tok) {
370 const RooCatType* ctype = cat->lookupType(tok,false) ;
371 if (!ctype) {
372 coutE(ObjectHandling) << "RooSimWSTool::build(" << GetName() << ") ERROR: restricted build category " << cat->GetName()
373 << " does not have state " << tok << " as specified in restriction list" << endl ;
374 delete obc ;
375 return 0 ;
376 }
377 rlist.push_back(ctype) ;
378 tok = strtok(0,"{,}") ;
379 }
380
381 obc->_restr[cat] = rlist ;
382 }
383
384 return obc ;
385}
386
387
388
389
390////////////////////////////////////////////////////////////////////////////////
391/// Internal build driver from validation ObjBuildConfig.
392
394{
395 RooArgSet cleanupList ;
396
397 RooAbsCategoryLValue* physCat = obc._masterCat ;
398
399 RooArgSet physModelSet ;
400 map<string,RooAbsPdf*> stateMap ;
401
402 map<RooAbsPdf*,ObjSplitRule>::iterator physIter = obc._pdfmap.begin() ;
403 while(physIter!=obc._pdfmap.end()) {
404
405
406 RooAbsPdf* physModel = physIter->first ;
407 physModelSet.add(*physModel,true) ; // silence duplicate insertion warnings
408
409 list<const RooCatType*>::iterator stiter ;
410 for (stiter=physIter->second._miStateList.begin() ; stiter!=physIter->second._miStateList.end() ; ++stiter) {
411 stateMap[(*stiter)->GetName()] = physModel ;
412 }
413
414 // Continue with next mapping
415 ++physIter ;
416 }
417 if (verbose) coutI(ObjectHandling) << "RooSimWSTool::executeBuild: list of prototype pdfs " << physModelSet << endl ;
418
419 RooArgSet splitCatSet(obc._usedSplitCats) ;
420 if (physCat) splitCatSet.add(*physCat) ;
421
422 RooArgSet splitCatSetFund ;
423 for(auto * scat : static_range_cast<RooAbsCategory*>(splitCatSet)) {
424 if (scat->isFundamental()) {
425 splitCatSetFund.add(*scat) ;
426 } else {
427 RooArgSet* scatvars = scat->getVariables() ;
428 splitCatSetFund.add(*scatvars) ;
429 delete scatvars ;
430 }
431 }
432
433
434 RooAbsCategoryLValue* masterSplitCat ;
435 if (splitCatSetFund.getSize()>1) {
436 masterSplitCat = new RooSuperCategory("masterSplitCat","Master splitting category",splitCatSetFund) ;
437 } else {
438 masterSplitCat = (RooAbsCategoryLValue*) splitCatSetFund.first() ;
439 }
440 if (verbose) coutI(ObjectHandling) << "RooSimWSTool::executeBuild: list of splitting categories " << splitCatSet << endl ;
441
442 RooArgSet splitNodeListOwned ; // owns all newly created components
443 RooArgSet splitNodeListAll ; // all leaf nodes, preload with ws contents to auto-connect existing specializations
444 TList* customizerList = new TList ;
445
446 // Loop over requested physics models and build components
447 for(auto * physModel : static_range_cast<RooAbsPdf*>(physModelSet)) {
448 if (verbose) coutI(ObjectHandling) << "RooSimPdfBuilder::executeBuild: processing prototype pdf " << physModel->GetName() << endl ;
449
450 RooCustomizer* physCustomizer = new RooCustomizer(*physModel,*masterSplitCat,splitNodeListOwned,&splitNodeListAll) ;
451 customizerList->Add(physCustomizer) ;
452
453 map<RooAbsArg*, pair<RooArgSet,string> >::iterator splitIter ;
454 for (splitIter = obc._pdfmap[physModel]._paramSplitMap.begin() ; splitIter != obc._pdfmap[physModel]._paramSplitMap.end() ; ++splitIter) {
455
456 // If split is composite, first make multicategory with name 'A,B,C' and insert in WS
457
458 // Construct name of (composite) split category (function)
459 RooArgSet& splitCatSetTmp = splitIter->second.first ;
460 string splitName = makeSplitName(splitCatSetTmp) ;
461
462 // If composite split object does not exist yet, create it now
463 RooAbsCategory* splitCat = _ws->catfunc(splitName.c_str()) ;
464 if (!splitCat) {
465 splitCat = new RooMultiCategory(splitName.c_str(),splitName.c_str(),splitCatSetTmp) ;
466 cleanupList.addOwned(*splitCat) ;
467 _ws->import(*splitCat,RooFit::Silence(!verbose)) ;
468 }
469
470 // If remainder category needs to be made, create RFV of appropriate for that and insert in WS
471 if(splitIter->second.second.size()>0) {
472
473 // Check that specified split name is in fact valid
474 if (!splitCat->hasLabel(splitIter->second.second)) {
475 coutE(InputArguments) << "RooSimWSTool::executeBuild(" << GetName() << ") ERROR: name of remainder state for constrained split, '"
476 << splitIter->second.second << "' , does not match any state name of (composite) split category " << splitCat->GetName() << endl ;
477 return 0 ;
478 }
479
480 // First build manually the specializations of all non-remainder states, as the remainder state depends on these
481 RooArgSet fracLeafList ;
482 TIterator* sctiter = splitCat->typeIterator() ;
484 while((type=(RooCatType*)sctiter->Next())) {
485
486 // Skip remainder state
487 if (splitIter->second.second == type->GetName()) continue ;
488
489 // Construct name of split leaf
490 TString splitLeafName(splitIter->first->GetName()) ;
491 splitLeafName.Append("_") ;
492 splitLeafName.Append(type->GetName()) ;
493
494 // Check if split leaf already exists
495 RooAbsArg* splitLeaf = _ws->fundArg(splitLeafName) ;
496 if (!splitLeaf) {
497 // If not create it now
498 splitLeaf = (RooAbsArg*) splitIter->first->clone(splitLeafName) ;
499 _ws->import(*splitLeaf,RooFit::Silence(!verbose)) ;
500 }
501 fracLeafList.add(*splitLeaf) ;
502 }
503 delete sctiter ;
504
505
506 // Build specialization for remainder state and insert in workspace
507 RooFracRemainder* fracRem = new RooFracRemainder(Form("%s_%s",splitIter->first->GetName(),splitIter->second.second.c_str()),"Remainder fraction",fracLeafList) ;
508 cleanupList.addOwned(*fracRem) ;
509 _ws->import(*fracRem) ;
510
511 }
512
513
514 // Add split definition to customizer
515 physCustomizer->splitArgs(*splitIter->first,*splitCat) ;
516 }
517 }
518
519 // List all existing workspace components as prebuilt items for the customizers at this point
520 splitNodeListAll.add(_ws->components()) ;
521
522 if (verbose) coutI(ObjectHandling) << "RooSimWSTool::executeBuild: configured customizers for all prototype pdfs" << endl ;
523
524 // Create fit category from physCat and splitCatList ;
525 RooArgSet fitCatList ;
526 if (physCat) fitCatList.add(*physCat) ;
527
528 // Add observables of splitCatSet members, rather than splitCatSet members directly
529 // as there may be cat->cat functions in here
530 for(auto * scat : static_range_cast<RooAbsCategory*>(splitCatSet)) {
531 if (scat->isFundamental()) {
532 fitCatList.add(*scat) ;
533 } else {
534 fitCatList.add(*std::unique_ptr<RooArgSet>{scat->getVariables()}) ;
535 }
536 }
537
538
539 string mcatname = string(simPdfName) + "_index" ;
540 RooAbsCategoryLValue* fitCat = 0 ;
541 if (fitCatList.getSize()>1) {
542 fitCat = new RooSuperCategory(mcatname.c_str(),mcatname.c_str(),fitCatList) ;
543 cleanupList.addOwned(*fitCat) ;
544 } else {
545 fitCat = (RooAbsCategoryLValue*) fitCatList.first() ;
546 }
547
548 // Create master PDF
549 RooSimultaneous* simPdf = new RooSimultaneous(simPdfName,simPdfName,*fitCat) ;
550 cleanupList.addOwned(*simPdf) ;
551
552 // Add component PDFs to master PDF
553 TIterator* fcIter = fitCat->typeIterator() ;
554
555 RooCatType* fcState ;
556 while((fcState=(RooCatType*)fcIter->Next())) {
557 // Select fitCat state
558 fitCat->setLabel(fcState->GetName()) ;
559
560 // Check if this fitCat state is selected
561 bool select(false) ;
562 if (obc._restr.size()>0) {
563 for(auto * splitCat : static_range_cast<RooAbsCategory*>(fitCatList)) {
564 // Find selected state list
565
566 list<const RooCatType*> slist = obc._restr[splitCat] ;
567 if (slist.empty()) {
568 continue ;
569 }
570
571 list<const RooCatType*>::iterator sli ;
572 for (sli=slist.begin() ; sli!=slist.end() ; ++sli) {
573 if (string(splitCat->getCurrentLabel())==(*sli)->GetName()) {
574 select=true ;
575 }
576 }
577 }
578 if (!select) continue ;
579 } else {
580 select = true ;
581 }
582
583 // Select appropriate PDF for this physCat state
584 RooCustomizer* physCustomizer ;
585 if (physCat) {
586 RooAbsPdf* pdf = stateMap[physCat->getCurrentLabel()] ;
587 if (pdf==0) {
588 continue ;
589 }
590 physCustomizer = (RooCustomizer*) customizerList->FindObject(pdf->GetName());
591 } else {
592 physCustomizer = (RooCustomizer*) customizerList->First() ;
593 }
594
595 if (verbose) coutI(ObjectHandling) << "RooSimWSTool::executeBuild: Customizing prototype pdf " << physCustomizer->GetName()
596 << " for mode " << fcState->GetName() << endl ;
597
598 // Customizer PDF for current state and add to master simPdf
599 RooAbsPdf* fcPdf = (RooAbsPdf*) physCustomizer->build(masterSplitCat->getCurrentLabel(),false) ;
600 simPdf->addPdf(*fcPdf,fcState->GetName()) ;
601 }
602 delete fcIter ;
603
605
606 // Delete customizers
607 customizerList->Delete() ;
608 delete customizerList ;
609 return (RooSimultaneous*) _ws->pdf(simPdf->GetName()) ;
610}
611
612
613
614////////////////////////////////////////////////////////////////////////////////
615/// Construct name of composite split
616
617std::string RooSimWSTool::makeSplitName(const RooArgSet& splitCatSet)
618{
619 std::string name ;
620
621 bool first=true ;
622 for(RooAbsArg * arg : splitCatSet) {
623 if (first) {
624 first=false;
625 } else {
626 name += "," ;
627 }
628 name += arg->GetName() ;
629 }
630
631 return name ;
632}
633
634
635
636
637////////////////////////////////////////////////////////////////////////////////
638/// Specify that parameters names listed in paramNameList be split in (product of) category(s)
639/// listed in categoryNameList
640
641void RooSimWSTool::SplitRule::splitParameter(const char* paramNameList, const char* categoryNameList)
642{
643 char paramBuf[4096] ;
644 char catBuf[4096] ;
645 strlcpy(paramBuf,paramNameList,4096) ;
646 strlcpy(catBuf,categoryNameList,4096) ;
647
648 // First parse category list
649 list<string> catList ;
650 char* cat = strtok(catBuf,"{,}") ;
651 while(cat) {
652 catList.push_back(cat) ;
653 cat = strtok(0,"{,}") ;
654 }
655
656 // Now parse parameter list
657 char* param = strtok(paramBuf,"{,}") ;
658 while(param) {
659 _paramSplitMap[param] = pair<list<string>,string>(catList,"") ;
660 param = strtok(0,"{,}") ;
661 }
662}
663
664
665////////////////////////////////////////////////////////////////////////////////
666/// Specify that parameters names listed in paramNameList be split in constrained way in (product of) category(s)
667/// listed in categoryNameList and that remainder fraction formula be put in state with name remainderStateName
668
669void RooSimWSTool::SplitRule::splitParameterConstrained(const char* paramNameList, const char* categoryNameList, const char* remainderStateName)
670{
671 char paramBuf[4096] ;
672 char catBuf[4096] ;
673 strlcpy(paramBuf,paramNameList,4096) ;
674 strlcpy(catBuf,categoryNameList,4096) ;
675
676 // First parse category list
677 list<string> catList ;
678 char* cat = strtok(catBuf,"{,}") ;
679 while(cat) {
680 catList.push_back(cat) ;
681 cat = strtok(0,"{,}") ;
682 }
683
684 // Now parse parameter list
685 char* param = strtok(paramBuf,"{,}") ;
686 while(param) {
687 _paramSplitMap[param] = pair<list<string>,string>(catList,remainderStateName) ;
688 param = strtok(0,"{,}") ;
689 }
690}
691
692
693////////////////////////////////////////////////////////////////////////////////
694/// Construct the SplitRule object from a list of named arguments past to RooSimWSTool::build
695/// This method parses any SplitParam and SplitParamComstrained argument in the list
696
697void RooSimWSTool::SplitRule::configure(const RooCmdArg& arg1,const RooCmdArg& arg2,const RooCmdArg& arg3,
698 const RooCmdArg& arg4, const RooCmdArg& arg5,const RooCmdArg& arg6)
699{
700 list<const RooCmdArg*> cmdList ;
701 cmdList.push_back(&arg1) ; cmdList.push_back(&arg2) ;
702 cmdList.push_back(&arg3) ; cmdList.push_back(&arg4) ;
703 cmdList.push_back(&arg5) ; cmdList.push_back(&arg6) ;
704
705 list<const RooCmdArg*>::iterator iter ;
706 for (iter=cmdList.begin() ; iter!=cmdList.end() ; ++iter) {
707
708 if ((*iter)->opcode()==0) continue ;
709
710 string name = (*iter)->opcode() ;
711
712 if (name=="SplitParam") {
713 splitParameter((*iter)->getString(0),(*iter)->getString(1)) ;
714 } else if (name=="SplitParamConstrained") {
715 splitParameterConstrained((*iter)->getString(0),(*iter)->getString(1),(*iter)->getString(2)) ;
716 }
717 }
718}
719
720
721
722
723////////////////////////////////////////////////////////////////////////////////
724/// Add prototype p.d.f pdfName to build configuration with associated split rules 'sr'
725
727{
728 internalAddPdf(pdfName,"",sr) ;
729}
730
731
732////////////////////////////////////////////////////////////////////////////////
733/// Construct build configuration from single prototype 'pdfName' and list of arguments
734/// that can be passed to RooSimWSTool::build() method. This routine parses SplitParam()
735/// SplitParamConstrained() and Restrict() arguments.
736
737RooSimWSTool::BuildConfig::BuildConfig(const char* pdfName, const RooCmdArg& arg1,const RooCmdArg& arg2,
738 const RooCmdArg& arg3,const RooCmdArg& arg4, const RooCmdArg& arg5,const RooCmdArg& arg6)
739{
740 SplitRule sr(pdfName) ;
741 sr.configure(arg1,arg2,arg3,arg4,arg5,arg6) ;
742 internalAddPdf(pdfName,"",sr) ;
743 _conflProtocol = RooFit::RenameConflictNodes(pdfName) ;
744
745 list<const RooCmdArg*> cmdList ;
746 cmdList.push_back(&arg1) ; cmdList.push_back(&arg2) ;
747 cmdList.push_back(&arg3) ; cmdList.push_back(&arg4) ;
748 cmdList.push_back(&arg5) ; cmdList.push_back(&arg6) ;
749
750 list<const RooCmdArg*>::iterator iter ;
751 for (iter=cmdList.begin() ; iter!=cmdList.end() ; ++iter) {
752 if ((*iter)->opcode()==0) continue ;
753 string name = (*iter)->opcode() ;
754 if (name=="Restrict") {
755 restrictBuild((*iter)->getString(0),(*iter)->getString(1)) ;
756 }
757 if (name=="RenameConflictNodes") {
758 _conflProtocol = *(*iter) ;
759 }
760 }
761}
762
763
764////////////////////////////////////////////////////////////////////////////////
765/// Constructor to make BuildConfig from legacy RooSimPdfBuilder configuration
766/// Empty for now
767
769{
770}
771
772
773////////////////////////////////////////////////////////////////////////////////
774/// Internal routine to add prototype pdf 'pdfName' with list of associated master states 'miStateNameList
775/// and split rules 'sr' to configuration
776
777void RooSimWSTool::BuildConfig::internalAddPdf(const char* pdfName, const char* miStateNameList,SplitRule& sr)
778{
779 char buf[4096] ;
780 strlcpy(buf,miStateNameList,4096) ;
781
782 char* tok = strtok(buf,",") ;
783 while(tok) {
784 sr._miStateNameList.push_back(tok) ;
785 tok = strtok(0,",") ;
786 }
787
788 _pdfmap[pdfName] = sr ;
789}
790
791
792////////////////////////////////////////////////////////////////////////////////
793/// Restrict build by only considering state names in stateList for split in category catName
794
795void RooSimWSTool::BuildConfig::restrictBuild(const char* catName, const char* stateList)
796{
797 _restr[catName] = stateList ;
798}
799
800
801
802
803////////////////////////////////////////////////////////////////////////////////
804/// Construct MultiBuildConfig for build configuration with multiple prototype p.d.f.s
805/// masterIndexCat is the name of the master index category that decides which
806/// prototype is used.
807
809{
810 _masterCatName = masterIndexCat ;
811}
812
813
814
815////////////////////////////////////////////////////////////////////////////////
816/// Add protytpe p.d.f 'pdfName' to MultiBuildConfig associated with master indes states 'miStateList'. This
817/// method parses the SplitParam() and SplitParamConstrained() arguments
818
819void RooSimWSTool::MultiBuildConfig::addPdf(const char* miStateList, const char* pdfName, const RooCmdArg& arg1,const RooCmdArg& arg2,
820 const RooCmdArg& arg3,const RooCmdArg& arg4, const RooCmdArg& arg5,const RooCmdArg& arg6)
821{
822 SplitRule sr(pdfName) ;
823 sr.configure(arg1,arg2,arg3,arg4,arg5,arg6) ;
824 internalAddPdf(pdfName,miStateList,sr) ;
825}
826
827
828
829////////////////////////////////////////////////////////////////////////////////
830/// Add protytpe p.d.f 'pdfName' to MultiBuildConfig associated with master indes states 'miStateList'.
831
832void RooSimWSTool::MultiBuildConfig::addPdf(const char* miStateList, const char* pdfName, SplitRule& sr)
833{
834 internalAddPdf(pdfName,miStateList,sr) ;
835}
836
837
838
839
840////////////////////////////////////////////////////////////////////////////////
841/// Destructor
842
844{
845}
846
847
848
849
850////////////////////////////////////////////////////////////////////////////////
851/// Print details of a validated build configuration
852
854{
855 // --- Dump contents of object build config ---
856 map<RooAbsPdf*,ObjSplitRule>::iterator ri ;
857 for (ri = _pdfmap.begin() ; ri != _pdfmap.end() ; ++ri ) {
858 cout << "Splitrule for p.d.f " << ri->first->GetName() << " with state list " ;
859 for (std::list<const RooCatType*>::iterator misi= ri->second._miStateList.begin() ; misi!=ri->second._miStateList.end() ; ++misi) {
860 cout << (*misi)->GetName() << " " ;
861 }
862 cout << endl ;
863
864 map<RooAbsArg*,pair<RooArgSet,string> >::iterator csi ;
865 for (csi = ri->second._paramSplitMap.begin() ; csi != ri->second._paramSplitMap.end() ; ++csi ) {
866 if (csi->second.second.length()>0) {
867 cout << " parameter " << csi->first->GetName() << " is split with constraint in categories " << csi->second.first
868 << " with remainder in state " << csi->second.second << endl ;
869 } else {
870 cout << " parameter " << csi->first->GetName() << " is split with constraint in categories " << csi->second.first << endl ;
871 }
872 }
873 }
874
875 map<RooAbsCategory*,list<const RooCatType*> >::iterator riter ;
876 for (riter=_restr.begin() ; riter!=_restr.end() ; ++riter) {
877 cout << "Restricting build in category " << riter->first->GetName() << " to states " ;
878 list<const RooCatType*>::iterator i ;
879 for (i=riter->second.begin() ; i!=riter->second.end() ; ++i) {
880 if (i!=riter->second.begin()) cout << "," ;
881 cout << (*i)->GetName() ;
882 }
883 cout << endl ;
884 }
885
886}
887
888
889
890
891////////////////////////////////////////////////////////////////////////////////
892
893std::string RooSimWSTool::SimWSIFace::create(RooFactoryWSTool& ft, const char* typeName, const char* instanceName, std::vector<std::string> args)
894{
895 string tn(typeName) ;
896 if (tn=="SIMCLONE") {
897
898 // Perform syntax check. Warn about any meta parameters other than $SplitParam, $SplitParamConstrained, $Restrict and $Verbose
899 for (unsigned int i=1 ; i<args.size() ; i++) {
900 if (args[i].find("$SplitParam(")!=0 &&
901 args[i].find("$SplitParamConstrained(")!=0 &&
902 args[i].find("$SplitRestrict(")!=0 &&
903 args[i].find("$Verbose(")!=0) {
904 throw string(Form("RooSimWSTool::SimWSIFace::create() ERROR: unknown token %s encountered",args[i].c_str())) ;
905 }
906 }
907
908 // Make SplitRule object from $SplitParam and $SplitParamConstrained arguments
909 RooSimWSTool::SplitRule sr(args[0].c_str()) ;
910 for (unsigned int i=1 ; i<args.size() ; i++) {
911 if (args[i].find("$SplitParam(")==0) {
912 vector<string> subargs = ft.splitFunctionArgs(args[i].c_str()) ;
913 if (subargs.size()!=2) {
914 throw string(Form("Incorrect number of arguments in $SplitParam, have %d, expect 2",(Int_t)subargs.size())) ;
915 }
916 sr.splitParameter(subargs[0].c_str(),subargs[1].c_str()) ;
917 } else if (args[i].find("$SplitParamConstrained(")==0) {
918 vector<string> subargs = ft.splitFunctionArgs(args[i].c_str()) ;
919 if (subargs.size()!=3) {
920 throw string(Form("Incorrect number of arguments in $SplitParamConstrained, have %d, expect 3",(Int_t)subargs.size())) ;
921 }
922 sr.splitParameterConstrained(subargs[0].c_str(), subargs[1].c_str(), subargs[2].c_str()) ;
923 }
924 }
925
926 // Make BuildConfig object
927 RooSimWSTool::BuildConfig bc(args[0].c_str(),sr) ;
928 for (unsigned int i=1 ; i<args.size() ; i++) {
929 if (args[i].find("$Restrict(")==0) {
930 vector<string> subargs = ft.splitFunctionArgs(args[i].c_str()) ;
931 if (subargs.size()!=2) {
932 throw string(Form("Incorrect number of arguments in $Restrict, have %d, expect 2",(Int_t)subargs.size())) ;
933 }
934 bc.restrictBuild(subargs[0].c_str(),subargs[1].c_str()) ;
935 }
936 }
937
938 // Look for verbose flag
939 bool verbose(false) ;
940 for (unsigned int i=1 ; i<args.size() ; i++) {
941 if (args[i].find("$Verbose(")==0) {
942 vector<string> subargs = ft.splitFunctionArgs(args[i].c_str()) ;
943 if (subargs.size()>0) {
944 verbose = atoi(subargs[0].c_str()) ;
945 }
946 }
947 }
948
949 // Build pdf clone
950 RooSimWSTool sct(ft.ws()) ;
951 RooAbsPdf* pdf = sct.build(instanceName,bc,verbose) ;
952 if (!pdf) {
953 throw string(Form("RooSimWSTool::SimWSIFace::create() error in RooSimWSTool::build() for %s",instanceName)) ;
954 }
955
956 // Import into workspace
957 ft.ws().import(*pdf,RooFit::Silence()) ;
958
959 } else if (tn=="MSIMCLONE") {
960
961 // First make a multibuild config from the master index cat
962 RooSimWSTool::MultiBuildConfig mbc(args[0].c_str()) ;
963
964 for (unsigned int i=1 ; i<args.size() ; i++) {
965 if (args[i].find("$AddPdf(")==0) {
966 // Process an add-pdf operation
967 vector<string> subargs = ft.splitFunctionArgs(args[i].c_str()) ;
968
969 // Make SplitRule object from $SplitParam and $SplitParamConstrained arguments
970 RooSimWSTool::SplitRule sr(subargs[1].c_str()) ;
971 for (unsigned int j=2 ; j<subargs.size() ; j++) {
972 if (subargs[j].find("$SplitParam(")==0) {
973 vector<string> subsubargs = ft.splitFunctionArgs(subargs[j].c_str()) ;
974 if (subsubargs.size()!=2) {
975 throw string(Form("Incorrect number of arguments in $SplitParam, have %d, expect 2",(Int_t)subsubargs.size())) ;
976 }
977 sr.splitParameter(subsubargs[0].c_str(),subsubargs[1].c_str()) ;
978 } else if (subargs[j].find("$SplitParamConstrained(")==0) {
979 vector<string> subsubargs = ft.splitFunctionArgs(subargs[j].c_str()) ;
980 if (subsubargs.size()!=3) {
981 throw string(Form("Incorrect number of arguments in $SplitParamConstrained, have %d, expect 3",(Int_t)subsubargs.size())) ;
982 }
983 sr.splitParameterConstrained(subsubargs[0].c_str(), subsubargs[1].c_str(), subsubargs[2].c_str()) ;
984 }
985 }
986 mbc.addPdf(subargs[0].c_str(),subargs[1].c_str(),sr) ;
987
988 } else if (args[i].find("$Restrict(")==0) {
989
990 // Process a restrict operation
991 vector<string> subargs = ft.splitFunctionArgs(args[i].c_str()) ;
992 if (subargs.size()!=2) {
993 throw string(Form("Incorrect number of arguments in $Restrict, have %d, expect 2",(Int_t)subargs.size())) ;
994 }
995 mbc.restrictBuild(subargs[0].c_str(),subargs[1].c_str()) ;
996
997 } else {
998 throw string(Form("RooSimWSTool::SimWSIFace::create() ERROR: unknown token in MSIMCLONE: %s",args[i].c_str())) ;
999 }
1000 }
1001
1002 // Build pdf clone
1003 RooSimWSTool sct(ft.ws()) ;
1004 RooAbsPdf* pdf = sct.build(instanceName,mbc,false) ;
1005 if (!pdf) {
1006 throw string(Form("RooSimWSTool::SimWSIFace::create() error in RooSimWSTool::build() for %s",instanceName)) ;
1007 }
1008
1009 // Import into workspace
1010 ft.ws().import(*pdf,RooFit::Silence()) ;
1011
1012
1013 } else {
1014 throw string(Form("RooSimWSTool::SimWSIFace::create() ERROR: Unknown meta-type %s requested",typeName)) ;
1015 }
1016
1017 return string(instanceName) ;
1018}
#define coutI(a)
Definition: RooMsgService.h:34
#define coutE(a)
Definition: RooMsgService.h:37
#define ClassImp(name)
Definition: Rtypes.h:375
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition: TGX11.cxx:110
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition: TString.cxx:2447
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
bool dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0, bool valueOnly=false) const
Test whether we depend on (ie, are served by) any object in the specified collection.
Definition: RooAbsArg.cxx:829
virtual TObject * clone(const char *newname=0) const =0
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual bool setLabel(const char *label, bool printError=true)=0
Change category state by specifying a state name.
A space to attach TBranches.
bool hasLabel(const std::string &label) const
Check if a state with name label exists.
virtual const char * getCurrentLabel() const
Return label string of current state.
TIterator * typeIterator() const
const RooCatType * lookupType(value_type index, bool printError=false) const
Find our type corresponding to the specified index, or return nullptr for no match.
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
Int_t getSize() const
Return the number of elements in the collection.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
RooAbsArg * first() const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:64
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state.
const Text_t * GetName() const override
Returns name of object.
RooCategory is an object to represent discrete states.
Definition: RooCategory.h:28
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:26
RooCustomizer is a factory class to produce clones of a prototype composite PDF object with the same ...
Definition: RooCustomizer.h:35
RooAbsArg * build(const char *masterCatState, bool verbose=false)
Build a clone of the prototype executing all registered 'replace' rules and 'split' rules for the mas...
void splitArgs(const RooArgSet &argSet, const RooAbsCategory &splitCat)
Split all arguments in 'set' into individualized clones for each defined state of 'splitCat'.
RooFactoryWSTool is a class similar to TTree::MakeClass() that generates skeleton code for RooAbsPdf ...
RooWorkspace & ws()
static void registerSpecial(const char *typeName, RooFactoryWSTool::IFace *iface)
Register foreign special objects in factory.
std::vector< std::string > splitFunctionArgs(const char *funcExpr)
Allocate and fill work buffer.
RooFracRemainder calculates the remainder fraction of a sum of RooAbsReal fraction,...
RooMultiCategory connects several RooAbsCategory objects into a single category.
void restrictBuild(const char *catName, const char *stateList)
Restrict build by only considering state names in stateList for split in category catName.
std::map< std::string, SplitRule > _pdfmap
Definition: RooSimWSTool.h:119
std::map< std::string, std::string > _restr
Definition: RooSimWSTool.h:120
void internalAddPdf(const char *pdfName, const char *miStateList, SplitRule &sr)
Internal routine to add prototype pdf 'pdfName' with list of associated master states 'miStateNameLis...
void addPdf(const char *miStateList, const char *pdfName, SplitRule &sr)
Add protytpe p.d.f 'pdfName' to MultiBuildConfig associated with master indes states 'miStateList'.
MultiBuildConfig(const char *masterIndexCat)
Construct MultiBuildConfig for build configuration with multiple prototype p.d.f.s masterIndexCat is ...
std::map< RooAbsPdf *, ObjSplitRule > _pdfmap
Definition: RooSimWSTool.h:170
void print()
Print details of a validated build configuration.
std::map< RooAbsCategory *, std::list< const RooCatType * > > _restr
Definition: RooSimWSTool.h:171
virtual ~ObjSplitRule()
Destructor.
std::map< RooAbsArg *, std::pair< RooArgSet, std::string > > _paramSplitMap
Definition: RooSimWSTool.h:156
std::list< const RooCatType * > _miStateList
Definition: RooSimWSTool.h:155
std::string create(RooFactoryWSTool &ft, const char *typeName, const char *instanceName, std::vector< std::string > args) override
void splitParameter(const char *paramList, const char *categoryList)
Specify that parameters names listed in paramNameList be split in (product of) category(s) listed in ...
void configure(const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none())
Construct the SplitRule object from a list of named arguments past to RooSimWSTool::build This method...
void splitParameterConstrained(const char *paramNameList, const char *categoryNameList, const char *remainderStateName)
Specify that parameters names listed in paramNameList be split in constrained way in (product of) cat...
std::map< std::string, std::pair< std::list< std::string >, std::string > > _paramSplitMap
Definition: RooSimWSTool.h:97
The RooSimWSTool is a tool operating on RooWorkspace objects that can clone PDFs into a series of var...
Definition: RooSimWSTool.h:37
RooWorkspace * _ws
Definition: RooSimWSTool.h:74
RooSimWSTool(RooWorkspace &ws)
Constructor of SimWSTool on given workspace.
RooSimultaneous * build(const char *simPdfName, const char *protoPdfName, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none())
Build a RooSimultaneous PDF with name simPdfName from cloning specializations of protytpe PDF protoPd...
RooSimultaneous * executeBuild(const char *simPdfName, ObjBuildConfig &obc, bool verbose=true)
Internal build driver from validation ObjBuildConfig.
ObjBuildConfig * validateConfig(BuildConfig &bc)
Validate build configuration.
std::string makeSplitName(const RooArgSet &splitCatSet)
Construct name of composite split.
~RooSimWSTool() override
Destructor.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
bool addPdf(const RooAbsPdf &pdf, const char *catLabel)
Associate given PDF with index category state label 'catLabel'.
The RooSuperCategory can join several RooAbsCategoryLValue objects into a single category.
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
RooAbsCategory * catfunc(RooStringView name) const
Retrieve discrete function (RooAbsCategory) with given name. A null pointer is returned if not found.
RooAbsPdf * pdf(RooStringView name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
RooCategory * cat(RooStringView name) const
Retrieve discrete variable (RooCategory) with given name. A null pointer is returned if not found.
bool import(const RooAbsArg &arg, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Import a RooAbsArg object, e.g.
RooAbsArg * fundArg(RooStringView name) const
Return fundamental (i.e.
const RooArgSet & components() const
Definition: RooWorkspace.h:119
Iterator abstract base class.
Definition: TIterator.h:30
virtual TObject * Next()=0
A doubly linked list.
Definition: TList.h:38
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
Definition: TList.cxx:578
void Add(TObject *obj) override
Definition: TList.h:81
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:659
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:470
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
Basic string class.
Definition: TString.h:136
TString & Append(const char *cs)
Definition: TString.h:564
RooCmdArg Silence(bool flag=true)
RooCmdArg RenameConflictNodes(const char *suffix, bool renameOrigNodes=false)
void(off) SmallVectorTemplateBase< T
void init()
Inspect hardware capabilities, and load the optimal library for RooFit computations.
@ InputArguments
Definition: RooGlobalFunc.h:64
@ ObjectHandling
Definition: RooGlobalFunc.h:64
static constexpr double sr
Definition: first.py:1
void ws()
Definition: ws.C:66