ATLAS Offline Software
Loading...
Searching...
No Matches
ClassCounts.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <iostream>
8
9using std::cout;
10using std::endl;
11
12using namespace LArSamples;
13
14std::map<TString, int>* ClassCounts::m_counts = nullptr;
15
21
22
24{
25 m_counts->erase(className());
26 if (m_counts->empty()) {
27 delete m_counts;
28 m_counts = nullptr;
29 }
30}
31
32
33std::map<TString, int>& ClassCounts::counts()
34{
35 if (!m_counts) m_counts = new std::map<TString, int>();
36 return *m_counts;
37}
38
39
41{
42 cout << "Class instance counts : " << endl;
43 if (!m_counts) return;
44 for (const std::pair<const TString, int>& p : counts())
45 cout << Form("%20s : %-d", p.first.Data(), p.second) << endl;
46}
static std::map< TString, int > & counts()
static std::map< TString, int > * m_counts
static void printCountsTable()
ClassCounts(const TString &name)
Constructor.