ATLAS Offline Software
G4ScoringProcessTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // class header
6 #include "G4ScoringProcessTool.h"
7 
8 #include <memory>
9 // package headers
10 #include "G4ParallelWorldScoringProcess.hh"
11 // Geant4 headers
12 #include "G4ProcessManager.hh"
13 #include "G4Version.hh"
14 //CLHEP headers
15 #include "CLHEP/Units/SystemOfUnits.h"
16 
17 
18 //-----------------------------------------------------------------------------
19 // Implementation file for class : G4ScoringProcessTool
20 //
21 // 26-10-2015 : Edoardo Farina
22 //-----------------------------------------------------------------------------
23 
24 #if G4VERSION_NUMBER > 1029
25 #define PARTICLEITERATOR (this->GetParticleIterator())
26 #elif G4VERSION_NUMBER > 1009
27 #define PARTICLEITERATOR aParticleIterator
28 #else
29 #define PARTICLEITERATOR theParticleIterator
30 #endif
31 
32 //=============================================================================
33 // Standard constructor, initializes variables
34 //=============================================================================
36  const std::string& nam,const IInterface* parent )
37  : base_class ( type, nam , parent )
38 {
39  m_physicsOptionType = G4AtlasPhysicsOption::Type::GlobalProcesses;
40 }
41 
42 //=============================================================================
43 // Destructor
44 //=============================================================================
45 
47 {
48 
49 }
50 
51 //=============================================================================
52 // Initialize
53 //=============================================================================
55 {
56  ATH_MSG_DEBUG("G4ScoringProcessTool initialize( )");
57  return StatusCode::SUCCESS;
58 }
59 
60 auto G4ScoringProcessTool::GetPhysicsOption() -> UPPhysicsConstructor {
61  return std::make_unique<G4ScoringProcessTool::PhysicsConstructor>(name(),
62  msgLevel());
63 }
64 
66 
68  // Add parallel world scoring process
69  ATH_MSG_DEBUG(" ScoringProcessDefinition::ConstructProcess()");
70 
71  G4ParallelWorldScoringProcess* theParallelWorldScoringProcess
72  = new G4ParallelWorldScoringProcess("ParaWorldScoringProc");
73  theParallelWorldScoringProcess->SetParallelWorld("Scoring");
74 
75  PARTICLEITERATOR->reset();
76  while( (*PARTICLEITERATOR)() )
77  {
78  G4ParticleDefinition* particle = PARTICLEITERATOR->value();
79  if (!particle->IsShortLived())
80  {
81  G4ProcessManager* pmanager = particle->GetProcessManager();
82  pmanager->AddProcess(theParallelWorldScoringProcess);
83  pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxAtRest);
84  pmanager->SetProcessOrdering(theParallelWorldScoringProcess, idxAlongStep, 1);
85  pmanager->SetProcessOrderingToLast(theParallelWorldScoringProcess, idxPostStep);
86  }
87  }
88 }
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:79
G4ScoringProcessTool::~G4ScoringProcessTool
virtual ~G4ScoringProcessTool()
Destructor.
Definition: G4ScoringProcessTool.cxx:46
G4ScoringProcessTool::GetPhysicsOption
virtual UPPhysicsConstructor GetPhysicsOption() override final
Implements.
Definition: G4ScoringProcessTool.cxx:60
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
G4ScoringProcessTool::initialize
virtual StatusCode initialize() override final
Initialize method.
Definition: G4ScoringProcessTool.cxx:54
G4ScoringProcessTool::G4ScoringProcessTool
G4ScoringProcessTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: G4ScoringProcessTool.cxx:35
G4ScoringProcessTool::PhysicsConstructor::ConstructProcess
virtual void ConstructProcess() override
Definition: G4ScoringProcessTool.cxx:67
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
G4AtlasPhysicsOption::GlobalProcesses
@ GlobalProcesses
Definition: IPhysicsOptionTool.h:26
PARTICLEITERATOR
#define PARTICLEITERATOR
Definition: G4ScoringProcessTool.cxx:29
G4ScoringProcessTool.h
G4ScoringProcessTool::PhysicsConstructor::ConstructParticle
virtual void ConstructParticle() override
Definition: G4ScoringProcessTool.cxx:65