Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:36

0001 // Copyright 2024, Jefferson Science Associates, LLC.
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 
0004 
0005 #include <JANA/Topology/JEventTapArrow.h>
0006 #include <JANA/JEventProcessor.h>
0007 #include <JANA/JEventUnfolder.h>
0008 #include <JANA/JEvent.h>
0009 
0010 
0011 JEventTapArrow::JEventTapArrow(std::string name) {
0012     set_name(name);
0013     create_ports(1,1);
0014 }
0015 
0016 void JEventTapArrow::add_processor(JEventProcessor* proc) {
0017     m_procs.push_back(proc);
0018 }
0019 
0020 void JEventTapArrow::fire(JEvent* event, OutputData& outputs, size_t& output_count, JArrow::FireResult& status) {
0021 
0022     LOG_DEBUG(m_logger) << "Executing arrow " << get_name() << " for event# " << event->GetEventNumber() << LOG_END;
0023     for (JEventProcessor* proc : m_procs) {
0024         JCallGraphEntryMaker cg_entry(*event->GetJCallGraphRecorder(), proc->GetTypeName()); // times execution until this goes out of scope
0025         if (proc->GetCallbackStyle() != JEventProcessor::CallbackStyle::LegacyMode) {
0026             proc->DoTap(*event);
0027         }
0028     }
0029     outputs[0] = {event, 1};
0030     output_count = 1;
0031     status = JArrow::FireResult::KeepGoing;
0032     LOG_DEBUG(m_logger) << "Executed arrow " << get_name() << " for event# " << event->GetEventNumber() << LOG_END;
0033 }
0034 
0035 void JEventTapArrow::initialize() {
0036     LOG_DEBUG(m_logger) << "Initializing arrow '" << get_name() << "'" << LOG_END;
0037     for (auto processor : m_procs) {
0038         processor->DoInitialize();
0039         LOG_INFO(m_logger) << "Initialized JEventProcessor '" << processor->GetTypeName() << "'" << LOG_END;
0040     }
0041 }
0042 
0043 void JEventTapArrow::finalize() {
0044     LOG_DEBUG(m_logger) << "Finalizing arrow '" << get_name() << "'" << LOG_END;
0045     for (auto processor : m_procs) {
0046         processor->DoFinalize();
0047         LOG_INFO(m_logger) << "Finalized JEventProcessor '" << processor->GetTypeName() << "'" << LOG_END;
0048     }
0049 }
0050