Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
DataMap.cxx
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * Garima Singh, CERN 2023
5 * Jonas Rembser, CERN 2023
6 *
7 * Copyright (c) 2023, CERN
8 *
9 * Redistribution and use in source and binary forms,
10 * with or without modification, are permitted according to the terms
11 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
12 */
13
15
16#include <RooBatchCompute.h>
17#include <RooRealVar.h>
18
19namespace RooFit {
20namespace Detail {
21
22std::span<const double> DataMap::at(RooAbsArg const *arg, RooAbsArg const * /*caller*/)
23{
24 if (!arg->hasDataToken()) {
25 auto var = static_cast<RooRealVar const *>(arg);
26 return {&var->_value, 1};
27 }
28 std::size_t idx = arg->dataToken();
29 return _dataMap[idx];
30}
31
33{
34 if (!arg->hasDataToken())
35 return;
36 std::size_t idx = arg->dataToken();
37 _cfgs[idx] = config;
38}
39
41{
42 if (!arg->hasDataToken()) {
43 return {};
44 }
45 std::size_t idx = arg->dataToken();
46 return _cfgs[idx];
47}
48
49void DataMap::resize(std::size_t n)
50{
51 _cfgs.resize(n);
52 _dataMap.resize(n);
53}
54
55} // namespace Detail
56} // namespace RooFit
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
bool hasDataToken() const
Definition RooAbsArg.h:705
std::size_t dataToken() const
Returns the token for retrieving results in the BatchMode. For internal use only.
Definition RooAbsArg.h:704
double _value
Cache for current value of object.
Definition RooAbsReal.h:543
Minimal configuration struct to steer the evaluation of a single node with the RooBatchCompute librar...
std::vector< RooBatchCompute::Config > _cfgs
Definition DataMap.h:124
RooBatchCompute::Config config(RooAbsArg const *arg) const
Definition DataMap.cxx:40
std::vector< std::span< const double > > _dataMap
Definition DataMap.h:123
std::span< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
Definition DataMap.cxx:22
void setConfig(RooAbsArg const *arg, RooBatchCompute::Config const &config)
Definition DataMap.cxx:32
void resize(std::size_t n)
Definition DataMap.cxx:49
Variable that can be changed from the outside.
Definition RooRealVar.h:37
const Int_t n
Definition legend1.C:16
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26