All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
sbn::details::TriggerResponseManager Class Reference

Manages extraction of trigger results and filling of their branches. More...

#include <TriggerResponseManager.h>

Inheritance diagram for sbn::details::TriggerResponseManager:
lar::UncopiableClass lar::UncopiableClass

Classes

class  Extractors
 Trigger information extractors tied to an event. More...
 
struct  TriggerInfo_t
 Information about a single trigger logic (hardware or emulated). More...
 
struct  TriggerInfoBranch_t
 Data for a single trigger logic output branch. More...
 
struct  TriggerInputSpec_t
 Configuration specifications for the emulation of a trigger logic. More...
 

Public Member Functions

 TriggerResponseManager (std::vector< TriggerInputSpec_t > const &triggerSpecs, art::ConsumesCollector &collector, TTree &tree)
 Initializes tree to accommodate the specified trigger information. More...
 
Extractors extractorsFor (art::Event const &event)
 Returns an object to extract trigger information from event. More...
 
 TriggerResponseManager (std::vector< TriggerInputSpec_t > const &triggerSpecs, art::ConsumesCollector &collector, TTree &tree)
 Initializes tree to accommodate the specified trigger information. More...
 
Extractors extractorsFor (art::Event const &event)
 Returns an object to extract trigger information from event. More...
 

Private Member Functions

std::vector< TriggerInfoBranch_tbuildTriggerResponseBranches (TTree &tree, std::vector< TriggerInputSpec_t > const &triggerSpecs) const
 Sets up the tree branches and returns the branch information structures. More...
 
TriggerInfoBranch_t buildTriggerResponseBranch (TTree &tree, TriggerInputSpec_t const &spec) const
 Sets up a tree branch and returns its branch information structure. More...
 
void declareConsumables (art::ConsumesCollector &collector) const
 Declares all the data products we are going to read. More...
 
std::vector< TriggerInfoBranch_tbuildTriggerResponseBranches (TTree &tree, std::vector< TriggerInputSpec_t > const &triggerSpecs) const
 Sets up the tree branches and returns the branch information structures. More...
 
TriggerInfoBranch_t buildTriggerResponseBranch (TTree &tree, TriggerInputSpec_t const &spec) const
 Sets up a tree branch and returns its branch information structure. More...
 
void declareConsumables (art::ConsumesCollector &collector) const
 Declares all the data products we are going to read. More...
 
- Private Member Functions inherited from lar::UncopiableClass
 UncopiableClass ()=default
 Default constructor. More...
 
 ~UncopiableClass ()=default
 Default destructor. More...
 
 UncopiableClass (UncopiableClass const &)=delete
 Deleted copy and move constructors and assignments. More...
 
 UncopiableClass (UncopiableClass &&)=default
 
UncopiableClassoperator= (UncopiableClass const &)=delete
 
UncopiableClassoperator= (UncopiableClass &&)=default
 

Private Attributes

std::vector< TriggerInfoBranch_tfBranchInfo
 Data structures for the tree. More...
 

Detailed Description

Manages extraction of trigger results and filling of their branches.

This class defines and manages the structure of the branches pertaining the trigger simulation in a ROOT tree.

It supports multiple trigger algorithms in a single ROOT tree entry (which may be defined for example as a physics event or as a particle within a physics event).

Configuration

The manager is configured with a list of trigger specifications (TriggerInputSpec_t). One simple branch (with multiple leaves) is created for each specifications.

Usage pattern

This manager class encloses all the steps needed to fill a tree with trigger response data. Users will have to take very few steps to integrate its functionality in a module.

  1. A single instance of this class is created associated to a ROOT tree, configured with a set of trigger specifications. A class data member is recommended for this pattern.
  2. On each art event, an extractor object is created (extractFor()) which will manage the extraction of trigger data from that event.
  3. On each entry in the tree, Extractor::fetch() is called for that entry, which will fill all the relevant branch data from the available information. This single steps makes all trigger data ready for filling.
  4. When all additional data is ready, the tree can be filled with the entry data (TTree::Fill()).

The configuration of this class is performed via a custom configuration data structure. The module may read it directly from its own (FHiCL) configuration or fill it in any other way.

Note
This class owns the memory associated to the tree branches. As such, it needs to exist as long as the buffers are needed, and those buffers must not change memory location. For this reason, the class is not copyable, but it is moveable (moving will preserve the address of the buffers).

This class defines and manages the structure of the branches pertaining the trigger simulation in a ROOT tree.

It supports multiple trigger algorithms in a single ROOT tree entry (which may be defined for example as a physics event or as a particle within a physics event).

Configuration

The manager is configured with a list of trigger specifications (TriggerInputSpec_t). One simple branch (with multiple leaves) is created for each specifications.

Usage pattern

This manager class encloses all the steps needed to fill a tree with trigger response data. Users will have to take very few steps to integrate its functionality in a module.

  1. A single instance of this class is created associated to a ROOT tree, configured with a set of trigger specifications. A class data member is recommended for this pattern.
  2. On each art event, an extractor object is created (extractFor()) which will manage the extraction of trigger data from that event.
  3. On each entry in the tree, Extractor::fetch() is called for that entry, which will fill all the relevant branch data from the available information. This single steps makes all trigger data ready for filling.
  4. When all additional data is ready, the tree can be filled with the entry data (TTree::Fill()).

