// Class RooThresholdCategory provides a real-to-category mapping defined
// by a series of thresholds.
// END_HTML
#include "RooFit.h"
#include "Riostream.h"
#include "Riostream.h"
#include <stdlib.h>
#include <stdio.h>
#include "TString.h"
#include "RooThresholdCategory.h"
#include "RooStreamParser.h"
#include "RooThreshEntry.h"
#include "RooMsgService.h"
using namespace std;
ClassImp(RooThresholdCategory)
RooThresholdCategory::RooThresholdCategory(const char *name, const char *title, RooAbsReal& inputVar,
const char* defOut, Int_t defIdx) :
RooAbsCategory(name, title), _inputVar("inputVar","Input category",this,inputVar)
{
_defCat = (RooCatType*) defineType(defOut,defIdx) ;
_threshIter = _threshList.MakeIterator() ;
}
RooThresholdCategory::RooThresholdCategory(const RooThresholdCategory& other, const char *name) :
RooAbsCategory(other,name), _inputVar("inputVar",this,other._inputVar)
{
_defCat = (RooCatType*) lookupType(other._defCat->GetName()) ;
other._threshIter->Reset() ;
RooThreshEntry* te ;
while((te=(RooThreshEntry*)other._threshIter->Next())) {
_threshList.Add(new RooThreshEntry(*te)) ;
}
_threshIter = _threshList.MakeIterator() ;
}
RooThresholdCategory::~RooThresholdCategory()
{
_threshList.Delete() ;
delete _threshIter ;
}
Bool_t RooThresholdCategory::addThreshold(Double_t upperLimit, const char* catName, Int_t catIdx)
{
_threshIter->Reset() ;
RooThreshEntry* te ;
while ((te=(RooThreshEntry*)_threshIter->Next())) {
if (te->thresh() == upperLimit) {
coutW(InputArguments) << "RooThresholdCategory::addThreshold(" << GetName()
<< ") threshold at " << upperLimit << " already defined" << endl ;
return kTRUE ;
}
}
const RooCatType* type = lookupType(catName,kFALSE) ;
if (!type) {
if (catIdx==-99999) {
type=defineType(catName) ;
} else {
type=defineType(catName,catIdx) ;
}
}
te = new RooThreshEntry(upperLimit,*type) ;
_threshList.Add(te) ;
return kFALSE ;
}
RooCatType RooThresholdCategory::evaluate() const
{
_threshIter->Reset() ;
RooThreshEntry* te ;
while((te=(RooThreshEntry*)_threshIter->Next())) {
if (_inputVar<te->thresh()) return te->cat() ;
}
return *_defCat ;
}
void RooThresholdCategory::writeToStream(ostream& os, Bool_t compact) const
{
if (compact) {
os << getLabel() ;
} else {
_threshIter->Reset() ;
RooThreshEntry* te ;
while((te=(RooThreshEntry*)_threshIter->Next())) {
os << te->cat().GetName() << ":<" << te->thresh() << " " ;
}
os << _defCat->GetName() << ":*" ;
}
}
void RooThresholdCategory::printMultiline(ostream& os, Int_t content, Bool_t verbose, TString indent) const
{
RooAbsCategory::printMultiline(os,content,verbose,indent);
if (verbose) {
os << indent << "--- RooThresholdCategory ---" << endl
<< indent << " Maps from " ;
_inputVar.arg().printStream(os,0,kStandard);
os << indent << " Threshold list" << endl ;
_threshIter->Reset() ;
RooThreshEntry* te ;
while((te=(RooThreshEntry*)_threshIter->Next())) {
os << indent << " input < " << te->thresh() << " --> " ;
te->cat().printStream(os,kName|kValue,kSingleLine) ;
}
os << indent << " Default value is " ;
_defCat->printStream(os,kValue,kSingleLine);
}
}
RooThresholdCategory.cxx:1 RooThresholdCategory.cxx:2 RooThresholdCategory.cxx:3 RooThresholdCategory.cxx:4 RooThresholdCategory.cxx:5 RooThresholdCategory.cxx:6 RooThresholdCategory.cxx:7 RooThresholdCategory.cxx:8 RooThresholdCategory.cxx:9 RooThresholdCategory.cxx:10 RooThresholdCategory.cxx:11 RooThresholdCategory.cxx:12 RooThresholdCategory.cxx:13 RooThresholdCategory.cxx:14 RooThresholdCategory.cxx:15 RooThresholdCategory.cxx:16 RooThresholdCategory.cxx:17 RooThresholdCategory.cxx:18 RooThresholdCategory.cxx:19 RooThresholdCategory.cxx:20 RooThresholdCategory.cxx:21 RooThresholdCategory.cxx:22 RooThresholdCategory.cxx:23 RooThresholdCategory.cxx:24 RooThresholdCategory.cxx:25 RooThresholdCategory.cxx:26 RooThresholdCategory.cxx:27 RooThresholdCategory.cxx:28 RooThresholdCategory.cxx:29 RooThresholdCategory.cxx:30 RooThresholdCategory.cxx:31 RooThresholdCategory.cxx:32 RooThresholdCategory.cxx:33 RooThresholdCategory.cxx:34 RooThresholdCategory.cxx:35 RooThresholdCategory.cxx:36 RooThresholdCategory.cxx:37 RooThresholdCategory.cxx:38 RooThresholdCategory.cxx:39 RooThresholdCategory.cxx:40 RooThresholdCategory.cxx:41 RooThresholdCategory.cxx:42 RooThresholdCategory.cxx:43 RooThresholdCategory.cxx:44 RooThresholdCategory.cxx:45 RooThresholdCategory.cxx:46 RooThresholdCategory.cxx:47 RooThresholdCategory.cxx:48 RooThresholdCategory.cxx:49 RooThresholdCategory.cxx:50 RooThresholdCategory.cxx:51 RooThresholdCategory.cxx:52 RooThresholdCategory.cxx:53 RooThresholdCategory.cxx:54 RooThresholdCategory.cxx:55 RooThresholdCategory.cxx:56 RooThresholdCategory.cxx:57 RooThresholdCategory.cxx:58 RooThresholdCategory.cxx:59 RooThresholdCategory.cxx:60 RooThresholdCategory.cxx:61 RooThresholdCategory.cxx:62 RooThresholdCategory.cxx:63 RooThresholdCategory.cxx:64 RooThresholdCategory.cxx:65 RooThresholdCategory.cxx:66 RooThresholdCategory.cxx:67 RooThresholdCategory.cxx:68 RooThresholdCategory.cxx:69 RooThresholdCategory.cxx:70 RooThresholdCategory.cxx:71 RooThresholdCategory.cxx:72 RooThresholdCategory.cxx:73 RooThresholdCategory.cxx:74 RooThresholdCategory.cxx:75 RooThresholdCategory.cxx:76 RooThresholdCategory.cxx:77 RooThresholdCategory.cxx:78 RooThresholdCategory.cxx:79 RooThresholdCategory.cxx:80 RooThresholdCategory.cxx:81 RooThresholdCategory.cxx:82 RooThresholdCategory.cxx:83 RooThresholdCategory.cxx:84 RooThresholdCategory.cxx:85 RooThresholdCategory.cxx:86 RooThresholdCategory.cxx:87 RooThresholdCategory.cxx:88 RooThresholdCategory.cxx:89 RooThresholdCategory.cxx:90 RooThresholdCategory.cxx:91 RooThresholdCategory.cxx:92 RooThresholdCategory.cxx:93 RooThresholdCategory.cxx:94 RooThresholdCategory.cxx:95 RooThresholdCategory.cxx:96 RooThresholdCategory.cxx:97 RooThresholdCategory.cxx:98 RooThresholdCategory.cxx:99 RooThresholdCategory.cxx:100 RooThresholdCategory.cxx:101 RooThresholdCategory.cxx:102 RooThresholdCategory.cxx:103 RooThresholdCategory.cxx:104 RooThresholdCategory.cxx:105 RooThresholdCategory.cxx:106 RooThresholdCategory.cxx:107 RooThresholdCategory.cxx:108 RooThresholdCategory.cxx:109 RooThresholdCategory.cxx:110 RooThresholdCategory.cxx:111 RooThresholdCategory.cxx:112 RooThresholdCategory.cxx:113 RooThresholdCategory.cxx:114 RooThresholdCategory.cxx:115 RooThresholdCategory.cxx:116 RooThresholdCategory.cxx:117 RooThresholdCategory.cxx:118 RooThresholdCategory.cxx:119 RooThresholdCategory.cxx:120 RooThresholdCategory.cxx:121 RooThresholdCategory.cxx:122 RooThresholdCategory.cxx:123 RooThresholdCategory.cxx:124 RooThresholdCategory.cxx:125 RooThresholdCategory.cxx:126 RooThresholdCategory.cxx:127 RooThresholdCategory.cxx:128 RooThresholdCategory.cxx:129 RooThresholdCategory.cxx:130 RooThresholdCategory.cxx:131 RooThresholdCategory.cxx:132 RooThresholdCategory.cxx:133 RooThresholdCategory.cxx:134 RooThresholdCategory.cxx:135 RooThresholdCategory.cxx:136 RooThresholdCategory.cxx:137 RooThresholdCategory.cxx:138 RooThresholdCategory.cxx:139 RooThresholdCategory.cxx:140 RooThresholdCategory.cxx:141 RooThresholdCategory.cxx:142 RooThresholdCategory.cxx:143 RooThresholdCategory.cxx:144 RooThresholdCategory.cxx:145 RooThresholdCategory.cxx:146 RooThresholdCategory.cxx:147 RooThresholdCategory.cxx:148 RooThresholdCategory.cxx:149 RooThresholdCategory.cxx:150 RooThresholdCategory.cxx:151 RooThresholdCategory.cxx:152 RooThresholdCategory.cxx:153 RooThresholdCategory.cxx:154 RooThresholdCategory.cxx:155 RooThresholdCategory.cxx:156 RooThresholdCategory.cxx:157 RooThresholdCategory.cxx:158 RooThresholdCategory.cxx:159 RooThresholdCategory.cxx:160 RooThresholdCategory.cxx:161 RooThresholdCategory.cxx:162 RooThresholdCategory.cxx:163 RooThresholdCategory.cxx:164 RooThresholdCategory.cxx:165 RooThresholdCategory.cxx:166 RooThresholdCategory.cxx:167 RooThresholdCategory.cxx:168 RooThresholdCategory.cxx:169 RooThresholdCategory.cxx:170 RooThresholdCategory.cxx:171 RooThresholdCategory.cxx:172 RooThresholdCategory.cxx:173 RooThresholdCategory.cxx:174 RooThresholdCategory.cxx:175 RooThresholdCategory.cxx:176 RooThresholdCategory.cxx:177 RooThresholdCategory.cxx:178 RooThresholdCategory.cxx:179 RooThresholdCategory.cxx:180 RooThresholdCategory.cxx:181 RooThresholdCategory.cxx:182 RooThresholdCategory.cxx:183 RooThresholdCategory.cxx:184 RooThresholdCategory.cxx:185 RooThresholdCategory.cxx:186 RooThresholdCategory.cxx:187 RooThresholdCategory.cxx:188 RooThresholdCategory.cxx:189 RooThresholdCategory.cxx:190 RooThresholdCategory.cxx:191 RooThresholdCategory.cxx:192 RooThresholdCategory.cxx:193 RooThresholdCategory.cxx:194 RooThresholdCategory.cxx:195