Skip to content

Commit

Permalink
Fix a few warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Sep 8, 2024
1 parent f52cfc6 commit da10828
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
1 change: 0 additions & 1 deletion k4MarlinWrapper/k4MarlinWrapper/util/k4MarlinWrapperUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#ifndef K4MARLINWRAPPER_UTIL_H
#define K4MARLINWRAPPER_UTIL_H

#include <iostream>
#include <regex>
#include <string>
#include <vector>
Expand Down
11 changes: 5 additions & 6 deletions k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<AnyDataWrapper<std::shared_ptr<podio::CollectionBase>>*>(p);
if (!ptr) {
auto nptr = dynamic_cast<AnyDataWrapper<std::shared_ptr<podio::CollectionBase>>*>(p);
if (!nptr) {
throw GaudiException("Collection could not be casted to the expected type", name(), StatusCode::FAILURE);
} else {
collPtr = dynamic_cast<podio::CollectionBase*>(ptr->getData().get());
collPtr = dynamic_cast<podio::CollectionBase*>(nptr->getData().get());
}
}

Expand Down
6 changes: 5 additions & 1 deletion k4MarlinWrapper/src/components/LcioEventOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<IMPL::LCEventImpl*>(static_cast<LCEventWrapper*>(pObject)->getEvent());

std::vector<lcio::LCCollectionVec*> subsets{};
Expand All @@ -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;
}
12 changes: 6 additions & 6 deletions k4MarlinWrapper/src/components/MarlinProcessorWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<LCEventWrapperStatus>(false);
const StatusCode scStatus = eventSvc()->registerObject("/Event/LCEventStatus", pStatus.release());
if (scStatus.isFailure()) {
auto upStatus = std::make_unique<LCEventWrapperStatus>(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;
}
Expand All @@ -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<LCEventWrapperStatus>(false);
const StatusCode scStatus = eventSvc()->registerObject("/Event/LCEventStatus", pStatus.release());
if (scStatus.isFailure()) {
auto upStatus = std::make_unique<LCEventWrapperStatus>(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;
}
Expand Down

0 comments on commit da10828

Please sign in to comment.