Back to home page

EIC code displayed by LXR

 
 

    


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

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 #include "DstExampleFactory.h"
0006 #include "DataObjects.h"
0007 
0008 #include <JANA/JEvent.h>
0009 
0010 void DstExampleFactory::Init() {
0011 
0012     /// This is necessary to generate the virtual function which does the conversion.
0013     /// Otherwise your datatype won't show up when you call event->GetAllChildren<T>.
0014     /// You can call this from the ctor, from Init, or from JEventSource::GetEvent.
0015 
0016     EnableGetAs<JObject>();
0017     EnableGetAs<Renderable>();
0018 }
0019 
0020 void DstExampleFactory::ChangeRun(const std::shared_ptr<const JEvent>&) {
0021 }
0022 
0023 void DstExampleFactory::Process(const std::shared_ptr<const JEvent> &event) {
0024 
0025     auto inputs = event->Get<MyRenderableJObject>("from_source");
0026 
0027     std::vector<MyRenderableJObject*> results;
0028 
0029     for (auto input : inputs) {
0030         // "Smear" each input
0031         auto mrj = new MyRenderableJObject(input->x + 1, input->y + 1, input->E + 1);
0032         results.push_back(mrj);
0033     }
0034 
0035     Set(results);
0036 }