@@ -26,40 +26,19 @@ the object is valid, so that other instances can, at a later moment
2626retrieve these precalculated objects.
2727**/
2828
29+ #include " RooExpensiveObjectCache.h"
2930
3031#include " TClass.h"
3132#include " RooAbsReal.h"
3233#include " RooAbsCategory.h"
3334#include " RooArgSet.h"
3435#include " RooMsgService.h"
3536#include < iostream>
36- using namespace std ;
37-
38- #include " RooExpensiveObjectCache.h"
3937
4038ClassImp (RooExpensiveObjectCache);
4139ClassImp (RooExpensiveObjectCache::ExpensiveObject);
4240
4341
44- // //////////////////////////////////////////////////////////////////////////////
45- // / Constructor
46-
47- RooExpensiveObjectCache::RooExpensiveObjectCache () : _nextUID(0 )
48- {
49- }
50-
51-
52-
53- // //////////////////////////////////////////////////////////////////////////////
54- // / Copy constructor
55-
56- RooExpensiveObjectCache::RooExpensiveObjectCache (const RooExpensiveObjectCache& other) :
57- TObject(other), _nextUID(0 )
58- {
59- }
60-
61-
62-
6342// //////////////////////////////////////////////////////////////////////////////
6443// / Destructor.
6544
@@ -231,7 +210,7 @@ RooExpensiveObjectCache::ExpensiveObject::ExpensiveObject(Int_t uidIn, const cha
231210 if (cat) {
232211 _catRefParams[cat->GetName ()] = cat->getCurrentIndex () ;
233212 } else {
234- oocoutW (&inPayload,Caching) << " RooExpensiveObject::registerObject() WARNING: ignoring non-RooAbsReal/non-RooAbsCategory reference parameter " << arg->GetName () << endl ;
213+ oocoutW (&inPayload,Caching) << " RooExpensiveObject::registerObject() WARNING: ignoring non-RooAbsReal/non-RooAbsCategory reference parameter " << arg->GetName () << std:: endl ;
235214 }
236215 }
237216 }
@@ -305,12 +284,9 @@ bool RooExpensiveObjectCache::ExpensiveObject::matches(TClass* tc, const RooArgS
305284
306285void RooExpensiveObjectCache::print () const
307286{
308- map<TString,ExpensiveObject*>::const_iterator iter = _map.begin () ;
309-
310- while (iter!=_map.end ()) {
311- cout << " uid = " << iter->second ->uid () << " key=" << iter->first << " value=" ;
312- iter->second ->print () ;
313- ++iter ;
287+ for (auto const & item : _map) {
288+ std::cout << " uid = " << item.second ->uid () << " key=" << item.first << " value=" ;
289+ item.second ->print () ;
314290 }
315291}
316292
@@ -320,22 +296,22 @@ void RooExpensiveObjectCache::print() const
320296
321297void RooExpensiveObjectCache::ExpensiveObject::print () const
322298{
323- cout << _payload->ClassName () << " ::" << _payload->GetName () ;
299+ std:: cout << _payload->ClassName () << " ::" << _payload->GetName () ;
324300 if (_realRefParams.size ()>0 || _catRefParams.size ()>0 ) {
325- cout << " parameters=( " ;
301+ std:: cout << " parameters=( " ;
326302 auto iter = _realRefParams.begin () ;
327303 while (iter!=_realRefParams.end ()) {
328- cout << iter->first << " =" << iter->second << " " ;
304+ std:: cout << iter->first << " =" << iter->second << " " ;
329305 ++iter ;
330306 }
331307 auto iter2 = _catRefParams.begin () ;
332308 while (iter2!=_catRefParams.end ()) {
333- cout << iter2->first << " =" << iter2->second << " " ;
309+ std:: cout << iter2->first << " =" << iter2->second << " " ;
334310 ++iter2 ;
335311 }
336- cout << " )" ;
312+ std:: cout << " )" ;
337313 }
338- cout << endl ;
314+ std:: cout << std:: endl ;
339315}
340316
341317
@@ -345,16 +321,14 @@ void RooExpensiveObjectCache::ExpensiveObject::print() const
345321
346322void RooExpensiveObjectCache::importCacheObjects (RooExpensiveObjectCache& other, const char * ownerName, bool verbose)
347323{
348- map<TString,ExpensiveObject*>::const_iterator iter = other._map .begin () ;
349- while (iter!=other._map .end ()) {
350- if (string (ownerName)==iter->second ->ownerName ()) {
351- _map[iter->first .Data ()] = new ExpensiveObject (_nextUID++, *iter->second ) ;
324+ for (auto const & item : other._map ) {
325+ if (std::string (ownerName)==item.second ->ownerName ()) {
326+ _map[item.first .Data ()] = new ExpensiveObject (_nextUID++, *item.second ) ;
352327 if (verbose) {
353- oocoutI (iter-> second ->payload (),Caching) << " RooExpensiveObjectCache::importCache() importing cache object "
354- << iter-> first << " associated with object " << iter-> second ->ownerName () << endl ;
328+ oocoutI (item. second ->payload (),Caching) << " RooExpensiveObjectCache::importCache() importing cache object "
329+ << item. first << " associated with object " << item. second ->ownerName () << std:: endl ;
355330 }
356331 }
357- ++iter ;
358332 }
359333
360334}
0 commit comments