ROOT logo
/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 *    File: $Id: RooArgSet.h,v 1.45 2007/08/09 19:55:47 wouter Exp $
 * Authors:                                                                  *
 *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
 *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
 *                                                                           *
 * Copyright (c) 2000-2005, Regents of the University of California          *
 *                          and Stanford University. All rights reserved.    *
 *                                                                           *
 * Redistribution and use in source and binary forms,                        *
 * with or without modification, are permitted according to the terms        *
 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
 *****************************************************************************/
#ifndef ROO_ARG_SET
#define ROO_ARG_SET

#include "RooAbsCollection.h"
#include "RooErrorHandler.h"
#include <map>
#include <iostream>
using namespace std ;

class RooArgList ;


#define USEMEMPOOL

class RooArgSet : public RooAbsCollection {
public:
  
#ifdef USEMEMPOOL
  void* operator new (size_t bytes);
  void operator delete (void *ptr);
#endif
 
  // Constructors, assignment etc.
  RooArgSet();
  RooArgSet(const RooArgList& list) ;
  RooArgSet(const RooArgList& list, const RooAbsArg* var1) ;
  explicit RooArgSet(const TCollection& tcoll, const char* name="") ;
  explicit RooArgSet(const char *name);
  RooArgSet(const RooArgSet& set1, const RooArgSet& set2,
	    const char *name="");
  RooArgSet(const RooAbsArg& var1, 
	    const char *name="");
  RooArgSet(const RooAbsArg& var1, const RooAbsArg& var2, 
	    const char *name="");
  RooArgSet(const RooAbsArg& var1, const RooAbsArg& var2,
	    const RooAbsArg& var3, 
	    const char *name="");
  RooArgSet(const RooAbsArg& var1, const RooAbsArg& var2,
	    const RooAbsArg& var3, const RooAbsArg& var4, 
	    const char *name="");
  RooArgSet(const RooAbsArg& var1, const RooAbsArg& var2,
	    const RooAbsArg& var3, const RooAbsArg& var4, 
	    const RooAbsArg& var5, 
	    const char *name="");
  RooArgSet(const RooAbsArg& var1, const RooAbsArg& var2,
	    const RooAbsArg& var3, const RooAbsArg& var4, 
	    const RooAbsArg& var5, const RooAbsArg& var6, 
	    const char *name="");
  RooArgSet(const RooAbsArg& var1, const RooAbsArg& var2,
            const RooAbsArg& var3, const RooAbsArg& var4, 
	    const RooAbsArg& var5, const RooAbsArg& var6, 
	    const RooAbsArg& var7, 
	    const char *name="");
  RooArgSet(const RooAbsArg& var1, const RooAbsArg& var2,
            const RooAbsArg& var3, const RooAbsArg& var4, 
	    const RooAbsArg& var5, const RooAbsArg& var6, 
	    const RooAbsArg& var7, const RooAbsArg& var8, 
	    const char *name="");
  RooArgSet(const RooAbsArg& var1, const RooAbsArg& var2,
            const RooAbsArg& var3, const RooAbsArg& var4, 
	    const RooAbsArg& var5, const RooAbsArg& var6, 
	    const RooAbsArg& var7, const RooAbsArg& var8, 
	    const RooAbsArg& var9, const char *name="");

  virtual ~RooArgSet();
  // Create a copy of an existing list. New variables cannot be added
  // to a copied list. The variables in the copied list are independent
  // of the original variables.
  RooArgSet(const RooArgSet& other, const char *name="");
  virtual TObject* clone(const char* newname) const { return new RooArgSet(*this,newname); }
  virtual TObject* create(const char* newname) const { return new RooArgSet(newname); }
  RooArgSet& operator=(const RooArgSet& other) { RooAbsCollection::operator=(other) ; return *this ;}

  virtual Bool_t add(const RooAbsArg& var, Bool_t silent=kFALSE) ;
  virtual Bool_t add(const RooAbsCollection& list, Bool_t silent=kFALSE) {
    // Add all elements in list to collection
    return RooAbsCollection::add(list,silent) ; 
  }
  virtual Bool_t addOwned(RooAbsArg& var, Bool_t silent=kFALSE);
  virtual Bool_t addOwned(const RooAbsCollection& list, Bool_t silent=kFALSE) { 
    // Add all elements in list as owned components to collection
    return RooAbsCollection::addOwned(list,silent) ; 
  }
  virtual RooAbsArg *addClone(const RooAbsArg& var, Bool_t silent=kFALSE) ;
  virtual void addClone(const RooAbsCollection& list, Bool_t silent=kFALSE) { 
    // Add owned clone of all elements of list to collection
    RooAbsCollection::addClone(list,silent) ; 
  }

  RooAbsArg& operator[](const char* name) const ;   

  virtual Bool_t readFromStream(istream& is, Bool_t compact, Bool_t verbose=kFALSE) {
    // I/O streaming interface (machine readable)
    return readFromStream(is, compact, 0, 0, verbose) ;
  }
  Bool_t readFromStream(istream& is, Bool_t compact, const char* flagReadAtt, const char* section, Bool_t verbose=kFALSE) ;
  virtual void writeToStream(ostream& os, Bool_t compact, const char* section=0) const;  
  void writeToFile(const char* fileName) const ;
  Bool_t readFromFile(const char* fileName, const char* flagReadAtt=0, const char* section=0, Bool_t verbose=kFALSE) ;

