Skip to content
Snippets Groups Projects
Commit 227b84b5 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'isfg4' into 'master'

ISF_Geant4Tools: thread-checker fixes

See merge request !58767
parents 9a945ab8 dbef968a
No related branches found
No related tags found
4 merge requests!59674InDetPerformanceMonitoring with LumiBlock selection,!59383cppcheck in trigger code: Prefer prefix ++/-- operators for non-primitive types.,!58990Draft:Fixing bug in FTF config when running with Reco_tf,!58767ISF_Geant4Tools: thread-checker fixes
Simulation/ISF/ISF_Geant4/ISF_Geant4Tools
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -58,10 +58,8 @@ namespace G4UA{
}
void MCTruthUserAction::PreUserTrackingAction(const G4Track* inTrack){
//ATH_MSG_DEBUG("Starting to track a new particle");
G4Track* inT = const_cast<G4Track*> (inTrack);
TrackHelper trackHelper(inT);
TrackHelper trackHelper(inTrack);
if (trackHelper.IsPrimary() ||
(trackHelper.IsRegisteredSecondary()&&m_config.ilevel>1) ||
......@@ -72,14 +70,13 @@ namespace G4UA{
trkMgr->SetStoreTrajectory(true);
trkMgr->SetTrajectory(temp);
// TODO: check that the 'temp' obeject is actually deleted by the G4TrackingManager
// TODO: check that the 'temp' object is actually deleted by the G4TrackingManager
// after FADS::FadsTrackingAction::GetTrackingAction()->ResetTraj() is executed
}
}
void MCTruthUserAction::PostUserTrackingAction(const G4Track*){
//ATH_MSG_DEBUG("Finished tracking a particle");
G4EventManager::GetEventManager()->GetTrackingManager()->SetStoreTrajectory(false);
}
} // namespace iGeant4
......
......@@ -20,6 +20,7 @@
// Athena includes
#include "AtlasDetDescr/AtlasRegion.h"
#include "CxxUtils/checker_macros.h"
#include "MCTruth/AtlasG4EventUserInfo.h"
#include "MCTruth/PrimaryParticleInformation.h"
......@@ -86,7 +87,7 @@ void TrackProcessorUserActionBase::UserSteppingAction(const G4Step* aStep)
const std::vector<const G4Track*> *secondaryVector = aStep->GetSecondaryInCurrentStep();
for ( auto* aConstSecondaryTrack : *secondaryVector ) {
// get a non-const G4Track for current secondary (nasty!)
G4Track* aSecondaryTrack = const_cast<G4Track*>( aConstSecondaryTrack );
G4Track* aSecondaryTrack ATLAS_THREAD_SAFE = const_cast<G4Track*>( aConstSecondaryTrack ); // imposed by Geant4 interface
auto *trackInfo = ::iGeant4::ISFG4Helper::getISFTrackInfo(*aSecondaryTrack);
......@@ -108,7 +109,7 @@ void TrackProcessorUserActionBase::PreUserTrackingAction(const G4Track* aTrack)
{
bool isPrimary = ! aTrack->GetParentID();
if (isPrimary) {
G4Track* nonConstTrack = const_cast<G4Track*> (aTrack); // love it :)
G4Track* nonConstTrack ATLAS_THREAD_SAFE = const_cast<G4Track*> (aTrack); // imposed by Geant4 interface
setupPrimary(*nonConstTrack);
} else {
setupSecondary(*aTrack);
......
......@@ -21,6 +21,8 @@
// Athena includes
#include "AtlasDetDescr/AtlasRegion.h"
#include "CxxUtils/checker_macros.h"
#include "StoreGate/StoreGateSvc.h"
// MCTruth includes
#include "MCTruth/TrackBarcodeInfo.h"
......@@ -29,8 +31,6 @@
#include "MCTruth/TrackInformation.h"
#include "MCTruth/VTrackInformation.h"
#include "StoreGate/StoreGateSvc.h"
// Geant4 includes
#include "G4ParticleDefinition.hh"
#include "G4DynamicParticle.hh"
......@@ -186,7 +186,7 @@ namespace G4UA {
// loop over new secondaries
for ( auto* aConstTrack_2nd : *secondaryVector ) {
// get a non-const G4Track for current secondary (nasty!)
G4Track *aTrack_2nd = const_cast<G4Track*>( aConstTrack_2nd );
G4Track *aTrack_2nd ATLAS_THREAD_SAFE = const_cast<G4Track*>( aConstTrack_2nd ); // imposed by Geant4 interface
// check if new secondary position is behind boundary
const G4ThreeVector& pos_2nd = aTrack_2nd->GetPosition();
......@@ -286,10 +286,11 @@ namespace G4UA {
trackInfo->SetBaseISFParticle( newISP );
// push the particle back to ISF via the particle broker
// in MT mode there is no broker
if ( m_particleBrokerQuick )
{
m_particleBrokerQuick->push(newISP, parentISP);
[&] ATLAS_NOT_THREAD_SAFE () { // suppress checker warning, in MT mode there is no broker
m_particleBrokerQuick->push(newISP, parentISP);
}();
}
else
{
......
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