The Gaudi Framework
master (53dee381)
Toggle main menu visibility
Loading...
Searching...
No Matches
Aida2ROOT.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#ifdef __ICC
12
// disable icc remark #2259: non-pointer conversion from "X" to "Y" may lose significant bits
13
// TODO: To be removed, since it comes from ROOT TMathBase.h
14
# pragma warning( disable : 2259 )
15
#endif
16
// ============================================================================
17
// Include files
18
// ============================================================================
19
#include <type_traits>
20
// ============================================================================
21
// AIDA
22
// ============================================================================
23
#include <AIDA/IHistogram1D.h>
24
#include <AIDA/IHistogram2D.h>
25
#include <AIDA/IHistogram3D.h>
26
#include <AIDA/IProfile1D.h>
27
#include <AIDA/IProfile2D.h>
28
// ============================================================================
29
// ROOT
30
// ============================================================================
31
#include <TH1D.h>
32
#include <TH2D.h>
33
#include <TH3D.h>
34
#include <TProfile.h>
35
#include <TProfile2D.h>
36
// ============================================================================
37
// GaudiKernel
38
// ============================================================================
39
#include <
GaudiKernel/HistogramBase.h
>
40
// ============================================================================
41
#include <
GaudiUtils/Aida2ROOT.h
>
42
// ============================================================================
48
49
namespace
{
50
template
<
typename
Out,
typename
In>
51
Out* a2r_cast( In* aida ) {
52
using
Base = std::conditional_t<std::is_const_v<Out>,
const
Gaudi::HistogramBase
,
Gaudi::HistogramBase
>;
53
auto
base
=
dynamic_cast<
Base*
>
( aida );
54
return
base
?
dynamic_cast<
Out*
>
(
base
->representation() ) :
nullptr
;
55
}
56
}
// namespace
57
// ============================================================================
58
// get the underlying pointer for 1D-histogram
59
// ============================================================================
60
TH1D*
Gaudi::Utils::Aida2ROOT::aida2root
( AIDA::IHistogram1D* aida ) {
return
a2r_cast<TH1D>( aida ); }
61
const
TH1D*
Gaudi::Utils::Aida2ROOT::aida2root
(
const
AIDA::IHistogram1D* aida ) {
62
return
a2r_cast<const TH1D>( aida );
63
}
64
// ============================================================================
65
// get the underlying pointer for 2D-histogram
66
// ============================================================================
67
TH2D*
Gaudi::Utils::Aida2ROOT::aida2root
( AIDA::IHistogram2D* aida ) {
return
a2r_cast<TH2D>( aida ); }
68
const
TH2D*
Gaudi::Utils::Aida2ROOT::aida2root
(
const
AIDA::IHistogram2D* aida ) {
69
return
a2r_cast<const TH2D>( aida );
70
}
71
// ============================================================================
72
// get the underlying pointer for 3D-histogram
73
// ============================================================================
74
TH3D*
Gaudi::Utils::Aida2ROOT::aida2root
( AIDA::IHistogram3D* aida ) {
return
a2r_cast<TH3D>( aida ); }
75
const
TH3D*
Gaudi::Utils::Aida2ROOT::aida2root
(
const
AIDA::IHistogram3D* aida ) {
76
return
a2r_cast<const TH3D>( aida );
77
}
78
// ============================================================================
79
// get the underlying pointer for 1D-profile
80
// ============================================================================
81
TProfile*
Gaudi::Utils::Aida2ROOT::aida2root
( AIDA::IProfile1D* aida ) {
return
a2r_cast<TProfile>( aida ); }
82
const
TProfile*
Gaudi::Utils::Aida2ROOT::aida2root
(
const
AIDA::IProfile1D* aida ) {
83
return
a2r_cast<const TProfile>( aida );
84
}
85
// ============================================================================
86
// get the underlying pointer for 2D-profile
87
// ============================================================================
88
TProfile2D*
Gaudi::Utils::Aida2ROOT::aida2root
( AIDA::IProfile2D* aida ) {
return
a2r_cast<TProfile2D>( aida ); }
89
const
TProfile2D*
Gaudi::Utils::Aida2ROOT::aida2root
(
const
AIDA::IProfile2D* aida ) {
90
return
a2r_cast<const TProfile2D>( aida );
91
}
92
// ============================================================================
93
// get root representation for other cases
94
// ============================================================================
95
TObject*
Gaudi::Utils::Aida2ROOT::aida2root
( AIDA::IHistogram* aida ) {
return
a2r_cast<TObject>( aida ); }
96
const
TObject*
Gaudi::Utils::Aida2ROOT::aida2root
(
const
AIDA::IHistogram* aida ) {
97
return
a2r_cast<const TObject>( aida );
98
}
99
// ============================================================================
100
// The END
101
// ============================================================================
Aida2ROOT.h
HistogramBase.h
Gaudi::HistogramBase
Common base class for all histograms Use is solely functional to minimize dynamic_casts inside Histog...
Definition
HistogramBase.h:31
Gaudi::Utils::Aida2ROOT::aida2root
static TH1D * aida2root(AIDA::IHistogram1D *aida)
get the underlying pointer for 1D-histogram
Definition
Aida2ROOT.cpp:60
GaudiPython.Bindings.nullptr
nullptr
Definition
Bindings.py:86
check_ParticleID.base
base
Definition
check_ParticleID.py:24
GaudiUtils
src
Lib
Aida2ROOT.cpp
Generated on
for The Gaudi Framework by
1.17.0