LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evd::RawDataDrawer::ManyOperations Class Reference
Inheritance diagram for evd::RawDataDrawer::ManyOperations:
evd::RawDataDrawer::OperationBaseClass

Public Member Functions

 ManyOperations (geo::PlaneID const &pid, RawDataDrawer *data_drawer=nullptr)
 
bool Initialize () override
 
bool ProcessWire (geo::WireID const &wireID) override
 
bool ProcessTick (size_t tick) override
 
bool Operate (geo::WireID const &wireID, size_t tick, float adc) override
 
bool Finish () override
 
std::string Name () const override
 
OperationBaseClassOperator (size_t iOp)
 
OperationBaseClass const * Operator (size_t iOp) const
 
void AddOperation (std::unique_ptr< OperationBaseClass > new_op)
 
bool operator() (geo::WireID const &wireID, size_t tick, float adc)
 
geo::PlaneID const & PlaneID () const
 
RawDataDrawerRawDataDrawerPtr () const
 

Protected Attributes

RawDataDrawerpRawDataDrawer = nullptr
 

Private Attributes

std::vector< std::unique_ptr< RawDataDrawer::OperationBaseClass > > operations
 

Detailed Description

Definition at line 680 of file RawDataDrawer.cxx.

Constructor & Destructor Documentation

evd::RawDataDrawer::ManyOperations::ManyOperations ( geo::PlaneID const &  pid,
RawDataDrawer data_drawer = nullptr 
)
inline

Definition at line 684 of file RawDataDrawer.cxx.

685  : OperationBaseClass(pid, data_drawer)
686  {}
OperationBaseClass(geo::PlaneID const &pid, RawDataDrawer *data_drawer=nullptr)

Member Function Documentation

void evd::RawDataDrawer::ManyOperations::AddOperation ( std::unique_ptr< OperationBaseClass new_op)
inline

Definition at line 740 of file RawDataDrawer.cxx.

References art::errors::LogicError.

Referenced by evd::RawDataDrawer::RawDigit2D().

741  {
742  if (!new_op) return;
743  if (PlaneID() != new_op->PlaneID()) {
745  << "RawDataDrawer::ManyOperations(): trying to run operations on "
746  << std::string(PlaneID()) << " and " << std::string(new_op->PlaneID())
747  << " at the same time";
748  }
749  if (RawDataDrawerPtr() && (RawDataDrawerPtr() != new_op->RawDataDrawerPtr())) {
751  << "RawDataDrawer::ManyOperations(): "
752  "trying to run operations on different RawDataDrawer"; // possible, but very unlikely
753  }
754  operations.emplace_back(std::move(new_op));
755  }
std::vector< std::unique_ptr< RawDataDrawer::OperationBaseClass > > operations
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
geo::PlaneID const & PlaneID() const
RawDataDrawer * RawDataDrawerPtr() const
bool evd::RawDataDrawer::ManyOperations::Finish ( )
inlineoverridevirtual

Reimplemented from evd::RawDataDrawer::OperationBaseClass.

Definition at line 716 of file RawDataDrawer.cxx.

717  {
718  bool bAllOk = true;
719  for (std::unique_ptr<OperationBaseClass> const& op : operations)
720  if (!op->Finish()) bAllOk = false;
721  return bAllOk;
722  }
std::vector< std::unique_ptr< RawDataDrawer::OperationBaseClass > > operations
bool evd::RawDataDrawer::ManyOperations::Initialize ( )
inlineoverridevirtual

Reimplemented from evd::RawDataDrawer::OperationBaseClass.

Definition at line 688 of file RawDataDrawer.cxx.

689  {
690  bool bAllOk = true;
691  for (std::unique_ptr<OperationBaseClass> const& op : operations)
692  if (!op->Initialize()) bAllOk = false;
693  return bAllOk;
694  }
std::vector< std::unique_ptr< RawDataDrawer::OperationBaseClass > > operations
std::string evd::RawDataDrawer::ManyOperations::Name ( ) const
inlineoverridevirtual

Reimplemented from evd::RawDataDrawer::OperationBaseClass.

