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/AnaAlgorithm.h
>
11
#include <
SystematicsHandles/SysListHandle.h
>
12
#include <
SystematicsHandles/SysReadHandle.h
>
13
#include <
SystematicsHandles/SysWriteDecorHandle.h
>
14
#include <
xAODEventInfo/EventInfo.h
>
15
#include <
AsgTools/PropertyWrapper.h
>
16
#include <TRandomGen.h>
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::AnaAlgorithm
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
(
const
EventContext& ctx)
override
;
67
69
private
:
70
SysListHandle
m_systematicsList
{
this
};
71
73
private
:
74
SysReadHandle<xAOD::EventInfo>
m_eventInfoHandle
{
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
:
87
BootstrapGenerator
m_bootstrap
;
88
90
private
:
91
std::vector<std::uint8_t>
m_weights
;
92
94
private
:
95
SysWriteDecorHandle<std::vector<std::uint8_t>
>
m_decoration
{
96
this
,
"decorationName"
,
"bootstrapWeights_%SYS%"
,
"decoration name for the vector of bootstrapped weights"
};
97
};
98
}
// namespace CP
99
100
#endif
AnaAlgorithm.h
PropertyWrapper.h
size
size_t size() const
Number of registered mappings.
SysListHandle.h
SysReadHandle.h
SysWriteDecorHandle.h
CP::BootstrapGeneratorAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
BootstrapGeneratorAlg.h:70
CP::BootstrapGeneratorAlg::BootstrapGeneratorAlg
BootstrapGeneratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition
BootstrapGeneratorAlg.cxx:9
CP::BootstrapGeneratorAlg::m_weights
std::vector< std::uint8_t > m_weights
the vector of bootstrap replica weights
Definition
BootstrapGeneratorAlg.h:91
CP::BootstrapGeneratorAlg::m_nReplicas
Gaudi::Property< int > m_nReplicas
the number of bootstrap replicas
Definition
BootstrapGeneratorAlg.h:79
CP::BootstrapGeneratorAlg::m_bootstrap
BootstrapGenerator m_bootstrap
the bootstrap generator instance
Definition
BootstrapGeneratorAlg.h:87
CP::BootstrapGeneratorAlg::m_decoration
SysWriteDecorHandle< std::vector< std::uint8_t > > m_decoration
the output decoration
Definition
BootstrapGeneratorAlg.h:95
CP::BootstrapGeneratorAlg::m_eventInfoHandle
SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the EventInfo container
Definition
BootstrapGeneratorAlg.h:74
CP::BootstrapGeneratorAlg::m_data
Gaudi::Property< bool > m_data
flag whether we are running on data
Definition
BootstrapGeneratorAlg.h:83
CP::BootstrapGeneratorAlg::initialize
StatusCode initialize() override
Definition
BootstrapGeneratorAlg.cxx:39
CP::BootstrapGenerator
a class to generate random numbers with a unique seed
Definition
BootstrapGeneratorAlg.h:22
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:15
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:33
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:25
CP::BootstrapGenerator::BootstrapGenerator
BootstrapGenerator()
the standard constructor
Definition
BootstrapGeneratorAlg.h:25
CP::SysListHandle
a class managing the property to configure the list of systematics to process
Definition
SysListHandle.h:33
CP::SysReadHandle
a data handle for reading systematics varied input data
Definition
SysReadHandle.h:33
CP::SysWriteDecorHandle
a data handle for reading systematics varied input data
Definition
SysWriteDecorHandle.h:42
EL::AnaAlgorithm
the (new) base class for EventLoop algorithms
Definition
AnaAlgorithm.h:74
EL::AnaAlgorithm::execute
virtual::StatusCode execute()
execute this algorithm
Definition
AnaAlgorithm.cxx:315
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::eventNumber
eventNumber
Definition
EventInfo_v1.cxx:124
xAOD::mcChannelNumber
mcChannelNumber
Definition
EventInfo_v1.cxx:197
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0