Logo ROOT   6.10/09
Reference Guide
RooArgList.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooArgList.h,v 1.14 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 #ifndef ROO_ARG_LIST
17 #define ROO_ARG_LIST
18 
19 #include "RooAbsCollection.h"
20 
21 class RooArgList : public RooAbsCollection {
22 public:
23 
24  // Constructors, assignment etc.
25  RooArgList();
26  RooArgList(const RooArgSet& set) ;
27  explicit RooArgList(const TCollection& tcoll, const char* name="") ;
28  explicit RooArgList(const char *name);
29  RooArgList(const RooAbsArg& var1,
30  const char *name="");
31  RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
32  const char *name="");
33  RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
34  const RooAbsArg& var3,
35  const char *name="");
36  RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
37  const RooAbsArg& var3, const RooAbsArg& var4,
38  const char *name="");
39  RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
40  const RooAbsArg& var3, const RooAbsArg& var4,
41  const RooAbsArg& var5,
42  const char *name="");
43  RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
44  const RooAbsArg& var3, const RooAbsArg& var4,
45  const RooAbsArg& var5, const RooAbsArg& var6,
46  const char *name="");
47  RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
48  const RooAbsArg& var3, const RooAbsArg& var4,
49  const RooAbsArg& var5, const RooAbsArg& var6,
50  const RooAbsArg& var7,
51  const char *name="");
52  RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
53  const RooAbsArg& var3, const RooAbsArg& var4,
54  const RooAbsArg& var5, const RooAbsArg& var6,
55  const RooAbsArg& var7, const RooAbsArg& var8,
56  const char *name="");
57  RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
58  const RooAbsArg& var3, const RooAbsArg& var4,
59  const RooAbsArg& var5, const RooAbsArg& var6,
60  const RooAbsArg& var7, const RooAbsArg& var8,
61  const RooAbsArg& var9, const char *name="");
62 
63  virtual ~RooArgList();
64  // Create a copy of an existing list. New variables cannot be added
65  // to a copied list. The variables in the copied list are independent
66  // of the original variables.
67  RooArgList(const RooArgList& other, const char *name="");
68  virtual TObject* clone(const char* newname) const { return new RooArgList(*this,newname); }
69  virtual TObject* create(const char* newname) const { return new RooArgList(newname); }
70  RooArgList& operator=(const RooArgList& other) { RooAbsCollection::operator=(other) ; return *this ; }
71 
72  inline void sort(Bool_t reverse=kFALSE) {
73  // Sort list in requested order
74  _list.Sort(!reverse) ;
75  }
76  inline Int_t index(const RooAbsArg* arg) const {
77  // Returns index of given arg, or -1 if arg is not in list
78  return _list.IndexOf(arg) ;
79  }
80  inline Int_t index(const char* name) const {
81  // Returns index of given arg, or -1 if arg is not in list
82  return _list.IndexOf(name) ;
83  }
84  inline RooAbsArg* at(Int_t idx) const {
85  // Return object at given index, or 0 if index is out of range
86  return (RooAbsArg*) _list.At(idx) ;
87  }
88 
89  // I/O streaming interface (machine readable)
90  virtual Bool_t readFromStream(std::istream& is, Bool_t compact, Bool_t verbose=kFALSE) ;
91  virtual void writeToStream(std::ostream& os, Bool_t compact) ;
92 
93  RooAbsArg& operator[](Int_t idx) const ;
94 
95 protected:
96 
97  ClassDef(RooArgList,1) // Ordered list of RooAbsArg objects
98 };
99 
100 #endif
Int_t IndexOf(const char *name) const
Return position of given object in list.
void sort(Bool_t reverse=kFALSE)
Definition: RooArgList.h:72
Int_t index(const RooAbsArg *arg) const
Definition: RooArgList.h:76
virtual ~RooArgList()
Destructor.
Definition: RooArgList.cxx:267
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read the contents of the argset in ASCII form from given stream.
Definition: RooArgList.cxx:327
virtual TObject * clone(const char *newname) const
Definition: RooArgList.h:68
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void Sort(Bool_t ascend=kTRUE)
#define ClassDef(name, id)
Definition: Rtypes.h:297
virtual TObject * create(const char *newname) const
Definition: RooArgList.h:69
virtual void writeToStream(std::ostream &os, Bool_t compact)
Write the contents of the argset in ASCII form to given stream.
Definition: RooArgList.cxx:301
RooAbsArg & operator[](Int_t idx) const
Array operator.
Definition: RooArgList.cxx:281
RooAbsArg * at(Int_t idx) const
Definition: RooArgList.h:84
TObject * At(Int_t index) const
Return object stored in sequential position given by index.
RooArgList & operator=(const RooArgList &other)
Definition: RooArgList.h:70
Collection abstract base class.
Definition: TCollection.h:42
bool verbose
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooArgList()
Default constructor.
Definition: RooArgList.cxx:64
RooLinkedList _list
Int_t index(const char *name) const
Definition: RooArgList.h:80
Mother of all ROOT objects.
Definition: TObject.h:37
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects...
RooAbsCollection & operator=(const RooAbsCollection &other)
The assignment operator sets the value of any argument in our set that also appears in the other set...
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66