Warning, file /include/root/RooMappedCategory.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROO_MAPPED_CATEGORY
0017 #define ROO_MAPPED_CATEGORY
0018
0019 #include "RooAbsCategory.h"
0020 #include "RooCategoryProxy.h"
0021 #include <map>
0022 #include <string>
0023
0024 class TRegexp;
0025 class RooMappedCategoryCache;
0026
0027 class RooMappedCategory : public RooAbsCategory {
0028 public:
0029 static constexpr value_type NoCatIdx = std::numeric_limits<value_type>::min();
0030
0031
0032 RooMappedCategory();
0033 RooMappedCategory(const char *name, const char *title, RooAbsCategory& inputCat, const char* defCatName="NotMapped", Int_t defCatIdx=NoCatIdx);
0034 RooMappedCategory(const RooMappedCategory& other, const char *name=nullptr) ;
0035 TObject* clone(const char* newname) const override { return new RooMappedCategory(*this,newname); }
0036 ~RooMappedCategory() override;
0037
0038
0039 bool map(const char* inKeyRegExp, const char* outKeyName, Int_t outKeyNum=NoCatIdx) ;
0040
0041
0042 void printMultiline(std::ostream& os, Int_t content, bool verbose=false, TString indent="") const override ;
0043 void printMetaArgs(std::ostream& os) const override ;
0044
0045
0046 bool readFromStream(std::istream& is, bool compact, bool verbose=false) override ;
0047 void writeToStream(std::ostream& os, bool compact) const override ;
0048
0049
0050 class Entry {
0051 public:
0052 inline Entry() : _catIdx() {}
0053 virtual ~Entry();
0054 Entry(const char* exp, RooAbsCategory::value_type cat);
0055 Entry(const Entry& other);
0056 bool ok();
0057 bool match(const char* testPattern) const;
0058 Entry& operator=(const Entry& other);
0059 RooAbsCategory::value_type outCat() const { return _catIdx; }
0060 const TRegexp* regexp() const;
0061
0062 protected:
0063
0064 TString mangle(const char* exp) const ;
0065
0066 TString _expr ;
0067 mutable TRegexp* _regexp{nullptr};
0068 RooAbsCategory::value_type _catIdx;
0069
0070 ClassDef(Entry, 2)
0071 };
0072
0073 protected:
0074
0075 value_type _defCat{NoCatIdx};
0076 RooCategoryProxy _inputCat ;
0077 std::map<std::string,RooMappedCategory::Entry> _mapArray ;
0078 mutable std::unique_ptr<RooMappedCategoryCache> _mapcache;
0079
0080 value_type evaluate() const override ;
0081 const RooMappedCategoryCache* getOrCreateCache() const;
0082
0083
0084 void recomputeShape() override;
0085
0086 friend class RooMappedCategoryCache;
0087
0088 private:
0089 inline void setDefCat(value_type defCat) { _defCat = defCat; }
0090
0091 ClassDefOverride(RooMappedCategory, 2)
0092 };
0093
0094 #endif