Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 // Copyright 2020, Jefferson Science Associates, LLC.
0003 // Subject to the terms in the LICENSE file found in the top-level directory.
0004 
0005 #ifndef JTestEventProcessor_h
0006 #define JTestEventProcessor_h
0007 
0008 #include <JANA/JEventProcessor.h>
0009 #include <JANA/Utils/JBenchUtils.h>
0010 #include "JTestDataObjects.h"
0011 
0012 class JTestPlotter : public JEventProcessor {
0013 
0014     Parameter<size_t> m_cputime_ms {this, "cputime_ms", 0, "Time spent during plotting" };
0015     Parameter<size_t> m_write_bytes {this, "bytes", 1000, "Bytes written during plotting"};
0016     Parameter<double> m_cputime_spread {this, "cputime_spread", 0.25, "Spread of time spent during plotting"};
0017     Parameter<double> m_write_spread {this, "bytes_spread", 0.25, "Spread of bytes written during plotting"};
0018 
0019     Input<JTestTrackData> m_track_data {this};
0020     Input<JTestTrackAuxilliaryData> m_track_aux_data {this};
0021 
0022     JBenchUtils m_bench_utils;
0023 
0024 public:
0025 
0026     JTestPlotter() {
0027         SetPrefix("jtest:plotter");
0028         SetTypeName(NAME_OF_THIS);
0029         SetCallbackStyle(CallbackStyle::ExpertMode);
0030     }
0031 
0032     void Process(const JEvent& event) override {
0033 
0034         m_bench_utils.set_seed(event.GetEventNumber(), typeid(*this).name());
0035 
0036         // Read the track data
0037         m_bench_utils.read_memory(m_track_data->at(0)->buffer);
0038 
0039         // Consume CPU
0040         m_bench_utils.consume_cpu_ms(*m_cputime_ms + m_track_aux_data->at(0)->something, *m_cputime_spread);
0041 
0042         // Write the histogram data
0043         auto hd = new JTestHistogramData;
0044         m_bench_utils.write_memory(hd->buffer, *m_write_bytes, *m_write_spread);
0045         event.Insert(hd);
0046     }
0047 
0048 };
0049 
0050 #endif // JTestEventProcessor
0051