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

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

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

Public Member Functions

 TriggerGateTree (TTree &tree)
 Constructor. More...
 
void assignTriggerGatesInfo (TriggerGatesInfo const &info)
 Copies the information from the info record into the ROOT tree buffers. More...
 
- Public Member Functions inherited from icarus::trigger::details::TreeHolder
 TreeHolder ()=default
 
 TreeHolder (TTree &tree)
 
TTree & tree ()
 
TTree const & tree () const
 

Private Member Functions

void checkSizes () const
 Internal check: all branch buffers have the same size. More...
 

Private Attributes

UInt_t fNChannels
 Number of channels. More...
 
std::vector< geo::Point_tfOpDetPos
 Coordinates of the optical detector. More...
 
std::vector< UInt_t > fNOpenings
 Number of openings (0 if never opens). More...
 
std::vector< Double_t > fOpeningTime
 Time of first opening. More...
 

Detailed Description

Class managing the serialization of trigger gates 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. Information may be loaded into the tree via assignTriggerGatesInfo() method, which sets each branch according to a value of the data structure TriggerGatesInfo, as described below.

The branch structure is: NChannels/i:OpDetPos_[]/D:NOpenings[]/i:OpeningTime[]/D

NOpenings (one count per channel, from TriggerGateInfo::nOpenings): the number of times the gate opened;

All branches come from a variable size vector with size the number of available trigger gates.

Definition at line 132 of file MakeTriggerSimulationTree_module.cc.

Constructor & Destructor Documentation

TriggerGateTree::TriggerGateTree ( TTree &  tree)

Constructor.

Definition at line 495 of file MakeTriggerSimulationTree_module.cc.

496  : TreeHolder(tree)
497 {
498 
499  this->tree().Branch("NChannels", &fNChannels);
500  this->tree().Branch("OpDetPos", &fOpDetPos);
501  this->tree().Branch("NOpenings", &fNOpenings);
502  this->tree().Branch("OpeningTime", &fOpeningTime);
503 
504 } // TriggerGateTree::TriggerGateTree()
std::vector< Double_t > fOpeningTime
Time of first opening.
UInt_t fNChannels
Number of channels.
std::vector< UInt_t > fNOpenings
Number of openings (0 if never opens).
std::vector< geo::Point_t > fOpDetPos
Coordinates of the optical detector.

Member Function Documentation

void TriggerGateTree::assignTriggerGatesInfo ( TriggerGatesInfo const &  info)

Copies the information from the info record into the ROOT tree buffers.

Definition at line 532 of file MakeTriggerSimulationTree_module.cc.

532  {
533 
534  fNChannels = info.TriggerGates.size();
535  fOpDetPos.clear();
536  fNOpenings.clear();
537  fOpeningTime.clear();
538  for
539  (auto const& [ iChannel, channelInfo ]: util::enumerate(info.TriggerGates))
540  {
541 
542  fOpDetPos.push_back(channelInfo.center);
543  fNOpenings.push_back(channelInfo.nOpenings);
544 
545  // accepting the fallback value when there is no interaction
546  // (that is `max()`)
547  fOpeningTime.push_back(channelInfo.firstOpenTime.value());
548  // fAmplitude.push_back(channelInfo.Amplitude);
549  } // for
550 
551  checkSizes();
552 
553 } // TriggerGateTree::assignTriggerGatesInfo()
std::vector< Double_t > fOpeningTime
Time of first opening.
UInt_t fNChannels
Number of channels.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
std::vector< UInt_t > fNOpenings
Number of openings (0 if never opens).
void checkSizes() const
Internal check: all branch buffers have the same size.
std::vector< geo::Point_t > fOpDetPos
Coordinates of the optical detector.
void TriggerGateTree::checkSizes ( ) const
private

Internal check: all branch buffers have the same size.

Definition at line 508 of file MakeTriggerSimulationTree_module.cc.

508  {
509 
510  auto checkSize = [this](auto const& v){ return v.size() == fNChannels; };
511 
512  if (!checkSize(fOpDetPos)) {
513  throw cet::exception("TriggerGateTree") << __func__
514  << ": Internal error: unexpected buffer size (" << fOpDetPos.size()
515  << ") : fOpDetPos\n";
516  }
517  if (!checkSize(fNOpenings)) {
518  throw cet::exception("TriggerGateTree") << __func__
519  << ": Internal error: unexpected buffer size (" << fNOpenings.size()
520  << ") : fNOpenings\n";
521  }
522  if (!checkSize(fOpeningTime)) {
523  throw cet::exception("TriggerGateTree") << __func__
524  << ": Internal error: unexpected buffer size (" << fOpeningTime.size()
525  << ") : fOpeningTime\n";
526  }
527 
528 } // TriggerGateTree::checkSizes()
std::vector< Double_t > fOpeningTime
Time of first opening.
UInt_t fNChannels
Number of channels.
std::vector< UInt_t > fNOpenings
Number of openings (0 if never opens).
std::vector< geo::Point_t > fOpDetPos
Coordinates of the optical detector.

Member Data Documentation

UInt_t TriggerGateTree::fNChannels
private

Number of channels.

Definition at line 142 of file MakeTriggerSimulationTree_module.cc.

std::vector<UInt_t> TriggerGateTree::fNOpenings
private

Number of openings (0 if never opens).

Definition at line 145 of file MakeTriggerSimulationTree_module.cc.

std::vector<geo::Point_t> TriggerGateTree::fOpDetPos
private

Coordinates of the optical detector.

Definition at line 144 of file MakeTriggerSimulationTree_module.cc.

std::vector<Double_t> TriggerGateTree::fOpeningTime
private

Time of first opening.

Definition at line 146 of file MakeTriggerSimulationTree_module.cc.


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