ATLAS Offline Software
Functions
G4LegacyTransportTool.cxx File Reference
#include "G4LegacyTransportTool.h"
#include "G4AtlasAlg/G4AtlasRunManager.h"
#include "G4AtlasAlg/G4AtlasActionInitialization.h"
#include "ISFFluxRecorder.h"
#include "AthenaKernel/RNGWrapper.h"
#include "ISF_Event/ISFParticle.h"
#include "ISF_Event/ISFParticleContainer.h"
#include "GeneratorObjects/McEventCollection.h"
#include "MCTruth/PrimaryParticleInformation.h"
#include "MCTruth/AtlasG4EventUserInfo.h"
#include "AtlasHepMC/GenParticle.h"
#include "G4LorentzVector.hh"
#include "G4PrimaryVertex.hh"
#include "G4PrimaryParticle.hh"
#include "G4Trajectory.hh"
#include "G4Geantino.hh"
#include "G4ChargedGeantino.hh"
#include "G4ParticleTable.hh"
#include "G4StateManager.hh"
#include "G4TransportationManager.hh"
#include "G4UImanager.hh"
#include "G4ScoringManager.hh"
#include "G4Timer.hh"
#include "G4SDManager.hh"
#include "G4VUserPhysicsList.hh"
#include "G4VModularPhysicsList.hh"
#include "G4ParallelWorldPhysics.hh"
#include "AtlasDetDescr/AtlasRegionHelper.h"
#include <mutex>

Go to the source code of this file.

Functions

void iGeant4::G4LegacyTransportTool::initializeOnce ATLAS_NOT_THREAD_SAFE ()
 Install fatal handler with default options. More...
 

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

void iGeant4::G4LegacyTransportTool::initializeOnce ATLAS_NOT_THREAD_SAFE ( )
inline

Install fatal handler with default options.

This is meant to be easy to call from python via ctypes.

Install fatal handler with default options.

getLorentzAngle() Read LorentzAngle from HIST and write out into local DB

getBSErrors() Read BSErrors from Monitoring HIST and write out into local DB

getEfficiency() Read Efficiency from Monitoring HIST and write out into local DB

getRawOccupancy() Read RawOccupancy from Monitoring HIST and write out into local DB

getNoiseOccupancy() Read NoiseOccupancy from HIST and write out into local DB

getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats

beginning of the loop of channels

bad bit newly found

known bad bit

for low noisy cells

for high noisy cells

0.01 is used to scale "PER" to the same order of magnitude to "SIG"

smaller deviation: distorted

checking TmaxAmp, Not mixed with MaxAmp and Width

channel information output

Only dead or distorted, or short known BCs are considered below.

index of bc

now add branches and leaves to the tree

now add branches and leaves to the tree

Definition at line 102 of file G4LegacyTransportTool.cxx.

103 {
104  // get G4AtlasRunManager
105  ATH_MSG_DEBUG("initialize G4AtlasRunManager");
106 
107  if (m_g4RunManagerHelper.retrieve().isFailure()) {
108  throw std::runtime_error("Could not initialize G4RunManagerHelper!");
109  }
110  ATH_MSG_DEBUG("retrieved "<<m_g4RunManagerHelper);
111  m_pRunMgr = m_g4RunManagerHelper ? m_g4RunManagerHelper->g4RunManager() : nullptr;
112  if (!m_pRunMgr) {
113  throw std::runtime_error("G4RunManagerHelper::g4RunManager() returned nullptr.");
114  }
115 
116  if(m_physListSvc.retrieve().isFailure()) {
117  throw std::runtime_error("Could not initialize ATLAS PhysicsListSvc!");
118  }
119  m_physListSvc->SetPhysicsList();
120 
121  m_pRunMgr->SetRecordFlux( m_recordFlux, std::make_unique<ISFFluxRecorder>() );
122  m_pRunMgr->SetLogLevel( int(msg().level()) ); // Synch log levels
123  m_pRunMgr->SetDetGeoSvc( m_detGeoSvc.typeAndName() );
124  m_pRunMgr->SetFastSimMasterTool(m_fastSimTool.typeAndName() );
125  m_pRunMgr->SetPhysListSvc(m_physListSvc.typeAndName() );
126  std::unique_ptr<G4AtlasActionInitialization> actionInitialization =
127  std::make_unique<G4AtlasActionInitialization>(&*m_userActionSvc);
128  m_pRunMgr->SetUserInitialization(actionInitialization.release());
129 
130  G4UImanager *ui = G4UImanager::GetUIpointer();
131 
132  if (!m_libList.empty()) {
133  ATH_MSG_INFO("G4AtlasAlg specific libraries requested ") ;
134  std::string temp="/load "+m_libList;
135  ui->ApplyCommand(temp);
136  }
137 
138  if (!m_physList.empty()) {
139  ATH_MSG_INFO("requesting a specific physics list "<< m_physList) ;
140  std::string temp="/Physics/GetPhysicsList "+m_physList;
141  ui->ApplyCommand(temp);
142  }
143 
144  if (!m_fieldMap.empty()) {
145  ATH_MSG_INFO("requesting a specific field map "<< m_fieldMap) ;
146  ATH_MSG_INFO("the field is initialized straight away") ;
147  std::string temp="/MagneticField/Select "+m_fieldMap;
148  ui->ApplyCommand(temp);
149  ui->ApplyCommand("/MagneticField/Initialize");
150  }
151 
152  // Send UI commands
153  ATH_MSG_DEBUG("G4 Command: Trying at the end of initializeOnce()");
154  for (const auto& g4command : m_g4commands) {
155  int returnCode = ui->ApplyCommand( g4command );
156  commandLog(returnCode, g4command);
157  }
158 
159  // Code from G4AtlasSvc
160  auto* rm = G4RunManager::GetRunManager();
161  if(!rm) {
162  throw std::runtime_error("Run manager retrieval has failed");
163  }
164  rm->Initialize(); // Initialization differs slightly in multi-threading.
165  // TODO: add more details about why this is here.
166  if(!m_useMT && rm->ConfirmBeamOnCondition()) {
167  rm->RunInitialization();
168  }
169 
170  ATH_MSG_INFO( "retireving the Detector Geometry Service" );
171  if(m_detGeoSvc.retrieve().isFailure()) {
172  throw std::runtime_error("Could not initialize ATLAS DetectorGeometrySvc!");
173  }
174 
175  if(m_userLimitsSvc.retrieve().isFailure()) {
176  throw std::runtime_error("Could not initialize ATLAS UserLimitsSvc!");
177  }
178 
179  if (m_activateParallelGeometries) {
180  G4VModularPhysicsList* thePhysicsList=dynamic_cast<G4VModularPhysicsList*>(m_physListSvc->GetPhysicsList());
181  if (!thePhysicsList) {
182  throw std::runtime_error("Failed dynamic_cast!! this is not a G4VModularPhysicsList!");
183  }
184 #if G4VERSION_NUMBER >= 1010
185  std::vector<std::string>& parallelWorldNames=m_detGeoSvc->GetParallelWorldNames();
186  for (auto& it: parallelWorldNames) {
187  thePhysicsList->RegisterPhysics(new G4ParallelWorldPhysics(it,true));
188  }
189 #endif
190  }
191 
192  return;
193 }
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
skel.it
it
Definition: skel.GENtoEVGEN.py:423
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CI_EMPFlowData22test.returnCode
returnCode
Definition: CI_EMPFlowData22test.py:16
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7