Import Geant4 0.0.0 source tree
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for persistency. Youhei Morita, 16/06/98.
|
||||
# --------------------------------------------------------------
|
||||
# object files are compiled from DDL files as well as from CC files
|
||||
#
|
||||
# include/*.ddl --> $(G4SYSTEM)/*.hh
|
||||
# $(G4SYSTEM)/*_ref.hh
|
||||
# $(G4SYSTEM)/*_ddl.cc --> $(G4SYSTEM)/*_ddl.o
|
||||
# (schema) -------> $(G4EXAMPLE_BOOT)
|
||||
# src/*.cc --------------------------------> $(G4SYSTEM)/*.o
|
||||
#
|
||||
# You must have unique G4EXAMPLE_FDID assigned by your local
|
||||
# manager of Objectivity/DB lock server.
|
||||
#
|
||||
# G4EXAMPLE_BOOT is defined as $HOME/G4EXAMPLE by default.
|
||||
|
||||
name := G4persistency
|
||||
G4ODBMS := true
|
||||
|
||||
SUBDIRS = events run geometry/management geometry/solids/CSG \
|
||||
geometry/volumes management
|
||||
SUBLIBS = G4pevents G4prun G4pgeomn G4pcsg G4pvol G4pmanagement
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../..
|
||||
endif
|
||||
include $(G4INSTALL)/config/globlib.gmk
|
||||
|
||||
# --------------------------------------------------------------
|
||||
|
||||
.PHONY : all global clean clean_libs cleandb
|
||||
|
||||
# override the target all, and warn if G4ODBMS flag is not defined.
|
||||
ifndef G4ODBMS
|
||||
all:
|
||||
@echo Error - Persistency requires G4ODBMS and related database setup.
|
||||
exit 1
|
||||
endif
|
||||
|
||||
cleandb:
|
||||
ifndef G4EXAMPLE_FDID
|
||||
@echo G4EXAMPLE_FDID is not defined. Stop.
|
||||
exit 1
|
||||
endif
|
||||
@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) clean); done
|
||||
@rm -f $(G4EXAMPLE_BOOT_DIR)/G4EXAMPLE
|
||||
@rm -f $(G4EXAMPLE_BOOT_DIR)/G4EXAMPLE.FDDB
|
||||
@rm -f $(G4EXAMPLE_BOOT_DIR)/*.G4EXAMPLE.DB
|
||||
@echo Copying schema file to $(G4EXAMPLE_BOOT) for FDID $(G4EXAMPLE_FDID)
|
||||
@$(HEP_ODBMS_DIR)/etc/getdb $(HEP_ODBMS_DIR)/schema/HEP_BASE \
|
||||
$(G4EXAMPLE_BOOT) $(G4EXAMPLE_FDID)
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
November 15, 98 Y.Morita (persistency-00-03-03)
|
||||
- Fix bug in G4PVPhysicalVolume.cc
|
||||
|
||||
November 10, 98 Y.Morita (persistency-00-03-02)
|
||||
- G4PersistentGeomMan now handle Replica geometry
|
||||
|
||||
November 10, 98 Y.Morita (persistency-00-03-01)
|
||||
- G4PersistencyManager splitted into G4PersistentEventMan,
|
||||
G4PersistentGeomMan, G4PersistentRunMan
|
||||
- G4Run is now persistent
|
||||
|
||||
July 23, 98 Y.Morita (persistency-00-01-09)
|
||||
- G4PVPhysicalVolume: protect declare of d_Double with
|
||||
OO_VARRAY_D_DOUBLE for different version of HepODBMS
|
||||
- G4PVPhysicalVolume: added G4Exception for restoring rotation matrix
|
||||
(for now)
|
||||
|
||||
July 15, 98 Y.Morita (persistency-00-01-08)
|
||||
- revised "cleandb" target in GNUmakefile
|
||||
- g4odbms_setup.csh cosmetics
|
||||
|
||||
July 15, 98 Y.Morita (persistency-00-01-07)
|
||||
- absorb oodlx compiler differences on CERN AIX-AFS
|
||||
|
||||
July 14, 98 Y.Morita (persistency-00-01-06)
|
||||
- Bug fix on store geometry
|
||||
- added G4ODBMS := true to GNUmakefile
|
||||
|
||||
July 11, 98 Y.Morita (persistency-00-01-05)
|
||||
- script clean up for test/g4odbms_setup.csh
|
||||
|
||||
July 10, 98 Y.Morita (persistency-00-01-04)
|
||||
- updated test/GNUmakefile
|
||||
- fixed a bug in G4PersistencyManager
|
||||
- digits+hits/hits added
|
||||
|
||||
July 10, 98 Y.Morita (persistency-00-01-03)
|
||||
- moved GNUmakefile targes 'headers' and 'd_files' to common.gmk and
|
||||
globlib.gmk.
|
||||
- a few bug fix in G4PPVPlacement.cc, G4PVSolid.cc,
|
||||
G4PGeometryObjectMap.ddl, G4PersistencyManager.hh,
|
||||
G4PGeometryObjectMap.cc, G4PersistencyManager.cc
|
||||
|
||||
July 9, 98 Y.Morita
|
||||
- new GNUmakefile for pre-beta01 (persistency-00-01-02)
|
||||
|
||||
July 8, 98 Y.Morita
|
||||
- debug physics volume and logical volume (persistency-00-01-01)
|
||||
|
||||
June 30, 98 Y.Morita
|
||||
- added geometry persistency: (persistency-00-07-01)
|
||||
|
||||
June 15, 98 Y.Morita
|
||||
- made new subcategories: digits+hits, geometry, events, management, run
|
||||
|
||||
June 11, 98 Y.Morita (persistency-00-06-01)
|
||||
- G4PersistencyManager uses HepDbApplication rather than inherit
|
||||
- Tagged.
|
||||
|
||||
April 21, 98 G.Cosmo (persistency-00-05-01)
|
||||
- Tagged.
|
||||
|
||||
March 24, 98 G.Barrand
|
||||
- GNUmakefile : MAKESHLIB changed in G4MAKESHLIB
|
||||
|
||||
March 24, 98 G.Barrand
|
||||
- Creation of this file.
|
||||
@@ -0,0 +1,33 @@
|
||||
# $Id: GNUmakefile,v 1.2 1998/07/14 14:26:34 morita Exp $
|
||||
|
||||
name := G4phits
|
||||
G4ODBMS := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../../..
|
||||
endif
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
# $(G4TMPDIR) will be overriden in common.gmk later.
|
||||
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
|
||||
|
||||
CPPFLAGS += \
|
||||
-Iinclude \
|
||||
-I$(G4TMPDIR) \
|
||||
-I$(G4INSTALL)/source/persistency/management/include \
|
||||
-I$(G4INSTALL)/source/run/include \
|
||||
-I$(G4INSTALL)/source/global/management/include \
|
||||
-I$(G4INSTALL)/source/digits+hits/hits/include \
|
||||
-I$(G4INSTALL)/source/graphics_reps/include
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
include $(G4INSTALL)/config/G4ODBMS_BUILD.gmk
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Explicit header file dependencies:
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PHCofThisEvent.ddl,v 1.2 1998/07/12 03:01:09 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4HCofThisEvent_h
|
||||
#define G4HCofThisEvent_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4VHitsCollection.hh"
|
||||
#include <rw/tpordvec.h>
|
||||
|
||||
class G4HCofThisEvent
|
||||
{
|
||||
public:
|
||||
G4HCofThisEvent();
|
||||
G4HCofThisEvent(G4int cap);
|
||||
~G4HCofThisEvent();
|
||||
inline void *operator new(size_t);
|
||||
inline void operator delete(void* anHCoTE);
|
||||
|
||||
void AddHitsCollection(G4int HCID,G4VHitsCollection * aHC);
|
||||
|
||||
private:
|
||||
RWTPtrOrderedVector<G4VHitsCollection> * HC;
|
||||
|
||||
public:
|
||||
inline G4VHitsCollection* GetHC(G4int i)
|
||||
{ return (*HC)[i]; }
|
||||
inline G4int GetCapacity()
|
||||
{
|
||||
return HC->entries();
|
||||
}
|
||||
inline G4int GetNumberOfCollections()
|
||||
{
|
||||
G4int n = 0;
|
||||
for(int i=0;i<HC->entries();i++)
|
||||
{
|
||||
if(!(*HC)[i]) n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
extern G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
|
||||
|
||||
inline void* G4HCofThisEvent::operator new(size_t)
|
||||
{
|
||||
void* anHCoTH;
|
||||
anHCoTH = (void*)anHCoTHAllocator.MallocSingle();
|
||||
return anHCoTH;
|
||||
}
|
||||
|
||||
inline void G4HCofThisEvent::operator delete(void* anHCoTH)
|
||||
{
|
||||
anHCoTHAllocator.FreeSingle((G4HCofThisEvent*)anHCoTH);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PVHit.ddl,v 1.2 1998/07/12 03:01:10 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// Takashi.Sasaki@kek.jp
|
||||
|
||||
#ifndef G4PVHit_h
|
||||
#define G4PVHit_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
|
||||
class G4VHit;
|
||||
|
||||
class G4PVHit : public HepPersObj
|
||||
{
|
||||
|
||||
public:
|
||||
G4PVHit();
|
||||
virtual ~G4PVHit();
|
||||
int operator==(const G4PVHit &right) const
|
||||
{
|
||||
return (this==&right) ? true : false;
|
||||
};
|
||||
|
||||
virtual G4VHit* MakeTransientObject()=0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PVHitsCollection.ddl,v 1.2 1998/07/12 03:01:11 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4VHitsCollection_h
|
||||
#define G4VHitsCollection_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4VHitsCollection
|
||||
{
|
||||
public:
|
||||
G4VHitsCollection();
|
||||
G4VHitsCollection(G4String detName,G4String colNam);
|
||||
virtual ~G4VHitsCollection();
|
||||
int operator==(const G4VHitsCollection &right) const;
|
||||
|
||||
virtual void DrawAllHits();
|
||||
virtual void PrintAllHits();
|
||||
|
||||
protected:
|
||||
|
||||
// Collection name
|
||||
G4String collectionName;
|
||||
G4String SDname;
|
||||
|
||||
public:
|
||||
inline G4String GetName()
|
||||
{ return collectionName; }
|
||||
inline G4String GetSDname()
|
||||
{ return SDname; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PVHit.cc,v 1.2 1998/07/12 03:01:12 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// Takashi.Sasaki@kek.jp
|
||||
|
||||
#include "G4PVHit.hh"
|
||||
|
||||
#include "G4VHit.hh"
|
||||
|
||||
G4PVHit::G4PVHit()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# $Id: GNUmakefile,v 2.5 1998/11/09 17:04:51 morita Exp $
|
||||
|
||||
name := G4pevents
|
||||
G4ODBMS := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
# $(G4TMPDIR) will be overrided in common.gmk later.
|
||||
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
|
||||
|
||||
CPPFLAGS += \
|
||||
-Iinclude \
|
||||
-I$(G4TMPDIR) \
|
||||
-I$(G4INSTALL)/source/run/include \
|
||||
-I$(G4INSTALL)/source/event/include \
|
||||
-I$(G4INSTALL)/source/global/management/include \
|
||||
-I$(G4INSTALL)/source/global/HEPRandom/include \
|
||||
-I$(G4INSTALL)/source/global/HEPGeometry/include \
|
||||
-I$(G4INSTALL)/source/geometry/management/include \
|
||||
-I$(G4INSTALL)/source/geometry/volumes/include \
|
||||
-I$(G4INSTALL)/source/geometry/solids/CSG/include \
|
||||
-I$(G4INSTALL)/source/events+tracks/include \
|
||||
-I$(G4INSTALL)/source/processes/management/include \
|
||||
-I$(G4INSTALL)/source/materials/include \
|
||||
-I$(G4INSTALL)/source/particles/management/include \
|
||||
-I$(G4INSTALL)/source/graphics_reps/include \
|
||||
-I$(G4INSTALL)/source/tracking/include \
|
||||
-I$(G4INSTALL)/source/track/include \
|
||||
-I$(G4INSTALL)/source/persistency/management/include \
|
||||
-I$(G4INSTALL)/source/digits+hits/detector/include \
|
||||
-I$(G4INSTALL)/source/digits+hits/hits/include \
|
||||
-I$(G4INSTALL)/source/digits+hits/digits/include
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
include $(G4INSTALL)/config/G4ODBMS_BUILD.gmk
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Explicit DDL dependencies:
|
||||
# G4PEvent.ddl includes G4PPrimaryVertex.hh, so G4PPrimaryVertex.hh
|
||||
# should be created before G4PEvent.hh.
|
||||
|
||||
$(G4TMPDIR)/G4PEvent.hh: $(G4TMPDIR)/G4PPrimaryVertex.hh
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PEvent.ddl,v 2.2 1998/07/12 03:01:14 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4PEvent_h
|
||||
#define G4PEvent_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4PersistentTypes.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4PPrimaryVertex.hh"
|
||||
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
|
||||
|
||||
class G4PEvent
|
||||
: public HepPersObj
|
||||
|
||||
{
|
||||
public:
|
||||
G4PEvent();
|
||||
G4PEvent(const G4Event *evt);
|
||||
~G4PEvent();
|
||||
|
||||
private:
|
||||
// event ID
|
||||
G4Pint eventID;
|
||||
|
||||
// PrimaryVertex
|
||||
ooRef(G4PPrimaryVertex) thePrimaryVertex;
|
||||
G4Pint numberOfPrimaryVertex;
|
||||
|
||||
// HitsCollection
|
||||
// G4HCofThisEvent* HC;
|
||||
|
||||
// TrajectoryContainer
|
||||
// G4TrajectoryContainer * trajectoryContainer;
|
||||
|
||||
public:
|
||||
inline void SetEventID(const G4Event *evt)
|
||||
{ eventID = evt->GetEventID(); };
|
||||
inline G4int GetEventID() const
|
||||
{ return eventID; };
|
||||
|
||||
// inline void AddPrimaryVertex()
|
||||
// {
|
||||
// primaryVertex should be added here
|
||||
// ;
|
||||
// };
|
||||
// inline G4int GetNumberOfPrimaryVertex() const
|
||||
// { return numberOfPrimaryVertex; };
|
||||
// inline G4PrimaryVertex* GetPrimaryVertex(G4int i=0) const
|
||||
// {
|
||||
// primaryVertex should be added here
|
||||
// ;
|
||||
// };
|
||||
// inline void SetHCofThisEvent()
|
||||
// { HC = value; };
|
||||
// inline G4HCofThisEvent* GetHCofThisEvent() const
|
||||
// { return HC; };
|
||||
// inline void SetTrajectoryContainer(G4TrajectoryContainer*value)
|
||||
// { trajectoryContainer = value; };
|
||||
// inline G4TrajectoryContainer* GetTrajectoryContainer() const
|
||||
// { return trajectoryContainer; };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PPrimaryVertex.ddl,v 2.0 1998/07/02 16:12:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#ifndef G4PPrimaryVertex_h
|
||||
#define G4PPrimaryVertex_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4PrimaryVertex.hh"
|
||||
#include "G4PrimaryParticle.hh"
|
||||
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
|
||||
class G4PPrimaryVertex
|
||||
: public HepPersObj
|
||||
{
|
||||
public:
|
||||
G4PPrimaryVertex();
|
||||
G4PPrimaryVertex(const G4PrimaryVertex* vertex);
|
||||
~G4PPrimaryVertex();
|
||||
|
||||
private:
|
||||
G4double X0;
|
||||
G4double Y0;
|
||||
G4double Z0;
|
||||
G4double T0;
|
||||
G4PrimaryParticle * theParticle;
|
||||
|
||||
G4PPrimaryVertex* nextVertex;
|
||||
G4int numberOfParticle;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PEvent.cc,v 2.1 1998/07/12 03:01:15 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
// G4PEvent
|
||||
|
||||
#include "G4PEvent.hh"
|
||||
#include "G4PPrimaryVertex.hh"
|
||||
|
||||
G4PEvent::G4PEvent()
|
||||
{
|
||||
eventID =0;
|
||||
// initialization of thePrimaryVertex is not necessary
|
||||
// since Objectivity/DB will do it for you...
|
||||
HepRef(G4PPrimaryVertex) thePrimaryVertex = NULL;
|
||||
numberOfPrimaryVertex = 0;
|
||||
// HC = NULL;
|
||||
// trajectoryContainer = NULL;
|
||||
}
|
||||
|
||||
G4PEvent::G4PEvent(const G4Event *evt)
|
||||
{
|
||||
eventID = evt->GetEventID();
|
||||
|
||||
const G4PrimaryVertex* PV = evt->GetPrimaryVertex();
|
||||
if(PV)
|
||||
{ HepRef(G4PPrimaryVertex) thePrimaryVertex = new G4PPrimaryVertex(PV); }
|
||||
else
|
||||
{ HepRef(G4PPrimaryVertex) thePrimaryVertex = NULL; }
|
||||
|
||||
// const G4TrajectoryContainer* TC = evt->GetTrajectoryContainer();
|
||||
// if(TC)
|
||||
// { trajectoryContainer = new G4PTrajectoryContainer(TC); }
|
||||
// else
|
||||
// { trajectoryContainer = NULL; }
|
||||
}
|
||||
|
||||
G4PEvent::~G4PEvent()
|
||||
{
|
||||
// if(thePrimaryVertex) delete thePrimaryVertex;
|
||||
// if(trajectoryContainer) delete trajectoryContainer;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PPrimaryVertex.cc,v 2.2 1998/07/13 17:19:19 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4PPrimaryVertex.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4PPrimaryVertex::G4PPrimaryVertex()
|
||||
:X0(0.),Y0(0.),Z0(0.),T0(0.),numberOfParticle(0),nextVertex(NULL),
|
||||
theParticle(NULL)
|
||||
{;}
|
||||
|
||||
G4PPrimaryVertex::G4PPrimaryVertex(const G4PrimaryVertex* vertex)
|
||||
{
|
||||
X0 = vertex->GetX0();
|
||||
Y0 = vertex->GetY0();
|
||||
Z0 = vertex->GetZ0();
|
||||
T0 = vertex->GetT0();
|
||||
numberOfParticle = vertex->GetNumberOfParticle();
|
||||
|
||||
const G4PrimaryVertex* nextVX = vertex->GetNext();
|
||||
if(nextVX)
|
||||
{ nextVertex = new G4PPrimaryVertex(nextVX); }
|
||||
else
|
||||
{ nextVertex = NULL; }
|
||||
|
||||
theParticle = NULL;
|
||||
}
|
||||
|
||||
G4PPrimaryVertex::~G4PPrimaryVertex()
|
||||
{
|
||||
if(theParticle != NULL)
|
||||
{ delete theParticle; }
|
||||
if(nextVertex != NULL)
|
||||
{ delete nextVertex; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for persistency geometry subcaterogy.
|
||||
# Youhei Morita, 09/07/98.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
# order of SUBDIRS are important for creating header files.
|
||||
# don't mess it up!
|
||||
SUBDIRS = management solids/CSG volumes
|
||||
SUBLIBS = G4pgeomn G4pcsg G4pvol
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
include $(G4INSTALL)/config/globlib.gmk
|
||||
|
||||
# --------------------------------------------------------------
|
||||
|
||||
glob global:
|
||||
@echo Error - gmake global is not supported at this directory.
|
||||
exit 1
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
# $Id: GNUmakefile,v 2.5 1998/11/10 18:20:53 morita Exp $
|
||||
|
||||
name := G4pgeomn
|
||||
G4ODBMS := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../../..
|
||||
endif
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
# $(G4TMPDIR) will be overriden in common.gmk later.
|
||||
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
|
||||
|
||||
CPPFLAGS += \
|
||||
-Iinclude \
|
||||
-I$(G4TMPDIR) \
|
||||
-I../volumes/include \
|
||||
-I$(G4TMP)/$(G4SYSTEM)/G4pvol \
|
||||
-I$(G4INSTALL)/source/persistency/management/include \
|
||||
-I$(G4INSTALL)/source/run/include \
|
||||
-I$(G4INSTALL)/source/global/management/include \
|
||||
-I$(G4INSTALL)/source/global/HEPRandom/include \
|
||||
-I$(G4INSTALL)/source/global/HEPGeometry/include \
|
||||
-I$(G4INSTALL)/source/geometry/management/include \
|
||||
-I$(G4INSTALL)/source/geometry/magneticfield/include \
|
||||
-I$(G4INSTALL)/source/geometry/volumes/include \
|
||||
-I$(G4INSTALL)/source/geometry/solids/CSG/include \
|
||||
-I$(G4INSTALL)/source/materials/include \
|
||||
-I$(G4INSTALL)/source/graphics_reps/include
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
include $(G4INSTALL)/config/G4ODBMS_BUILD.gmk
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Explicit header file dependencies:
|
||||
|
||||
$(G4TMPDIR)/G4PPVParameterised.hh: $(G4TMPDIR)/G4PPVReplica.hh
|
||||
$(G4TMPDIR)/G4PPVReplica.hh: $(G4TMPDIR)/G4PVPhysicalVolume.hh
|
||||
$(G4TMPDIR)/G4PPVPlacement.hh: $(G4TMPDIR)/G4PVPhysicalVolume.hh
|
||||
$(G4TMPDIR)/G4PVPhysicalVolume.hh: $(G4TMPDIR)/G4PVSolid.hh
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PPVParameterised.ddl,v 2.1 1998/11/10 18:29:54 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PPVParameterised
|
||||
//
|
||||
// Persistent-capable class of G4PVParameterised
|
||||
//
|
||||
// History:
|
||||
// 05.11.99 Y.Morita First non-stub version
|
||||
|
||||
#ifndef G4PPVPARAMETERISED_DDL
|
||||
#define G4PPVPARAMETERISED_DDL 1
|
||||
|
||||
#include "G4PPVReplica.hh"
|
||||
|
||||
class G4PPVParameterised
|
||||
: public G4PPVReplica
|
||||
{
|
||||
public:
|
||||
G4PPVParameterised(G4VPhysicalVolume *PhysVol,
|
||||
HepRef(G4PLogicalVolume) persLogVol);
|
||||
|
||||
~G4PPVParameterised();
|
||||
|
||||
G4VPhysicalVolume* MakeTransientObject(
|
||||
G4LogicalVolume* aLogical,
|
||||
G4VPhysicalVolume* aMother );
|
||||
|
||||
virtual G4int GetCopyNo() const;
|
||||
|
||||
protected:
|
||||
virtual void SetCopyNo(G4int CopyNo);
|
||||
|
||||
private:
|
||||
// ooRef(G4VPVParameterisation) fparam;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PPVPlacement.ddl,v 2.3 1998/11/10 18:29:53 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// P-versieon of G4PVPlacement Takashi.Sasaki@kek.jp
|
||||
#ifndef G4PPVPLACEMENT_DDL
|
||||
#define G4PPVPLACEMENT_DDL 1
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
class G4PLogicalVolume;
|
||||
|
||||
#include "G4PVPhysicalVolume.hh"
|
||||
|
||||
class G4PPVPlacement : public G4PVPhysicalVolume
|
||||
{
|
||||
public:
|
||||
G4PPVPlacement( G4VPhysicalVolume *PhysVol,
|
||||
HepRef(G4PLogicalVolume) persLogVol);
|
||||
|
||||
~G4PPVPlacement();
|
||||
|
||||
G4VPhysicalVolume* MakeTransientObject(
|
||||
G4LogicalVolume* aLogical,
|
||||
G4VPhysicalVolume* aMother );
|
||||
|
||||
virtual G4bool IsMany() const;
|
||||
virtual G4int GetCopyNo() const;
|
||||
|
||||
protected:
|
||||
virtual void SetCopyNo(G4int CopyNo);
|
||||
|
||||
private:
|
||||
G4bool fmany; // flag for booleans
|
||||
// G4bool fallocatedRotM; // flag for allocation of Rotation Matrix
|
||||
G4int fcopyNo; // for identification
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PPVReplica.ddl,v 2.1 1998/11/10 18:29:54 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// class G4PPVReplica
|
||||
//
|
||||
// Persistent-capable class of G4PVReplica
|
||||
//
|
||||
// History:
|
||||
// 05.11.99 Y.Morita First non-stub version
|
||||
|
||||
#ifndef G4PPVREPLICA_DDL
|
||||
#define G4PPVREPLICA_DDL
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
#include "G4PVPhysicalVolume.hh"
|
||||
|
||||
class G4PPVReplica
|
||||
: public G4PVPhysicalVolume
|
||||
{
|
||||
public:
|
||||
G4PPVReplica( G4VPhysicalVolume *PhysVol,
|
||||
HepRef(G4PLogicalVolume) persLogVol);
|
||||
|
||||
~G4PPVReplica();
|
||||
|
||||
G4VPhysicalVolume* MakeTransientObject(
|
||||
G4LogicalVolume* aLogical,
|
||||
G4VPhysicalVolume* aMother );
|
||||
|
||||
virtual G4bool IsMany() const;
|
||||
virtual G4int GetCopyNo() const;
|
||||
|
||||
protected:
|
||||
virtual void SetCopyNo(G4int CopyNo);
|
||||
|
||||
protected:
|
||||
EAxis faxis;
|
||||
G4int fnReplicas;
|
||||
G4double fwidth,foffset;
|
||||
|
||||
G4int fcopyNo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PVPhysicalVolume.ddl,v 2.5 1998/11/10 18:29:53 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// class G4PVPhysicalVolume
|
||||
|
||||
#ifndef G4PVPHYSICALVOLUME_DDL
|
||||
#define G4PVPHYSICALVOLUME_DDL 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "geomdefs.hh"
|
||||
#include "G4PersistentTypes.hh"
|
||||
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
#include "HepODBMS/odbms/HepVArray.h"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
|
||||
//class G4VPVParameterisation;
|
||||
|
||||
// forward declaration and #pragma ooclassref is necessary in solving
|
||||
// the circular dependency between G4PLogicalVolume and G4PVPhysicalVolume
|
||||
class G4PLogicalVolume;
|
||||
#pragma ooclassref G4PLogicalVolume "G4PLogicalVolume_ref.hh"
|
||||
|
||||
#ifndef OO_VARRAY_D_DOUBLE
|
||||
declare(HepVArray,d_Double)
|
||||
#endif
|
||||
|
||||
class G4PVPhysicalVolume: public HepPersObj
|
||||
{
|
||||
public:
|
||||
G4PVPhysicalVolume();
|
||||
|
||||
G4PVPhysicalVolume( const G4VPhysicalVolume *PhysVol,
|
||||
const HepRef(G4PLogicalVolume) persLogVol);
|
||||
|
||||
// Destructor
|
||||
~G4PVPhysicalVolume();
|
||||
//
|
||||
void SetMother(const HepRef(G4PVPhysicalVolume) persMother);
|
||||
|
||||
G4VPhysicalVolume* MakeTransientObject(
|
||||
G4LogicalVolume* aLogical,
|
||||
G4VPhysicalVolume* aMother );
|
||||
|
||||
// Access functions
|
||||
G4PString GetName();
|
||||
void SetName(const G4PString aName);
|
||||
G4RotationMatrix* GetRotation();
|
||||
G4ThreeVector& GetTranslation();
|
||||
void SetRotation(const G4RotationMatrix* aRot);
|
||||
void SetTranslation(G4ThreeVector atrans);
|
||||
|
||||
HepRef(G4PLogicalVolume) GetLogicalVolume();
|
||||
|
||||
// Define equality by equal addresses only.
|
||||
G4bool operator == (const G4PVPhysicalVolume& p) const;
|
||||
|
||||
// Functions required of subclasses
|
||||
virtual G4bool IsMany() const = 0;
|
||||
virtual G4int GetCopyNo() const = 0;
|
||||
virtual void SetCopyNo(G4int CopyNo) = 0;
|
||||
|
||||
protected:
|
||||
HepVArray(d_Double) frot;
|
||||
HepVArray(d_Double) ftrans;
|
||||
|
||||
G4ThreeVector ftransvector;
|
||||
|
||||
ooRef(G4PLogicalVolume) flogical;
|
||||
G4PString fname; // name of the volume
|
||||
ooRef(G4PVPhysicalVolume) fmother; // The current moher volume
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PVSolid.ddl,v 2.0 1998/07/02 16:12:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// class G4PVSolid
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted from G4VSolid.hh
|
||||
// 20.06.98 A.Kimura Clean up
|
||||
|
||||
#ifndef G4PVSOLID_DDL
|
||||
#define G4PVSOLID_DDL
|
||||
|
||||
#include "globals.hh"
|
||||
#include "geomdefs.hh"
|
||||
#include "G4PersistentTypes.hh"
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
|
||||
class G4PVSolid;
|
||||
|
||||
class G4PVSolid : public HepPersObj {
|
||||
public:
|
||||
G4PVSolid(const G4String& name);
|
||||
virtual ~G4PVSolid();
|
||||
|
||||
virtual G4VSolid* MakeTransientObject() const = 0;
|
||||
|
||||
G4bool operator==( const G4PVSolid& s) const
|
||||
{
|
||||
return (this==&s) ? true : false;
|
||||
}
|
||||
|
||||
G4String GetName() const;
|
||||
void SetName(const G4String& name);
|
||||
|
||||
virtual G4GeometryType GetEntityType() const = 0;
|
||||
|
||||
private:
|
||||
|
||||
G4PString fshapeName; // Name
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PPVParameterised.cc,v 2.1 1998/11/10 18:31:07 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4PPVParameterised.hh"
|
||||
|
||||
#include "HepODBMS/clustering/HepClustering.h"
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PLogicalVolume.hh"
|
||||
|
||||
G4PPVParameterised::G4PPVParameterised( G4VPhysicalVolume* PhysVol,
|
||||
HepRef(G4PLogicalVolume) persLogVol)
|
||||
: G4PPVReplica(PhysVol, persLogVol)
|
||||
{
|
||||
// G4VPVParameterisation class has no data member
|
||||
// fparam = NULL;
|
||||
}
|
||||
|
||||
G4PPVParameterised::~G4PPVParameterised()
|
||||
{
|
||||
}
|
||||
|
||||
G4VPhysicalVolume* G4PPVParameterised::MakeTransientObject(
|
||||
G4LogicalVolume* aLogical,
|
||||
G4VPhysicalVolume* aMother)
|
||||
{
|
||||
const G4String pName = (const char *) GetName();
|
||||
EAxis pAxis = faxis;
|
||||
G4int nReplicas = fnReplicas;
|
||||
|
||||
G4VPhysicalVolume* aPhysVol = new G4PVParameterised(
|
||||
pName, aLogical, aMother, pAxis, nReplicas, NULL);
|
||||
|
||||
return aPhysVol;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PPVPlacement.cc,v 2.5 1998/11/10 18:31:06 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4PPVPlacement.hh"
|
||||
|
||||
#include "HepODBMS/clustering/HepClustering.h"
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PLogicalVolume.hh"
|
||||
|
||||
G4PPVPlacement::G4PPVPlacement(
|
||||
G4VPhysicalVolume* PhysVol,
|
||||
HepRef(G4PLogicalVolume) persLogVol)
|
||||
: G4PVPhysicalVolume(PhysVol, persLogVol)
|
||||
{
|
||||
fcopyNo = PhysVol->GetCopyNo();
|
||||
fmany = PhysVol->IsMany();
|
||||
}
|
||||
|
||||
G4PPVPlacement::~G4PPVPlacement()
|
||||
{
|
||||
}
|
||||
|
||||
G4VPhysicalVolume* G4PPVPlacement::MakeTransientObject(
|
||||
G4LogicalVolume* aLogical,
|
||||
G4VPhysicalVolume* aMother )
|
||||
{
|
||||
G4RotationMatrix* pRot = GetRotation();
|
||||
G4ThreeVector tlate = GetTranslation();
|
||||
G4String pName;
|
||||
|
||||
G4VPhysicalVolume* aPhysVol = new G4PVPlacement(
|
||||
pRot, tlate, pName = fname, aLogical, aMother, false, 0);
|
||||
|
||||
return aPhysVol;
|
||||
}
|
||||
|
||||
G4bool G4PPVPlacement::IsMany() const
|
||||
{
|
||||
return fmany;
|
||||
}
|
||||
|
||||
G4int G4PPVPlacement::GetCopyNo() const
|
||||
{
|
||||
return fcopyNo;
|
||||
}
|
||||
|
||||
|
||||
void G4PPVPlacement::SetCopyNo(G4int newCopyNo)
|
||||
{
|
||||
fcopyNo= newCopyNo;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PPVReplica.cc,v 2.1 1998/11/10 18:31:07 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4PPVReplica.hh"
|
||||
|
||||
#include "HepODBMS/clustering/HepClustering.h"
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
#include "G4PVReplica.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PLogicalVolume.hh"
|
||||
|
||||
G4PPVReplica::G4PPVReplica( G4VPhysicalVolume* PhysVol,
|
||||
HepRef(G4PLogicalVolume) persLogVol)
|
||||
: G4PVPhysicalVolume(PhysVol, persLogVol)
|
||||
{
|
||||
EAxis axis;
|
||||
G4int nReplicas;
|
||||
G4double width;
|
||||
G4double offset;
|
||||
G4bool consuming;
|
||||
|
||||
PhysVol->GetReplicationData(axis, nReplicas, width, offset, consuming);
|
||||
faxis = axis;
|
||||
fnReplicas = nReplicas;
|
||||
fwidth = width;
|
||||
foffset = offset;
|
||||
fcopyNo = PhysVol->GetCopyNo();
|
||||
}
|
||||
|
||||
G4PPVReplica::~G4PPVReplica()
|
||||
{
|
||||
}
|
||||
|
||||
G4VPhysicalVolume* G4PPVReplica::MakeTransientObject(
|
||||
G4LogicalVolume* aLogical,
|
||||
G4VPhysicalVolume* aMother)
|
||||
{
|
||||
const G4String pName = (const char *) GetName();
|
||||
EAxis pAxis = faxis;
|
||||
G4int nReplicas = fnReplicas;
|
||||
G4double width = fwidth;
|
||||
G4double offset = foffset;
|
||||
|
||||
G4VPhysicalVolume* aPhysVol = new G4PVReplica(
|
||||
pName, aLogical, aMother, pAxis, nReplicas, width, offset);
|
||||
|
||||
return aPhysVol;
|
||||
}
|
||||
|
||||
G4bool G4PPVReplica::IsMany() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
G4int G4PPVReplica::GetCopyNo() const
|
||||
{
|
||||
return fcopyNo;
|
||||
}
|
||||
|
||||
void G4PPVReplica::SetCopyNo(G4int newCopyNo)
|
||||
{
|
||||
fcopyNo= newCopyNo;
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PVPhysicalVolume.cc,v 2.6 1998/11/15 14:04:17 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Takashi.Sasaki@kek.jp
|
||||
|
||||
#include "G4PVPhysicalVolume.hh"
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PLogicalVolume.hh"
|
||||
|
||||
#ifndef OO_VARRAY_D_DOUBLE
|
||||
implement(HepVArray,d_Double)
|
||||
#endif
|
||||
|
||||
G4PVPhysicalVolume::G4PVPhysicalVolume()
|
||||
: flogical(NULL), fname(NULL), fmother(NULL)
|
||||
{
|
||||
frot.resize(9);
|
||||
ftrans.resize(3);
|
||||
}
|
||||
|
||||
G4PVPhysicalVolume::G4PVPhysicalVolume(
|
||||
const G4VPhysicalVolume *PhysVol,
|
||||
const HepRef(G4PLogicalVolume) persLogVol)
|
||||
{
|
||||
const G4RotationMatrix* aRot = PhysVol->GetRotation();
|
||||
if ( aRot )
|
||||
SetRotation( PhysVol->GetRotation() );
|
||||
|
||||
const G4ThreeVector atrans = PhysVol->GetTranslation();
|
||||
SetTranslation( atrans );
|
||||
|
||||
flogical = persLogVol;
|
||||
fname = PhysVol->GetName();
|
||||
// fmother = LookUp(PhysVol->GetMother());
|
||||
}
|
||||
|
||||
G4PVPhysicalVolume::~G4PVPhysicalVolume()
|
||||
{
|
||||
}
|
||||
|
||||
void G4PVPhysicalVolume::SetMother(const HepRef(G4PVPhysicalVolume) persMother)
|
||||
{
|
||||
fmother = persMother;
|
||||
}
|
||||
|
||||
G4VPhysicalVolume* G4PVPhysicalVolume::MakeTransientObject(
|
||||
G4LogicalVolume* aLogical,
|
||||
G4VPhysicalVolume* aMother )
|
||||
{
|
||||
G4RotationMatrix* pRot = GetRotation();
|
||||
G4ThreeVector tlate = GetTranslation();
|
||||
G4String pName;
|
||||
|
||||
// Need to call concrete Phys Vol class according to the physics
|
||||
// volume type. For now, a simple physical volume is assumed for
|
||||
// quick solution.
|
||||
|
||||
G4VPhysicalVolume* aPhysVol = new G4PVPlacement(
|
||||
pRot, tlate, pName = fname, aLogical, NULL, false, 0);
|
||||
aPhysVol->SetMother(aMother);
|
||||
|
||||
return aPhysVol;
|
||||
}
|
||||
|
||||
G4PString G4PVPhysicalVolume::GetName()
|
||||
{
|
||||
return fname;
|
||||
}
|
||||
|
||||
void G4PVPhysicalVolume::SetName(const G4PString aName)
|
||||
{
|
||||
fname = aName;
|
||||
}
|
||||
|
||||
HepRef(G4PLogicalVolume) G4PVPhysicalVolume::GetLogicalVolume()
|
||||
{
|
||||
return flogical;
|
||||
}
|
||||
|
||||
G4RotationMatrix* G4PVPhysicalVolume::GetRotation()
|
||||
{
|
||||
// create unit matrix with default constructor
|
||||
G4RotationMatrix* aRot = new G4RotationMatrix();
|
||||
|
||||
// setup the transient rotation matrix
|
||||
aRot->rotateAxes( Hep3Vector(frot[0],frot[3],frot[6]),
|
||||
Hep3Vector(frot[1],frot[4],frot[7]),
|
||||
Hep3Vector(frot[2],frot[5],frot[8]) );
|
||||
return aRot;
|
||||
}
|
||||
|
||||
G4ThreeVector& G4PVPhysicalVolume::GetTranslation()
|
||||
{
|
||||
G4ThreeVector atrans(ftrans[0],ftrans[1],ftrans[2]); // local variable
|
||||
ftransvector = G4ThreeVector(atrans); // cast by copy constructor
|
||||
return ftransvector;
|
||||
}
|
||||
|
||||
void G4PVPhysicalVolume::SetRotation(const G4RotationMatrix* aRot)
|
||||
{
|
||||
frot.resize(9);
|
||||
|
||||
frot[0] = aRot->xx();
|
||||
frot[1] = aRot->xy();
|
||||
frot[2] = aRot->xz();
|
||||
frot[3] = aRot->yx();
|
||||
frot[4] = aRot->yy();
|
||||
frot[5] = aRot->yz();
|
||||
frot[6] = aRot->zx();
|
||||
frot[7] = aRot->zy();
|
||||
frot[8] = aRot->zz();
|
||||
|
||||
frot.update();
|
||||
}
|
||||
|
||||
void G4PVPhysicalVolume::SetTranslation(G4ThreeVector atrans)
|
||||
{
|
||||
ftrans.resize(3);
|
||||
|
||||
ftrans[0] = atrans.x();
|
||||
ftrans[1] = atrans.y();
|
||||
ftrans[2] = atrans.z();
|
||||
|
||||
ftrans.update();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PVSolid.cc,v 2.3 1998/07/12 03:01:22 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PVSolid
|
||||
//
|
||||
// Implementation for persistent solid base class
|
||||
//
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4VSolid.cc
|
||||
|
||||
#include "G4PVSolid.hh"
|
||||
|
||||
// Constructor
|
||||
// - Copies name
|
||||
G4PVSolid::G4PVSolid(const G4String& name)
|
||||
: fshapeName(name)
|
||||
{
|
||||
}
|
||||
|
||||
// Destructor (virtual)
|
||||
// - Remove ourselves from solid Store
|
||||
G4PVSolid::~G4PVSolid()
|
||||
{
|
||||
}
|
||||
|
||||
// Returns name by value
|
||||
G4String G4PVSolid::GetName() const
|
||||
{
|
||||
return (const char*) fshapeName;
|
||||
}
|
||||
|
||||
void G4PVSolid::SetName(const G4String& name)
|
||||
{
|
||||
fshapeName = name;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
# $Id: GNUmakefile,v 2.4 1998/07/14 14:27:15 morita Exp $
|
||||
|
||||
name := G4pcsg
|
||||
G4ODBMS := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../../../..
|
||||
endif
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
# $(G4TMPDIR) will be overriden in common.gmk later.
|
||||
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
|
||||
|
||||
CPPFLAGS += \
|
||||
-Iinclude \
|
||||
-I$(G4TMPDIR) \
|
||||
-I$(G4TMP)/$(G4SYSTEM)/G4pgeomn \
|
||||
-I../management/include \
|
||||
-I$(G4INSTALL)/source/persistency/management/include \
|
||||
-I$(G4INSTALL)/source/run/include \
|
||||
-I$(G4INSTALL)/source/global/management/include \
|
||||
-I$(G4INSTALL)/source/global/HEPRandom/include \
|
||||
-I$(G4INSTALL)/source/global/HEPGeometry/include \
|
||||
-I$(G4INSTALL)/source/geometry/management/include \
|
||||
-I$(G4INSTALL)/source/geometry/magneticfield/include \
|
||||
-I$(G4INSTALL)/source/geometry/volumes/include \
|
||||
-I$(G4INSTALL)/source/geometry/solids/CSG/include \
|
||||
-I$(G4INSTALL)/source/materials/include \
|
||||
-I$(G4INSTALL)/source/graphics_reps/include
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
include $(G4INSTALL)/config/G4ODBMS_BUILD.gmk
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Explicit DDL dependencies:
|
||||
|
||||
$(G4TMPDIR)/G4PBox.hh: $(G4TMPDIR)/G4PCSGSolid.hh
|
||||
$(G4TMPDIR)/G4PCSGSolid.hh:
|
||||
$(G4TMPDIR)/G4PCons.hh: $(G4TMPDIR)/G4PCSGSolid.hh
|
||||
$(G4TMPDIR)/G4PPara.hh: $(G4TMPDIR)/G4PCSGSolid.hh
|
||||
$(G4TMPDIR)/G4PSphere.hh: $(G4TMPDIR)/G4PCSGSolid.hh
|
||||
$(G4TMPDIR)/G4PTorus.hh: $(G4TMPDIR)/G4PCSGSolid.hh
|
||||
$(G4TMPDIR)/G4PTrap.hh: $(G4TMPDIR)/G4PCSGSolid.hh
|
||||
$(G4TMPDIR)/G4PTrd.hh: $(G4TMPDIR)/G4PCSGSolid.hh
|
||||
$(G4TMPDIR)/G4PTubs.hh: $(G4TMPDIR)/G4PCSGSolid.hh
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PBox.ddl,v 2.0 1998/07/02 16:12:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PBox
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted from G4Box.hh
|
||||
|
||||
#ifndef G4PBOX_DDL
|
||||
#define G4PBOX_DDL
|
||||
|
||||
#include "G4PCSGSolid.hh"
|
||||
|
||||
class G4VSolid;
|
||||
class G4Box;
|
||||
|
||||
class G4PBox : public G4PCSGSolid {
|
||||
public:
|
||||
G4PBox(const G4Box* theBox);
|
||||
virtual ~G4PBox();
|
||||
|
||||
G4VSolid* MakeTransientObject() const;
|
||||
|
||||
// Naming method (pseudo-RTTI : run-time type identification
|
||||
virtual G4GeometryType GetEntityType() const { return G4String("G4Box"); }
|
||||
|
||||
private:
|
||||
G4double fDx,fDy,fDz;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PCSGSolid.ddl,v 2.0 1998/07/02 16:13:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// class G4CSGSolid
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4CSGSolid.hh
|
||||
|
||||
#ifndef G4PCSGSOLID_DDL
|
||||
#define G4PCSGSOLID_DDL
|
||||
|
||||
#include "G4PVSolid.hh"
|
||||
|
||||
class G4PCSGSolid : public G4PVSolid {
|
||||
public:
|
||||
G4PCSGSolid(const G4String& pName);
|
||||
|
||||
virtual ~G4PCSGSolid();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PCons.ddl,v 2.0 1998/07/02 16:12:58 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4Cons
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Cons.hh
|
||||
|
||||
#ifndef G4PCons_DDL
|
||||
#define G4PCons_DDL
|
||||
|
||||
#include "G4PCSGSolid.hh"
|
||||
|
||||
class G4Cons;
|
||||
class G4VSolid;
|
||||
|
||||
class G4PCons : public G4PCSGSolid {
|
||||
public:
|
||||
G4PCons(const G4Cons* theCons);
|
||||
virtual ~G4PCons() ;
|
||||
|
||||
G4VSolid* MakeTransientObject() const;
|
||||
|
||||
// Naming method (pseudo-RTTI : run-time type identification
|
||||
virtual G4GeometryType GetEntityType() const {return G4String("G4Cons");}
|
||||
|
||||
private:
|
||||
|
||||
G4double fRmin1, fRmin2,
|
||||
fRmax1, fRmax2,
|
||||
fDz,
|
||||
fSPhi, fDPhi;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,95 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PHype.ddl,v 2.1 1998/07/12 03:01:24 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PHype
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Hype.hh
|
||||
|
||||
#ifndef G4PHYPE_DDL
|
||||
#define G4PHYPE_DDL
|
||||
|
||||
#include "G4PCSGSolid.hh"
|
||||
|
||||
class G4VSolid;
|
||||
class G4Hype;
|
||||
|
||||
class G4PHype : public G4PCSGSolid {
|
||||
public:
|
||||
|
||||
G4PHype(const G4Hype* theHype);
|
||||
virtual ~G4PHype();
|
||||
|
||||
G4VSolid* MakeTransientObject() const;
|
||||
|
||||
virtual G4GeometryType GetEntityType() const {return G4String("G4Hype");}
|
||||
|
||||
protected:
|
||||
// values of hype radius at a given Z
|
||||
G4double HypeInnerRadius2(double zVal) const {
|
||||
return (tanInnerStereo2*zVal*zVal+innerRadius2);
|
||||
}
|
||||
G4double HypeOuterRadius2(double zVal) const {
|
||||
return (tanOuterStereo2*zVal*zVal+outerRadius2);
|
||||
}
|
||||
|
||||
G4double innerRadius; // variable names are quite self explanative
|
||||
G4double outerRadius;
|
||||
G4double halfLenZ;
|
||||
G4double innerStereo;
|
||||
G4double outerStereo;
|
||||
|
||||
// precalculated parameters, squared quantities
|
||||
G4double tanInnerStereo2; // squared tan of Inner Stereo angle
|
||||
G4double tanOuterStereo2; // squared tan of Outer Stereo angle
|
||||
G4double innerRadius2; // squared Inner Radius
|
||||
G4double outerRadius2; // squared Outer Radius
|
||||
G4double endInnerRadius2; // squared endcap Inner Radius
|
||||
G4double endOuterRadius2; // squared endcap Outer Radius
|
||||
G4double endInnerRadius; // endcap Inner Radius
|
||||
G4double endOuterRadius; // endcap Outer Radius
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PPara.ddl,v 2.0 1998/07/02 16:13:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PPara
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Para.hh
|
||||
|
||||
|
||||
#ifndef G4PPara_DDL
|
||||
#define G4PPara_DDL
|
||||
|
||||
#include "G4PCSGSolid.hh"
|
||||
|
||||
class G4Para;
|
||||
class G4VSolid;
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
#include <rw/tvordvec.h>
|
||||
typedef RWTValOrderedVector<G4ThreeVector> G4ThreeVectorList;
|
||||
|
||||
class G4PPara : public G4PCSGSolid {
|
||||
public:
|
||||
|
||||
G4PPara(const G4Para* thePara);
|
||||
virtual ~G4PPara() ;
|
||||
|
||||
// Access functions
|
||||
G4VSolid* MakeTransientObject() const ;
|
||||
|
||||
// Get functions
|
||||
|
||||
G4ThreeVector GetSymAxis() const {
|
||||
G4double cosTheta
|
||||
= 1.0/sqrt(1+fTthetaCphi*fTthetaCphi+fTthetaSphi*fTthetaSphi) ;
|
||||
|
||||
return G4ThreeVector(fTthetaCphi*cosTheta,fTthetaSphi*cosTheta,cosTheta) ;
|
||||
}
|
||||
|
||||
// Naming method (pseudo-RTTI : run-time type identification
|
||||
|
||||
virtual G4GeometryType GetEntityType() const {return G4String("G4Para");}
|
||||
|
||||
private:
|
||||
G4double fDx,fDy,fDz;
|
||||
G4double fTalpha,fTthetaCphi,fTthetaSphi;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PSphere.ddl,v 2.0 1998/07/02 16:13:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PSphere
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Sphere.hh
|
||||
|
||||
#ifndef G4PSphere_DDL
|
||||
#define G4PSphere_DDL
|
||||
|
||||
#include "G4PCSGSolid.hh"
|
||||
|
||||
class G4VSolid;
|
||||
class G4Sphere;
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
#include <rw/tvordvec.h>
|
||||
typedef RWTValOrderedVector<G4ThreeVector> G4ThreeVectorList;
|
||||
|
||||
class G4PSphere : public G4PCSGSolid {
|
||||
public:
|
||||
G4PSphere(const G4Sphere* theSphere);
|
||||
|
||||
virtual ~G4PSphere() ;
|
||||
|
||||
G4VSolid* MakeTransientObject() const;
|
||||
|
||||
// Naming method (pseudo-RTTI : run-time type identification
|
||||
virtual G4GeometryType GetEntityType() const {return G4String("G4Sphere");}
|
||||
|
||||
private:
|
||||
|
||||
G4double fRmin,fRmax,
|
||||
fSPhi,fDPhi,
|
||||
fSTheta,fDTheta;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PTorus.ddl,v 2.0 1998/07/02 16:13:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// class G4PTorus
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Torus.hh
|
||||
|
||||
#ifndef G4PTorus_DDL
|
||||
#define G4PTorus_DDL
|
||||
|
||||
#include "G4PCSGSolid.hh"
|
||||
|
||||
class G4VSolid;
|
||||
class G4Torus;
|
||||
|
||||
class G4PTorus : public G4PCSGSolid {
|
||||
public:
|
||||
G4PTorus(const G4Torus* theTorus);
|
||||
virtual ~G4PTorus();
|
||||
|
||||
G4VSolid* MakeTransientObject() const;
|
||||
|
||||
void SetAllParameters(G4double pRmin, G4double pRmax, G4double pRtor,
|
||||
G4double pSPhi, G4double pDPhi);
|
||||
|
||||
// Naming method (pseudo-RTTI : run-time type identification
|
||||
virtual G4GeometryType GetEntityType() const {return G4String("G4Torus");}
|
||||
|
||||
protected:
|
||||
|
||||
G4double fRmin,fRmax,fRtor,fSPhi,fDPhi;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PTrap.ddl,v 2.0 1998/07/02 16:13:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PTrap
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Trap.hh
|
||||
|
||||
#ifndef G4PTrap_DDL
|
||||
#define G4PTrap_DDL
|
||||
|
||||
#include "G4PCSGSolid.hh"
|
||||
|
||||
class G4VSolid;
|
||||
class G4Trap;
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
#include <rw/tvordvec.h>
|
||||
typedef RWTValOrderedVector<G4ThreeVector> G4ThreeVectorList;
|
||||
|
||||
struct PTrapSidePlane
|
||||
{
|
||||
G4double a,b,c,d; // Normal unit vector (a,b,c) and offset (d)
|
||||
// => Ax+By+Cz+D=0
|
||||
};
|
||||
|
||||
class G4PTrap : public G4PCSGSolid {
|
||||
|
||||
public:
|
||||
|
||||
// The most general constructor for G4Trap
|
||||
|
||||
G4PTrap(const G4Trap* theTrap);
|
||||
virtual ~G4PTrap() ;
|
||||
|
||||
// Access functions
|
||||
G4VSolid* MakeTransientObject() const;
|
||||
|
||||
void SetAllParameters ( G4double pDz,
|
||||
G4double pTheta,
|
||||
G4double pPhi,
|
||||
G4double pDy1,
|
||||
G4double pDx1,
|
||||
G4double pDx2,
|
||||
G4double pAlp1,
|
||||
G4double pDy2,
|
||||
G4double pDx3,
|
||||
G4double pDx4,
|
||||
G4double pAlp2);
|
||||
|
||||
// Naming method (pseudo-RTTI : run-time type identification
|
||||
virtual G4GeometryType GetEntityType() const { return G4String("G4Trap"); }
|
||||
|
||||
protected:
|
||||
|
||||
G4bool MakePlanes();
|
||||
G4bool MakePlane( const G4ThreeVector& p1,
|
||||
const G4ThreeVector& p2,
|
||||
const G4ThreeVector& p3,
|
||||
const G4ThreeVector& p4,
|
||||
PTrapSidePlane& plane ) ;
|
||||
|
||||
private:
|
||||
|
||||
G4double fDz,fTthetaCphi,fTthetaSphi;
|
||||
G4double fDy1,fDx1,fDx2,fTalpha1;
|
||||
G4double fDy2,fDx3,fDx4,fTalpha2;
|
||||
PTrapSidePlane fPlanes[4];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// **************************** End of G4Trap.hh *****************************************
|
||||
@@ -0,0 +1,49 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PTrd.ddl,v 2.0 1998/07/02 16:13:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PTrd
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Trd.hh
|
||||
|
||||
#ifndef G4PTRD_DDL
|
||||
#define G4PTRD_DDL
|
||||
|
||||
#include "G4PCSGSolid.hh"
|
||||
|
||||
class G4Trd;
|
||||
class G4VSolid;
|
||||
|
||||
class G4PTrd : public G4PCSGSolid {
|
||||
|
||||
public:
|
||||
|
||||
G4PTrd(const G4Trd* theTrd);
|
||||
|
||||
virtual ~G4PTrd();
|
||||
|
||||
G4VSolid* MakeTransientObject() const;
|
||||
|
||||
// Naming method (pseudo-RTTI : run-time type identification
|
||||
virtual G4GeometryType GetEntityType() const {return G4String("G4Trd");}
|
||||
|
||||
void CheckAndSetAllParameters (G4double pdx1, G4double pdx2,
|
||||
G4double pdy1, G4double pdy2,
|
||||
G4double pdz);
|
||||
|
||||
protected:
|
||||
|
||||
G4double fDx1,fDx2,fDy1,fDy2,fDz;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PTubs.ddl,v 2.0 1998/07/02 16:13:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// class G4PTubs
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Tubs.hh
|
||||
|
||||
#ifndef G4PTUBS_DDL
|
||||
#define G4PTUBS_DDL
|
||||
|
||||
#include "G4PCSGSolid.hh"
|
||||
|
||||
class G4VSolid;
|
||||
class G4Tubs;
|
||||
|
||||
class G4PTubs : public G4PCSGSolid {
|
||||
public:
|
||||
G4PTubs(const G4Tubs* theTubs);
|
||||
virtual ~G4PTubs();
|
||||
|
||||
G4VSolid* MakeTransientObject() const;
|
||||
|
||||
// Naming method (pseudo-RTTI : run-time type identification)
|
||||
virtual G4GeometryType GetEntityType() const { return G4String("G4Tubs"); }
|
||||
|
||||
protected:
|
||||
|
||||
G4double fRMin,fRMax,fDz,fSPhi,fDPhi;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PBox.cc,v 2.0 1998/07/02 16:13:16 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
// Implementation for G4PBox class
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Box.cc
|
||||
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PBox.hh"
|
||||
#include "G4Box.hh"
|
||||
|
||||
#include "G4AffineTransform.hh"
|
||||
|
||||
// Constructor - check & set half widths
|
||||
G4PBox::G4PBox(const G4Box* theBox) : G4PCSGSolid(theBox->GetName()) {
|
||||
G4double pX = theBox->GetXHalfLength();
|
||||
G4double pY = theBox->GetYHalfLength();
|
||||
G4double pZ = theBox->GetZHalfLength();
|
||||
|
||||
if (pX>0&&pY>0&&pZ>0) {
|
||||
fDx=pX; fDy=pY; fDz=pZ;
|
||||
} else {
|
||||
G4Exception("Error in G4PBox::Box - negative parameters");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Destructor
|
||||
G4PBox::~G4PBox() {
|
||||
;
|
||||
}
|
||||
|
||||
// make a transient object
|
||||
G4VSolid* G4PBox::MakeTransientObject() const {
|
||||
G4VSolid* transientObject = new G4Box(GetName(),
|
||||
fDx, fDy, fDz);
|
||||
return transientObject;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PCSGSolid.cc,v 2.0 1998/07/02 16:13:15 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4CSGSolid.cc
|
||||
|
||||
#include "G4PCSGSolid.hh"
|
||||
|
||||
// Constructor
|
||||
// - Base class constructor
|
||||
|
||||
G4PCSGSolid::G4PCSGSolid(const G4String& name) :
|
||||
G4PVSolid(name)
|
||||
{
|
||||
}
|
||||
|
||||
G4PCSGSolid::~G4PCSGSolid()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PCons.cc,v 2.2 1998/07/12 03:01:26 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PCons
|
||||
//
|
||||
// Implementation for G4PCons class
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Cons.cc
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PCons.hh"
|
||||
#include "G4Cons.hh"
|
||||
|
||||
#include "G4VoxelLimits.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
|
||||
// #include "G4PVPVParameterisation.hh"
|
||||
|
||||
#include "meshdefs.hh"
|
||||
|
||||
#include "G4VGraphicsScene.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4NURBS.hh"
|
||||
#include "G4NURBSbox.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
|
||||
G4PCons::~G4PCons() {
|
||||
;
|
||||
}
|
||||
|
||||
// make a transient object
|
||||
G4VSolid* G4PCons::MakeTransientObject() const {
|
||||
G4VSolid* transientObject = new G4Cons(GetName(),
|
||||
fRmin1, fRmax1,
|
||||
fRmin2, fRmax2,
|
||||
fDz,
|
||||
fSPhi, fDPhi);
|
||||
return transientObject;
|
||||
}
|
||||
|
||||
// constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
|
||||
// - note if pDPhi>2PI then reset to 2PI
|
||||
|
||||
G4PCons::G4PCons(const G4Cons* theCons) : G4PCSGSolid(theCons->GetName()) {
|
||||
|
||||
G4double pRmin1 = theCons->GetInnerRadiusMinusZ();
|
||||
G4double pRmax1 = theCons->GetOuterRadiusMinusZ();
|
||||
G4double pRmin2 = theCons->GetInnerRadiusPlusZ();
|
||||
G4double pRmax2 = theCons->GetOuterRadiusPlusZ();
|
||||
G4double pDz = theCons->GetZHalfLength();
|
||||
G4double pSPhi = theCons->GetStartPhiAngle();
|
||||
G4double pDPhi = theCons->GetDeltaPhiAngle();
|
||||
|
||||
// Check z-len
|
||||
if (pDz>0) {
|
||||
fDz=pDz;
|
||||
} else {
|
||||
G4Exception("Error in G4PCons::G4PCons - invalid z half-length");
|
||||
}
|
||||
|
||||
// Check radii
|
||||
if (pRmin1<pRmax1 && pRmin2<pRmax2 && pRmin1>=0 && pRmin2>=0) {
|
||||
fRmin1=pRmin1; fRmax1=pRmax1;
|
||||
fRmin2=pRmin2; fRmax2=pRmax2;
|
||||
} else {
|
||||
G4Exception("Error in G4PCons::G4PCons - invalid radii");
|
||||
}
|
||||
|
||||
// Check angles
|
||||
if (pDPhi>=2.0*M_PI) {
|
||||
fDPhi=2*M_PI;
|
||||
fSPhi=0;
|
||||
} else {
|
||||
if (pDPhi>0) {
|
||||
fDPhi=pDPhi;
|
||||
} else {
|
||||
G4Exception("Error in G4PCons::G4PCons - invalid pDPhi");
|
||||
}
|
||||
|
||||
// Ensure pSPhi in 0-2PI or -2PI-0 range if shape crosses 0
|
||||
if (pSPhi<0) {
|
||||
fSPhi=2.0*M_PI-fmod(fabs(pSPhi),2.0*M_PI);
|
||||
} else {
|
||||
fSPhi=fmod(pSPhi,2.0*M_PI);
|
||||
}
|
||||
|
||||
if (fSPhi+fDPhi>2.0*M_PI) fSPhi-=2.0*M_PI;
|
||||
}
|
||||
}
|
||||
|
||||
// ******************************* End of G4PCons.cc file **********************************
|
||||
@@ -0,0 +1,81 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PHype.cc,v 2.1 1998/07/12 03:01:27 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PHype
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4PHype.cc
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PHype.hh"
|
||||
#include "G4Hype.hh"
|
||||
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "meshdefs.hh"
|
||||
|
||||
#define SURFACE_PRECISION (0.5*kCarTolerance)
|
||||
|
||||
// Constructor - check parameters, and fills protected data members
|
||||
G4PHype::G4PHype(const G4Hype* theHype) : G4PCSGSolid(theHype->GetName()) {
|
||||
|
||||
const G4double newInnerRadius = theHype->GetInnerRadius();
|
||||
const G4double newOuterRadius = theHype->GetOuterRadius();
|
||||
const G4double newInnerStereo = theHype->GetOuterStereo();
|
||||
const G4double newOuterStereo = theHype->GetInnerStereo();
|
||||
const G4double newHalfLenZ = theHype->GetZHalfLength();
|
||||
|
||||
// Check z-len
|
||||
if (newHalfLenZ>0) {
|
||||
halfLenZ=newHalfLenZ;
|
||||
} else {
|
||||
G4Exception("Error in G4PHype::G4PHype - invalid z half-length");
|
||||
}
|
||||
|
||||
// Check radii
|
||||
if (newInnerRadius>=0 && newOuterRadius>=0) {
|
||||
if (newInnerRadius < newOuterRadius) {
|
||||
innerRadius=newInnerRadius;
|
||||
outerRadius=newOuterRadius;
|
||||
} else { // swapping radii (:-)
|
||||
innerRadius=newOuterRadius;
|
||||
outerRadius=newInnerRadius;
|
||||
}
|
||||
} else {
|
||||
G4Exception("Error in G4PHype::G4PHype - invalid radii");
|
||||
}
|
||||
|
||||
innerStereo=newInnerStereo;
|
||||
outerStereo=newOuterStereo;
|
||||
|
||||
// init of precalculated quantities
|
||||
tanInnerStereo2 = tan(innerStereo)*tan(innerStereo);
|
||||
tanOuterStereo2 = tan(outerStereo)*tan(outerStereo);
|
||||
innerRadius2 = innerRadius*innerRadius;
|
||||
outerRadius2 = outerRadius*outerRadius;
|
||||
endInnerRadius2 = HypeInnerRadius2(halfLenZ);
|
||||
endOuterRadius2 = HypeOuterRadius2(halfLenZ);
|
||||
endInnerRadius = sqrt(endInnerRadius2);
|
||||
endOuterRadius = sqrt(endOuterRadius2);
|
||||
}
|
||||
|
||||
// Destructor
|
||||
G4PHype::~G4PHype()
|
||||
{;}
|
||||
|
||||
// make a transient object
|
||||
G4VSolid* G4PHype::MakeTransientObject() const {
|
||||
G4VSolid* transientObject = new G4Hype(GetName(),
|
||||
innerRadius,
|
||||
outerRadius,
|
||||
innerStereo,
|
||||
outerStereo,
|
||||
halfLenZ);
|
||||
return transientObject;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PPara.cc,v 2.0 1998/07/02 16:13:21 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PPara
|
||||
//
|
||||
// Implementation for G4PPara class
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Para.cc
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PPara.hh"
|
||||
#include "G4Para.hh"
|
||||
|
||||
#include "G4AffineTransform.hh"
|
||||
|
||||
// Constructor - check and set half-widths
|
||||
|
||||
G4PPara::G4PPara(const G4Para* thePara) : G4PCSGSolid(thePara->GetName())
|
||||
{
|
||||
G4double pDx = thePara->GetXHalfLength();
|
||||
G4double pDy = thePara->GetYHalfLength();
|
||||
G4double pDz = thePara->GetZHalfLength();
|
||||
|
||||
if(pDx>0&&pDy>0&&pDz>0) {
|
||||
fDx = pDx;
|
||||
fDy = pDy;
|
||||
fDz = pDz;
|
||||
fTalpha = thePara->GetTanAlpha();
|
||||
G4ThreeVector symAxis = thePara->GetSymAxis();
|
||||
fTthetaCphi = symAxis.x()/symAxis.z();
|
||||
fTthetaSphi = symAxis.y()/symAxis.z();
|
||||
} else {
|
||||
G4Exception("Error in G4PPara::G4PPara - Invalid Length Parameters");
|
||||
}
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
G4PPara::~G4PPara()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// make a transient object
|
||||
G4VSolid* G4PPara::MakeTransientObject() const {
|
||||
G4ThreeVector symaxis = GetSymAxis();
|
||||
G4double alpha = atan(fTalpha);
|
||||
G4double theta = acos(symaxis.z());
|
||||
G4double phi = acos(fTthetaCphi/tan(theta));
|
||||
|
||||
G4VSolid* transientObject = new G4Para(GetName(),
|
||||
fDx, fDy, fDz,
|
||||
alpha, theta, phi);
|
||||
return transientObject;
|
||||
}
|
||||
|
||||
// ******************************** End of G4PPara.cc ********************************
|
||||
@@ -0,0 +1,119 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PSphere.cc,v 2.0 1998/07/02 16:13:27 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// class G4PSphere
|
||||
//
|
||||
// Implementation for G4PSphere class
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Sphere.cc
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PSphere.hh"
|
||||
#include "G4Sphere.hh"
|
||||
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "meshdefs.hh"
|
||||
|
||||
// Destructor
|
||||
G4PSphere::~G4PSphere(){
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
// make a transient object
|
||||
G4VSolid* G4PSphere::MakeTransientObject() const {
|
||||
G4VSolid* transientObject = new G4Sphere(GetName(),
|
||||
fRmin,
|
||||
fRmax,
|
||||
fSPhi,
|
||||
fDPhi,
|
||||
fSTheta,
|
||||
fDTheta);
|
||||
return transientObject;
|
||||
}
|
||||
|
||||
// constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
|
||||
// - note if pDPhi>2PI then reset to 2PI
|
||||
|
||||
G4PSphere::G4PSphere(const G4Sphere* theSphere)
|
||||
: G4PCSGSolid(theSphere->GetName())
|
||||
{
|
||||
G4double pRmin = fRmin;
|
||||
G4double pRmax = fRmax;
|
||||
G4double pSPhi = fSPhi;
|
||||
G4double pDPhi = fDPhi;
|
||||
G4double pSTheta = fSTheta;
|
||||
G4double pDTheta = fDTheta;
|
||||
|
||||
// Check radii
|
||||
if (pRmin<pRmax&&pRmin>=0)
|
||||
{
|
||||
fRmin=pRmin; fRmax=pRmax;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4PSphere::G4PSphere - invalid radii");
|
||||
}
|
||||
|
||||
// Check angles
|
||||
if (pDPhi>=2.0*M_PI)
|
||||
{
|
||||
fDPhi=2*M_PI;
|
||||
}
|
||||
else if (pDPhi>0)
|
||||
{
|
||||
fDPhi=pDPhi;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4PSphere::G4PSphere - invalid DPhi");
|
||||
}
|
||||
// Convert fSPhi to 0-2PI
|
||||
if (pSPhi<0)
|
||||
{
|
||||
fSPhi=2.0*M_PI-fmod(fabs(pSPhi),2.0*M_PI);
|
||||
}
|
||||
else
|
||||
{
|
||||
fSPhi=fmod(pSPhi,2.0*M_PI);
|
||||
}
|
||||
// Sphere is placed such that fSPhi+fDPhi>2.0*M_PI ! fSPhi could be < 0 !!? P
|
||||
if (fSPhi+fDPhi>2.0*M_PI) fSPhi-=2.0*M_PI;
|
||||
|
||||
// Check theta angles
|
||||
if (pSTheta<0 || pSTheta>M_PI)
|
||||
{
|
||||
G4Exception("Error in G4PSphere::G4PSphere - stheta outside 0-PI range");
|
||||
}
|
||||
else
|
||||
{
|
||||
fSTheta=pSTheta;
|
||||
}
|
||||
|
||||
if (pDTheta+pSTheta>=M_PI)
|
||||
{
|
||||
fDTheta=M_PI-pSTheta;
|
||||
}
|
||||
else if (pDTheta>0)
|
||||
{
|
||||
fDTheta=pDTheta;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4PSphere::G4PSphere - invalid pDTheta");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ****************************** End of G4PSphere.cc ****************************************
|
||||
@@ -0,0 +1,114 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PTorus.cc,v 2.0 1998/07/02 16:13:28 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// class G4PTorus
|
||||
//
|
||||
// Implementation
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Torus.cc
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PTorus.hh"
|
||||
#include "G4Torus.hh"
|
||||
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "meshdefs.hh"
|
||||
|
||||
// Constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
|
||||
// - note if pdphi>2PI then reset to 2PI
|
||||
G4PTorus::G4PTorus(const G4Torus* theTorus)
|
||||
: G4PCSGSolid(theTorus->GetName())
|
||||
{
|
||||
SetAllParameters(theTorus->GetRmin(),
|
||||
theTorus->GetRmax(),
|
||||
theTorus->GetRtor(),
|
||||
theTorus->GetSPhi(),
|
||||
theTorus->GetDPhi());
|
||||
}
|
||||
|
||||
void
|
||||
G4PTorus::SetAllParameters(
|
||||
G4double pRmin,
|
||||
G4double pRmax,
|
||||
G4double pRtor,
|
||||
G4double pSPhi,
|
||||
G4double pDPhi)
|
||||
{
|
||||
// Check swept radius
|
||||
if (pRtor>=pRmax)
|
||||
{
|
||||
fRtor=pRtor;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4PTorus::SetAllParameters - invalid swept radius");
|
||||
}
|
||||
|
||||
// Check radii
|
||||
if (pRmin<pRmax&&pRmin>=0)
|
||||
{
|
||||
fRmin=pRmin; fRmax=pRmax;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4PTorus::SetAllParameters - invalid radii");
|
||||
}
|
||||
|
||||
// Check angles
|
||||
if (pDPhi>=2.0*M_PI)
|
||||
{
|
||||
fDPhi=2*M_PI;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDPhi>0)
|
||||
{
|
||||
fDPhi = pDPhi;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4PTorus::SetAllParameters - invalid dphi");
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure psphi in 0-2PI or -2PI-0 range if shape crosses 0
|
||||
fSPhi = pSPhi;
|
||||
|
||||
if (fSPhi<0)
|
||||
{
|
||||
fSPhi=2.0*M_PI-fmod(fabs(fSPhi),2.0*M_PI);
|
||||
}
|
||||
else
|
||||
{
|
||||
fSPhi=fmod(fSPhi,2.0*M_PI);
|
||||
}
|
||||
|
||||
if (fSPhi+fDPhi>2.0*M_PI)
|
||||
{
|
||||
fSPhi-=2.0*M_PI;
|
||||
}
|
||||
}
|
||||
|
||||
// Destructor
|
||||
G4PTorus::~G4PTorus()
|
||||
{;}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// make a transient object
|
||||
G4VSolid* G4PTorus::MakeTransientObject() const {
|
||||
G4VSolid* transientObject = new G4Torus(GetName(),
|
||||
fRmin, fRmax,
|
||||
fRtor,
|
||||
fSPhi, fDPhi);
|
||||
return transientObject;
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PTrap.cc,v 2.1 1998/07/12 03:01:29 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PTrap
|
||||
//
|
||||
// Implementation for G4PTrap class
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Trap.cc
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PTrap.hh"
|
||||
#include "G4Trap.hh"
|
||||
|
||||
#include "G4AffineTransform.hh"
|
||||
|
||||
const G4double kCoplanar_Tolerance=1E-4;
|
||||
|
||||
// Destructor
|
||||
|
||||
G4PTrap::~G4PTrap()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
// make a transient object
|
||||
G4VSolid* G4PTrap::MakeTransientObject() const {
|
||||
G4VSolid* transientObject = new G4Trap(GetName(),
|
||||
fDx1, fDx2,
|
||||
fDy1, fDy2,
|
||||
fDz);
|
||||
return transientObject;
|
||||
}
|
||||
|
||||
// Constructor for G4Trd
|
||||
|
||||
G4PTrap::G4PTrap(const G4Trap* theTrap)
|
||||
: G4PCSGSolid(theTrap->GetName()) {
|
||||
|
||||
G4double pDx1 = theTrap->GetXHalfLength1();
|
||||
G4double pDx2 = theTrap->GetXHalfLength2();
|
||||
G4double pDy1 = theTrap->GetYHalfLength1();
|
||||
G4double pDy2 = theTrap->GetYHalfLength2();
|
||||
G4double pDz = theTrap->GetZHalfLength();
|
||||
|
||||
G4bool good;
|
||||
|
||||
if (pDz>0 && pDy1>0 && pDx1>0 && pDx2>0 && pDy2>0 )
|
||||
{
|
||||
fDz = pDz;
|
||||
fTthetaCphi = 0 ;
|
||||
fTthetaSphi = 0 ;
|
||||
|
||||
fDy1 = pDy1 ;
|
||||
fDx1 = pDx1 ;
|
||||
fDx2 = pDx1 ;
|
||||
fTalpha1 = 0 ;
|
||||
|
||||
fDy2 = pDy2 ;
|
||||
fDx3 = pDx2 ;
|
||||
fDx4 = pDx2 ;
|
||||
fTalpha2 = 0 ;
|
||||
|
||||
G4ThreeVector pt[8] ;
|
||||
|
||||
pt[0]=G4ThreeVector(-fDz*fTthetaCphi-fDy1*fTalpha1-fDx1,-fDz*fTthetaSphi-fDy1,-fDz);
|
||||
pt[1]=G4ThreeVector(-fDz*fTthetaCphi-fDy1*fTalpha1+fDx1,-fDz*fTthetaSphi-fDy1,-fDz);
|
||||
pt[2]=G4ThreeVector(-fDz*fTthetaCphi+fDy1*fTalpha1-fDx2,-fDz*fTthetaSphi+fDy1,-fDz);
|
||||
pt[3]=G4ThreeVector(-fDz*fTthetaCphi+fDy1*fTalpha1+fDx2,-fDz*fTthetaSphi+fDy1,-fDz);
|
||||
pt[4]=G4ThreeVector(+fDz*fTthetaCphi-fDy2*fTalpha2-fDx3,+fDz*fTthetaSphi-fDy2,+fDz);
|
||||
pt[5]=G4ThreeVector(+fDz*fTthetaCphi-fDy2*fTalpha2+fDx3,+fDz*fTthetaSphi-fDy2,+fDz);
|
||||
pt[6]=G4ThreeVector(+fDz*fTthetaCphi+fDy2*fTalpha2-fDx4,+fDz*fTthetaSphi+fDy2,+fDz);
|
||||
pt[7]=G4ThreeVector(+fDz*fTthetaCphi+fDy2*fTalpha2+fDx4,+fDz*fTthetaSphi+fDy2,+fDz);
|
||||
// Bottom side with normal approx. -Y
|
||||
good=MakePlane(pt[0],pt[4],pt[5],pt[1],fPlanes[0]);
|
||||
if (!good)
|
||||
{
|
||||
G4Exception("G4PTrap::G4PTrap - face at ~-Y not planar");
|
||||
|
||||
}
|
||||
// Top side with normal approx. +Y
|
||||
good=MakePlane(pt[2],pt[3],pt[7],pt[6],fPlanes[1]);
|
||||
if (!good)
|
||||
{
|
||||
G4Exception("G4PTrap::G4PTrap - face at ~+Y not planar");
|
||||
}
|
||||
// Front side with normal approx. -X
|
||||
good=MakePlane(pt[0],pt[2],pt[6],pt[4],fPlanes[2]);
|
||||
if (!good)
|
||||
{
|
||||
G4Exception("G4PTrap::G4PTrap - face at ~-X not planar");
|
||||
}
|
||||
// Back side iwth normal approx. +X
|
||||
good=MakePlane(pt[1],pt[5],pt[7],pt[3],fPlanes[3]);
|
||||
if (!good)
|
||||
{
|
||||
G4Exception("G4PTrap::G4PTrap - face at ~+X not planar");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4PTrap::G4PTrap - Invalid Length G4PTrapmeters");
|
||||
}
|
||||
}
|
||||
|
||||
// Set all parameters, as for constructor - check and set half-widths
|
||||
// as well as angles: final check of coplanarity
|
||||
|
||||
void G4PTrap::SetAllParameters ( G4double pDz,
|
||||
G4double pTheta,
|
||||
G4double pPhi,
|
||||
G4double pDy1,
|
||||
G4double pDx1,
|
||||
G4double pDx2,
|
||||
G4double pAlp1,
|
||||
G4double pDy2,
|
||||
G4double pDx3,
|
||||
G4double pDx4,
|
||||
G4double pAlp2)
|
||||
{
|
||||
if (pDz>0 && pDy1>0 && pDx1>0 && pDx2>0 && pDy2>0 && pDx3>0 && pDx4>0)
|
||||
{
|
||||
fDz=pDz;
|
||||
fTthetaCphi=tan(pTheta)*cos(pPhi);
|
||||
fTthetaSphi=tan(pTheta)*sin(pPhi);
|
||||
|
||||
fDy1=pDy1;
|
||||
fDx1=pDx1;
|
||||
fDx2=pDx2;
|
||||
fTalpha1=tan(pAlp1);
|
||||
|
||||
fDy2=pDy2;
|
||||
fDx3=pDx3;
|
||||
fDx4=pDx4;
|
||||
fTalpha2=tan(pAlp2);
|
||||
|
||||
MakePlanes();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4PTrap::SetAll - Invalid Length G4PTrapmeters");
|
||||
}
|
||||
}
|
||||
|
||||
G4bool G4PTrap::MakePlanes()
|
||||
{
|
||||
G4bool good = true;
|
||||
|
||||
G4ThreeVector pt[8] ;
|
||||
|
||||
pt[0]=G4ThreeVector(-fDz*fTthetaCphi-fDy1*fTalpha1-fDx1,-fDz*fTthetaSphi-fDy1,-fDz);
|
||||
pt[1]=G4ThreeVector(-fDz*fTthetaCphi-fDy1*fTalpha1+fDx1,-fDz*fTthetaSphi-fDy1,-fDz);
|
||||
pt[2]=G4ThreeVector(-fDz*fTthetaCphi+fDy1*fTalpha1-fDx2,-fDz*fTthetaSphi+fDy1,-fDz);
|
||||
pt[3]=G4ThreeVector(-fDz*fTthetaCphi+fDy1*fTalpha1+fDx2,-fDz*fTthetaSphi+fDy1,-fDz);
|
||||
pt[4]=G4ThreeVector(+fDz*fTthetaCphi-fDy2*fTalpha2-fDx3,+fDz*fTthetaSphi-fDy2,+fDz);
|
||||
pt[5]=G4ThreeVector(+fDz*fTthetaCphi-fDy2*fTalpha2+fDx3,+fDz*fTthetaSphi-fDy2,+fDz);
|
||||
pt[6]=G4ThreeVector(+fDz*fTthetaCphi+fDy2*fTalpha2-fDx4,+fDz*fTthetaSphi+fDy2,+fDz);
|
||||
pt[7]=G4ThreeVector(+fDz*fTthetaCphi+fDy2*fTalpha2+fDx4,+fDz*fTthetaSphi+fDy2,+fDz);
|
||||
// Bottom side with normal approx. -Y
|
||||
good=MakePlane(pt[0],pt[4],pt[5],pt[1],fPlanes[0]);
|
||||
if (!good)
|
||||
{
|
||||
G4Exception("G4PTrap::G4PTrap - face at ~-Y not planar");
|
||||
}
|
||||
// Top side with normal approx. +Y
|
||||
good=MakePlane(pt[2],pt[3],pt[7],pt[6],fPlanes[1]);
|
||||
if (!good)
|
||||
{
|
||||
G4Exception("G4PTrap::G4PTrap - face at ~+Y not planar");
|
||||
}
|
||||
// Front side with normal approx. -X
|
||||
good=MakePlane(pt[0],pt[2],pt[6],pt[4],fPlanes[2]);
|
||||
if (!good)
|
||||
{
|
||||
G4Exception("G4PTrap::G4PTrap - face at ~-X not planar");
|
||||
}
|
||||
// Back side iwth normal approx. +X
|
||||
good=MakePlane(pt[1],pt[5],pt[7],pt[3],fPlanes[3]);
|
||||
if (!good)
|
||||
{
|
||||
G4Exception("G4PTrap::G4PTrap - face at ~+X not planar");
|
||||
}
|
||||
return good;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Calculate the coef's of the plane p1->p2->p3->p4->p1
|
||||
// where the ThreeVectors 1-4 are in anti-clockwise order when viewed from
|
||||
// infront of the plane.
|
||||
//
|
||||
// Return true if the ThreeVectors are coplanar + set coef;s
|
||||
// false if ThreeVectors are not coplanar
|
||||
|
||||
G4bool G4PTrap::MakePlane( const G4ThreeVector& p1,
|
||||
const G4ThreeVector& p2,
|
||||
const G4ThreeVector& p3,
|
||||
const G4ThreeVector& p4,
|
||||
PTrapSidePlane& plane )
|
||||
{
|
||||
G4double a,b,c,s;
|
||||
G4ThreeVector v12,v13,v14,Vcross;
|
||||
|
||||
G4bool good;
|
||||
|
||||
v12 = p2-p1;
|
||||
v13 = p3-p1;
|
||||
v14 = p4-p1;
|
||||
Vcross=v12.cross(v13);
|
||||
|
||||
if (fabs(Vcross.dot(v14)/(Vcross.mag()*v14.mag()))>kCoplanar_Tolerance)
|
||||
{
|
||||
good=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// a,b,c correspond to the x/y/z components of the normal vector to the plane
|
||||
|
||||
// a=(p2.y()-p1.y())*(p1.z()+p2.z())+(p3.y()-p2.y())*(p2.z()+p3.z());
|
||||
// a+=(p4.y()-p3.y())*(p3.z()+p4.z())+(p1.y()-p4.y())*(p4.z()+p1.z()); // may be delete ?
|
||||
|
||||
// b=(p2.z()-p1.z())*(p1.x()+p2.x())+(p3.z()-p2.z())*(p2.x()+p3.x());
|
||||
// b+=(p4.z()-p3.z())*(p3.x()+p4.x())+(p1.z()-p4.z())*(p4.x()+p1.x()); // ?
|
||||
|
||||
// c=(p2.x()-p1.x())*(p1.y()+p2.y())+(p3.x()-p2.x())*(p2.y()+p3.y());
|
||||
// c+=(p4.x()-p3.x())*(p3.y()+p4.y())+(p1.x()-p4.x())*(p4.y()+p1.y()); // ?
|
||||
// Let create diagonals 4-2 and 3-1 than (4-2)x(3-1) provides vector perpendicular to the
|
||||
// plane directed to outside !!! and a,b,c, = f(1,2,3,4)
|
||||
a = +(p4.y() - p2.y())*(p3.z() - p1.z()) - (p3.y() - p1.y())*(p4.z() - p2.z()) ;
|
||||
b = -(p4.x() - p2.x())*(p3.z() - p1.z()) + (p3.x() - p1.x())*(p4.z() - p2.z()) ;
|
||||
c = +(p4.x() - p2.x())*(p3.y() - p1.y()) - (p3.x() - p1.x())*(p4.y() - p2.y()) ;
|
||||
s=sqrt(a*a+b*b+c*c); // so now vector plane.(a,b,c) is unit
|
||||
plane.a=a/s;
|
||||
plane.b=b/s;
|
||||
plane.c=c/s;
|
||||
// Calculate D: p1 in in plane so D=-n.p1.Vect()
|
||||
|
||||
plane.d=-(plane.a*p1.x()+plane.b*p1.y()+plane.c*p1.z());
|
||||
good=true;
|
||||
}
|
||||
return good;
|
||||
}
|
||||
|
||||
|
||||
// ******************************** End of G4PTrap.cc ********************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PTrd.cc,v 2.0 1998/07/02 16:13:29 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Implementation for G4Trd class
|
||||
//
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Trd.cc
|
||||
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PTrd.hh"
|
||||
#include "G4Trd.hh"
|
||||
|
||||
#include "G4AffineTransform.hh"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
// Constructor - check & set half widths
|
||||
|
||||
G4PTrd::G4PTrd(const G4Trd* theTrd) : G4PCSGSolid(theTrd->GetName())
|
||||
{
|
||||
G4double pdx1 = theTrd->GetXHalfLength1();
|
||||
G4double pdx2 = theTrd->GetXHalfLength2();
|
||||
G4double pdy1 = theTrd->GetYHalfLength1();
|
||||
G4double pdy2 = theTrd->GetYHalfLength2();
|
||||
G4double pdz = theTrd->GetZHalfLength();
|
||||
CheckAndSetAllParameters (pdx1, pdx2, pdy1, pdy2, pdz);
|
||||
}
|
||||
|
||||
void
|
||||
G4PTrd::CheckAndSetAllParameters (G4double pdx1, G4double pdx2,
|
||||
G4double pdy1, G4double pdy2,
|
||||
G4double pdz) {
|
||||
if (pdx1>0&&pdx2>0&&pdy1>0&&pdy2>0&&pdz>0)
|
||||
{
|
||||
fDx1=pdx1; fDx2=pdx2;
|
||||
fDy1=pdy1; fDy2=pdy2;
|
||||
fDz=pdz;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pdx1>=0 && pdx2>=0 && pdy1>=0 && pdy2>=0 && pdz>=0)
|
||||
{
|
||||
// G4double Minimum_length= (1+per_thousand) * kCarTolerance/2.;
|
||||
// FIX-ME : temporary solution for ZERO or very-small parameters.
|
||||
G4double Minimum_length= kCarTolerance/2.;
|
||||
fDx1=max(pdx1,Minimum_length);
|
||||
fDx2=max(pdx2,Minimum_length);
|
||||
fDy1=max(pdy1,Minimum_length);
|
||||
fDy2=max(pdy2,Minimum_length);
|
||||
fDz=max(pdz,Minimum_length);
|
||||
}
|
||||
else
|
||||
G4Exception("Error in G4PTrd::G4PTrd - One or more parameters are < 0");
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// Destructor
|
||||
|
||||
G4PTrd::~G4PTrd()
|
||||
{}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// make a transient object
|
||||
G4VSolid* G4PTrd::MakeTransientObject() const {
|
||||
G4VSolid* transientObject = new G4Trd(GetName(),
|
||||
fDx1, fDx2,
|
||||
fDy1, fDy2,
|
||||
fDz);
|
||||
return transientObject;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PTubs.cc,v 2.0 1998/07/02 16:13:31 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// class G4PTubs
|
||||
//
|
||||
// History:
|
||||
// 19.06.98 A.Kimura Converted G4Tubs.cc
|
||||
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PTubs.hh"
|
||||
#include "G4Tubs.hh"
|
||||
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "meshdefs.hh"
|
||||
|
||||
// Constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI
|
||||
// - note if pdphi>2PI then reset to 2PI
|
||||
G4PTubs::G4PTubs(const G4Tubs* theTubs) : G4PCSGSolid(theTubs->GetName()) {
|
||||
|
||||
G4double pRMin = theTubs->GetInnerRadius();
|
||||
G4double pRMax = theTubs->GetOuterRadius();
|
||||
G4double pDz = theTubs->GetZHalfLength();
|
||||
G4double pSPhi = theTubs->GetStartPhiAngle();
|
||||
G4double pDPhi = theTubs->GetDeltaPhiAngle();
|
||||
|
||||
// Check z-len
|
||||
if (pDz>0)
|
||||
{
|
||||
fDz=pDz;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4PTubs::G4PTubs - invalid z half-length");
|
||||
}
|
||||
|
||||
// Check radii
|
||||
if (pRMin<pRMax&&pRMin>=0)
|
||||
{
|
||||
fRMin=pRMin; fRMax=pRMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4PTubs::G4PTubs - invalid radii");
|
||||
}
|
||||
|
||||
// Check angles
|
||||
if (pDPhi>=2.0*M_PI)
|
||||
{
|
||||
fDPhi=2*M_PI;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDPhi>0)
|
||||
{
|
||||
fDPhi = pDPhi;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("Error in G4PTubs::G4PTubs - invalid dphi");
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure psphi in 0-2PI or -2PI-0 range if shape crosses 0
|
||||
fSPhi = pSPhi;
|
||||
|
||||
if (fSPhi<0)
|
||||
{
|
||||
fSPhi=2.0*M_PI-fmod(fabs(fSPhi),2.0*M_PI);
|
||||
}
|
||||
else
|
||||
{
|
||||
fSPhi=fmod(fSPhi,2.0*M_PI);
|
||||
}
|
||||
|
||||
if (fSPhi+fDPhi>2.0*M_PI)
|
||||
{
|
||||
fSPhi-=2.0*M_PI;
|
||||
}
|
||||
}
|
||||
|
||||
// Destructor
|
||||
G4PTubs::~G4PTubs()
|
||||
{;}
|
||||
|
||||
// make a transient object
|
||||
G4VSolid* G4PTubs::MakeTransientObject() const {
|
||||
G4VSolid* transientObject = new G4Tubs(GetName(),
|
||||
fRMin, fRMax,
|
||||
fDz,
|
||||
fSPhi, fDPhi);
|
||||
return transientObject;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
name := G4pvol
|
||||
G4ODBMS := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../../..
|
||||
endif
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
# $(G4TMPDIR) will be overriden in common.gmk later.
|
||||
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
|
||||
|
||||
CPPFLAGS += \
|
||||
-Iinclude \
|
||||
-I$(G4TMPDIR) \
|
||||
-I../management/include \
|
||||
-I$(G4TMP)/$(G4SYSTEM)/G4pgeomn \
|
||||
-I$(G4INSTALL)/source/persistency/management/include \
|
||||
-I$(G4INSTALL)/source/run/include \
|
||||
-I$(G4INSTALL)/source/global/management/include \
|
||||
-I$(G4INSTALL)/source/global/HEPRandom/include \
|
||||
-I$(G4INSTALL)/source/global/HEPGeometry/include \
|
||||
-I$(G4INSTALL)/source/geometry/management/include \
|
||||
-I$(G4INSTALL)/source/geometry/magneticfield/include \
|
||||
-I$(G4INSTALL)/source/geometry/volumes/include \
|
||||
-I$(G4INSTALL)/source/geometry/solids/CSG/include \
|
||||
-I$(G4INSTALL)/source/materials/include \
|
||||
-I$(G4INSTALL)/source/graphics_reps/include
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
include $(G4INSTALL)/config/G4ODBMS_BUILD.gmk
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PLogicalVolume.ddl,v 2.3 1998/07/12 03:01:31 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// class G4PLogicalVolume
|
||||
// P-verson of the class G4LogicalVolume
|
||||
// Takashi.Sasaki@kek.jp
|
||||
#ifndef G4PLOGICALVOLUME_DDL
|
||||
#define G4PLOGICALVOLUME_DDL 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4PersistentTypes.hh"
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
|
||||
#include "G4PVSolid.hh"
|
||||
|
||||
// Forward declarations
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
class G4VSolid;
|
||||
|
||||
#include "G4PVPhysicalVolume.hh"
|
||||
#include "G4PVPhysVolRefVArray.hh"
|
||||
|
||||
class G4PLogicalVolume: public HepPersObj
|
||||
{
|
||||
public:
|
||||
G4PLogicalVolume( const G4LogicalVolume* aLogicalVolume,
|
||||
HepRef(G4PVSolid) persSolid);
|
||||
~G4PLogicalVolume();
|
||||
|
||||
G4LogicalVolume* MakeTransientObject(G4VSolid* aSolid);
|
||||
|
||||
HepRef(G4PVSolid) GetSolid();
|
||||
void SetSolid( HepRef(G4PVSolid) pSolid );
|
||||
|
||||
public:
|
||||
G4int GetNoDaughters() const;
|
||||
HepRef(G4PVPhysicalVolume) GetDaughter(const G4int i) const;
|
||||
void AddDaughter(HepRef(G4PVPhysicalVolume) p);
|
||||
G4bool IsDaughter(const HepRef(G4PVPhysicalVolume) p) const;
|
||||
void RemoveDaughter(const HepRef(G4PVPhysicalVolume) p);
|
||||
|
||||
private:
|
||||
G4PVPhysVolRefVArray fDaughters;
|
||||
// G4MagneticField* fMagneticField;
|
||||
// G4Material* fMaterial;
|
||||
G4PString fName;
|
||||
// G4VSensitiveDetector *fSensitiveDetector;
|
||||
ooRef(G4PVSolid) fSolid;
|
||||
// G4UserLimits* fUserLimits;
|
||||
// G4SmartVoxelHeader* fVoxel;
|
||||
// const G4VisAttributes* fVisAttributes;
|
||||
// G4FastSimulationManager* fFastSimulationManager;
|
||||
// G4bool fIsEnvelope;
|
||||
|
||||
G4Pint NoOfDaughters;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,154 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PLogicalVolume.cc,v 2.3 1998/07/15 07:08:59 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Takashi.Sasaki@kek.jp
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PVSolid.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PLogicalVolume.hh"
|
||||
#include "G4PVPhysicalVolume.hh"
|
||||
#include "HepODBMS/clustering/HepClustering.h"
|
||||
|
||||
implement(HepRefVArray,G4PVPhysicalVolume)
|
||||
|
||||
G4PLogicalVolume::G4PLogicalVolume(
|
||||
const G4LogicalVolume* aLogicalVolume,
|
||||
HepRef(G4PVSolid) persSolid)
|
||||
: NoOfDaughters(0)
|
||||
{
|
||||
// Construct persistent logical volume based on the information of
|
||||
// the transient logical volume aLogicalVolume.
|
||||
// It assumes a persistent persSolid has already been created.
|
||||
// Note that daughter volumes will be set by G4PersistencyManager.
|
||||
|
||||
fName = aLogicalVolume->GetName();
|
||||
// *fSensitiveDetector = LogicalVolume->GetSensitiveDetector();
|
||||
fSolid = persSolid;
|
||||
// *fUserLimits = LogicalVolume->GetUserLimits();
|
||||
// *fVoxel = LogicalVolume->GetVoxelHeader();
|
||||
// *fVisAttributes = LogivalVolume->GetVisAttributes();
|
||||
// *fFastSimulationManager = LogicalVolume->GetFastSimulationManager();
|
||||
// *fIsEnvelops = LogicalVolume->GetIsEnvelope();
|
||||
|
||||
}
|
||||
|
||||
G4PLogicalVolume::~G4PLogicalVolume()
|
||||
{
|
||||
// ~G4PLogicalVolume() deletes the persistent Logical Volume permanently
|
||||
// from the database (as well as from the memory).
|
||||
|
||||
// need to de-reference HepRef's in persistent Physics Volume here.
|
||||
// ....
|
||||
|
||||
HepRef(G4PLogicalVolume) aVol = ooThis();
|
||||
|
||||
HepDelete(aVol);
|
||||
}
|
||||
|
||||
|
||||
//#include "G4MagneticField.hh"
|
||||
//#include "G4Material.hh"
|
||||
//#include "G4VSensitiveDetector.hh"
|
||||
//#include "G4VSolid.hh"
|
||||
//#include "G4UserLimits.hh"
|
||||
//#include "G4SmartVoxelHeader.hh"
|
||||
//#include "G4VisAttributes.hh"
|
||||
//#include "G4FastSimulationManager.hh"
|
||||
|
||||
class G4MagneticField;
|
||||
class G4Material;
|
||||
class G4VSensitiveDetector;
|
||||
class G4VSolid;
|
||||
class G4UserLimits;
|
||||
class G4SmartVoxelHeader;
|
||||
class G4VisAttributes;
|
||||
class G4FastSimulationManager;
|
||||
|
||||
G4LogicalVolume* G4PLogicalVolume::MakeTransientObject(G4VSolid* theSolid)
|
||||
{
|
||||
// These are null poineters temporaly
|
||||
G4Material* fMaterial = NULL;
|
||||
G4SmartVoxelHeader* fVoxel = NULL;
|
||||
const G4VisAttributes* fVisAttributes = NULL;
|
||||
|
||||
// G4LogicalVolume(G4VSolid *pSolid, G4Material *pMaterial,
|
||||
// const G4String& name,
|
||||
// G4MagneticField *pField=0,
|
||||
// G4VSensitiveDetector *pSDetector=0,
|
||||
// G4UserLimits *pULimits=0);
|
||||
|
||||
//--------- Material definition ---------
|
||||
//
|
||||
// G4double a, iz, z, density;
|
||||
//
|
||||
// a = 207.19*g/mole;
|
||||
// density = 11.35*g/cm3;
|
||||
// G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
|
||||
//
|
||||
// G4LogicalVolume* testvolume = new G4LogicalVolume(
|
||||
// theSolid, Pb, fName, 0, 0, 0);
|
||||
//
|
||||
//--------- Material definition ---------
|
||||
|
||||
G4String name;
|
||||
G4LogicalVolume* aLogicalVolume = new G4LogicalVolume(
|
||||
theSolid, fMaterial, name=fName, 0, 0, 0);
|
||||
|
||||
// if ( aLogicalVolume )
|
||||
// aLogicalVume->SetVisAttributes(*fVisAttributes);
|
||||
|
||||
return aLogicalVolume;
|
||||
}
|
||||
//////////////////////////
|
||||
|
||||
G4int G4PLogicalVolume::GetNoDaughters() const
|
||||
{
|
||||
// return fDaughters.entries();
|
||||
return NoOfDaughters;
|
||||
}
|
||||
|
||||
HepRef(G4PVPhysicalVolume) G4PLogicalVolume::GetDaughter(const G4int i) const
|
||||
{
|
||||
return fDaughters[i-1];
|
||||
}
|
||||
|
||||
void G4PLogicalVolume::AddDaughter(HepRef(G4PVPhysicalVolume) p)
|
||||
{
|
||||
fDaughters.insert(p);
|
||||
NoOfDaughters++;
|
||||
}
|
||||
|
||||
G4bool G4PLogicalVolume::IsDaughter(const HepRef(G4PVPhysicalVolume) p) const
|
||||
{
|
||||
for ( G4int i=0; i<NoOfDaughters; i++)
|
||||
if ( fDaughters[i-1] == p )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void G4PLogicalVolume::RemoveDaughter(const HepRef(G4PVPhysicalVolume) p)
|
||||
{
|
||||
for ( G4int i=0; i<NoOfDaughters; i++)
|
||||
if ( fDaughters[i-1] == p )
|
||||
fDaughters.removeAt(i);
|
||||
}
|
||||
|
||||
HepRef(G4PVSolid) G4PLogicalVolume::GetSolid()
|
||||
{
|
||||
return fSolid;
|
||||
}
|
||||
|
||||
void G4PLogicalVolume::SetSolid(HepRef(G4PVSolid) pSolid)
|
||||
{
|
||||
fSolid = pSolid;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
# $Id: GNUmakefile,v 2.5 1998/11/09 17:07:16 morita Exp $
|
||||
|
||||
name := G4pmanagement
|
||||
G4ODBMS := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
# $(G4TMPDIR) will be overrided in common.gmk later.
|
||||
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
|
||||
|
||||
CPPFLAGS += \
|
||||
-Iinclude \
|
||||
-I$(G4TMPDIR) \
|
||||
-I../geometry/management/include \
|
||||
-I$(G4TMP)/$(G4SYSTEM)/G4pgeomn \
|
||||
-I../geometry/volumes/include \
|
||||
-I$(G4TMP)/$(G4SYSTEM)/G4pvol \
|
||||
-I../geometry/solids/CSG/include \
|
||||
-I$(G4TMP)/$(G4SYSTEM)/G4pcsg \
|
||||
-I../events/include \
|
||||
-I$(G4TMP)/$(G4SYSTEM)/G4pevents \
|
||||
-I$(G4TMP)/$(G4SYSTEM)/G4prun \
|
||||
-I$(G4INSTALL)/source/run/include \
|
||||
-I$(G4INSTALL)/source/event/include \
|
||||
-I$(G4INSTALL)/source/global/management/include \
|
||||
-I$(G4INSTALL)/source/global/HEPRandom/include \
|
||||
-I$(G4INSTALL)/source/global/HEPGeometry/include \
|
||||
-I$(G4INSTALL)/source/geometry/management/include \
|
||||
-I$(G4INSTALL)/source/geometry/volumes/include \
|
||||
-I$(G4INSTALL)/source/geometry/solids/CSG/include \
|
||||
-I$(G4INSTALL)/source/events+tracks/include \
|
||||
-I$(G4INSTALL)/source/processes/management/include \
|
||||
-I$(G4INSTALL)/source/materials/include \
|
||||
-I$(G4INSTALL)/source/particles/management/include \
|
||||
-I$(G4INSTALL)/source/graphics_reps/include \
|
||||
-I$(G4INSTALL)/source/tracking/include \
|
||||
-I$(G4INSTALL)/source/track/include \
|
||||
-I$(G4INSTALL)/source/digits+hits/detector/include \
|
||||
-I$(G4INSTALL)/source/digits+hits/hits/include \
|
||||
-I$(G4INSTALL)/source/digits+hits/digits/include
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
include $(G4INSTALL)/config/G4ODBMS_BUILD.gmk
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Explicit DDL dependencies:
|
||||
# G4PEvent.ddl includes G4PPrimaryVertex.hh, so G4PPrimaryVertex.hh
|
||||
# should be created before G4PEvent.hh.
|
||||
|
||||
$(G4TMPDIR)/G4PEvent.hh: $(G4TMPDIR)/G4PPrimaryVertex.hh
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PGeometryObjectMap.ddl,v 2.5 1998/07/14 14:12:35 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PGeometryObjectMap
|
||||
//
|
||||
// A Class responsible for keeping track of the geometry object map.
|
||||
//
|
||||
// This class is persistent-capable.
|
||||
//
|
||||
// Member functions:
|
||||
// =================
|
||||
// G4PGeometryObjectMap( G4PString theGeometryName );
|
||||
// ~G4PGeometryObjectMap();
|
||||
//
|
||||
// protected:
|
||||
// G4PVPhysicalVolume* LookUp( G4VPhysicalVolume* aPhysVol );
|
||||
// void Add( const G4VPhysicalVolume* aPhysVol,
|
||||
// const G4PVPhysicalVolume* persPhysVol );
|
||||
// G4PLogicalVolume* LookUp(G4LogicalVolume* aLogVol);
|
||||
// void Add( const G4LogicalVolume* aLogVol,
|
||||
// const G4PLogicalVolume* persLogVol );
|
||||
// G4PVSolid* LookUp(G4VSolid* aSolid);
|
||||
// void Add( const G4VSolid* aSolid,
|
||||
// const G4PVSolid* persSolid );
|
||||
// G4int GetNoSolids();
|
||||
// G4VSolid* GetSolid(G4int n);
|
||||
// G4PVSolid* GetPSolid(G4int n);
|
||||
//
|
||||
// Note:
|
||||
// =====
|
||||
// This class contains RWTPtrVector of the transient classes.
|
||||
// As a result, ooddlx compiler will issue warnings as follows, but it's okay.
|
||||
// The value of RWTPtrVector is used only in transient case
|
||||
// in this class, and you can safely ignore these warnings.
|
||||
// ----
|
||||
// "include/G4PGeometryObjectMap.ddl", line xxx: warning: persistent-capable
|
||||
// class member type is a problem
|
||||
// The type of base class RWPtrVector is a problem
|
||||
// The type of member RWPtrVector::array_ is pointer
|
||||
// The type of base class RWTPtrVector<G4VPhysicalVolume > is a
|
||||
// problem
|
||||
// The type of base class RWPtrVector is a problem
|
||||
// G4PhysVolRefVArray transPhysVolPtrs;
|
||||
// ^
|
||||
// ----
|
||||
//
|
||||
//
|
||||
// History:
|
||||
// 98.06.20 Y.Morita Initial version
|
||||
|
||||
#ifndef G4PGeometryObjectMap_h
|
||||
#define G4PGeometryObjectMap_h 1
|
||||
|
||||
#include <rw/tpordvec.h>
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PersistentTypes.hh"
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
|
||||
#include "G4PVPhysicalVolume.hh"
|
||||
#include "G4PVPhysVolRefVArray.hh"
|
||||
#include "G4PLogicalVolume.hh"
|
||||
#include "G4PLogVolRefVArray.hh"
|
||||
#include "G4PVSolid.hh"
|
||||
#include "G4PVSolidRefVArray.hh"
|
||||
|
||||
typedef RWTPtrVector<G4VPhysicalVolume> G4VPhysVolRefVArray;
|
||||
typedef RWTPtrVector<G4LogicalVolume> G4LogVolRefVArray;
|
||||
typedef RWTPtrVector<G4VSolid> G4VSolidRefVArray;
|
||||
|
||||
class G4PGeometryObjectMap
|
||||
: public HepPersObj
|
||||
{
|
||||
public:
|
||||
G4PGeometryObjectMap();
|
||||
G4PGeometryObjectMap( const G4String theGeometryName );
|
||||
~G4PGeometryObjectMap();
|
||||
|
||||
// template cannot be used in class scope!!
|
||||
// template<class T_IN, class T_OUT> T_OUT LookUp( const T_IN aGeomObj );
|
||||
|
||||
HepRef(G4PVPhysicalVolume) LookUp( G4VPhysicalVolume* aPhysVol );
|
||||
G4VPhysicalVolume* LookUp( HepRef(G4PVPhysicalVolume) aPhysVol );
|
||||
HepRef(G4PLogicalVolume) LookUp( G4LogicalVolume* aLogVol);
|
||||
G4LogicalVolume* LookUp( HepRef(G4PLogicalVolume) aLogVol);
|
||||
HepRef(G4PVSolid) LookUp( G4VSolid* aSolid);
|
||||
G4VSolid* LookUp( HepRef(G4PVSolid) persSolid);
|
||||
|
||||
void Add( G4VPhysicalVolume* aPhysVol,
|
||||
HepRef(G4PVPhysicalVolume) persPhysVol );
|
||||
void Add( HepRef(G4PVPhysicalVolume) persPhysVol,
|
||||
G4VPhysicalVolume* aPhysVol );
|
||||
void Add( G4LogicalVolume* aLogVol,
|
||||
HepRef(G4PLogicalVolume) persLogVol );
|
||||
void Add( HepRef(G4PLogicalVolume) persLogVol,
|
||||
G4LogicalVolume* aLogVol );
|
||||
void Add( G4VSolid* aSolid,
|
||||
HepRef(G4PVSolid) persSolid );
|
||||
void Add( HepRef(G4PVSolid) persSolid,
|
||||
G4VSolid* aSolid );
|
||||
|
||||
inline void SetWorldVolume( const HepRef(G4PVPhysicalVolume) aWorld )
|
||||
{ thePersistentWorldVolume = aWorld; }
|
||||
inline HepRef(G4PVPhysicalVolume) GetWorldVolume()
|
||||
{ return thePersistentWorldVolume; }
|
||||
|
||||
inline G4int GetNoPhysVol() const { return noPhysVol; }
|
||||
inline G4int GetNoLogVol() const { return noLogVol; }
|
||||
inline G4int GetNoSolids() const { return noSolids; }
|
||||
|
||||
G4VSolid* GetSolid(G4int n);
|
||||
HepRef(G4PVSolid) GetPSolid(G4int n);
|
||||
|
||||
void InitTransientMap();
|
||||
|
||||
private:
|
||||
// World Volume of this Geometry object tree
|
||||
ooRef(G4PVPhysicalVolume) thePersistentWorldVolume;
|
||||
|
||||
// Physics Volume Pointer Array
|
||||
G4Pint noPhysVol;
|
||||
G4VPhysVolRefVArray transPhysVolPtrs;
|
||||
G4PVPhysVolRefVArray persPhysVolPtrs;
|
||||
|
||||
// Logical Volume Pointer Array
|
||||
G4Pint noLogVol;
|
||||
G4LogVolRefVArray transLogVolPtrs;
|
||||
G4PLogVolRefVArray persLogVolPtrs;
|
||||
|
||||
// Solid Pointer Array
|
||||
G4Pint noSolids;
|
||||
G4VSolidRefVArray transSolidPtrs;
|
||||
G4PVSolidRefVArray persSolidPtrs;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// G4PLogVolRefVArray.hh
|
||||
//
|
||||
// HepRefVArray typedefs for Geant4/Persistency category
|
||||
//
|
||||
// It is the user's responsibility to include header files
|
||||
// of classes G4PLogicalVolume.hh _before_ including this file.
|
||||
//
|
||||
// History:
|
||||
// 09.07.98 Y.Morita - Created
|
||||
|
||||
#ifndef G4PLOGVOLREFVARRAY_HH
|
||||
#define G4PLOGVOLREFVARRAY_HH 1
|
||||
|
||||
#include "HepODBMS/odbms/HepRefVArray.h"
|
||||
|
||||
declare(HepRefVArray,G4PLogicalVolume)
|
||||
typedef HepRefVArray(G4PLogicalVolume) G4PLogVolRefVArray;
|
||||
|
||||
#endif /* G4PLOGVOLREFVARRAY_HH */
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// G4PVPhysVolRefVArray.hh
|
||||
//
|
||||
// HepRefVArray typedefs for Geant4/Persistency category
|
||||
//
|
||||
// It is the user's responsibility to include header files
|
||||
// of classes G4PVPhysicalVolume.hh _before_ including this file.
|
||||
//
|
||||
// History:
|
||||
// 09.07.98 Y.Morita - Created
|
||||
|
||||
#ifndef G4PVPHYSVOLREFVARRAY_HH
|
||||
#define G4PVPHYSVOLREFVARRAY_HH 1
|
||||
|
||||
#include "HepODBMS/odbms/HepRefVArray.h"
|
||||
|
||||
declare(HepRefVArray,G4PVPhysicalVolume)
|
||||
typedef HepRefVArray(G4PVPhysicalVolume) G4PVPhysVolRefVArray;
|
||||
|
||||
#endif /* G4PVPHYSVOLREFVARRAY_HH */
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// G4PVSolidRefVArray.hh
|
||||
//
|
||||
// HepRefVArray typedefs for Geant4/Persistency category
|
||||
//
|
||||
// It is the user's responsibility to include header files
|
||||
// of classes G4PVSolid.hh _before_ including this file.
|
||||
//
|
||||
// History:
|
||||
// 09.07.98 Y.Morita - Created
|
||||
|
||||
#ifndef G4PVSOLIDREFVARRAY_HH
|
||||
#define G4PVSOLIDREFVARRAY_HH 1
|
||||
|
||||
#include "HepODBMS/odbms/HepRefVArray.h"
|
||||
|
||||
declare(HepRefVArray,G4PVSolid)
|
||||
typedef HepRefVArray(G4PVSolid) G4PVSolidRefVArray;
|
||||
|
||||
#endif /* G4PVSOLIDREFVARRAY_HH */
|
||||
@@ -0,0 +1,103 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PersistencyManager.hh,v 2.5 1998/11/09 17:21:42 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PersistencyManager
|
||||
//
|
||||
// A Class responsible for storing and retrieving the run, event,
|
||||
// Hit and geometry objects into ODBMS using HepODBMS interface.
|
||||
//
|
||||
// The class is `singleton', with access via
|
||||
// G4PersistencyManager::GetPersistencyManager.
|
||||
//
|
||||
// This class itself is not persistent-capable.
|
||||
//
|
||||
// Member functions:
|
||||
// =================
|
||||
// static G4PersistencyManager* GetPersistencyManager();
|
||||
// static G4PersistencyManager* get_PersistencyManagerIfExist();
|
||||
// Return ptr to singleton instance of the class.
|
||||
//
|
||||
// G4bool Store(const G4Event* anEvent);
|
||||
// Store anEvent and associated objects into a database.
|
||||
// G4bool Store(const G4Run* aRun);
|
||||
// Store aRun and associated objects into a database.
|
||||
// G4bool Store(const G4VPhysicalVolume* aWorld);
|
||||
// Store aWorld and entire geometry object tree into a database.
|
||||
//
|
||||
// G4bool Retrieve(G4Event*& anEvent);
|
||||
// Retrieve anEvent and associated objects from a database.
|
||||
// G4bool Retrieve(G4Run*& aRun);
|
||||
// Retrieve aRun and associated objects from a database.
|
||||
// G4bool Retrieve(G4VPhysicalVolume*& aWorld);
|
||||
// Retrieve aWorld and entire geometry object tree from a database.
|
||||
//
|
||||
// Member data:
|
||||
// ============
|
||||
// static G4PersistencyManager* fPersistencyManager
|
||||
// Ptr to the unique instance of class
|
||||
//
|
||||
// History:
|
||||
// 98.01.08 Y.Morita Initial version
|
||||
// 98.06.20 Y.Morita Implement geometry Store and Retrieve
|
||||
// 98.10.30 Y.Morita Splitted into event/run/geometry utility classes
|
||||
|
||||
#ifndef G4PERSISTENCYMANAGER_HH
|
||||
#define G4PERSISTENCYMANAGER_HH 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VPersistencyManager.hh"
|
||||
|
||||
#include "G4PersistentEventMan.hh"
|
||||
#include "G4PersistentRunMan.hh"
|
||||
#include "G4PersistentGeomMan.hh"
|
||||
|
||||
////#include "HepODBMS/clustering/HepContainerHint.h"
|
||||
#include "HepODBMS/clustering/HepDbApplication.h"
|
||||
|
||||
class G4PersistencyManager
|
||||
: public G4VPersistencyManager
|
||||
{
|
||||
public:
|
||||
static G4PersistencyManager* GetPersistencyManager();
|
||||
static G4PersistencyManager* get_PersistencyManagerIfExist();
|
||||
G4PersistencyManager();
|
||||
|
||||
public:
|
||||
~G4PersistencyManager();
|
||||
|
||||
private:
|
||||
HepDbApplication* dbApp;
|
||||
|
||||
// static HepRef(NamedNode) namedRoot;
|
||||
// static NamedObjectTree*
|
||||
|
||||
private:
|
||||
static G4PersistencyManager * f_PersistencyManager;
|
||||
|
||||
public:
|
||||
G4bool Store(const G4Event* anEvent);
|
||||
G4bool Store(const G4Run* aRun);
|
||||
G4bool Store(const G4VPhysicalVolume* aWorld);
|
||||
|
||||
G4bool Retrieve(G4Event*& anEvent);
|
||||
G4bool Retrieve(G4Run*& aRun);
|
||||
G4bool Retrieve(G4VPhysicalVolume*& aWorld);
|
||||
|
||||
// Utility Classes
|
||||
private:
|
||||
G4PersistentEventMan f_pEventMan;
|
||||
G4PersistentRunMan f_pRunMan;
|
||||
G4PersistentGeomMan f_pGeomMan;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PersistentEventMan.hh,v 2.1 1998/11/09 17:19:04 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PersistentEventMan
|
||||
//
|
||||
// A Utility class for storing and retrieving the event objects.
|
||||
//
|
||||
// This class is not persistent-capable.
|
||||
//
|
||||
// Member functions:
|
||||
// =================
|
||||
// G4bool Store(const G4Event* anEvent);
|
||||
// Store anEvent and associated objects into database.
|
||||
// G4bool Retrieve(G4Event*& anEvent);
|
||||
// Retrieve anEvent and associated objects into database.
|
||||
// G4Bool LocateDB( HepDBApplication* dbApp,
|
||||
// const G4String eventDBName );
|
||||
// Create and locate event database and container.
|
||||
//
|
||||
// Member data:
|
||||
// ============
|
||||
// HepDatabaseRef f_EventDB;
|
||||
// Reference to the event database.
|
||||
// HepContainerRef f_EventContainer;
|
||||
// Reference to the event container in the database.
|
||||
//
|
||||
// History:
|
||||
// 98.10.30 Y.Morita Splited from G4PersistencyManager
|
||||
|
||||
#ifndef G4PERSISTENTEVENTMAN_H
|
||||
#define G4PERSISTENTEVENTMAN_H 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "HepODBMS/clustering/HepDbApplication.h"
|
||||
|
||||
class G4Event;
|
||||
|
||||
class G4PersistentEventMan
|
||||
{
|
||||
public:
|
||||
G4PersistentEventMan();
|
||||
~G4PersistentEventMan();
|
||||
HepDatabaseRef GetDB();
|
||||
HepContainerRef GetContainer();
|
||||
G4bool LocateDB( HepDbApplication* dbApp,
|
||||
const G4String eventDBName );
|
||||
|
||||
private:
|
||||
HepDatabaseRef f_EventDB;
|
||||
HepContainerRef f_EventContainer;
|
||||
|
||||
public:
|
||||
G4bool Store( HepDbApplication* dbApp,
|
||||
const G4Event* anEvent );
|
||||
G4bool Retrieve( HepDbApplication* dbApp,
|
||||
G4Event*& anEvent );
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PersistentGeomMan.hh,v 2.2 1998/11/10 18:23:41 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PersistentGeomMan
|
||||
//
|
||||
// A Utility class for storing and retrieving the geometry objects.
|
||||
//
|
||||
// This class is not persistent-capable.
|
||||
//
|
||||
// Member functions:
|
||||
// =================
|
||||
//
|
||||
//
|
||||
// Member data:
|
||||
// ============
|
||||
// static G4PersistentGeomMan* fPersistencyManager
|
||||
// Ptr to the unique instance of class
|
||||
//
|
||||
// History:
|
||||
// 98.10.30 Y.Morita Splited from G4PersistencyManager
|
||||
|
||||
#ifndef G4PERSISTENTGEOMMAN_H
|
||||
#define G4PERSISTENTGEOMMAN_H 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "geomdefs.hh"
|
||||
|
||||
#include "HepODBMS/clustering/HepDbApplication.h"
|
||||
|
||||
#define G4_PHYS_VOLUME_DEPTH_MAX 1000000
|
||||
|
||||
class G4VSolid;
|
||||
class G4PEvent;
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
class G4PVPhysicalVolume;
|
||||
class G4PLogicalVolume;
|
||||
class G4PVSolid;
|
||||
|
||||
#include "G4PGeometryObjectMap.hh"
|
||||
|
||||
|
||||
class G4PersistentGeomMan
|
||||
{
|
||||
public:
|
||||
G4PersistentGeomMan();
|
||||
~G4PersistentGeomMan();
|
||||
|
||||
private:
|
||||
HepDatabaseRef f_GeomDB;
|
||||
HepContainerRef f_GeomContainer;
|
||||
HepRef(G4PGeometryObjectMap) f_GeomMap;
|
||||
|
||||
public:
|
||||
G4bool Store( HepDbApplication* dbApp,
|
||||
const G4VPhysicalVolume* aWorld );
|
||||
G4bool Retrieve( HepDbApplication* dbApp,
|
||||
G4VPhysicalVolume*& aWorld );
|
||||
|
||||
private:
|
||||
// Characterise `type' of volume - normal/replicated/parameterised
|
||||
EVolume VolumeType(const G4VPhysicalVolume *pVol) const;
|
||||
|
||||
HepRef(G4PVPhysicalVolume) MakePersistentObject (
|
||||
G4VPhysicalVolume* aPhysVol );
|
||||
HepRef(G4PLogicalVolume) MakePersistentObject (
|
||||
G4LogicalVolume* aLogVol );
|
||||
HepRef(G4PVSolid) MakePersistentObject ( G4VSolid* aSolid );
|
||||
|
||||
G4VPhysicalVolume* MakeTransientObject (
|
||||
HepRef(G4PVPhysicalVolume) aPhysVol,
|
||||
HepRef(G4PVPhysicalVolume) theMotherVol );
|
||||
G4LogicalVolume* MakeTransientObject (
|
||||
HepRef(G4PLogicalVolume) aLogVol,
|
||||
HepRef(G4PVPhysicalVolume) theMotherVol );
|
||||
G4VSolid* MakeTransientObject ( HepRef(G4PVSolid) aSolid );
|
||||
|
||||
private:
|
||||
G4int f_nRecursive;
|
||||
G4int f_tRecursive;
|
||||
G4PString f_GeomMapScopeName;
|
||||
};
|
||||
|
||||
inline EVolume G4PersistentGeomMan::VolumeType(const G4VPhysicalVolume *pVol) const
|
||||
{
|
||||
EVolume type;
|
||||
EAxis axis;
|
||||
G4int nReplicas;
|
||||
G4double width,offset;
|
||||
G4bool consuming;
|
||||
if (pVol->IsReplicated())
|
||||
{
|
||||
pVol->GetReplicationData(axis,nReplicas,width,offset,consuming);
|
||||
type=(consuming) ? kReplica : kParameterised;
|
||||
}
|
||||
else
|
||||
{
|
||||
type=kNormal;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PersistentRunMan.hh,v 2.1 1998/11/09 17:19:06 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PersistentRunMan
|
||||
//
|
||||
// A Utility class for storing and retrieving the run objects.
|
||||
//
|
||||
// This class is not persistent-capable.
|
||||
//
|
||||
// Member functions:
|
||||
// =================
|
||||
// G4bool Store(const G4Run* aRun);
|
||||
// Store aRun and associated objects into database.
|
||||
// G4bool Retrieve(G4Run*& aRun);
|
||||
// Retrieve aRun and associated objects into database.
|
||||
// G4Bool LocateDB( HepDbApplication* dbApp,
|
||||
// const G4String runDBName );
|
||||
// Create and locate run database and container.
|
||||
//
|
||||
// Member data:
|
||||
// ============
|
||||
// HepDatabaseRef f_RunDB;
|
||||
// Reference to the run database.
|
||||
// HepContainerRef f_RunContainer;
|
||||
// Reference to the run container in the database.
|
||||
//
|
||||
// History:
|
||||
// 98.10.30 Y.Morita Splited from G4PersistencyManager
|
||||
|
||||
#ifndef G4PERSISTENTRUNMAN_H
|
||||
#define G4PERSISTENTRUNMAN_H 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "HepODBMS/clustering/HepDbApplication.h"
|
||||
|
||||
class G4Run;
|
||||
|
||||
|
||||
class G4PersistentRunMan
|
||||
{
|
||||
public:
|
||||
G4PersistentRunMan();
|
||||
~G4PersistentRunMan();
|
||||
HepDatabaseRef GetDB();
|
||||
HepContainerRef GetContainer();
|
||||
G4bool LocateDB( HepDbApplication* dbApp,
|
||||
const G4String runDBName );
|
||||
|
||||
private:
|
||||
HepDatabaseRef f_RunDB;
|
||||
HepContainerRef f_RunContainer;
|
||||
|
||||
public:
|
||||
G4bool Store( HepDbApplication* dbApp, const G4Run* aRun);
|
||||
G4bool Retrieve( HepDbApplication* dbApp, G4Run*& aRun );
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PersistentTypes.hh,v 2.0 1998/07/02 16:13:43 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Persistent-capable typedefs for Geant4/Persistency category
|
||||
//
|
||||
// History:
|
||||
// 15.06.98 Y.Morita - Created
|
||||
|
||||
#ifndef G4_PERSISTENT_TYPES_HH
|
||||
#define G4_PERSISTENT_TYPES_HH
|
||||
|
||||
// Typedefs to decouple from library classes
|
||||
#include <HepODBMS/odbms/HepODBMS.h>
|
||||
|
||||
typedef d_String G4PString;
|
||||
typedef d_Double G4Pdouble;
|
||||
typedef d_Float G4Pfloat;
|
||||
typedef d_Long G4Pint;
|
||||
typedef d_Long G4Plong;
|
||||
|
||||
#endif /* G4_PERSISTENT_TYPES_HH */
|
||||
@@ -0,0 +1,280 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PGeometryObjectMap.cc,v 2.2 1998/07/14 14:15:04 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PGeometryObjectMap
|
||||
//
|
||||
// Implementation of a class responsible for keeping track of
|
||||
// the geometry object map.
|
||||
//
|
||||
// History:
|
||||
// 98.06.20 Y.Morita Initial version
|
||||
|
||||
#include "G4PGeometryObjectMap.hh"
|
||||
|
||||
// tell C++ compiler to generate code of parametrized class for eacy class
|
||||
// (Required by Objectivity/DB)
|
||||
implement(HepRefVArray,G4PVPhysicalVolume)
|
||||
implement(HepRefVArray,G4PLogicalVolume)
|
||||
implement(HepRefVArray,G4PVSolid)
|
||||
|
||||
G4PGeometryObjectMap::G4PGeometryObjectMap()
|
||||
{
|
||||
}
|
||||
|
||||
G4PGeometryObjectMap::G4PGeometryObjectMap( const G4String theGeometryName )
|
||||
{
|
||||
noPhysVol = 0;
|
||||
noLogVol = 0;
|
||||
noSolids = 0;
|
||||
}
|
||||
|
||||
G4PGeometryObjectMap::~G4PGeometryObjectMap()
|
||||
{
|
||||
}
|
||||
|
||||
// -------- LookUp() and Add() functions for each class -------- //
|
||||
|
||||
HepRef(G4PVPhysicalVolume) G4PGeometryObjectMap::LookUp(
|
||||
G4VPhysicalVolume* inGeomObj )
|
||||
{
|
||||
assert(inGeomObj != NULL);
|
||||
for(G4int i=0;i<noPhysVol;i++)
|
||||
if( transPhysVolPtrs[i] == inGeomObj )
|
||||
return persPhysVolPtrs[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void G4PGeometryObjectMap::Add( G4VPhysicalVolume* inGeomObj,
|
||||
HepRef(G4PVPhysicalVolume) outGeomObj )
|
||||
{
|
||||
assert(inGeomObj != NULL);
|
||||
HepRef(G4PVPhysicalVolume) aGeomObj = LookUp( inGeomObj );
|
||||
if( aGeomObj == NULL )
|
||||
{
|
||||
// assert( inGeomObj == aGeomObj );
|
||||
noPhysVol++;
|
||||
transPhysVolPtrs.resize(noPhysVol);
|
||||
transPhysVolPtrs[noPhysVol-1] = inGeomObj;
|
||||
persPhysVolPtrs.append(outGeomObj);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------- //
|
||||
|
||||
G4VPhysicalVolume* G4PGeometryObjectMap::LookUp(
|
||||
HepRef(G4PVPhysicalVolume) inGeomObj )
|
||||
{
|
||||
assert(inGeomObj != NULL);
|
||||
for(G4int i=0;i<noPhysVol;i++)
|
||||
if( persPhysVolPtrs[i] == inGeomObj )
|
||||
return transPhysVolPtrs[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void G4PGeometryObjectMap::Add( HepRef(G4PVPhysicalVolume) inGeomObj,
|
||||
G4VPhysicalVolume* outGeomObj )
|
||||
{
|
||||
assert(inGeomObj != NULL);
|
||||
for(G4int i=0;i<noPhysVol;i++)
|
||||
{
|
||||
if( persPhysVolPtrs[i] == inGeomObj )
|
||||
{
|
||||
transPhysVolPtrs[i] = outGeomObj;
|
||||
break;
|
||||
}
|
||||
cerr << "G4PGeometryObjectMap::Add -- transient solid not assigned" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------- //
|
||||
|
||||
HepRef(G4PLogicalVolume) G4PGeometryObjectMap::LookUp(
|
||||
G4LogicalVolume* inGeomObj )
|
||||
{
|
||||
assert(inGeomObj != NULL);
|
||||
for(G4int i=0;i<noLogVol;i++)
|
||||
if( transLogVolPtrs[i] == inGeomObj )
|
||||
return persLogVolPtrs[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void G4PGeometryObjectMap::Add( G4LogicalVolume* inGeomObj,
|
||||
HepRef(G4PLogicalVolume) outGeomObj )
|
||||
{
|
||||
assert(inGeomObj != NULL);
|
||||
HepRef(G4PLogicalVolume) aGeomObj = LookUp( inGeomObj );
|
||||
if( aGeomObj == NULL )
|
||||
{
|
||||
// assert( inGeomObj == aGeomObj );
|
||||
noLogVol++;
|
||||
transLogVolPtrs.resize(noLogVol);
|
||||
transLogVolPtrs[noLogVol-1] = inGeomObj;
|
||||
persLogVolPtrs.append(outGeomObj);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------- //
|
||||
|
||||
G4LogicalVolume* G4PGeometryObjectMap::LookUp(
|
||||
HepRef(G4PLogicalVolume) inGeomObj )
|
||||
{
|
||||
assert(inGeomObj != NULL);
|
||||
for(G4int i=0;i<noLogVol;i++)
|
||||
if( persLogVolPtrs[i] == inGeomObj )
|
||||
return transLogVolPtrs[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void G4PGeometryObjectMap::Add( HepRef(G4PLogicalVolume) inGeomObj,
|
||||
G4LogicalVolume* outGeomObj )
|
||||
{
|
||||
assert(inGeomObj != NULL);
|
||||
for(G4int i=0;i<noLogVol;i++)
|
||||
{
|
||||
if( persLogVolPtrs[i] == inGeomObj )
|
||||
{
|
||||
transLogVolPtrs[i] = outGeomObj;
|
||||
break;
|
||||
}
|
||||
cerr << "G4PGeometryObjectMap::Add -- transient solid not assigned" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------- //
|
||||
HepRef(G4PVSolid) G4PGeometryObjectMap::LookUp( G4VSolid* inGeomObj )
|
||||
{
|
||||
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
cout << "G4PGeometryObjectMap::LookUp(G4VSolid) -- noSolids is "
|
||||
<< noSolids << endl;
|
||||
cout << " G4VSolid info: " << inGeomObj << endl;
|
||||
#endif
|
||||
|
||||
assert(inGeomObj != NULL);
|
||||
for(G4int i=0;i<noSolids;i++)
|
||||
{
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
G4VSolid* tmpSolid = transSolidPtrs[i];
|
||||
cout << "[" << i << "] transSolidPtrs[i]=" << tmpSolid <<endl;
|
||||
cout << " persSolidPtrs[i]=";
|
||||
HepRef(G4PVSolid) tmpPSolid = persSolidPtrs[i];
|
||||
tmpPSolid.print();
|
||||
#endif
|
||||
|
||||
if( transSolidPtrs[i] == inGeomObj )
|
||||
return persSolidPtrs[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void G4PGeometryObjectMap::Add( G4VSolid* inGeomObj,
|
||||
HepRef(G4PVSolid) outGeomObj )
|
||||
{
|
||||
assert(inGeomObj != NULL);
|
||||
HepRef(G4PVSolid) aGeomObj = LookUp( inGeomObj );
|
||||
if( aGeomObj == NULL )
|
||||
{
|
||||
// assert( inGeomObj == aGeomObj );
|
||||
noSolids++;
|
||||
transSolidPtrs.resize(noSolids);
|
||||
transSolidPtrs[noSolids-1] = inGeomObj;
|
||||
persSolidPtrs.append(outGeomObj);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------- //
|
||||
|
||||
G4VSolid* G4PGeometryObjectMap::LookUp(
|
||||
HepRef(G4PVSolid) inGeomObj )
|
||||
{
|
||||
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
cout << "G4PGeometryObjectMap::LookUp(G4PVSolid) -- noSolids is "
|
||||
<< noSolids << endl;
|
||||
cout << " G4PVSolid info:";
|
||||
inGeomObj.print(stdout);
|
||||
#endif
|
||||
|
||||
assert(inGeomObj != NULL);
|
||||
for(G4int i=0;i<noSolids;i++)
|
||||
{
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
cout << "[" << i << "] persSolidPtrs[i]=";
|
||||
HepRef(G4PVSolid) tmpPSolid = persSolidPtrs[i];
|
||||
tmpPSolid.print();
|
||||
G4VSolid* tmpSolid = transSolidPtrs[i];
|
||||
cout << " transSolidPtrs[i]=" << tmpSolid <<endl;
|
||||
#endif
|
||||
if( persSolidPtrs[i] == inGeomObj )
|
||||
return transSolidPtrs[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void G4PGeometryObjectMap::Add( HepRef(G4PVSolid) inGeomObj,
|
||||
G4VSolid* outGeomObj )
|
||||
{
|
||||
assert(inGeomObj != NULL);
|
||||
for(G4int i=0;i<noSolids;i++)
|
||||
{
|
||||
if( persSolidPtrs[i] == inGeomObj )
|
||||
{
|
||||
transSolidPtrs[i] = outGeomObj;
|
||||
break;
|
||||
}
|
||||
cerr << "G4PGeometryObjectMap::Add -- transient solid not assigned" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------- //
|
||||
|
||||
G4VSolid* G4PGeometryObjectMap::GetSolid(G4int i)
|
||||
{
|
||||
if( i >= 0 && i < noSolids)
|
||||
return transSolidPtrs[i];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HepRef(G4PVSolid) G4PGeometryObjectMap::GetPSolid(G4int i)
|
||||
{
|
||||
if( i >= 0 && i < noSolids)
|
||||
return persSolidPtrs[i];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void G4PGeometryObjectMap::InitTransientMap()
|
||||
{
|
||||
transPhysVolPtrs.resize(noPhysVol);
|
||||
transLogVolPtrs.resize(noLogVol);
|
||||
transSolidPtrs.resize(noSolids);
|
||||
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
cout << "G4PGeometryObjectMap::InitTransientMap()" << endl;
|
||||
cout << " -- noPhysVol: " << noPhysVol << endl;
|
||||
cout << " -- transPhysVolPtrs.length: " << transPhysVolPtrs.length() << endl;
|
||||
cout << " -- transLogVolPtrs.length: " << transLogVolPtrs.length() << endl;
|
||||
cout << " -- transSolidPtrs.length: " << transSolidPtrs.length() << endl;
|
||||
#endif
|
||||
|
||||
for(G4int i=0;i<noPhysVol;i++)
|
||||
transPhysVolPtrs[i] = NULL;
|
||||
for(i=0;i<noLogVol;i++)
|
||||
transLogVolPtrs[i] = NULL;
|
||||
for(i=0;i<noSolids;i++)
|
||||
transSolidPtrs[i] = NULL;
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PersistencyManager.cc,v 2.7 1998/11/09 17:22:07 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PersistencyManager
|
||||
//
|
||||
// Implementation for concrete G4PersistencyManager.
|
||||
//
|
||||
// History:
|
||||
// 98.01.08 Y.Morita Initial version
|
||||
// 98.06.20 Y.Morita Implement geometry Store and Retrieve
|
||||
|
||||
#include "G4PersistencyManager.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4PersistencyManager* G4PersistencyManager::f_PersistencyManager = NULL;
|
||||
|
||||
G4PersistencyManager* G4PersistencyManager::GetPersistencyManager()
|
||||
{
|
||||
if(!f_PersistencyManager)
|
||||
{
|
||||
f_PersistencyManager = new G4PersistencyManager;
|
||||
}
|
||||
return f_PersistencyManager;
|
||||
}
|
||||
|
||||
G4PersistencyManager* G4PersistencyManager::get_PersistencyManagerIfExist()
|
||||
{ return f_PersistencyManager; }
|
||||
|
||||
G4PersistencyManager::G4PersistencyManager()
|
||||
{
|
||||
|
||||
dbApp = new HepDbApplication("g4example");
|
||||
|
||||
if (!dbApp)
|
||||
{
|
||||
G4cerr << "could not allocate HepDbApplication in G4PersistencyManager!" << endl;
|
||||
}
|
||||
|
||||
// Open and Initialize a database
|
||||
|
||||
// Note: The name of the federated database file "G4EXAMPLE" is
|
||||
// hard-coded here for now.
|
||||
// In near future G4PersistencyManager should take an argument
|
||||
// of the file name so that user can specify it on the fly.
|
||||
|
||||
const G4String bootFileName = "G4EXAMPLE";
|
||||
G4cout << "Opening Federated Database " << bootFileName << "." << endl;
|
||||
dbApp->fdBootName(bootFileName);
|
||||
dbApp->Init();
|
||||
|
||||
// Locate or create run databases and containers
|
||||
const G4String runDBName = "Runs";
|
||||
if( ! f_pRunMan.LocateDB( dbApp, runDBName) )
|
||||
{
|
||||
G4cerr << "could not locate run database in G4PersistencyManager!" << endl;
|
||||
}
|
||||
|
||||
// Locate or create event databases and containers
|
||||
const G4String eventDBName = "Events";
|
||||
if( ! f_pEventMan.LocateDB( dbApp, eventDBName) )
|
||||
{
|
||||
G4cerr << "could not locate event database in G4PersistencyManager!" << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
G4PersistencyManager::~G4PersistencyManager()
|
||||
{
|
||||
// Any persistent objects which are created during save() should
|
||||
// not be deleted in ~G4PersistencyManager() implicitly, because
|
||||
// they are "persistent"!
|
||||
|
||||
// On the contrary, any transient objects which are created during
|
||||
// Retrieve() should be deleted explicitly when they are no longer
|
||||
// in use. It is the responsibility of the caller of Retrieve()
|
||||
// to destroy the retrieved transient objects if Retrieve() is to be
|
||||
// called repeatedlly.
|
||||
|
||||
G4cout << "PersistencyManager is deleting." << endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
G4bool G4PersistencyManager::Store(const G4Event* anEvent)
|
||||
{
|
||||
return f_pEventMan.Store(dbApp, anEvent);
|
||||
}
|
||||
|
||||
G4bool G4PersistencyManager::Store(const G4Run* aRun)
|
||||
{
|
||||
return f_pRunMan.Store(dbApp, aRun);
|
||||
}
|
||||
|
||||
G4bool G4PersistencyManager::Store(const G4VPhysicalVolume* aWorld)
|
||||
{
|
||||
return f_pGeomMan.Store(dbApp, aWorld);
|
||||
}
|
||||
|
||||
G4bool G4PersistencyManager::Retrieve(G4Event*& anEvent)
|
||||
{
|
||||
return f_pEventMan.Retrieve(dbApp, anEvent);
|
||||
}
|
||||
|
||||
G4bool G4PersistencyManager::Retrieve(G4Run*& aRun)
|
||||
{
|
||||
return f_pRunMan.Retrieve(dbApp, aRun);
|
||||
}
|
||||
|
||||
G4bool G4PersistencyManager::Retrieve(G4VPhysicalVolume*& theWorld)
|
||||
{
|
||||
return f_pGeomMan.Retrieve(dbApp, theWorld);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PersistentEventMan.cc,v 2.1 1998/11/09 17:19:46 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PersistentEventMan
|
||||
//
|
||||
// Implementation for concrete G4PersistentEventMan.
|
||||
//
|
||||
// History:
|
||||
// 98.01.08 Y.Morita Initial version
|
||||
// 98.06.20 Y.Morita Implement geometry Store and Retrieve
|
||||
|
||||
#include "G4PersistentEventMan.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4PEvent.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4PersistentEventMan::G4PersistentEventMan()
|
||||
{;}
|
||||
|
||||
G4PersistentEventMan::~G4PersistentEventMan()
|
||||
{;}
|
||||
|
||||
HepDatabaseRef G4PersistentEventMan::GetDB()
|
||||
{
|
||||
return f_EventDB;
|
||||
}
|
||||
|
||||
HepContainerRef G4PersistentEventMan::GetContainer()
|
||||
{
|
||||
return f_EventContainer;
|
||||
}
|
||||
|
||||
G4bool G4PersistentEventMan::LocateDB(HepDbApplication* dbApp,
|
||||
const G4String eventDBName)
|
||||
{
|
||||
G4bool theStatus = true;
|
||||
|
||||
// start a transaction to create databases and containers
|
||||
dbApp->startUpdate();
|
||||
|
||||
// create a root named object tree namespace
|
||||
// namedRoot = new NamedNode;
|
||||
// NamedObjectTree namedTree( namedRoot );
|
||||
|
||||
// use database Events
|
||||
f_EventDB = dbApp->db(eventDBName);
|
||||
|
||||
if (f_EventDB == NULL)
|
||||
{
|
||||
G4cerr << "Could not create or find " << eventDBName << " database." << endl;
|
||||
theStatus = false;
|
||||
}
|
||||
|
||||
// create a new container for event collection in this database
|
||||
f_EventContainer = dbApp->container("EventContainer");
|
||||
|
||||
if ( f_EventContainer == NULL )
|
||||
{
|
||||
G4cerr << "could not find or create eventContainer in the database" << endl;
|
||||
theStatus = false;
|
||||
}
|
||||
|
||||
// create a "Events" named object tree in the namespace
|
||||
// namedTree.mkdir(eventDBName);
|
||||
// namedTree.cd(eventDBName);
|
||||
|
||||
// Commit the update
|
||||
dbApp->commit();
|
||||
|
||||
return theStatus;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
G4bool G4PersistentEventMan::Store( HepDbApplication* dbApp,
|
||||
const G4Event* anEvent )
|
||||
{
|
||||
// Start Update G4PEvent in the database
|
||||
dbApp->startUpdate();
|
||||
|
||||
// Create persistent event object
|
||||
new(f_EventContainer) G4PEvent(anEvent);
|
||||
|
||||
// Put it into event iterator
|
||||
|
||||
// Commit the update
|
||||
dbApp->commit();
|
||||
|
||||
#ifndef G4PERSISTENCY_DEBUG
|
||||
G4cout << "G4PEvent " << anEvent->GetEventID() << " Committed." << endl;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
G4bool G4PersistentEventMan::Retrieve( HepDbApplication* dbApp,
|
||||
G4Event*& anEvent )
|
||||
{
|
||||
// not implemented yet
|
||||
|
||||
G4bool fStatus = false;
|
||||
|
||||
// loop thru the event iterator
|
||||
|
||||
fStatus = true;
|
||||
return fStatus;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,491 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PersistentGeomMan.cc,v 2.2 1998/11/10 18:27:43 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PersistentGeomMan
|
||||
//
|
||||
// Implementation for concrete G4PersistentGeomMan.
|
||||
//
|
||||
// History:
|
||||
// 98.10.30 Y.Morita Splited from G4PersistencyManager
|
||||
|
||||
#include "G4PersistentGeomMan.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PVSolid.hh"
|
||||
#include "G4PBox.hh"
|
||||
#include "G4PCons.hh"
|
||||
#include "G4PHype.hh"
|
||||
#include "G4PPara.hh"
|
||||
#include "G4PSphere.hh"
|
||||
#include "G4PTorus.hh"
|
||||
#include "G4PTrap.hh"
|
||||
#include "G4PTrd.hh"
|
||||
#include "G4PTubs.hh"
|
||||
|
||||
#include "G4PLogicalVolume.hh"
|
||||
#include "G4PPVPlacement.hh"
|
||||
#include "G4PPVReplica.hh"
|
||||
#include "G4PPVParameterised.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4PersistentGeomMan::G4PersistentGeomMan()
|
||||
{
|
||||
f_GeomMapScopeName = "Geant4 Geometry Object Map";
|
||||
}
|
||||
|
||||
G4PersistentGeomMan::~G4PersistentGeomMan()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
G4bool G4PersistentGeomMan::Store( HepDbApplication* dbApp,
|
||||
const G4VPhysicalVolume* theWorld)
|
||||
{
|
||||
void* aWorld = (void*) theWorld;
|
||||
G4bool fStatus = false;
|
||||
const G4String theGeometryName = "G4EXAMPLE test geometry";
|
||||
|
||||
// clear the recursive call counter
|
||||
f_nRecursive = 0;
|
||||
f_tRecursive = 0;
|
||||
|
||||
// Start Updating the geometry database
|
||||
dbApp->startUpdate();
|
||||
|
||||
// Open or create Geometry DB
|
||||
const HepDatabaseRef f_GeomDB = dbApp->db("Geometry");
|
||||
|
||||
if ( f_GeomDB == NULL )
|
||||
{
|
||||
G4cerr << "G4PersistentGeomMan::Store" <<
|
||||
" -- error in opening or creating the geometry database." << endl;
|
||||
}
|
||||
|
||||
// create a new container for geometry collection in this database
|
||||
f_GeomContainer = dbApp->container("GeometryContainer");
|
||||
|
||||
if ( f_GeomContainer == NULL )
|
||||
{
|
||||
G4cerr << "could not find or create f_GeomContainer in the database" << endl;
|
||||
}
|
||||
|
||||
// ----------------------- Objectivity Feature ----------------------- //
|
||||
// Look for the geometry object map in the database and create it
|
||||
// if it does not exist
|
||||
if ( ! f_GeomMap.lookupObj( f_GeomDB, f_GeomMapScopeName, oocUpdate ) )
|
||||
{
|
||||
|
||||
// Prepare lookup table for the geometry object tree
|
||||
f_GeomMap =
|
||||
new(f_GeomContainer) G4PGeometryObjectMap( theGeometryName );
|
||||
|
||||
// Add ScopeName to f_GeomMap for future reference (*Objy feature)
|
||||
if ( ! f_GeomMap.nameObj( f_GeomDB, f_GeomMapScopeName ) )
|
||||
{
|
||||
G4cerr << "G4PersistentGeomMan::Store" <<
|
||||
" -- error in naming the geometry object map: " <<
|
||||
f_GeomMapScopeName << endl;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "G4PersistentGeomMan::Store" <<
|
||||
" -- the object map already defined in the geometry database." < endl;
|
||||
G4cerr << " Geometry not stored." << endl;
|
||||
dbApp->abort();
|
||||
return false;
|
||||
}
|
||||
// ----------------------- Objectivity Feature ----------------------- //
|
||||
|
||||
// make the persistent world volume object from "theWorld"
|
||||
HepRef(G4PVPhysicalVolume) persWorld =
|
||||
MakePersistentObject( (G4VPhysicalVolume*)aWorld );
|
||||
|
||||
if ( persWorld != NULL )
|
||||
{
|
||||
// set the persistent World Volume to f_GeomMap
|
||||
f_GeomMap->SetWorldVolume( persWorld );
|
||||
|
||||
// commit the changes to the geometry database
|
||||
dbApp->commit();
|
||||
fStatus = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
dbApp->abort();
|
||||
fStatus = false;
|
||||
}
|
||||
|
||||
return fStatus;
|
||||
}
|
||||
|
||||
G4bool G4PersistentGeomMan::Retrieve( HepDbApplication* dbApp,
|
||||
G4VPhysicalVolume*& theWorld)
|
||||
{
|
||||
const G4PString theGeometryName = "G4EXAMPLE test geometry";
|
||||
G4bool fStatus = false;
|
||||
|
||||
theWorld = NULL;
|
||||
|
||||
// Start "Read" transactions to the database
|
||||
dbApp->startRead();
|
||||
|
||||
// Open existing Geometry database
|
||||
f_GeomDB = dbApp->db("Geometry");
|
||||
|
||||
if ( f_GeomDB == NULL )
|
||||
{
|
||||
G4cerr << "G4PersistentGeomMan::Retrieve" <<
|
||||
" -- error in searching the geometry database" << endl;
|
||||
}
|
||||
|
||||
// ----------------------- Objectivity Feature ----------------------- //
|
||||
// Load the geometry object map from the database with read-only mode
|
||||
if ( ! f_GeomMap.lookupObj( f_GeomDB, f_GeomMapScopeName, oocRead ) )
|
||||
{
|
||||
G4cerr << "G4PersistentGeomMan::Retrieve" <<
|
||||
" -- error in looking up the geometry object map: " <<
|
||||
f_GeomMapScopeName << endl;
|
||||
}
|
||||
// ----------------------- Objectivity Feature ----------------------- //
|
||||
|
||||
if ( f_GeomMap == NULL )
|
||||
{
|
||||
G4cerr << "G4PersistentGeomMan::Retrieve" <<
|
||||
" -- error in searching the geometry object map: " <<
|
||||
f_GeomMapScopeName << endl;
|
||||
}
|
||||
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
G4cout << "G4PersistentGeomMan::Retrieve(G4VPhysicalVolume*)"
|
||||
<< " -- f_GeomMap is loaded." << endl;
|
||||
#endif
|
||||
|
||||
// initialize the transient part of the geometry object map
|
||||
f_GeomMap->InitTransientMap();
|
||||
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
G4cout << "G4PersistentGeomMan::Retrieve(G4VPhysicalVolume*)"
|
||||
<< " -- f_GeomMap is initialized." << endl;
|
||||
#endif
|
||||
|
||||
// loop through the number of solids in the database
|
||||
G4int nSolids = f_GeomMap->GetNoSolids();
|
||||
for(G4int i=0;i<nSolids;i++)
|
||||
{
|
||||
// load persistent solid object from DB
|
||||
HepRef(G4PVSolid) persSolid = f_GeomMap->GetPSolid(i);
|
||||
|
||||
// make transient version of G4VSolid from the persistent solid
|
||||
G4VSolid* theSolid = MakeTransientObject(persSolid);
|
||||
}
|
||||
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
G4cout << "G4PersistentGeomMan::Retrieve(G4VPhysicalVolume*)"
|
||||
<< " -- Transient Solid is created for nSolids:"
|
||||
<< nSolids << endl;
|
||||
#endif
|
||||
|
||||
// Locate the persistent world physics volume
|
||||
HepRef(G4PVPhysicalVolume) persWorld = f_GeomMap->GetWorldVolume();
|
||||
|
||||
if ( persWorld == NULL )
|
||||
{
|
||||
G4cerr << "G4PersistentGeomMan::Retrieve" <<
|
||||
" -- geometry object map does not have world volume." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// start the recursive data member copy
|
||||
// to create the transient geometry object tree
|
||||
HepRef(G4PVPhysicalVolume) persMother = NULL;
|
||||
G4VPhysicalVolume* theWorld =
|
||||
MakeTransientObject( persWorld, persMother );
|
||||
|
||||
if ( theWorld != NULL )
|
||||
fStatus = true;
|
||||
}
|
||||
// Close the transaction on geometry retrive
|
||||
dbApp->commit();
|
||||
|
||||
return fStatus;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
HepRef(G4PVPhysicalVolume) G4PersistentGeomMan::MakePersistentObject (
|
||||
G4VPhysicalVolume* thePhysVol )
|
||||
{
|
||||
// check the depth of the recursive call to this method
|
||||
if ( ++f_nRecursive > G4_PHYS_VOLUME_DEPTH_MAX )
|
||||
{
|
||||
G4cerr << "G4PersistentGeomMan::MakePersistentObject" <<
|
||||
" -- Physical Volume recursive depth reached to G4_PHYS_VOLUME_DEPTH_MAX."
|
||||
<< endl;
|
||||
return NULL;
|
||||
}
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
if ( f_nRecursive % 1000 == 0 )
|
||||
{
|
||||
G4cout << "G4PersistentGeomMan::MakePersistentObject" <<
|
||||
" -- Physical Volume recursive depth is " << f_nRecursive << endl;
|
||||
}
|
||||
#endif // G4PERSISTENCY_DEBUG
|
||||
|
||||
// check if the persistent version of thePhysVol exists
|
||||
HepRef(G4PVPhysicalVolume) persPhysVol = f_GeomMap->LookUp(thePhysVol);
|
||||
if ( persPhysVol == NULL )
|
||||
{
|
||||
// Get the Logical Volume in thePhysVol
|
||||
G4LogicalVolume* theLogVol = thePhysVol->GetLogicalVolume();
|
||||
|
||||
// make the persistent logical volume object from "theLogVol"
|
||||
HepRef(G4PLogicalVolume) persLogVol =
|
||||
MakePersistentObject( theLogVol );
|
||||
assert( persLogVol != NULL );
|
||||
|
||||
// Construct the persistent version of thePhysVol for each type of volume
|
||||
switch (VolumeType(thePhysVol))
|
||||
{
|
||||
case kNormal:
|
||||
persPhysVol = new(f_GeomContainer)
|
||||
G4PPVPlacement( thePhysVol, persLogVol);
|
||||
break;
|
||||
case kReplica:
|
||||
persPhysVol = new(f_GeomContainer)
|
||||
G4PPVReplica( thePhysVol, persLogVol);
|
||||
break;
|
||||
case kParameterised:
|
||||
persPhysVol = new(f_GeomContainer)
|
||||
G4PPVReplica( thePhysVol, persLogVol);
|
||||
// G4PPVParameterized( thePhysVol, persLogVol);
|
||||
break;
|
||||
}
|
||||
assert( persPhysVol != NULL );
|
||||
|
||||
// register persPhysVol to the geometry object lookup table
|
||||
f_GeomMap->Add( thePhysVol, persPhysVol );
|
||||
|
||||
} // end of if f_GeomMap->LookUp(thePhysVol)
|
||||
|
||||
return persPhysVol;
|
||||
}
|
||||
|
||||
HepRef(G4PLogicalVolume) G4PersistentGeomMan::MakePersistentObject (
|
||||
G4LogicalVolume* theLogVol )
|
||||
|
||||
{
|
||||
// check if the persistent version of theLogVol exists
|
||||
HepRef(G4PLogicalVolume) persLogVol = f_GeomMap->LookUp(theLogVol);
|
||||
if ( persLogVol == NULL )
|
||||
{
|
||||
// get the solid of the transient logical volume
|
||||
G4VSolid* theSolid = theLogVol->GetSolid();
|
||||
|
||||
// make the persistent solid object from "theSolid"
|
||||
HepRef(G4PVSolid) persSolid = MakePersistentObject(theSolid);
|
||||
|
||||
// Construct the persistent version of theLogVol
|
||||
persLogVol = new(f_GeomContainer) G4PLogicalVolume(theLogVol, persSolid);
|
||||
assert( persLogVol != NULL );
|
||||
|
||||
// register persLogVol to the geometry object lookup table
|
||||
f_GeomMap->Add( theLogVol, persLogVol );
|
||||
|
||||
// loop through the daughter physical volumes in theLogVol
|
||||
G4int nDaughters = theLogVol->GetNoDaughters();
|
||||
for(G4int i=0;i<nDaughters;i++)
|
||||
{
|
||||
// Get the i-th daughter physics volume
|
||||
G4VPhysicalVolume* dPhysVol = theLogVol->GetDaughter(i);
|
||||
|
||||
// make the persistent physics volume object from "dPhysVol"
|
||||
HepRef(G4PVPhysicalVolume) persDaughterPhysVol =
|
||||
MakePersistentObject( dPhysVol );
|
||||
|
||||
// add persistent daughter volume to the persistent logical volume
|
||||
if ( persDaughterPhysVol != NULL )
|
||||
persLogVol->AddDaughter( persDaughterPhysVol );
|
||||
|
||||
} // end of for(G4int i=0;i<nDaughters;i++)
|
||||
|
||||
} // end of if f_GeomMap->LookUp(theLogVol)
|
||||
|
||||
return persLogVol;
|
||||
}
|
||||
|
||||
HepRef(G4PVSolid) G4PersistentGeomMan::MakePersistentObject (
|
||||
G4VSolid* theSolid )
|
||||
{
|
||||
// check if the persistent version of theSolid exists
|
||||
HepRef(G4PVSolid) persSolid = f_GeomMap->LookUp(theSolid);
|
||||
if ( persSolid == NULL )
|
||||
{
|
||||
G4GeometryType theSolidType = theSolid->GetEntityType();
|
||||
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
G4cout << "G4PersistentGeomMan::MakePersistentObject (G4VSolid) "
|
||||
<< "-- theSolidType is " << theSolidType << endl;
|
||||
#endif
|
||||
|
||||
// Construct persistent and concrete solid object
|
||||
// according to the entity type of theSolid
|
||||
if ( theSolidType == "G4Box")
|
||||
persSolid = new(f_GeomContainer) G4PBox( (G4Box*)theSolid );
|
||||
else if ( theSolidType == "G4Cons")
|
||||
persSolid = new(f_GeomContainer) G4PCons( (G4Cons*)theSolid );
|
||||
else if ( theSolidType == "G4Hype")
|
||||
persSolid = new(f_GeomContainer) G4PHype( (G4Hype*)theSolid );
|
||||
else if ( theSolidType == "G4Para")
|
||||
persSolid = new(f_GeomContainer) G4PPara( (G4Para*)theSolid );
|
||||
else if ( theSolidType == "G4Sphere")
|
||||
persSolid = new(f_GeomContainer) G4PSphere( (G4Sphere*)theSolid );
|
||||
else if ( theSolidType == "G4Torus")
|
||||
persSolid = new(f_GeomContainer) G4PTorus( (G4Torus*)theSolid );
|
||||
else if ( theSolidType == "G4Trap")
|
||||
persSolid = new(f_GeomContainer) G4PTrap( (G4Trap*)theSolid );
|
||||
else if ( theSolidType == "G4Trd")
|
||||
persSolid = new(f_GeomContainer) G4PTrd( (G4Trd*)theSolid );
|
||||
else if ( theSolidType == "G4Tubs")
|
||||
persSolid = new(f_GeomContainer) G4PTubs( (G4Tubs*)theSolid );
|
||||
|
||||
// register persSolid to the geometry object lookup table
|
||||
if ( persSolid != NULL )
|
||||
f_GeomMap->Add( theSolid, persSolid );
|
||||
|
||||
} // end of if f_GeomMap->LookUp(theSolid)
|
||||
|
||||
return persSolid;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
G4VPhysicalVolume* G4PersistentGeomMan::MakeTransientObject (
|
||||
HepRef(G4PVPhysicalVolume) persPhysVol,
|
||||
HepRef(G4PVPhysicalVolume) persMotherVol )
|
||||
{
|
||||
// check the depth of the recursive call to this method
|
||||
if ( ++f_tRecursive > G4_PHYS_VOLUME_DEPTH_MAX )
|
||||
{
|
||||
G4cerr << "G4PersistentGeomMan::MakeTransientObject" <<
|
||||
" -- Physical Volume recursive depth reached to G4_PHYS_VOLUME_DEPTH_MAX."
|
||||
<< endl;
|
||||
return NULL;
|
||||
}
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
if ( f_tRecursive % 1000 == 0 )
|
||||
{
|
||||
G4cout << "G4PersistentGeomMan::MakeTransientObject" <<
|
||||
" -- Physical Volume recursive depth is " << f_tRecursive << endl;
|
||||
}
|
||||
#endif // G4PERSISTENCY_DEBUG
|
||||
|
||||
// check if the transient version of persPhysVol exists
|
||||
G4VPhysicalVolume* thePhysVol = f_GeomMap->LookUp(persPhysVol);
|
||||
if ( thePhysVol == NULL )
|
||||
{
|
||||
// Get the Logical Volume in persPhysVol
|
||||
HepRef(G4PLogicalVolume) persLogVol = persPhysVol->GetLogicalVolume();
|
||||
|
||||
// make the transient logical volume object from "persPhysVol"
|
||||
G4LogicalVolume* theLogVol =
|
||||
MakeTransientObject( persLogVol, persPhysVol );
|
||||
assert( theLogVol != NULL );
|
||||
|
||||
// Construct the transient version of persPhysVol
|
||||
G4VPhysicalVolume*
|
||||
thePhysVol = persPhysVol->MakeTransientObject(
|
||||
theLogVol, f_GeomMap->LookUp(persMotherVol) );
|
||||
assert( thePhysVol != NULL );
|
||||
|
||||
// register thePhysVol to the geometry object lookup table
|
||||
f_GeomMap->Add( persPhysVol, thePhysVol );
|
||||
|
||||
} // end of if f_GeomMap->LookUp(persPhysVol)
|
||||
|
||||
return thePhysVol;
|
||||
}
|
||||
|
||||
G4LogicalVolume* G4PersistentGeomMan::MakeTransientObject (
|
||||
HepRef(G4PLogicalVolume) persLogVol,
|
||||
HepRef(G4PVPhysicalVolume) persMotherVol )
|
||||
{
|
||||
// check if the transient version of persLogVol exists
|
||||
G4LogicalVolume* theLogVol = f_GeomMap->LookUp(persLogVol);
|
||||
if ( theLogVol == NULL )
|
||||
{
|
||||
// get the solid of the persistent logical volume
|
||||
HepRef(G4PVSolid) persSolid = persLogVol->GetSolid();
|
||||
assert( persSolid != NULL );
|
||||
|
||||
// check if the transient version of persSolid exists
|
||||
G4VSolid* theSolid = f_GeomMap->LookUp(persSolid);
|
||||
|
||||
if ( theSolid == NULL )
|
||||
{
|
||||
G4cerr << "G4PersistentGeomMan::MakeTransientObject" <<
|
||||
" -- transient Solid not found for the persistent Solid" << endl;
|
||||
}
|
||||
|
||||
// Construct the persistent version of theLogVol with theSolid
|
||||
theLogVol = persLogVol->MakeTransientObject(theSolid);
|
||||
assert( theLogVol != NULL );
|
||||
|
||||
// register theLogVol to the geometry object lookup table
|
||||
f_GeomMap->Add( persLogVol, theLogVol );
|
||||
|
||||
// loop through the daughter physical volumes in persLogVol
|
||||
G4int nDaughters = persLogVol->GetNoDaughters();
|
||||
for(G4int i=0;i<nDaughters;i++)
|
||||
{
|
||||
// Get the i-th daughter physics volume
|
||||
HepRef(G4PVPhysicalVolume) persDaughterPhysVol
|
||||
= persLogVol->GetDaughter(i);
|
||||
|
||||
// make the transient physics volume object from "persDaughterPhysVol"
|
||||
G4VPhysicalVolume* theDaughterPhysVol =
|
||||
MakeTransientObject( persDaughterPhysVol, persMotherVol );
|
||||
|
||||
// add transient daughter volume to the transient logical volume
|
||||
if ( theDaughterPhysVol != NULL )
|
||||
theLogVol->AddDaughter( theDaughterPhysVol );
|
||||
|
||||
} // end of for(G4int i=0;i<nDaughters;i++)
|
||||
|
||||
} // end of if f_GeomMap->LookUp(persLogVol)
|
||||
|
||||
return theLogVol;
|
||||
}
|
||||
|
||||
G4VSolid* G4PersistentGeomMan::MakeTransientObject (
|
||||
HepRef(G4PVSolid) persSolid )
|
||||
{
|
||||
// check if the persistent version of theSolid exists
|
||||
G4VSolid* transSolid = f_GeomMap->LookUp(persSolid);
|
||||
if ( transSolid == NULL )
|
||||
{
|
||||
#ifdef G4PERSISTENCY_DEBUG
|
||||
G4GeometryType theSolidType = persSolid->GetEntityType();
|
||||
G4cout << "G4PersistentGeomMan::MakePersistentObject (G4PVSolid) "
|
||||
<< "-- theSolidType is " << theSolidType << endl;
|
||||
#endif
|
||||
transSolid = persSolid->MakeTransientObject();
|
||||
assert( transSolid != NULL );
|
||||
f_GeomMap->Add( persSolid, transSolid );
|
||||
}
|
||||
|
||||
return transSolid;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -0,0 +1,113 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PersistentRunMan.cc,v 2.2 1998/11/10 04:05:52 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// class G4PersistentRunMan
|
||||
//
|
||||
// Implementation for concrete G4PersistentRunMan.
|
||||
//
|
||||
// History:
|
||||
// 98.01.08 Y.Morita Initial version
|
||||
// 98.06.20 Y.Morita Implement geometry Store and Retrieve
|
||||
|
||||
#include "G4PersistentRunMan.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4PRun.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4PersistentRunMan::G4PersistentRunMan()
|
||||
{;}
|
||||
|
||||
G4PersistentRunMan::~G4PersistentRunMan()
|
||||
{;}
|
||||
|
||||
HepDatabaseRef G4PersistentRunMan::GetDB()
|
||||
{
|
||||
return f_RunDB;
|
||||
}
|
||||
|
||||
HepContainerRef G4PersistentRunMan::GetContainer()
|
||||
{
|
||||
return f_RunContainer;
|
||||
}
|
||||
|
||||
G4PersistentRunMan::LocateDB(HepDbApplication* dbApp,
|
||||
const G4String runDBName)
|
||||
{
|
||||
G4bool theStatus = true;
|
||||
|
||||
// start a transaction to create databases and containers
|
||||
dbApp->startUpdate();
|
||||
|
||||
// create a root named object tree namespace
|
||||
// namedRoot = new NamedNode;
|
||||
// NamedObjectTree namedTree( namedRoot );
|
||||
|
||||
// use database RunDB
|
||||
f_RunDB = dbApp->db("RunDB");
|
||||
|
||||
if (f_RunDB == NULL)
|
||||
{
|
||||
G4cerr << "Could not create or find RunDB database." << endl;
|
||||
theStatus = false;
|
||||
}
|
||||
|
||||
// create a new container for Run collection in this database
|
||||
f_RunContainer = dbApp->container("RunContainer");
|
||||
|
||||
if ( f_RunContainer == NULL )
|
||||
{
|
||||
G4cerr << "could not find or create RunContainer in the database" << endl;
|
||||
theStatus = false;
|
||||
}
|
||||
|
||||
// create a "RunDB" named object tree in the namespace
|
||||
// namedTree.mkdir("RunDB");
|
||||
// namedTree.cd("RunDB");
|
||||
|
||||
// Commit the update
|
||||
dbApp->commit();
|
||||
|
||||
return theStatus;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
G4bool G4PersistentRunMan::Store( HepDbApplication* dbApp,
|
||||
const G4Run* aRun)
|
||||
{
|
||||
// Start Update G4PRun in the database
|
||||
dbApp->startUpdate();
|
||||
|
||||
// Create persistent Run object
|
||||
new(f_RunContainer) G4PRun(aRun);
|
||||
|
||||
// Commit the update
|
||||
dbApp->commit();
|
||||
|
||||
#ifndef G4PERSISTENCY_DEBUG
|
||||
G4cout << "G4PRun " << aRun->GetRunID() << " Committed." << endl;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
G4bool G4PersistentRunMan::Retrieve( HepDbApplication* dbApp,
|
||||
G4Run*& aRun)
|
||||
{
|
||||
// not implemented yet
|
||||
|
||||
G4bool fStatus = false;
|
||||
|
||||
fStatus = true;
|
||||
return fStatus;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# $Id: GNUmakefile,v 1.2 1998/11/09 17:16:04 morita Exp $
|
||||
|
||||
name := G4prun
|
||||
G4ODBMS := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
# $(G4TMPDIR) will be overrided in common.gmk later.
|
||||
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
|
||||
|
||||
CPPFLAGS += \
|
||||
-Iinclude \
|
||||
-I$(G4TMPDIR) \
|
||||
-I$(G4INSTALL)/source/run/include \
|
||||
-I$(G4INSTALL)/source/event/include \
|
||||
-I$(G4INSTALL)/source/global/management/include \
|
||||
-I$(G4INSTALL)/source/global/HEPRandom/include \
|
||||
-I$(G4INSTALL)/source/global/HEPGeometry/include \
|
||||
-I$(G4INSTALL)/source/geometry/management/include \
|
||||
-I$(G4INSTALL)/source/geometry/volumes/include \
|
||||
-I$(G4INSTALL)/source/geometry/solids/CSG/include \
|
||||
-I$(G4INSTALL)/source/events+tracks/include \
|
||||
-I$(G4INSTALL)/source/processes/management/include \
|
||||
-I$(G4INSTALL)/source/materials/include \
|
||||
-I$(G4INSTALL)/source/particles/management/include \
|
||||
-I$(G4INSTALL)/source/graphics_reps/include \
|
||||
-I$(G4INSTALL)/source/tracking/include \
|
||||
-I$(G4INSTALL)/source/track/include \
|
||||
-I$(G4INSTALL)/source/persistency/management/include \
|
||||
-I$(G4INSTALL)/source/digits+hits/detector/include \
|
||||
-I$(G4INSTALL)/source/digits+hits/hits/include \
|
||||
-I$(G4INSTALL)/source/digits+hits/digits/include
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
include $(G4INSTALL)/config/G4ODBMS_BUILD.gmk
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Explicit DDL dependencies:
|
||||
# G4PEvent.ddl includes G4PPrimaryVertex.hh, so G4PPrimaryVertex.hh
|
||||
# should be created before G4PEvent.hh.
|
||||
|
||||
$(G4TMPDIR)/G4PEvent.hh: $(G4TMPDIR)/G4PPrimaryVertex.hh
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PRun.ddl,v 1.2 1998/11/09 17:17:21 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4PRun_h
|
||||
#define G4PRun_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4Allocator.hh"
|
||||
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
|
||||
#include "G4PersistentTypes.hh"
|
||||
|
||||
class G4Run;
|
||||
//class G4HCtable;
|
||||
//class G4DCtable;
|
||||
|
||||
class G4PRun
|
||||
: public HepPersObj
|
||||
{
|
||||
public:
|
||||
G4PRun();
|
||||
G4PRun(const G4Run* aRun);
|
||||
virtual ~G4PRun();
|
||||
|
||||
protected:
|
||||
G4Pint runID;
|
||||
G4Pint numberOfEvent;
|
||||
// G4HCtable* HCtable;
|
||||
// G4DCtable* DCtable;
|
||||
|
||||
public:
|
||||
inline void SetRunID(G4int id)
|
||||
{ runID = id; }
|
||||
inline G4int GetRunID() const
|
||||
{ return runID; }
|
||||
inline G4int GetNumberOfEvent() const
|
||||
{ return numberOfEvent; }
|
||||
// inline virtual void RecordEvent(G4Event*)
|
||||
// { numberOfEvent++; }
|
||||
// inline void SetHCtable(G4HCtable* HCtbl)
|
||||
// { HCtable = HCtbl; }
|
||||
// inline const G4HCtable* GetHCtable() const
|
||||
// { return HCtable; }
|
||||
// inline void SetDCtable(G4DCtable* DCtbl)
|
||||
// { DCtable = DCtbl; }
|
||||
// inline const G4DCtable* GetDCtable() const
|
||||
// { return DCtable; }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PRun.cc,v 1.2 1998/11/09 17:17:50 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4PRun.hh"
|
||||
|
||||
G4PRun::G4PRun()
|
||||
// :runID(0),numberOfEvent(0),HCtable(NULL),DCtable(NULL)
|
||||
:runID(0),numberOfEvent(0)
|
||||
{;}
|
||||
|
||||
G4PRun::G4PRun(const G4Run* aRun)
|
||||
{
|
||||
runID = aRun->GetRunID();
|
||||
numberOfEvent = aRun->GetNumberOfEvent();
|
||||
}
|
||||
|
||||
G4PRun::~G4PRun()
|
||||
{;}
|
||||
|
||||
Reference in New Issue
Block a user