ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigSteer
HLTSeeding
src
PrescalingEmulationTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
PrescalingEmulationTool.h
"
5
#include "
AthenaKernel/SlotSpecificObj.h
"
6
#include "GaudiKernel/IToolSvc.h"
7
#include "CLHEP/Random/RandomEngine.h"
8
#include "CLHEP/Random/Ranlux64Engine.h"
9
10
11
const
std::function< CLHEP::HepRandomEngine*(void) >
RanluxFactory
= []()->CLHEP::HepRandomEngine*{
12
return
new
CLHEP::Ranlux64Engine();
13
};
14
15
16
PrescalingEmulationTool::PrescalingEmulationTool
(
const
std::string&
type
,
17
const
std::string& name,
18
const
IInterface* parent )
19
: base_class(
type
, name, parent),
20
m_RNGEngines
(
RanluxFactory
,
SG
::getNSlots() ) { }
21
22
23
StatusCode
PrescalingEmulationTool::initialize
() {
24
for
(
const
std::string& confElement:
m_prescalingConfig
) {
25
std::string chainName( confElement, 0, confElement.find(
':'
) );
26
std::string psValue( confElement, confElement.find(
':'
)+1 );
27
ATH_MSG_DEBUG
(
"Decoded part of the config "
<< chainName <<
" "
<< psValue );
28
m_prescalingInfo
[
HLT::Identifier
( chainName ) ] = 1./std::stof( psValue );
29
}
30
return
StatusCode::SUCCESS;
31
}
32
33
34
StatusCode
PrescalingEmulationTool::prescaleChains
(
const
EventContext& ctx,
35
const
HLT::IDVec
& initiallyActive,
36
HLT::IDVec
& remainActive,
37
bool
forExpressStream )
const
{
38
39
ATH_MSG_DEBUG
(
"Express stream prescaling ignored in Emulation tool"
<< forExpressStream);
40
41
if
( initiallyActive.empty() ) {
42
return
StatusCode::SUCCESS;
43
}
44
45
// obtain CTP time
46
remainActive.reserve( initiallyActive.size() );
47
48
// create the seed from the event time
49
size_t
seed = ctx.eventID().time_stamp() ^ ctx.eventID().time_stamp_ns_offset();
50
CLHEP::HepRandomEngine* engine =
m_RNGEngines
.getEngine( ctx );
51
engine->setSeed( seed, 0 );
52
for
(
auto
ch: initiallyActive ) {
53
PrescalingInfo::const_iterator chainPS =
m_prescalingInfo
.find( ch );
54
const
bool
decision = (chainPS !=
m_prescalingInfo
.end()) ?
55
engine->flat() < chainPS->second :
56
bool(
m_keepUnknownChains
);
57
ATH_MSG_DEBUG
(
"Prescaling decision for chain "
<< ch <<
" "
<< decision );
58
if
( decision ) {
59
remainActive.push_back( ch );
60
}
61
}
62
return
StatusCode::SUCCESS;
63
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
SlotSpecificObj.h
Maintain a set of objects, one per slot.
RanluxFactory
const std::function< CLHEP::HepRandomEngine *(void) > RanluxFactory
Definition
PrescalingEmulationTool.cxx:11
PrescalingEmulationTool.h
HLT::Identifier
Definition
TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:19
PrescalingEmulationTool::m_RNGEngines
ATHRNG::RNGWrapper m_RNGEngines
Definition
PrescalingEmulationTool.h:52
PrescalingEmulationTool::m_prescalingInfo
PrescalingInfo m_prescalingInfo
Definition
PrescalingEmulationTool.h:55
PrescalingEmulationTool::prescaleChains
virtual StatusCode prescaleChains(const EventContext &ctx, const HLT::IDVec &initiallyActive, HLT::IDVec &remainActive, bool forExpressStream=false) const override
Definition
PrescalingEmulationTool.cxx:34
PrescalingEmulationTool::m_prescalingConfig
Gaudi::Property< std::vector< std::string > > m_prescalingConfig
Definition
PrescalingEmulationTool.h:49
PrescalingEmulationTool::initialize
virtual StatusCode initialize() override
Definition
PrescalingEmulationTool.cxx:23
PrescalingEmulationTool::m_keepUnknownChains
Gaudi::Property< bool > m_keepUnknownChains
Definition
PrescalingEmulationTool.h:46
PrescalingEmulationTool::PrescalingEmulationTool
PrescalingEmulationTool()
HLT::IDVec
std::vector< HLT::Identifier > IDVec
Definition
TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:55
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
type
Generated on
for ATLAS Offline Software by
1.17.0