44using std::endl, std::ostream;
58 for (
const auto arg : inputCategories) {
60 coutE(InputArguments) <<
"RooMultiCategory::RooMultiCategory(" <<
GetName() <<
"): input argument " << arg->GetName()
61 <<
" is not a RooAbsCategory" << std::endl ;
87 for (
const auto arg :
_catSet) {
90 label += first ?
'{' :
';';
91 label += cat->getCurrentLabel();
109 for (
const auto arg :
_catSet) {
112 coutW(InputArguments) << __func__ <<
" Trying to build a multi-category state based on "
113 "a category with zero states. Fix '" << cat->GetName() <<
"'." << std::endl;
116 computedStateIndex += cat->getCurrentOrdinalNumber() * multiplier;
117 multiplier *= cat->size();
120 return computedStateIndex;
133 os <<
indent <<
"--- RooMultiCategory ---" << std::endl;
134 os <<
indent <<
" Input category list:" << std::endl ;
157 return item.first.c_str();
172 unsigned int totalSize = 1;
173 for (
const auto arg :
_catSet) {
175 totalSize *= cat->size();
178 for (
unsigned int i=0; i < totalSize; ++i) {
179 unsigned int workingIndex = i;
180 std::string catName =
"{";
181 for (
const auto arg :
_catSet) {
183 unsigned int thisStateOrdinal = workingIndex % cat->size();
184 const auto& thisState = cat->getOrdinal(thisStateOrdinal);
185 catName += thisState.first +
';';
186 workingIndex = (workingIndex - thisStateOrdinal) / cat->size();
188 catName[catName.size()-1] =
'}';
int Int_t
Signed integer 4 bytes (int).
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.
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.
int value_type
The type used to denote a specific category state.
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.
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.
const char * GetName() const override
Returns name of object.
const char * Data() const
TString & Append(const char *cs)