ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDigitization
SCT_Digitization
src
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"
12
#include "
SiDigitization/SiChargedDiodeCollection.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
20
struct
HitCacheCounter
21
{
22
23
HitCacheCounter
():
m_count
(0){}
24
void
operator()
(
const
HitCache::value_type& entry)
25
{
26
m_count
+= (entry.second).
size
();
27
}
28
unsigned
int
m_count
;
29
};
30
31
struct
DiodeCacheCounter
32
{
33
34
DiodeCacheCounter
():
m_count
(0){}
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
SiChargedDiodeCollection.h
size
size_t size() const
Number of registered mappings.
getMemUsage.h
PSUtils
Definition
getMemUsage.cxx:12
PSUtils::getMemUsage
MemStruct getMemUsage()
Definition
getMemUsage.cxx:13
PSUtils::memPrint
std::string memPrint(const DiodeCache &cache)
Definition
memPrint.h:43
PSUtils::HitCache
std::map< IdentifierHash, std::vector< HitIndexAndTime > > HitCache
Definition
memPrint.h:18
PSUtils::DiodeCache
std::map< IdentifierHash, SiChargedDiodeCollection * > DiodeCache
Definition
memPrint.h:17
PSUtils::DiodeCacheCounter
Definition
memPrint.h:32
PSUtils::DiodeCacheCounter::operator()
void operator()(const DiodeCache::value_type &entry)
Definition
memPrint.h:35
PSUtils::DiodeCacheCounter::DiodeCacheCounter
DiodeCacheCounter()
Definition
memPrint.h:34
PSUtils::DiodeCacheCounter::m_count
unsigned int m_count
Definition
memPrint.h:39
PSUtils::HitCacheCounter
Definition
memPrint.h:21
PSUtils::HitCacheCounter::operator()
void operator()(const HitCache::value_type &entry)
Definition
memPrint.h:24
PSUtils::HitCacheCounter::m_count
unsigned int m_count
Definition
memPrint.h:28
PSUtils::HitCacheCounter::HitCacheCounter
HitCacheCounter()
Definition
memPrint.h:23
Generated on
for ATLAS Offline Software by
1.17.0