Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-01 08:57:57

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 
0006 #ifndef JANA2_JHITCALIBRATOR_H
0007 #define JANA2_JHITCALIBRATOR_H
0008 
0009 #include <JANA/JEventProcessor.h>
0010 #include <JANA/JEvent.h>
0011 #include <JANA/Utils/JBenchUtils.h>
0012 #include "AHit.h"
0013 
0014 class AHitAnomalyDetector : public JEventProcessor {
0015 
0016 public:
0017     AHitAnomalyDetector(size_t delay_ms=1000) : m_delay_ms(delay_ms) {
0018             SetCallbackStyle(CallbackStyle::ExpertMode);
0019         };
0020 
0021     void Init() override {
0022 
0023     }
0024     void ProcessSequential(const JEvent& event) override {
0025 
0026         auto a_hits = event.Get<AHit>();
0027         std::stringstream ss;
0028         ss << "Anomaly detection: Event #" << event.GetEventNumber() << " : {";
0029         for (auto & hit : a_hits) {
0030             ss << "(" << hit->E << "," << hit->x << "), ";
0031         }
0032         ss << "}" << std::endl;
0033         std::cout << ss.str();
0034         m_bench_utils.set_seed(event.GetEventNumber(), NAME_OF_THIS);
0035         m_bench_utils.consume_cpu_ms(m_delay_ms);
0036     }
0037     void Finish() override {
0038         std::cout << "Anomaly detection: Done!" << std::endl;
0039     }
0040 private:
0041     size_t m_delay_ms;
0042     JBenchUtils m_bench_utils = JBenchUtils();
0043 
0044 };
0045 
0046 
0047 #endif