// RooCompositeDataStore is the abstract base class for data collection that
// use a TTree as internal storage mechanism
// END_HTML
#include "RooFit.h"
#include "RooMsgService.h"
#include "RooCompositeDataStore.h"
#include "Riostream.h"
#include "TTree.h"
#include "TChain.h"
#include "TDirectory.h"
#include "TROOT.h"
#include "RooFormulaVar.h"
#include "RooRealVar.h"
#include "RooCategory.h"
#include <iomanip>
using namespace std ;
ClassImp(RooCompositeDataStore)
;
RooCompositeDataStore::RooCompositeDataStore() : _curStore(0), _curIndex(0)
{
}
RooCompositeDataStore::RooCompositeDataStore(const char* name, const char* title, const RooArgSet& vars, RooCategory& indexCat,map<string,RooAbsDataStore*> inputData) :
RooAbsDataStore(name,title,RooArgSet(vars,indexCat)), _dataMap(inputData), _indexCat(&indexCat), _curStore(0), _curIndex(0)
{
}
RooCompositeDataStore::RooCompositeDataStore(const RooCompositeDataStore& other, const char* newname) :
RooAbsDataStore(other,newname), _dataMap(other._dataMap), _indexCat(other._indexCat), _curStore(other._curStore), _curIndex(other._curIndex)
{
}
RooCompositeDataStore::RooCompositeDataStore(const RooCompositeDataStore& other, const RooArgSet& vars, const char* newname) :
RooAbsDataStore(other,vars,newname), _dataMap(other._dataMap), _indexCat(other._indexCat), _curStore(other._curStore), _curIndex(other._curIndex)
{
}
RooCompositeDataStore::~RooCompositeDataStore()
{
}
Bool_t RooCompositeDataStore::valid() const
{
return kTRUE ;
}
Int_t RooCompositeDataStore::fill()
{
RooAbsDataStore* subset = _dataMap[_indexCat->getLabel()] ;
*const_cast<RooArgSet*>((subset->get())) = _vars ;
return subset->fill() ;
}
const RooArgSet* RooCompositeDataStore::get(Int_t index) const
{
Int_t offset(0) ;
map<string,RooAbsDataStore*>::const_iterator iter ;
for (iter = _dataMap.begin() ; iter!=_dataMap.end() ; ++iter) {
if (index>=(offset+iter->second->numEntries())) {
offset += iter->second->numEntries() ;
continue ;
}
const_cast<RooCompositeDataStore*>(this)->_vars = (*iter->second->get(index-offset)) ;
_indexCat->setLabel(iter->first.c_str()) ;
_curStore = iter->second ;
_curIndex = index-offset ;
return &_vars ;
}
return 0 ;
}
Double_t RooCompositeDataStore::weight() const
{
if (!_curStore) get(0) ;
return _curStore->weight(_curIndex) ;
}
Double_t RooCompositeDataStore::weight(Int_t index) const
{
get(index) ;
return weight() ;
}
Double_t RooCompositeDataStore::weightError(RooAbsData::ErrorType etype) const
{
if (!_curStore) get(0) ;
return _curStore->weightError(etype) ;
}
void RooCompositeDataStore::weightError(Double_t& lo, Double_t& hi, RooAbsData::ErrorType etype) const
{
if (!_curStore) get(0) ;
return _curStore->weightError(lo,hi,etype) ;
}
Bool_t RooCompositeDataStore::isWeighted() const
{
map<string,RooAbsDataStore*>::const_iterator iter ;
for (iter = _dataMap.begin() ; iter!=_dataMap.end() ; ++iter) {
if (iter->second->isWeighted()) return kTRUE ;
}
return kFALSE ; ;
}
Bool_t RooCompositeDataStore::changeObservableName(const char* from, const char* to)
{
RooAbsArg* var = _vars.find(from) ;
if (!var) {
coutE(InputArguments) << "RooCompositeDataStore::changeObservableName(" << GetName() << " no observable " << from << " in this dataset" << endl ;
return kTRUE ;
}
var->SetName(to) ;
Bool_t ret(kFALSE) ;
map<string,RooAbsDataStore*>::const_iterator iter ;
for (iter = _dataMap.begin() ; iter!=_dataMap.end() ; ++iter) {
ret |= iter->second->changeObservableName(from,to) ;
}
return ret ;
}
RooAbsArg* RooCompositeDataStore::addColumn(RooAbsArg& newVar, Bool_t adjustRange)
{
RooAbsArg* ret(0) ;
map<string,RooAbsDataStore*>::const_iterator iter ;
for (iter = _dataMap.begin() ; iter!=_dataMap.end() ; ++iter) {
ret = iter->second->addColumn(newVar,adjustRange) ;
}
return ret ;
}
RooArgSet* RooCompositeDataStore::addColumns(const RooArgList& varList)
{
RooArgSet* ret(0) ;
map<string,RooAbsDataStore*>::const_iterator iter ;
for (iter = _dataMap.begin() ; iter!=_dataMap.end() ; ++iter) {
ret = iter->second->addColumns(varList) ;
}
return ret ;
}
RooAbsDataStore* RooCompositeDataStore::merge(const RooArgSet& , list<RooAbsDataStore*> )
{
throw string("RooCompositeDataStore::merge() is not implemented yet") ;
}
void RooCompositeDataStore::append(RooAbsDataStore& other)
{
Int_t nevt = other.numEntries() ;
for (int i=0 ; i<nevt ; i++) {
_vars = *other.get(i) ;
fill() ;
}
}
Int_t RooCompositeDataStore::numEntries() const
{
Int_t n(0) ;
map<string,RooAbsDataStore*>::const_iterator iter ;
for (iter = _dataMap.begin() ; iter!=_dataMap.end() ; ++iter) {
n += iter->second->numEntries() ;
}
return n ;
}
void RooCompositeDataStore::reset()
{
map<string,RooAbsDataStore*>::const_iterator iter ;
for (iter = _dataMap.begin() ; iter!=_dataMap.end() ; ++iter) {
iter->second->reset() ;
}
}
void RooCompositeDataStore::cacheArgs(const RooAbsArg* owner, RooArgSet& newVarSet, const RooArgSet* nset)
{
map<string,RooAbsDataStore*>::const_iterator iter ;
for (iter = _dataMap.begin() ; iter!=_dataMap.end() ; ++iter) {
iter->second->cacheArgs(owner,newVarSet,nset) ;
}
}
void RooCompositeDataStore::setArgStatus(const RooArgSet& set, Bool_t active)
{
map<string,RooAbsDataStore*>::const_iterator iter ;
for (iter = _dataMap.begin() ; iter!=_dataMap.end() ; ++iter) {
RooArgSet* subset = (RooArgSet*) set.selectCommon(*iter->second->get()) ;
iter->second->setArgStatus(*subset,active) ;
delete subset ;
}
return ;
}
void RooCompositeDataStore::attachCache(const RooAbsArg* newOwner, const RooArgSet& inCachedVars)
{
map<string,RooAbsDataStore*>::const_iterator iter ;
for (iter = _dataMap.begin() ; iter!=_dataMap.end() ; ++iter) {
iter->second->attachCache(newOwner,inCachedVars) ;
}
return ;
}
void RooCompositeDataStore::resetCache()
{
map<string,RooAbsDataStore*>::const_iterator iter ;
for (iter = _dataMap.begin() ; iter!=_dataMap.end() ; ++iter) {
iter->second->resetCache() ;
}
return ;
}
RooCompositeDataStore.cxx:1 RooCompositeDataStore.cxx:2 RooCompositeDataStore.cxx:3 RooCompositeDataStore.cxx:4 RooCompositeDataStore.cxx:5 RooCompositeDataStore.cxx:6 RooCompositeDataStore.cxx:7 RooCompositeDataStore.cxx:8 RooCompositeDataStore.cxx:9 RooCompositeDataStore.cxx:10 RooCompositeDataStore.cxx:11 RooCompositeDataStore.cxx:12 RooCompositeDataStore.cxx:13 RooCompositeDataStore.cxx:14 RooCompositeDataStore.cxx:15 RooCompositeDataStore.cxx:16 RooCompositeDataStore.cxx:17 RooCompositeDataStore.cxx:18 RooCompositeDataStore.cxx:19 RooCompositeDataStore.cxx:20 RooCompositeDataStore.cxx:21 RooCompositeDataStore.cxx:22 RooCompositeDataStore.cxx:23 RooCompositeDataStore.cxx:24 RooCompositeDataStore.cxx:25 RooCompositeDataStore.cxx:26 RooCompositeDataStore.cxx:27 RooCompositeDataStore.cxx:28 RooCompositeDataStore.cxx:29 RooCompositeDataStore.cxx:30 RooCompositeDataStore.cxx:31 RooCompositeDataStore.cxx:32 RooCompositeDataStore.cxx:33 RooCompositeDataStore.cxx:34 RooCompositeDataStore.cxx:35 RooCompositeDataStore.cxx:36 RooCompositeDataStore.cxx:37 RooCompositeDataStore.cxx:38 RooCompositeDataStore.cxx:39 RooCompositeDataStore.cxx:40 RooCompositeDataStore.cxx:41 RooCompositeDataStore.cxx:42 RooCompositeDataStore.cxx:43 RooCompositeDataStore.cxx:44 RooCompositeDataStore.cxx:45 RooCompositeDataStore.cxx:46 RooCompositeDataStore.cxx:47 RooCompositeDataStore.cxx:48 RooCompositeDataStore.cxx:49 RooCompositeDataStore.cxx:50 RooCompositeDataStore.cxx:51 RooCompositeDataStore.cxx:52 RooCompositeDataStore.cxx:53 RooCompositeDataStore.cxx:54 RooCompositeDataStore.cxx:55 RooCompositeDataStore.cxx:56 RooCompositeDataStore.cxx:57 RooCompositeDataStore.cxx:58 RooCompositeDataStore.cxx:59 RooCompositeDataStore.cxx:60 RooCompositeDataStore.cxx:61 RooCompositeDataStore.cxx:62 RooCompositeDataStore.cxx:63 RooCompositeDataStore.cxx:64 RooCompositeDataStore.cxx:65 RooCompositeDataStore.cxx:66 RooCompositeDataStore.cxx:67 RooCompositeDataStore.cxx:68 RooCompositeDataStore.cxx:69 RooCompositeDataStore.cxx:70 RooCompositeDataStore.cxx:71 RooCompositeDataStore.cxx:72 RooCompositeDataStore.cxx:73 RooCompositeDataStore.cxx:74 RooCompositeDataStore.cxx:75 RooCompositeDataStore.cxx:76 RooCompositeDataStore.cxx:77 RooCompositeDataStore.cxx:78 RooCompositeDataStore.cxx:79 RooCompositeDataStore.cxx:80 RooCompositeDataStore.cxx:81 RooCompositeDataStore.cxx:82 RooCompositeDataStore.cxx:83 RooCompositeDataStore.cxx:84 RooCompositeDataStore.cxx:85 RooCompositeDataStore.cxx:86 RooCompositeDataStore.cxx:87 RooCompositeDataStore.cxx:88 RooCompositeDataStore.cxx:89 RooCompositeDataStore.cxx:90 RooCompositeDataStore.cxx:91 RooCompositeDataStore.cxx:92 RooCompositeDataStore.cxx:93 RooCompositeDataStore.cxx:94 RooCompositeDataStore.cxx:95 RooCompositeDataStore.cxx:96 RooCompositeDataStore.cxx:97 RooCompositeDataStore.cxx:98 RooCompositeDataStore.cxx:99 RooCompositeDataStore.cxx:100 RooCompositeDataStore.cxx:101 RooCompositeDataStore.cxx:102 RooCompositeDataStore.cxx:103 RooCompositeDataStore.cxx:104 RooCompositeDataStore.cxx:105 RooCompositeDataStore.cxx:106 RooCompositeDataStore.cxx:107 RooCompositeDataStore.cxx:108 RooCompositeDataStore.cxx:109 RooCompositeDataStore.cxx:110 RooCompositeDataStore.cxx:111 RooCompositeDataStore.cxx:112 RooCompositeDataStore.cxx:113 RooCompositeDataStore.cxx:114 RooCompositeDataStore.cxx:115 RooCompositeDataStore.cxx:116 RooCompositeDataStore.cxx:117 RooCompositeDataStore.cxx:118 RooCompositeDataStore.cxx:119 RooCompositeDataStore.cxx:120 RooCompositeDataStore.cxx:121 RooCompositeDataStore.cxx:122 RooCompositeDataStore.cxx:123 RooCompositeDataStore.cxx:124 RooCompositeDataStore.cxx:125 RooCompositeDataStore.cxx:126 RooCompositeDataStore.cxx:127 RooCompositeDataStore.cxx:128 RooCompositeDataStore.cxx:129 RooCompositeDataStore.cxx:130 RooCompositeDataStore.cxx:131 RooCompositeDataStore.cxx:132 RooCompositeDataStore.cxx:133 RooCompositeDataStore.cxx:134 RooCompositeDataStore.cxx:135 RooCompositeDataStore.cxx:136 RooCompositeDataStore.cxx:137 RooCompositeDataStore.cxx:138 RooCompositeDataStore.cxx:139 RooCompositeDataStore.cxx:140 RooCompositeDataStore.cxx:141 RooCompositeDataStore.cxx:142 RooCompositeDataStore.cxx:143 RooCompositeDataStore.cxx:144 RooCompositeDataStore.cxx:145 RooCompositeDataStore.cxx:146 RooCompositeDataStore.cxx:147 RooCompositeDataStore.cxx:148 RooCompositeDataStore.cxx:149 RooCompositeDataStore.cxx:150 RooCompositeDataStore.cxx:151 RooCompositeDataStore.cxx:152 RooCompositeDataStore.cxx:153 RooCompositeDataStore.cxx:154 RooCompositeDataStore.cxx:155 RooCompositeDataStore.cxx:156 RooCompositeDataStore.cxx:157 RooCompositeDataStore.cxx:158 RooCompositeDataStore.cxx:159 RooCompositeDataStore.cxx:160 RooCompositeDataStore.cxx:161 RooCompositeDataStore.cxx:162 RooCompositeDataStore.cxx:163 RooCompositeDataStore.cxx:164 RooCompositeDataStore.cxx:165 RooCompositeDataStore.cxx:166 RooCompositeDataStore.cxx:167 RooCompositeDataStore.cxx:168 RooCompositeDataStore.cxx:169 RooCompositeDataStore.cxx:170 RooCompositeDataStore.cxx:171 RooCompositeDataStore.cxx:172 RooCompositeDataStore.cxx:173 RooCompositeDataStore.cxx:174 RooCompositeDataStore.cxx:175 RooCompositeDataStore.cxx:176 RooCompositeDataStore.cxx:177 RooCompositeDataStore.cxx:178 RooCompositeDataStore.cxx:179 RooCompositeDataStore.cxx:180 RooCompositeDataStore.cxx:181 RooCompositeDataStore.cxx:182 RooCompositeDataStore.cxx:183 RooCompositeDataStore.cxx:184 RooCompositeDataStore.cxx:185 RooCompositeDataStore.cxx:186 RooCompositeDataStore.cxx:187 RooCompositeDataStore.cxx:188 RooCompositeDataStore.cxx:189 RooCompositeDataStore.cxx:190 RooCompositeDataStore.cxx:191 RooCompositeDataStore.cxx:192 RooCompositeDataStore.cxx:193 RooCompositeDataStore.cxx:194 RooCompositeDataStore.cxx:195 RooCompositeDataStore.cxx:196 RooCompositeDataStore.cxx:197 RooCompositeDataStore.cxx:198 RooCompositeDataStore.cxx:199 RooCompositeDataStore.cxx:200 RooCompositeDataStore.cxx:201 RooCompositeDataStore.cxx:202 RooCompositeDataStore.cxx:203 RooCompositeDataStore.cxx:204 RooCompositeDataStore.cxx:205 RooCompositeDataStore.cxx:206 RooCompositeDataStore.cxx:207 RooCompositeDataStore.cxx:208 RooCompositeDataStore.cxx:209 RooCompositeDataStore.cxx:210 RooCompositeDataStore.cxx:211 RooCompositeDataStore.cxx:212 RooCompositeDataStore.cxx:213 RooCompositeDataStore.cxx:214 RooCompositeDataStore.cxx:215 RooCompositeDataStore.cxx:216 RooCompositeDataStore.cxx:217 RooCompositeDataStore.cxx:218 RooCompositeDataStore.cxx:219 RooCompositeDataStore.cxx:220 RooCompositeDataStore.cxx:221 RooCompositeDataStore.cxx:222 RooCompositeDataStore.cxx:223 RooCompositeDataStore.cxx:224 RooCompositeDataStore.cxx:225 RooCompositeDataStore.cxx:226 RooCompositeDataStore.cxx:227 RooCompositeDataStore.cxx:228 RooCompositeDataStore.cxx:229 RooCompositeDataStore.cxx:230 RooCompositeDataStore.cxx:231 RooCompositeDataStore.cxx:232 RooCompositeDataStore.cxx:233 RooCompositeDataStore.cxx:234 RooCompositeDataStore.cxx:235 RooCompositeDataStore.cxx:236 RooCompositeDataStore.cxx:237 RooCompositeDataStore.cxx:238 RooCompositeDataStore.cxx:239 RooCompositeDataStore.cxx:240 RooCompositeDataStore.cxx:241 RooCompositeDataStore.cxx:242 RooCompositeDataStore.cxx:243 RooCompositeDataStore.cxx:244 RooCompositeDataStore.cxx:245 RooCompositeDataStore.cxx:246 RooCompositeDataStore.cxx:247 RooCompositeDataStore.cxx:248 RooCompositeDataStore.cxx:249 RooCompositeDataStore.cxx:250 RooCompositeDataStore.cxx:251 RooCompositeDataStore.cxx:252 RooCompositeDataStore.cxx:253 RooCompositeDataStore.cxx:254 RooCompositeDataStore.cxx:255 RooCompositeDataStore.cxx:256 RooCompositeDataStore.cxx:257 RooCompositeDataStore.cxx:258 RooCompositeDataStore.cxx:259 RooCompositeDataStore.cxx:260 RooCompositeDataStore.cxx:261 RooCompositeDataStore.cxx:262 RooCompositeDataStore.cxx:263 RooCompositeDataStore.cxx:264 RooCompositeDataStore.cxx:265 RooCompositeDataStore.cxx:266 RooCompositeDataStore.cxx:267 RooCompositeDataStore.cxx:268 RooCompositeDataStore.cxx:269 RooCompositeDataStore.cxx:270 RooCompositeDataStore.cxx:271 RooCompositeDataStore.cxx:272 RooCompositeDataStore.cxx:273 RooCompositeDataStore.cxx:274 RooCompositeDataStore.cxx:275 RooCompositeDataStore.cxx:276 RooCompositeDataStore.cxx:277 RooCompositeDataStore.cxx:278 RooCompositeDataStore.cxx:279 RooCompositeDataStore.cxx:280 RooCompositeDataStore.cxx:281 RooCompositeDataStore.cxx:282 RooCompositeDataStore.cxx:283 RooCompositeDataStore.cxx:284 RooCompositeDataStore.cxx:285 RooCompositeDataStore.cxx:286 RooCompositeDataStore.cxx:287 RooCompositeDataStore.cxx:288 RooCompositeDataStore.cxx:289 RooCompositeDataStore.cxx:290 RooCompositeDataStore.cxx:291 RooCompositeDataStore.cxx:292 RooCompositeDataStore.cxx:293 RooCompositeDataStore.cxx:294 RooCompositeDataStore.cxx:295 RooCompositeDataStore.cxx:296 RooCompositeDataStore.cxx:297 RooCompositeDataStore.cxx:298 RooCompositeDataStore.cxx:299 RooCompositeDataStore.cxx:300 RooCompositeDataStore.cxx:301 RooCompositeDataStore.cxx:302 RooCompositeDataStore.cxx:303 RooCompositeDataStore.cxx:304 RooCompositeDataStore.cxx:305 RooCompositeDataStore.cxx:306 RooCompositeDataStore.cxx:307 RooCompositeDataStore.cxx:308 RooCompositeDataStore.cxx:309 RooCompositeDataStore.cxx:310 RooCompositeDataStore.cxx:311 RooCompositeDataStore.cxx:312 RooCompositeDataStore.cxx:313 RooCompositeDataStore.cxx:314 RooCompositeDataStore.cxx:315 RooCompositeDataStore.cxx:316 RooCompositeDataStore.cxx:317 RooCompositeDataStore.cxx:318 RooCompositeDataStore.cxx:319 RooCompositeDataStore.cxx:320 RooCompositeDataStore.cxx:321 RooCompositeDataStore.cxx:322 RooCompositeDataStore.cxx:323 RooCompositeDataStore.cxx:324 RooCompositeDataStore.cxx:325 RooCompositeDataStore.cxx:326 RooCompositeDataStore.cxx:327 RooCompositeDataStore.cxx:328 RooCompositeDataStore.cxx:329 RooCompositeDataStore.cxx:330 RooCompositeDataStore.cxx:331 RooCompositeDataStore.cxx:332 RooCompositeDataStore.cxx:333 RooCompositeDataStore.cxx:334 RooCompositeDataStore.cxx:335 RooCompositeDataStore.cxx:336 RooCompositeDataStore.cxx:337 RooCompositeDataStore.cxx:338 RooCompositeDataStore.cxx:339 RooCompositeDataStore.cxx:340 RooCompositeDataStore.cxx:341 RooCompositeDataStore.cxx:342 RooCompositeDataStore.cxx:343 RooCompositeDataStore.cxx:344