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 "RooCmdArg.h"
00033 #include "RooCmdArg.h"
00034 #include "Riostream.h"
00035 #include "RooArgSet.h"
00036 #include <string>
00037
00038 ClassImp(RooCmdArg)
00039 ;
00040
00041 const RooCmdArg RooCmdArg::_none ;
00042
00043
00044
00045 const RooCmdArg& RooCmdArg::none()
00046 {
00047
00048 return _none ;
00049 }
00050
00051
00052
00053 RooCmdArg::RooCmdArg() : TNamed("","")
00054 {
00055
00056 _procSubArgs = kFALSE ;
00057 _prefixSubArgs = kTRUE ;
00058 _c = 0 ;
00059 _o[0] = 0 ;
00060 _o[1] = 0 ;
00061 _i[0] = 0 ;
00062 _i[1] = 0 ;
00063 _d[0] = 0 ;
00064 _d[1] = 0 ;
00065 }
00066
00067
00068
00069 RooCmdArg::RooCmdArg(const char* name, Int_t i1, Int_t i2, Double_t d1, Double_t d2,
00070 const char* s1, const char* s2, const TObject* o1, const TObject* o2,
00071 const RooCmdArg* ca, const char* s3, const RooArgSet* c1, const RooArgSet* c2) :
00072 TNamed(name,name)
00073 {
00074
00075
00076
00077 _i[0] = i1 ;
00078 _i[1] = i2 ;
00079 _d[0] = d1 ;
00080 _d[1] = d2 ;
00081 if (s1) _s[0] = s1 ;
00082 if (s2) _s[1] = s2 ;
00083 if (s3) _s[2] = s3 ;
00084 _o[0] = (TObject*) o1 ;
00085 _o[1] = (TObject*) o2 ;
00086 _c = 0 ;
00087
00088 if (c1||c2) _c = new RooArgSet[2] ;
00089 if (c1) _c[0].add(*c1) ;
00090 if (c2) _c[1].add(*c2) ;
00091
00092 _procSubArgs = kTRUE ;
00093 _prefixSubArgs = kTRUE ;
00094 if (ca) {
00095 _argList.Add(new RooCmdArg(*ca)) ;
00096 }
00097 }
00098
00099
00100
00101
00102 RooCmdArg::RooCmdArg(const RooCmdArg& other) :
00103 TNamed(other)
00104 {
00105
00106
00107 _i[0] = other._i[0] ;
00108 _i[1] = other._i[1] ;
00109 _d[0] = other._d[0] ;
00110 _d[1] = other._d[1] ;
00111 _s[0] = other._s[0] ;
00112 _s[1] = other._s[1] ;
00113 _s[2] = other._s[2] ;
00114 _o[0] = other._o[0] ;
00115 _o[1] = other._o[1] ;
00116 if (other._c) {
00117 _c = new RooArgSet[2] ;
00118 _c[0].add(other._c[0]) ;
00119 _c[1].add(other._c[1]) ;
00120 } else {
00121 _c = 0 ;
00122 }
00123
00124 _procSubArgs = other._procSubArgs ;
00125 _prefixSubArgs = other._prefixSubArgs ;
00126 for (Int_t i=0 ; i<other._argList.GetSize() ; i++) {
00127 _argList.Add(new RooCmdArg((RooCmdArg&)*other._argList.At(i))) ;
00128 }
00129 }
00130
00131
00132
00133 RooCmdArg& RooCmdArg::operator=(const RooCmdArg& other)
00134 {
00135
00136
00137 if (&other==this) return *this ;
00138
00139 SetName(other.GetName()) ;
00140 SetTitle(other.GetTitle()) ;
00141
00142 _i[0] = other._i[0] ;
00143 _i[1] = other._i[1] ;
00144 _d[0] = other._d[0] ;
00145 _d[1] = other._d[1] ;
00146 _s[0] = other._s[0] ;
00147 _s[1] = other._s[1] ;
00148 _s[2] = other._s[2] ;
00149 _o[0] = other._o[0] ;
00150 _o[1] = other._o[1] ;
00151 if (!_c) _c = new RooArgSet[2] ;
00152 if (other._c) {
00153 _c[0].removeAll() ; _c[0].add(other._c[0]) ;
00154 _c[1].removeAll() ; _c[1].add(other._c[1]) ;
00155 }
00156
00157 _procSubArgs = other._procSubArgs ;
00158 _prefixSubArgs = other._prefixSubArgs ;
00159
00160 for (Int_t i=0 ; i<other._argList.GetSize() ; i++) {
00161 _argList.Add(new RooCmdArg((RooCmdArg&)*other._argList.At(i))) ;
00162 }
00163
00164 return *this ;
00165 }
00166
00167
00168
00169
00170 RooCmdArg::~RooCmdArg()
00171 {
00172
00173 _argList.Delete() ;
00174 if (_c) delete[] _c ;
00175 }
00176
00177
00178
00179
00180 void RooCmdArg::addArg(const RooCmdArg& arg)
00181 {
00182
00183
00184 _argList.Add(new RooCmdArg(arg)) ;
00185 }
00186
00187
00188
00189
00190 const RooArgSet* RooCmdArg::getSet(Int_t idx) const {
00191
00192 return _c ? &_c[idx] : 0 ;
00193 }
00194
00195
00196
00197
00198 void RooCmdArg::setSet(Int_t idx,const RooArgSet& set)
00199 {
00200 if (!_c) {
00201 _c = new RooArgSet[2] ;
00202 }
00203 _c[idx].removeAll() ;
00204 _c[idx].add(set) ;
00205 }