ATLAS Offline Software
Functions
G4LegacyTransportTool.cxx File Reference
#include "G4LegacyTransportTool.h"
#include "AthenaKernel/RNGWrapper.h"
#include "CxxUtils/checker_macros.h"
#include "G4AtlasAlg/G4AtlasRunManager.h"
#include "G4AtlasTools/G4AtlasActionInitialization.h"
#include "ISFFluxRecorder.h"
#include "ISF_Event/ISFParticle.h"
#include "ISF_Event/ISFParticleContainer.h"
#include "AtlasDetDescr/AtlasRegionHelper.h"
#include "GeneratorObjects/McEventCollection.h"
#include "HitManagement/HitCollectionMap.h"
#include "MCTruth/AtlasG4EventUserInfo.h"
#include "MCTruth/PrimaryParticleInformation.h"
#include "AtlasHepMC/GenParticle.h"
#include "G4ChargedGeantino.hh"
#include "G4Event.hh"
#include "G4Geantino.hh"
#include "G4LorentzVector.hh"
#include "G4ParallelWorldPhysics.hh"
#include "G4ParticleTable.hh"
#include "G4PrimaryParticle.hh"
#include "G4PrimaryVertex.hh"
#include "G4SDManager.hh"
#include "G4ScoringManager.hh"
#include "G4StateManager.hh"
#include "G4Timer.hh"
#include "G4Trajectory.hh"
#include "G4TransportationManager.hh"
#include "G4UImanager.hh"
#include "G4VModularPhysicsList.hh"
#include "G4VUserPhysicsList.hh"
#include <memory>
#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

getCoefficientMap(label, EigenIdxList)

input value:

  1. label: falvor label in std::string format, could be one of B, C, T, Light
  2. EigenIdxList is user defined vector containing all eigenvector index that user interested in. output: Map of format map<string, map<string, float>> containing decomposition coefficient of the list of eigenvectors defined by EigenIdxList.

getCoefficients(label, evIdx)

input value:

  1. label: falvor label in std::string format, could be one of B, C, T, Light
  2. evIdx: The index of eigenvector user interested in. output value: vector of coefficient values. The order is the same as output given by getListOfOriginalNuisanceParameters()

getListOfOriginalNuisanceParameters(label)

input value:

  1. label: falvor label in std::string format, could be one of B, C, T, Light output value: List of original nuisance parameter names.

getNumEigenVectors(label)

input value:

  1. label: falvor label in std::string format, could be one of B, C, T, Light return value: number of eigen vectors used for chosen label. Return 0 if error occured.

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  ATH_MSG_INFO( "retireving the Detector Construction tool" );
121  if(m_detConstruction.retrieve().isFailure()) {
122  throw std::runtime_error("Could not initialize ATLAS DetectorConstruction!");
123  }
124 
125  m_pRunMgr->SetRecordFlux( m_recordFlux, std::make_unique<ISFFluxRecorder>() );
126  m_pRunMgr->SetLogLevel( int(msg().level()) ); // Synch log levels
127  m_pRunMgr->SetDetConstructionTool( m_detConstruction.get() );
128  m_pRunMgr->SetPhysListSvc(m_physListSvc.typeAndName() );
129  m_pRunMgr->SetQuietMode( m_quietMode );
130  std::unique_ptr<G4AtlasActionInitialization> actionInitialization =
131  std::make_unique<G4AtlasActionInitialization>(&*m_userActionSvc);
132  m_pRunMgr->SetUserInitialization(actionInitialization.release());
133 
134  G4UImanager *ui = G4UImanager::GetUIpointer();
135 
136  if (!m_libList.empty()) {
137  ATH_MSG_INFO("G4AtlasAlg specific libraries requested ") ;
138  std::string temp="/load "+m_libList;
139  ui->ApplyCommand(temp);
140  }
141 
142  if (!m_physList.empty()) {
143  ATH_MSG_INFO("requesting a specific physics list "<< m_physList) ;
144  std::string temp="/Physics/GetPhysicsList "+m_physList;
145  ui->ApplyCommand(temp);
146  }
147 
148  if (!m_fieldMap.empty()) {
149  ATH_MSG_INFO("requesting a specific field map "<< m_fieldMap) ;
150  ATH_MSG_INFO("the field is initialized straight away") ;
151  std::string temp="/MagneticField/Select "+m_fieldMap;
152  ui->ApplyCommand(temp);
153  ui->ApplyCommand("/MagneticField/Initialize");
154  }
155 
156  // Send UI commands
157  ATH_MSG_DEBUG("G4 Command: Trying at the end of initializeOnce()");
158  for (const auto& g4command : m_g4commands) {
159  int returnCode = ui->ApplyCommand( g4command );
160  commandLog(returnCode, g4command);
161  }
162 
163  // Code from G4AtlasSvc
164  auto* rm = G4RunManager::GetRunManager();
165  if(!rm) {
166  throw std::runtime_error("Run manager retrieval has failed");
167  }
168  rm->Initialize(); // Initialization differs slightly in multi-threading.
169  // TODO: add more details about why this is here.
170  if(!m_useMT && rm->ConfirmBeamOnCondition()) {
171  rm->RunInitialization();
172  }
173 
174  ATH_MSG_INFO("Initializing " << m_physicsInitializationTools.size() << " physics initialization tools");
175  for(auto& physicsTool : m_physicsInitializationTools) {
176  if (physicsTool->initializePhysics().isFailure()) {
177  throw std::runtime_error("Failed to initialize physics with tool " + physicsTool.name());
178  }
179  }
180 
181  if(m_userLimitsSvc.retrieve().isFailure()) {
182  throw std::runtime_error("Could not initialize ATLAS UserLimitsSvc!");
183  }
184 
185  if (m_activateParallelGeometries) {
186  G4VModularPhysicsList* thePhysicsList=dynamic_cast<G4VModularPhysicsList*>(m_physListSvc->GetPhysicsList());
187  if (!thePhysicsList) {
188  throw std::runtime_error("Failed dynamic_cast!! this is not a G4VModularPhysicsList!");
189  }
190 #if G4VERSION_NUMBER >= 1010
191  std::vector<std::string>& parallelWorldNames=m_detConstruction->GetParallelWorldNames();
192  for (auto& it: parallelWorldNames) {
193  thePhysicsList->RegisterPhysics(new G4ParallelWorldPhysics(it,true));
194  }
195 #endif
196  }
197 
198  return;
199 }
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
skel.it
it
Definition: skel.GENtoEVGEN.py:407
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7