ATLAS Offline Software
memPrint.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PSUTILS_MEMPRINT_H
6 #define PSUTILS_MEMPRINT_H
7 
8 #include <map>
9 #include <vector>
10 #include "getMemUsage.h"
11 #include "SiDigitization/HitIndexAndTime.h"
13 #include <sstream>
14 
15 namespace PSUtils{
16 
17  typedef std::map< IdentifierHash, SiChargedDiodeCollection* > DiodeCache;
18  typedef std::map< IdentifierHash, std::vector<HitIndexAndTime> > HitCache;
19 
21  {
22 
24  void operator()(const HitCache::value_type& entry)
25  {
26  m_count += (entry.second).size();
27  }
28  unsigned int m_count;
29  };
30 
32  {
33 
35  void operator()(const DiodeCache::value_type& entry)
36  {
37  m_count += ((entry.second)->chargedDiodes()).size();
38  }
39  unsigned int m_count;
40  };
41 
42 
43  std::string memPrint(const DiodeCache& cache){
44  std::size_t nWafers = cache.size();
45  std::size_t nDiodes = (std::for_each(cache.begin(), cache.end(), DiodeCacheCounter() ) ).m_count;
46  std::ostringstream sstream;
47  sstream<<getMemUsage()<<" n wafers "<< nWafers<<" n diodes "<<nDiodes<<'\n';
48  return sstream.str();
49  }
50 
51  std::string memPrint(const HitCache& cache){
52  std::size_t nWafers = cache.size();
53  std::size_t nDiodes = (std::for_each(cache.begin(), cache.end(), HitCacheCounter() ) ).m_count;
54  std::ostringstream sstream;
55  sstream<<getMemUsage()<<" n wafers "<< nWafers<<" n hits "<<nDiodes<<'\n';
56  return sstream.str();
57  }
58 }
59 #endif
PSUtils
Definition: getMemUsage.cxx:12
getMemUsage.h
PSUtils::DiodeCacheCounter::DiodeCacheCounter
DiodeCacheCounter()
Definition: memPrint.h:34
PSUtils::HitCacheCounter::operator()
void operator()(const HitCache::value_type &entry)
Definition: memPrint.h:24
PSUtils::DiodeCacheCounter::operator()
void operator()(const DiodeCache::value_type &entry)
Definition: memPrint.h:35
PSUtils::DiodeCacheCounter::m_count
unsigned int m_count
Definition: memPrint.h:39
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
PSUtils::getMemUsage
MemStruct getMemUsage()
Definition: getMemUsage.cxx:13
PSUtils::HitCacheCounter::m_count
unsigned int m_count
Definition: memPrint.h:28
PSUtils::DiodeCache
std::map< IdentifierHash, SiChargedDiodeCollection * > DiodeCache
Definition: memPrint.h:17
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
PSUtils::DiodeCacheCounter
Definition: memPrint.h:32
PSUtils::HitCache
std::map< IdentifierHash, std::vector< HitIndexAndTime > > HitCache
Definition: memPrint.h:18
PSUtils::HitCacheCounter::HitCacheCounter
HitCacheCounter()
Definition: memPrint.h:23
PSUtils::HitCacheCounter
Definition: memPrint.h:21
PSUtils::memPrint
std::string memPrint(const DiodeCache &cache)
Definition: memPrint.h:43
SiChargedDiodeCollection.h