ATLAS Offline Software
Loading...
Searching...
No Matches
BootstrapGeneratorAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#ifndef ASG_ANALYSIS_ALGORITHMS__BOOTSTRAP_GENERATOR_ALG_H
8#define ASG_ANALYSIS_ALGORITHMS__BOOTSTRAP_GENERATOR_ALG_H
9
15#include <TRandomGen.h>
16#include <vector>
17
18namespace CP
19{
22 {
24 public:
26
28 public:
29 std::uint64_t fnv1a_64(const void *buffer, size_t size, std::uint64_t offset_basis);
30
32 public:
33 void setSeed(std::uint64_t eventNumber, std::uint32_t runNumber, std::uint32_t mcChannelNumber);
34
36 public:
37 std::uint64_t generateSeed(std::uint64_t eventNumber, std::uint32_t runNumber, std::uint32_t mcChannelNumber);
38
40 public:
41 std::uint8_t getBootstrap() { return m_rng.Poisson(1); };
42
44 private:
45 static constexpr std::uint64_t m_offset = 14695981039346656037u;
46 static constexpr std::uint64_t m_prime = 1099511628211u;
47
49 private:
50 TRandomRanluxpp m_rng;
51 };
52
53
56 {
58 public:
60
61 public:
62 StatusCode initialize() override;
63
64 public:
65 StatusCode execute(const EventContext& ctx) const override;
66
68 private:
70 this, "eventInfo", "EventInfo", "the EventInfo container"};
71
73 private:
74 Gaudi::Property<int> m_nReplicas {this, "nReplicas", 1000, "number of bootstrapped weights (toys) to generate"};
75
77 private:
78 Gaudi::Property<bool> m_data {this, "isData", false, "whether we are running on data"};
79
81 private:
83 this, "decorationName", m_eventInfoKey, "bootstrapWeights", "decoration name for the vector of bootstrapped weights"};
84 };
85} // namespace CP
86
87#endif
Property holding a SG store/key/clid from which a ReadHandle is made.
size_t size() const
Number of registered mappings.
an algorithm to compute per-event bootstrap replica weights
SG::WriteDecorHandleKey< xAOD::EventInfo > m_decorationKey
the output decoration
Gaudi::Property< int > m_nReplicas
the number of bootstrap replicas
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
the EventInfo container
StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< bool > m_data
flag whether we are running on data
std::uint64_t fnv1a_64(const void *buffer, size_t size, std::uint64_t offset_basis)
implementation of the hash function from https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo...
void setSeed(std::uint64_t eventNumber, std::uint32_t runNumber, std::uint32_t mcChannelNumber)
set the seed of the random number generator based on event properties
static constexpr std::uint64_t m_offset
constants for seed generation
TRandomRanluxpp m_rng
the random number generator (Ranlux++)
static constexpr std::uint64_t m_prime
std::uint8_t getBootstrap()
get the next bootstrap weight
std::uint64_t generateSeed(std::uint64_t eventNumber, std::uint32_t runNumber, std::uint32_t mcChannelNumber)
generate a unique seed based on event identifiers
BootstrapGenerator()
the standard constructor
the base class for EventLoop reentrant algorithms
AnaReentrantAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Select isolated Photons, Electrons and Muons.