diff --git a/tests/read_test.h b/tests/read_test.h index 9bfffe145..4761df401 100644 --- a/tests/read_test.h +++ b/tests/read_test.h @@ -38,8 +38,8 @@ bool check_fixed_width_value(FixedWidthT actual, FixedWidthT expected, const std return true; } -void processEvent(const podio::Frame& store, int eventNum, podio::version::Version fileVersion) { - const float evtWeight = store.getParameter("UserEventWeight"); +void processEvent(const podio::Frame& event, int eventNum, podio::version::Version fileVersion) { + const float evtWeight = event.getParameter("UserEventWeight"); if (evtWeight != (float)100. * eventNum) { std::cout << " read UserEventWeight: " << evtWeight << " - expected : " << (float)100. * eventNum << std::endl; throw std::runtime_error("Couldn't read event meta data parameters 'UserEventWeight'"); @@ -47,7 +47,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi std::stringstream ss; ss << " event_number_" << eventNum; - const auto& evtName = store.getParameter("UserEventName"); + const auto& evtName = event.getParameter("UserEventName"); if (evtName != ss.str()) { std::cout << " read UserEventName: " << evtName << " - expected : " << ss.str() << std::endl; @@ -55,7 +55,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi } if (fileVersion > podio::version::Version{0, 14, 1}) { - const auto& someVectorData = store.getParameter>("SomeVectorData"); + const auto& someVectorData = event.getParameter>("SomeVectorData"); if (someVectorData.size() != 4) { throw std::runtime_error("Couldn't read event meta data parameters: 'SomeVectorData'"); } @@ -67,7 +67,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi } if (fileVersion > podio::version::Version{0, 16, 2}) { - const auto& doubleParams = store.getParameter>("SomeVectorData"); + const auto& doubleParams = event.getParameter>("SomeVectorData"); if (doubleParams.size() != 2 || doubleParams[0] != eventNum * 1.1 || doubleParams[1] != eventNum * 2.2) { throw std::runtime_error("Could not read event parameter: 'SomeDoubleValues' correctly"); } @@ -76,7 +76,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi try { // not assigning to a variable, because it will remain unused, we just want // the exception here - store.get("notthere"); + event.get("notthere"); } catch (const std::runtime_error& err) { if (std::string(err.what()) != "No collection \'notthere\' is present in the EventStore") { throw std::runtime_error("Trying to get non present collection \'notthere' should throw an exception"); @@ -84,10 +84,10 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi } // read collection meta data - auto& hits = store.get("hits"); + auto& hits = event.get("hits"); if (fileVersion > podio::version::Version{0, 14, 0}) { - auto& hitRefs = store.get("hitRefs"); + auto& hitRefs = event.get("hitRefs"); if (hitRefs.size() != hits.size()) { throw std::runtime_error("hit and subset hit collection do not have the same size"); } @@ -96,7 +96,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi } } - auto& clusters = store.get("clusters"); + auto& clusters = event.get("clusters"); if (clusters.isValid()) { auto cluster = clusters[0]; for (auto i = cluster.Hits_begin(), end = cluster.Hits_end(); i != end; ++i) { @@ -110,7 +110,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi // Read the mcParticleRefs before reading any of the other collections that // are referenced to make sure that all the necessary relations are handled // correctly - auto& mcpRefs = store.get("mcParticleRefs"); + auto& mcpRefs = event.get("mcParticleRefs"); if (!mcpRefs.isValid()) { throw std::runtime_error("Collection 'mcParticleRefs' should be present"); } @@ -132,7 +132,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi } } - auto& mcps = store.get("mcparticles"); + auto& mcps = event.get("mcparticles"); if (!mcps.isValid()) { throw std::runtime_error("Collection 'mcparticles' should be present"); } @@ -200,7 +200,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi // Load the subset collection first to ensure that it pulls in objects taht // have not been read yet - auto& mcpRefs = store.get("mcParticleRefs"); + auto& mcpRefs = event.get("mcParticleRefs"); if (!mcpRefs.isValid()) { throw std::runtime_error("Collection 'mcParticleRefs' should be present"); } @@ -212,7 +212,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi } } - auto& moreMCs = store.get("moreMCs"); + auto& moreMCs = event.get("moreMCs"); // First check that the two mc collections that we store are the same if (mcps.size() != moreMCs.size()) { @@ -245,7 +245,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi } // std::cout << "Fetching collection 'refs'" << std::endl; - auto& refs = store.get("refs"); + auto& refs = event.get("refs"); if (refs.isValid()) { auto ref = refs[0]; for (auto cluster : ref.Clusters()) { @@ -257,7 +257,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi throw std::runtime_error("Collection 'refs' should be present"); } // std::cout << "Fetching collection 'OneRelation'" << std::endl; - auto& rels = store.get("OneRelation"); + auto& rels = event.get("OneRelation"); if (rels.isValid()) { // std::cout << "Referenced object has an energy of " << (*rels)[0].cluster().energy() << std::endl; } else { @@ -265,7 +265,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi } // std::cout << "Fetching collection 'WithVectorMember'" << std::endl; - auto& vecs = store.get("WithVectorMember"); + auto& vecs = event.get("WithVectorMember"); if (vecs.isValid()) { if (vecs.size() != 2) { throw std::runtime_error("Collection 'WithVectorMember' should have two elements'"); @@ -292,13 +292,13 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi throw std::runtime_error("Collection 'WithVectorMember' should be present"); } - auto& comps = store.get("Component"); + auto& comps = event.get("Component"); if (comps.isValid()) { auto comp = comps[0]; int a [[maybe_unused]] = comp.component().data.x + comp.component().data.z; } - auto& arrays = store.get("arrays"); + auto& arrays = event.get("arrays"); if (arrays.isValid() && arrays.size() != 0) { auto array = arrays[0]; if (array.myArray(1) != eventNum) { @@ -314,8 +314,8 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi throw std::runtime_error("Collection 'arrays' should be present"); } - auto& nmspaces = store.get("WithNamespaceRelation"); - auto& copies = store.get("WithNamespaceRelationCopy"); + auto& nmspaces = event.get("WithNamespaceRelation"); + auto& copies = event.get("WithNamespaceRelationCopy"); auto cpytest = ex42::ExampleWithARelationCollection{}; if (nmspaces.isValid() && copies.isValid()) { @@ -354,7 +354,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi } if (fileVersion >= podio::version::Version{0, 13, 1}) { - const auto& fixedWidthInts = store.get("fixedWidthInts"); + const auto& fixedWidthInts = event.get("fixedWidthInts"); if (not fixedWidthInts.isValid() or fixedWidthInts.size() != 3) { throw std::runtime_error("Collection \'fixedWidthInts\' should be present and have 3 elements"); } @@ -388,7 +388,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi } if (fileVersion >= podio::version::Version{0, 13, 2}) { - auto& usrInts = store.get>("userInts"); + auto& usrInts = event.get>("userInts"); if (usrInts.size() != (unsigned)eventNum + 1) { throw std::runtime_error("Could not read all userInts properly (expected: " + std::to_string(eventNum + 1) + @@ -410,7 +410,7 @@ void processEvent(const podio::Frame& store, int eventNum, podio::version::Versi } } - auto& usrDbl = store.get>("userDoubles"); + auto& usrDbl = event.get>("userDoubles"); if (usrDbl.size() != 100) { throw std::runtime_error( "Could not read all userDoubles properly (expected: 100, actual: " + std::to_string(usrDbl.size()) + ")");