All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
ResponseTree Struct Reference

Class managing the serialization of trigger responses in a simple ROOT tree. More...

Inheritance diagram for ResponseTree:
TreeHolder icarus::trigger::details::TreeHolder icarus::trigger::details::TreeHolder

Public Member Functions

template<typename Thresholds , typename Requirements >
 ResponseTree (TTree &tree, Thresholds const &thresholds, Requirements const &minReqs)
 Constructor: accommodates that many thresholds and requirements. More...
 
void assignResponse (std::size_t iThr, std::size_t iReq, bool resp)
 Assigns the response for the specified trigger. More...
 
template<typename Thresholds , typename Settings >
 ResponseTree (TTree &tree, Thresholds const &thresholds, Settings const &settings)
 Constructor: accommodates that many thresholds and trigger settings. More...
 
void assignResponse (std::size_t iThr, std::size_t iSettings, bool resp)
 Assigns the response for the specified trigger. More...
 
template<typename Thresholds , typename Requirements >
 ResponseTree (TTree &tree, Thresholds const &thresholds, Requirements const &minReqs)
 Constructor: accommodates that many thresholds and requirements. More...
 
void assignResponse (std::size_t iThr, std::size_t iReq, bool resp)
 Assigns the response for the specified trigger. More...
 
- Public Member Functions inherited from TreeHolder
 TreeHolder ()=default
 
 TreeHolder (TTree &tree)
 
TTree & tree ()
 
TTree const & tree () const
 
- Public Member Functions inherited from icarus::trigger::details::TreeHolder
 TreeHolder ()=default
 
 TreeHolder (TTree &tree)
 
TTree & tree ()
 
TTree const & tree () const
 

Public Attributes

util::MatrixIndices indices
 
std::unique_ptr< bool[]> RespTxxRxx
 
std::unique_ptr< bool[]> RespTxxSxx
 

Detailed Description

Class managing the serialization of trigger responses in a simple ROOT tree.

The tree is supplied by the caller. This object will create the proper branches into the tree and assign addresses to them. Then it will assume they will stay assigned.

On assignResponse(), the proper branch address is assigned the specified trigger response (true or false).

The branch structure is: a RespTxxRxx/O branch for each threshold (numeric) and requirement (also numeric). with a single branch per element.

The tree is supplied by the caller. This object will create the proper branches into the tree and assign addresses to them. Then it will assume they will stay assigned.

On assignResponse(), the proper branch address is assigned the specified trigger response (true or false).

The branch structure is: a RespTxxSxx/O branch for each threshold and settings label, with a single branch per element.

Definition at line 65 of file MajorityTriggerEfficiencyPlots_module.cc.

Constructor & Destructor Documentation

template<typename Thresholds , typename Requirements >
ResponseTree::ResponseTree ( TTree &  tree,
Thresholds const &  thresholds,
Requirements const &  minReqs 
)

Constructor: accommodates that many thresholds and requirements.

Definition at line 471 of file MajorityTriggerEfficiencyPlots_module.cc.

472  : TreeHolder(tree)
473  , indices(std::size(thresholds), std::size(minReqs))
474  , RespTxxRxx{ std::make_unique<bool[]>(indices.size()) }
475 {
476 
477  for (auto [ iThr, thresholdTag]: util::enumerate(thresholds)) {
478 
479  for (auto [ iReq, req ]: util::enumerate(minReqs)) {
480 
481  std::string const branchName
482  = "RespT" + thresholdTag + "R" + util::to_string(req);
483 
484  this->tree().Branch
485  (branchName.c_str(), &(RespTxxRxx[indices(iThr, iReq)]));
486 
487  } // for all requirements
488 
489  } // for all thresholds
490 
491 } // ResponseTree::ResponseTree()
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
std::unique_ptr< bool[]> RespTxxRxx
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
DimSize_t size() const
Returns the size of the minor tensor.
template<typename Thresholds , typename Settings >
ResponseTree::ResponseTree ( TTree &  tree,
Thresholds const &  thresholds,
Settings const &  settings 
)

Constructor: accommodates that many thresholds and trigger settings.

Template Parameters
Thresholdsan iterable type yielding objects convertible to numbers
Settingsan iterable type yielding objects convertible to string
Parameters
treethe ROOT tree to add branches to (managed elsewhere)
thresholdscollection of thresholds to be included
settingscollection of trigger settings to be included

The thresholds must be convertible to ADC counts (i.e. numbers), while the settings elements must support conversion to string via to_string() function call (more precisely, util::to_string() from larcorealg/CoreUtils/StdUtils.h).

Definition at line 517 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

518  : TreeHolder(tree)
519  , indices(std::size(thresholds), std::size(settings))
520  , RespTxxSxx{ std::make_unique<bool[]>(indices.size()) }
521 {
522 
523  for (auto [ iThr, thresholdTag]: util::enumerate(thresholds)) {
524 
525  for (auto [ iSetting, setting ]: util::enumerate(settings)) {
526 
527  std::string const branchName
528  = "RespT" + thresholdTag + "S" + util::to_string(setting);
529 
530  this->tree().Branch
531  (branchName.c_str(), &(RespTxxSxx[indices(iThr, iSetting)]));
532 
533  } // for all requirements
534 
535  } // for all thresholds
536 
537 } // ResponseTree::ResponseTree()
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
DimSize_t size() const
Returns the size of the minor tensor.
template<typename Thresholds , typename Requirements >
ResponseTree::ResponseTree ( TTree &  tree,
Thresholds const &  thresholds,
Requirements const &  minReqs 
)

Constructor: accommodates that many thresholds and requirements.

Member Function Documentation

void ResponseTree::assignResponse ( std::size_t  iThr,
std::size_t  iReq,
bool  resp 
)

Assigns the response for the specified trigger.

Definition at line 496 of file MajorityTriggerEfficiencyPlots_module.cc.

497 {
498  RespTxxRxx[indices(iThr, iReq)] = resp;
499 } // ResponseTree::assignResponse()
std::unique_ptr< bool[]> RespTxxRxx
void ResponseTree::assignResponse ( std::size_t  iThr,
std::size_t  iSettings,
bool  resp 
)

Assigns the response for the specified trigger.

void ResponseTree::assignResponse ( std::size_t  iThr,
std::size_t  iReq,
bool  resp 
)

Assigns the response for the specified trigger.

Member Data Documentation

util::MatrixIndices ResponseTree::indices

Definition at line 68 of file MajorityTriggerEfficiencyPlots_module.cc.

std::unique_ptr< bool[]> ResponseTree::RespTxxRxx

Definition at line 69 of file MajorityTriggerEfficiencyPlots_module.cc.

std::unique_ptr<bool[]> ResponseTree::RespTxxSxx

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