Skip to content
Snippets Groups Projects
Commit 673780d7 authored by John Chapman's avatar John Chapman
Browse files

Remove short-lived heap allocations of strings in LArG4Barrel

As mentioned in	ATLASSIM-2643, lines using char* literals cause	short-lived
heap-allocations, harming simulation performance. This merge request aims
to mitigate this by making the strings in question static const.


Former-commit-id: 9680dee1dc3df5ad5ad7958a1fda116ddf76d85f
parent 499b1f50
No related branches found
No related tags found
No related merge requests found
......@@ -149,24 +149,19 @@ G4bool LArBarrelPresamplerCalculator::Process(const G4Step* a_step, std::vector<
bool testbeam=false;
if(m_detectorName=="")
for (G4int ii=0;ii<=ndep;ii++) {
G4VPhysicalVolume* v1 = g4navigation->GetVolume(ii);
// FIXME More efficient to find the comparison volume once and compare pointers?
if (v1->GetName()=="LAr::Barrel::Presampler") idep=ii; // half barrel
// FIXME Why are we checking if the geo is test beam every step?
if (v1->GetName()=="LAr::TBBarrel::Cryostat::LAr") testbeam=true; // TB or not ?
}
else
const G4String presamplerName((m_detectorName.empty()) ? "LAr::Barrel::Presampler" :
m_detectorName+"::LAr::Barrel::Presampler");
const G4String tbCryostatName((m_detectorName.empty()) ? "LAr::TBBarrel::Cryostat::LAr" :
m_detectorName+"::LAr::TBBarrel::Cryostat::LAr");
for (G4int ii=0;ii<=ndep;ii++) {
G4VPhysicalVolume* v1 = g4navigation->GetVolume(ii);
#ifdef DEBUGSTEP
ATH_MSG_DEBUG(" Level,VolumeName " << ii << " " << v1->GetName());
#endif
// FIXME More efficient to find the comparison volume once and compare pointers?
if (v1->GetName()==G4String(m_detectorName+"::LAr::Barrel::Presampler")) idep=ii;
if (v1->GetName()==presamplerName) idep=ii;
// FIXME Why are we checking if the geo is test beam every step?
if (v1->GetName()==G4String(m_detectorName+"::LAr::TBBarrel::Cryostat::LAr")) testbeam=true; // TB or not ?
if (v1->GetName()==tbCryostatName) testbeam=true; // TB or not ?
}
#ifdef DEBUGSTEP
......
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