Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
v
w
x
z
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
v
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
GitLab
LXR
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
InnerDetector
InDetValidation
InDetDefectsEmulation
src
HistUtil.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
#ifndef HISTUTIL_H
5
#define HISTUTIL_H
6
#include "TVirtualMutex.h"
7
#include "TH1.h"
8
#include <string>
9
#include <string_view>
10
11
namespace
HistUtil
{
12
// Helper class to avoid that newly created histograms are added to random
13
// root TDirectories
14
class
ProtectHistogramCreation
{
15
public
:
16
ProtectHistogramCreation
() {
17
TVirtualMutex *root_global_mutex
ATLAS_THREAD_SAFE
= gGlobalMutex;
18
if
(root_global_mutex) {
19
root_global_mutex->Lock();
20
}
21
m_addDirectory
=TH1::AddDirectoryStatus();
22
if
(
m_addDirectory
) {
23
TH1::AddDirectory(kFALSE);
24
}
25
}
26
~ProtectHistogramCreation
() {
27
if
(
m_addDirectory
) {
28
TH1::AddDirectory(
m_addDirectory
);
29
}
30
TVirtualMutex *root_global_mutex
ATLAS_THREAD_SAFE
= gGlobalMutex;
31
if
(root_global_mutex) {
32
root_global_mutex->UnLock();
33
}
34
}
35
private
:
36
bool
m_addDirectory
=
false
;
37
};
38
39
// Helper class to compose strings in a stringstream-way but only with the overhead of
40
// string concatenation
41
class
StringCat
{
42
public
:
43
StringCat
(
const
std::string &
a
) :
m_str
(
a
) {}
44
StringCat
(std::string &&
a
) :
m_str
(std::move(
a
)) {}
45
StringCat
() =
default
;
46
47
const
std::string &
str
()
const
{
return
m_str
; }
48
std::string
release
() {
return
std::move(
m_str
); }
49
StringCat
&
operator<<
(
const
std::string &
a
) {
m_str
+=
a
;
return
*
this
;}
50
StringCat
&
operator<<
(
const
char
*
a
) {
m_str
+=
a
;
return
*
this
;}
51
StringCat
&
operator<<
(
const
std::string_view &
a
) {
m_str
+=
a
;
return
*
this
;}
52
template
<
typename
T>
53
StringCat
&
operator<<
(
const
T &
a
) {
m_str
+=
std::to_string
(
a
);
return
*
this
;}
54
private
:
55
std::string
m_str
;
56
};
57
58
}
59
#endif
HistUtil::ProtectHistogramCreation::ProtectHistogramCreation
ProtectHistogramCreation()
Definition:
HistUtil.h:16
HistUtil::StringCat::StringCat
StringCat(std::string &&a)
Definition:
HistUtil.h:44
HistUtil::StringCat::operator<<
StringCat & operator<<(const T &a)
Definition:
HistUtil.h:53
HistUtil::ProtectHistogramCreation::m_addDirectory
bool m_addDirectory
Definition:
HistUtil.h:36
HistUtil::StringCat
Definition:
HistUtil.h:41
HistUtil::StringCat::release
std::string release()
Definition:
HistUtil.h:48
HistUtil::StringCat::m_str
std::string m_str
Definition:
HistUtil.h:55
HistUtil::StringCat::StringCat
StringCat(const std::string &a)
Definition:
HistUtil.h:43
HistUtil::StringCat::StringCat
StringCat()=default
HistUtil::StringCat::operator<<
StringCat & operator<<(const std::string &a)
Definition:
HistUtil.h:49
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition:
GeometryDefs.h:34
a
TList * a
Definition:
liststreamerinfos.cxx:10
HistUtil::ProtectHistogramCreation::~ProtectHistogramCreation
~ProtectHistogramCreation()
Definition:
HistUtil.h:26
HistUtil::StringCat::operator<<
StringCat & operator<<(const char *a)
Definition:
HistUtil.h:50
HistUtil::ProtectHistogramCreation
Definition:
HistUtil.h:14
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition:
checker_macros.h:211
HistUtil
Definition:
HistUtil.h:11
HistUtil::StringCat::operator<<
StringCat & operator<<(const std::string_view &a)
Definition:
HistUtil.h:51
HistUtil::StringCat::str
const std::string & str() const
Definition:
HistUtil.h:47
Generated on Tue Mar 25 2025 21:11:30 for ATLAS Offline Software by
1.8.18