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

Add isTestBeam property to LArBarrelPresamplerGeometry

Whether we are running a test-beam job or not should be known at
configuration time, so it is much more efficient to set a configurable
property at this point rather than checking whether we are using
a test beam geometry *every single step* in the pre-sampler. Part of
the changes for ATLASSIM-2643. (Does not change the output in my local tests.)


Former-commit-id: ffc9ec29d05010b853bca289ddb799d2e448ed46
parent 21716d97
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,7 @@ namespace LArG4 {
: base_class(name, pSvcLocator)
{
declareProperty("DetectorName",m_detectorName);
declareProperty("TestBeam", m_testbeam);
}
//=====================================================================================
......@@ -125,7 +126,6 @@ namespace LArG4 {
const G4NavigationHistory* g4navigation = a_step->GetPreStepPoint()->GetTouchable()->GetHistory();
const G4int ndep = g4navigation->GetDepth();
bool iactive(false);
bool isTestBeam(false);
G4int idep(-999);
/** Now navigate through the volumes hierarchy */
......@@ -133,16 +133,15 @@ namespace LArG4 {
// FIXME Need to find a way to avoid these string-comparisons
const G4String& vname = g4navigation->GetVolume(ii)->GetName();
if (idep<0 && vname==fullPSName) idep=ii; // half barrel
else if (!isTestBeam && vname==fullCryoName) isTestBeam=true; // TB or not ?
else if (!iactive && vname==fullModuleName) iactive=true;
}
if (idep < 0) std::abort();
if ( iactive ) {
return this->CalculatePSActiveIdentifier( a_step , idep , isTestBeam );
return this->CalculatePSActiveIdentifier( a_step , idep );
}
return this->CalculatePS_DMIdentifier( a_step , idep , isTestBeam);
return this->CalculatePS_DMIdentifier( a_step , idep );
}
// ==========================================================================================
......@@ -151,7 +150,7 @@ namespace LArG4 {
used for calibration hit even if the hit is not really in the
"fiducial" active part */
LArG4Identifier Geometry::CalculatePSActiveIdentifier(const G4Step* a_step, const G4int ind, const bool isTestBeam) const
LArG4Identifier Geometry::CalculatePSActiveIdentifier(const G4Step* a_step, const G4int ind) const
{
LArG4Identifier PSActiveID = LArG4Identifier();
......@@ -167,7 +166,7 @@ namespace LArG4 {
const G4NavigationHistory* g4navigation = a_step->GetPreStepPoint()->GetTouchable()->GetHistory();
const G4ThreeVector ploc = g4navigation->GetTransform(ind).TransformPoint(p);
const G4int zSide(this->determineZSide(isTestBeam, p.z()));
const G4int zSide(this->determineZSide(p.z()));
CalcData currentCellData;
(void)this->findCell(currentCellData,ploc.x(),ploc.y(),ploc.z());
......@@ -202,7 +201,7 @@ namespace LArG4 {
//==========================================================================================
LArG4Identifier Geometry::CalculatePS_DMIdentifier(const G4Step* a_step, const G4int ind, const bool isTestBeam) const
LArG4Identifier Geometry::CalculatePS_DMIdentifier(const G4Step* a_step, const G4int ind) const
{
/******************************************************************************
......@@ -249,7 +248,7 @@ namespace LArG4 {
#endif
// 01-Feb-2001 WGS: Add zSide calculation.
const G4int zSide(this->determineZSide(isTestBeam, p.z()));
const G4int zSide(this->determineZSide(p.z()));
/** eta,phi in "local" half barrel coordinates */
const G4double phi = (ploc2.phi() < 0.) ? ploc2.phi()+2.*M_PI : ploc2.phi();
......
......@@ -39,13 +39,13 @@ namespace LArG4 {
virtual bool findCell(CalcData & currentCellData, G4double xloc,G4double yloc,G4double zloc) const override final;
private:
LArG4Identifier CalculatePSActiveIdentifier( const G4Step* , const G4int indPS , const bool itb ) const;
LArG4Identifier CalculatePS_DMIdentifier( const G4Step* , const G4int indPS , const bool itb) const;
LArG4Identifier CalculatePSActiveIdentifier( const G4Step* , const G4int indPS ) const;
LArG4Identifier CalculatePS_DMIdentifier( const G4Step* , const G4int indPS ) const;
inline G4int determineZSide(const bool isTestBeam, const double zCoord) const {
inline G4int determineZSide(const double zCoord) const {
// in TB case, only 1 side,
// in Atlas case, use overall z to decide side
if (isTestBeam) { return 1; }
if (m_testbeam) { return 1; }
if (zCoord > 0.) { return 1; }
return -1;
}
......@@ -72,7 +72,8 @@ namespace LArG4 {
G4int m_ncell_module[8]{};
// total LAr thickness
G4double m_halfThickLAr{0.5*13.*Athena::Units::mm}; // LAr total gap
// is this a test beam simulation job
bool m_testbeam{false};
} ;
......
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