Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright 2020, Jefferson Science Associates, LLC.
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 //
0004 // Implement a simple event processor. For the purposes of this
0005 // example plugin, we Get the Cluster objects. Doing so tells
0006 // JANA to activate the JFactory_Cluster::Process method so that
0007 // the Cluster objects are created.
0008 //
0009 // Note that the "Cluster" objects produced inherit from TObject but nothing
0010 // special is needed here to accommodate that.
0011 
0012 #include "JTestRootProcessor.h"
0013 #include <JANA/JLogger.h>
0014 
0015 #include "Cluster.h"
0016 
0017 JTestRootProcessor::JTestRootProcessor() {
0018     SetTypeName(NAME_OF_THIS); // Provide JANA with this class's name
0019     SetCallbackStyle(CallbackStyle::ExpertMode);
0020 }
0021 
0022 void JTestRootProcessor::Process(const JEvent& event) {
0023     // Get the cluster objects
0024     auto clusters = event.Get<Cluster>();
0025 
0026     // Lock mutex so operations on ROOT objects are serialized
0027     std::lock_guard<std::mutex>lock(m_mutex);
0028 
0029     // At this point we can do something with the Cluster objects
0030     // for (auto cluster : clusters) {
0031     //      //Use cluster object (e.g. fill histogram or write object to output file)
0032     // }
0033 }