Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-21 09:18:09

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 JTestPlotter_h
0006 #define JTestPlotter_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(bool order_output=false) {
0027         SetPrefix("jtest:plotter");
0028         SetTypeName(NAME_OF_THIS);
0029         SetCallbackStyle(CallbackStyle::ExpertMode);
0030         EnableOrdering(order_output);
0031     }
0032 
0033     void ProcessSequential(const JEvent& event) override {
0034 
0035         m_bench_utils.set_seed(event.GetEventNumber(), typeid(*this).name());
0036 
0037         // Read the track data
0038         m_bench_utils.read_memory(m_track_data->at(0)->buffer);
0039 
0040         // Consume CPU
0041         m_bench_utils.consume_cpu_ms(*m_cputime_ms + m_track_aux_data->at(0)->something, *m_cputime_spread);
0042 
0043         // Write the histogram data
0044         auto hd = new JTestHistogramData;
0045         m_bench_utils.write_memory(hd->buffer, *m_write_bytes, *m_write_spread);
0046         event.Insert(hd);
0047     }
0048 
0049 };
0050 
0051 #endif // JTestPlotter_h
0052