Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright 2020, Jefferson Science Associates, LLC.
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 //
0004 // This implements a simple clusterizer factory to create Cluster
0005 // objects out of Hit objects. The Hit objects are obtained from
0006 // JANA where in principle they could come from either the event
0007 // source (e.g. file) or from another factory. (For this plugin
0008 // though they come from the event source.)
0009 //
0010 // For this example we only implement the Process method for simplicity.
0011 
0012 #include <JANA/JEvent.h>
0013 #include "JFactory_Cluster.h"
0014 
0015 void JFactory_Cluster::Process(const std::shared_ptr<const JEvent> &event) {
0016 
0017     // Get all Hit objects
0018     auto hits = event->Get<Hit>();
0019 
0020     // Make clusters from hits.
0021     // (for this example we just make a single cluster from all hits)
0022     auto cluster = new Cluster();
0023     for( auto hit : hits ) cluster->AddHit( hit );
0024 
0025     /// Publish outputs
0026     std::vector<Cluster*> results;
0027     results.push_back(cluster); // in real situation we may have more than one cluster
0028     Set(results);
0029 }