Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooNormSetCache.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooNormSetCache.h,v 1.12 2007/08/09 19:55:47 wouter Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_NORMSET_CACHE
17#define ROO_NORMSET_CACHE
18
19#include <RooArgSet.h>
20
21#include <deque>
22#include <set>
23#include <string>
24
26
27public:
28 RooNormSetCache(std::size_t max = 32) : _max(max) {}
29
30 inline bool contains(const RooArgSet* set1, const RooArgSet* set2 = nullptr,
31 const TNamed* set2RangeName = nullptr)
32 {
33 // Match range name first
34 if (set2RangeName != _set2RangeName) return false;
35 return _pairSet.find({RooFit::getUniqueId(set1), RooFit::getUniqueId(set2)}) != _pairSet.end();
36 }
37
38 const std::string& nameSet1() const { return _name1; }
39 const std::string& nameSet2() const { return _name2; }
40
41 bool autoCache(const RooAbsArg* self, const RooArgSet* set1,
42 const RooArgSet* set2 = nullptr, const TNamed* set2RangeName = nullptr,
43 bool autoRefill = true);
44
45 void clear();
46
47private:
48
49 void add(const RooArgSet* set1, const RooArgSet* set2 = nullptr);
50
52 using Pair_t = std::pair<Value_t,Value_t>;
53
54 std::deque<Pair_t> _pairs; ///<!
55 std::set<Pair_t> _pairSet; ///<!
56 std::size_t _max; ///<!
57
58 std::string _name1; ///<!
59 std::string _name2; ///<!
60 TNamed* _set2RangeName = nullptr; ///<!
61};
62
63#endif
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:79
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Class RooNormSet cache manage the bookkeeping of multiple instances of sets of integration and normal...
const std::string & nameSet2() const
void clear()
Clear contents.
TNamed * _set2RangeName
!
bool autoCache(const RooAbsArg *self, const RooArgSet *set1, const RooArgSet *set2=nullptr, const TNamed *set2RangeName=nullptr, bool autoRefill=true)
If RooArgSets set1 and set2 or sets with similar contents have been seen by this cache manager before...
std::string _name1
!
std::set< Pair_t > _pairSet
!
std::size_t _max
!
std::deque< Pair_t > _pairs
!
bool contains(const RooArgSet *set1, const RooArgSet *set2=nullptr, const TNamed *set2RangeName=nullptr)
std::string _name2
!
void add(const RooArgSet *set1, const RooArgSet *set2=nullptr)
Add given pair of RooArgSet pointers to our store.
std::pair< Value_t, Value_t > Pair_t
RooFit::UniqueId< RooArgSet >::Value_t Value_t
const std::string & nameSet1() const
RooNormSetCache(std::size_t max=32)
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
UniqueId_t const & getUniqueId(Class const *ptr)
A helper function to replace pointer comparisons with UniqueId comparisons.
Definition UniqueId.h:89
unsigned long Value_t
Definition UniqueId.h:41