Logo ROOT  
Reference Guide
RooSuperCategory.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooSuperCategory.h,v 1.17 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_SUPER_CATEGORY
17 #define ROO_SUPER_CATEGORY
18 
19 class TObject ;
20 class TIterator;
21 #include "RooMultiCategory.h"
22 #include "RooAbsCategoryLValue.h"
23 #include "RooArgSet.h"
24 #include "RooTemplateProxy.h"
25 
26 
28 public:
29  // Constructors etc.
31  RooSuperCategory(const char *name, const char *title, const RooArgSet& inputCatList);
32  RooSuperCategory(const RooSuperCategory& other, const char *name=0) ;
33  virtual TObject* clone(const char* newname) const override { return new RooSuperCategory(*this,newname); }
34  virtual ~RooSuperCategory() { };
35 
36  virtual bool setIndex(value_type index, bool printError = true) override ;
38  virtual Bool_t setLabel(const char* label, Bool_t printError=kTRUE) override;
40 
41  // Printing interface (human readable)
42  virtual void printMultiline(std::ostream& os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const override;
43 
44  /// \deprecated Use begin(), end() or range-based for loops to iterate through state names.
45  TIterator* MakeIterator() const ;
46  const RooArgSet& inputCatList() const { return _multiCat->inputCatList(); }
47 
48  virtual Bool_t inRange(const char* rangeName) const override;
49  virtual Bool_t hasRange(const char* rangeName) const override;
50 
51 protected:
52  value_type evaluate() const override {
53  return _multiCat->getCurrentIndex();
54  }
55 
56  /// Ask server category to recompute shape, and copy its information.
57  void recomputeShape() override {
58  // Propagate up
59  setShapeDirty();
63  }
64 
65 
66 private:
68 
69  ClassDefOverride(RooSuperCategory,2) // Lvalue product operator for category lvalues
70 };
71 
72 #endif
RooSuperCategory::recomputeShape
void recomputeShape() override
Ask server category to recompute shape, and copy its information.
Definition: RooSuperCategory.h:57
RooMultiCategory::recomputeShape
void recomputeShape() override
Inspect all the subcategories, and enumerate and name their states.
Definition: RooMultiCategory.cxx:204
RooSuperCategory::MakeIterator
TIterator * MakeIterator() const
Make an iterator over all state permutations of the input categories of this supercategory.
Definition: RooSuperCategory.cxx:93
RooSuperCategory::printMultiline
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const override
Print the state of this object to the specified output stream.
Definition: RooSuperCategory.cxx:142
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooAbsCategory::getCurrentIndex
virtual value_type getCurrentIndex() const
Return index number of current state.
Definition: RooAbsCategory.cxx:114
RooAbsCategoryLValue::setLabel
virtual bool setLabel(const char *label, Bool_t printError=kTRUE)=0
Change category state by specifying a state name.
RooArgSet.h
RooAbsCategory::value_type
int value_type
The type used to denote a specific category state.
Definition: RooAbsCategory.h:41
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
RooSuperCategory::setIndex
virtual bool setIndex(value_type index, bool printError=true)=0
Change category state by specifying the index code of the desired state.
RooSuperCategory::~RooSuperCategory
virtual ~RooSuperCategory()
Definition: RooSuperCategory.h:34
RooTemplateProxy.h
TString
Basic string class.
Definition: TString.h:136
ClassDefOverride
#define ClassDefOverride(name, id)
Definition: Rtypes.h:329
bool
TIterator
Iterator abstract base class.
Definition: TIterator.h:30
RooSuperCategory::setLabel
virtual bool setLabel(const char *label, Bool_t printError=kTRUE)=0
Change category state by specifying a state name.
RooAbsCategoryLValue::setIndex
virtual bool setIndex(value_type index, bool printError=true)=0
Change category state by specifying the index code of the desired state.
RooMultiCategory.h
RooSuperCategory::_multiCat
RooTemplateProxy< RooMultiCategory > _multiCat
Definition: RooSuperCategory.h:67
RooSuperCategory::evaluate
value_type evaluate() const override
Evaluate the category state and return.
Definition: RooSuperCategory.h:52
RooSuperCategory::RooSuperCategory
RooSuperCategory()
Definition: RooSuperCategory.cxx:49
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooAbsCategory::_stateNames
std::map< std::string, value_type > _stateNames
Current category state.
Definition: RooAbsCategory.h:220
RooSuperCategory::inputCatList
const RooArgSet & inputCatList() const
Definition: RooSuperCategory.h:46
RooMultiCategory::inputCatList
const RooArgSet & inputCatList() const
Definition: RooMultiCategory.h:44
RooAbsCategory::_insertionOrder
std::vector< std::string > _insertionOrder
Map state names to index numbers. Make sure state names are updated in recomputeShape().
Definition: RooAbsCategory.h:221
RooTemplateProxy< RooMultiCategory >
RooSuperCategory::inRange
virtual Bool_t inRange(const char *rangeName) const override
Check that all input category states are in the given range.
Definition: RooSuperCategory.cxx:158
RooAbsArg::setShapeDirty
void setShapeDirty()
Notify that a shape-like property (e.g. binning) has changed.
Definition: RooAbsArg.h:512
RooSuperCategory::hasRange
virtual Bool_t hasRange(const char *rangeName) const override
Check that any of the input categories has a range with the given name.
Definition: RooSuperCategory.cxx:173
RooAbsCategoryLValue.h
RooSuperCategory
The RooSuperCategory can join several RooAbsCategoryLValue objects into a single category.
Definition: RooSuperCategory.h:27
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
name
char name[80]
Definition: TGX11.cxx:110
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
RooAbsCategoryLValue
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
Definition: RooAbsCategoryLValue.h:25
RooSuperCategory::clone
virtual TObject * clone(const char *newname) const override
Definition: RooSuperCategory.h:33
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
int