00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "RooFit.h"
00031
00032 #include "RooCmdConfig.h"
00033 #include "RooInt.h"
00034 #include "RooDouble.h"
00035 #include "RooArgSet.h"
00036 #include "RooStringVar.h"
00037 #include "RooTObjWrap.h"
00038 #include "RooAbsData.h"
00039 #include "TObjString.h"
00040 #include "RooMsgService.h"
00041
00042 #include "Riostream.h"
00043
00044
00045 ClassImp(RooCmdConfig)
00046 ;
00047
00048
00049
00050
00051 RooCmdConfig::RooCmdConfig(const char* methodName) :
00052 TObject(),
00053 _name(methodName)
00054 {
00055
00056
00057
00058
00059 _verbose = kFALSE ;
00060 _error = kFALSE ;
00061 _allowUndefined = kFALSE ;
00062
00063 _iIter = _iList.MakeIterator() ;
00064 _dIter = _dList.MakeIterator() ;
00065 _sIter = _sList.MakeIterator() ;
00066 _oIter = _oList.MakeIterator() ;
00067 _cIter = _cList.MakeIterator() ;
00068
00069 _rIter = _rList.MakeIterator() ;
00070 _fIter = _fList.MakeIterator() ;
00071 _mIter = _mList.MakeIterator() ;
00072 _yIter = _yList.MakeIterator() ;
00073 _pIter = _pList.MakeIterator() ;
00074 }
00075
00076
00077
00078
00079 RooCmdConfig::RooCmdConfig(const RooCmdConfig& other) : TObject(other)
00080 {
00081
00082
00083 _name = other._name ;
00084 _verbose = other._verbose ;
00085 _error = other._error ;
00086 _allowUndefined = other._allowUndefined ;
00087
00088 _iIter = _iList.MakeIterator() ;
00089 _dIter = _dList.MakeIterator() ;
00090 _sIter = _sList.MakeIterator() ;
00091 _oIter = _oList.MakeIterator() ;
00092 _cIter = _cList.MakeIterator() ;
00093 _rIter = _rList.MakeIterator() ;
00094 _fIter = _fList.MakeIterator() ;
00095 _mIter = _mList.MakeIterator() ;
00096 _yIter = _yList.MakeIterator() ;
00097 _pIter = _pList.MakeIterator() ;
00098
00099 other._iIter->Reset() ;
00100 RooInt* ri ;
00101 while((ri=(RooInt*)other._iIter->Next())) {
00102 _iList.Add(ri->Clone()) ;
00103 }
00104
00105 other._dIter->Reset() ;
00106 RooDouble* rd ;
00107 while((rd=(RooDouble*)other._dIter->Next())) {
00108 _dList.Add(rd->Clone()) ;
00109 }
00110
00111 other._sIter->Reset() ;
00112 RooStringVar* rs ;
00113 while((rs=(RooStringVar*)other._sIter->Next())) {
00114 _sList.Add(rs->Clone()) ;
00115 }
00116
00117 other._oIter->Reset() ;
00118 RooTObjWrap* os ;
00119 while((os=(RooTObjWrap*)other._oIter->Next())) {
00120 _oList.Add(os->Clone()) ;
00121 }
00122
00123 other._cIter->Reset() ;
00124 RooTObjWrap* cs ;
00125 while((cs=(RooTObjWrap*)other._cIter->Next())) {
00126 _cList.Add(cs->Clone()) ;
00127 }
00128
00129 other._rIter->Reset() ;
00130 TObjString* rr ;
00131 while((rr=(TObjString*)other._rIter->Next())) {
00132 _rList.Add(rr->Clone()) ;
00133 }
00134
00135 other._fIter->Reset() ;
00136 TObjString* ff ;
00137 while((ff=(TObjString*)other._fIter->Next())) {
00138 _fList.Add(ff->Clone()) ;
00139 }
00140
00141 other._mIter->Reset() ;
00142 TObjString* mm ;
00143 while((mm=(TObjString*)other._mIter->Next())) {
00144 _mList.Add(mm->Clone()) ;
00145 }
00146
00147 other._yIter->Reset() ;
00148 TObjString* yy ;
00149 while((yy=(TObjString*)other._yIter->Next())) {
00150 _yList.Add(yy->Clone()) ;
00151 }
00152
00153 other._pIter->Reset() ;
00154 TObjString* pp ;
00155 while((pp=(TObjString*)other._pIter->Next())) {
00156 _pList.Add(pp->Clone()) ;
00157 }
00158
00159 }
00160
00161
00162
00163
00164 RooCmdConfig::~RooCmdConfig()
00165 {
00166
00167
00168 delete _iIter ;
00169 delete _dIter ;
00170 delete _sIter ;
00171 delete _oIter ;
00172 delete _cIter ;
00173 delete _rIter ;
00174 delete _fIter ;
00175 delete _mIter ;
00176 delete _yIter ;
00177 delete _pIter ;
00178
00179 _iList.Delete() ;
00180 _dList.Delete() ;
00181 _sList.Delete() ;
00182 _cList.Delete() ;
00183 _oList.Delete() ;
00184 _rList.Delete() ;
00185 _fList.Delete() ;
00186 _mList.Delete() ;
00187 _yList.Delete() ;
00188 _pList.Delete() ;
00189 }
00190
00191
00192
00193
00194 void RooCmdConfig::defineRequiredArgs(const char* argName1, const char* argName2,
00195 const char* argName3, const char* argName4,
00196 const char* argName5, const char* argName6,
00197 const char* argName7, const char* argName8)
00198 {
00199
00200
00201 if (argName1) _rList.Add(new TObjString(argName1)) ;
00202 if (argName2) _rList.Add(new TObjString(argName2)) ;
00203 if (argName3) _rList.Add(new TObjString(argName3)) ;
00204 if (argName4) _rList.Add(new TObjString(argName4)) ;
00205 if (argName5) _rList.Add(new TObjString(argName5)) ;
00206 if (argName6) _rList.Add(new TObjString(argName6)) ;
00207 if (argName7) _rList.Add(new TObjString(argName7)) ;
00208 if (argName8) _rList.Add(new TObjString(argName8)) ;
00209 }
00210
00211
00212
00213
00214 const char* RooCmdConfig::missingArgs() const
00215 {
00216
00217
00218
00219 static TString ret ;
00220 ret="" ;
00221
00222 _rIter->Reset() ;
00223 TObjString* s ;
00224 Bool_t first(kTRUE) ;
00225 while((s=(TObjString*)_rIter->Next())) {
00226 if (first) {
00227 first=kFALSE ;
00228 } else {
00229 ret.Append(", ") ;
00230 }
00231 ret.Append(s->String()) ;
00232 }
00233
00234 return ret.Length() ? ret.Data() : 0 ;
00235 }
00236
00237
00238
00239
00240 void RooCmdConfig::defineDependency(const char* refArgName, const char* neededArgName)
00241 {
00242
00243
00244
00245 TNamed* dep = new TNamed(refArgName,neededArgName) ;
00246 _yList.Add(dep) ;
00247 }
00248
00249
00250
00251
00252 void RooCmdConfig::defineMutex(const char* argName1, const char* argName2)
00253 {
00254
00255
00256 TNamed* mutex1 = new TNamed(argName1,argName2) ;
00257 TNamed* mutex2 = new TNamed(argName2,argName1) ;
00258 _mList.Add(mutex1) ;
00259 _mList.Add(mutex2) ;
00260 }
00261
00262
00263
00264
00265 void RooCmdConfig::defineMutex(const char* argName1, const char* argName2, const char* argName3)
00266 {
00267
00268
00269 defineMutex(argName1,argName2) ;
00270 defineMutex(argName1,argName3) ;
00271 defineMutex(argName2,argName3) ;
00272 }
00273
00274
00275
00276 void RooCmdConfig::defineMutex(const char* argName1, const char* argName2, const char* argName3, const char* argName4)
00277 {
00278
00279
00280 defineMutex(argName1,argName2) ;
00281 defineMutex(argName1,argName3) ;
00282 defineMutex(argName1,argName4) ;
00283 defineMutex(argName2,argName3) ;
00284 defineMutex(argName2,argName4) ;
00285 defineMutex(argName3,argName4) ;
00286 }
00287
00288
00289
00290
00291 void RooCmdConfig::defineMutex(const char* argName1, const char* argName2, const char* argName3, const char* argName4, const char* argName5)
00292 {
00293
00294
00295 defineMutex(argName1,argName2) ;
00296 defineMutex(argName1,argName3) ;
00297 defineMutex(argName1,argName4) ;
00298 defineMutex(argName1,argName4) ;
00299 defineMutex(argName2,argName3) ;
00300 defineMutex(argName2,argName4) ;
00301 defineMutex(argName2,argName4) ;
00302 defineMutex(argName3,argName4) ;
00303 defineMutex(argName3,argName5) ;
00304 defineMutex(argName4,argName5) ;
00305 }
00306
00307
00308
00309
00310 Bool_t RooCmdConfig::defineInt(const char* name, const char* argName, Int_t intNum, Int_t defVal)
00311 {
00312
00313
00314
00315 if (_iList.FindObject(name)) {
00316 coutE(InputArguments) << "RooCmdConfig::defintInt: name '" << name << "' already defined" << endl ;
00317 return kTRUE ;
00318 }
00319
00320 RooInt* ri = new RooInt(defVal) ;
00321 ri->SetName(name) ;
00322 ri->SetTitle(argName) ;
00323 ri->SetUniqueID(intNum) ;
00324
00325 _iList.Add(ri) ;
00326 return kFALSE ;
00327 }
00328
00329
00330
00331
00332 Bool_t RooCmdConfig::defineDouble(const char* name, const char* argName, Int_t doubleNum, Double_t defVal)
00333 {
00334
00335
00336
00337 if (_dList.FindObject(name)) {
00338 coutE(InputArguments) << "RooCmdConfig::defineDouble: name '" << name << "' already defined" << endl ;
00339 return kTRUE ;
00340 }
00341
00342 RooDouble* rd = new RooDouble(defVal) ;
00343 rd->SetName(name) ;
00344 rd->SetTitle(argName) ;
00345 rd->SetUniqueID(doubleNum) ;
00346
00347 _dList.Add(rd) ;
00348 return kFALSE ;
00349 }
00350
00351
00352
00353
00354 Bool_t RooCmdConfig::defineString(const char* name, const char* argName, Int_t stringNum, const char* defVal, Bool_t appendMode)
00355 {
00356
00357
00358
00359
00360
00361 if (_sList.FindObject(name)) {
00362 coutE(InputArguments) << "RooCmdConfig::defineString: name '" << name << "' already defined" << endl ;
00363 return kTRUE ;
00364 }
00365
00366 RooStringVar* rs = new RooStringVar(name,argName,defVal,10240) ;
00367 if (appendMode) {
00368 rs->setAttribute("RooCmdConfig::AppendMode") ;
00369 }
00370 rs->SetUniqueID(stringNum) ;
00371
00372 _sList.Add(rs) ;
00373 return kFALSE ;
00374 }
00375
00376
00377
00378
00379 Bool_t RooCmdConfig::defineObject(const char* name, const char* argName, Int_t setNum, const TObject* defVal, Bool_t isArray)
00380 {
00381
00382
00383
00384
00385
00386
00387 if (_oList.FindObject(name)) {
00388 coutE(InputArguments) << "RooCmdConfig::defineObject: name '" << name << "' already defined" << endl ;
00389 return kTRUE ;
00390 }
00391
00392 RooTObjWrap* os = new RooTObjWrap((TObject*)defVal,isArray) ;
00393 os->SetName(name) ;
00394 os->SetTitle(argName) ;
00395 os->SetUniqueID(setNum) ;
00396
00397 _oList.Add(os) ;
00398 return kFALSE ;
00399 }
00400
00401
00402
00403
00404 Bool_t RooCmdConfig::defineSet(const char* name, const char* argName, Int_t setNum, const RooArgSet* defVal)
00405 {
00406
00407
00408
00409
00410
00411
00412 if (_cList.FindObject(name)) {
00413 coutE(InputArguments) << "RooCmdConfig::defineObject: name '" << name << "' already defined" << endl ;
00414 return kTRUE ;
00415 }
00416
00417 RooTObjWrap* cs = new RooTObjWrap((TObject*)defVal) ;
00418 cs->SetName(name) ;
00419 cs->SetTitle(argName) ;
00420 cs->SetUniqueID(setNum) ;
00421
00422 _cList.Add(cs) ;
00423 return kFALSE ;
00424 }
00425
00426
00427
00428
00429 void RooCmdConfig::print()
00430 {
00431
00432
00433
00434 _iIter->Reset() ;
00435 RooInt* ri ;
00436 while((ri=(RooInt*)_iIter->Next())) {
00437 cout << ri->GetName() << "[Int_t] = " << *ri << endl ;
00438 }
00439
00440
00441 _dIter->Reset() ;
00442 RooDouble* rd ;
00443 while((rd=(RooDouble*)_dIter->Next())) {
00444 cout << rd->GetName() << "[Double_t] = " << *rd << endl ;
00445 }
00446
00447
00448 _sIter->Reset() ;
00449 RooStringVar* rs ;
00450 while((rs=(RooStringVar*)_sIter->Next())) {
00451 cout << rs->GetName() << "[string] = \"" << rs->getVal() << "\"" << endl ;
00452 }
00453
00454
00455 _oIter->Reset() ;
00456 RooTObjWrap* ro ;
00457 while((ro=(RooTObjWrap*)_oIter->Next())) {
00458 cout << ro->GetName() << "[TObject] = " ;
00459 if (ro->obj()) {
00460 cout << ro->obj()->GetName() << endl ;
00461 } else {
00462
00463 cout << "(null)" << endl ;
00464 }
00465 }
00466 }
00467
00468
00469
00470
00471 Bool_t RooCmdConfig::process(const RooLinkedList& argList)
00472 {
00473
00474
00475 Bool_t ret(kFALSE) ;
00476 TIterator* iter = argList.MakeIterator() ;
00477 RooCmdArg* arg ;
00478 while((arg=(RooCmdArg*)iter->Next())) {
00479 ret |= process(*arg) ;
00480 }
00481 delete iter ;
00482 return ret ;
00483 }
00484
00485
00486
00487
00488 Bool_t RooCmdConfig::process(const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4,
00489 const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8)
00490 {
00491
00492
00493 Bool_t ret(kFALSE) ;
00494 ret |= process(arg1) ;
00495 ret |= process(arg2) ;
00496 ret |= process(arg3) ;
00497 ret |= process(arg4) ;
00498 ret |= process(arg5) ;
00499 ret |= process(arg6) ;
00500 ret |= process(arg7) ;
00501 ret |= process(arg8) ;
00502 return ret ;
00503 }
00504
00505
00506
00507
00508 Bool_t RooCmdConfig::process(const RooCmdArg& arg)
00509 {
00510
00511
00512
00513 const char* opc = arg.opcode() ;
00514
00515
00516 if (!opc) return kFALSE ;
00517
00518
00519 if (_fList.FindObject(opc)) {
00520 coutE(InputArguments) << _name << " ERROR: argument " << opc << " not allowed in this context" << endl ;
00521 _error = kTRUE ;
00522 return kTRUE ;
00523 }
00524
00525
00526 TObject* dep = _yList.FindObject(opc) ;
00527 if (dep) {
00528
00529 if (!_pList.FindObject(dep->GetTitle())) {
00530 _rList.Add(new TObjString(dep->GetTitle())) ;
00531 if (_verbose) {
00532 cout << "RooCmdConfig::process: " << opc << " has unprocessed dependent " << dep->GetTitle()
00533 << ", adding to required list" << endl ;
00534 }
00535 } else {
00536 if (_verbose) {
00537 cout << "RooCmdConfig::process: " << opc << " dependent " << dep->GetTitle() << " is already processed" << endl ;
00538 }
00539 }
00540 }
00541
00542
00543 TObject * mutex = _mList.FindObject(opc) ;
00544 if (mutex) {
00545 if (_verbose) {
00546 cout << "RooCmdConfig::process: " << opc << " excludes " << mutex->GetTitle()
00547 << ", adding to forbidden list" << endl ;
00548 }
00549 _fList.Add(new TObjString(mutex->GetTitle())) ;
00550 }
00551
00552
00553 Bool_t anyField(kFALSE) ;
00554
00555
00556 _iIter->Reset() ;
00557 RooInt* ri ;
00558 while((ri=(RooInt*)_iIter->Next())) {
00559 if (!TString(opc).CompareTo(ri->GetTitle())) {
00560 *ri = arg.getInt(ri->GetUniqueID()) ;
00561 anyField = kTRUE ;
00562 if (_verbose) {
00563 cout << "RooCmdConfig::process " << ri->GetName() << "[Int_t]" << " set to " << *ri << endl ;
00564 }
00565 }
00566 }
00567
00568
00569 _dIter->Reset() ;
00570 RooDouble* rd ;
00571 while((rd=(RooDouble*)_dIter->Next())) {
00572 if (!TString(opc).CompareTo(rd->GetTitle())) {
00573 *rd = arg.getDouble(rd->GetUniqueID()) ;
00574 anyField = kTRUE ;
00575 if (_verbose) {
00576 cout << "RooCmdConfig::process " << rd->GetName() << "[Double_t]" << " set to " << *rd << endl ;
00577 }
00578 }
00579 }
00580
00581
00582 _sIter->Reset() ;
00583 RooStringVar* rs ;
00584 while((rs=(RooStringVar*)_sIter->Next())) {
00585 if (!TString(opc).CompareTo(rs->GetTitle())) {
00586
00587 const char* oldStr = rs->getVal() ;
00588
00589 if (oldStr && strlen(oldStr)>0 && rs->getAttribute("RooCmdConfig::AppendMode")) {
00590 rs->setVal(Form("%s,%s",rs->getVal(),arg.getString(rs->GetUniqueID()))) ;
00591 } else {
00592 rs->setVal(arg.getString(rs->GetUniqueID())) ;
00593 }
00594 anyField = kTRUE ;
00595 if (_verbose) {
00596 cout << "RooCmdConfig::process " << rs->GetName() << "[string]" << " set to " << rs->getVal() << endl ;
00597 }
00598 }
00599 }
00600
00601
00602 _oIter->Reset() ;
00603 RooTObjWrap* os ;
00604 while((os=(RooTObjWrap*)_oIter->Next())) {
00605 if (!TString(opc).CompareTo(os->GetTitle())) {
00606 os->setObj((TObject*)arg.getObject(os->GetUniqueID())) ;
00607 anyField = kTRUE ;
00608 if (_verbose) {
00609 cout << "RooCmdConfig::process " << os->GetName() << "[TObject]" << " set to " ;
00610 if (os->obj()) {
00611 cout << os->obj()->GetName() << endl ;
00612 } else {
00613 cout << "(null)" << endl ;
00614 }
00615 }
00616 }
00617 }
00618
00619
00620 _cIter->Reset() ;
00621 RooTObjWrap* cs ;
00622 while((cs=(RooTObjWrap*)_cIter->Next())) {
00623 if (!TString(opc).CompareTo(cs->GetTitle())) {
00624 cs->setObj((TObject*)arg.getSet(cs->GetUniqueID())) ;
00625 anyField = kTRUE ;
00626 if (_verbose) {
00627 cout << "RooCmdConfig::process " << cs->GetName() << "[RooArgSet]" << " set to " ;
00628 if (cs->obj()) {
00629 cout << cs->obj()->GetName() << endl ;
00630 } else {
00631 cout << "(null)" << endl ;
00632 }
00633 }
00634 }
00635 }
00636
00637 if (!anyField && !_allowUndefined) {
00638 coutE(InputArguments) << _name << " ERROR: unrecognized command: " << opc << endl ;
00639 }
00640
00641
00642
00643 TObject* obj = _rList.FindObject(opc) ;
00644 if (obj) {
00645 _rList.Remove(obj) ;
00646 }
00647
00648
00649 TNamed *pcmd = new TNamed(opc,opc) ;
00650 _pList.Add(pcmd) ;
00651
00652 Bool_t depRet = kFALSE ;
00653 if (arg._procSubArgs) {
00654 for (Int_t ia=0 ; ia<arg._argList.GetSize() ; ia++) {
00655 RooCmdArg* subArg = static_cast<RooCmdArg*>(arg._argList.At(ia)) ;
00656 if (strlen(subArg->GetName())>0) {
00657 RooCmdArg subArgCopy(*subArg) ;
00658 if (arg._prefixSubArgs) {
00659 subArgCopy.SetName(Form("%s::%s",arg.GetName(),subArg->GetName())) ;
00660 }
00661 depRet |= process(subArgCopy) ;
00662 }
00663 }
00664 }
00665
00666 return ((anyField||_allowUndefined)?kFALSE:kTRUE)||depRet ;
00667 }
00668
00669
00670
00671
00672 Bool_t RooCmdConfig::hasProcessed(const char* cmdName) const
00673 {
00674
00675
00676 return _pList.FindObject(cmdName) ? kTRUE : kFALSE ;
00677 }
00678
00679
00680
00681
00682 Int_t RooCmdConfig::getInt(const char* name, Int_t defVal)
00683 {
00684
00685
00686
00687 RooInt* ri = (RooInt*) _iList.FindObject(name) ;
00688 return ri ? (Int_t)(*ri) : defVal ;
00689 }
00690
00691
00692
00693
00694 Double_t RooCmdConfig::getDouble(const char* name, Double_t defVal)
00695 {
00696
00697
00698
00699 RooDouble* rd = (RooDouble*) _dList.FindObject(name) ;
00700 return rd ? (Double_t)(*rd) : defVal ;
00701 }
00702
00703
00704
00705
00706 const char* RooCmdConfig::getString(const char* name, const char* defVal, Bool_t convEmptyToNull)
00707 {
00708
00709
00710
00711
00712 RooStringVar* rs = (RooStringVar*) _sList.FindObject(name) ;
00713 return rs ? ((convEmptyToNull && strlen(rs->getVal())==0) ? 0 : ((const char*)rs->getVal()) ) : defVal ;
00714 }
00715
00716
00717
00718
00719 TObject* RooCmdConfig::getObject(const char* name, TObject* defVal)
00720 {
00721
00722
00723
00724 RooTObjWrap* ro = (RooTObjWrap*) _oList.FindObject(name) ;
00725 return ro ? ro->obj() : defVal ;
00726 }
00727
00728
00729
00730 RooArgSet* RooCmdConfig::getSet(const char* name, RooArgSet* defVal)
00731 {
00732
00733
00734
00735 RooTObjWrap* ro = (RooTObjWrap*) _cList.FindObject(name) ;
00736 return ro ? ((RooArgSet*)ro->obj()) : defVal ;
00737 }
00738
00739
00740
00741
00742 const RooLinkedList& RooCmdConfig::getObjectList(const char* name)
00743 {
00744
00745
00746 static RooLinkedList defaultDummy ;
00747 RooTObjWrap* ro = (RooTObjWrap*) _oList.FindObject(name) ;
00748 return ro ? ro->objList() : defaultDummy ;
00749 }
00750
00751
00752
00753
00754 Bool_t RooCmdConfig::ok(Bool_t verbose) const
00755 {
00756
00757
00758 if (_rList.GetSize()==0 && !_error) return kTRUE ;
00759
00760 if (verbose) {
00761 const char* margs = missingArgs() ;
00762 if (margs) {
00763 coutE(InputArguments) << _name << " ERROR: missing arguments: " << margs << endl ;
00764 } else {
00765 coutE(InputArguments) << _name << " ERROR: illegal combination of arguments and/or missing arguments" << endl ;
00766 }
00767 }
00768 return kFALSE ;
00769 }
00770
00771
00772
00773
00774 void RooCmdConfig::stripCmdList(RooLinkedList& cmdList, const char* cmdsToPurge)
00775 {
00776
00777
00778
00779 if (!cmdsToPurge) return ;
00780
00781
00782 char buf[1024] ;
00783 strlcpy(buf,cmdsToPurge,1024) ;
00784
00785 char* name = strtok(buf,",") ;
00786 while(name) {
00787 TObject* cmd = cmdList.FindObject(name) ;
00788 if (cmd) cmdList.Remove(cmd) ;
00789 name = strtok(0,",") ;
00790 }
00791
00792 }
00793
00794
00795
00796
00797 RooLinkedList RooCmdConfig::filterCmdList(RooLinkedList& cmdInList, const char* cmdNameList, Bool_t removeFromInList)
00798 {
00799
00800
00801
00802 RooLinkedList filterList ;
00803 if (!cmdNameList) return filterList ;
00804
00805
00806 char buf[1024] ;
00807 strlcpy(buf,cmdNameList,1024) ;
00808
00809 char* name = strtok(buf,",") ;
00810 while(name) {
00811 TObject* cmd = cmdInList.FindObject(name) ;
00812 if (cmd) {
00813 if (removeFromInList) {
00814 cmdInList.Remove(cmd) ;
00815 }
00816 filterList.Add(cmd) ;
00817 }
00818 name = strtok(0,",") ;
00819 }
00820 return filterList ;
00821 }
00822
00823
00824
00825
00826 Int_t RooCmdConfig::decodeIntOnTheFly(const char* callerID, const char* cmdArgName, Int_t intIdx, Int_t defVal, const RooCmdArg& arg1,
00827 const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4,
00828 const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7,
00829 const RooCmdArg& arg8, const RooCmdArg& arg9)
00830 {
00831
00832
00833
00834 RooCmdConfig pc(callerID) ;
00835 pc.allowUndefined() ;
00836 pc.defineInt("theInt",cmdArgName,intIdx,defVal) ;
00837 pc.process(arg1) ; pc.process(arg2) ; pc.process(arg3) ;
00838 pc.process(arg4) ; pc.process(arg5) ; pc.process(arg6) ;
00839 pc.process(arg7) ; pc.process(arg8) ; pc.process(arg9) ;
00840 return pc.getInt("theInt") ;
00841 }
00842
00843
00844
00845
00846 const char* RooCmdConfig::decodeStringOnTheFly(const char* callerID, const char* cmdArgName, Int_t strIdx, const char* defVal, const RooCmdArg& arg1,
00847 const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4,
00848 const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7,
00849 const RooCmdArg& arg8, const RooCmdArg& arg9)
00850 {
00851
00852
00853
00854 static string retBuf = "" ;
00855
00856 RooCmdConfig pc(callerID) ;
00857 pc.allowUndefined() ;
00858 pc.defineString("theString",cmdArgName,strIdx,defVal) ;
00859 pc.process(arg1) ; pc.process(arg2) ; pc.process(arg3) ;
00860 pc.process(arg4) ; pc.process(arg5) ; pc.process(arg6) ;
00861 pc.process(arg7) ; pc.process(arg8) ; pc.process(arg9) ;
00862 const char* ret = pc.getString("theString",0,kTRUE) ;
00863
00864 if (ret) {
00865 retBuf = ret ;
00866 } else {
00867 retBuf.clear() ;
00868 }
00869 return retBuf.c_str() ;
00870 }
00871
00872
00873
00874
00875 TObject* RooCmdConfig::decodeObjOnTheFly(const char* callerID, const char* cmdArgName, Int_t objIdx, TObject* defVal, const RooCmdArg& arg1,
00876 const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4,
00877 const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7,
00878 const RooCmdArg& arg8, const RooCmdArg& arg9)
00879 {
00880
00881
00882
00883 RooCmdConfig pc(callerID) ;
00884 pc.allowUndefined() ;
00885 pc.defineObject("theObj",cmdArgName,objIdx,defVal) ;
00886 pc.process(arg1) ; pc.process(arg2) ; pc.process(arg3) ;
00887 pc.process(arg4) ; pc.process(arg5) ; pc.process(arg6) ;
00888 pc.process(arg7) ; pc.process(arg8) ; pc.process(arg9) ;
00889 return (TObject*) pc.getObject("theObj") ;
00890 }