Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
SharedOffset.cxx
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * PB, Patrick Bos, Netherlands eScience Center, p.bos@esciencecenter.nl
5 *
6 * Copyright (c) 2024, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
14
15SharedOffset::SharedOffset() : offsets_(std::make_shared<OffsetVec>()), offsets_save_(std::make_shared<OffsetVec>()) {}
16
18{
19 offsets_->clear();
20 offsets_save_->clear();
21}
22
23/// When calculating an unbinned likelihood with square weights applied, a different offset
24/// is necessary. Similar situations may ask for a separate offset as well. This function
25/// switches between the two sets of offset values for the given component keys.
26/// \note Currently we do not recalculate the offset value, so in practice swapped offsets
27/// are zero.
28void SharedOffset::swap(const std::vector<std::size_t> &component_keys)
29{
30 for (auto key : component_keys) {
31 std::swap((*offsets_)[key], (*offsets_save_)[key]);
32 }
33}
void swap(const std::vector< std::size_t > &component_keys)
When calculating an unbinned likelihood with square weights applied, a different offset is necessary.
std::vector< ROOT::Math::KahanSum< double > > OffsetVec
std::shared_ptr< OffsetVec > offsets_save_
std::shared_ptr< OffsetVec > offsets_