-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathRooCompositeDataStore.h
More file actions
118 lines (88 loc) · 4.74 KB
/
RooCompositeDataStore.h
File metadata and controls
118 lines (88 loc) · 4.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*****************************************************************************
* Project: RooFit *
* Package: RooFitCore *
* File: $Id$
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
#ifndef ROO_COMPOSITE_DATA_STORE
#define ROO_COMPOSITE_DATA_STORE
#include "RooAbsDataStore.h"
#include <map>
#include <string>
#include <vector>
#include <list>
class RooAbsArg ;
class RooArgList ;
class RooFormulaVar ;
class RooArgSet ;
class RooCategory ;
class RooCompositeDataStore : public RooAbsDataStore {
public:
RooCompositeDataStore() ;
// Ctors from DataStore
RooCompositeDataStore(RooStringView name, RooStringView title, const RooArgSet& vars, RooCategory& indexCat, std::map<std::string,RooAbsDataStore*> const& inputData) ;
// Empty constructor.
RooAbsDataStore* clone(const char* newname=nullptr) const override { return new RooCompositeDataStore(*this,newname) ; }
RooAbsDataStore* clone(const RooArgSet& vars, const char* newname=nullptr) const override { return new RooCompositeDataStore(*this,vars,newname) ; }
std::unique_ptr<RooAbsDataStore> reduce(RooStringView name, RooStringView title,
const RooArgSet& vars, const RooFormulaVar* cutVar, const char* cutRange,
std::size_t nStart, std::size_t nStop) override;
RooCompositeDataStore(const RooCompositeDataStore& other, const char* newname=nullptr) ;
RooCompositeDataStore(const RooCompositeDataStore& other, const RooArgSet& vars, const char* newname=nullptr) ;
~RooCompositeDataStore() override ;
void dump() override ;
// Write current row
Int_t fill() override ;
double sumEntries() const override ;
// Retrieve a row
using RooAbsDataStore::get ;
const RooArgSet* get(Int_t index) const override ;
using RooAbsDataStore::weight ;
double weight() const override ;
double weightError(RooAbsData::ErrorType etype=RooAbsData::Poisson) const override ;
void weightError(double& lo, double& hi, RooAbsData::ErrorType etype=RooAbsData::Poisson) const override ;
bool isWeighted() const override ;
// Change observable name
bool changeObservableName(const char* from, const char* to) override ;
// Add one column
RooAbsArg* addColumn(RooAbsArg& var, bool adjustRange=true) override ;
// Merge column-wise
RooAbsDataStore* merge(const RooArgSet& allvars, std::list<RooAbsDataStore*> dstoreList) override ;
RooCategory* index() { return _indexCat ; }
// Add rows
void append(RooAbsDataStore& other) override ;
// General & bookkeeping methods
Int_t numEntries() const override ;
void reset() override ;
// Buffer redirection routines used in inside RooAbsOptTestStatistics
void attachBuffers(const RooArgSet& extObs) override ;
void resetBuffers() override ;
void loadValues(const RooAbsDataStore *tds, const RooFormulaVar* select=nullptr, const char* rangeName=nullptr,
std::size_t nStart=0, std::size_t nStop = std::numeric_limits<std::size_t>::max()) override;
RooAbsData::RealSpans getBatches(std::size_t first, std::size_t len) const override {
//TODO
std::cerr << "This functionality is not yet implemented for composite data stores." << std::endl;
throw std::logic_error("getBatches() not implemented for RooCompositeDataStore.");
(void)first; (void)len;
return {};
}
std::span<const double> getWeightBatch(std::size_t first, std::size_t len) const override;
protected:
std::map<Int_t,RooAbsDataStore*> _dataMap ;
RooCategory* _indexCat = nullptr;
mutable RooAbsDataStore* _curStore = nullptr; ///<! Datastore associated with current event
mutable Int_t _curIndex = 0; ///<! Index associated with current event
mutable std::unique_ptr<std::vector<double>> _weightBuffer; ///<! Buffer for weights in case a batch of values is requested.
bool _ownComps = false; ///<!
ClassDefOverride(RooCompositeDataStore,1) // Composite Data Storage class
};
#endif