ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
8// already included in TBPreScalerStreamerTool.h
9//#include "CLHEP/Random/RanluxEngine.h"
10
11#include <string>
12
13using CLHEP::RanluxEngine;
14
16 const std::string& name,
17 const IInterface* parent)
18 : TBEventStreamerTool(type,name,parent)
20 , m_randomizer(nullptr)
21{
22 declareInterface<TBEventStreamerTool>(this);
23 declareProperty("AcceptEventFraction",m_acceptFraction);
24}
25
28
30{
31 // check configuration
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
48{
49 return m_randomizer->flat() < m_acceptFraction
50 ? StatusCode::SUCCESS
51 : StatusCode::FAILURE;
52}
#define endmsg
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
TBEventStreamerTool(const std::string &name, const std::string &type, const IInterface *parent)
virtual StatusCode initializeTool() override
TBPreScalerStreamerTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode accept() override
CLHEP::RanluxEngine * m_randomizer