The configuration of this class is performed via a custom configuration data structure. The module may read it directly from its own (FHiCL) configuration or fill it in any other way.

Note
This class owns the memory associated to the tree branches. As such, it needs to exist as long as the buffers are needed, and those buffers must not change memory location. For this reason, the class is not copyable, but it is movable (moving will preserve the address of the buffers).

Definition at line 86 of file Analysis/trigger/details/TriggerResponseManager.h.

Constructor & Destructor Documentation

sbn::details::TriggerResponseManager::TriggerResponseManager ( std::vector< TriggerInputSpec_t > const &  triggerSpecs,
art::ConsumesCollector &  collector,
TTree &  tree 
)

Initializes tree to accommodate the specified trigger information.

Definition at line 116 of file Analysis/trigger/details/TriggerResponseManager.cxx.

121  : fBranchInfo{ buildTriggerResponseBranches(tree, triggerSpecs) }
122 {
123 
124  declareConsumables(collector);
125 
126 } // sbn::details::TriggerResponseManager::TriggerResponseManager()
void declareConsumables(art::ConsumesCollector &collector) const
Declares all the data products we are going to read.
std::vector< TriggerInfoBranch_t > fBranchInfo
Data structures for the tree.
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.
sbn::details::TriggerResponseManager::TriggerResponseManager ( std::vector< TriggerInputSpec_t > const &  triggerSpecs,
art::ConsumesCollector &  collector,
TTree &  tree 
)

Initializes tree to accommodate the specified trigger information.

Member Function Documentation

auto sbn::details::TriggerResponseManager::buildTriggerResponseBranch ( TTree &  tree,
TriggerInputSpec_t const &  spec 
) const
private

Sets up a tree branch and returns its branch information structure.

Definition at line 160 of file Analysis/trigger/details/TriggerResponseManager.cxx.

161 {
162  TriggerInfoBranch_t branchInfo {
163  spec.name // name
164  , spec.inputTag // triggerTag
165  // the rest is default-constructed
166  }; // TriggerInfoBranch_t
167 
168  branchInfo.branch = tree.Branch(
169  spec.name.c_str(), branchInfo.data.get(),
171  );
172 
173  return branchInfo;
174 } // sbn::details::TriggerResponseManager::buildTriggerResponseBranches()
static std::string const & TriggerResponseBranchStructure()
ROOT TTree specification for this data structure (leaf list).
TriggerInfoBranch_t sbn::details::TriggerResponseManager::buildTriggerResponseBranch ( TTree &  tree,
TriggerInputSpec_t const &  spec 
) const
private

Sets up a tree branch and returns its branch information structure.

auto sbn::details::TriggerResponseManager::buildTriggerResponseBranches ( TTree &  tree,
std::vector< TriggerInputSpec_t > const &  triggerSpecs 
) const
private

Sets up the tree branches and returns the branch information structures.

Definition at line 148 of file Analysis/trigger/details/TriggerResponseManager.cxx.

150 {
151  std::vector<TriggerInfoBranch_t> branchInfoList;
152  for (TriggerInputSpec_t const& spec: triggerSpecs)
153  branchInfoList.push_back(buildTriggerResponseBranch(tree, spec));
154  return branchInfoList;
155 } // sbn::details::TriggerResponseManager::buildTriggerResponseBranches()
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> sbn::details::TriggerResponseManager::buildTriggerResponseBranches ( TTree &  tree,
std::vector< TriggerInputSpec_t > const &  triggerSpecs 
) const
private

Sets up the tree branches and returns the branch information structures.

void sbn::details::TriggerResponseManager::declareConsumables ( art::ConsumesCollector &  collector) const
private

Declares all the data products we are going to read.

Definition at line 139 of file Analysis/trigger/details/TriggerResponseManager.cxx.

140 {
141  for (TriggerInfoBranch_t const& branchInfo: fBranchInfo)
142  Extractors::consumesInputData(collector, branchInfo);
143 } // sbn::details::TriggerResponseManager::declareConsumables()
std::vector< TriggerInfoBranch_t > fBranchInfo
Data structures for the tree.
static void consumesInputData(art::ConsumesCollector &collector, TriggerInfoBranch_t const &branchInfo)
Declares all data products that need to be read for branchInfo.
void sbn::details::TriggerResponseManager::declareConsumables ( art::ConsumesCollector &  collector) const
private

Declares all the data products we are going to read.

auto sbn::details::TriggerResponseManager::extractorsFor ( art::Event const &  event)

Returns an object to extract trigger information from event.

Definition at line 131 of file Analysis/trigger/details/TriggerResponseManager.cxx.

132 {
133  return Extractors{ event, fBranchInfo };
134 } // sbn::details::TriggerResponseManager::extractorsFor()
std::vector< TriggerInfoBranch_t > fBranchInfo
Data structures for the tree.
Extractors sbn::details::TriggerResponseManager::extractorsFor ( art::Event const &  event)

Returns an object to extract trigger information from event.

Member Data Documentation

std::vector< TriggerInfoBranch_t > sbn::details::TriggerResponseManager::fBranchInfo
private

Data structures for the tree.

Definition at line 201 of file Analysis/trigger/details/TriggerResponseManager.h.


The documentation for this class was generated from the following files: