// $Id$ // // File: JEventProcessor_FindTest.cc // Created: Mon Aug 25 01:59:59 PM EDT 2025 // Creator: staylor (on Linux ifarm2401.jlab.org 5.14.0-570.33.2.el9_6.x86_64 x86_64) // /// For more information on the syntax changes between JANA1 and JANA2, visit: https://jeffersonlab.github.io/JANA2/#/jana1to2/jana1-to-jana2 #include "JEventProcessor_FindTest.h" #include #include using namespace std::chrono; #include #include // Routine used to create our JEventProcessor #include extern "C"{ void InitPlugin(JApplication *app){ InitJANAPlugin(app); app->Add(new JEventProcessor_FindTest()); } } // "C" //------------------ // JEventProcessor_FindTest (Constructor) //------------------ JEventProcessor_FindTest::JEventProcessor_FindTest() { // Parameters and Services should be accessed from Init() instead of here! } //------------------ // ~JEventProcessor_FindTest (Destructor) //------------------ JEventProcessor_FindTest::~JEventProcessor_FindTest() { SetTypeName(NAME_OF_THIS); // Provide JANA with this class's name } //------------------ // Init //------------------ void JEventProcessor_FindTest::Init() { // This is called once at program startup. auto app = GetApplication(); // lockService should be initialized here like this // lockService = app->GetService(); } //------------------ // BeginRun //------------------ void JEventProcessor_FindTest::BeginRun(const std::shared_ptr &event) { // This is called whenever the run number changes } //------------------ // Process //------------------ void JEventProcessor_FindTest::Process(const std::shared_ptr &event) { vectorpseudos; event->Get(pseudos); // Time stamp before pattern recognition high_resolution_clock::time_point t0 = high_resolution_clock::now(); vectorcandidates; event->Get(candidates,"FDCCathodes"); // Time stamp after pattern recognition high_resolution_clock::time_point t1 = high_resolution_clock::now(); duration time_span = duration_cast>(t1 - t0); cumulative_time+=double(time_span.count()); cumulative_events+=1.0; } //------------------ // EndRun //------------------ void JEventProcessor_FindTest::EndRun() { // This is called whenever the run number changes, before it is // changed to give you a chance to clean up before processing // events from the next run number. } //------------------ // Finish //------------------ void JEventProcessor_FindTest::Finish() { cout << "Average track finding time = " << 1000.*cumulative_time/cumulative_events << " ms" << endl; // Called before program exit after event processing is finished. }