A class to store batches of data points that can be accessed via RooSpan.
Definition at line 30 of file BatchData.h.
Classes | |
| struct | Batch |
Public Types | |
| enum | Status_t { kNoBatch , kDirty , kWriting , kReady , kReadyAndConstant } |
| Status of the batch. More... | |
| enum | Tag_t { kUnspecified , kgetVal , kgetLogVal } |
Public Member Functions | |
| BatchData () | |
| void | attachForeignStorage (const std::vector< double > &vec) |
| Attach a foreign storage. Batches coming from this storage will be read only. More... | |
| void | clear () |
| Discard all storage. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| void | markDirty () |
| Mark all batches dirty. This will trigger recomputations. More... | |
| void | print (std::ostream &os, const std::string &indent) const |
| Print to given output stream. More... | |
| 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. More... | |
| 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. More... | |
Private Types | |
| using | Key_t = std::tuple< std::size_t, const RooArgSet *const, Tag_t > |
| Key type of map that holds the batch storage. More... | |
| using | Map_t = std::map< Key_t, Batch > |
| Storage for batch data. More... | |
Private Member Functions | |
| 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. More... | |
| 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. More... | |
Private Attributes | |
| const std::vector< double > * | _foreignData |
| Map_t | _ownedBatches |
#include <BatchData.h>
|
private |
Key type of map that holds the batch storage.
Definition at line 96 of file BatchData.h.
|
private |
Storage for batch data.
Definition at line 101 of file BatchData.h.
Status of the batch.
Make sure that everything that is readable has a status >= kReady.
| Enumerator | |
|---|---|
| kNoBatch | |
| kDirty | |
| kWriting | |
| kReady | |
| kReadyAndConstant | |
Definition at line 34 of file BatchData.h.
| Enumerator | |
|---|---|
| kUnspecified | |
| kgetVal | |
| kgetLogVal | |
Definition at line 35 of file BatchData.h.
|
inline |
Definition at line 37 of file BatchData.h.
Attach a foreign storage. Batches coming from this storage will be read only.
Definition at line 160 of file BatchData.cxx.
|
inline |
Discard all storage.
Definition at line 45 of file BatchData.h.
|
private |
Create a span pointing to existing batch memory.
| [in] | begin | Index of the event to find. |
| [in] | batchSize | Requested size of the span. May come out smaller if no more data exists. |
| [in] | normSet | Optional normalisation set defining what this batch was normalised to. |
| [in] | ownerTag | Optional owner tag to prevent sharing of memory between e.g. getVal() and getLogVal(). |
Definition at line 223 of file BatchData.cxx.
|
private |
Find the batch that contains the event with number evt.
| [in] | evt | Index of the event to find. |
| [in] | normSet | Optional normalisation set defining what this batch was normalised to. |
| [in] | ownerTag | Optional owner tag to prevent sharing of memory between e.g. getVal() and getLogVal(). |
Definition at line 204 of file BatchData.cxx.
| RooSpan< const double > BatchHelpers::BatchData::getBatch | ( | std::size_t | begin, |
| std::size_t | maxSize, | ||
| const RooArgSet *const | normSet = nullptr, |
||
| Tag_t | ownerTag = kUnspecified |
||
| ) | const |
Retrieve an existing batch.
| [in] | begin | Begin index of the batch. |
| [in] | size | Requested size. Batch may come out smaller than this. |
| [in] | normSet | Optional normSet pointer to distinguish differently normalised computations. |
| [in] | ownerTag | Optional owner tag. This avoids reusing batch memory for e.g. getVal() and getLogVal(). |
Definition at line 80 of file BatchData.cxx.
| RooSpan< double > BatchHelpers::BatchData::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.
Calls makeWritableBatchUnInit() and initialises the memory.
| [in] | begin | Begin of the batch. |
| [in] | batchSize | End of the batch (not included) |
| [in] | value | Value to initialise with (defaults to 0.). |
| [in] | normSet | Optional normSet pointer to distinguish differently normalised computations. |
| [in] | ownerTag | Optional owner tag. This avoids reusing batch memory for e.g. getVal() and getLogVal(). |
begin. Definition at line 148 of file BatchData.cxx.
| RooSpan< double > BatchHelpers::BatchData::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.
The batch status is switched to kWriting, but the batch is not initialised. If a batch at this start point exists, the storage will be resized to fit the required size.
| [in] | begin | Begin of the batch. |
| [in] | batchSize | Size of the batch. |
| [in] | normSet | Optional normSet pointer to distinguish differently normalised computations. |
| [in] | ownerTag | Optional owner tag. This avoids reusing batch memory for e.g. getVal() and getLogVal(). |
begin. Definition at line 118 of file BatchData.cxx.
|
inline |
Mark all batches dirty. This will trigger recomputations.
Definition at line 55 of file BatchData.h.
| void BatchHelpers::BatchData::print | ( | std::ostream & | os, |
| const std::string & | indent | ||
| ) | const |
Print to given output stream.
Definition at line 170 of file BatchData.cxx.
| bool BatchHelpers::BatchData::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.
The status of foreign read-only data will never change.
| [in] | begin | Begin index of the batch. |
| [in] | size | Size of the batch for checking that enough data is available. |
| [in] | normSet | Optional normSet pointer to destinguish differently normalised computations. |
| [in] | ownerTag | Optional owner tag. This avoids reusing batch memory for e.g. getVal() and getLogVal(). |
Definition at line 58 of file BatchData.cxx.
| BatchData::Status_t BatchHelpers::BatchData::status | ( | std::size_t | begin, |
| const RooArgSet *const | normSet = nullptr, |
||
| Tag_t | ownerTag = kUnspecified |
||
| ) | const |
Return the status of the batch starting at begin.
| [in] | begin | Start of the batch. |
| [in] | normSet | Optional normSet pointer to distinguish differently normalised computations. |
| [in] | ownerTag | Optional owner tag. This avoids reusing batch memory for e.g. getVal() and getLogVal(). |
Definition at line 30 of file BatchData.cxx.
|
private |
Definition at line 111 of file BatchData.h.
|
private |
Definition at line 110 of file BatchData.h.