ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
Tools
RDOAnalysis
src
EventInfoRDOAnalysis.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
EventInfoRDOAnalysis.h
"
6
#include "
StoreGate/ReadHandle.h
"
7
8
#include <TH1.h>
9
#include <TTree.h>
10
11
12
StatusCode
EventInfoRDOAnalysis::initialize
()
13
{
14
// This will check that the properties were initialized
15
// properly by job configuration.
16
ATH_CHECK
(
m_eventInfoKey
.initialize() );
17
18
19
m_tree
=
new
TTree(
m_ntupleName
.value().c_str(),
"EventInfoRDOAnalysis"
);
20
ATH_CHECK
(
histSvc
()->regTree(
m_ntuplePath
.value() +
m_ntupleName
.value(),
m_tree
));
21
m_tree
->Branch(
"runNumber"
, &
m_runNumber
);
22
m_tree
->Branch(
"eventNumber"
, &
m_eventNumber
);
23
m_tree
->Branch(
"lumiBlock"
, &
m_lumiBlock
);
24
m_tree
->Branch(
"bcid"
, &
m_bcid
);
25
26
m_tree
->Branch(
"actualInteractionsPerCrossing"
, &
m_actualInteractionsPerCrossing
);
27
m_tree
->Branch(
"averageInteractionsPerCrossing"
, &
m_averageInteractionsPerCrossing
);
28
29
m_tree
->Branch(
"beamPosX"
, &
m_beamPosX
);
30
m_tree
->Branch(
"beamPosY"
, &
m_beamPosY
);
31
m_tree
->Branch(
"beamPosZ"
, &
m_beamPosZ
);
32
m_tree
->Branch(
"beamPosSigmaX"
, &
m_beamPosSigmaX
);
33
m_tree
->Branch(
"beamPosSigmaY"
, &
m_beamPosSigmaY
);
34
m_tree
->Branch(
"beamPosSigmaZ"
, &
m_beamPosSigmaZ
);
35
36
37
// HISTOGRAMS
38
m_h_actualInteractionsPerCrossing
=
new
TH1F(
"h_actualInteractionsPerCrossing"
,
"actualInteractionsPerCrossing"
, 100, 0, 100);
39
m_h_actualInteractionsPerCrossing
->StatOverflows();
40
ATH_CHECK
(
histSvc
()->regHist(
m_histPath
+
m_h_actualInteractionsPerCrossing
->GetName(),
m_h_actualInteractionsPerCrossing
));
41
42
m_h_averageInteractionsPerCrossing
=
new
TH1F(
"h_averageInteractionsPerCrossing"
,
"averageInteractionsPerCrossing"
, 100, 0, 100);
43
m_h_averageInteractionsPerCrossing
->StatOverflows();
44
ATH_CHECK
(
histSvc
()->regHist(
m_histPath
+
m_h_averageInteractionsPerCrossing
->GetName(),
m_h_averageInteractionsPerCrossing
));
45
46
return
StatusCode::SUCCESS;
47
}
48
49
StatusCode
EventInfoRDOAnalysis::execute
(
const
EventContext& ctx)
50
{
51
52
const
xAOD::EventInfo
* eventInfo{
nullptr
};
53
ATH_CHECK
(
SG::get
(eventInfo,
m_eventInfoKey
, ctx));
54
55
m_runNumber
= eventInfo->
runNumber
();
56
m_eventNumber
= eventInfo->
eventNumber
();
57
m_lumiBlock
= eventInfo->
lumiBlock
();
58
m_bcid
= eventInfo->
bcid
();
59
60
m_actualInteractionsPerCrossing
= eventInfo->
actualInteractionsPerCrossing
();
61
m_averageInteractionsPerCrossing
= eventInfo->
averageInteractionsPerCrossing
();
62
m_h_actualInteractionsPerCrossing
->Fill(
m_actualInteractionsPerCrossing
);
63
m_h_averageInteractionsPerCrossing
->Fill(
m_averageInteractionsPerCrossing
);
64
65
m_beamPosX
= eventInfo->
beamPosX
();
66
m_beamPosY
= eventInfo->
beamPosY
();
67
m_beamPosZ
= eventInfo->
beamPosZ
();
68
69
m_beamPosSigmaX
= eventInfo->
beamPosSigmaX
();
70
m_beamPosSigmaY
= eventInfo->
beamPosSigmaY
();
71
m_beamPosSigmaZ
= eventInfo->
beamPosSigmaZ
();
72
73
m_tree
->Fill();
74
75
return
StatusCode::SUCCESS;
76
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
EventInfoRDOAnalysis.h
ReadHandle.h
Handle class for reading from StoreGate.
AthHistogramAlgorithm::histSvc
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
Definition
AthHistogramAlgorithm.h:113
EventInfoRDOAnalysis::m_runNumber
uint32_t m_runNumber
Definition
EventInfoRDOAnalysis.h:39
EventInfoRDOAnalysis::m_h_actualInteractionsPerCrossing
TH1 * m_h_actualInteractionsPerCrossing
Definition
EventInfoRDOAnalysis.h:56
EventInfoRDOAnalysis::m_beamPosSigmaY
float m_beamPosSigmaY
Definition
EventInfoRDOAnalysis.h:52
EventInfoRDOAnalysis::m_beamPosZ
float m_beamPosZ
Definition
EventInfoRDOAnalysis.h:49
EventInfoRDOAnalysis::m_histPath
Gaudi::Property< std::string > m_histPath
Definition
EventInfoRDOAnalysis.h:32
EventInfoRDOAnalysis::m_beamPosY
float m_beamPosY
Definition
EventInfoRDOAnalysis.h:48
EventInfoRDOAnalysis::initialize
virtual StatusCode initialize() override final
Definition
EventInfoRDOAnalysis.cxx:12
EventInfoRDOAnalysis::m_bcid
uint32_t m_bcid
Definition
EventInfoRDOAnalysis.h:42
EventInfoRDOAnalysis::m_ntuplePath
Gaudi::Property< std::string > m_ntuplePath
Definition
EventInfoRDOAnalysis.h:33
EventInfoRDOAnalysis::m_actualInteractionsPerCrossing
float m_actualInteractionsPerCrossing
Definition
EventInfoRDOAnalysis.h:44
EventInfoRDOAnalysis::m_tree
TTree * m_tree
Definition
EventInfoRDOAnalysis.h:59
EventInfoRDOAnalysis::m_ntupleName
Gaudi::Property< std::string > m_ntupleName
Definition
EventInfoRDOAnalysis.h:34
EventInfoRDOAnalysis::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition
EventInfoRDOAnalysis.h:30
EventInfoRDOAnalysis::m_h_averageInteractionsPerCrossing
TH1 * m_h_averageInteractionsPerCrossing
Definition
EventInfoRDOAnalysis.h:57
EventInfoRDOAnalysis::m_beamPosSigmaX
float m_beamPosSigmaX
Definition
EventInfoRDOAnalysis.h:51
EventInfoRDOAnalysis::execute
virtual StatusCode execute(const EventContext &ctx) override final
Execute method.
Definition
EventInfoRDOAnalysis.cxx:49
EventInfoRDOAnalysis::m_eventNumber
unsigned long long m_eventNumber
Definition
EventInfoRDOAnalysis.h:40
EventInfoRDOAnalysis::m_lumiBlock
uint32_t m_lumiBlock
Definition
EventInfoRDOAnalysis.h:41
EventInfoRDOAnalysis::m_beamPosX
float m_beamPosX
Definition
EventInfoRDOAnalysis.h:47
EventInfoRDOAnalysis::m_beamPosSigmaZ
float m_beamPosSigmaZ
Definition
EventInfoRDOAnalysis.h:53
EventInfoRDOAnalysis::m_averageInteractionsPerCrossing
float m_averageInteractionsPerCrossing
Definition
EventInfoRDOAnalysis.h:45
xAOD::EventInfo_v1::beamPosSigmaY
float beamPosSigmaY() const
The width of the beam spot in the Y direction.
xAOD::EventInfo_v1::lumiBlock
uint32_t lumiBlock() const
The current event's luminosity block number.
xAOD::EventInfo_v1::bcid
uint32_t bcid() const
The bunch crossing ID of the event.
xAOD::EventInfo_v1::beamPosX
float beamPosX() const
X coordinate of the beam spot position.
xAOD::EventInfo_v1::averageInteractionsPerCrossing
float averageInteractionsPerCrossing() const
Average interactions per crossing for all BCIDs - for out-of-time pile-up.
Definition
EventInfo_v1.cxx:397
xAOD::EventInfo_v1::actualInteractionsPerCrossing
float actualInteractionsPerCrossing() const
Average interactions per crossing for the current BCID - for in-time pile-up.
Definition
EventInfo_v1.cxx:380
xAOD::EventInfo_v1::beamPosSigmaX
float beamPosSigmaX() const
The width of the beam spot in the X direction.
xAOD::EventInfo_v1::beamPosZ
float beamPosZ() const
Z coordinate of the beam spot position.
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
xAOD::EventInfo_v1::beamPosSigmaZ
float beamPosSigmaZ() const
The length of the beam spot in the Z direction.
xAOD::EventInfo_v1::beamPosY
float beamPosY() const
Y coordinate of the beam spot position.
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:281
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
Generated on
for ATLAS Offline Software by
1.17.0