ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
AsgAnalysisAlgorithms
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
10
#include <
AnaAlgorithm/AnaReentrantAlgorithm.h
>
11
#include <
AsgDataHandles/ReadHandleKey.h
>
12
#include <
AsgDataHandles/WriteDecorHandleKey.h
>
13
#include <
xAODEventInfo/EventInfo.h
>
14
#include <
AsgTools/PropertyWrapper.h
>
15
#include <TRandomGen.h>
16
#include <vector>
17
18
namespace
CP
19
{
21
class
BootstrapGenerator
22
{
24
public
:
25
BootstrapGenerator
() {};
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
55
class
BootstrapGeneratorAlg
final :
public
EL::AnaReentrantAlgorithm
56
{
58
public
:
59
using
EL::AnaReentrantAlgorithm::AnaReentrantAlgorithm
;
60
61
public
:
62
StatusCode
initialize
()
override
;
63
64
public
:
65
StatusCode
execute
(
const
EventContext& ctx)
const override
;
66
68
private
:
69
SG::ReadHandleKey<xAOD::EventInfo>
m_eventInfoKey
{
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
:
82
SG::WriteDecorHandleKey<xAOD::EventInfo>
m_decorationKey
{
83
this
,
"decorationName"
,
m_eventInfoKey
,
"bootstrapWeights"
,
"decoration name for the vector of bootstrapped weights"
};
84
};
85
}
// namespace CP
86
87
#endif
AnaReentrantAlgorithm.h
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
WriteDecorHandleKey.h
PropertyWrapper.h
size
size_t size() const
Number of registered mappings.
CP::BootstrapGeneratorAlg
an algorithm to compute per-event bootstrap replica weights
Definition
BootstrapGeneratorAlg.h:56
CP::BootstrapGeneratorAlg::m_decorationKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_decorationKey
the output decoration
Definition
BootstrapGeneratorAlg.h:82
CP::BootstrapGeneratorAlg::m_nReplicas
Gaudi::Property< int > m_nReplicas
the number of bootstrap replicas
Definition
BootstrapGeneratorAlg.h:74
CP::BootstrapGeneratorAlg::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
the EventInfo container
Definition
BootstrapGeneratorAlg.h:69
CP::BootstrapGeneratorAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition
BootstrapGeneratorAlg.cxx:49
CP::BootstrapGeneratorAlg::m_data
Gaudi::Property< bool > m_data
flag whether we are running on data
Definition
BootstrapGeneratorAlg.h:78
CP::BootstrapGeneratorAlg::initialize
StatusCode initialize() override
Definition
BootstrapGeneratorAlg.cxx:35
CP::BootstrapGenerator::fnv1a_64
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...
Definition
BootstrapGeneratorAlg.cxx:11
CP::BootstrapGenerator::setSeed
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
Definition
BootstrapGeneratorAlg.cxx:29
CP::BootstrapGenerator::m_offset
static constexpr std::uint64_t m_offset
constants for seed generation
Definition
BootstrapGeneratorAlg.h:45
CP::BootstrapGenerator::m_rng
TRandomRanluxpp m_rng
the random number generator (Ranlux++)
Definition
BootstrapGeneratorAlg.h:50
CP::BootstrapGenerator::m_prime
static constexpr std::uint64_t m_prime
Definition
BootstrapGeneratorAlg.h:46
CP::BootstrapGenerator::getBootstrap
std::uint8_t getBootstrap()
get the next bootstrap weight
Definition
BootstrapGeneratorAlg.h:41
CP::BootstrapGenerator::generateSeed
std::uint64_t generateSeed(std::uint64_t eventNumber, std::uint32_t runNumber, std::uint32_t mcChannelNumber)
generate a unique seed based on event identifiers
Definition
BootstrapGeneratorAlg.cxx:21
CP::BootstrapGenerator::BootstrapGenerator
BootstrapGenerator()
the standard constructor
Definition
BootstrapGeneratorAlg.h:25
EL::AnaReentrantAlgorithm
the base class for EventLoop reentrant algorithms
Definition
AnaReentrantAlgorithm.h:51
EL::AnaReentrantAlgorithm::AnaReentrantAlgorithm
AnaReentrantAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition
AnaReentrantAlgorithm.cxx:29
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition
StoreGate/StoreGate/ReadHandleKey.h:40
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition
StoreGate/StoreGate/WriteDecorHandleKey.h:90
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
xAOD::eventNumber
eventNumber
Definition
EventInfo_v1.cxx:95
xAOD::mcChannelNumber
mcChannelNumber
Definition
EventInfo_v1.cxx:168
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0