| 1 | /* ======================================================================== *\
|
|---|
| 2 | !
|
|---|
| 3 | ! *
|
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 8 | ! *
|
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its
|
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee,
|
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and
|
|---|
| 12 | ! * that both that copyright notice and this permission notice appear
|
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express
|
|---|
| 14 | ! * or implied warranty.
|
|---|
| 15 | ! *
|
|---|
| 16 | !
|
|---|
| 17 | !
|
|---|
| 18 | ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2005
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // MParContainer
|
|---|
| 28 | //
|
|---|
| 29 | // The MParContainer class is the base class for all MARS parameter
|
|---|
| 30 | // containers. At the moment it is almost the same than ROOT's TNamed.
|
|---|
| 31 | // A TNamed contains the essential elements (name, title)
|
|---|
| 32 | // to identify a derived object in lists like our MParList or MTaskList.
|
|---|
| 33 | // The main difference is that the name and title isn't stored and read
|
|---|
| 34 | // to and from root files ("//!")
|
|---|
| 35 | //
|
|---|
| 36 | // MParContainer has several enhancements compared to TNamed:
|
|---|
| 37 | // - GetDescriptor(): returns name and class type
|
|---|
| 38 | // - GetUniqueName(): returns a unique name (used in StreamPrimitive)
|
|---|
| 39 | // - SetLogStream(MLog *lg): Set a logging stream to which loggingis stored
|
|---|
| 40 | // - Reset(): Reset content of class in an eventloop
|
|---|
| 41 | // - IsReadyToSave(): The contents are ready to be saved to a file
|
|---|
| 42 | // - IsSavedAsPrimitive(): A unique name for this instance is already
|
|---|
| 43 | // existing
|
|---|
| 44 | // - SetVariables(): Can be overloaded if the containers stores
|
|---|
| 45 | // coefficients (to be used in fits)
|
|---|
| 46 | // - SetDisplay(): Set a display for redirecting graphical output
|
|---|
| 47 | // - GetNames(): Get Name/Title from instance and store it in
|
|---|
| 48 | // a TObjArray (used to store the names of the
|
|---|
| 49 | // conteiners in a file
|
|---|
| 50 | // - SetNames(): vice versa
|
|---|
| 51 | // - ReadEnv(), WriteEnv(): Function which is used for automatical setup
|
|---|
| 52 | // IsEnvDefined() from a TEnv file
|
|---|
| 53 | //
|
|---|
| 54 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 55 | #include "MParContainer.h"
|
|---|
| 56 |
|
|---|
| 57 | #include <ctype.h> // isdigit
|
|---|
| 58 | #include <fstream> // ofstream
|
|---|
| 59 |
|
|---|
| 60 | #include <TEnv.h> // Env::Lookup
|
|---|
| 61 | #include <TClass.h> // IsA
|
|---|
| 62 | #include <TObjArray.h> // TObjArray
|
|---|
| 63 | #include <TBaseClass.h> // GetClassPointer
|
|---|
| 64 | #include <TMethodCall.h> // TMethodCall, AsciiWrite
|
|---|
| 65 | #include <TDataMember.h> // TDataMember, AsciiWrite
|
|---|
| 66 | #include <TVirtualPad.h> // gPad
|
|---|
| 67 |
|
|---|
| 68 | #include "MString.h"
|
|---|
| 69 |
|
|---|
| 70 | #include "MLog.h"
|
|---|
| 71 | #include "MLogManip.h"
|
|---|
| 72 |
|
|---|
| 73 | TList *gListOfPrimitives; // forard declaration in MParContainer.h
|
|---|
| 74 |
|
|---|
| 75 | #undef DEBUG
|
|---|
| 76 | //#define DEBUG
|
|---|
| 77 |
|
|---|
| 78 | ClassImp(MParContainer);
|
|---|
| 79 |
|
|---|
| 80 | using namespace std;
|
|---|
| 81 |
|
|---|
| 82 | TObjArray MParContainer::fgListMethodCall;
|
|---|
| 83 |
|
|---|
| 84 | MParContainer::MParContainer(const char *name, const char *title) :
|
|---|
| 85 | fName(name), fTitle(title), fLog(&gLog), fDisplay(NULL), fReadyToSave(kFALSE)
|
|---|
| 86 | {
|
|---|
| 87 | fgListMethodCall.SetOwner();
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | MParContainer::MParContainer(const TString &name, const TString &title) :
|
|---|
| 91 | fName(name), fTitle(title), fLog(&gLog), fDisplay(NULL), fReadyToSave(kFALSE)
|
|---|
| 92 | {
|
|---|
| 93 | fgListMethodCall.SetOwner();
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | // --------------------------------------------------------------------------
|
|---|
| 97 | //
|
|---|
| 98 | // MParContainer copy ctor
|
|---|
| 99 | //
|
|---|
| 100 | MParContainer::MParContainer(const MParContainer &named) : TObject()
|
|---|
| 101 | {
|
|---|
| 102 | fName = named.fName;
|
|---|
| 103 | fTitle = named.fTitle;
|
|---|
| 104 |
|
|---|
| 105 | fLog = named.fLog;
|
|---|
| 106 |
|
|---|
| 107 | fReadyToSave = named.fReadyToSave;
|
|---|
| 108 |
|
|---|
| 109 | fDisplay = named.fDisplay;
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 | MParContainer::~MParContainer()
|
|---|
| 113 | {
|
|---|
| 114 | #ifdef DEBUG
|
|---|
| 115 | if (fName.IsNull() || fName==(TString)"MTime")
|
|---|
| 116 | return;
|
|---|
| 117 |
|
|---|
| 118 | *fLog << all << "Deleting " << GetDescriptor() << endl;
|
|---|
| 119 | if (TestBit(kMustCleanup) && gROOT && gROOT->MustClean())
|
|---|
| 120 | {
|
|---|
| 121 | *fLog << "Recursive Remove..." << flush;
|
|---|
| 122 | if (TestBit(kCanDelete))
|
|---|
| 123 | *fLog << "kCanDelete..." << flush;
|
|---|
| 124 | TIter Next(gROOT->GetListOfCleanups());
|
|---|
| 125 | TObject *o=0;
|
|---|
| 126 | while ((o=Next()))
|
|---|
| 127 | *fLog << dbg << o->GetName() << " [" << o->ClassName() << "]" << endl;
|
|---|
| 128 | *fLog << dbg << "Removing..." << flush;
|
|---|
| 129 | gROOT->GetListOfCleanups()->RecursiveRemove(this);
|
|---|
| 130 | *fLog << "Removed." << endl;
|
|---|
| 131 | }
|
|---|
| 132 | #endif
|
|---|
| 133 | }
|
|---|
| 134 |
|
|---|
| 135 | // --------------------------------------------------------------------------
|
|---|
| 136 | //
|
|---|
| 137 | // MParContainer assignment operator.
|
|---|
| 138 | //
|
|---|
| 139 | MParContainer& MParContainer::operator=(const MParContainer& rhs)
|
|---|
| 140 | {
|
|---|
| 141 | if (this == &rhs)
|
|---|
| 142 | return *this;
|
|---|
| 143 |
|
|---|
| 144 | TObject::operator=(rhs);
|
|---|
| 145 |
|
|---|
| 146 | fName = rhs.fName;
|
|---|
| 147 | fTitle = rhs.fTitle;
|
|---|
| 148 |
|
|---|
| 149 | fLog = rhs.fLog;
|
|---|
| 150 | fReadyToSave = rhs.fReadyToSave;
|
|---|
| 151 |
|
|---|
| 152 | return *this;
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | // --------------------------------------------------------------------------
|
|---|
| 156 | //
|
|---|
| 157 | // Make a clone of an object using the Streamer facility.
|
|---|
| 158 | // If newname is specified, this will be the name of the new object
|
|---|
| 159 | //
|
|---|
| 160 | TObject *MParContainer::Clone(const char *newname) const
|
|---|
| 161 | {
|
|---|
| 162 |
|
|---|
| 163 | MParContainer *named = (MParContainer*)TObject::Clone();
|
|---|
| 164 | if (newname && strlen(newname)) named->SetName(newname);
|
|---|
| 165 | return named;
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | // --------------------------------------------------------------------------
|
|---|
| 169 | //
|
|---|
| 170 | // Compare two MParContainer objects. Returns 0 when equal, -1 when this is
|
|---|
| 171 | // smaller and +1 when bigger (like strcmp).
|
|---|
| 172 | //
|
|---|
| 173 | Int_t MParContainer::Compare(const TObject *obj) const
|
|---|
| 174 | {
|
|---|
| 175 | if (this == obj) return 0;
|
|---|
| 176 | return fName.CompareTo(obj->GetName());
|
|---|
| 177 | }
|
|---|
| 178 |
|
|---|
| 179 | // --------------------------------------------------------------------------
|
|---|
| 180 | //
|
|---|
| 181 | // Copy this to obj.
|
|---|
| 182 | //
|
|---|
| 183 | void MParContainer::Copy(TObject &obj)
|
|---|
| 184 | #if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
|
|---|
| 185 | const
|
|---|
| 186 | #endif
|
|---|
| 187 | {
|
|---|
| 188 | MParContainer &cont = (MParContainer&)obj;
|
|---|
| 189 |
|
|---|
| 190 | TObject::Copy(obj);
|
|---|
| 191 |
|
|---|
| 192 | cont.fName = fName;
|
|---|
| 193 | cont.fTitle = fTitle;
|
|---|
| 194 |
|
|---|
| 195 | cont.fLog = fLog;
|
|---|
| 196 | cont.fReadyToSave = fReadyToSave;
|
|---|
| 197 | }
|
|---|
| 198 |
|
|---|
| 199 | // --------------------------------------------------------------------------
|
|---|
| 200 | //
|
|---|
| 201 | // Encode MParContainer into output buffer.
|
|---|
| 202 | //
|
|---|
| 203 | void MParContainer::FillBuffer(char *&buffer)
|
|---|
| 204 | {
|
|---|
| 205 | fName.FillBuffer(buffer);
|
|---|
| 206 | fTitle.FillBuffer(buffer);
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | // --------------------------------------------------------------------------
|
|---|
| 210 | //
|
|---|
| 211 | // Returns the name of the object. If the name of the object is not the
|
|---|
| 212 | // class name it returns the object name and in []-brackets the class name.
|
|---|
| 213 | //
|
|---|
| 214 | const TString MParContainer::GetDescriptor() const
|
|---|
| 215 | {
|
|---|
| 216 | return GetDescriptor(*this);
|
|---|
| 217 | }
|
|---|
| 218 |
|
|---|
| 219 | // --------------------------------------------------------------------------
|
|---|
| 220 | //
|
|---|
| 221 | // Returns the name of the object. If the name of the object is not the
|
|---|
| 222 | // class name it returns the object name and in []-brackets the class name.
|
|---|
| 223 | //
|
|---|
| 224 | const TString MParContainer::GetDescriptor(const TObject &o)
|
|---|
| 225 | {
|
|---|
| 226 | //
|
|---|
| 227 | // Because it returns a (const char*) we cannot return a casted
|
|---|
| 228 | // local TString. The pointer would - immediatly after return -
|
|---|
| 229 | // point to a random memory segment, because the TString has gone.
|
|---|
| 230 | //
|
|---|
| 231 | return (TString)o.GetName()==o.ClassName() ? (TString)o.ClassName() :
|
|---|
| 232 | MString::Format("%s [%s]", o.GetName(), o.ClassName());
|
|---|
| 233 | }
|
|---|
| 234 |
|
|---|
| 235 | // --------------------------------------------------------------------------
|
|---|
| 236 | //
|
|---|
| 237 | // Return a unique name for this container. It is created from
|
|---|
| 238 | // the container name and the unique Id. (This is mostly used
|
|---|
| 239 | // in the StreamPrimitive member functions)
|
|---|
| 240 | //
|
|---|
| 241 | const TString MParContainer::GetUniqueName() const
|
|---|
| 242 | {
|
|---|
| 243 | TString ret = ToLower(fName);
|
|---|
| 244 |
|
|---|
| 245 | if (isdigit(ret[ret.Length()-1]))
|
|---|
| 246 | ret+="_";
|
|---|
| 247 |
|
|---|
| 248 | ret+=GetUniqueID();
|
|---|
| 249 |
|
|---|
| 250 | return ret;
|
|---|
| 251 | }
|
|---|
| 252 |
|
|---|
| 253 | // --------------------------------------------------------------------------
|
|---|
| 254 | //
|
|---|
| 255 | // List MParContainer name and title.
|
|---|
| 256 | //
|
|---|
| 257 | void MParContainer::ls(Option_t *) const
|
|---|
| 258 | {
|
|---|
| 259 | TROOT::IndentLevel();
|
|---|
| 260 | *fLog << all << GetDescriptor() << " " << GetTitle() << ": kCanDelete=";
|
|---|
| 261 | *fLog << Int_t(TestBit(kCanDelete)) << endl;
|
|---|
| 262 | }
|
|---|
| 263 |
|
|---|
| 264 | // --------------------------------------------------------------------------
|
|---|
| 265 | //
|
|---|
| 266 | // Print MParContainer name and title.
|
|---|
| 267 | //
|
|---|
| 268 | void MParContainer::Print(Option_t *) const
|
|---|
| 269 | {
|
|---|
| 270 | *fLog << all << GetDescriptor() << " " << GetTitle() << endl;
|
|---|
| 271 | }
|
|---|
| 272 |
|
|---|
| 273 | // --------------------------------------------------------------------------
|
|---|
| 274 | //
|
|---|
| 275 | // Change (i.e. set) the name of the MParContainer.
|
|---|
| 276 | // WARNING !!
|
|---|
| 277 | // If the object is a member of a THashTable, THashList container
|
|---|
| 278 | // The HashTable must be Rehashed after SetName
|
|---|
| 279 | // For example the list of objects in the current directory is a THashList
|
|---|
| 280 | //
|
|---|
| 281 | void MParContainer::SetName(const char *name)
|
|---|
| 282 | {
|
|---|
| 283 | fName = name;
|
|---|
| 284 | ResetBit(kIsSavedAsPrimitive);
|
|---|
| 285 | if (gPad && TestBit(kMustCleanup)) gPad->Modified();
|
|---|
| 286 | }
|
|---|
| 287 |
|
|---|
| 288 | // --------------------------------------------------------------------------
|
|---|
| 289 | //
|
|---|
| 290 | // Change (i.e. set) all the MParContainer parameters (name and title).
|
|---|
| 291 | // See also WARNING in SetName
|
|---|
| 292 | //
|
|---|
| 293 | void MParContainer::SetObject(const char *name, const char *title)
|
|---|
| 294 | {
|
|---|
| 295 | fName = name;
|
|---|
| 296 | fTitle = title;
|
|---|
| 297 | ResetBit(kIsSavedAsPrimitive);
|
|---|
| 298 | if (gPad && TestBit(kMustCleanup)) gPad->Modified();
|
|---|
| 299 | }
|
|---|
| 300 |
|
|---|
| 301 | // --------------------------------------------------------------------------
|
|---|
| 302 | //
|
|---|
| 303 | // Change (i.e. set) the title of the MParContainer.
|
|---|
| 304 | //
|
|---|
| 305 | void MParContainer::SetTitle(const char *title)
|
|---|
| 306 | {
|
|---|
| 307 | fTitle = title;
|
|---|
| 308 | ResetBit(kIsSavedAsPrimitive);
|
|---|
| 309 | if (gPad && TestBit(kMustCleanup)) gPad->Modified();
|
|---|
| 310 | }
|
|---|
| 311 |
|
|---|
| 312 | // --------------------------------------------------------------------------
|
|---|
| 313 | //
|
|---|
| 314 | // Return size of the MParContainer part of the TObject.
|
|---|
| 315 | //
|
|---|
| 316 | Int_t MParContainer::Sizeof() const
|
|---|
| 317 | {
|
|---|
| 318 | Int_t nbytes = fName.Sizeof() + fTitle.Sizeof();
|
|---|
| 319 | return nbytes;
|
|---|
| 320 | }
|
|---|
| 321 |
|
|---|
| 322 | // --------------------------------------------------------------------------
|
|---|
| 323 | //
|
|---|
| 324 | // Read an object from the current directory. If no name is given
|
|---|
| 325 | // the name of this object is used. The final object will have the
|
|---|
| 326 | // name of the object read from file.
|
|---|
| 327 | //
|
|---|
| 328 | Int_t MParContainer::Read(const char *name)
|
|---|
| 329 | {
|
|---|
| 330 | const Int_t rc = TObject::Read(name?name:(const char*)fName);
|
|---|
| 331 | if (name)
|
|---|
| 332 | SetName(name);
|
|---|
| 333 | return rc;
|
|---|
| 334 | }
|
|---|
| 335 |
|
|---|
| 336 | // --------------------------------------------------------------------------
|
|---|
| 337 | //
|
|---|
| 338 | // If you want to use Ascii-Input/-Output (eg. MWriteAsciiFile) of a
|
|---|
| 339 | // container, overload this function.
|
|---|
| 340 | //
|
|---|
| 341 | void MParContainer::AsciiRead(istream &)
|
|---|
| 342 | {
|
|---|
| 343 | *fLog << warn << "To use the the ascii input of " << GetName();
|
|---|
| 344 | *fLog << " you have to overload " << ClassName() << "::AsciiRead." << endl;
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | // --------------------------------------------------------------------------
|
|---|
| 348 | //
|
|---|
| 349 | // Write out a data member given as a TDataMember object to an output stream.
|
|---|
| 350 | //
|
|---|
| 351 | Bool_t MParContainer::WriteDataMember(ostream &out, const TDataMember *member, Double_t scale) const
|
|---|
| 352 | {
|
|---|
| 353 | if (!member)
|
|---|
| 354 | return kFALSE;
|
|---|
| 355 |
|
|---|
| 356 | if (!member->IsPersistent() || member->Property()&kIsStatic)
|
|---|
| 357 | return kFALSE;
|
|---|
| 358 |
|
|---|
| 359 | /*const*/ TMethodCall *call = ((TDataMember*)member)->GetterMethod(); //FIXME: Root
|
|---|
| 360 | if (!call)
|
|---|
| 361 | {
|
|---|
| 362 | *fLog << warn << "Sorry, no getter method found for " << member->GetName() << endl;
|
|---|
| 363 | return kFALSE;
|
|---|
| 364 | }
|
|---|
| 365 |
|
|---|
| 366 | // For debugging: out << member->GetName() << ":";
|
|---|
| 367 |
|
|---|
| 368 | switch (call->ReturnType())
|
|---|
| 369 | {
|
|---|
| 370 | case TMethodCall::kLong:
|
|---|
| 371 | Long_t l;
|
|---|
| 372 | call->Execute((void*)this, l); // FIXME: const, root
|
|---|
| 373 | out << l << " ";
|
|---|
| 374 | return kTRUE;
|
|---|
| 375 |
|
|---|
| 376 | case TMethodCall::kDouble:
|
|---|
| 377 | Double_t d;
|
|---|
| 378 | call->Execute((void*)this, d); // FIXME: const, root
|
|---|
| 379 | out << (scale*d) << " ";
|
|---|
| 380 | return kTRUE;
|
|---|
| 381 |
|
|---|
| 382 | default:
|
|---|
| 383 | //case TMethodCall::kString:
|
|---|
| 384 | //case TMethodCall::kOther:
|
|---|
| 385 | /* someone may want to enhance this? */
|
|---|
| 386 | return kFALSE;
|
|---|
| 387 | }
|
|---|
| 388 | }
|
|---|
| 389 |
|
|---|
| 390 | // --------------------------------------------------------------------------
|
|---|
| 391 | //
|
|---|
| 392 | // Write out a data member given by name to an output stream.
|
|---|
| 393 | //
|
|---|
| 394 | Bool_t MParContainer::WriteDataMember(ostream &out, const char *member, Double_t scale) const
|
|---|
| 395 | {
|
|---|
| 396 | /*const*/ TClass *cls = IsA()->GetBaseDataMember(member);
|
|---|
| 397 | if (!cls)
|
|---|
| 398 | return kFALSE;
|
|---|
| 399 |
|
|---|
| 400 | return WriteDataMember(out, cls->GetDataMember(member), scale);
|
|---|
| 401 | }
|
|---|
| 402 |
|
|---|
| 403 | // --------------------------------------------------------------------------
|
|---|
| 404 | //
|
|---|
| 405 | // Write out a data member from a given TList of TDataMembers.
|
|---|
| 406 | // returns kTRUE when at least one member was successfully written
|
|---|
| 407 | //
|
|---|
| 408 | Bool_t MParContainer::WriteDataMember(ostream &out, const TList *list) const
|
|---|
| 409 | {
|
|---|
| 410 | Bool_t rc = kFALSE;
|
|---|
| 411 |
|
|---|
| 412 | TDataMember *data = NULL;
|
|---|
| 413 |
|
|---|
| 414 | TIter Next(list);
|
|---|
| 415 | while ((data=(TDataMember*)Next()))
|
|---|
| 416 | rc |= WriteDataMember(out, data);
|
|---|
| 417 |
|
|---|
| 418 | return rc;
|
|---|
| 419 | }
|
|---|
| 420 |
|
|---|
| 421 | // --------------------------------------------------------------------------
|
|---|
| 422 | //
|
|---|
| 423 | // If you want to use Ascii-Input/-Output (eg. MWriteAsciiFile) of a
|
|---|
| 424 | // container, you may overload this function. If you don't overload it
|
|---|
| 425 | // the data member of a class are written to the file in the order of
|
|---|
| 426 | // appearance in the class header (be more specfic: root dictionary)
|
|---|
| 427 | // Only data members which are of integer (Bool_t, Int_t, ...) or
|
|---|
| 428 | // floating point (Float_t, Double_t, ...) type are written.
|
|---|
| 429 | // returns kTRUE when at least one member was successfully written
|
|---|
| 430 | //
|
|---|
| 431 | Bool_t MParContainer::AsciiWrite(ostream &out) const
|
|---|
| 432 | {
|
|---|
| 433 | // *fLog << warn << "To use the the ascii output of " << GetName();
|
|---|
| 434 | // *fLog << " you have to overload " << ClassName() << "::AsciiWrite." << endl;
|
|---|
| 435 |
|
|---|
| 436 | Bool_t rc = WriteDataMember(out, IsA()->GetListOfDataMembers());
|
|---|
| 437 |
|
|---|
| 438 | TIter NextBaseClass(IsA()->GetListOfBases());
|
|---|
| 439 | TBaseClass *base;
|
|---|
| 440 | while ((base = (TBaseClass*) NextBaseClass()))
|
|---|
| 441 | {
|
|---|
| 442 | /*const*/ TClass *cls = base->GetClassPointer();
|
|---|
| 443 |
|
|---|
| 444 | if (!cls)
|
|---|
| 445 | continue;
|
|---|
| 446 |
|
|---|
| 447 | if (cls->GetClassVersion())
|
|---|
| 448 | rc |= WriteDataMember(out, cls->GetListOfDataMembers());
|
|---|
| 449 | }
|
|---|
| 450 |
|
|---|
| 451 | return rc;
|
|---|
| 452 | }
|
|---|
| 453 |
|
|---|
| 454 | // --------------------------------------------------------------------------
|
|---|
| 455 | //
|
|---|
| 456 | // This virtual function is called for all parameter containers which are
|
|---|
| 457 | // found in the parameter list automatically each time the tasklist is
|
|---|
| 458 | // executed.
|
|---|
| 459 | //
|
|---|
| 460 | // By overwriting this function you can invalidate the contents of a
|
|---|
| 461 | // container before each execution of the tasklist:
|
|---|
| 462 | //
|
|---|
| 463 | // For example:
|
|---|
| 464 | // void MHillas::Reset()
|
|---|
| 465 | // {
|
|---|
| 466 | // fWidth = -1;
|
|---|
| 467 | // }
|
|---|
| 468 | //
|
|---|
| 469 | // (While -1 is obviously a impossible value for fWidth you can immediatly
|
|---|
| 470 | // see - if you Print() the contents of this container - that MHillasCalc
|
|---|
| 471 | // has not caluclated the width in this runthrough of the tasklist)
|
|---|
| 472 | //
|
|---|
| 473 | // Overwriting MParConatiner::Reset() in your container makes it
|
|---|
| 474 | // unnecessary to call any Clear() or Reset() manually in your task and
|
|---|
| 475 | // you make sure, that you don't keep results of previous runs of your
|
|---|
| 476 | // tasklist by chance.
|
|---|
| 477 | //
|
|---|
| 478 | // MParContainer::Reset() itself does nothing.
|
|---|
| 479 | //
|
|---|
| 480 | void MParContainer::Reset()
|
|---|
| 481 | {
|
|---|
| 482 | }
|
|---|
| 483 |
|
|---|
| 484 | // --------------------------------------------------------------------------
|
|---|
| 485 | //
|
|---|
| 486 | // Return the pointer to the TClass (from the root dictionary) which
|
|---|
| 487 | // corresponds to the class with name name.
|
|---|
| 488 | //
|
|---|
| 489 | // Make sure, that a new object of this type can be created.
|
|---|
| 490 | //
|
|---|
| 491 | // In case of failure return NULL
|
|---|
| 492 | //
|
|---|
| 493 | TClass *MParContainer::GetConstructor(const char *name) const
|
|---|
| 494 | {
|
|---|
| 495 | //
|
|---|
| 496 | // try to get class from root environment
|
|---|
| 497 | //
|
|---|
| 498 | TClass *cls = gROOT->GetClass(name);
|
|---|
| 499 | Int_t rc = 0;
|
|---|
| 500 | if (!cls)
|
|---|
| 501 | rc =1;
|
|---|
| 502 | else
|
|---|
| 503 | {
|
|---|
| 504 | if (!cls->Property())
|
|---|
| 505 | rc = 5;
|
|---|
| 506 | if (!cls->Size())
|
|---|
| 507 | rc = 4;
|
|---|
| 508 | if (!cls->IsLoaded())
|
|---|
| 509 | rc = 3;
|
|---|
| 510 | if (!cls->HasDefaultConstructor())
|
|---|
| 511 | rc = 2;
|
|---|
| 512 | }
|
|---|
| 513 |
|
|---|
| 514 | if (!rc)
|
|---|
| 515 | return cls;
|
|---|
| 516 |
|
|---|
| 517 | *fLog << err << dbginf << GetDescriptor() << " - Cannot create new instance of class '" << name << "': ";
|
|---|
| 518 | switch (rc)
|
|---|
| 519 | {
|
|---|
| 520 | case 1:
|
|---|
| 521 | *fLog << "gROOT->GetClass() returned NULL." << endl;
|
|---|
| 522 | return NULL;
|
|---|
| 523 | case 2:
|
|---|
| 524 | *fLog << "no default constructor." << endl;
|
|---|
| 525 | return NULL;
|
|---|
| 526 | case 3:
|
|---|
| 527 | *fLog << "not loaded." << endl;
|
|---|
| 528 | return NULL;
|
|---|
| 529 | case 4:
|
|---|
| 530 | *fLog << "zero size." << endl;
|
|---|
| 531 | return NULL;
|
|---|
| 532 | case 5:
|
|---|
| 533 | *fLog << "no property." << endl;
|
|---|
| 534 | return NULL;
|
|---|
| 535 | }
|
|---|
| 536 |
|
|---|
| 537 | *fLog << "rtlprmft." << endl;
|
|---|
| 538 |
|
|---|
| 539 | return NULL;
|
|---|
| 540 | }
|
|---|
| 541 |
|
|---|
| 542 | // --------------------------------------------------------------------------
|
|---|
| 543 | //
|
|---|
| 544 | // Return a new object of class 'name'. Make sure that the object
|
|---|
| 545 | // derives from the class base.
|
|---|
| 546 | //
|
|---|
| 547 | // In case of failure return NULL
|
|---|
| 548 | //
|
|---|
| 549 | // The caller is responsible of deleting the object!
|
|---|
| 550 | //
|
|---|
| 551 | MParContainer *MParContainer::GetNewObject(const char *name, TClass *base) const
|
|---|
| 552 | {
|
|---|
| 553 | return base ? GetNewObject(name, base->GetName()) : 0;
|
|---|
| 554 | }
|
|---|
| 555 |
|
|---|
| 556 | // --------------------------------------------------------------------------
|
|---|
| 557 | //
|
|---|
| 558 | // Return a new object of class 'name'. Make sure that the object
|
|---|
| 559 | // derives from the class base.
|
|---|
| 560 | //
|
|---|
| 561 | // In case of failure return NULL
|
|---|
| 562 | //
|
|---|
| 563 | // The caller is responsible of deleting the object!
|
|---|
| 564 | //
|
|---|
| 565 | MParContainer *MParContainer::GetNewObject(const char *name, const char *base) const
|
|---|
| 566 | {
|
|---|
| 567 | TClass *cls = GetConstructor(name);
|
|---|
| 568 | if (!cls || !base)
|
|---|
| 569 | return NULL;
|
|---|
| 570 |
|
|---|
| 571 | if (!cls->InheritsFrom(base))
|
|---|
| 572 | {
|
|---|
| 573 | *fLog << err;
|
|---|
| 574 | *fLog << dbginf << GetDescriptor() << "Cannot create new instance of class '" << name << "': " << endl;
|
|---|
| 575 | *fLog << "Class " << cls->GetName() << " doesn't inherit from " << base << endl;
|
|---|
| 576 | return NULL;
|
|---|
| 577 | }
|
|---|
| 578 |
|
|---|
| 579 | //
|
|---|
| 580 | // create the parameter container of the the given class type
|
|---|
| 581 | //
|
|---|
| 582 | TObject *obj = (TObject*)cls->New();
|
|---|
| 583 | if (!obj)
|
|---|
| 584 | {
|
|---|
| 585 | *fLog << err;
|
|---|
| 586 | *fLog << dbginf << GetDescriptor() << " - Cannot create new instance of class '" << name << "': " << endl;
|
|---|
| 587 | *fLog << " - Class " << cls->GetName() << " has no default constructor." << endl;
|
|---|
| 588 | *fLog << " - An abstract member functions of a base class is not overwritten." << endl;
|
|---|
| 589 | return NULL;
|
|---|
| 590 | }
|
|---|
| 591 |
|
|---|
| 592 | return (MParContainer*)obj;
|
|---|
| 593 | }
|
|---|
| 594 |
|
|---|
| 595 | TMethodCall *MParContainer::GetterMethod(const char *name) const
|
|---|
| 596 | {
|
|---|
| 597 | const TString n(name);
|
|---|
| 598 | const Int_t pos1 = n.First('.');
|
|---|
| 599 |
|
|---|
| 600 | const TString part1 = pos1<0 ? n : n(0, pos1);
|
|---|
| 601 | const TString part2 = pos1<0 ? TString("") : n(pos1+1, n.Length());
|
|---|
| 602 |
|
|---|
| 603 | TClass *cls = IsA()->GetBaseDataMember(part1);
|
|---|
| 604 | if (cls)
|
|---|
| 605 | {
|
|---|
| 606 | TDataMember *member = cls->GetDataMember(part1);
|
|---|
| 607 | if (!member)
|
|---|
| 608 | {
|
|---|
| 609 | *fLog << err << "Datamember '" << part1 << "' not in " << GetDescriptor() << endl;
|
|---|
| 610 | return NULL;
|
|---|
| 611 | }
|
|---|
| 612 |
|
|---|
| 613 | // This handles returning references of contained objects, eg
|
|---|
| 614 | // class X { TObject fO; TObject &GetO() { return fO; } };
|
|---|
| 615 | if (!member->IsBasic() && !part2.IsNull())
|
|---|
| 616 | {
|
|---|
| 617 | cls = gROOT->GetClass(member->GetTypeName());
|
|---|
| 618 | if (!cls)
|
|---|
| 619 | {
|
|---|
| 620 | *fLog << err << "Datamember " << part1 << " [";
|
|---|
| 621 | *fLog << member->GetTypeName() << "] not in dictionary." << endl;
|
|---|
| 622 | return NULL;
|
|---|
| 623 | }
|
|---|
| 624 | if (!cls->InheritsFrom(MParContainer::Class()))
|
|---|
| 625 | {
|
|---|
| 626 | *fLog << err << "Datamember " << part1 << " [";
|
|---|
| 627 | *fLog << member->GetTypeName() << "] does not inherit from ";
|
|---|
| 628 | *fLog << "MParContainer." << endl;
|
|---|
| 629 | return NULL;
|
|---|
| 630 | }
|
|---|
| 631 |
|
|---|
| 632 | const MParContainer *sub = (MParContainer*)((ULong_t)this+member->GetOffset());
|
|---|
| 633 | return sub->GetterMethod(part2);
|
|---|
| 634 | }
|
|---|
| 635 |
|
|---|
| 636 | if (member->IsaPointer())
|
|---|
| 637 | {
|
|---|
| 638 | *fLog << warn << "Data-member " << part1 << " is a pointer..." << endl;
|
|---|
| 639 | *fLog << dbginf << "Not yet implemented!" << endl;
|
|---|
| 640 | //TClass *test = gROOT->GetClass(member->GetTypeName());
|
|---|
| 641 | return 0;
|
|---|
| 642 | }
|
|---|
| 643 |
|
|---|
| 644 | TMethodCall *call = member->GetterMethod();
|
|---|
| 645 | if (call)
|
|---|
| 646 | return call;
|
|---|
| 647 | }
|
|---|
| 648 |
|
|---|
| 649 | *fLog << inf << "No standard access for '" << part1 << "' in ";
|
|---|
| 650 | *fLog << GetDescriptor() << " or one of its base classes." << endl;
|
|---|
| 651 |
|
|---|
| 652 | TMethodCall *call = NULL;
|
|---|
| 653 |
|
|---|
| 654 | *fLog << "Trying to find MethodCall '" << ClassName();
|
|---|
| 655 | *fLog << "::" << part1 << "' instead..." << flush;
|
|---|
| 656 | call = new TMethodCall(IsA(), part1, "");
|
|---|
| 657 | if (call->GetMethod())
|
|---|
| 658 | {
|
|---|
| 659 | fgListMethodCall.Add(call);
|
|---|
| 660 | *fLog << "found." << endl;
|
|---|
| 661 | return call;
|
|---|
| 662 | }
|
|---|
| 663 | *fLog << endl;
|
|---|
| 664 |
|
|---|
| 665 | delete call;
|
|---|
| 666 |
|
|---|
| 667 | *fLog << "Trying to find MethodCall '" << ClassName();
|
|---|
| 668 | *fLog << "::Get" << part1 << "' instead..." << flush;
|
|---|
| 669 | call = new TMethodCall(IsA(), (TString)"Get"+part1, "");
|
|---|
| 670 | if (call->GetMethod())
|
|---|
| 671 | {
|
|---|
| 672 | fgListMethodCall.Add(call);
|
|---|
| 673 | *fLog << "found." << endl;
|
|---|
| 674 | return call;
|
|---|
| 675 | }
|
|---|
| 676 | *fLog << endl;
|
|---|
| 677 |
|
|---|
| 678 | delete call;
|
|---|
| 679 |
|
|---|
| 680 | *fLog << err << "Sorry, no getter method found for " << part1 << endl;
|
|---|
| 681 | return NULL;
|
|---|
| 682 | }
|
|---|
| 683 |
|
|---|
| 684 | // --------------------------------------------------------------------------
|
|---|
| 685 | //
|
|---|
| 686 | // Implementation of SavePrimitive. Used to write the call to a constructor
|
|---|
| 687 | // to a macro. In the original root implementation it is used to write
|
|---|
| 688 | // gui elements to a macro-file.
|
|---|
| 689 | //
|
|---|
| 690 | void MParContainer::SavePrimitive(ostream &out, Option_t *)
|
|---|
| 691 | {
|
|---|
| 692 | static UInt_t uid = 0;
|
|---|
| 693 |
|
|---|
| 694 | if (IsSavedAsPrimitive())
|
|---|
| 695 | return;
|
|---|
| 696 |
|
|---|
| 697 | SetUniqueID(uid++);
|
|---|
| 698 | SetBit(kIsSavedAsPrimitive);
|
|---|
| 699 |
|
|---|
| 700 | if (gListOfPrimitives && !gListOfPrimitives->FindObject(this))
|
|---|
| 701 | gListOfPrimitives->Add(this);
|
|---|
| 702 |
|
|---|
| 703 | StreamPrimitive(out);
|
|---|
| 704 | }
|
|---|
| 705 |
|
|---|
| 706 | void MParContainer::SavePrimitive(ofstream &out, Option_t *)
|
|---|
| 707 | {
|
|---|
| 708 | SavePrimitive(static_cast<ostream&>(out));
|
|---|
| 709 | }
|
|---|
| 710 |
|
|---|
| 711 | // --------------------------------------------------------------------------
|
|---|
| 712 | //
|
|---|
| 713 | // Creates the string written by SavePrimitive and returns it.
|
|---|
| 714 | //
|
|---|
| 715 | void MParContainer::StreamPrimitive(ostream &out) const
|
|---|
| 716 | {
|
|---|
| 717 | out << " // Using MParContainer::StreamPrimitive" << endl;
|
|---|
| 718 | out << " " << ClassName() << " " << GetUniqueName() << "(\"";
|
|---|
| 719 | out << fName << "\", \"" << fTitle << "\");" << endl;
|
|---|
| 720 | }
|
|---|
| 721 |
|
|---|
| 722 | void MParContainer::GetNames(TObjArray &arr) const
|
|---|
| 723 | {
|
|---|
| 724 | arr.AddLast(new TNamed(fName, fTitle));
|
|---|
| 725 | }
|
|---|
| 726 |
|
|---|
| 727 | void MParContainer::SetNames(TObjArray &arr)
|
|---|
| 728 | {
|
|---|
| 729 | TNamed *name = (TNamed*)arr.First();
|
|---|
| 730 |
|
|---|
| 731 | fName = name->GetName();
|
|---|
| 732 | fTitle = name->GetTitle();
|
|---|
| 733 |
|
|---|
| 734 | delete arr.Remove(name);
|
|---|
| 735 | arr.Compress();
|
|---|
| 736 | }
|
|---|
| 737 |
|
|---|
| 738 | // --------------------------------------------------------------------------
|
|---|
| 739 | //
|
|---|
| 740 | // Creates a new instance of this class. The idea is to create a clone of
|
|---|
| 741 | // this class in its initial state.
|
|---|
| 742 | //
|
|---|
| 743 | MParContainer *MParContainer::New() const
|
|---|
| 744 | {
|
|---|
| 745 | return (MParContainer*)IsA()->New();
|
|---|
| 746 | }
|
|---|
| 747 |
|
|---|
| 748 | // --------------------------------------------------------------------------
|
|---|
| 749 | //
|
|---|
| 750 | // Read the contents/setup of a parameter container/task from a TEnv
|
|---|
| 751 | // instance (steering card/setup file).
|
|---|
| 752 | // The key to search for in the file should be of the syntax:
|
|---|
| 753 | // prefix.vname
|
|---|
| 754 | // While vname is a name which is specific for a single setup date
|
|---|
| 755 | // (variable) of this container and prefix is something like:
|
|---|
| 756 | // evtloopname.name
|
|---|
| 757 | // While name is the name of the containers/tasks in the parlist/tasklist
|
|---|
| 758 | //
|
|---|
| 759 | // eg. Job4.MImgCleanStd.CleaningLevel1: 3.0
|
|---|
| 760 | // Job4.MImgCleanStd.CleaningLevel2: 2.5
|
|---|
| 761 | //
|
|---|
| 762 | // If this cannot be found the next step is to search for
|
|---|
| 763 | // MImgCleanStd.CleaningLevel1: 3.0
|
|---|
| 764 | // And if this doesn't exist, too, we should search for:
|
|---|
| 765 | // CleaningLevel1: 3.0
|
|---|
| 766 | //
|
|---|
| 767 | // Warning: The programmer is responsible for the names to be unique in
|
|---|
| 768 | // all Mars classes.
|
|---|
| 769 | //
|
|---|
| 770 | // Return values:
|
|---|
| 771 | // kTRUE: Environment string found
|
|---|
| 772 | // kFALSE: Environment string not found
|
|---|
| 773 | // kERROR: Error occured, eg. environment invalid
|
|---|
| 774 | //
|
|---|
| 775 | // Overload this if you don't want to control the level of setup-string. In
|
|---|
| 776 | // this case ReadEnv gets called with the different possibilities, see TestEnv.
|
|---|
| 777 | //
|
|---|
| 778 | Int_t MParContainer::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
|
|---|
| 779 | {
|
|---|
| 780 | if (!IsEnvDefined(env, prefix, "", print))
|
|---|
| 781 | return kFALSE;
|
|---|
| 782 |
|
|---|
| 783 | *fLog << warn << "WARNING - " << fName << ": Resource " << prefix << " found, but no " << ClassName() << "::ReadEnv." << endl;
|
|---|
| 784 | return kTRUE;
|
|---|
| 785 | }
|
|---|
| 786 |
|
|---|
| 787 | // --------------------------------------------------------------------------
|
|---|
| 788 | //
|
|---|
| 789 | // Write the contents/setup of a parameter container/task to a TEnv
|
|---|
| 790 | // instance (steering card/setup file).
|
|---|
| 791 | // The key to search for in the file should be of the syntax:
|
|---|
| 792 | // prefix.vname
|
|---|
| 793 | // While vname is a name which is specific for a single setup date
|
|---|
| 794 | // (variable) of this container and prefix is something like:
|
|---|
| 795 | // evtloopname.name
|
|---|
| 796 | // While name is the name of the containers/tasks in the parlist/tasklist
|
|---|
| 797 | //
|
|---|
| 798 | // eg. Job4.MImgCleanStd.CleaningLevel1: 3.0
|
|---|
| 799 | // Job4.MImgCleanStd.CleaningLevel2: 2.5
|
|---|
| 800 | //
|
|---|
| 801 | // If this cannot be found the next step is to search for
|
|---|
| 802 | // MImgCleanStd.CleaningLevel1: 3.0
|
|---|
| 803 | // And if this doesn't exist, too, we should search for:
|
|---|
| 804 | // CleaningLevel1: 3.0
|
|---|
| 805 | //
|
|---|
| 806 | // Warning: The programmer is responsible for the names to be unique in
|
|---|
| 807 | // all Mars classes.
|
|---|
| 808 | //
|
|---|
| 809 | Bool_t MParContainer::WriteEnv(TEnv &env, TString prefix, Bool_t print) const
|
|---|
| 810 | {
|
|---|
| 811 | if (!IsEnvDefined(env, prefix, "", print))
|
|---|
| 812 | return kFALSE;
|
|---|
| 813 |
|
|---|
| 814 | *fLog << warn << "WARNING - Resource " << prefix+fName << " found, but " << ClassName() << "::WriteEnv not overloaded." << endl;
|
|---|
| 815 | return kTRUE;
|
|---|
| 816 | }
|
|---|
| 817 |
|
|---|
| 818 | // --------------------------------------------------------------------------
|
|---|
| 819 | //
|
|---|
| 820 | // Take the prefix and call ReadEnv for:
|
|---|
| 821 | // prefix.containername
|
|---|
| 822 | // prefix.classname
|
|---|
| 823 | // containername
|
|---|
| 824 | // classname
|
|---|
| 825 | //
|
|---|
| 826 | // The existance of an environment variable is done in this order. If
|
|---|
| 827 | // ReadEnv return kTRUE the existance of the container setup is assumed and
|
|---|
| 828 | // the other tests are skipped. If kFALSE is assumed the sequence is
|
|---|
| 829 | // continued. In case of kERROR failing of the setup from a file is assumed.
|
|---|
| 830 | //
|
|---|
| 831 | // Overload this if you want to control the handling of level of setup-string
|
|---|
| 832 | // mentioned above. In this case ReadEnv gets never called if you don't call
|
|---|
| 833 | // it explicitly.
|
|---|
| 834 | //
|
|---|
| 835 | Int_t MParContainer::TestEnv(const TEnv &env, TString prefix, Bool_t print)
|
|---|
| 836 | {
|
|---|
| 837 | if (print)
|
|---|
| 838 | *fLog << all << "Testing Prefix+ContName: " << prefix+GetName() << endl;
|
|---|
| 839 | Int_t rc = ReadEnv(env, prefix+GetName(), print);
|
|---|
| 840 | if (rc==kERROR || rc==kTRUE)
|
|---|
| 841 | return rc;
|
|---|
| 842 |
|
|---|
| 843 | // Check For: Job4.MClassName.Varname
|
|---|
| 844 | if (print)
|
|---|
| 845 | *fLog << all << "Testing Prefix+ClasName: " << prefix+ClassName() << endl;
|
|---|
| 846 | rc = ReadEnv(env, prefix+ClassName(), print);
|
|---|
| 847 | if (rc==kERROR || rc==kTRUE)
|
|---|
| 848 | return rc;
|
|---|
| 849 |
|
|---|
| 850 | // Check For: ContainerName.Varname
|
|---|
| 851 | if (print)
|
|---|
| 852 | *fLog << all << "Testing ContName: " << GetName() << endl;
|
|---|
| 853 | rc = ReadEnv(env, GetName(), print);
|
|---|
| 854 | if (rc==kERROR || rc==kTRUE)
|
|---|
| 855 | return rc;
|
|---|
| 856 |
|
|---|
| 857 | // Check For: MClassName.Varname
|
|---|
| 858 | if (print)
|
|---|
| 859 | *fLog << all << "Testing ClassName: " << ClassName() << endl;
|
|---|
| 860 | rc = ReadEnv(env, ClassName(), print);
|
|---|
| 861 | if (rc==kERROR || rc==kTRUE)
|
|---|
| 862 | return rc;
|
|---|
| 863 |
|
|---|
| 864 | // Not found
|
|---|
| 865 | return kFALSE;
|
|---|
| 866 | }
|
|---|
| 867 |
|
|---|
| 868 | Bool_t MParContainer::IsEnvDefined(const TEnv &env, TString prefix, TString postfix, Bool_t print) const
|
|---|
| 869 | {
|
|---|
| 870 | if (!postfix.IsNull())
|
|---|
| 871 | postfix.Insert(0, ".");
|
|---|
| 872 |
|
|---|
| 873 | return IsEnvDefined(env, prefix+postfix, print);
|
|---|
| 874 | }
|
|---|
| 875 |
|
|---|
| 876 | Bool_t MParContainer::IsEnvDefined(const TEnv &env, TString name, Bool_t print) const
|
|---|
| 877 | {
|
|---|
| 878 | if (print)
|
|---|
| 879 | *fLog << all << GetDescriptor() << " - " << name << "... " << flush;
|
|---|
| 880 |
|
|---|
| 881 | if (!((TEnv&)env).Defined(name))
|
|---|
| 882 | {
|
|---|
| 883 | if (print)
|
|---|
| 884 | *fLog << "not found." << endl;
|
|---|
| 885 | return kFALSE;
|
|---|
| 886 | }
|
|---|
| 887 |
|
|---|
| 888 | if (print)
|
|---|
| 889 | *fLog << "found." << endl;
|
|---|
| 890 |
|
|---|
| 891 | return kTRUE;
|
|---|
| 892 | }
|
|---|
| 893 |
|
|---|
| 894 | Int_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, Int_t dflt) const
|
|---|
| 895 | {
|
|---|
| 896 | return GetEnvValue(env, prefix+"."+postfix, dflt);
|
|---|
| 897 | }
|
|---|
| 898 |
|
|---|
| 899 | Double_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, Double_t dflt) const
|
|---|
| 900 | {
|
|---|
| 901 | return GetEnvValue(env, prefix+"."+postfix, dflt);
|
|---|
| 902 | }
|
|---|
| 903 |
|
|---|
| 904 | const char *MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, const char *dflt) const
|
|---|
| 905 | {
|
|---|
| 906 | return GetEnvValue(env, prefix+"."+postfix, dflt);
|
|---|
| 907 | }
|
|---|
| 908 |
|
|---|
| 909 | Int_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, Int_t dflt) const
|
|---|
| 910 | {
|
|---|
| 911 | return ((TEnv&)env).GetValue(prefix, dflt);
|
|---|
| 912 | }
|
|---|
| 913 |
|
|---|
| 914 | Double_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, Double_t dflt) const
|
|---|
| 915 | {
|
|---|
| 916 | return ((TEnv&)env).GetValue(prefix, dflt);
|
|---|
| 917 | }
|
|---|
| 918 |
|
|---|
| 919 | const char *MParContainer::GetEnvValue(const TEnv &env, TString prefix, const char *dflt) const
|
|---|
| 920 | {
|
|---|
| 921 | return ((TEnv&)env).GetValue(prefix, dflt);
|
|---|
| 922 | }
|
|---|