File indexing completed on 2025-01-18 10:17:19
0001
0002
0003
0004
0005
0006 #ifndef JANA2_DETECTORAHITFACTORY_H
0007 #define JANA2_DETECTORAHITFACTORY_H
0008
0009 #include <JANA/JFactoryT.h>
0010 #include <JANA/JEvent.h>
0011
0012 #include <chrono>
0013
0014 #include "AHit.h"
0015 #include "ReadoutMessageAuto.h"
0016
0017
0018
0019 class AHitParser : public JFactoryT<AHit> {
0020
0021
0022 public:
0023
0024 void Process(const std::shared_ptr<const JEvent>& event) {
0025
0026 auto readoutMessages = event->Get<ReadoutMessageAuto>();
0027 for (const auto& readoutMessage : readoutMessages) {
0028 auto ahit = new AHit();
0029
0030 ahit->E = reinterpret_cast<const float&>(readoutMessage->payload[0]);
0031 ahit->x = reinterpret_cast<const float&>(readoutMessage->payload[1]);
0032 ahit->y = reinterpret_cast<const float&>(readoutMessage->payload[2]);
0033 ahit->z = reinterpret_cast<const float&>(readoutMessage->payload[3]);
0034 Insert(ahit);
0035 std::cout << "Parsing: " << *readoutMessage << std::endl;
0036 }
0037 }
0038 };
0039
0040 #endif