Logo ROOT   6.16/01
Reference Guide
RooCmdArg.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooCmdArg.h,v 1.10 2007/05/11 09:11:30 verkerke Exp $
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#ifndef ROO_CMD_ARG
18#define ROO_CMD_ARG
19
20#include <string>
21#include "TNamed.h"
22#include "TString.h"
23#include "RooLinkedList.h"
24class RooAbsData ;
25class RooArgSet ;
26
27class RooCmdArg : public TNamed {
28public:
29
30 RooCmdArg();
31 RooCmdArg(const char* name,
32 Int_t i1=0, Int_t i2=0,
33 Double_t d1=0, Double_t d2=0,
34 const char* s1=0, const char* s2=0,
35 const TObject* o1=0, const TObject* o2=0, const RooCmdArg* ca=0, const char* s3=0,
36 const RooArgSet* c1=0, const RooArgSet* c2=0) ;
37 RooCmdArg(const RooCmdArg& other) ;
38 RooCmdArg& operator=(const RooCmdArg& other) ;
39 void addArg(const RooCmdArg& arg) ;
40 void setProcessRecArgs(Bool_t flag, Bool_t prefix=kTRUE) {
41 // If true flag this object as containing recursive arguments
42 _procSubArgs = flag ;
43 _prefixSubArgs = prefix ;
44 }
45
47 // Return list of sub-arguments in this RooCmdArg
48 return _argList ;
49 }
50
51 virtual TObject* Clone(const char* newName=0) const {
52 RooCmdArg* newarg = new RooCmdArg(*this) ;
53 if (newName) { newarg->SetName(newName) ; }
54 return newarg ;
55 }
56
57 virtual ~RooCmdArg();
58
59 static const RooCmdArg& none() ;
60
61 const char* opcode() const {
62 // Return operator code
63 return strlen(GetName()) ? GetName() : 0 ;
64 }
65
66 void setInt(Int_t idx,Int_t value) {
67 _i[idx] = value ;
68 }
69 void setDouble(Int_t idx,Double_t value) {
70 _d[idx] = value ;
71 }
72 void setString(Int_t idx,const char* value) {
73 _s[idx] = value ;
74 }
75 void setObject(Int_t idx,TObject* value) {
76 _o[idx] = value ;
77 }
78 void setSet(Int_t idx,const RooArgSet& set) ;
79
80 Int_t getInt(Int_t idx) const {
81 // Return integer stored in slot idx
82 return _i[idx] ;
83 }
84 Double_t getDouble(Int_t idx) const {
85 // Return double stored in slot idx
86 return _d[idx] ;
87 }
88 const char* getString(Int_t idx) const {
89 // Return string stored in slot idx
90 return (_s[idx].size()>0) ? _s[idx].c_str() : 0 ;
91 }
92 const TObject* getObject(Int_t idx) const {
93 // Return TObject stored in slot idx
94 return _o[idx] ;
95 }
96
97 const RooArgSet* getSet(Int_t idx) const ;
98
99protected:
100
101 static const RooCmdArg _none ; // Static instance of null object
102 friend class RooCmdConfig ;
103
104private:
105
106 friend class RooAbsCollection ;
107
108 // Payload
109 Double_t _d[2] ; // Payload doubles
110 Int_t _i[2] ; // Payload integers
111 std::string _s[3] ; // Payload strings
112 TObject* _o[2] ; // Payload objects
113 Bool_t _procSubArgs ; // If true argument requires recursive processing
114 RooArgSet* _c ; // Payload RooArgSets
115 RooLinkedList _argList ; // Payload sub-arguments
116 Bool_t _prefixSubArgs ; // Prefix subarguments with container name?
117
118 ClassDef(RooCmdArg,2) // Generic named argument container
119};
120
121#endif
122
123
#define s1(x)
Definition: RSha256.hxx:91
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:324
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:27
Double_t getDouble(Int_t idx) const
Definition: RooCmdArg.h:84
const RooArgSet * getSet(Int_t idx) const
Return RooArgSet stored in slot idx.
Definition: RooCmdArg.cxx:198
RooArgSet * _c
Definition: RooCmdArg.h:114
RooLinkedList _argList
Definition: RooCmdArg.h:115
void addArg(const RooCmdArg &arg)
Utility function to add nested RooCmdArg to payload of this RooCmdArg.
Definition: RooCmdArg.cxx:188
Int_t _i[2]
Definition: RooCmdArg.h:110
void setObject(Int_t idx, TObject *value)
Definition: RooCmdArg.h:75
void setInt(Int_t idx, Int_t value)
Definition: RooCmdArg.h:66
void setDouble(Int_t idx, Double_t value)
Definition: RooCmdArg.h:69
RooCmdArg & operator=(const RooCmdArg &other)
Assignment operator.
Definition: RooCmdArg.cxx:140
static const RooCmdArg & none()
Return reference to null argument.
Definition: RooCmdArg.cxx:50
Bool_t _procSubArgs
Definition: RooCmdArg.h:113
Bool_t _prefixSubArgs
Definition: RooCmdArg.h:116
virtual ~RooCmdArg()
Destructor.
Definition: RooCmdArg.cxx:177
Int_t getInt(Int_t idx) const
Definition: RooCmdArg.h:80
void setSet(Int_t idx, const RooArgSet &set)
Definition: RooCmdArg.cxx:206
RooLinkedList & subArgs()
Definition: RooCmdArg.h:46
std::string _s[3]
Definition: RooCmdArg.h:111
Double_t _d[2]
Definition: RooCmdArg.h:109
RooCmdArg()
Default constructor.
Definition: RooCmdArg.cxx:59
TObject * _o[2]
Definition: RooCmdArg.h:112
const char * opcode() const
Definition: RooCmdArg.h:61
static const RooCmdArg _none
Definition: RooCmdArg.h:101
void setProcessRecArgs(Bool_t flag, Bool_t prefix=kTRUE)
Definition: RooCmdArg.h:40
const char * getString(Int_t idx) const
Definition: RooCmdArg.h:88
void setString(Int_t idx, const char *value)
Definition: RooCmdArg.h:72
const TObject * getObject(Int_t idx) const
Definition: RooCmdArg.h:92
virtual TObject * Clone(const char *newName=0) const
Make a clone of an object using the Streamer facility.
Definition: RooCmdArg.h:51
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
Definition: RooCmdConfig.h:27
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
return c1
Definition: legend1.C:41
return c2
Definition: legend2.C:14