diff --git a/DDDigi/io/DigiEdm4hepOutput.cpp b/DDDigi/io/DigiEdm4hepOutput.cpp index 17fc4a6324ba13c44f70ad075f9da71eef55158b..5f275f5cd8f60c7672dd53eaa826a818e55ac183 100644 --- a/DDDigi/io/DigiEdm4hepOutput.cpp +++ b/DDDigi/io/DigiEdm4hepOutput.cpp @@ -61,8 +61,10 @@ namespace dd4hep { std::map<std::string, std::unique_ptr<edm4hep::TrackerHitCollection> > m_tracker_collections; /// Collection of all edm4hep calorimeter object collections std::map<std::string, std::unique_ptr<edm4hep::CalorimeterHitCollection> > m_calo_collections; - - std::string m_section_name { }; + /// Output section name + std::string m_section_name{ "EVENT" }; + /// Output mutex + std::mutex m_lock; /// Total numbe rof events to be processed long num_events { -1 }; /// Running event counter @@ -143,7 +145,7 @@ namespace dd4hep { return nullptr; } }; - + /// Clear local data content void DigiEdm4hepOutput::internals_t::clear() { m_header.second->clear(); @@ -157,6 +159,7 @@ namespace dd4hep { /// Commit data at end of filling procedure void DigiEdm4hepOutput::internals_t::commit() { if ( m_writer ) { + std::lock_guard<std::mutex> protection(m_lock); m_frame.put( std::move(*m_header.second), m_header.first); m_frame.put( std::move(*m_particles.second), m_particles.first); for( const auto& c : m_tracker_collections )