ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
8#include <TH1.h>
9#include <TTree.h>
10
11
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();
41
42 m_h_averageInteractionsPerCrossing = new TH1F("h_averageInteractionsPerCrossing", "averageInteractionsPerCrossing", 100, 0, 100);
45
46 return StatusCode::SUCCESS;
47}
48
50{
51
52 const xAOD::EventInfo* eventInfo{nullptr};
53 ATH_CHECK(SG::get(eventInfo, m_eventInfoKey, Gaudi::Hive::currentContext()));
54
55 m_runNumber = eventInfo->runNumber();
56 m_eventNumber = eventInfo->eventNumber();
57 m_lumiBlock = eventInfo->lumiBlock();
58 m_bcid = eventInfo->bcid();
59
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading from StoreGate.
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
Gaudi::Property< std::string > m_histPath
virtual StatusCode initialize() override final
Gaudi::Property< std::string > m_ntuplePath
Gaudi::Property< std::string > m_ntupleName
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
unsigned long long m_eventNumber
virtual StatusCode execute() override final
float beamPosSigmaY() const
The width of the beam spot in the Y direction.
uint32_t lumiBlock() const
The current event's luminosity block number.
uint32_t bcid() const
The bunch crossing ID of the event.
float beamPosX() const
X coordinate of the beam spot position.
float averageInteractionsPerCrossing() const
Average interactions per crossing for all BCIDs - for out-of-time pile-up.
float actualInteractionsPerCrossing() const
Average interactions per crossing for the current BCID - for in-time pile-up.
float beamPosSigmaX() const
The width of the beam spot in the X direction.
float beamPosZ() const
Z coordinate of the beam spot position.
uint32_t runNumber() const
The current event's run number.
uint64_t eventNumber() const
The current event's event number.
float beamPosSigmaZ() const
The length of the beam spot in the Z direction.
float beamPosY() const
Y coordinate of the beam spot position.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
EventInfo_v1 EventInfo
Definition of the latest event info version.