ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDTools
EventLoop
Root
DirectInputModule.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
//
9
// includes
10
//
11
12
#include <
EventLoop/DirectInputModule.h
>
13
14
#include <
EventLoop/IInputModuleActions.h
>
15
#include <
EventLoop/EventRange.h
>
16
#include <
RootCoreUtils/Assert.h
>
17
18
//
19
// method implementations
20
//
21
22
namespace
EL
23
{
24
namespace
Detail
25
{
26
StatusCode
DirectInputModule ::
27
processInputs (
ModuleData
&
/*data*/
,
IInputModuleActions
& actions)
28
{
29
Long64_t toSkip = this->
skipEvents
.value ();
30
std::optional<Long64_t> toProcess;
31
if
(this->
maxEvents
.value() != -1)
32
toProcess = this->
maxEvents
.value();
33
for
(
const
std::string& fileName :
fileList
.value())
34
{
35
// open the input file to inspect it
36
ANA_CHECK
(actions.
openInputFile
(fileName));
37
ANA_MSG_INFO
(
"Opened input file: "
<< fileName);
38
39
EventRange
eventRange;
40
eventRange.
m_url
= fileName;
41
eventRange.
m_endEvent
= actions.
inputFileNumEntries
();
42
43
if
(toSkip > 0)
44
{
45
if
(toSkip >= eventRange.
m_endEvent
)
46
{
47
toSkip -= eventRange.
m_endEvent
;
48
ANA_MSG_INFO
(
"File "
<< fileName <<
" has only "
<< eventRange.
m_endEvent
<<
" events, skipping it."
);
49
continue
;
50
}
51
eventRange.
m_beginEvent
= toSkip;
52
toSkip = 0u;
53
}
54
55
if
(toProcess.has_value())
56
{
57
if
(eventRange.
m_endEvent
>= eventRange.
m_beginEvent
+ toProcess.value())
58
{
59
eventRange.
m_endEvent
= eventRange.
m_beginEvent
+ toProcess.value();
60
toProcess = 0u;
61
}
else
62
{
63
toProcess.value() -= eventRange.
m_endEvent
- eventRange.
m_beginEvent
;
64
}
65
}
66
ANA_CHECK
(actions.
processEvents
(eventRange));
67
if
(toProcess.has_value() && toProcess.value() == 0u)
68
{
69
ANA_MSG_INFO
(
"Reached maximum number of events, stopping."
);
70
break
;
71
}
72
}
73
return
StatusCode::SUCCESS;
74
}
75
}
76
}
Assert.h
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg,...)
Macro printing info messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:291
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
DirectInputModule.h
EventRange.h
IInputModuleActions.h
EL::Detail::DirectInputModule::skipEvents
Gaudi::Property< uint64_t > skipEvents
Definition
DirectInputModule.h:34
EL::Detail::DirectInputModule::fileList
Gaudi::Property< std::vector< std::string > > fileList
Definition
DirectInputModule.h:32
EL::Detail::DirectInputModule::maxEvents
Gaudi::Property< int64_t > maxEvents
Definition
DirectInputModule.h:36
EL::Detail::IInputModuleActions
the actions that Module::processInputs can perform
Definition
IInputModuleActions.h:42
EL::Detail::IInputModuleActions::processEvents
virtual::StatusCode processEvents(EventRange &eventRange)=0
process the given event range
EL::Detail::IInputModuleActions::openInputFile
virtual::StatusCode openInputFile(const std::string &inputFileUrl)=0
open the given input file without processing it
EL::Detail::IInputModuleActions::inputFileNumEntries
virtual Long64_t inputFileNumEntries() const =0
the number of events in the input file
EL::Detail
Definition
AsgComponentFactories.h:20
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition
AsgComponentFactories.h:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL::Detail::ModuleData
the data the EventLoop core classes are sharing with the Module implementation
Definition
ModuleData.h:64
EL::EventRange
a range of events in a given file
Definition
EventRange.h:22
EL::EventRange::m_url
std::string m_url
the location of the file
Definition
EventRange.h:24
EL::EventRange::m_beginEvent
Long64_t m_beginEvent
the first event to process
Definition
EventRange.h:27
EL::EventRange::m_endEvent
Long64_t m_endEvent
the event past the last event, or eof
Definition
EventRange.h:30
Generated on
for ATLAS Offline Software by
1.17.0