59 for (
const auto arg : inputCategories) {
61 coutE(InputArguments) <<
"RooMultiCategory::RooMultiCategory(" <<
GetName() <<
"): input argument " << arg->
GetName()
62 <<
" is not a RooAbsCategory" << endl ;
98 for (
const auto arg :
_catSet) {
101 label +=
first ?
'{' :
';';
102 label += cat->getCurrentLabel();
120 for (
const auto arg :
_catSet) {
123 coutW(InputArguments) << __func__ <<
" Trying to build a multi-category state based on "
124 "a category with zero states. Fix '" << cat->
GetName() <<
"'." << std::endl;
127 computedStateIndex += cat->getCurrentOrdinalNumber() * multiplier;
128 multiplier *= cat->size();
131 return computedStateIndex;
144 os <<
indent <<
"--- RooMultiCategory ---" << endl;
145 os <<
indent <<
" Input category list:" << endl ;
168 return item.first.c_str();
183 unsigned int totalSize = 1;
184 for (
const auto arg :
_catSet) {
186 totalSize *= cat->size();
189 for (
unsigned int i=0; i < totalSize; ++i) {
190 unsigned int workingIndex = i;
191 std::string catName =
"{";
192 for (
const auto arg :
_catSet) {
194 unsigned int thisStateOrdinal = workingIndex % cat->size();
195 const auto& thisState = cat->getOrdinal(thisStateOrdinal);
196 catName += thisState.first +
';';
197 workingIndex = (workingIndex - thisStateOrdinal) / cat->size();
199 catName[catName.size()-1] =
'}';
static void indent(ostringstream &buf, int indent_level)
void setShapeDirty()
Notify that a shape-like property (e.g. binning) has changed.
void setValueDirty()
Mark the element dirty. This forces a re-evaluation when a value is requested.
A space to attach TBranches.
virtual value_type getCurrentIndex() const
Return index number of current state.
void defineStateUnchecked(const std::string &label, value_type index)
Internal version of defineState() that does not check if type already exists.
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to ostream.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Print info about this object to the specified stream.
std::vector< std::string > _insertionOrder
Keeps track in which order state numbers have been inserted. Make sure this is updated in recomputeSh...
std::map< std::string, value_type > _stateNames
Map state names to index numbers. Make sure state names are updated in recomputeShape().
const std::map< std::string, value_type > & stateNames() const
Access the map of state names to index numbers.
void clearTypes()
Delete all currently defined states.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
RooMultiCategory connects several RooAbsCategory objects into a single category.
value_type evaluate() const override
Calculate the current value.
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override
Print the state of this object to the specified output stream.
const char * getCurrentLabel() const override
Get current label.
std::string createLabel() const
Compile a string with all the labels of the serving categories, such as {1Jet;1Lepton;2Tag}.
RooSetProxy _catSet
Set of input category.
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to given stream.
void recomputeShape() override
Inspect all the subcategories, and enumerate and name their states.
~RooMultiCategory() override
Destructor.
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
const char * GetName() const override
Returns name of object.
const char * Data() const
TString & Append(const char *cs)