Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 08:56:54

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         LOG_DEBUG(m_logger) << "Initializing JEventProcessor '" << processor->GetTypeName() << "'" << LOG_END;
0039         processor->DoInitialize();
0040         LOG_INFO(m_logger) << "Initialized JEventProcessor '" << processor->GetTypeName() << "'" << LOG_END;
0041     }
0042     LOG_DEBUG(m_logger) << "Initialized arrow '" << get_name() << "'" << LOG_END;
0043 }
0044 
0045 void JEventTapArrow::finalize() {
0046     LOG_DEBUG(m_logger) << "Finalizing arrow '" << get_name() << "'" << LOG_END;
0047     for (auto processor : m_procs) {
0048         LOG_DEBUG(m_logger) << "Finalizing JEventProcessor '" << processor->GetTypeName() << "'" << LOG_END;
0049         processor->DoFinalize();
0050         LOG_INFO(m_logger) << "Finalized JEventProcessor '" << processor->GetTypeName() << "'" << LOG_END;
0051     }
0052     LOG_DEBUG(m_logger) << "Finalized arrow '" << get_name() << "'" << LOG_END;
0053 }
0054