36 auto item =
_ownedBatches.find(std::make_tuple(begin, normSet, ownerTag));
38 return item->second.status;
42 return item->second.status;
63 auto item =
_ownedBatches.find(std::make_tuple(begin, normSet, ownerTag));
64 if (item ==
_ownedBatches.end() || size != item->second.data.size())
67 item->second.status = stat;
86 const double* dataBegin = &*(
_foreignData->begin()+begin);
87 maxSize = std::min(maxSize,
_foreignData->size() - begin);
94 const auto item =
_ownedBatches.find(std::make_tuple(begin, normSet, ownerTag));
100 const auto& batch = item->second;
101 maxSize = std::min(maxSize, batch.data.size() - (begin-batch.begin));
120 auto item =
_ownedBatches.find(std::make_tuple(begin, normSet, ownerTag));
122 auto inserted =
_ownedBatches.emplace(std::piecewise_construct,
123 std::forward_as_tuple(begin, normSet, ownerTag),
124 std::forward_as_tuple(
Batch{begin, std::vector<double>(batchSize),
kWriting}));
128 Batch& batch = item->second;
130 if (batch.
data.size() != batchSize) {
131 batch.
data.resize(batchSize);
151 for (
auto& elm : batch) {
171 os <<
indent <<
"Batch data access";
173 os <<
" not initialised." << std::endl;
179 os <<
" with " << (
_foreignData ?
"(foreign)" :
"(owned)") <<
" data:";
180 os <<
"\n" <<
indent << std::right << std::setw(8) <<
"Batch #" << std::setw(8) <<
"Start"
181 << std::setw(7) <<
"Status";
185 auto key = item.first;
186 const Batch& batch = item.second;
189 << std::setw(8) << i << std::setw(8) << std::get<0>(key) << std::setw(8) << std::get<2>(key)
190 << std::setw(7) << batch.
status <<
": {";
191 for (
unsigned int j=0; j < 5 && j < batch.
data.size(); ++j) {
192 os << batch.
data[j] <<
", ";
196 os << std::resetiosflags(std::ios::adjustfield) << std::endl;
207 if (normSet == std::get<1>(it->first)
208 && ownerTag == std::get<2>(it->first)
209 && it->second.inBatch(evt))
226 if (normSet == std::get<1>(it->first)
227 && ownerTag == std::get<2>(it->first)
228 && it->second.inBatch(begin))
229 return it->second.makeSpan(begin, batchSize);
static void indent(ostringstream &buf, int indent_level)
bool setStatus(std::size_t begin, std::size_t size, Status_t stat, const RooArgSet *const normSet=nullptr, Tag_t ownerTag=kUnspecified)
Set the status of a batch with the given properties.
RooSpan< const double > getBatch(std::size_t begin, std::size_t maxSize, const RooArgSet *const normSet=nullptr, Tag_t ownerTag=kUnspecified) const
Retrieve an existing batch.
RooSpan< double > makeWritableBatchUnInit(std::size_t begin, std::size_t batchSize, const RooArgSet *const normSet=nullptr, Tag_t ownerTag=kUnspecified)
Make a batch and return a span pointing to the pdf-local memory.
void clear()
Discard all storage.
void print(std::ostream &os, const std::string &indent) const
Print to given output stream.
Status_t
Status of the batch.
RooSpan< const double > createSpanInsideExistingBatch(std::size_t begin, std::size_t batchSize, const RooArgSet *const normSet, Tag_t ownerTag) const
Create a span pointing to existing batch memory.
const std::vector< double > * _foreignData
Map_t::const_iterator findEnclosingBatch(std::size_t evt, const RooArgSet *const normSet, Tag_t ownerTag) const
Find the batch that contains the event with number evt.
Status_t status(std::size_t begin, const RooArgSet *const normSet=nullptr, Tag_t ownerTag=kUnspecified) const
Return the status of the batch starting at begin.
RooSpan< double > makeWritableBatchInit(std::size_t begin, std::size_t batchSize, double value, const RooArgSet *const normSet=nullptr, Tag_t ownerTag=kUnspecified)
Make a batch and return a span pointing to the pdf-local memory.
void attachForeignStorage(const std::vector< double > &vec)
Attach a foreign storage. Batches coming from this storage will be read only.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
A simple container to hold a batch of data values.
std::vector< double > data