G4PVDivisionFactory.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4PVDivisionFactory.cc 69784 2013-05-15 09:16:06Z gcosmo $
00028 //
00029 // class G4PVDivisionFactory Implementation file
00030 //
00031 // Author: Ivana Hrivnacova, 4.5.2004  (Ivana.Hrivnacova@cern.ch)
00032 // --------------------------------------------------------------------
00033 
00034 #include "G4PVDivisionFactory.hh"
00035 #include "G4PVDivision.hh"
00036 #include "G4VDivisionParameterisation.hh"
00037 
00038 //_____________________________________________________________________________
00039 
00040 G4PVDivisionFactory::G4PVDivisionFactory()
00041   : G4VPVDivisionFactory()
00042 {
00043   // Protected singleton constructor.
00044   // ---
00045 }
00046 
00047 //_____________________________________________________________________________
00048 
00049 G4PVDivisionFactory::~G4PVDivisionFactory()
00050 {
00051 }
00052 
00053 //_____________________________________________________________________________
00054 
00055 G4PVDivisionFactory* G4PVDivisionFactory::GetInstance()
00056 {
00057   static G4PVDivisionFactory * theFactory = new G4PVDivisionFactory;
00058   if (!fgInstance)
00059   {
00060     fgInstance = theFactory;
00061   }
00062   return theFactory;
00063 } 
00064 
00065 //_____________________________________________________________________________
00066 
00067 G4VPhysicalVolume* 
00068 G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
00069                              G4LogicalVolume* pLogical,
00070                              G4LogicalVolume* pMotherLogical,
00071                              const EAxis pAxis,
00072                              const G4int nReplicas,
00073                              const G4double width,
00074                              const G4double offset )
00075 {     
00076   // Create division - with number of divisions and width
00077   // ---
00078 
00079   return new G4PVDivision(pName, pLogical, pMotherLogical, 
00080                           pAxis, nReplicas, width, offset);
00081 }    
00082 
00083 //_____________________________________________________________________________
00084 
00085 G4VPhysicalVolume* 
00086 G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
00087                              G4LogicalVolume* pLogical,
00088                              G4LogicalVolume* pMotherLogical,
00089                              const EAxis pAxis,
00090                              const G4int nReplicas,
00091                              const G4double offset )
00092 {     
00093   // Create division - with number of divisions 
00094   // ---
00095 
00096   return new G4PVDivision(pName, pLogical, pMotherLogical, 
00097                           pAxis, nReplicas, offset);
00098 }    
00099 
00100 //_____________________________________________________________________________
00101 
00102 G4VPhysicalVolume* 
00103 G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
00104                              G4LogicalVolume* pLogical,
00105                              G4LogicalVolume* pMotherLogical,
00106                              const EAxis pAxis,
00107                              const G4double width,
00108                              const G4double offset )
00109 {     
00110   // Create division - with width
00111   // ---
00112 
00113   return new G4PVDivision(pName, pLogical, pMotherLogical, 
00114                           pAxis, width, offset);
00115 }    
00116 
00117 //_____________________________________________________________________________
00118 
00119 G4VPhysicalVolume* 
00120 G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
00121                              G4LogicalVolume* pLogical,
00122                              G4LogicalVolume* pMotherLogical,
00123                              const G4VPVParameterisation* param)
00124 {     
00125   // Create division - with parameterisation
00126   // ---
00127 
00128   // Get parameterisation data
00129   //
00130   const G4VDivisionParameterisation* divParam
00131     = dynamic_cast<const G4VDivisionParameterisation*>(param);
00132 
00133   if (!divParam)
00134   {
00135     G4Exception("G4PVDivisionFactory::CreatePVDivision()",
00136                 "GeomDiv0001", FatalException,
00137                 "Unexpected parameterisation type!");
00138     return 0;
00139   }
00140   else
00141   {
00142     EAxis axis = divParam->GetAxis();
00143     G4int nofDivisions = divParam->GetNoDiv();
00144     G4double width = divParam->GetWidth();
00145     G4double offset = divParam->GetOffset();
00146 
00147     return new G4PVDivision(pName, pLogical, pMotherLogical, 
00148                             axis, nofDivisions, width, offset);
00149   }
00150 }    
00151 
00152 //_____________________________________________________________________________
00153 
00154 G4bool G4PVDivisionFactory::IsPVDivision(const G4VPhysicalVolume* pv) const
00155 { 
00156   // Returns true if pv is division
00157   // ---
00158 
00159   if (dynamic_cast<const G4PVDivision*>(pv))
00160     return true;
00161   else
00162     return false;  
00163 }
00164 

Generated on Mon May 27 17:49:30 2013 for Geant4 by  doxygen 1.4.7