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
16#include <TRandomGen.h>
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:
59 BootstrapGeneratorAlg(const std::string &name,
60 ISvcLocator *pSvcLocator);
61
62 public:
63 StatusCode initialize() override;
64
65 public:
66 StatusCode execute() override;
67
69 private:
71
73 private:
75 this, "eventInfo", "EventInfo", "the EventInfo container"};
76
78 private:
79 Gaudi::Property<int> m_nReplicas {this, "nReplicas", 1000, "number of bootstrapped weights (toys) to generate"};
80
82 private:
83 Gaudi::Property<bool> m_data {this, "isData", false, "whether we are running on data"};
84
86 private:
88
90 private:
91 std::vector<std::uint8_t> m_weights;
92
94 private:
96 this, "decorationName", "bootstrapWeights_%SYS%", "decoration name for the vector of bootstrapped weights"};
97 };
98} // namespace CP
99
100#endif
SysListHandle m_systematicsList
the systematics list we run
BootstrapGeneratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
std::vector< std::uint8_t > m_weights
the vector of bootstrap replica weights
Gaudi::Property< int > m_nReplicas
the number of bootstrap replicas
BootstrapGenerator m_bootstrap
the bootstrap generator instance
SysWriteDecorHandle< std::vector< std::uint8_t > > m_decoration
the output decoration
SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the EventInfo container
Gaudi::Property< bool > m_data
flag whether we are running on data
a class to generate random numbers with a unique seed
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
a class managing the property to configure the list of systematics to process
a data handle for reading systematics varied input data
a data handle for reading systematics varied input data
the (new) base class for EventLoop algorithms
Select isolated Photons, Electrons and Muons.