Definition at line 724 of file RawDataDrawer.cxx.

References util::to_string().

725  {
726  std::string msg = cet::demangle_symbol(typeid(*this).name());
727  msg += (" [running " + std::to_string(operations.size()) + " operations:");
728  for (auto const& op : operations) { // it's unique_ptr<OperationBaseClass>
729  if (op)
730  msg += " " + op->Name();
731  else
732  msg += " <invalid>";
733  }
734  return msg + " ]";
735  }
std::vector< std::unique_ptr< RawDataDrawer::OperationBaseClass > > operations
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
bool evd::RawDataDrawer::ManyOperations::Operate ( geo::WireID const &  wireID,
size_t  tick,
float  adc 
)
inlineoverridevirtual

Implements evd::RawDataDrawer::OperationBaseClass.

Definition at line 709 of file RawDataDrawer.cxx.

710  {
711  for (std::unique_ptr<OperationBaseClass> const& op : operations)
712  if (!op->Operate(wireID, tick, adc)) return false;
713  return true;
714  }
std::vector< std::unique_ptr< RawDataDrawer::OperationBaseClass > > operations
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
OperationBaseClass* evd::RawDataDrawer::ManyOperations::Operator ( size_t  iOp)
inline

Definition at line 737 of file RawDataDrawer.cxx.

737 { return operations.at(iOp).get(); }
std::vector< std::unique_ptr< RawDataDrawer::OperationBaseClass > > operations
OperationBaseClass const* evd::RawDataDrawer::ManyOperations::Operator ( size_t  iOp) const
inline

Definition at line 738 of file RawDataDrawer.cxx.

738 { return operations.at(iOp).get(); }
std::vector< std::unique_ptr< RawDataDrawer::OperationBaseClass > > operations
bool evd::RawDataDrawer::OperationBaseClass::operator() ( geo::WireID const &  wireID,
size_t  tick,
float  adc 
)
inlineinherited

Definition at line 664 of file RawDataDrawer.cxx.

665  {
666  return Operate(wireID, tick, adc);
667  }
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
virtual bool Operate(geo::WireID const &wireID, size_t tick, float adc)=0
geo::PlaneID const& evd::RawDataDrawer::OperationBaseClass::PlaneID ( ) const
inlineinherited

Definition at line 669 of file RawDataDrawer.cxx.

Referenced by evd::RawDataDrawer::RunOperation().

669 { return planeID; }
bool evd::RawDataDrawer::ManyOperations::ProcessTick ( size_t  tick)
inlineoverridevirtual

Reimplemented from evd::RawDataDrawer::OperationBaseClass.

Definition at line 702 of file RawDataDrawer.cxx.

703  {
704  for (std::unique_ptr<OperationBaseClass> const& op : operations)
705  if (op->ProcessTick(tick)) return true;
706  return false;
707  }
std::vector< std::unique_ptr< RawDataDrawer::OperationBaseClass > > operations
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
bool evd::RawDataDrawer::ManyOperations::ProcessWire ( geo::WireID const &  wireID)
inlineoverridevirtual

Reimplemented from evd::RawDataDrawer::OperationBaseClass.

Definition at line 696 of file RawDataDrawer.cxx.

697  {
698  for (std::unique_ptr<OperationBaseClass> const& op : operations)
699  if (op->ProcessWire(wireID)) return true;
700  return false;
701  }
std::vector< std::unique_ptr< RawDataDrawer::OperationBaseClass > > operations
RawDataDrawer* evd::RawDataDrawer::OperationBaseClass::RawDataDrawerPtr ( ) const
inlineinherited

Definition at line 670 of file RawDataDrawer.cxx.

670 { return pRawDataDrawer; }

Member Data Documentation

std::vector<std::unique_ptr<RawDataDrawer::OperationBaseClass> > evd::RawDataDrawer::ManyOperations::operations
private

Definition at line 681 of file RawDataDrawer.cxx.

RawDataDrawer* evd::RawDataDrawer::OperationBaseClass::pRawDataDrawer = nullptr
protectedinherited

Definition at line 673 of file RawDataDrawer.cxx.


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