Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "TNamed.h"
21#include "RooLinkedList.h"
22#include <string>
23
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
99 void Print(const char* = "") const;
100
101protected:
102
103 static const RooCmdArg _none ; // Static instance of null object
104 friend class RooCmdConfig ;
105
106private:
107
108 friend class RooAbsCollection ;
109
110 // Payload
111 Double_t _d[2] ; // Payload doubles
112 Int_t _i[2] ; // Payload integers
113 std::string _s[3] ; // Payload strings
114 TObject* _o[2] ; // Payload objects
115 Bool_t _procSubArgs ; // If true argument requires recursive processing
116 RooArgSet* _c ; // Payload RooArgSets
117 RooLinkedList _argList ; // Payload sub-arguments
118 Bool_t _prefixSubArgs ; // Prefix subarguments with container name?
119
120 ClassDef(RooCmdArg,2) // Generic named argument container
121};
122
123#endif
124
125
#define s1(x)
Definition RSha256.hxx:91
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
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:49
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:29
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.
RooArgSet * _c
Definition RooCmdArg.h:116
RooLinkedList _argList
Definition RooCmdArg.h:117
void addArg(const RooCmdArg &arg)
Utility function to add nested RooCmdArg to payload of this RooCmdArg.
Int_t _i[2]
Definition RooCmdArg.h:112
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.
static const RooCmdArg & none()
Return reference to null argument.
Definition RooCmdArg.cxx:52
Bool_t _procSubArgs
Definition RooCmdArg.h:115
Bool_t _prefixSubArgs
Definition RooCmdArg.h:118
virtual ~RooCmdArg()
Destructor.
Int_t getInt(Int_t idx) const
Definition RooCmdArg.h:80
void setSet(Int_t idx, const RooArgSet &set)
RooLinkedList & subArgs()
Definition RooCmdArg.h:46
std::string _s[3]
Definition RooCmdArg.h:113
Double_t _d[2]
Definition RooCmdArg.h:111
RooCmdArg()
Default constructor.
Definition RooCmdArg.cxx:61
TObject * _o[2]
Definition RooCmdArg.h:114
void Print(const char *="") const
Print contents.
const char * opcode() const
Definition RooCmdArg.h:61
static const RooCmdArg _none
Definition RooCmdArg.h:103
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.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
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