ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
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
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
TBEventStreamerTool.h
TBPreScalerStreamerTool.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
TBEventStreamerTool::TBEventStreamerTool
TBEventStreamerTool(const std::string &name, const std::string &type, const IInterface *parent)
Definition
TBEventStreamerTool.cxx:8
TBPreScalerStreamerTool::~TBPreScalerStreamerTool
virtual ~TBPreScalerStreamerTool()
Definition
TBPreScalerStreamerTool.cxx:26
TBPreScalerStreamerTool::initializeTool
virtual StatusCode initializeTool() override
Definition
TBPreScalerStreamerTool.cxx:29
TBPreScalerStreamerTool::TBPreScalerStreamerTool
TBPreScalerStreamerTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TBPreScalerStreamerTool.cxx:15
TBPreScalerStreamerTool::accept
virtual StatusCode accept() override
Definition
TBPreScalerStreamerTool.cxx:47
TBPreScalerStreamerTool::m_randomizer
CLHEP::RanluxEngine * m_randomizer
Definition
TBPreScalerStreamerTool.h:46
TBPreScalerStreamerTool::m_acceptFraction
double m_acceptFraction
Definition
TBPreScalerStreamerTool.h:40
type
Generated on
for ATLAS Offline Software by
1.17.0