Skip to content

Commit

Permalink
Remove some messages and fix some tests (key4hep#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell authored May 29, 2024
1 parent 1d4647e commit 67c62d9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
8 changes: 2 additions & 6 deletions k4FWCore/components/IOSvc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ std::tuple<std::vector<std::shared_ptr<podio::CollectionBase>>, std::vector<std:
podio::Frame frame;
{
std::scoped_lock<std::mutex> lock(m_changeBufferLock);
info() << "m_nextEntry = " << m_nextEntry << " m_entries = " << m_entries << endmsg;
if (m_nextEntry < m_entries) {
frame = podio::Frame(std::move(m_reader->readEntry(podio::Category::Event, m_nextEntry)));
} else {
Expand All @@ -88,14 +87,12 @@ std::tuple<std::vector<std::shared_ptr<podio::CollectionBase>>, std::vector<std:
}

if (m_nextEntry >= m_entries) {
// if (true) {
auto ep = serviceLocator()->as<IEventProcessor>();
StatusCode sc = ep->stopRun();
if (sc.isFailure()) {
error() << "Error when stopping run" << endmsg;
throw GaudiException("Error when stopping run", name(), StatusCode::FAILURE);
}
info() << "m_nextEntry = " << m_nextEntry << " m_entries = " << m_entries << endmsg;
}

std::vector<std::shared_ptr<podio::CollectionBase>> collections;
Expand Down Expand Up @@ -143,10 +140,9 @@ void IOSvc::handle(const Incident& incident) {
if (code.isSuccess()) {
debug() << "Removing the collection: " << coll << " from the store" << endmsg;
code = m_dataSvc->unregisterObject(collPtr);
} else {
error() << "Expected collection " << coll << " in the store but it was not found" << endmsg;
}
// else {
// info() << "Collection not found: " << coll << endmsg;
// }
}
}

Expand Down
8 changes: 5 additions & 3 deletions k4FWCore/include/k4FWCore/FunctionalUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,17 @@ namespace k4FWCore {
// 1. a mistake was made in the input types of a functional algorithm
// 2. the data was produced using the old DataHandle, which is never going to be in the input type
if (e.message().find("different from") != std::string::npos) {
thisClass->error() << "Trying to cast the collection " << std::get<Index>(handles)[0].objKey()
<< " to the requested type " << thisClass->name() << endmsg;
thisClass->debug() << "Trying to cast the collection " << std::get<Index>(handles)[0].objKey()
<< " to the requested type didn't work " << endmsg;
DataObject* p;
IDataProviderSvc* svc = thisClass->serviceLocator()->template service<IDataProviderSvc>("EventDataSvc");
svc->retrieveObject("/Event/" + std::get<Index>(handles)[0].objKey(), p).ignore();
const auto wrp = dynamic_cast<const DataWrapper<std::tuple_element_t<Index, std::tuple<In...>>>*>(p);
if (!wrp) {
throw GaudiException(thisClass->name(),
"Failed to cast collection " + std::get<Index>(handles)[0].objKey(),
"Failed to cast collection " + std::get<Index>(handles)[0].objKey() +
" to the requested type " +
typeid(std::tuple_element_t<Index, std::tuple<In...>>).name(),
StatusCode::FAILURE);
}
std::get<Index>(inputTuple) = const_cast<std::tuple_element_t<Index, std::tuple<In...>>*>(wrp->getData());
Expand Down
9 changes: 6 additions & 3 deletions test/k4FWCoreTest/options/runFunctionalMix.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# This is an example mixing functional and non-functional algorithms
#

from Gaudi.Configuration import INFO, DEBUG
from Gaudi.Configuration import INFO
from Configurables import (
ExampleFunctionalConsumerMultiple,
ExampleFunctionalTransformerMultiple,
Expand Down Expand Up @@ -102,7 +102,9 @@
InputCollectionParticles=["FunctionalMCParticles"],
Offset=0,
)
consumer_producerfun_algorithm = k4FWCoreTest_CheckExampleEventData("CheckFunctional")
consumer_producerfun_algorithm = k4FWCoreTest_CheckExampleEventData(
"CheckFunctional", keepEventNumberZero=True
)
consumer_producerfun_algorithm.mcparticles = "FunctionalMCParticles"
consumer_producerfun_algorithm.keepEventNumberZero = True

Expand All @@ -125,6 +127,7 @@
)
consumer_produceralg_algorithm = k4FWCoreTest_CheckExampleEventData("CheckAlgorithm")
consumer_produceralg_algorithm.mcparticles = "OldAlgorithmMCParticles"
consumer_produceralg_algorithm.vectorfloat = "OldAlgorithmVectorFloat"

###############################

Expand Down Expand Up @@ -160,5 +163,5 @@
EvtSel="NONE",
EvtMax=10,
ExtSvc=[iosvc if args.iosvc else podioevent],
OutputLevel=DEBUG,
OutputLevel=INFO,
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@

// datamodel
#include "edm4hep/MCParticleCollection.h"
#include "edm4hep/SimTrackerHitCollection.h"
#include "edm4hep/TrackCollection.h"
#if __has_include("edm4hep/TrackerHit3DCollection.h")
#include "edm4hep/TrackerHit3DCollection.h"
#else
#include "edm4hep/TrackerHitCollection.h"
namespace edm4hep {
using TrackerHit3DCollection = edm4hep::TrackerHitCollection;
} // namespace edm4hep
#endif
#include "edm4hep/TrackerHitPlaneCollection.h"

DECLARE_COMPONENT(k4FWCoreTest_CheckExampleEventData)

Expand All @@ -48,9 +37,10 @@ StatusCode k4FWCoreTest_CheckExampleEventData::initialize() { return Gaudi::Algo
StatusCode k4FWCoreTest_CheckExampleEventData::execute(const EventContext&) const {
auto floatVector = m_vectorFloatHandle.get();
if (floatVector->size() != 3 || (*floatVector)[2] != m_event) {
fatal() << "Contents of vectorfloat collection is not as expected: size = " << floatVector->size()
<< " (expected 3), contents = " << *floatVector << " (expected [125., 25., " << m_event << "]) " << endmsg;
// return StatusCode::FAILURE;
std::stringstream error;
error << "Contents of vectorfloat collection is not as expected: size = " << floatVector->size()
<< " (expected 3), contents = " << *floatVector << " (expected [125., 25., " << m_event << "]) ";
throw std::runtime_error(error.str());
}

auto particles = m_mcParticleHandle.get();
Expand Down

0 comments on commit 67c62d9

Please sign in to comment.