ATLAS Offline Software
Loading...
Searching...
No Matches
LArCalorimeter
LArCafJobs
src
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
5
#include "
LArCafJobs/ClassCounts.h
"
6
7
#include <iostream>
8
9
using
std::cout;
10
using
std::endl;
11
12
using namespace
LArSamples
;
13
14
std::map<TString, int>*
ClassCounts::m_counts
=
nullptr
;
15
16
ClassCounts::ClassCounts
(
const
TString&
className
)
17
:
m_className
(
className
)
18
{
19
counts
()[
className
] = 0;
20
}
21
22
23
ClassCounts::~ClassCounts
()
24
{
25
m_counts
->erase(
className
());
26
if
(
m_counts
->empty()) {
27
delete
m_counts
;
28
m_counts
=
nullptr
;
29
}
30
}
31
32
33
std::map<TString, int>&
ClassCounts::counts
()
34
{
35
if
(!
m_counts
)
m_counts
=
new
std::map<TString, int>();
36
return
*
m_counts
;
37
}
38
39
40
void
ClassCounts::printCountsTable
()
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
}
ClassCounts.h
LArSamples::ClassCounts::counts
static std::map< TString, int > & counts()
Definition
ClassCounts.cxx:33
LArSamples::ClassCounts::m_counts
static std::map< TString, int > * m_counts
Definition
LArCafJobs/LArCafJobs/ClassCounts.h:46
LArSamples::ClassCounts::className
const TString & className() const
Definition
LArCafJobs/LArCafJobs/ClassCounts.h:29
LArSamples::ClassCounts::~ClassCounts
virtual ~ClassCounts()
Definition
ClassCounts.cxx:23
LArSamples::ClassCounts::printCountsTable
static void printCountsTable()
Definition
ClassCounts.cxx:40
LArSamples::ClassCounts::m_className
TString m_className
Definition
LArCafJobs/LArCafJobs/ClassCounts.h:45
LArSamples::ClassCounts::ClassCounts
ClassCounts(const TString &name)
Constructor.
Definition
ClassCounts.cxx:16
LArSamples
Definition
AbsShape.h:24
Generated on
for ATLAS Offline Software by
1.14.0