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