  // Utilities functions when used as configuration object
  Double_t getRealValue(const char* name, Double_t defVal=0, Bool_t verbose=kFALSE) const ;
  const char* getCatLabel(const char* name, const char* defVal="", Bool_t verbose=kFALSE) const ;
  Int_t getCatIndex(const char* name, Int_t defVal=0, Bool_t verbose=kFALSE) const ;
  const char* getStringValue(const char* name, const char* defVal="", Bool_t verbose=kFALSE) const ;
  Bool_t setRealValue(const char* name, Double_t newVal=0, Bool_t verbose=kFALSE) ;
  Bool_t setCatLabel(const char* name, const char* newVal="", Bool_t verbose=kFALSE) ;
  Bool_t setCatIndex(const char* name, Int_t newVal=0, Bool_t verbose=kFALSE) ;
  Bool_t setStringValue(const char* name, const char* newVal="", Bool_t verbose=kFALSE) ;

  static void cleanup() ;

  Bool_t isInRange(const char* rangeSpec) ;

protected:

  Bool_t checkForDup(const RooAbsArg& arg, Bool_t silent) const ;

  static char* _poolBegin ; //! Start of memory pool
  static char* _poolCur ;   //! Next free slot in memory pool
  static char* _poolEnd ;   //! End of memory pool  
  
  ClassDef(RooArgSet,1) // Set of RooAbsArg objects
};

#endif
 RooArgSet.h:1
 RooArgSet.h:2
 RooArgSet.h:3
 RooArgSet.h:4
 RooArgSet.h:5
 RooArgSet.h:6
 RooArgSet.h:7
 RooArgSet.h:8
 RooArgSet.h:9
 RooArgSet.h:10
 RooArgSet.h:11
 RooArgSet.h:12
 RooArgSet.h:13
 RooArgSet.h:14
 RooArgSet.h:15
 RooArgSet.h:16
 RooArgSet.h:17
 RooArgSet.h:18
 RooArgSet.h:19
 RooArgSet.h:20
 RooArgSet.h:21
 RooArgSet.h:22
 RooArgSet.h:23
 RooArgSet.h:24
 RooArgSet.h:25
 RooArgSet.h:26
 RooArgSet.h:27
 RooArgSet.h:28
 RooArgSet.h:29
 RooArgSet.h:30
 RooArgSet.h:31
 RooArgSet.h:32
 RooArgSet.h:33
 RooArgSet.h:34
 RooArgSet.h:35
 RooArgSet.h:36
 RooArgSet.h:37
 RooArgSet.h:38
 RooArgSet.h:39
 RooArgSet.h:40
 RooArgSet.h:41
 RooArgSet.h:42
 RooArgSet.h:43
 RooArgSet.h:44
 RooArgSet.h:45
 RooArgSet.h:46
 RooArgSet.h:47
 RooArgSet.h:48
 RooArgSet.h:49
 RooArgSet.h:50
 RooArgSet.h:51
 RooArgSet.h:52
 RooArgSet.h:53
 RooArgSet.h:54
 RooArgSet.h:55
 RooArgSet.h:56
 RooArgSet.h:57
 RooArgSet.h:58
 RooArgSet.h:59
 RooArgSet.h:60
 RooArgSet.h:61
 RooArgSet.h:62
 RooArgSet.h:63
 RooArgSet.h:64
 RooArgSet.h:65
 RooArgSet.h:66
 RooArgSet.h:67
 RooArgSet.h:68
 RooArgSet.h:69
 RooArgSet.h:70
 RooArgSet.h:71
 RooArgSet.h:72
 RooArgSet.h:73
 RooArgSet.h:74
 RooArgSet.h:75
 RooArgSet.h:76
 RooArgSet.h:77
 RooArgSet.h:78
 RooArgSet.h:79
 RooArgSet.h:80
 RooArgSet.h:81
 RooArgSet.h:82
 RooArgSet.h:83
 RooArgSet.h:84
 RooArgSet.h:85
 RooArgSet.h:86
 RooArgSet.h:87
 RooArgSet.h:88
 RooArgSet.h:89
 RooArgSet.h:90
 RooArgSet.h:91
 RooArgSet.h:92
 RooArgSet.h:93
 RooArgSet.h:94
 RooArgSet.h:95
 RooArgSet.h:96
 RooArgSet.h:97
 RooArgSet.h:98
 RooArgSet.h:99
 RooArgSet.h:100
 RooArgSet.h:101
 RooArgSet.h:102
 RooArgSet.h:103
 RooArgSet.h:104
 RooArgSet.h:105
 RooArgSet.h:106
 RooArgSet.h:107
 RooArgSet.h:108
 RooArgSet.h:109
 RooArgSet.h:110
 RooArgSet.h:111
 RooArgSet.h:112
 RooArgSet.h:113
 RooArgSet.h:114
 RooArgSet.h:115
 RooArgSet.h:116
 RooArgSet.h:117
 RooArgSet.h:118
 RooArgSet.h:119
 RooArgSet.h:120
 RooArgSet.h:121
 RooArgSet.h:122
 RooArgSet.h:123
 RooArgSet.h:124
 RooArgSet.h:125
 RooArgSet.h:126
 RooArgSet.h:127
 RooArgSet.h:128
 RooArgSet.h:129
 RooArgSet.h:130
 RooArgSet.h:131
 RooArgSet.h:132
 RooArgSet.h:133
 RooArgSet.h:134
 RooArgSet.h:135
 RooArgSet.h:136
 RooArgSet.h:137
 RooArgSet.h:138
 RooArgSet.h:139
 RooArgSet.h:140
 RooArgSet.h:141