Skip to content

Commit

Permalink
* add 10 files unmodified from the geant4-v10.7.4 source tree to G4fixes
Browse files Browse the repository at this point in the history
  without modification, because they are in the dependency list of this
  one class G4VDivisionParameterisation that I needed to split to make
  it thread-safe. [rtj]
  • Loading branch information
Richard T. Jones committed Nov 29, 2023
1 parent 117c6dd commit 964e259
Show file tree
Hide file tree
Showing 10 changed files with 4,853 additions and 0 deletions.
571 changes: 571 additions & 0 deletions src/G4.10.07.p04fixes/G4PVDivision.cc

Large diffs are not rendered by default.

157 changes: 157 additions & 0 deletions src/G4.10.07.p04fixes/G4PVDivisionFactory.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4PVDivisionFactory Implementation file
//
// Author: Ivana Hrivnacova, 04.05.2004 ([email protected])
// --------------------------------------------------------------------

#include "G4PVDivisionFactory.hh"
#include "G4PVDivision.hh"
#include "G4VDivisionParameterisation.hh"

//_____________________________________________________________________________

G4PVDivisionFactory::G4PVDivisionFactory()
: G4VPVDivisionFactory()
{
// Protected singleton constructor.
// ---
}

//_____________________________________________________________________________

G4PVDivisionFactory::~G4PVDivisionFactory()
{
}

//_____________________________________________________________________________

G4PVDivisionFactory* G4PVDivisionFactory::GetInstance()
{
if (fgInstance == nullptr)
{
fgInstance = new G4PVDivisionFactory;
}
return dynamic_cast<G4PVDivisionFactory*>(fgInstance);
}

//_____________________________________________________________________________

G4VPhysicalVolume*
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4int nReplicas,
const G4double width,
const G4double offset )
{
// Create division - with number of divisions and width
// ---

return new G4PVDivision(pName, pLogical, pMotherLogical,
pAxis, nReplicas, width, offset);
}

//_____________________________________________________________________________

G4VPhysicalVolume*
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4int nReplicas,
const G4double offset )
{
// Create division - with number of divisions
// ---

return new G4PVDivision(pName, pLogical, pMotherLogical,
pAxis, nReplicas, offset);
}

//_____________________________________________________________________________

G4VPhysicalVolume*
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4double width,
const G4double offset )
{
// Create division - with width
// ---

return new G4PVDivision(pName, pLogical, pMotherLogical,
pAxis, width, offset);
}

//_____________________________________________________________________________

G4VPhysicalVolume*
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const G4VPVParameterisation* param)
{
// Create division - with parameterisation
// ---

// Get parameterisation data
//
const G4VDivisionParameterisation* divParam
= dynamic_cast<const G4VDivisionParameterisation*>(param);

if (divParam == nullptr)
{
G4Exception("G4PVDivisionFactory::CreatePVDivision()",
"GeomDiv0001", FatalException,
"Unexpected parameterisation type!");
return nullptr;
}
else
{
EAxis axis = divParam->GetAxis();
G4int nofDivisions = divParam->GetNoDiv();
G4double width = divParam->GetWidth();
G4double offset = divParam->GetOffset();

return new G4PVDivision(pName, pLogical, pMotherLogical,
axis, nofDivisions, width, offset);
}
}

//_____________________________________________________________________________

G4bool G4PVDivisionFactory::IsPVDivision(const G4VPhysicalVolume* pv) const
{
// Returns true if pv is division
// ---

return (dynamic_cast<const G4PVDivision*>(pv) != nullptr) ? true : false;
}

Loading

0 comments on commit 964e259

Please sign in to comment.