diff --git a/k4MarlinWrapper/k4MarlinWrapper/util/k4MarlinWrapperUtil.h b/k4MarlinWrapper/k4MarlinWrapper/util/k4MarlinWrapperUtil.h index 98cceddb..6bb8a755 100644 --- a/k4MarlinWrapper/k4MarlinWrapper/util/k4MarlinWrapperUtil.h +++ b/k4MarlinWrapper/k4MarlinWrapper/util/k4MarlinWrapperUtil.h @@ -19,7 +19,6 @@ #ifndef K4MARLINWRAPPER_UTIL_H #define K4MARLINWRAPPER_UTIL_H -#include #include #include #include diff --git a/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp b/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp index 5a4d04ae..887c6f40 100644 --- a/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp +++ b/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp @@ -287,15 +287,14 @@ podio::CollectionBase* EDM4hep2LcioTool::getEDM4hepCollection(const std::string& if (ptr) { collPtr = ptr->collectionBase(); } - // When the collection can't be retrieved from the frame - // there is still the possibility that it was generated - // from a functional algorithm + // When the collection can't be retrieved from the frame there is still the + // possibility that it was generated from a functional algorithm else { - auto ptr = dynamic_cast>*>(p); - if (!ptr) { + auto nptr = dynamic_cast>*>(p); + if (!nptr) { throw GaudiException("Collection could not be casted to the expected type", name(), StatusCode::FAILURE); } else { - collPtr = dynamic_cast(ptr->getData().get()); + collPtr = dynamic_cast(nptr->getData().get()); } } diff --git a/k4MarlinWrapper/src/components/LcioEventOutput.cpp b/k4MarlinWrapper/src/components/LcioEventOutput.cpp index 4ff7fdc6..0aefc151 100644 --- a/k4MarlinWrapper/src/components/LcioEventOutput.cpp +++ b/k4MarlinWrapper/src/components/LcioEventOutput.cpp @@ -132,6 +132,10 @@ StatusCode LcioEventOutput::execute(const EventContext&) const { // Get event DataObject* pObject = nullptr; StatusCode sc = evtSvc()->retrieveObject("/Event/LCEvent", pObject); + if (sc.isFailure()) { + error() << "Could not retrieve LCEvent from event service" << endmsg; + return StatusCode::FAILURE; + } lcio::LCEventImpl* the_event = dynamic_cast(static_cast(pObject)->getEvent()); std::vector subsets{}; @@ -149,7 +153,7 @@ StatusCode LcioEventOutput::execute(const EventContext&) const { StatusCode LcioEventOutput::finalize() { // Cleanup m_writer->close(); - delete (m_writer); + delete m_writer; return StatusCode::SUCCESS; } diff --git a/k4MarlinWrapper/src/components/MarlinProcessorWrapper.cpp b/k4MarlinWrapper/src/components/MarlinProcessorWrapper.cpp index 439d44a5..89da3df1 100644 --- a/k4MarlinWrapper/src/components/MarlinProcessorWrapper.cpp +++ b/k4MarlinWrapper/src/components/MarlinProcessorWrapper.cpp @@ -276,9 +276,9 @@ StatusCode MarlinProcessorWrapper::execute(const EventContext&) const { // Handle exceptions that may come from Marlin catch (marlin::SkipEventException& e) { // Store flag to prevent the rest of the event from processing - auto pStatus = std::make_unique(false); - const StatusCode scStatus = eventSvc()->registerObject("/Event/LCEventStatus", pStatus.release()); - if (scStatus.isFailure()) { + auto upStatus = std::make_unique(false); + const StatusCode code = eventSvc()->registerObject("/Event/LCEventStatus", upStatus.release()); + if (code.isFailure()) { error() << "Failed to store flag to skip event on Marlin marlin::SkipEventException" << endmsg; return scStatus; } @@ -287,9 +287,9 @@ StatusCode MarlinProcessorWrapper::execute(const EventContext&) const { return StatusCode::FAILURE; } catch (marlin::StopProcessingException& e) { // Store flag to prevent the rest of the event from processing - auto pStatus = std::make_unique(false); - const StatusCode scStatus = eventSvc()->registerObject("/Event/LCEventStatus", pStatus.release()); - if (scStatus.isFailure()) { + auto upStatus = std::make_unique(false); + const StatusCode code = eventSvc()->registerObject("/Event/LCEventStatus", upStatus.release()); + if (code.isFailure()) { error() << "Failed to store flag to skip event on Marlin marlin::StopProcessingException" << endmsg; return scStatus; }