ATLAS Offline Software
FastSimulationMasterTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Base class
7 
8 // For the process setup
9 #include "G4ParticleTable.hh"
10 #include "G4FastSimulationManagerProcess.hh"
11 #include "G4ProcessManager.hh"
12 
13 FastSimulationMasterTool::FastSimulationMasterTool(const std::string& type, const std::string& name, const IInterface* parent)
14  : base_class(type,name,parent)
15 {
16 }
17 
19  ATH_MSG_VERBOSE( name() << "::initializeFastSims()" );
20  // Loop through list of fast simulations and retrieve them
21  // This forces a call to initialize() for each of them
22  ATH_MSG_INFO( "Initializing list of " << m_FastSimList.size() << " fast simulation tools in " << name() );
23  CHECK( m_FastSimList.retrieve() );
24 
25  // Initialize the SDs
26  for (auto& ifs : m_FastSimList){
27  CHECK(ifs->initializeFastSim());
28  }
29 
30  // If we added a fast simulation, then we will need to add the process to the particles
31  if ( m_FastSimList.size() > 0 ){
32  G4FastSimulationManagerProcess* fastSimManagerProcess = new G4FastSimulationManagerProcess();
33  G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
34  G4ParticleTable::G4PTblDicIterator* theParticleIterator = theParticleTable->GetIterator();
35 
36  theParticleIterator->reset();
37  while( (*theParticleIterator)() ){
38  G4ProcessManager* pmanager = theParticleIterator->value()->GetProcessManager();
39  pmanager->AddProcess(fastSimManagerProcess, -1, 1, 1);
40  } // Done with loop over particles
41  } // Done with process assignment
42 
43  return StatusCode::SUCCESS;
44 }
45 
46 
48  // Method that gets called at the beginning of every *athena* event
49  for (auto& ifs : m_FastSimList){
50  CHECK(ifs->BeginOfAthenaEvent());
51  }
52  return StatusCode::SUCCESS;
53 }
54 
56  // Method that gets called at the end of every *athena* event
57  for (auto& ifs : m_FastSimList){
58  CHECK(ifs->EndOfAthenaEvent());
59  }
60  return StatusCode::SUCCESS;
61 }
FastSimulationMasterTool::initializeFastSims
StatusCode initializeFastSims() override final
Definition: FastSimulationMasterTool.cxx:18
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FastSimulationMasterTool::EndOfAthenaEvent
StatusCode EndOfAthenaEvent() override final
!< Base class method that calls BeginOfAthenaEvent for all fast simulation models.
Definition: FastSimulationMasterTool.cxx:55
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
FastSimulationMasterTool::BeginOfAthenaEvent
StatusCode BeginOfAthenaEvent() override final
!< Base class method to initialize all the fast simulation models
Definition: FastSimulationMasterTool.cxx:47
FastSimulationMasterTool.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FastSimulationMasterTool::m_FastSimList
ToolHandleArray< IFastSimulation > m_FastSimList
!< Base class method that calls EndOfAthenaEvent for all fast simulation models.
Definition: FastSimulationMasterTool.h:28
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
FastSimulationMasterTool::FastSimulationMasterTool
FastSimulationMasterTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: FastSimulationMasterTool.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78