Coder Social home page Coder Social logo

Comments (1)

tmadlener avatar tmadlener commented on July 23, 2024

Another issue with subset collections of datatypes with a VectorMember is that they cannot be written if they have been read from file, i.e.

auto reader = podio::ROOTFrameReader();
reader.openFile("inputfile.root");

auto writer = podio::ROOTFrameWriter("outputfile.root");

auto event = podio::Frame(reader.readEntry("events", 0));
// assume there is a subset collection with a subset collection
// of a datatype with a VectorMember, e.g. ExampleWithVectorMember

writer.writeFrame(event, "events");

The final call here will crash with something like:

#6  0x00007ff214836552 in ExampleWithVectorMemberCollectionData::getCollectionBuffers (this=0x5566b4c044a8, isSubsetColl=true) at /home/tmadlener/work/AIDASoft/podio/tests/src/ExampleWithVectorMemberCollectionData.cc:52
#7  0x00007ff214833cea in ExampleWithVectorMemberCollection::getBuffers (this=<optimized out>) at /home/tmadlener/work/AIDASoft/podio/tests/src/ExampleWithVectorMemberCollection.cc:155
#8  0x00007ff2148f1779 in podio::ROOTFrameWriter::initBranches (this=<optimized out>, catInfo=..., collections=..., parameters=...) at /home/tmadlener/work/AIDASoft/podio/src/ROOTFrameWriter.cc:77
#9  0x00007ff2148f3450 in podio::ROOTFrameWriter::writeFrame (this=this, entry=0x7ffd08b1aab0, frame=..., category="other_events", collsToWrite=std::vector of length 24, capacity 24 = {...}) at /home/tmadlener/work/AIDASoft/podio/src/ROOTFrameWriter.cc:52
#10 0x00007ff2148f3539 in podio::ROOTFrameWriter::writeFrame (this=this, entry=0x7ffd08b1aab0, frame=..., category="other_events") at /home/tmadlener/work/AIDASoft/podio/src/ROOTFrameWriter.cc:25

This is because, we try to access elements of a vector that do not exist in this case, here:

podio::CollectionWriteBuffers {{ class_type }}::getCollectionBuffers(bool isSubsetColl) {
{% if VectorMembers %}
// Make sure these point to the right place, even if a collection has been
// moved since it has been created
{% for member in VectorMembers %}
m_vecmem_info[{{ loop.index0 }}].second = &m_vec_{{ member.name }};
{% endfor %}
{% endif -%}

The access to the vector members need to be guarded by an if(!isSubsetColl)

from podio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.