ATLAS Offline Software
Loading...
Searching...
No Matches
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
15namespace 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
MemStruct getMemUsage()
std::string memPrint(const DiodeCache &cache)
Definition memPrint.h:43
std::map< IdentifierHash, std::vector< HitIndexAndTime > > HitCache
Definition memPrint.h:18
std::map< IdentifierHash, SiChargedDiodeCollection * > DiodeCache
Definition memPrint.h:17
void operator()(const DiodeCache::value_type &entry)
Definition memPrint.h:35
void operator()(const HitCache::value_type &entry)
Definition memPrint.h:24
unsigned int m_count
Definition memPrint.h:28