17 #include "art/Framework/Principal/Handle.h"
33 (art::Event
const& event, std::vector<TriggerInfoBranch_t>& branchInfoList)
34 : fBranchInfo(&branchInfoList)
37 for (TriggerInfoBranch_t
const& branchInfo: *
fBranchInfo)
38 fInputData.emplace_back(buildInputData(event, branchInfo));
48 std::vector<TriggerInfoBranch_t>
const& branchInfo = *fBranchInfo;
49 assert(branchInfo.size() == fInputData.size());
52 fetchBranch(branchInfo[iBranch], fInputData[iBranch], iEntry);
59 (art::ConsumesCollector& collector, TriggerInfoBranch_t
const& branchInfo)
62 collector.consumes<std::vector<raw::Trigger>>(branchInfo.triggerTag);
69 (art::Event
const& event, TriggerInfoBranch_t
const& branchInfo)
const
73 return TriggerInputData_t{
74 &(
event.getProduct<std::vector<raw::Trigger>>(branchInfo.triggerTag))
83 TriggerInfoBranch_t
const&
info,
84 TriggerInputData_t& inputData,
87 assert(inputData.triggers);
89 raw::Trigger const& trigger = inputData.triggers->at(iEntry);
90 TriggerInfo_t& data = *(info.data);
104 {
"time/D:gateStart/D:fired/O" };
110 art::ConsumesCollector& collector,
116 declareConsumables(collector);
123 (art::Event
const& event) -> Extractors
125 return Extractors{ event, fBranchInfo };
131 (art::ConsumesCollector& collector)
const
133 for (TriggerInfoBranch_t
const& branchInfo: fBranchInfo)
134 Extractors::consumesInputData(collector, branchInfo);
140 (TTree& tree, std::vector<TriggerInputSpec_t>
const&
triggerSpecs)
const
141 -> std::vector<TriggerInfoBranch_t>
143 std::vector<TriggerInfoBranch_t> branchInfoList;
145 branchInfoList.push_back(buildTriggerResponseBranch(tree, spec));
146 return branchInfoList;
152 (TTree& tree, TriggerInputSpec_t
const& spec)
const -> TriggerInfoBranch_t
154 TriggerInfoBranch_t branchInfo {
160 branchInfo.branch = tree.Branch(
161 spec.name.c_str(), branchInfo.data.get(),
162 TriggerInfo_t::TriggerResponseBranchStructure.c_str()
void declareConsumables(art::ConsumesCollector &collector) const
Declares all the data products we are going to read.
TriggerInfoBranch_t buildTriggerResponseBranch(TTree &tree, TriggerInputSpec_t const &spec) const
Sets up a tree branch and returns its branch information structure.
std::vector< TriggerInfoBranch_t > fBranchInfo
Data structures for the tree.
static std::string const & TriggerResponseBranchStructure()
ROOT TTree specification for this data structure (leaf list).
Helper managing the trigger response part of a TTree.
double TriggerTime() const
Trigger time w.r.t. electronics clock T0 in us.
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
double BeamGateTime() const
BeamGate time w.r.t. electronics clock T0 in us.
Test of util::counter and support utilities.
std::vector< TriggerInfoBranch_t > buildTriggerResponseBranches(TTree &tree, std::vector< TriggerInputSpec_t > const &triggerSpecs) const
Sets up the tree branches and returns the branch information structures.
TriggerResponseManager(std::vector< TriggerInputSpec_t > const &triggerSpecs, art::ConsumesCollector &collector, TTree &tree)
Initializes tree to accommodate the specified trigger information.
Extractors extractorsFor(art::Event const &event)
Returns an object to extract trigger information from event.
unsigned int TriggerBits() const
Trigger Bits.