LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
CachedProducts.h
Go to the documentation of this file.
1
#ifndef art_Framework_Core_CachedProducts_h
2
#define art_Framework_Core_CachedProducts_h
3
4
// -------------------------------------------------------------------
5
//
6
// CachedProducts: This class is used by OutputModule to interact with
7
// the TriggerResults objects upon which the decision to write out an
8
// event is made.
9
//
10
//
11
// -------------------------------------------------------------------
12
13
#include "
art/Framework/Core/EventSelector.h
"
14
#include "
art/Framework/Principal/Event.h
"
15
#include "
art/Framework/Principal/Handle.h
"
16
#include "
art/Framework/Principal/Selector.h
"
17
#include "
art/Framework/Principal/fwd.h
"
18
#include "
canvas/Persistency/Common/TriggerResults.h
"
19
20
#include <string>
21
#include <vector>
22
23
namespace
art
{
24
namespace
detail {
25
26
// Match events based on the trigger results from a given process name.
27
class
ProcessAndEventSelector
{
28
public
:
29
explicit
ProcessAndEventSelector
(std::string
const
& process_name,
30
EventSelector
const
& event_selector)
31
:
processNameSelector_
{process_name},
eventSelector_
{event_selector}
32
{}
33
34
// Trigger results.
35
void
36
loadTriggerResults
(
Event
const
&
e
)
37
{
38
e.
get
(
/*in=*/
processNameSelector_
,
/*out=*/
triggerResults_
);
39
}
40
art::Handle<art::TriggerResults>
41
triggerResults
()
const
42
{
43
return
triggerResults_
;
44
}
45
void
46
clearTriggerResults
()
47
{
48
triggerResults_
.clear();
49
}
50
51
// Event selection.
52
bool
53
match
()
54
{
55
return
eventSelector_
.
acceptEvent
(*
triggerResults_
);
56
}
57
58
private
:
59
// Select events based on a process name.
60
ProcessNameSelector
processNameSelector_
;
61
// Select events based on criteria applied to trigger path results.
62
EventSelector
eventSelector_
;
63
// Fetched trigger path results for the given process name.
64
art::Handle<art::TriggerResults>
triggerResults_
{};
// invalid
65
};
66
67
class
PVSentry
;
68
69
// Handle the SelectEvents configuration parameter of modules on the end
70
// path.
71
class
CachedProducts
{
72
public
:
73
void
setupDefault(std::vector<std::string>
const
& trigger_names);
74
void
setup(
75
std::vector
<std::pair<std::string, std::string>>
const
& path_specs,
76
std::vector<std::string>
const
& trigger_names,
77
std::string
const
& process_name);
78
bool
wantEvent(
Event
const
&);
79
art::Handle<art::TriggerResults>
getOneTriggerResults(
Event
const
&)
const
;
80
81
private
:
82
void
clearTriggerResults
();
83
void
loadTriggerResults
(
Event
const
&);
84
85
friend
class
PVSentry
;
86
std::vector<ProcessAndEventSelector> p_and_e_selectors_{};
87
bool
loadDone_{
false
};
88
unsigned
long
numberFound_{};
89
};
90
91
class
PVSentry
{
92
public
:
93
explicit
PVSentry
(
CachedProducts
& p_and_e_selectors)
94
: p_and_e_selectors_(p_and_e_selectors)
95
{}
96
97
~PVSentry
() noexcept(false) { p_and_e_selectors_.clearTriggerResults(); }
98
99
PVSentry
(
PVSentry
const
&) =
delete
;
100
PVSentry
& operator=(
PVSentry
const
&) =
delete
;
101
102
private
:
103
CachedProducts
&
p_and_e_selectors_
;
104
};
105
106
}
// namespace detail
107
}
// namespace art
108
109
#endif
/* art_Framework_Core_CachedProducts_h */
110
111
// Local Variables:
112
// mode: c++
113
// End:
art::EventSelector
Definition:
EventSelector.h:34
art::detail::PVSentry
Definition:
CachedProducts.h:91
Selector.h
TriggerResults.h
art::detail::CachedProducts
Definition:
CachedProducts.h:71
art::DataViewImpl::get
bool get(SelectorBase const &, Handle< PROD > &result) const
Definition:
DataViewImpl.h:307
art::detail::ProcessAndEventSelector::ProcessAndEventSelector
ProcessAndEventSelector(std::string const &process_name, EventSelector const &event_selector)
Definition:
CachedProducts.h:29
art::Handle
Definition:
fwd.h:23
Handle.h
EventSelector.h
Event.h
lar::dump::vector
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition:
DumpUtils.h:265
fwd.h
art::detail::PVSentry::p_and_e_selectors_
CachedProducts & p_and_e_selectors_
Definition:
CachedProducts.h:103
art::detail::ProcessAndEventSelector::match
bool match()
Definition:
CachedProducts.h:53
art::detail::PVSentry::~PVSentry
~PVSentry() noexcept(false)
Definition:
CachedProducts.h:97
art::detail::ProcessAndEventSelector::triggerResults
art::Handle< art::TriggerResults > triggerResults() const
Definition:
CachedProducts.h:41
art::ProcessNameSelector
Definition:
Selector.h:73
art::detail::ProcessAndEventSelector::loadTriggerResults
void loadTriggerResults(Event const &e)
Definition:
CachedProducts.h:36
art::detail::ProcessAndEventSelector
Definition:
CachedProducts.h:27
art::Event
Definition:
Event.h:42
art::detail::ProcessAndEventSelector::triggerResults_
art::Handle< art::TriggerResults > triggerResults_
Definition:
CachedProducts.h:64
art
HLT enums.
Definition:
ServiceProviderWrappers.h:36
art::detail::ProcessAndEventSelector::clearTriggerResults
void clearTriggerResults()
Definition:
CachedProducts.h:46
art::detail::ProcessAndEventSelector::processNameSelector_
ProcessNameSelector processNameSelector_
Definition:
CachedProducts.h:60
e
Float_t e
Definition:
plot.C:34
art::detail::PVSentry::PVSentry
PVSentry(CachedProducts &p_and_e_selectors)
Definition:
CachedProducts.h:93
art::detail::ProcessAndEventSelector::eventSelector_
EventSelector eventSelector_
Definition:
CachedProducts.h:62
art::EventSelector::acceptEvent
bool acceptEvent(TriggerResults const &)
Definition:
EventSelector.cc:204
art
Framework
Core
CachedProducts.h
Generated on Wed Dec 12 2018 14:42:31 for LArSoft by
1.8.11