ATLAS Offline Software
Loading...
Searching...
No Matches
MetaDataAlg.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 MUONPERFORMANCEALGS_MUONTPMETADATAALG_H
5#define MUONPERFORMANCEALGS_MUONTPMETADATAALG_H
12
13namespace MuonVal{
14
16public:
18 virtual ~MetaDataAlg() = default;
19
20 StatusCode initialize() override;
21 StatusCode execute() override;
22 StatusCode finalize() override;
23 StatusCode beginInputFile() override;
24 unsigned int cardinality() const override final { return 1; }
25
26private:
27 SG::ReadHandleKey<xAOD::EventInfo> m_infoKey{this, "EvtInfoKey", "EventInfo"};
29 Gaudi::Property<std::string> m_stream{this, "OutStream", "MUONTP"};
30
31 //
32 Gaudi::Property<bool> m_isData{this, "isData", false};
34 Gaudi::Property<bool> m_isDerivedAOD{this, "isDAOD", false};
36 Gaudi::Property<bool> m_isAF2{this, "isAF2", false};
38 Gaudi::Property<bool> m_storeLHE{this, "writeLHE", false};
39
40 ToolHandle<CP::IPileupReweightingTool> m_prwTool{this, "prwTool", ""};
41 bool m_hasPrwTool{false};
43 std::unique_ptr<MuonTesterTree> m_MetaDataTree{nullptr};
44
47 struct RunMetaData {
48 ~RunMetaData() = default;
49 RunMetaData(unsigned int run, const std::string& stream) : run_number{run}, trigger_stream{stream} {}
50 bool operator<(const RunMetaData& other) const { return run_number < other.run_number; }
52 unsigned int run_number{0};
54 Long64_t tot_events{0};
56 Long64_t proc_events{0};
58 std::string trigger_stream{};
60 std::set<unsigned int> total_lumi_blocks{};
62 std::set<unsigned int> processed_blocks{};
63
64 bool has_book_keeper{false};
65 };
66 struct SimMetaData {
67 ~SimMetaData() = default;
68 SimMetaData(int dsid, unsigned int prw) : mc_channel{dsid}, prw_channel{prw} {}
69 bool operator<(const SimMetaData& other) const {
70 if (other.mc_channel != mc_channel) return mc_channel < other.mc_channel;
71 if (other.prw_channel != prw_channel) return prw_channel < other.prw_channel;
72 return variation_number < other.variation_number;
73 }
74
75 int mc_channel{0};
77 unsigned int prw_channel{0};
79 double prw_lumi{0};
81 Long64_t tot_events{0};
83 Long64_t proc_events{0};
85 double sum_w{0.};
86 double sum_w_squared{0.};
87
89 std::string weight_name{};
91 unsigned int variation_number{0};
93 bool has_book_keeper{false};
95 bool warned{false};
96 };
97 StatusCode fillDataTree();
98 StatusCode fillSimulationTree();
99
100
101 std::vector<SimMetaData> m_sim_meta{};
102 std::vector<RunMetaData> m_run_meta{};
103
104 const xAOD::CutBookkeeper* RetrieveCutBookKeeper(const std::string& stream, const std::string& cbk_name = "AllExecutedEvents") const;
105};
106}
107#endif //> !MUONPERFORMANCEALGS_MUONTPMETADATAALG_H
Property holding a SG store/key/clid from which a ReadHandle is made.
AthAnalysisAlgorithm(const std::string &name)
Constructor taking just a name.
unsigned int cardinality() const override final
Definition MetaDataAlg.h:24
std::vector< SimMetaData > m_sim_meta
StatusCode beginInputFile() override
Function called when a new input file is opened user can read input metadata from inputMetaStore()
Gaudi::Property< bool > m_isData
Definition MetaDataAlg.h:32
const xAOD::CutBookkeeper * RetrieveCutBookKeeper(const std::string &stream, const std::string &cbk_name="AllExecutedEvents") const
StatusCode finalize() override
StatusCode fillSimulationTree()
StatusCode execute() override
StatusCode initialize() override
std::vector< RunMetaData > m_run_meta
std::unique_ptr< MuonTesterTree > m_MetaDataTree
Meta data tree object.
Definition MetaDataAlg.h:43
SG::ReadHandleKey< xAOD::EventInfo > m_infoKey
Definition MetaDataAlg.h:27
Gaudi::Property< bool > m_storeLHE
Store LHE weights.
Definition MetaDataAlg.h:38
Gaudi::Property< bool > m_isAF2
On AFII simulation.
Definition MetaDataAlg.h:36
StatusCode fillDataTree()
Gaudi::Property< bool > m_isDerivedAOD
Is derived DAOD property.
Definition MetaDataAlg.h:34
ToolHandle< CP::IPileupReweightingTool > m_prwTool
Definition MetaDataAlg.h:40
AthAnalysisAlgorithm(const std::string &name)
Constructor taking just a name.
virtual ~MetaDataAlg()=default
Gaudi::Property< std::string > m_stream
Output file stream.
Definition MetaDataAlg.h:29
Property holding a SG store/key/clid from which a ReadHandle is made.
Class to store array like branches into the n-tuples.
Definition HitValAlg.cxx:19
Definition run.py:1
CutBookkeeper_v1 CutBookkeeper
Define the latest version of the CutBookkeeper class.
RunMetaData(unsigned int run, const std::string &stream)
Definition MetaDataAlg.h:49
std::set< unsigned int > total_lumi_blocks
Luminosity blocks from the cache upstream.
Definition MetaDataAlg.h:60
Long64_t tot_events
Total events from the upstream AOD.
Definition MetaDataAlg.h:54
std::set< unsigned int > processed_blocks
Luminosity blocks from the file.
Definition MetaDataAlg.h:62
Long64_t proc_events
Processed Events.
Definition MetaDataAlg.h:56
unsigned int run_number
run number of the current file
Definition MetaDataAlg.h:52
bool operator<(const RunMetaData &other) const
Definition MetaDataAlg.h:50
std::string trigger_stream
Name of the trigger stream.
Definition MetaDataAlg.h:58
bool operator<(const SimMetaData &other) const
Definition MetaDataAlg.h:69
unsigned int prw_channel
run number used for the pile-up campaign
Definition MetaDataAlg.h:77
Long64_t proc_events
Number of processed events in the file itself.
Definition MetaDataAlg.h:83
bool warned
Make sure that the WARNING is only printed once.
Definition MetaDataAlg.h:95
std::string weight_name
Name of the weight variation.
Definition MetaDataAlg.h:89
int mc_channel
Mc channel number.
Definition MetaDataAlg.h:75
unsigned int variation_number
Position inside the weight vector.
Definition MetaDataAlg.h:91
double sum_w
Sum of weights.
Definition MetaDataAlg.h:85
SimMetaData(int dsid, unsigned int prw)
Definition MetaDataAlg.h:68
bool has_book_keeper
Print the WARNING.
Definition MetaDataAlg.h:93
double prw_lumi
Expected luminosity.
Definition MetaDataAlg.h:79
Long64_t tot_events
Number of total events from the file upstream.
Definition MetaDataAlg.h:81