Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:36:43

0001 // Copyright 2024, Jefferson Science Associates, LLC.
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 
0004 #pragma once
0005 
0006 #include <JANA/Components/JDatabundle.h>
0007 #include <podio/CollectionBase.h>
0008 #include <podio/Frame.h>
0009 
0010 
0011 class JPodioDatabundle : public JDatabundle {
0012 
0013 private:
0014     const podio::CollectionBase* m_collection = nullptr;
0015 
0016 public:
0017     size_t GetSize() const override {
0018         if (m_collection == nullptr) {
0019             return 0;
0020         }
0021         return m_collection->size();
0022     }
0023 
0024     virtual void ClearData() override {
0025         m_collection = nullptr;
0026 
0027         SetStatus(JDatabundle::Status::Empty);
0028         // Podio clears the data itself when the frame is destroyed.
0029         // Until then, the collection is immutable.
0030         //
0031         // Consider: Instead of putting the frame in its own JFactory, maybe we 
0032         // want to maintain a shared_ptr to the frame here, and delete the
0033         // the reference on ClearData(). Thus, the final call to ClearData()
0034         // for each event deletes the frame and actually frees the data.
0035         // This would let us support multiple frames within one event, though
0036         // it might also prevent the user from accessing frames directly.
0037     }
0038 
0039     const podio::CollectionBase* GetCollection() const { return m_collection; }
0040 
0041     void SetCollection(const podio::CollectionBase* collection) { m_collection = collection; }
0042 };
0043 
0044