ATLAS Offline Software
TestBeam
TBRec
src
TBPreScalerStreamerTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TBEventStreamerTool.h
"
6
#include "
TBPreScalerStreamerTool.h
"
7
8
// already included in TBPreScalerStreamerTool.h
9
//#include "CLHEP/Random/RanluxEngine.h"
10
11
#include <string>
12
13
using
CLHEP::RanluxEngine;
14
15
TBPreScalerStreamerTool::TBPreScalerStreamerTool
(
const
std::string&
type
,
16
const
std::string&
name
,
17
const
IInterface*
parent
)
18
:
TBEventStreamerTool
(
type
,
name
,
parent
)
19
, m_acceptFraction(1.)
20
, m_randomizer(nullptr)
21
{
22
declareInterface<TBEventStreamerTool>(
this
);
23
declareProperty
(
"AcceptEventFraction"
,
m_acceptFraction
);
24
}
25
26
TBPreScalerStreamerTool::~TBPreScalerStreamerTool
()
27
{ }
28
29
StatusCode
TBPreScalerStreamerTool::initializeTool
()
30
{
31
// check configuration
32
if
( m_acceptFraction < 0 || m_acceptFraction > 1 )
33
{
34
MsgStream
report
(
msgSvc
(),
name
());
35
report
<< MSG::ERROR
36
<<
"event accept frequency outside allowed range [0,1]"
37
<<
endmsg
;
38
return
StatusCode::FAILURE;
39
}
40
// initialize randomizer
41
m_randomizer
=
new
RanluxEngine();
42
return
m_randomizer
!= 0
43
? StatusCode::SUCCESS
44
: StatusCode::FAILURE;
45
}
46
47
StatusCode
TBPreScalerStreamerTool::accept
()
48
{
49
return
m_randomizer
->flat() <
m_acceptFraction
50
? StatusCode::SUCCESS
51
: StatusCode::FAILURE;
52
}
TBPreScalerStreamerTool::TBPreScalerStreamerTool
TBPreScalerStreamerTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition:
TBPreScalerStreamerTool.cxx:15
TBPreScalerStreamerTool::m_acceptFraction
double m_acceptFraction
Definition:
TBPreScalerStreamerTool.h:40
TBPreScalerStreamerTool::~TBPreScalerStreamerTool
virtual ~TBPreScalerStreamerTool()
Definition:
TBPreScalerStreamerTool.cxx:26
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition:
AthCommonDataStore.h:145
checkTP.report
report
Definition:
checkTP.py:127
TBEventStreamerTool.h
TBPreScalerStreamerTool::initializeTool
virtual StatusCode initializeTool() override
Definition:
TBPreScalerStreamerTool.cxx:29
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition:
StdJOSetup.py:36
endmsg
#define endmsg
Definition:
AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition:
test_pyathena.py:15
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
TBPreScalerStreamerTool::accept
virtual StatusCode accept() override
Definition:
TBPreScalerStreamerTool.cxx:47
TBPreScalerStreamerTool.h
TBEventStreamerTool
Definition:
TBEventStreamerTool.h:15
TBPreScalerStreamerTool::m_randomizer
CLHEP::RanluxEngine * m_randomizer
Definition:
TBPreScalerStreamerTool.h:46
python.CaloScaleNoiseConfig.type
type
Definition:
CaloScaleNoiseConfig.py:78
Generated on Mon Dec 23 2024 21:19:16 for ATLAS Offline Software by
1.8.18