diff --git a/Control/AthenaBaseComps/src/AthFilterAlgorithm.cxx b/Control/AthenaBaseComps/src/AthFilterAlgorithm.cxx index 470208d6dfc1ecf2c9cd2b0ee798c5dd914074ae..22a696bf8a30a562b127bf43f50b2d25e3e76850 100644 --- a/Control/AthenaBaseComps/src/AthFilterAlgorithm.cxx +++ b/Control/AthenaBaseComps/src/AthFilterAlgorithm.cxx @@ -102,23 +102,20 @@ AthFilterAlgorithm::setFilterPassed( bool state ) const AthAlgorithm::setFilterPassed(state); if (state) { -/* double evtWeight=1.0; - const xAOD::EventInfo* evtInfo = 0; + const xAOD::EventInfo* evtInfo = nullptr; StatusCode sc = evtStore()->retrieve(evtInfo); if ( sc.isFailure() || NULL == evtInfo ) { - ATH_MSG_WARNING("Could not retrieve EventInfo from StoreGate "); + ATH_MSG_ERROR("Could not retrieve xAOD::EventInfo from StoreGate "); evtWeight=-1000.; } else { - // Only try to access the mcEventWeight is we are running on Monte Carlo, duhhh! + // Only try to access the mcEventWeight if we are running on Monte Carlo, duhhh! if ( evtInfo->eventType(xAOD::EventInfo::IS_SIMULATION) ) { evtWeight = evtInfo->mcEventWeight(); } } m_cutFlowSvc->addEvent(m_cutID,evtWeight); -*/ - m_cutFlowSvc->addEvent(m_cutID); } } diff --git a/Control/AthenaKernel/AthenaKernel/ICutFlowSvc.h b/Control/AthenaKernel/AthenaKernel/ICutFlowSvc.h index a7b4944272a5d52678d4a01cc3b1d1b4ebd41ee0..c4d21a1d12a513249fbe1cc307a46ee7dba80d82 100644 --- a/Control/AthenaKernel/AthenaKernel/ICutFlowSvc.h +++ b/Control/AthenaKernel/AthenaKernel/ICutFlowSvc.h @@ -93,18 +93,6 @@ public: /// using CutIdentifier returned by selfRegisterFilter or registerCut virtual void addEvent( CutIdentifier cutID, double weight) = 0; - /// Get a CutBookkeeper given a CutID - // virtual xAOD::CutBookkeeper* getCutBookkeeper( const CutIdentifier cutID ) = 0; - - /// Helper function for D3PDs, dumps the CutFlowSvc content into a flat TTree. - /// The returned TTree is owned by the caller and can be eventually written by the caller in its favorite output TFile. - //virtual TTree* dumpCutFlowToTTree( const char* treeName="CutFlowTree" ) = 0; - - /// Inverse of above DumpCutFlowToTTree: when reading a D3PD, re-interpret the flat TTree to a usual transient EventBookkeeperCollection. - /// This should be the only method able to read flat TTrees, the other CutFlowSvc functionalities always work with EventBookkeepers. - /// The produced EventBookkeeperCollection remains internal to the CutFlowSvc, users can manipulate it using the usual ICutFlowSvc interface. - //virtual void loadCutFlowFromTTree( TTree* t ) = 0; - /// Gaudi boilerplate static const InterfaceID& interfaceID(); diff --git a/Event/EventBookkeeperTools/src/CutFlowSvc.cxx b/Event/EventBookkeeperTools/src/CutFlowSvc.cxx index 589ea9c576704c536571f11ffa18428ea5113fab..c90174094d288420bce333a10ec2babed30db432 100644 --- a/Event/EventBookkeeperTools/src/CutFlowSvc.cxx +++ b/Event/EventBookkeeperTools/src/CutFlowSvc.cxx @@ -318,9 +318,10 @@ void CutFlowSvc::addEvent( CutIdentifier cutID ) { ATH_MSG_INFO("calling addEvent(" << cutID << ")" ); + ATH_MSG_WARNING("DEPRECATED method, please call addEvent(ID,weight)"); double evtWeight=1.0; - +/* const xAOD::EventInfo* evtInfo = nullptr; StatusCode sc = m_eventStore->retrieve(evtInfo); if ( sc.isFailure() || nullptr == evtInfo ) { @@ -332,6 +333,7 @@ CutFlowSvc::addEvent( CutIdentifier cutID ) evtWeight = evtInfo->mcEventWeight(); } } +*/ addEvent(cutID,evtWeight); @@ -345,6 +347,7 @@ CutFlowSvc::addEvent( CutIdentifier cutID, double weight) { ATH_MSG_INFO("calling addEvent(" << cutID << ", " << weight << ")" ); + std::lock_guard<std::recursive_mutex> lock(m_addeventMutex); // Create bookkeeper container for bookkeepers in _this_ processing xAOD::CutBookkeeperContainer* fileBook = nullptr; if (m_outMetaDataStore->retrieve(fileBook,m_fileCollName).isFailure()) { @@ -545,7 +548,7 @@ CutFlowSvc::recordCollection( xAOD::CutBookkeeperContainer * coll, xAOD::CutBookkeeper* -CutFlowSvc::getCutBookkeeper( const CutIdentifier cutID ) { +CutFlowSvc::getCutBookkeeper( const CutIdentifier cutID ) const { xAOD::CutBookkeeperContainer* fileBook = nullptr; if (m_outMetaDataStore->retrieve(fileBook,m_fileCollName).isFailure()) { ATH_MSG_ERROR("Could not retrieve handle to cutflowsvc bookkeeper"); diff --git a/Event/EventBookkeeperTools/src/CutFlowSvc.h b/Event/EventBookkeeperTools/src/CutFlowSvc.h index d92d249a5f5b26e3edd852d7d094aa19b49f772d..4a712d7064a933601e47981b746933a8e58fb186 100644 --- a/Event/EventBookkeeperTools/src/CutFlowSvc.h +++ b/Event/EventBookkeeperTools/src/CutFlowSvc.h @@ -22,6 +22,7 @@ // STL includes #include <string> #include <vector> +#include <mutex> // FrameWork includes #include "GaudiKernel/ISvcLocator.h" @@ -127,7 +128,7 @@ public: void addEvent( CutIdentifier cutID, double weight ) override final; /// Get a CutBookkeeper given a CutID - xAOD::CutBookkeeper* getCutBookkeeper( const CutIdentifier cutID ); + xAOD::CutBookkeeper* getCutBookkeeper( const CutIdentifier cutID ) const; void print(); @@ -175,6 +176,8 @@ private: /// to the pointer of associated CutBookkeeper CutIDMap_t m_ebkMap; + mutable std::recursive_mutex m_addeventMutex; + public: /// Publish the interface for this service