ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
PileUpComps
src
TestPileUpTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include <algorithm>
6
7
#include "
TestPileUpTool.h
"
8
9
TestPileUpTool::TestPileUpTool
(
const
std::string&
type
,
10
const
std::string& name,
11
const
IInterface* parent)
12
:
PileUpToolBase
(
type
, name, parent)
13
{
14
}
15
16
StatusCode
TestPileUpTool::prepareEvent
(
const
EventContext&
/*ctx*/
,
unsigned
int
nInputEvents)
17
{
18
ATH_MSG_INFO
(
"prepareEvent: expect to process "
<< nInputEvents <<
" events this time."
);
19
return
StatusCode::SUCCESS;
20
}
21
22
StatusCode
TestPileUpTool::mergeEvent
(
const
EventContext&
/*ctx*/
)
23
{
24
for
(
const
auto
& bc :
m_seen
)
25
{
26
ATH_MSG_INFO
(
"mergeEvent: there are "
<< bc.first <<
" events in bunch xing "
<< bc.second );
27
}
28
return
StatusCode::SUCCESS;
29
}
30
31
StatusCode
TestPileUpTool::processBunchXing
(
int
bunchXing,
32
SubEventIterator
bSubEvents,
33
SubEventIterator
eSubEvents)
34
{
35
m_seen
.push_back(std::make_pair(std::distance(bSubEvents,eSubEvents), bunchXing));
36
if
(
m_doFiltering
&& bunchXing==0)
37
{
38
if
(
m_maxInTimePileUp
<
m_seen
.back().first)
39
{
40
ATH_MSG_INFO
(
"Triggering filter as there were "
<<
m_seen
.back().first <<
" pile-up events in time."
);
41
m_filterPassed
=
false
;
42
}
43
}
44
45
SubEventIterator
iEvt(bSubEvents);
46
while
(iEvt != eSubEvents)
47
{
48
StoreGateSvc
& seStore(*iEvt->ptr()->evtStore());
49
ATH_MSG_DEBUG
(
"SubEvt EventInfo from StoreGate "
<< seStore.name() <<
" : "
50
<<
" bunch crossing : "
<< bunchXing
51
<<
" time offset: "
<< iEvt->time()
52
<<
" event: "
<< iEvt->ptr()->eventNumber()
53
<<
" run: "
<< iEvt->ptr()->runNumber()
54
);
55
++iEvt;
56
}
57
return
StatusCode::SUCCESS;
58
}
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition
IPileUpTool.h:22
TestPileUpTool.h
a sample implementation of IPileUpTool to test the framework
PileUpToolBase::m_filterPassed
bool m_filterPassed
Definition
PileUpToolBase.h:60
PileUpToolBase::PileUpToolBase
PileUpToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition
PileUpToolBase.cxx:7
StoreGateSvc
The Athena Transient Store API.
Definition
StoreGateSvc.h:120
TestPileUpTool::m_maxInTimePileUp
Gaudi::Property< unsigned int > m_maxInTimePileUp
Definition
TestPileUpTool.h:46
TestPileUpTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int nInputEvents) override final
called before the bunchXing loop
Definition
TestPileUpTool.cxx:16
TestPileUpTool::processBunchXing
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
called for each active bunch-crossing to process current SubEvents bunchXing is in ns
Definition
TestPileUpTool.cxx:31
TestPileUpTool::TestPileUpTool
TestPileUpTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TestPileUpTool.cxx:9
TestPileUpTool::m_doFiltering
Gaudi::Property< bool > m_doFiltering
Definition
TestPileUpTool.h:45
TestPileUpTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
called at the end of the subevts loop.
Definition
TestPileUpTool.cxx:22
TestPileUpTool::m_seen
std::vector< std::pair< unsigned int, int > > m_seen
return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase...
Definition
TestPileUpTool.h:44
type
Generated on
for ATLAS Offline Software by
1.17.0