Skip to content
Snippets Groups Projects
Commit 0245026b authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Fire ContextIncident 'CONNECTED_NTUPLE_OUTPUT' when opening a ntuple file in RFileCnv

parent 4784576d
No related branches found
No related tags found
1 merge request!1478Fire ContextIncident 'CONNECTED_NTUPLE_OUTPUT' when opening a ntuple file in RFileCnv
Pipeline #5934609 passed
......@@ -10,6 +10,7 @@
\***********************************************************************************/
// Include files
#include "GaudiKernel/Bootstrap.h"
#include "GaudiKernel/DataIncident.h"
#include "GaudiKernel/IOpaqueAddress.h"
#include "GaudiKernel/IRegistry.h"
#include "GaudiKernel/ISvcLocator.h"
......@@ -44,7 +45,14 @@ StatusCode RootHistCnv::RFileCnv::initialize() {
if ( !sc ) return sc;
}
// initialise base class
return RDirectoryCnv::initialize();
return RDirectoryCnv::initialize().andThen( [&]() {
m_incSvc = service( "IncidentSvc" );
if ( !m_incSvc ) {
MsgStream( msgSvc() ) << MSG::ERROR << "Cannot access IncidentSvc" << endmsg;
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
} );
}
//------------------------------------------------------------------------------
......@@ -126,6 +134,7 @@ StatusCode RootHistCnv::RFileCnv::createObj( IOpaqueAddress* pAddress, DataObjec
regTFile( ooname, rfile ).ignore();
log << MSG::DEBUG << "creating ROOT file " << fname << endmsg;
m_incSvc->fireIncident( ContextIncident<TFile*>( fname, "CONNECTED_NTUPLE_OUTPUT", rfile ) );
ipar[0] = (unsigned long)rfile;
NTuple::File* pFile = new NTuple::File( objType(), fname, oname );
......
......@@ -12,6 +12,7 @@
#define ROOTHISTCNV_RFILECNV_H 1
// Include files
#include "GaudiKernel/IIncidentSvc.h"
#include "GaudiKernel/NTuple.h"
#include "RDirectoryCnv.h"
......@@ -51,8 +52,9 @@ namespace RootHistCnv {
RFileCnv( ISvcLocator* svc );
protected:
TFile* rfile{ nullptr }; ///< Pointer to ROOT file
std::string m_compLevel; ///< Compression setting, property RFileCnv.GlobalCompression
TFile* rfile{ nullptr }; ///< Pointer to ROOT file
std::string m_compLevel; ///< Compression setting, property RFileCnv.GlobalCompression
SmartIF<IIncidentSvc> m_incSvc;
};
} // namespace RootHistCnv
#endif // RootHistCnv_RFileCNV_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment