Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:29:23

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooNormSetCache.h,v 1.12 2007/08/09 19:55:47 wouter Exp $
0005  * Authors:                                                                  *
0006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
0007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
0008  *                                                                           *
0009  * Copyright (c) 2000-2005, Regents of the University of California          *
0010  *                          and Stanford University. All rights reserved.    *
0011  *                                                                           *
0012  * Redistribution and use in source and binary forms,                        *
0013  * with or without modification, are permitted according to the terms        *
0014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
0015  *****************************************************************************/
0016 #ifndef ROO_NORMSET_CACHE
0017 #define ROO_NORMSET_CACHE
0018 
0019 #include <RooArgSet.h>
0020 
0021 #include <deque>
0022 #include <set>
0023 #include <string>
0024 
0025 class RooNormSetCache {
0026 
0027 public:
0028   RooNormSetCache(std::size_t max = 32) : _max(max) {}
0029 
0030   inline bool contains(const RooArgSet* set1, const RooArgSet* set2 = nullptr,
0031       const TNamed* set2RangeName = nullptr)
0032   {
0033     // Match range name first
0034     if (set2RangeName != _set2RangeName) return false;
0035     return _pairSet.find({RooFit::getUniqueId(set1), RooFit::getUniqueId(set2)}) != _pairSet.end();
0036   }
0037 
0038   const std::string& nameSet1() const { return _name1; }
0039   const std::string& nameSet2() const { return _name2; }
0040 
0041   bool autoCache(const RooAbsArg* self, const RooArgSet* set1,
0042       const RooArgSet* set2 = nullptr, const TNamed* set2RangeName = nullptr,
0043       bool autoRefill = true);
0044 
0045   void clear();
0046 
0047 private:
0048 
0049   void add(const RooArgSet* set1, const RooArgSet* set2 = nullptr);
0050 
0051   using Value_t = RooFit::UniqueId<RooArgSet>::Value_t;
0052   using Pair_t = std::pair<Value_t,Value_t>;
0053 
0054   std::deque<Pair_t> _pairs; ///<!
0055   std::set<Pair_t> _pairSet; ///<!
0056   std::size_t _max; ///<!
0057 
0058   std::string _name1;   ///<!
0059   std::string _name2;   ///<!
0060   TNamed*    _set2RangeName = nullptr; ///<!
0061 };
0062 
0063 #endif