ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigSteer
TrigOutputHandling
src
TruncationAnalysisAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TruncationAnalysisAlg.h
"
6
#include <algorithm>
7
#include <sstream>
8
#include <iomanip>
9
10
#include "
TrigCompositeUtils/TrigCompositeUtils.h
"
11
12
namespace
{
13
struct
CollectionDebugInfo {
14
std::string_view name;
15
uint32_t
size = 0;
16
bool
isRecorded =
false
;
17
};
18
bool
cmpCollections(
const
CollectionDebugInfo&
a
,
const
CollectionDebugInfo& b) {
19
return
a
.size >
b
.size;
20
}
21
}
22
23
TruncationAnalysisAlg::TruncationAnalysisAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
24
AthReentrantAlgorithm
(name, pSvcLocator) {}
25
26
StatusCode
TruncationAnalysisAlg::initialize
() {
27
ATH_CHECK
(
m_truncationInfoKey
.initialize() );
28
return
StatusCode::SUCCESS;
29
}
30
31
StatusCode
TruncationAnalysisAlg::execute
(
const
EventContext& context)
const
{
32
ATH_MSG_DEBUG
(
"Retrieving truncation info object "
<<
m_truncationInfoKey
.fullKey());
33
auto
truncationInfo =
SG::makeHandle
(
m_truncationInfoKey
, context);
34
ATH_MSG_DEBUG
(
"Retrieved container with size: "
<< truncationInfo->size());
35
const
xAOD::TrigComposite::ConstAccessor<uint16_t> moduleId(
"moduleId"
);
36
const
xAOD::TrigComposite::ConstAccessor<uint32_t>
totalSize
(
"totalSize"
);
37
const
xAOD::TrigComposite::ConstAccessor<std::vector<std::string>> typeNameVec(
"typeName"
);
38
const
xAOD::TrigComposite::ConstAccessor<std::vector<uint32_t>> sizeVec(
"size"
);
39
const
xAOD::TrigComposite::ConstAccessor<std::vector<char>> isRecordedVec(
"isRecorded"
);
40
size_t
counter = 0;
41
const
size_t
nInfos = truncationInfo->size();
42
for
(
const
xAOD::TrigComposite
* info : *truncationInfo) {
43
++counter;
44
std::ostringstream
ss
;
45
ss
<< std::endl <<
"================================================================================"
<< std::endl;
46
47
//Print general information
48
ss
<<
"Info number "
<< counter <<
" / "
<< nInfos << std::endl;
49
ss
<<
"Module ID: "
<< moduleId(*info) << std::endl;
50
ss
<<
"Total size: "
<<
totalSize
(*info)/1024. <<
" kB"
<< std::endl << std::endl;
51
52
ss
<<
"Passing Chains IDs (look these IDs up in a menu JSON): "
;
53
for
(
const
TrigCompositeUtils::DecisionID
chainID :
TrigCompositeUtils::decisionIDs
(info)) {
54
ss
<< chainID <<
", "
;
55
}
56
ss
<< std::endl << std::endl;
57
58
// Collect name+size+isRecorded in one structure and sort by descending size
59
std::vector<CollectionDebugInfo> collections;
60
for
(
size_t
i=0; i<typeNameVec(*info).size(); ++i) {
61
collections.push_back({typeNameVec(*info).at(i),
62
sizeVec(*info).at(i),
63
static_cast<
bool
>
(isRecordedVec(*info).at(i))});
64
}
65
std::sort
(collections.begin(), collections.end(), cmpCollections);
66
67
// Print information about all collections
68
ss
<<
"Found "
<< collections.size() <<
" collections in this module"
<< std::endl;
69
ss
<<
"--------------------------------------------------------------------------------"
<< std::endl;
70
ss
<<
"| Size [kB] | Recorded? | Name |"
<< std::endl;
71
for
(
const
CollectionDebugInfo& coll : collections) {
72
ss
<<
"| "
<< std::setw(9) << std::setprecision(2) << std::fixed << coll.size/1024.;
73
ss
<< (coll.isRecorded ?
" | Y | "
:
" | N | "
);
74
ss
<< coll.name <<
" |"
<< std::endl;
75
}
76
ss
<<
"--------------------------------------------------------------------------------"
<< std::endl;
77
ss
<<
"================================================================================"
<< std::endl;
78
ATH_MSG_INFO
(
ss
.str());
79
}
80
ATH_MSG_DEBUG
(
"Execution finished"
);
81
return
StatusCode::SUCCESS;
82
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
ss
static Double_t ss
Definition
LArPhysWaveHECTool.cxx:37
totalSize
static unsigned int totalSize(const MultiDimArray< T, N > &ht)
Definition
MultiDimArray.h:310
TrigCompositeUtils.h
TruncationAnalysisAlg.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
TruncationAnalysisAlg::execute
virtual StatusCode execute(const EventContext &context) const override
Definition
TruncationAnalysisAlg.cxx:31
TruncationAnalysisAlg::TruncationAnalysisAlg
TruncationAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TruncationAnalysisAlg.cxx:23
TruncationAnalysisAlg::m_truncationInfoKey
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_truncationInfoKey
Definition
TruncationAnalysisAlg.h:22
TruncationAnalysisAlg::initialize
virtual StatusCode initialize() override
Definition
TruncationAnalysisAlg.cxx:26
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition
TrigComposite_v1.h:27
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition
TrigCompositeUtilsRoot.cxx:65
plotBeamSpotMon.b
b
Definition
plotBeamSpotMon.py:76
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
xAOD::TrigComposite
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
Definition
TrigComposite.h:16
xAOD::uint32_t
setEventNumber uint32_t
Definition
EventInfo_v1.cxx:127
Generated on
for ATLAS Offline Software by
1.17.0