Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
# $Id: GNUmakefile,v 2.2 1998/07/05 12:40:59 allison Exp $
# -----------------------------------------------------------------
# "gmake" makes default libraries for each subdomain.
# "gmake glob" makes global libraries for each subdomain.
# Composite libraries are built.
# "gmake vis" makes global libraries and default (separate) visualization.
# "gmake total" makes everything, including the BREPS and the STEP code.
#
# (The .o files(s) are made by implicit rules.)
MAKEFLAGS= --no-print-directory
SUBDIR1 = global particles processes geometry digits+hits
SUBDIR2 = event tracking track materials run graphics_reps intercoms readout
SUBDIR3 = g3tog4 interfaces visualization
SUBDIR4 = # persistency
ifndef G4INSTALL
G4INSTALL = ..
endif
include $(G4INSTALL)/config/architecture.gmk
.PHONY: all glob global vis clean_libs clean clean_all
all:
@for dir in $(SUBDIR1); do (cd $$dir; $(MAKE)); done
@for dir in $(SUBDIR2); do (cd $$dir; $(MAKE)); done
@for dir in $(SUBDIR3); do (cd $$dir; $(MAKE)); done
glob global:
@for dir in $(SUBDIR1); do (cd $$dir; $(MAKE) global); done
@for dir in $(SUBDIR2); do (cd $$dir; $(MAKE)); done
@for dir in $(SUBDIR3); do (cd $$dir; $(MAKE)); done
# Following vis target is obsolete and should be removed
#
vis:
@for dir in $(SUBDIR1); do (cd $$dir; $(MAKE) global); done
@for dir in $(SUBDIR2); do (cd $$dir; $(MAKE)); done
@for dir in $(SUBDIR3); do (cd $$dir; $(MAKE)); done
clean_libs:
@echo Removing all libraries ...
@for dir in $(SUBDIR1); do (cd $$dir; $(MAKE) clean_libs); done
@for dir in $(SUBDIR2); do (cd $$dir; $(MAKE) clean_libs); done
@for dir in $(SUBDIR3); do (cd $$dir; $(MAKE) clean_libs); done
ifdef CFRONT
@rm -rf $(G4TREP)
endif
clean:
@echo Removing current $(G4SYSTEM) installation ...
@rm -rf $(G4TMP)/$(G4SYSTEM)
@rm -rf $(G4LIB)/$(G4SYSTEM)
@rm -rf $(G4BIN)/$(G4SYSTEM)
ifdef CFRONT
@rm -rf $(G4TREP)
endif
# Pay _extremely_ attention to perform the following target !!
#
clean_all:
@echo Removing all installations ...
@echo Removing $(G4TMP) ...
@rm -rf $(G4TMP)
@echo Removing $(G4LIB) ...
@rm -rf $(G4LIB)
@echo Removing $(G4BIN) ...
@rm -rf $(G4BIN)
+15
View File
@@ -0,0 +1,15 @@
# $Id: GNUmakefile,v 2.0 1998/07/02 16:15:33 gunter Exp $
# --------------------------------------------------------------
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
# --------------------------------------------------------------
name := G4digits+hits
SUBDIRS := detector hits digits
SUBLIBS = G4detector G4digits G4hits
ifndef G4INSTALL
G4INSTALL = ../..
endif
include $(G4INSTALL)/config/globlib.gmk
+57
View File
@@ -0,0 +1,57 @@
$Id: History,v 2.3 1998/10/26 01:52:40 asaim Exp $
-------------------------------------------------------------------
=========================================================
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 *
----------------------------------------------------------
Oct 26, 98 M.Asai (tag digits+hits-00-03-01)
- Debugged in G4HCofThisEvent.hh and G4DCofThisEvent.hh
July 15, 98 M.Asai (tag digits+hits-00-01-02)
- Modify some UI command definitions.
July 4, 98 M.Asai (tag digits+hits-00-01-01)
- Ready for the beta release.
July 1, 98 M.Asai (tag digits+hits-00-07-02)
- G4TDigiCollection has been debugged.
June 30, 98 M.Asai (tag digits+hits-00-07-01)
- Introduce G4Allocator for G4HCofThisEvent, G4DCofThisEvent,
G4HitsCollection, G4DigiCollection.
- New template classes G4THitsCollection and G4TDigiCollection
- New base class protected method in G4VSensitiveDetector
- Corrections in G4VReadoutGeometry
June 11, 98 G.Cosmo (digits+hits-00-06-02)
- Removed CR characters from G4HCtable.hh, .cc (P.Urban)
June 8, 98 M.Asai
- Tagged as digits+hits-00-06-01
June 6, 98 M.Asai
- New sub-directories (detector, hits, digits) are introduced.
- All codes which used to be in include and src directories are
moved to the newly created sub-directories.
- GNUmakefile is completely changed to catch up the new directory
structure.
April 21, 98 M.Asai
- Tagged as hits-00-05-01.
December 19, 97 G. Cosmo - (alpha03)
- Created.
+28
View File
@@ -0,0 +1,28 @@
# $Id: GNUmakefile,v 2.0 1998/07/02 16:14:54 gunter Exp $
# --------------------------------------------------------------
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
# --------------------------------------------------------------
name := G4detector
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/digits+hits/hits/include \
-I$(G4BASE)/intercoms/include
include $(G4INSTALL)/config/common.gmk
+21
View File
@@ -0,0 +1,21 @@
$Id: History,v 2.0 1998/07/02 16:14:40 gunter Exp $
-------------------------------------------------------------------
=========================================================
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 *
----------------------------------------------------------
June 6, 98 M.Asai
- Created.
@@ -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: G4HCtable.hh,v 2.1 1998/07/12 02:53:17 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4HCtable_H
#define G4HCtable_H 1
#include "globals.hh"
#include <rw/tvordvec.h>
class G4HCtable
{
public:
G4HCtable();
~G4HCtable();
public:
G4int Registor(G4String SDname,G4String HCname);
G4int GetCollectionID(G4String HCname);
private:
RWTValOrderedVector<G4String> SDlist;
RWTValOrderedVector<G4String> HClist;
public:
inline G4int entries() const
{ return HClist.entries(); }
};
#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: G4SDManager.hh,v 2.1 1998/07/12 02:53:19 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4SDManager_h
#define G4SDManager_h 1
#include "globals.hh"
#include "G4SDStructure.hh"
#include "G4HCtable.hh"
class G4VHitsCollection;
class G4VSensitiveDetector;
class G4HCofThisEvent;
class G4SDmessenger;
class G4SDManager
{
public:
static G4SDManager* GetSDMpointer();
static G4SDManager* GetSDMpointerIfExist();
protected:
G4SDManager();
public:
~G4SDManager();
void AddNewDetector(G4VSensitiveDetector*aSD);
G4HCofThisEvent* PrepareNewEvent();
void TerminateCurrentEvent(G4HCofThisEvent* HCE);
void Activate(G4String dName, G4bool activeFlag);
G4int GetCollectionID(G4String colName);
G4int GetCollectionID(G4VHitsCollection * aHC);
G4VSensitiveDetector* FindSensitiveDetector(G4String dName);
private:
static G4SDManager * fSDManager;
G4SDStructure * treeTop;
G4int verboseLevel;
G4HCtable* HCtable;
G4SDmessenger* theMessenger;
public:
inline void SetVerboseLevel(G4int vl)
{
verboseLevel = vl;
treeTop->SetVerboseLevel(vl);
}
inline G4SDStructure* GetTreeTop() const
{ return treeTop; }
inline void ListTree() const
{ treeTop->ListTree(); }
inline G4int GetCollectionCapacity() const
{ return HCtable->entries(); }
inline G4HCtable* GetHCtable() const
{ return HCtable; }
};
#endif
@@ -0,0 +1,67 @@
// 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: G4SDStructure.hh,v 2.1 1998/07/12 02:53:19 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4SDStructure_h
#define G4SDStructure_h 1
// Globals
#include "globals.hh"
// G4VSensitiveDetector
#include "G4VSensitiveDetector.hh"
// RWTPtrOrderedVector
#include <rw/tpordvec.h>
class G4HCofThisEvent;
class G4SDStructure
{
public:
G4SDStructure(G4String aPath);
~G4SDStructure();
int operator==(const G4SDStructure &right) const;
void AddNewDetector(G4VSensitiveDetector*aSD, G4String treeStructure);
void Activate(G4String aName, G4bool sensitiveFlag);
void Initialize(G4HCofThisEvent*HCE);
void Terminate(G4HCofThisEvent*HCE);
G4VSensitiveDetector* FindSensitiveDetector(G4String aName);
G4VSensitiveDetector* GetSD(G4String aName);
void ListTree();
private:
G4SDStructure* FindSubDirectory(G4String subD);
G4String ExtractDirName(G4String aPath);
private:
RWTPtrOrderedVector<G4SDStructure> structure;
RWTPtrOrderedVector<G4VSensitiveDetector> detector;
G4String pathName;
G4String dirName;
G4int verboseLevel;
public:
inline void SetVerboseLevel(G4int vl)
{
verboseLevel = vl;
for(int i=0; i<structure.entries(); i++)
{ structure(i)->SetVerboseLevel(vl); }
for(int j=0; j<detector.entries(); j++)
{ detector(j)->SetVerboseLevel(vl); }
};
};
#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: G4SDmessenger.hh,v 2.1 1998/07/12 02:53:20 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4SDmessenger_h
#define G4SDmessenger_h 1
#include "G4UImessenger.hh"
class G4SDManager;
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4SDmessenger: public G4UImessenger
{
public:
G4SDmessenger(G4SDManager * SDManager);
~G4SDmessenger();
void SetNewValue(G4UIcommand * command,G4String newValues);
private:
G4SDManager * fSDMan;
G4UIdirectory* hitsDir;
G4UIcmdWithoutParameter* listCmd;
G4UIcmdWithAString* activeCmd;
G4UIcmdWithAString* inactiveCmd;
G4UIcmdWithAnInteger* verboseCmd;
};
#endif
@@ -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: G4SensitiveVolumeList.hh,v 2.1 1998/07/12 02:53:20 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file --- Copyright CERN 1996
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on Hits+Digi domain
// object model of April 1996, S.Piperov
//
// ---------------- G4SensitiveVolumeList -----------------
#ifndef G4SensitiveVolumeList_h
#define G4SensitiveVolumeList_h 1
#include <rw/tpordvec.h>
#include <rw/tvordvec.h>
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
class G4SensitiveVolumeList
{
public:
//Constructors
G4SensitiveVolumeList();
G4SensitiveVolumeList(const G4SensitiveVolumeList &right);
//Destructor
~G4SensitiveVolumeList();
//Assignment Operation
const G4SensitiveVolumeList & operator=(const G4SensitiveVolumeList &right
);
//Equality Operations
G4int operator==(const G4SensitiveVolumeList &right) const;
G4int operator!=(const G4SensitiveVolumeList &right) const;
//Other Operations
G4bool CheckPV(const G4VPhysicalVolume *pvp) const;
G4bool CheckLV(const G4LogicalVolume *lvp) const;
//Get and Set Operations for Has Relationships
const RWTPtrOrderedVector<G4VPhysicalVolume>& GetThePhysicalVolumeList() const;
void SetThePhysicalVolumeList(const RWTPtrOrderedVector<G4VPhysicalVolume> value);
const RWTPtrOrderedVector<G4LogicalVolume>& GetTheLogicalVolumeList() const;
void SetTheLogicalVolumeList(const RWTPtrOrderedVector<G4LogicalVolume> value);
private:
//Data Members for Has Relationships
RWTPtrOrderedVector<G4VPhysicalVolume> thePhysicalVolumeList;
RWTPtrOrderedVector<G4LogicalVolume> theLogicalVolumeList;
};
#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: G4SensitiveVolumeList.icc,v 2.0 1998/07/02 16:14:33 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
// -----------------------------------------------------------
// Inline functions of GEANT 4 class header file.
// --- Copyright CERN 1996, CERN Geneva Switzerland ---
//
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on Hits+Digi domain
// object model of April 1996, S.Piperov
//
// ---------------- G4SensitiveVolumeList -----------------
//Get and Set Operations for Has Relationships
inline const RWTPtrOrderedVector<G4VPhysicalVolume>& G4SensitiveVolumeList::get_the_G4VPhysicalVolume_list() const { return the_G4VPhysicalVolume_list; }
inline void G4SensitiveVolumeList::set_the_G4VPhysicalVolume_list(const RWTPtrOrderedVector<G4VPhysicalVolume> value) { the_G4VPhysicalVolume_list = value; }
inline const RWTPtrOrderedVector<G4LogicalVolume>& G4SensitiveVolumeList::get_the_G4LogicalVolume() const { return the_G4LogicalVolume_list; }
inline void G4SensitiveVolumeList::set_the_G4LogicalVolume(const RWTPtrOrderedVector<G4LogicalVolume> value) { the_G4LogicalVolume_list = value; }
@@ -0,0 +1,76 @@
// 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: G4VReadOutGeometry.hh,v 2.1 1998/07/12 02:53:20 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// ------------------------------------------------------------
#ifndef G4VReadOutGeometry_h
#define G4VReadOutGeometry_h
#include "G4SensitiveVolumeList.hh"
#include "G4Step.hh"
#include "G4TouchableHistory.hh"
class G4Navigator;
class G4VReadOutGeometry
{
protected:
virtual G4VPhysicalVolume* Build() = 0; // must return the world of the ROGeometry;
public:
G4VReadOutGeometry();
G4VReadOutGeometry(const G4VReadOutGeometry &right);
G4VReadOutGeometry(G4String);
virtual ~G4VReadOutGeometry();
const G4VReadOutGeometry & operator=(const G4VReadOutGeometry &right);
G4int operator==(const G4VReadOutGeometry &right) const;
G4int operator!=(const G4VReadOutGeometry &right) const;
// buildROGeomety must be invoked to Build (ie Build() method)
// the ROGeometry. It sets up in addition the needed
// the G4Navigator used to navigate inside this ROGeometry.
void BuildROGeometry();
G4bool CheckROVolume(G4Step*,G4TouchableHistory*&);
protected:
G4bool FindROTouchable(G4Step*);
G4VPhysicalVolume* ROworld;
G4SensitiveVolumeList* fincludeList;
G4SensitiveVolumeList* fexcludeList;
G4String name;
private:
G4Navigator* ROnavigator;
G4TouchableHistory* touchableHistory;
public:
inline const G4SensitiveVolumeList* GetIncludeList() const
{ return fincludeList; }
inline void SetIncludeList(G4SensitiveVolumeList* value)
{ fincludeList = value; }
inline const G4SensitiveVolumeList* GetExcludeList() const
{ return fexcludeList; }
inline void SetExcludeList(G4SensitiveVolumeList* value)
{ fexcludeList = value; }
inline G4String GetName() const
{ return name; }
inline void SetName(G4String value)
{ name = value; }
// ADDED:
inline G4VPhysicalVolume* GetROWorld() const
{ return ROworld;}
};
#endif
@@ -0,0 +1,96 @@
// 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: G4VSensitiveDetector.hh,v 2.1 1998/07/12 02:53:21 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4VSensitiveDetector_h
#define G4VSensitiveDetector_h 1
#include "G4VHit.hh"
#include "G4Step.hh"
#include "G4HCofThisEvent.hh"
#include "G4VReadOutGeometry.hh"
#include "G4TouchableHistory.hh"
#include <rw/tvordvec.h>
class G4VSensitiveDetector
{
public:
G4VSensitiveDetector(G4String name);
G4VSensitiveDetector(const G4VSensitiveDetector &right);
virtual ~G4VSensitiveDetector();
const G4VSensitiveDetector & operator=(const G4VSensitiveDetector &right);
int operator==(const G4VSensitiveDetector &right) const;
int operator!=(const G4VSensitiveDetector &right) const;
virtual void Initialize(G4HCofThisEvent*HCE);
virtual void EndOfEvent(G4HCofThisEvent*HCE);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
protected:
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist) = 0;
G4int GetCollectionID(G4int i);
G4String SensitiveDetectorName; // detector name
G4String thePathName; // directory path
G4String fullPathName; // path + detector name
G4int verboseLevel;
G4bool active;
RWTValOrderedVector<G4String> collectionName;
private:
G4VReadOutGeometry * ROgeometry;
public:
inline G4bool Hit(G4Step*aStep)
{
G4bool ack = true;
G4TouchableHistory* ROhis = NULL;
if(!isActive())
{ ack = false; }
else if(ROgeometry)
{ ack = ROgeometry->CheckROVolume(aStep,ROhis); }
if(ack)
{ ack = ProcessHits(aStep,ROhis); }
return ack;
}
inline G4int GetNumberOfCollections()
{ return collectionName.entries(); };
inline G4String GetCollectionName(G4int id)
{ return collectionName[id]; };
inline void SetVerboseLevel(G4int vl)
{ verboseLevel = vl; };
inline void Activate(G4bool activeFlag)
{ active = activeFlag; };
inline G4bool isActive()
{ return active; };
inline G4String GetName()
{ return SensitiveDetectorName; };
inline G4String GetPathName()
{ return thePathName; };
inline G4String GetFullPathName()
{ return fullPathName; };
inline void SetROgeometry(G4VReadOutGeometry*value)
{ ROgeometry = value; };
inline G4VReadOutGeometry* GetROgeometry()
{ return ROgeometry; };
};
#endif
@@ -0,0 +1,58 @@
// 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: G4HCtable.cc,v 2.1 1998/07/12 02:53:29 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4HCtable.hh"
G4HCtable::G4HCtable() {;}
G4HCtable::~G4HCtable() {;}
G4int G4HCtable::Registor(G4String SDname,G4String HCname)
{
for(int i=0;i<HClist.entries();i++)
{ if(HClist[i]==HCname && SDlist[i]==SDname) return -1; }
HClist.insert(HCname);
SDlist.insert(SDname);
return HClist.entries();
}
G4int G4HCtable::GetCollectionID(G4String HCname)
{
G4int i = -1;
if(HCname.index("/")==RW_NPOS) // HCname only
{
for(G4int j=0;j<HClist.entries();j++)
{
if(HClist[j]==HCname)
{
if(i>=0) return -2;
i = j;
}
}
}
else
{
for(G4int j=0;j<HClist.entries();j++)
{
G4String tgt = SDlist[j];
tgt += "/";
tgt += HClist[j];
if(tgt==HCname)
{
if(i>=0) return -2;
i = j;
}
}
}
return i;
}
@@ -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: G4SDManager.cc,v 2.2 1998/07/13 16:50:04 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4SDManager.hh"
#include "G4SDmessenger.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4VSensitiveDetector.hh"
#include "G4ios.hh"
G4SDManager* G4SDManager::fSDManager = 0;
G4SDManager* G4SDManager::GetSDMpointer()
{
if(!fSDManager)
{
fSDManager = new G4SDManager;
}
return fSDManager;
}
G4SDManager* G4SDManager::GetSDMpointerIfExist()
{ return fSDManager; }
G4SDManager::G4SDManager():verboseLevel(0)
{
G4String topName = "/";
treeTop = new G4SDStructure(topName);
theMessenger = new G4SDmessenger(this);
HCtable = new G4HCtable;
}
G4SDManager::~G4SDManager()
{
delete theMessenger;
}
void G4SDManager::AddNewDetector(G4VSensitiveDetector*aSD)
{
G4String pathName = aSD->GetPathName();
G4int numberOfCollections = aSD->GetNumberOfCollections();
if( pathName(0) != '/' ) pathName.prepend("/");
if( pathName(pathName.length()-1) != '/' ) pathName += "/";
treeTop->AddNewDetector(aSD,pathName);
for(int i=0;i<numberOfCollections;i++)
{
G4String SDname = aSD->GetName();
G4String DCname = aSD->GetCollectionName(i);
HCtable->Registor(SDname,DCname);
}
if( verboseLevel > 0 )
{
G4cout << "New sensitive detector <" << aSD->GetName()
<< "> is registored at " << pathName << endl;
}
}
G4HCofThisEvent* G4SDManager::PrepareNewEvent()
{
G4HCofThisEvent* HCE = new G4HCofThisEvent(HCtable->entries());
treeTop->Initialize(HCE);
return HCE;
}
void G4SDManager::TerminateCurrentEvent(G4HCofThisEvent* HCE)
{
treeTop->Terminate(HCE);
}
void G4SDManager::Activate(G4String dName, G4bool activeFlag)
{
G4String pathName = dName;
if( pathName(0) != '/' ) pathName.prepend("/");
treeTop->Activate(pathName,activeFlag);
}
G4VSensitiveDetector* G4SDManager::FindSensitiveDetector(G4String dName)
{
G4String pathName = dName;
if( pathName(0) != '/' ) pathName.prepend("/");
return treeTop->FindSensitiveDetector(pathName);
}
G4int G4SDManager::GetCollectionID(G4String colName)
{
G4int id = HCtable->GetCollectionID(colName);
if(id==-1)
{ G4cout << "<" << colName << "> is not found." << endl; }
else if(id==-2)
{ G4cout << "<" << colName << "> is ambiguous." << endl; }
return id;
}
G4int G4SDManager::GetCollectionID(G4VHitsCollection* aHC)
{
G4String HCname = aHC->GetSDname();
HCname += "/";
HCname += aHC->GetName();
return GetCollectionID(HCname);
}
@@ -0,0 +1,217 @@
// 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: G4SDStructure.cc,v 2.2 1998/07/13 16:50:05 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// G4SDStructure
#include "G4SDStructure.hh"
#include "G4ios.hh"
G4SDStructure::G4SDStructure(G4String aPath):verboseLevel(0)
{
pathName = aPath;
dirName = aPath;
int i = dirName.length();
if( i > 1 )
{
dirName.remove(i-1);
int isl = dirName.last('/');
dirName.remove(0,isl+1);
dirName += "/";
}
}
G4SDStructure::~G4SDStructure()
{
}
int G4SDStructure::operator==(const G4SDStructure &right) const
{
return false;
}
void G4SDStructure::AddNewDetector(G4VSensitiveDetector*aSD,
G4String treeStructure)
{
G4String remainingPath = treeStructure;
remainingPath.remove(0,pathName.length());
if( ! remainingPath.isNull() )
{ // The detector should be kept in subdirectory.
// First, check if the subdirectoy exists.
G4String subD = ExtractDirName( remainingPath );
G4SDStructure* tgtSDS = FindSubDirectory(subD);
if( tgtSDS == NULL )
{ // Subdirectory not found. Create a new directory.
subD.prepend(pathName);
tgtSDS = new G4SDStructure(subD);
structure.insert( tgtSDS );
}
tgtSDS->AddNewDetector(aSD,treeStructure);
}
else
{ // The sensitive detector should be kept in this directory.
G4VSensitiveDetector* tgtSD = GetSD( aSD->GetName() );
if( tgtSD != NULL )
{
G4cout << aSD->GetName() << " had already stored in "
<< pathName << endl;
}
else
{
detector.insert( aSD );
}
}
}
G4SDStructure* G4SDStructure::FindSubDirectory(G4String subD)
{
for( int i=0; i<structure.entries(); i++ )
{
if( subD == structure(i)->dirName ) return structure(i);
}
return NULL;
}
G4VSensitiveDetector* G4SDStructure::GetSD(G4String aSDName)
{
for( int i=0; i<detector.entries(); i++ )
{
G4VSensitiveDetector* tgtSD = detector(i);
if( aSDName == tgtSD->GetName() ) return tgtSD;
}
return NULL;
}
G4String G4SDStructure::ExtractDirName(G4String aName)
{
G4String subD = aName;
int i = aName.first('/');
if( i != RW_NPOS ) subD.remove(i+1);
return subD;
}
void G4SDStructure::Activate(G4String aName, G4bool sensitiveFlag)
{
G4String aPath = aName;
aPath.remove(0,pathName.length());
if( aPath.first('/') != RW_NPOS )
{ // Command is ordered for a subdirectory.
G4String subD = ExtractDirName(aPath);
G4SDStructure* tgtSDS = FindSubDirectory(subD);
if( tgtSDS == NULL )
{ // The subdirectory is not found
G4cout << subD << " is not found in " << pathName << endl;
}
else
{
tgtSDS->Activate(aName,sensitiveFlag);
}
}
else if( aPath.isNull() )
{ // Command is ordered for all detectors in this directory.
for( int i=0; i<detector.entries(); i++)
{
detector(i)->Activate(sensitiveFlag);
}
for( int j=0;j<structure.entries(); j++)
{
structure(j)->Activate(G4String("/"),sensitiveFlag);
}
}
else
{ // Command is ordered to a particular detector.
G4VSensitiveDetector* tgtSD = GetSD(aPath);
if( tgtSD == NULL )
{ // The detector is not found.
G4cout << aPath << " is not found in " << pathName << endl;
}
else
{
tgtSD->Activate(sensitiveFlag);
}
}
}
G4VSensitiveDetector* G4SDStructure::FindSensitiveDetector(G4String aName)
{
G4String aPath = aName;
aPath.remove(0,pathName.length());
if( aPath.first('/') != RW_NPOS )
{ // SD exists in sub-directory
G4String subD = ExtractDirName(aPath);
G4SDStructure* tgtSDS = FindSubDirectory(subD);
if( tgtSDS == NULL )
{ // The subdirectory is not found
G4cout << subD << " is not found in " << pathName << endl;
return NULL;
}
else
{
return tgtSDS->FindSensitiveDetector(aName);
}
}
else
{ // SD must exist in this directory
G4VSensitiveDetector* tgtSD = GetSD(aPath);
if( tgtSD == NULL )
{ // The detector is not found.
G4cout << aPath << " is not found in " << pathName << endl;
}
return tgtSD;
}
}
void G4SDStructure::Initialize(G4HCofThisEvent*HCE)
{
int i;
// Broadcast to subdirectories.
for( i=0; i<structure.entries(); i++ )
{
structure(i)->Initialize(HCE);
}
// Initialize all detectors in this directory.
for( i=0; i<detector.entries(); i++ )
{
if(detector(i)->isActive()) detector(i)->Initialize(HCE);
}
}
void G4SDStructure::Terminate(G4HCofThisEvent*HCE)
{
int i;
// Broadcast to subdirectories.
for( i=0; i<structure.entries(); i++ )
{
structure(i)->Terminate(HCE);
}
// Initialize all detectors in this directory.
for( i=0; i<detector.entries(); i++ )
{
if(detector(i)->isActive()) detector(i)->EndOfEvent(HCE);
}
}
void G4SDStructure::ListTree()
{
G4cout << pathName << endl;
for(int i=0; i<detector.entries(); i++)
{
G4VSensitiveDetector* sd = detector(i);
G4cout << pathName << sd->GetName();
if( sd->isActive() )
{ G4cout << " *** Active "; }
else
{ G4cout << " XXX Inactive "; }
G4cout << endl;
}
for(int j=0; j<structure.entries(); j++)
{ structure(j)->ListTree(); }
}
@@ -0,0 +1,65 @@
// 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: G4SDmessenger.cc,v 2.2 1998/07/14 17:24:16 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
// ---------------------------------------------------------------------
#include "G4SDmessenger.hh"
#include "G4SDManager.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
G4SDmessenger::G4SDmessenger(G4SDManager* SDManager):fSDMan(SDManager)
{
hitsDir = new G4UIdirectory("/hits/");
hitsDir->SetGuidance("Sensitive detectors and Hits");
listCmd = new G4UIcmdWithoutParameter("/hits/list",this);
listCmd->SetGuidance("List sensitive detector tree.");
activeCmd = new G4UIcmdWithAString("/hits/activate",this);
activeCmd->SetGuidance("Activate sensitive detector(s).");
activeCmd->SetParameterName("detector",true);
activeCmd->SetDefaultValue("/");
inactiveCmd = new G4UIcmdWithAString("/hits/inactivate",this);
inactiveCmd->SetGuidance("Inactivate sensitive detector(s).");
inactiveCmd->SetParameterName("detector",true);
inactiveCmd->SetDefaultValue("/");
verboseCmd = new G4UIcmdWithAnInteger("/hits/verbose",this);
verboseCmd->SetGuidance("Set the Verbose level.");
verboseCmd->SetParameterName("level",false);
}
G4SDmessenger::~G4SDmessenger()
{
delete listCmd;
delete activeCmd;
delete inactiveCmd;
delete verboseCmd;
delete hitsDir;
}
void G4SDmessenger::SetNewValue(G4UIcommand * command,G4String newVal)
{
if( command==listCmd )
{ fSDMan->ListTree(); }
if( command==activeCmd )
{ fSDMan->Activate(newVal,1); }
if( command==inactiveCmd )
{ fSDMan->Activate(newVal,0); }
if( command==verboseCmd )
{ fSDMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal)); }
return;
}
@@ -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: G4SensitiveVolumeList.cc,v 2.1 1998/07/12 02:53:31 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD Group
// History: first implementation June'96, based on Hits+Digi
// domain model of April 1996, S.Piperov
//
// ---------------- G4SensitiveVolumeList -----------------
#include "G4SensitiveVolumeList.hh"
//Constructors
G4SensitiveVolumeList::G4SensitiveVolumeList()
{
}
G4SensitiveVolumeList::G4SensitiveVolumeList(const G4SensitiveVolumeList &right)
{
thePhysicalVolumeList = right.thePhysicalVolumeList;
theLogicalVolumeList = right.theLogicalVolumeList;
}
//Destructor
G4SensitiveVolumeList::~G4SensitiveVolumeList()
{
}
//Assignment Operation
const G4SensitiveVolumeList & G4SensitiveVolumeList::operator=(const G4SensitiveVolumeList &right)
{
thePhysicalVolumeList = right.thePhysicalVolumeList;
theLogicalVolumeList = right.theLogicalVolumeList;
return *this;
}
//Equality Operations
G4int G4SensitiveVolumeList::operator==(const G4SensitiveVolumeList &right) const
{
return (this == (G4SensitiveVolumeList *) &right);
}
G4int G4SensitiveVolumeList::operator!=(const G4SensitiveVolumeList &right) const
{
return (this != (G4SensitiveVolumeList *) &right);
}
//Other Operations
G4bool G4SensitiveVolumeList::CheckPV(const G4VPhysicalVolume * pvp) const
{
if (thePhysicalVolumeList.entries()==0) return false;
for(int i=0;i<thePhysicalVolumeList.entries();i++)
{ if(thePhysicalVolumeList(i)==pvp) return true; }
return false;
}
G4bool G4SensitiveVolumeList::CheckLV(const G4LogicalVolume * lvp) const
{
if (theLogicalVolumeList.entries()==0) return false;
for(int i=0;i<theLogicalVolumeList.entries();i++)
{ if(theLogicalVolumeList(i)==lvp) return true; }
return false;
}
@@ -0,0 +1,136 @@
// 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: G4VReadOutGeometry.cc,v 2.1 1998/07/12 02:53:31 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4VReadOutGeometry.hh"
#include "G4Navigator.hh"
G4VReadOutGeometry::G4VReadOutGeometry()
:ROworld(NULL),touchableHistory(NULL),
fincludeList(NULL),fexcludeList(NULL)
{
name = "unknown";
ROnavigator = new G4Navigator();
}
G4VReadOutGeometry::G4VReadOutGeometry(const G4VReadOutGeometry &right)
{
fincludeList = right.fincludeList;
fexcludeList = right.fexcludeList;
name = right.name;
ROworld = right.ROworld;
touchableHistory = NULL;
// COPY CONSTRUCTOR NOT STRAIGHT FORWARD: need to copy the touchabelHistory
// VALUE, same foe navigator and same for the World+Geom hierachy ??
}
G4VReadOutGeometry::G4VReadOutGeometry(G4String n)
:name(n),ROworld(NULL),touchableHistory(NULL),
fincludeList(NULL),fexcludeList(NULL)
{
ROnavigator = new G4Navigator();
}
G4VReadOutGeometry::~G4VReadOutGeometry()
{
//if(ROworld) delete ROworld; //should we do ? will it delete the goem tree also ?
if(fincludeList) delete fincludeList;
if(fexcludeList) delete fexcludeList;
if(touchableHistory) delete touchableHistory;
if(ROnavigator) delete ROnavigator;
}
const G4VReadOutGeometry & G4VReadOutGeometry::operator=(const G4VReadOutGeometry &right)
{
fincludeList = right.fincludeList;
fexcludeList = right.fexcludeList;
name = right.name;
ROworld = right.ROworld;
touchableHistory = NULL;
return *this;
}
G4int G4VReadOutGeometry::operator==(const G4VReadOutGeometry &right) const
{ return (this == (G4VReadOutGeometry *) &right); }
G4int G4VReadOutGeometry::operator!=(const G4VReadOutGeometry &right) const
{ return (this != (G4VReadOutGeometry *) &right); }
void G4VReadOutGeometry::BuildROGeometry()
{
ROworld = Build();
ROnavigator->SetWorldVolume(ROworld);
}
G4bool G4VReadOutGeometry::CheckROVolume(G4Step*currentStep,G4TouchableHistory*& ROhist)
{
ROhist = NULL;
G4bool incFlg = true;
G4VPhysicalVolume* PV = currentStep->GetPreStepPoint()->GetPhysicalVolume();
if((fexcludeList)&&(fexcludeList->CheckPV(PV)))
{ incFlg = false; }
else if ((fincludeList)&&(fincludeList->CheckPV(PV)))
{ incFlg = true; }
else if((fexcludeList)&&(fexcludeList->CheckLV(PV->GetLogicalVolume())))
{ incFlg = false; }
else if((fincludeList)&&(fincludeList->CheckLV(PV->GetLogicalVolume())))
{ incFlg = true; }
if(!incFlg) return false;
if(ROworld)
{ incFlg = FindROTouchable(currentStep); }
if(incFlg)
{ ROhist = touchableHistory; }
return incFlg;
}
G4bool G4VReadOutGeometry::FindROTouchable(G4Step*currentStep)
{
// Update G4TouchableHistory object (touchableHistory)
// using the parallel readout world (ROworld)
// Return false in case the current Step is outside of the
// sensitive volume of the readout world.
// At first invokation, creates the touchable history. Note
// that default value (false) of Locate method is used.
if(!touchableHistory)
{
touchableHistory = new G4TouchableHistory();
ROnavigator->LocateGlobalPointAndUpdateTouchable(
currentStep->GetPreStepPoint()->GetPosition(),
touchableHistory);
}
else
{
ROnavigator->LocateGlobalPointAndUpdateTouchable(
currentStep->GetPreStepPoint()->GetPosition(),
touchableHistory,
true);
}
// Can the above be improved by the use of an isotropic safety
// in order to avoid LocateGlobalPointAndUpdateTouchable
// at each Step ?
// Should require that an RO geometry is notified at the
// starting of a track to avoid possible confusion looking
// at the safety value only.
// checks if volume is sensitive:
G4VPhysicalVolume* currentVolume;
// checks first if a physical volume exists here:
if ( currentVolume = touchableHistory->GetVolume() )
{
return currentVolume->GetLogicalVolume()->
GetSensitiveDetector() != NULL;
}
// no sensitive volume found: returns false
return false;
}
@@ -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: G4VSensitiveDetector.cc,v 2.1 1998/07/12 02:53:32 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// G4VSensitiveDetector
#include "G4VSensitiveDetector.hh"
#include "G4SDManager.hh"
G4VSensitiveDetector::G4VSensitiveDetector(G4String name)
:verboseLevel(0),active(true),ROgeometry(NULL)
{
size_t sLast = name.last('/');
if(sLast==RW_NPOS)
{ // detector name only
SensitiveDetectorName = name;
thePathName = "/";
}
else
{ // name conatin the directory path
SensitiveDetectorName = name;
SensitiveDetectorName.remove(0,sLast+1);
thePathName = name;
thePathName.remove(sLast+1,name.length()-sLast);
if(thePathName(0)!='/') thePathName.prepend("/");
}
fullPathName = thePathName + SensitiveDetectorName;
}
G4VSensitiveDetector::G4VSensitiveDetector(const G4VSensitiveDetector &right)
{
}
G4VSensitiveDetector::~G4VSensitiveDetector()
{
}
const G4VSensitiveDetector & G4VSensitiveDetector::operator=(const G4VSensitiveDetector &right)
{
return *this;
}
int G4VSensitiveDetector::operator==(const G4VSensitiveDetector &right) const
{
return false;
}
int G4VSensitiveDetector::operator!=(const G4VSensitiveDetector &right) const
{
return true;
}
G4int G4VSensitiveDetector::GetCollectionID(G4int i)
{
return G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[i]);
}
//----- following methoods are abstract methods to be
//----- implemented in the concrete classes
void G4VSensitiveDetector::Initialize(G4HCofThisEvent*HCE)
{
}
void G4VSensitiveDetector::EndOfEvent(G4HCofThisEvent*HCE)
{
}
void G4VSensitiveDetector::clear()
{
}
void G4VSensitiveDetector::DrawAll()
{
}
void G4VSensitiveDetector::PrintAll()
{
}
+20
View File
@@ -0,0 +1,20 @@
# $Id: GNUmakefile,v 2.0 1998/07/02 16:15:12 gunter Exp $
# --------------------------------------------------------------
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
# --------------------------------------------------------------
name := G4digits
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPGeometry/include
include $(G4INSTALL)/config/common.gmk
+21
View File
@@ -0,0 +1,21 @@
$Id: History,v 2.0 1998/07/02 16:15:04 gunter Exp $
-------------------------------------------------------------------
=========================================================
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 *
----------------------------------------------------------
June 6, 98 M.Asai
- Created.
@@ -0,0 +1,67 @@
// 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: G4DCofThisEvent.hh,v 2.2 1998/10/26 01:53:21 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4DCofThisEvent_h
#define G4DCofThisEvent_h 1
#include "globals.hh"
#include "G4Allocator.hh"
#include "G4VDigiCollection.hh"
#include <rw/tpordvec.h>
class G4DCofThisEvent
{
public:
G4DCofThisEvent();
G4DCofThisEvent(G4int cap);
~G4DCofThisEvent();
inline void *operator new(size_t);
inline void operator delete(void* anDCoTE);
void AddDigiCollection(G4int DCID,G4VDigiCollection * aDC);
private:
RWTPtrOrderedVector<G4VDigiCollection> * DC;
public:
inline G4VDigiCollection* GetDC(G4int i) const
{ return (*DC)[i]; }
inline G4int GetCapacity() const
{
return DC->entries();
}
inline G4int GetNumberOfCollections() const
{
G4int n = 0;
for(int i=0;i<DC->entries();i++)
{
if((*DC)[i]) n++;
}
return n;
}
};
extern G4Allocator<G4DCofThisEvent> anDCoTHAllocator;
inline void* G4DCofThisEvent::operator new(size_t)
{
void* anDCoTH;
anDCoTH = (void*)anDCoTHAllocator.MallocSingle();
return anDCoTH;
}
inline void G4DCofThisEvent::operator delete(void* anDCoTH)
{
anDCoTHAllocator.FreeSingle((G4DCofThisEvent*)anDCoTH);
}
#endif
@@ -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: G4TDigiCollection.hh,v 2.1 1998/07/12 02:53:35 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4TDigiCollection_h
#define G4TDigiCollection_h 1
#include "G4VDigiCollection.hh"
#include "G4Allocator.hh"
#include "globals.hh"
#include <rw/tpordvec.h>
class G4DigiCollection : public G4VDigiCollection
{
public:
G4DigiCollection();
G4DigiCollection(G4String detName,G4String colNam);
virtual ~G4DigiCollection();
int operator==(const G4DigiCollection &right) const;
protected:
void* theCollection;
};
extern G4Allocator<G4DigiCollection> aDCAllocator;
template <class T> class G4TDigiCollection : public G4DigiCollection
{
public:
G4TDigiCollection();
G4TDigiCollection(G4String detName,G4String colNam);
virtual ~G4TDigiCollection();
int operator==(const G4TDigiCollection &right) const;
inline void *operator new(size_t);
inline void operator delete(void* aDC);
virtual void DrawAllDigi();
virtual void PrintAllDigi();
public:
inline T* operator[](size_t i)
{ return (*((RWTPtrOrderedVector<T>*)theCollection))[i]; }
inline RWTPtrOrderedVector<T>* GetVector()
{ return (RWTPtrOrderedVector<T>*)theCollection; }
inline int insert(T* aHit)
{
RWTPtrOrderedVector<T>*theDigiCollection
= (RWTPtrOrderedVector<T>*)theCollection;
theDigiCollection->insert(aHit);
return theDigiCollection->entries();
}
};
template <class T> inline void* G4TDigiCollection<T>::operator new(size_t)
{
void* aDC;
aDC = (void*)aDCAllocator.MallocSingle();
return aDC;
}
template <class T> inline void G4TDigiCollection<T>::operator delete(void* aDC)
{
aDCAllocator.FreeSingle((G4DigiCollection*)aDC);
}
template <class T> G4TDigiCollection<T>::G4TDigiCollection()
{
RWTPtrOrderedVector<T> * theDigiCollection
= new RWTPtrOrderedVector<T>;
theCollection = (void*)theDigiCollection;
}
template <class T> G4TDigiCollection<T>::G4TDigiCollection(G4String detName,G4String colNam)
: G4DigiCollection(detName,colNam)
{
RWTPtrOrderedVector<T> * theDigiCollection
= new RWTPtrOrderedVector<T>;
theCollection = (void*)theDigiCollection;
}
template <class T> G4TDigiCollection<T>::~G4TDigiCollection()
{
RWTPtrOrderedVector<T> * theDigiCollection
= (RWTPtrOrderedVector<T>*)theCollection;
theDigiCollection->clearAndDestroy();
delete theDigiCollection;
}
template <class T> int G4TDigiCollection<T>::operator==(const G4TDigiCollection<T> &right) const
{ return (collectionName==right.collectionName); }
template <class T> void G4TDigiCollection<T>::DrawAllDigi()
{
RWTPtrOrderedVector<T> * theDigiCollection
= (RWTPtrOrderedVector<T>*)theCollection;
int n = theDigiCollection->entries();
for(int i=0;i<n;i++)
{ (*theDigiCollection)[i]->Draw(); }
}
template <class T> void G4TDigiCollection<T>::PrintAllDigi()
{
RWTPtrOrderedVector<T> * theDigiCollection
= (RWTPtrOrderedVector<T>*)theCollection;
int n = theDigiCollection->entries();
for(int i=0;i<n;i++)
{ (*theDigiCollection)[i]->Print(); }
}
#endif
@@ -0,0 +1,30 @@
// 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: G4VDigi.hh,v 2.1 1998/07/12 02:53:36 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4VDigi_h
#define G4VDigi_h 1
class G4VDigi
{
public:
G4VDigi();
virtual ~G4VDigi();
int operator==(const G4VDigi &right) const;
virtual void Draw();
virtual void Print();
};
#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: G4VDigiCollection.hh,v 2.1 1998/07/12 02:53:37 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4VDigiCollection_h
#define G4VDigiCollection_h 1
#include "globals.hh"
class G4VDigiCollection
{
public:
G4VDigiCollection();
G4VDigiCollection(G4String DMnam,G4String colNam);
virtual ~G4VDigiCollection();
int operator==(const G4VDigiCollection &right) const;
virtual void DrawAllDigi();
virtual void PrintAllDigi();
protected:
// Collection name
G4String collectionName;
G4String DMname;
public:
inline G4String GetName()
{ return collectionName; };
inline G4String GetDMname()
{ return DMname; };
};
#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: G4DCofThisEvent.cc,v 2.1 1998/07/12 02:53:39 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4DCofThisEvent.hh"
G4Allocator<G4DCofThisEvent> anDCoTHAllocator;
G4DCofThisEvent::G4DCofThisEvent()
{
DC = new RWTPtrOrderedVector<G4VDigiCollection>;
}
G4DCofThisEvent::G4DCofThisEvent(G4int cap)
{
DC = new RWTPtrOrderedVector<G4VDigiCollection>;
for(int i=0;i<cap;i++)
{
DC->insert((G4VDigiCollection*)NULL);
}
}
G4DCofThisEvent::~G4DCofThisEvent()
{
DC->clearAndDestroy();
delete DC;
}
void G4DCofThisEvent::AddDigiCollection(G4int DCID,G4VDigiCollection * aDC)
{
if(DCID>=0 && DCID<DC->entries())
{ (*DC)[DCID] = aDC; }
}
@@ -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: G4TDigiCollection.cc,v 2.0 1998/07/02 16:15:05 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4TDigiCollection.hh"
G4Allocator<G4DigiCollection> aDCAllocator;
G4DigiCollection::G4DigiCollection()
{;}
G4DigiCollection::G4DigiCollection(G4String detName,G4String colNam)
: G4VDigiCollection(detName,colNam)
{;}
G4DigiCollection::~G4DigiCollection()
{;}
int G4DigiCollection::operator==(const G4DigiCollection &right) const
{ return (collectionName==right.collectionName); }
+30
View File
@@ -0,0 +1,30 @@
// 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: G4VDigi.cc,v 2.1 1998/07/12 02:53:39 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// G4VDigi
#include "G4VDigi.hh"
#include "globals.hh"
G4VDigi::G4VDigi()
{;}
G4VDigi::~G4VDigi()
{;}
int G4VDigi::operator==(const G4VDigi &right) const
{ return false; }
void G4VDigi::Draw()
{;}
void G4VDigi::Print()
{;}
@@ -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: G4VDigiCollection.cc,v 2.1 1998/07/12 02:53:40 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// G4VDigiCollection
#include "G4VDigiCollection.hh"
G4VDigiCollection::G4VDigiCollection()
{
collectionName = "Unknown";
DMname = "Unknown";
}
G4VDigiCollection::G4VDigiCollection(G4String DMnam,G4String colNam)
{
collectionName = colNam;
DMname = DMnam;
}
G4VDigiCollection::~G4VDigiCollection()
{ ; }
int G4VDigiCollection::operator==(const G4VDigiCollection &right) const
{
return ((collectionName==right.collectionName)
&&(DMname==right.DMname));
}
void G4VDigiCollection::DrawAllDigi()
{;}
void G4VDigiCollection::PrintAllDigi()
{;}
+19
View File
@@ -0,0 +1,19 @@
# $Id: GNUmakefile,v 2.0 1998/07/02 16:15:31 gunter Exp $
# --------------------------------------------------------------
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
# --------------------------------------------------------------
name := G4hits
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPGeometry/include
include $(G4INSTALL)/config/common.gmk
+21
View File
@@ -0,0 +1,21 @@
$Id: History,v 2.0 1998/07/02 16:15:22 gunter Exp $
-------------------------------------------------------------------
=========================================================
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 *
----------------------------------------------------------
June 6, 98 M.Asai
- Created.
@@ -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: G4HCofThisEvent.hh,v 2.2 1998/10/26 01:53:29 asaim 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,126 @@
// 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: G4THitsCollection.hh,v 2.1 1998/07/12 02:53:42 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4THitsCollection_h
#define G4THitsCollection_h 1
#include "G4VHitsCollection.hh"
#include "G4Allocator.hh"
#include "globals.hh"
#include <rw/tpordvec.h>
class G4HitsCollection : public G4VHitsCollection
{
public:
G4HitsCollection();
G4HitsCollection(G4String detName,G4String colNam);
virtual ~G4HitsCollection();
int operator==(const G4HitsCollection &right) const;
protected:
void* theCollection;
};
extern G4Allocator<G4HitsCollection> anHCAllocator;
template <class T> class G4THitsCollection : public G4HitsCollection
{
public:
G4THitsCollection();
G4THitsCollection(G4String detName,G4String colNam);
virtual ~G4THitsCollection();
int operator==(const G4THitsCollection<T> &right) const;
inline void *operator new(size_t);
inline void operator delete(void* anHC);
virtual void DrawAllHits();
virtual void PrintAllHits();
public:
inline T* operator[](size_t i)
{ return (*((RWTPtrOrderedVector<T>*)theCollection))[i]; }
inline RWTPtrOrderedVector<T>* GetVector()
{ return (RWTPtrOrderedVector<T>*)theCollection; }
inline int insert(T* aHit)
{
RWTPtrOrderedVector<T>*theHitsCollection
= (RWTPtrOrderedVector<T>*)theCollection;
theHitsCollection->insert(aHit);
return theHitsCollection->entries();
}
inline int entries()
{
RWTPtrOrderedVector<T>*theHitsCollection
= (RWTPtrOrderedVector<T>*)theCollection;
return theHitsCollection->entries();
}
};
template <class T> inline void* G4THitsCollection<T>::operator new(size_t)
{
void* anHC;
anHC = (void*)anHCAllocator.MallocSingle();
return anHC;
}
template <class T> inline void G4THitsCollection<T>::operator delete(void* anHC)
{
anHCAllocator.FreeSingle((G4HitsCollection*)anHC);
}
template <class T> G4THitsCollection<T>::G4THitsCollection()
{
RWTPtrOrderedVector<T> * theHitsCollection
= new RWTPtrOrderedVector<T>;
theCollection = (void*)theHitsCollection;
}
template <class T> G4THitsCollection<T>::G4THitsCollection(G4String detName,G4String colNam)
: G4HitsCollection(detName,colNam)
{
RWTPtrOrderedVector<T> * theHitsCollection
= new RWTPtrOrderedVector<T>;
theCollection = (void*)theHitsCollection;
}
template <class T> G4THitsCollection<T>::~G4THitsCollection()
{
RWTPtrOrderedVector<T> * theHitsCollection
= (RWTPtrOrderedVector<T>*)theCollection;
theHitsCollection->clearAndDestroy();
delete theHitsCollection;
}
template <class T> int G4THitsCollection<T>::operator==(const G4THitsCollection<T> &right) const
{ return (collectionName==right.collectionName); }
template <class T> void G4THitsCollection<T>::DrawAllHits()
{
RWTPtrOrderedVector<T> * theHitsCollection
= (RWTPtrOrderedVector<T>*)theCollection;
int n = theHitsCollection->entries();
for(int i=0;i<n;i++)
{ (*theHitsCollection)[i]->Draw(); }
}
template <class T> void G4THitsCollection<T>::PrintAllHits()
{
RWTPtrOrderedVector<T> * theHitsCollection
= (RWTPtrOrderedVector<T>*)theCollection;
int n = theHitsCollection->entries();
for(int i=0;i<n;i++)
{ (*theHitsCollection)[i]->Print(); }
}
#endif
+30
View File
@@ -0,0 +1,30 @@
// 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: G4VHit.hh,v 2.1 1998/07/12 02:53:42 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4VHit_h
#define G4VHit_h 1
class G4VHit
{
public:
G4VHit();
virtual ~G4VHit();
int operator==(const G4VHit &right) const;
virtual void Draw();
virtual void Print();
};
#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: G4VHitsCollection.hh,v 2.1 1998/07/12 02:53:43 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,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: G4HCofThisEvent.cc,v 2.1 1998/07/12 02:53:44 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4HCofThisEvent.hh"
G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
G4HCofThisEvent::G4HCofThisEvent()
{
HC = new RWTPtrOrderedVector<G4VHitsCollection>;
}
G4HCofThisEvent::G4HCofThisEvent(G4int cap)
{
HC = new RWTPtrOrderedVector<G4VHitsCollection>;
for(int i=0;i<cap;i++)
{
HC->insert((G4VHitsCollection*)NULL);
}
}
G4HCofThisEvent::~G4HCofThisEvent()
{
HC->clearAndDestroy();
delete HC;
}
void G4HCofThisEvent::AddHitsCollection(G4int HCID,G4VHitsCollection * aHC)
{
if(HCID>=0 && HCID<HC->entries())
{ (*HC)[HCID] = aHC; }
}
@@ -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: G4THitsCollection.cc,v 2.0 1998/07/02 16:15:23 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4THitsCollection.hh"
G4Allocator<G4HitsCollection> anHCAllocator;
G4HitsCollection::G4HitsCollection()
{;}
G4HitsCollection::G4HitsCollection(G4String detName,G4String colNam)
: G4VHitsCollection(detName,colNam)
{;}
G4HitsCollection::~G4HitsCollection()
{;}
int G4HitsCollection::operator==(const G4HitsCollection &right) const
{ return (collectionName==right.collectionName); }
+30
View File
@@ -0,0 +1,30 @@
// 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: G4VHit.cc,v 2.1 1998/07/12 02:53:44 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// G4VHit
#include "G4VHit.hh"
#include "globals.hh"
G4VHit::G4VHit()
{;}
G4VHit::~G4VHit()
{;}
int G4VHit::operator==(const G4VHit &right) const
{ return false; }
void G4VHit::Draw()
{;}
void G4VHit::Print()
{;}
@@ -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: G4VHitsCollection.cc,v 2.1 1998/07/12 02:53:45 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// G4VHitsCollection
#include "G4VHitsCollection.hh"
G4VHitsCollection::G4VHitsCollection()
{
collectionName = "Unknown";
SDname = "Unknown";
}
G4VHitsCollection::G4VHitsCollection(G4String detName,G4String colNam)
{
collectionName = colNam;
SDname = detName;
}
G4VHitsCollection::~G4VHitsCollection()
{ ; }
int G4VHitsCollection::operator==(const G4VHitsCollection &right) const
{
return ((collectionName==right.collectionName)
&&(SDname==right.SDname));
}
void G4VHitsCollection::DrawAllHits()
{;}
void G4VHitsCollection::PrintAllHits()
{;}
+47
View File
@@ -0,0 +1,47 @@
# $Id: GNUmakefile,v 2.2 1998/11/18 18:33:18 kurasige Exp $
# ------------------------------------------------------------
# GNUmakefile for events library. Makoto Asai, 5/9/95.
# ------------------------------------------------------------
name := G4event
ifndef G4INSTALL
G4INSTALL = ../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/tracking/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/digits+hits/detector/include \
-I$(G4BASE)/digits+hits/hits/include \
-I$(G4BASE)/digits+hits/digits/include \
-I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/intercoms/include
ifdef G4_STORE_TRAJECTORY
CPPFLAGS += -DG4_STORE_TRAJECTORY
endif
include $(G4INSTALL)/config/common.gmk
.PHONY: global
global: lib
+84
View File
@@ -0,0 +1,84 @@
$Id: History,v 2.7 1998/11/11 11:15:48 asaim Exp $
-------------------------------------------------------------------
=========================================================
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 *
----------------------------------------------------------
Nov 11, 98 M.Asai (tag event-00-03-04)
- Optimize G4PrimaryVertex for events such as having huge number
of primaries.
Oct 10, 98 M.Asai (tag event-00-03-03)
- Bug fix in G4PrimaryVertex.
- Add verbosity to G4PrimaryXXX.
Oct 01, 98 M.Asai (tag event-00-03-02)
- Introducing a new inlined method in G4ParticleGun.hh.
Sep. 21, 98 M.Asai (tag event-00-03-01)
- Inclusion of "G4HCofThisEvent.hh" and "G4DCofThisEvent.hh" moved
from "G4Event.cc" to "G4Event.hh", to avoid the link problem on
HP-CC (not aCC).
July 19, 98 M.Asai (tag event-00-01-03)
- More tight check against EoF in G4HEPEvtInterface
July 15, 98 M.Asai (tag event-00-01-02)
July 4, 98 M.Asai (tag event-00-01-01)
- ready for the beta release
June 30, 98 M.Asai (tag event-00-07-01)
- Introduce shortlived particles
June 22, 98 P. Urban
- Preliminary results of tracking optimisation merged into the HEAD.
- tagged as event-00-06-03
June 10, 98 M.Asai
- G4ParticleGunMessenger.cc is modified to catch up the new G4UIcommand
- tagged as event-00-06-02
June 8, 98 M.Asai
- tagged as event-00-06-01
June 6, 98 M.Asai
- G4Event and G4EventManager is updated for the new "digita+hits" scheme
- GNUmakefile is updated
May 6, 98 M.Asai
- G4ParticleGun is cleaned up.
April 29, 98 G.Cosmo (event-00-05-02)
- Removed print-out of track's pointers from verbose level in
G4EventManager.cc (P.Urban)
April 22, 98 M.Asai
- Tagged as event-00-05-01
April 9, 98 G.Cosmo
- Porting on DEC-cxx 6.0.
Removed meaningless usage of "const" qualifier from functions
return type for basic types by value. Modified files:
G4StackManager.hh, G4TrackStack.hh
April 6, 97 M.Nagamatu
- modified G4ParticleGunMessenger.cc to fix the "Unit length" of
/gun/position command.
December 19, 97 G. Cosmo - (alpha03)
- Created.
@@ -0,0 +1,25 @@
// 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: G4ClassificationOfNewTrack.hh,v 2.0 1998/07/02 16:53:45 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#ifndef G4ClassificationOfNewTrack_hh
#define G4ClassificationOfNewTrack_hh 1
enum G4ClassificationOfNewTrack
{
fUrgent, // put into the urgent stack
fWaiting, // put into the waiting stack
fPostpone, // postpone to the next event
fKill // kill
};
#endif
+36
View File
@@ -0,0 +1,36 @@
// 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: G4EvManMessenger.hh,v 2.2 1998/07/12 03:42:11 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4EvManMessenger_h
#define G4EvManMessenger_h 1
#include "G4UImessenger.hh"
class G4EventManager;
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAnInteger;
class G4EvManMessenger: public G4UImessenger
{
public:
G4EvManMessenger(G4EventManager * fEvMan);
~G4EvManMessenger();
void SetNewValue(G4UIcommand * command,G4String newValues);
G4String GetCurrentValue(G4UIcommand * command);
private:
G4EventManager * fEvManager;
G4UIdirectory* eventDirectory;
G4UIcmdWithoutParameter* abortCmd;
G4UIcmdWithAnInteger* verboseCmd;
};
#endif
+117
View File
@@ -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: G4Event.hh,v 2.2 1998/09/21 02:01:39 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4Event_h
#define G4Event_h 1
#include "globals.hh"
#include "G4Allocator.hh"
#include "G4PrimaryVertex.hh"
#include "G4HCofThisEvent.hh"
#include "G4DCofThisEvent.hh"
#include "G4TrajectoryContainer.hh"
class G4VHitsCollection;
class G4Event
{
public:
G4Event();
G4Event(G4int evID);
~G4Event();
inline void *operator new(size_t);
inline void operator delete(void* anEvent);
int operator==(const G4Event &right) const;
int operator!=(const G4Event &right) const;
void Print() const;
void Draw() const;
private:
// event ID
G4int eventID;
// PrimaryVertex
G4PrimaryVertex* thePrimaryVertex;
G4int numberOfPrimaryVertex;
// HitsCollection
G4HCofThisEvent* HC;
// DigiCollection
G4DCofThisEvent* DC;
// TrajectoryContainer
G4TrajectoryContainer * trajectoryContainer;
public:
inline void SetEventID(G4int i)
{ eventID = i; };
inline G4int GetEventID() const
{ return eventID; };
inline void AddPrimaryVertex(G4PrimaryVertex* aPrimaryVertex)
{
if( thePrimaryVertex == NULL )
{ thePrimaryVertex = aPrimaryVertex; }
else
{ thePrimaryVertex->SetNext( aPrimaryVertex ); }
numberOfPrimaryVertex++;
};
inline G4int GetNumberOfPrimaryVertex() const
{ return numberOfPrimaryVertex; };
inline G4PrimaryVertex* GetPrimaryVertex(G4int i=0) const
{
if( i == 0 )
{ return thePrimaryVertex; }
else if( i > 0 && i < numberOfPrimaryVertex )
{
G4PrimaryVertex* primaryVertex = thePrimaryVertex;
for( int j=0; j<i; j++ )
{
if( primaryVertex == NULL ) return NULL;
primaryVertex = primaryVertex->GetNext();
}
return primaryVertex;
}
else
{ return NULL; }
};
inline void SetHCofThisEvent(G4HCofThisEvent*value)
{ HC = value; };
inline G4HCofThisEvent* GetHCofThisEvent() const
{ return HC; };
inline void SetDCofThisEvent(G4DCofThisEvent*value)
{ DC = value; };
inline G4DCofThisEvent* GetDCofThisEvent() const
{ return DC; };
inline void SetTrajectoryContainer(G4TrajectoryContainer*value)
{ trajectoryContainer = value; };
inline G4TrajectoryContainer* GetTrajectoryContainer() const
{ return trajectoryContainer; };
};
extern G4Allocator<G4Event> anEventAllocator;
inline void* G4Event::operator new(size_t)
{
void* anEvent;
anEvent = (void*)anEventAllocator.MallocSingle();
return anEvent;
}
inline void G4Event::operator delete(void* anEvent)
{
anEventAllocator.FreeSingle((G4Event*)anEvent);
}
#endif
+103
View File
@@ -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: G4EventManager.hh,v 2.2 1998/10/10 10:51:17 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Last Modification : 10/Dec/96 M.Asai
//
#ifndef G4EventManager_h
#define G4EventManager_h 1
#include "evmandefs.hh"
#include "G4StackManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4PrimaryTransformer.hh"
class G4Event;
class G4UserEventAction;
class G4UserStackingAction;
class G4UserTrackingAction;
class G4UserSteppingAction;
class G4EvManMessenger;
#include "G4TrackingManager.hh"
#include "G4Track.hh"
#include "G4Trajectory.hh"
#include "G4TrackStatus.hh"
class G4SDManager;
#include "globals.hh"
//## Class: G4EventManager
// G4EventManager controls an event. This class has only
// one public method, ProcessOneEvent(), which will be
// called by GEANT4.
class G4EventManager
{
public:
G4EventManager();
~G4EventManager();
private:
G4EventManager(const G4EventManager &right);
G4EventManager& operator=(const G4EventManager& right);
public:
void ProcessOneEvent(G4Event* anEvent);
private:
void StackTracks(G4TrackVector *trackVector);
G4Event* currentEvent;
G4StackManager *trackContainer;
G4TrackingManager *trackManager;
G4TrajectoryContainer *trajectoryContainer;
G4int trackIDCounter;
int verboseLevel;
G4SDManager* sdManager;
G4PrimaryTransformer* transformer;
G4UserEventAction* userEventAction;
G4bool tracking;
G4EvManMessenger* theMessenger;
public:
inline const G4Event* GetConstCurrentEvent()
{ return currentEvent; };
inline G4Event* GetNonconstCurrentEvent()
{ return currentEvent; };
inline void AbortCurrentEvent()
{
trackContainer->clear();
if(tracking) trackManager->EventAborted();
};
void SetUserAction(G4UserEventAction* userAction);
inline void SetUserAction(G4UserStackingAction* userAction)
{ trackContainer->SetUserStackingAction(userAction); };
inline void SetUserAction(G4UserTrackingAction* userAction)
{ trackManager->SetUserAction(userAction); };
inline void SetUserAction(G4UserSteppingAction* userAction)
{ trackManager->SetUserAction(userAction); };
inline G4int GetVerboseLevel()
{ return verboseLevel; };
inline void SetVerboseLevel( G4int value )
{
verboseLevel = value;
trackContainer->SetVerboseLevel( value );
transformer->SetVerboseLevel( value );
};
};
#endif
+40
View File
@@ -0,0 +1,40 @@
// 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: G4HEPEvtInterface.hh,v 2.1 1998/07/12 02:53:50 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4HEPEvtInterface_h
#define G4HEPEvtInterface_h 1
#include <fstream.h>
#include <rw/tpordvec.h>
#include "globals.hh"
#include "G4VPrimaryGenerator.hh"
#include "G4HEPEvtParticle.hh"
class G4PrimaryVertex;
class G4Event;
class G4HEPEvtInterface:public G4VPrimaryGenerator
{
public:
G4HEPEvtInterface(char* evfile);
G4HEPEvtInterface(G4String evfile);
~G4HEPEvtInterface();
void GeneratePrimaryVertex(G4Event* evt);
private:
G4String fileName;
ifstream inputFile;
RWTPtrOrderedVector<G4HEPEvtParticle> HPlist;
};
#endif
+74
View File
@@ -0,0 +1,74 @@
// 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: G4HEPEvtParticle.hh,v 2.1 1998/07/12 02:53:50 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#ifndef G4HEPEvtParticle_h
#define G4HEPEvtParticle_h 1
#include "globals.hh"
#include "G4Allocator.hh"
#include "G4PrimaryParticle.hh"
class G4HEPEvtParticle
{
public:
inline void *operator new(size_t);
inline void operator delete(void *aStackedTrack);
G4HEPEvtParticle();
G4HEPEvtParticle(G4PrimaryParticle* pp,
G4int isthep, G4int jdahep1, G4int jdahep2);
~G4HEPEvtParticle();
const G4HEPEvtParticle & operator=(const G4HEPEvtParticle &right);
int operator==(const G4HEPEvtParticle &right) const;
int operator!=(const G4HEPEvtParticle &right) const;
private:
G4PrimaryParticle * theParticle;
G4int ISTHEP; // Status code of the entry
// Set to be 0 after generating links of
// G4PrimaryParticle object
G4int JDAHEP1;
G4int JDAHEP2;
public:
inline G4PrimaryParticle * GetTheParticle()
{ return theParticle; };
inline void Done()
{ ISTHEP *= -1; };
inline G4int GetISTHEP()
{ return ISTHEP; };
inline G4int GetJDAHEP1()
{ return JDAHEP1; };
inline G4int GetJDAHEP2()
{ return JDAHEP2; };
};
extern G4Allocator<G4HEPEvtParticle> aHEPEvtParticleAllocator;
inline void * G4HEPEvtParticle::operator new(size_t)
{
void * aHEPEvtParticle;
aHEPEvtParticle = (void *) aHEPEvtParticleAllocator.MallocSingle();
return aHEPEvtParticle;
}
inline void G4HEPEvtParticle::operator delete(void * aHEPEvtParticle)
{
aHEPEvtParticleAllocator.FreeSingle((G4HEPEvtParticle *) aHEPEvtParticle);
}
#endif
+101
View File
@@ -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: G4ParticleGun.hh,v 2.2 1998/10/01 16:41:52 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4ParticleGun_h
#define G4ParticleGun_h 1
#include "globals.hh"
#include "G4VPrimaryGenerator.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleDefinition.hh"
#include "G4PrimaryVertex.hh"
#include "G4ParticleMomentum.hh"
class G4Event;
class G4ParticleGunMessenger;
class G4ParticleGun:public G4VPrimaryGenerator
{
public:
G4ParticleGun();
G4ParticleGun(G4int numberofparticles);
G4ParticleGun(G4ParticleDefinition * particleDef,
G4int numberofparticles = 1);
virtual ~G4ParticleGun();
G4ParticleGun(const G4ParticleGun &right);
const G4ParticleGun & operator=(const G4ParticleGun &right);
int operator==(const G4ParticleGun &right) const;
int operator!=(const G4ParticleGun &right) const;
virtual void GeneratePrimaryVertex(G4Event* evt);
// Set particle properties to be shoot out
// SetParticleDefinition should be called at first
// By using SetParticleMomentum(), both particle_momentum_direction and
// particle_energy(Kinetic Energy) are determined.
void SetParticleMomentum(G4ParticleMomentum aMomentum);
inline void SetParticleDefinition
(G4ParticleDefinition * aParticleDefinition)
{ particle_definition = aParticleDefinition; }
inline void SetParticleMomentumDirection
(G4ParticleMomentum aMomentumDirection)
{ particle_momentum_direction = aMomentumDirection.unit(); }
inline void SetParticleEnergy(G4double aKineticEnergy)
{ particle_energy = aKineticEnergy; }
inline void SetParticlePosition(G4ThreeVector aPosition)
{ particle_position = aPosition; }
inline void SetParticleTime(G4double aTime)
{ particle_time = aTime; }
inline G4ParticleDefinition* GetParticleDefinition()
{ return particle_definition; }
inline G4ParticleMomentum GetParticleMomentumDirection()
{ return particle_momentum_direction; }
inline G4double GetParticleEnergy()
{ return particle_energy; }
inline G4ThreeVector GetParticlePosition()
{ return particle_position; }
inline G4double GetParticleTime()
{ return particle_time; }
inline void SetParticlePolarization(G4ThreeVector aVal)
{ particle_polarization = aVal; }
inline G4ThreeVector GetParticlePolarization()
{ return particle_polarization; }
inline void SetNumberOfParticles(G4int i)
{ NumberOfParticlesToBeGenerated = i; }
inline G4int GetNumberOfParticles()
{ return NumberOfParticlesToBeGenerated; }
protected:
virtual void SetInitialValues();
G4int NumberOfParticlesToBeGenerated;
G4ParticleDefinition* particle_definition;
G4ParticleMomentum particle_momentum_direction;
G4double particle_energy;
G4ThreeVector particle_position;
G4double particle_time;
G4ThreeVector particle_polarization;
private:
G4ParticleGunMessenger* theMessenger;
};
#endif
@@ -0,0 +1,59 @@
// 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: G4ParticleGunMessenger.hh,v 2.2 1998/07/12 03:42:15 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#ifndef G4ParticleGunMessenger_h
#define G4ParticleGunMessenger_h 1
class G4ParticleGun;
class G4ParticleTable;
class G4UIcommand;
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWith3Vector;
class G4UIcmdWith3VectorAndUnit;
class G4UIcmdWithAnInteger;
#include "G4UImessenger.hh"
#include "globals.hh"
class G4ParticleGunMessenger: public G4UImessenger
{
public:
G4ParticleGunMessenger(G4ParticleGun * fPtclGun);
~G4ParticleGunMessenger();
public:
void SetNewValue(G4UIcommand * command,G4String newValues);
G4String GetCurrentValue(G4UIcommand * command);
private:
G4ParticleGun * fParticleGun;
G4ParticleTable * particleTable;
private: //commands
G4UIdirectory * gunDirectory;
G4UIcmdWithoutParameter * listCmd;
G4UIcmdWithAString * particleCmd;
G4UIcmdWith3Vector * directionCmd;
G4UIcmdWithADoubleAndUnit * energyCmd;
G4UIcmdWith3VectorAndUnit * positionCmd;
G4UIcmdWithADoubleAndUnit * timeCmd;
G4UIcmdWith3Vector * polCmd;
G4UIcmdWithAnInteger * numberCmd;
};
#endif
+141
View File
@@ -0,0 +1,141 @@
// 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: G4PrimaryParticle.hh,v 2.2 1998/10/10 10:51:18 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#ifndef G4PrimaryParticle_h
#define G4PrimaryParticle_h 1
#include "globals.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
class G4ParticleDefinition;
class G4PrimaryParticle
{
public:
inline void *operator new(size_t);
inline void operator delete(void *aStackedTrack);
G4PrimaryParticle();
G4PrimaryParticle(G4int Pcode);
G4PrimaryParticle(G4int Pcode,
G4double px,G4double py,G4double pz);
G4PrimaryParticle(G4ParticleDefinition* Gcode);
G4PrimaryParticle(G4ParticleDefinition* Gcode,
G4double px,G4double py,G4double pz);
~G4PrimaryParticle();
const G4PrimaryParticle & operator=(const G4PrimaryParticle &right);
int operator==(const G4PrimaryParticle &right) const;
int operator!=(const G4PrimaryParticle &right) const;
void Print() const;
private:
G4int PDGcode;
G4ParticleDefinition * G4code;
G4double Px;
G4double Py;
G4double Pz;
G4PrimaryParticle * nextParticle;
G4PrimaryParticle * daughterParticle;
G4int trackID; // This will be set if this particle is
// sent to G4EventManager and converted to
// G4Track. Otherwise = -1.
G4double mass; // This is just for book keeping.
// This will not be used but the mass in
// G4ParticleDefinition will be used.
G4double polX;
G4double polY;
G4double polZ;
public:
void SetPDGcode(G4int Pcode);
inline G4int GetPDGcode() const
{ return PDGcode; };
void SetG4code(G4ParticleDefinition * Gcode);
inline G4ParticleDefinition * GetG4code() const
{ return G4code; };
inline void SetMomentum(G4double px, G4double py, G4double pz)
{
Px = px;
Py = py;
Pz = pz;
};
inline G4ThreeVector GetMomentum() const
{ return G4ThreeVector(Px,Py,Pz); };
inline G4double GetPx() const
{ return Px; };
inline G4double GetPy() const
{ return Py; };
inline G4double GetPz() const
{ return Pz; };
inline void SetNext(G4PrimaryParticle * np)
{
if(nextParticle == NULL)
{ nextParticle = np; }
else
{ nextParticle->SetNext(np); }
};
inline G4PrimaryParticle * GetNext() const
{ return nextParticle; };
inline void SetDaughter(G4PrimaryParticle * np)
{
if(daughterParticle == NULL)
{ daughterParticle = np; }
else
{ daughterParticle->SetNext(np); }
};
inline G4PrimaryParticle * GetDaughter() const
{ return daughterParticle; };
inline void SetTrackID(G4int id)
{ trackID = id; };
inline G4int GetTrackID() const
{ return trackID; };
inline void SetMass(G4double mas)
{ mass = mas; };
inline G4double GetMass() const
{ return mass; };
inline void SetPolarization(G4double px,G4double py,G4double pz)
{
polX = px;
polY = py;
polZ = pz;
};
inline G4ThreeVector GetPolarization() const
{ return G4ThreeVector(polX,polY,polZ); };
inline G4double GetPolX() const { return polX; };
inline G4double GetPolY() const { return polY; };
inline G4double GetPolZ() const { return polZ; };
};
extern G4Allocator<G4PrimaryParticle> aPrimaryParticleAllocator;
inline void * G4PrimaryParticle::operator new(size_t)
{
void * aPrimaryParticle;
aPrimaryParticle = (void *) aPrimaryParticleAllocator.MallocSingle();
return aPrimaryParticle;
}
inline void G4PrimaryParticle::operator delete(void * aPrimaryParticle)
{
aPrimaryParticleAllocator.FreeSingle((G4PrimaryParticle *) aPrimaryParticle);
}
#endif
@@ -0,0 +1,55 @@
// 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: G4PrimaryTransformer.hh,v 2.2 1998/10/10 10:51:18 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4PromaryTransformer_h
#define G4PromaryTransformer_h 1
#include "G4TrackVector.hh"
#include "G4ParticleTable.hh"
#include "globals.hh"
class G4Event;
class G4PrimaryVertex;
#include "G4PrimaryParticle.hh"
class G4PrimaryTransformer
{
public:
G4PrimaryTransformer();
~G4PrimaryTransformer();
G4TrackVector* GimmePrimaries(G4Event* anEvent);
private:
G4TrackVector TV;
G4ParticleTable* particleTable;
G4int verboseLevel;
public:
inline void SetVerboseLevel(G4int vl)
{ verboseLevel = vl; };
private:
void GenerateTracks(G4PrimaryVertex* primaryVertex);
void GenerateSingleTrack(G4PrimaryParticle* primaryParticle,
G4double x0,G4double y0,G4double z0,G4double t0);
void SetDecayProducts(G4PrimaryParticle* mother,
G4DynamicParticle* motherDP);
inline G4ParticleDefinition* GetDefinition(G4PrimaryParticle*pp)
{
G4ParticleDefinition* partDef = pp->GetG4code();
if(!partDef) partDef = particleTable->FindParticle(pp->GetPDGcode());
return partDef;
};
};
#endif
+120
View File
@@ -0,0 +1,120 @@
// 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: G4PrimaryVertex.hh,v 2.3 1998/11/11 11:19:37 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#ifndef G4PrimaryVertex_h
#define G4PrimaryVertex_h 1
#include "globals.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4PrimaryParticle.hh"
class G4PrimaryVertex
{
public:
inline void *operator new(size_t);
inline void operator delete(void *aStackedTrack);
G4PrimaryVertex();
G4PrimaryVertex(G4double x0,G4double y0,G4double z0,G4double t0);
G4PrimaryVertex(G4ThreeVector xyz0,G4double t0);
~G4PrimaryVertex();
const G4PrimaryVertex & operator=(const G4PrimaryVertex &right);
int operator==(const G4PrimaryVertex &right) const;
int operator!=(const G4PrimaryVertex &right) const;
void Print() const;
private:
G4double X0;
G4double Y0;
G4double Z0;
G4double T0;
G4PrimaryParticle * theParticle;
G4PrimaryParticle * theTail;
G4PrimaryVertex* nextVertex;
G4int numberOfParticle;
public:
inline G4ThreeVector GetPosition() const
{ return G4ThreeVector(X0,Y0,Z0); }
inline G4double GetX0() const
{ return X0; }
inline G4double GetY0() const
{ return Y0; }
inline G4double GetZ0() const
{ return Z0; }
inline G4double GetT0() const
{ return T0; }
inline G4int GetNumberOfParticle() const
{ return numberOfParticle; }
inline void SetPrimary(G4PrimaryParticle * pp)
{
if(theParticle == NULL)
{
theParticle = pp;
theTail = pp;
}
else
{
theTail->SetNext(pp);
theTail = pp;
}
numberOfParticle++;
}
inline G4PrimaryParticle* GetPrimary(G4int i=0) const
{
if( i == 0 )
{ return theParticle; }
else if( i > 0 && i < numberOfParticle )
{
G4PrimaryParticle* particle = theParticle;
for( int j=0; j<i; j++ )
{
if( particle == NULL ) return NULL;
particle = particle->GetNext();
}
return particle;
}
else
{ return NULL; }
}
inline void SetNext(G4PrimaryVertex* nv)
{
if(nextVertex == NULL)
{ nextVertex = nv; }
else
{ nextVertex->SetNext(nv); }
}
inline G4PrimaryVertex* GetNext() const
{ return nextVertex; }
};
extern G4Allocator<G4PrimaryVertex> aPrimaryVertexAllocator;
inline void * G4PrimaryVertex::operator new(size_t)
{
void * aPrimaryVertex;
aPrimaryVertex = (void *) aPrimaryVertexAllocator.MallocSingle();
return aPrimaryVertex;
}
inline void G4PrimaryVertex::operator delete(void * aPrimaryVertex)
{
aPrimaryVertexAllocator.FreeSingle((G4PrimaryVertex *) aPrimaryVertex);
}
#endif
+97
View File
@@ -0,0 +1,97 @@
// 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: G4StackManager.hh,v 2.1 1998/07/12 02:53:54 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Last Modification : 09/Dec/96 M.Asai
//
#ifndef G4StackManager_h
#define G4StackManager_h 1
#include "G4UserStackingAction.hh"
#include "G4StackedTrack.hh"
#include "G4TrackStack.hh"
#include "G4ClassificationOfNewTrack.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "globals.hh"
class G4StackingMessenger;
class G4StackManager
{
public:
G4StackManager();
~G4StackManager();
private:
const G4StackManager & operator=
(const G4StackManager &right);
int operator==(const G4StackManager &right) const;
int operator!=(const G4StackManager &right) const;
public:
G4int PushOneTrack(G4Track *newTrack);
G4Track * PopNextTrack();
G4int PrepareNewEvent();
void ReClassify();
private:
G4UserStackingAction * userStackingAction;
int verboseLevel;
G4TrackStack * urgentStack;
G4TrackStack * waitingStack;
G4TrackStack * postponeStack;
G4StackingMessenger* theMessenger;
public:
inline void clear()
{
ClearUrgentStack();
ClearWaitingStack();
};
inline void ClearUrgentStack()
{ urgentStack->clear(); };
inline void ClearWaitingStack()
{ waitingStack->clear(); };
inline void ClearPostponeStack()
{ postponeStack->clear(); };
inline G4int GetNTotalTrack() const
{ return urgentStack->GetNTrack()
+ waitingStack->GetNTrack()
+ postponeStack->GetNTrack(); };
inline G4int GetNUrgentTrack() const
{ return urgentStack->GetNTrack(); };
inline G4int GetNWaitingTrack() const
{ return waitingStack->GetNTrack(); };
inline G4int GetNPostponedTrack() const
{ return postponeStack->GetNTrack(); };
inline void SetVerboseLevel( int const value )
{ verboseLevel = value; };
inline void SetUserStackingAction(G4UserStackingAction* value)
{
if (userStackingAction) delete userStackingAction;
userStackingAction = value;
userStackingAction->SetStackManager(this);
};
private:
inline G4ClassificationOfNewTrack
DefaultClassification(G4Track *aTrack)
{
G4ClassificationOfNewTrack classification = fUrgent;
if( aTrack->GetTrackStatus() == fPostponeToNextEvent )
{ classification = fPostpone; }
return classification;
};
};
#endif
+76
View File
@@ -0,0 +1,76 @@
// 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: G4StackedTrack.hh,v 2.1 1998/07/12 02:53:54 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Last Modification : 02/Feb/96 M.Asai
//
#ifndef G4StackedTrack_h
#define G4StackedTrack_h 1
#include "G4Track.hh"
#include "globals.hh"
#include "G4Allocator.hh"
class G4StackedTrack
{
public:
inline void *operator new(size_t);
inline void operator delete(void *aStackedTrack);
G4StackedTrack();
G4StackedTrack(G4Track * aTrack);
~G4StackedTrack();
const G4StackedTrack & operator=(const G4StackedTrack &right);
int operator==(const G4StackedTrack &right) const;
int operator!=(const G4StackedTrack &right) const;
private:
G4double priorityWeight;
G4Track *track;
G4StackedTrack * previousStackedTrack;
G4StackedTrack * nextStackedTrack;
public:
inline G4double GetPriorityWeight() const
{ return priorityWeight; };
inline void SetPriorityWeight(const G4double value)
{ priorityWeight = value; };
inline G4Track * GetTrack() const
{ return track; };
inline G4StackedTrack * GetPrevious() const
{ return previousStackedTrack; };
inline G4StackedTrack * GetNext() const
{ return nextStackedTrack; };
inline void SetPrevious(G4StackedTrack * value)
{ previousStackedTrack = value; };
inline void SetNext(G4StackedTrack * value)
{ nextStackedTrack = value; };
};
extern G4Allocator<G4StackedTrack> aStackedTrackAllocator;
inline void * G4StackedTrack::operator new(size_t)
{
void * aStackedTrack;
aStackedTrack = (void *) aStackedTrackAllocator.MallocSingle();
return aStackedTrack;
}
inline void G4StackedTrack::operator delete(void * aStackedTrack)
{
aStackedTrackAllocator.FreeSingle((G4StackedTrack *) aStackedTrack);
}
#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: G4StackingMessenger.hh,v 2.2 1998/07/12 03:42:17 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4StackingMessenger_h
#define G4StackingMessenger_h 1
#include "G4UImessenger.hh"
class G4StackManager;
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAnInteger;
class G4StackingMessenger: public G4UImessenger
{
public:
G4StackingMessenger(G4StackManager* fCont);
~G4StackingMessenger();
void SetNewValue(G4UIcommand * command,G4String newValues);
private:
G4StackManager * fContainer;
G4UIdirectory* stackDir;
G4UIcmdWithoutParameter* statusCmd;
G4UIcmdWithAnInteger* clearCmd;
};
#endif
+52
View File
@@ -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: G4TrackStack.hh,v 2.1 1998/07/12 02:53:55 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Last Modification : 09/Dec/96 M.Asai
//
#ifndef G4TrackStack_h
#define G4TrackStack_h 1
#include "G4StackedTrack.hh"
#include "globals.hh"
class G4TrackStack
{
public:
G4TrackStack();
~G4TrackStack();
private:
const G4TrackStack & operator=
(const G4TrackStack &right);
int operator==(const G4TrackStack &right) const;
int operator!=(const G4TrackStack &right) const;
public:
void PushToStack(G4StackedTrack * aStackedTrack);
G4StackedTrack * PopFromStack();
void GrabFromStack(G4StackedTrack * aStackedTrack);
void clear();
void TransferTo(G4TrackStack * aStack);
private:
G4int n_stackedTrack;
G4StackedTrack * firstStackedTrack;
G4StackedTrack * lastStackedTrack;
public:
inline G4int GetNTrack() const
{ return n_stackedTrack; };
};
#endif
@@ -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: G4TrajectoryContainer.hh,v 2.0 1998/07/02 16:53:34 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// G4TrajectoryContainer
//
#ifndef G4TrajectoryContainer_h
#define G4TrajectoryContainer_h 1
// TrackManagement
#include "G4Trajectory.hh"
// RWTPtrOrderedVector
#include <rw/tpordvec.h>
typedef RWTPtrOrderedVector<G4Trajectory> G4TrajectoryContainer;
#endif
+33
View File
@@ -0,0 +1,33 @@
// 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: G4UserEventAction.hh,v 2.1 1998/07/12 02:53:56 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//
#ifndef G4UserEventAction_h
#define G4UserEventAction_h 1
class G4EventManager;
class G4UserEventAction
{
public:
virtual ~G4UserEventAction()
{;}
inline void SetEventManager(G4EventManager* value)
{ fpEventManager = value; };
virtual void BeginOfEventAction();
virtual void EndOfEventAction();
protected:
G4EventManager* fpEventManager;
};
#endif
@@ -0,0 +1,104 @@
// 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: G4UserStackingAction.hh,v 2.1 1998/07/12 02:53:56 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Last Modification : 09/Dec/96 M.Asai
//
#ifndef G4UserStackingAction_h
#define G4UserStackingAction_h 1
class G4StackManager;
class G4Track;
#include "G4ClassificationOfNewTrack.hh"
class G4UserStackingAction
{
public:
G4UserStackingAction();
virtual ~G4UserStackingAction();
protected:
G4StackManager * stackManager;
public:
inline void SetStackManager(G4StackManager * value)
{ stackManager = value; };
public:
//---------------------------------------------------------------
// vitual methods to be implemented by user
//---------------------------------------------------------------
//
virtual G4ClassificationOfNewTrack
ClassifyNewTrack(G4Track *const aTrack);
//
// Reply G4ClassificationOfNewTrack determined by the
// newly coming G4Track.
//
// enum G4ClassificationOfNewTrack
// {
// fUrgent, // put into the urgent stack
// fWaiting, // put into the waiting stack
// fPostpone, // postpone to the next event
// fKill // kill without stacking
// };
//
// The parent_ID of the track indicates the origin of it.
//
// G4int parent_ID = aTrack->get_parentID();
//
// parent_ID = 0 : primary particle
// > 0 : secondary particle
// < 0 : postponed from the previous event
//
//---------------------------------------------------------------
//
virtual void NewStage();
//
// This method is called by G4StackManager when the urgentStack
// becomes empty and contents in the waitingStack are transtered
// to the urgentStack.
// Note that this method is not called at the begining of each
// event, but "PrepareNewEvent" is called.
//
// In case re-classification of the stacked tracks is needed,
// use the following method to request to G4StackManager.
//
// stackManager->ReClassify();
//
// All of the stacked tracks in the waitingStack will be re-classified
// by "ClassifyNewTrack" method.
// To abort current event, use the following method.
//
// stackManager->clear();
//
// Note that this way is valid and safe only for the case it is called
// from this user class. The more global way of event abortion is
//
// G4UImanager * UImanager = G4UImanager::GetUIpointer();
// UImanager->ApplyCommand("/event/abort");
//
//---------------------------------------------------------------
//
virtual void PrepareNewEvent();
//
// This method is called by G4StackManager at the begining of
// each event.
// Be careful that the urgentStack and the waitingStack of
// G4StackManager are empty at this moment, because this method
// is called before accepting primary particles. Also, note that
// the postponeStack of G4StackManager may have some postponed
// tracks.
//
//---------------------------------------------------------------
};
#endif
@@ -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: G4VPrimaryGenerator.hh,v 2.1 1998/07/12 02:53:57 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4VPrimaryGenerator_h
#define G4VPrimaryGenerator_h 1
class G4Event;
class G4VPrimaryGenerator
{
public:
G4VPrimaryGenerator();
virtual ~G4VPrimaryGenerator();
virtual void GeneratePrimaryVertex(G4Event* evt) = 0;
};
#endif
+12
View File
@@ -0,0 +1,12 @@
// 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: eventgendefs.hh,v 2.0 1998/07/02 16:53:21 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef EventGenerator_DEBUG
#define EventGenerator_DEBUG
+19
View File
@@ -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: evmandefs.hh,v 2.0 1998/07/02 16:53:42 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
///#define G4EVENTMANAGER_DEBUG 1
///#define G4EVENTMANAGER_DEBUG_0 1
#ifdef G4EVENTMANAGER_DEBUG
#define G4EVENTMANAGER_DEBUG_0 1
#endif
#include "trajectoryControl.hh"
+17
View File
@@ -0,0 +1,17 @@
// 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: trajectoryControl.hh,v 2.1 1998/10/10 10:51:20 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
////#define G4_STORE_TRAJECTORY 1
//#ifdef G4VISUALIZE
//#ifndef G4_STORE_TRAJECTORY
//#define G4_STORE_TRAJECTORY 1
//#endif
//#endif
+1
View File
@@ -0,0 +1 @@
*.d
+60
View File
@@ -0,0 +1,60 @@
// 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: G4EvManMessenger.cc,v 2.2 1998/07/12 03:42:25 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// --------------------------------------------------------------------
#include "G4EvManMessenger.hh"
#include "G4EventManager.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAnInteger.hh"
G4EvManMessenger::G4EvManMessenger(G4EventManager * fEvMan)
:fEvManager(fEvMan)
{
eventDirectory = new G4UIdirectory("/event/");
eventDirectory->SetGuidance("EventManager control commands.");
abortCmd = new G4UIcmdWithoutParameter("/event/abort",this);
abortCmd->SetGuidance("Abort current event.");
abortCmd->AvailableForStates(EventProc);
verboseCmd = new G4UIcmdWithAnInteger("/event/verbose",this);
verboseCmd->SetGuidance("Set Verbose level of event management category.");
verboseCmd->SetGuidance(" 0 : Silent");
verboseCmd->SetGuidance(" 1 : Stacking information");
verboseCmd->SetGuidance(" 2 : More...");
verboseCmd->SetParameterName("level",false);
verboseCmd->SetRange("level>=0");
}
G4EvManMessenger::~G4EvManMessenger()
{
delete abortCmd;
delete verboseCmd;
delete eventDirectory;
}
void G4EvManMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
{
if( command == verboseCmd )
{ fEvManager->SetVerboseLevel(verboseCmd->GetNewIntValue(newValues)); }
if( command == abortCmd )
{ fEvManager->AbortCurrentEvent(); }
}
G4String G4EvManMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String cv;
if( command == verboseCmd )
{ cv = verboseCmd->ConvertToString(fEvManager->GetVerboseLevel()); }
return cv;
}
+95
View File
@@ -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: G4Event.cc,v 2.3 1998/09/21 02:02:09 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
// G4Event
#include "G4Event.hh"
#include "G4VVisManager.hh"
//#include "G4HCofThisEvent.hh"
//#include "G4DCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4VDigiCollection.hh"
#include "G4ios.hh"
G4Allocator<G4Event> anEventAllocator;
G4Event::G4Event()
:eventID(0),
thePrimaryVertex(NULL),numberOfPrimaryVertex(0),
DC(NULL),HC(NULL),trajectoryContainer(NULL)
{;}
G4Event::G4Event(G4int evID)
:eventID(evID),
thePrimaryVertex(NULL),numberOfPrimaryVertex(0),
DC(NULL),HC(NULL),trajectoryContainer(NULL)
{;}
G4Event::~G4Event()
{
if(thePrimaryVertex) delete thePrimaryVertex;
if(HC) delete HC;
if(DC) delete DC;
if(trajectoryContainer)
{
trajectoryContainer->clearAndDestroy();
delete trajectoryContainer;
}
}
int G4Event::operator==(const G4Event &right) const
{
return ( eventID == right.eventID );
}
int G4Event::operator!=(const G4Event &right) const
{
return ( eventID != right.eventID );
}
void G4Event::Print() const
{
G4cout << "G4Event " << eventID << endl;
}
void G4Event::Draw() const
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(!pVVisManager) return;
if(trajectoryContainer)
{
G4int n_traj = trajectoryContainer->entries();
for(int i=0;i<n_traj;i++)
{ (*trajectoryContainer)[i]->DrawTrajectory(); }
}
if(HC)
{
G4int n_HC = HC->GetCapacity();
for(int j=0;j<n_HC;j++)
{
G4VHitsCollection * VHC = HC->GetHC(j);
if(VHC) VHC->DrawAllHits();
}
}
if(DC)
{
G4int n_DC = DC->GetCapacity();
for(int j=0;j<n_DC;j++)
{
G4VDigiCollection * VDC = DC->GetDC(j);
if(VDC) VDC->DrawAllDigi();
}
}
}
+219
View File
@@ -0,0 +1,219 @@
// 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: G4EventManager.cc,v 2.2 1998/07/13 16:50:12 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//
#include "G4EventManager.hh"
#include "G4ios.hh"
#include "G4EvManMessenger.hh"
#include "G4Event.hh"
#include "G4UserEventAction.hh"
#include "G4UserStackingAction.hh"
#include "G4SDManager.hh"
G4EventManager::G4EventManager()
:verboseLevel(0),trajectoryContainer(NULL),userEventAction(NULL),
tracking(false),currentEvent(NULL)
{
trackManager = new G4TrackingManager;
transformer = new G4PrimaryTransformer;
trackContainer = new G4StackManager;
theMessenger = new G4EvManMessenger(this);
sdManager = G4SDManager::GetSDMpointerIfExist();
}
// private -> never called
G4EventManager::G4EventManager(const G4EventManager &right) { }
G4EventManager& G4EventManager::operator=(const G4EventManager& right)
{
return *this;
}
G4EventManager::~G4EventManager()
{
delete trackContainer;
delete transformer;
delete trackManager;
delete theMessenger;
if (userEventAction) delete userEventAction;
}
/*
const G4EventManager & G4EventManager::operator=(const G4EventManager &right)
{ }
int G4EventManager::operator==(const G4EventManager &right) const { }
int G4EventManager::operator!=(const G4EventManager &right) const { }
*/
void G4EventManager::ProcessOneEvent(G4Event* anEvent)
{
currentEvent = anEvent;
G4Track * track;
G4TrackStatus istop;
#ifdef G4VERBOSE
if ( verboseLevel > 0 )
{
G4cout << "=====================================" << endl;
G4cout << " G4EventManager::ProcessOneEvent() " << endl;
G4cout << "=====================================" << endl;
}
#endif
trackIDCounter = trackContainer->PrepareNewEvent();
#ifdef G4_STORE_TRAJECTORY
trajectoryContainer = NULL;
#endif
sdManager = G4SDManager::GetSDMpointerIfExist();
if(sdManager)
{ currentEvent->SetHCofThisEvent(sdManager->PrepareNewEvent()); }
if(userEventAction) userEventAction->BeginOfEventAction();
#ifdef G4VERBOSE
if ( verboseLevel > 1 )
{
G4cout << currentEvent->GetNumberOfPrimaryVertex()
<< " vertices passed from G4Event." << endl;
}
#endif
StackTracks( transformer->GimmePrimaries( currentEvent ) );
#ifdef G4VERBOSE
if ( verboseLevel > 0 )
{
G4cout << trackContainer->GetNTotalTrack() << " primaries "
<< "are passed from G4EventTransformer." << endl;
G4cout << "!!!!!!! Now start processing an event !!!!!!!" << endl;
}
#endif
while( ( track = trackContainer->PopNextTrack() ) != NULL )
{
#ifdef G4VERBOSE
if ( verboseLevel > 1 )
{
G4cout << "Track " << track << " (trackID " << track->GetTrackID()
<< ", parentID " << track->GetParentID()
<< ") is passed to G4TrackingManager." << endl;
}
#endif
tracking = true;
trackManager->ProcessOneTrack( track );
istop = track->GetTrackStatus();
tracking = false;
#ifdef G4VERBOSE
if ( verboseLevel > 0 )
{
G4cout << "Track (trackID " << track->GetTrackID()
<< ", parentID " << track->GetParentID()
<< ") is processed with stopping code " << istop << endl;
}
#endif
#ifdef G4_STORE_TRAJECTORY
G4Trajectory * aTrajectory = trackManager->GimmeTrajectory();
if(aTrajectory)
{
if(!trajectoryContainer)
{ trajectoryContainer = new G4TrajectoryContainer; }
trajectoryContainer->insert(aTrajectory);
}
#endif
G4TrackVector * secondaries = trackManager->GimmeSecondaries();
switch (istop)
{
case fStopButAlive:
case fSuspend:
case fPostponeToNextEvent:
trackContainer->PushOneTrack( track );
StackTracks( secondaries );
break;
case fStopAndKill:
StackTracks( secondaries );
delete track;
break;
case fAlive:
G4cout << "Illeagal TrackStatus returned from G4TrackingManager!"
<< endl;
case fKillTrackAndSecondaries:
if( secondaries ) secondaries->clearAndDestroy();
delete track;
break;
}
}
#ifdef G4VERBOSE
if ( verboseLevel > 0 )
{
G4cout << "NULL returned from G4StackManager." << endl;
G4cout << "Terminate current event processing." << endl;
}
#endif
if(sdManager)
{ sdManager->TerminateCurrentEvent(currentEvent->GetHCofThisEvent()); }
#ifdef G4_STORE_TRAJECTORY
currentEvent->SetTrajectoryContainer(trajectoryContainer);
#endif
if(userEventAction) userEventAction->EndOfEventAction();
currentEvent = NULL;
}
void G4EventManager::StackTracks(G4TrackVector *trackVector)
{
G4Track * newTrack;
if( trackVector )
{
size_t n_passedTrack = trackVector->entries();
if( n_passedTrack == 0 ) return;
for( size_t i = 0; i < n_passedTrack; i++ )
{
newTrack = (*trackVector)[ i ];
trackIDCounter++;
newTrack->SetTrackID( trackIDCounter );
trackContainer->PushOneTrack( newTrack );
#ifdef G4VERBOSE
if ( verboseLevel > 1 )
{
G4cout << "A new track " << newTrack
<< " (trackID " << newTrack->GetTrackID()
<< ", parentID " << newTrack->GetParentID()
<< ") is passed to G4StackManager." << endl;
}
#endif
}
trackVector->clear();
}
}
void G4EventManager::SetUserAction(G4UserEventAction* userAction)
{
if (userEventAction) delete userEventAction;
userEventAction = userAction;
userEventAction->SetEventManager(this);
}
+128
View File
@@ -0,0 +1,128 @@
// 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: G4HEPEvtInterface.cc,v 2.3 1998/07/18 10:34:11 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// --------------------------------------------------------------------
#ifdef WIN32
# include <Strstrea.h>
#else
# include <strstream.h>
#endif
#include "G4ios.hh"
#include "G4HEPEvtInterface.hh"
#include "G4PrimaryVertex.hh"
#include "G4PrimaryParticle.hh"
#include "G4HEPEvtParticle.hh"
#include "G4Event.hh"
G4HEPEvtInterface::G4HEPEvtInterface(char* evfile)
{
inputFile.open(evfile);
fileName = evfile;
}
G4HEPEvtInterface::G4HEPEvtInterface(G4String evfile)
{
const char* fn = evfile.data();
inputFile.open((char*)fn);
fileName = evfile;
}
G4HEPEvtInterface::~G4HEPEvtInterface()
{;}
void G4HEPEvtInterface::GeneratePrimaryVertex(G4Event* evt)
{
int NHEP; // number of entries
inputFile >> NHEP;
if( inputFile.eof() )
{
G4Exception("End-Of-File : HEPEvt input file");
return;
}
for( int IHEP=0; IHEP<NHEP; IHEP++ )
{
G4int ISTHEP; // status code
G4int IDHEP; // PDG code
G4int JDAHEP1; // first daughter
G4int JDAHEP2; // last daughter
G4double PHEP1; // px in GeV
G4double PHEP2; // py in GeV
G4double PHEP3; // pz in GeV
G4double PHEP5; // mass in GeV
inputFile >> ISTHEP >> IDHEP >> JDAHEP1 >> JDAHEP2
>> PHEP1 >> PHEP2 >> PHEP3 >> PHEP5;
// create G4PrimaryParticle object
G4PrimaryParticle* particle
= new G4PrimaryParticle( IDHEP, PHEP1*GeV, PHEP2*GeV, PHEP3*GeV );
particle->SetMass( PHEP5*GeV );
// create G4HEPEvtParticle object
G4HEPEvtParticle* hepParticle
= new G4HEPEvtParticle( particle, ISTHEP, JDAHEP1, JDAHEP2 );
// Store
HPlist.insert( hepParticle );
}
// check if there is at least one particle
if( HPlist.entries() == 0 ) return;
// make connection between daughter particles decayed from
// the same mother
for( int i=0; i<HPlist.entries(); i++ )
{
if( HPlist(i)->GetJDAHEP1() > 0 ) // it has daughters
{
int jda1 = HPlist(i)->GetJDAHEP1()-1; // FORTRAN index starts from 1
int jda2 = HPlist(i)->GetJDAHEP2()-1; // but C++ starts from 0.
G4PrimaryParticle* mother = HPlist(i)->GetTheParticle();
for( int j=jda1; j<=jda2; j++ )
{
G4PrimaryParticle* daughter = HPlist(j)->GetTheParticle();
if(HPlist(j)->GetISTHEP()>0)
{
mother->SetDaughter( daughter );
HPlist(j)->Done();
}
}
}
}
// create G4PrimaryVertex object
G4double x0 = 0.; // vertex point X
G4double y0 = 0.; // vertex point Y
G4double z0 = 0.; // vertex point Z
G4double t0 = 0.; // vertex time
G4PrimaryVertex* vertex = new G4PrimaryVertex(x0,y0,z0,t0);
// put initial particles to the vertex
for( int ii=0; ii<HPlist.entries(); ii++ )
{
if( HPlist(ii)->GetISTHEP() > 0 ) // ISTHEP of daughters had been
// set to negative
{
G4PrimaryParticle* initialParticle = HPlist(ii)->GetTheParticle();
vertex->SetPrimary( initialParticle );
}
}
// clear G4HEPEvtParticles
HPlist.clearAndDestroy();
// Put the vertex to G4Event object
evt->AddPrimaryVertex( vertex );
}
+39
View File
@@ -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: G4HEPEvtParticle.cc,v 2.0 1998/07/02 16:53:56 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#include "G4HEPEvtParticle.hh"
G4Allocator<G4HEPEvtParticle> aHEPEvtParticleAllocator;
G4HEPEvtParticle::G4HEPEvtParticle()
{;}
G4HEPEvtParticle::G4HEPEvtParticle(G4PrimaryParticle* pp,
G4int isthep, G4int jdahep1, G4int jdahep2)
:theParticle(pp),ISTHEP(isthep),JDAHEP1(jdahep1),JDAHEP2(jdahep2)
{;}
G4HEPEvtParticle::~G4HEPEvtParticle()
{;}
const G4HEPEvtParticle &
G4HEPEvtParticle::operator=(const G4HEPEvtParticle &right)
{ return *this; }
int G4HEPEvtParticle::operator==(const G4HEPEvtParticle &right) const
{ return false; }
int G4HEPEvtParticle::operator!=(const G4HEPEvtParticle &right) const
{ return true; }
+113
View File
@@ -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: G4ParticleGun.cc,v 2.2 1998/07/13 16:50:14 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// G4ParticleGun
#include "G4ParticleGun.hh"
#include "G4PrimaryParticle.hh"
#include "G4ParticleGunMessenger.hh"
#include "G4Event.hh"
#include "G4ios.hh"
G4ParticleGun::G4ParticleGun()
{
SetInitialValues();
}
G4ParticleGun::G4ParticleGun(G4int numberofparticles)
{
SetInitialValues();
NumberOfParticlesToBeGenerated = numberofparticles;
}
G4ParticleGun::G4ParticleGun
(G4ParticleDefinition * particleDef, G4int numberofparticles)
{
SetInitialValues();
NumberOfParticlesToBeGenerated = numberofparticles;
particle_definition = particleDef;
}
void G4ParticleGun::SetInitialValues()
{
NumberOfParticlesToBeGenerated = 1;
particle_definition = NULL;
G4ThreeVector zero;
particle_momentum_direction = (G4ParticleMomentum)zero;
particle_energy = 0.0;
particle_position = zero;
particle_time = 0.0;
particle_polarization = zero;
theMessenger = new G4ParticleGunMessenger(this);
}
G4ParticleGun::~G4ParticleGun()
{
delete theMessenger;
}
void G4ParticleGun::SetParticleMomentum(G4ParticleMomentum aMomentum)
{
if(particle_definition==NULL)
{
G4cout <<"Particle Definition not defined yet for G4ParticleGun"<< endl;
G4cout <<"Zero Mass is assumed"<<endl;
particle_momentum_direction = aMomentum.unit();
particle_energy = aMomentum.mag();
}
else
{
G4double mass = particle_definition->GetPDGMass();
G4double p = aMomentum.mag();
particle_momentum_direction = aMomentum.unit();
if ((particle_energy>0.0)&&(abs(particle_energy+mass-sqrt(p*p+mass*mass))>keV))
{
G4cout << "G4ParticleGun::" << particle_definition->GetParticleName() << endl;
G4cout << " KineticEnergy and Momentum could be inconsistent" << endl;
G4cout << " (Momentum:" << p/GeV << " GeV/c";
G4cout << " Mass:" << mass/GeV << " GeV/c/c)" << endl;
G4cout << " KineticEnergy is overwritten!! ";
G4cout << particle_energy/GeV << "->";
G4cout << (sqrt(p*p+mass*mass)-mass)/GeV << "GeV" << endl;
}
particle_energy = sqrt(p*p+mass*mass)-mass;
}
}
void G4ParticleGun::GeneratePrimaryVertex(G4Event* evt)
{
if(particle_definition==NULL) return;
// create a new vertex
G4PrimaryVertex* vertex =
new G4PrimaryVertex(particle_position,particle_time);
// create new primaries and set them to the vertex
G4double mass = particle_definition->GetPDGMass();
G4double energy = particle_energy + mass;
G4double pmom = sqrt(energy*energy-mass*mass);
G4double px = pmom*particle_momentum_direction.x();
G4double py = pmom*particle_momentum_direction.y();
G4double pz = pmom*particle_momentum_direction.z();
for( int i=0; i<NumberOfParticlesToBeGenerated; i++ )
{
G4PrimaryParticle* particle =
new G4PrimaryParticle(particle_definition,px,py,pz);
particle->SetMass( mass );
particle->SetPolarization(particle_polarization.x(),
particle_polarization.y(),
particle_polarization.z());
vertex->SetPrimary( particle );
}
evt->AddPrimaryVertex( vertex );
}
+155
View File
@@ -0,0 +1,155 @@
// 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: G4ParticleGunMessenger.cc,v 2.4 1998/10/01 16:58:31 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4ParticleGunMessenger.hh"
#include "G4ParticleGun.hh"
#include "G4Geantino.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleTable.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWith3Vector.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4ios.hh"
G4ParticleGunMessenger::G4ParticleGunMessenger(G4ParticleGun * fPtclGun)
:fParticleGun(fPtclGun)
{
particleTable = G4ParticleTable::GetParticleTable();
gunDirectory = new G4UIdirectory("/gun/");
gunDirectory->SetGuidance("Particle Gun control commands.");
listCmd = new G4UIcmdWithoutParameter("/gun/List",this);
listCmd->SetGuidance("List available particles.");
listCmd->SetGuidance(" Invoke G4ParticleTable.");
particleCmd = new G4UIcmdWithAString("/gun/particle",this);
particleCmd->SetGuidance("Set particle to be generated.");
particleCmd->SetGuidance(" (geantino is default)");
particleCmd->SetParameterName("particleName",true);
particleCmd->SetDefaultValue("geantino");
G4String candidateList;
G4int nPtcl = particleTable->entries();
for(G4int i=0;i<nPtcl;i++)
{
candidateList += particleTable->GetParticleName(i);
candidateList += " ";
}
particleCmd->SetCandidates(candidateList);
directionCmd = new G4UIcmdWith3Vector("/gun/direction",this);
directionCmd->SetGuidance("Set momentum direction.");
directionCmd->SetGuidance("Direction needs not to be a unit vector.");
directionCmd->SetParameterName("Px","Py","Pz",true,true);
directionCmd->SetRange("Px != 0 || Py != 0 || Pz != 0");
energyCmd = new G4UIcmdWithADoubleAndUnit("/gun/energy",this);
energyCmd->SetGuidance("Set kinetic energy.");
energyCmd->SetParameterName("Energy",true,true);
energyCmd->SetDefaultUnit("GeV");
//energyCmd->SetUnitCategory("Energy");
//energyCmd->SetUnitCandidates("eV keV MeV GeV TeV");
positionCmd = new G4UIcmdWith3VectorAndUnit("/gun/position",this);
positionCmd->SetGuidance("Set starting position of the particle.");
positionCmd->SetParameterName("X","Y","Z",true,true);
positionCmd->SetDefaultUnit("cm");
//positionCmd->SetUnitCategory("Length");
//positionCmd->SetUnitCandidates("microm mm cm m km");
timeCmd = new G4UIcmdWithADoubleAndUnit("/gun/time",this);
timeCmd->SetGuidance("Set initial time of the particle.");
timeCmd->SetParameterName("t0",true,true);
timeCmd->SetDefaultUnit("ns");
//timeCmd->SetUnitCategory("Time");
//timeCmd->SetUnitCandidates("ns ms s");
polCmd = new G4UIcmdWith3Vector("/gun/polarization",this);
polCmd->SetGuidance("Set polarization.");
polCmd->SetParameterName("Px","Py","Pz",true,true);
polCmd->SetRange("Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
numberCmd = new G4UIcmdWithAnInteger("/gun/number",this);
numberCmd->SetGuidance("Set number of particles to be generated.");
numberCmd->SetParameterName("N",true,true);
numberCmd->SetRange("N>0");
// set initial value to G4ParticleGun
fParticleGun->SetParticleDefinition( G4Geantino::Geantino() );
fParticleGun->SetParticleMomentumDirection( G4ThreeVector(1.0,0.0,0.0) );
fParticleGun->SetParticleEnergy( 1.0*GeV );
fParticleGun->SetParticlePosition(G4ThreeVector(0.0*cm, 0.0*cm, 0.0*cm));
fParticleGun->SetParticleTime( 0.0*ns );
}
G4ParticleGunMessenger::~G4ParticleGunMessenger()
{
delete listCmd;
delete particleCmd;
delete directionCmd;
delete energyCmd;
delete positionCmd;
delete timeCmd;
delete polCmd;
delete numberCmd;
delete gunDirectory;
}
void G4ParticleGunMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
{
if( command==listCmd )
{ particleTable->DumpTable(); }
else if( command==particleCmd )
{
G4ParticleDefinition* pd = particleTable->FindParticle(newValues);
if(pd != NULL)
{ fParticleGun->SetParticleDefinition( pd ); }
}
else if( command==directionCmd )
{ fParticleGun->SetParticleMomentumDirection(directionCmd->GetNew3VectorValue(newValues)); }
else if( command==energyCmd )
{ fParticleGun->SetParticleEnergy(energyCmd->GetNewDoubleValue(newValues)); }
else if( command==positionCmd )
{ fParticleGun->SetParticlePosition(positionCmd->GetNew3VectorValue(newValues)); }
else if( command==timeCmd )
{ fParticleGun->SetParticleTime(timeCmd->GetNewDoubleValue(newValues)); }
else if( command==polCmd )
{ fParticleGun->SetParticlePolarization(polCmd->GetNew3VectorValue(newValues)); }
else if( command==numberCmd )
{ fParticleGun->SetNumberOfParticles(numberCmd->GetNewIntValue(newValues)); }
}
G4String G4ParticleGunMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String cv;
if( command==directionCmd )
{ cv = directionCmd->ConvertToString(fParticleGun->GetParticleMomentumDirection()); }
else if( command==particleCmd )
{ cv = fParticleGun->GetParticleDefinition()->GetParticleName(); }
else if( command==energyCmd )
{ cv = energyCmd->ConvertToString(fParticleGun->GetParticleEnergy(),"GeV"); }
else if( command==positionCmd )
{ cv = positionCmd->ConvertToString(fParticleGun->GetParticlePosition(),"cm"); }
else if( command==timeCmd )
{ cv = timeCmd->ConvertToString(fParticleGun->GetParticleTime(),"ns"); }
else if( command==polCmd )
{ cv = polCmd->ConvertToString(fParticleGun->GetParticlePolarization()); }
else if( command==numberCmd )
{ cv = numberCmd->ConvertToString(fParticleGun->GetNumberOfParticles()); }
return cv;
}
+99
View File
@@ -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: G4PrimaryParticle.cc,v 2.3 1998/10/10 10:51:24 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4PrimaryParticle.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4ios.hh"
G4Allocator<G4PrimaryParticle> aPrimaryParticleAllocator;
G4PrimaryParticle::G4PrimaryParticle()
:PDGcode(0),G4code(NULL),Px(0.),Py(0.),Pz(0.),
nextParticle(NULL),daughterParticle(NULL),trackID(-1),
mass(0.),polX(0.),polY(0.),polZ(0.)
{;}
G4PrimaryParticle::G4PrimaryParticle(G4int Pcode)
:PDGcode(Pcode),Px(0.),Py(0.),Pz(0.),
nextParticle(NULL),daughterParticle(NULL),trackID(-1),
mass(0.),polX(0.),polY(0.),polZ(0.)
{ G4code = G4ParticleTable::GetParticleTable()->FindParticle(Pcode); }
G4PrimaryParticle::G4PrimaryParticle(G4int Pcode,
G4double px,G4double py,G4double pz)
:PDGcode(Pcode),Px(px),Py(py),Pz(pz),
nextParticle(NULL),daughterParticle(NULL),trackID(-1),
mass(0.),polX(0.),polY(0.),polZ(0.)
{ G4code = G4ParticleTable::GetParticleTable()->FindParticle(Pcode); }
G4PrimaryParticle::G4PrimaryParticle(G4ParticleDefinition* Gcode)
:G4code(Gcode),Px(0.),Py(0.),Pz(0.),
nextParticle(NULL),daughterParticle(NULL),trackID(-1),
mass(0.),polX(0.),polY(0.),polZ(0.)
{ PDGcode = Gcode->GetPDGEncoding(); }
G4PrimaryParticle::G4PrimaryParticle(G4ParticleDefinition* Gcode,
G4double px,G4double py,G4double pz)
:G4code(Gcode),Px(px),Py(py),Pz(pz),
nextParticle(NULL),daughterParticle(NULL),trackID(-1),
mass(0.),polX(0.),polY(0.),polZ(0.)
{ PDGcode = Gcode->GetPDGEncoding(); }
G4PrimaryParticle::~G4PrimaryParticle()
{
if(nextParticle != NULL)
{ delete nextParticle; }
if(daughterParticle != NULL)
{ delete daughterParticle; }
}
void G4PrimaryParticle::SetPDGcode(G4int Pcode)
{
PDGcode = Pcode;
G4code = G4ParticleTable::GetParticleTable()->FindParticle(Pcode);
}
void G4PrimaryParticle::SetG4code(G4ParticleDefinition* Gcode)
{
G4code = Gcode;
PDGcode = Gcode->GetPDGEncoding();
}
const G4PrimaryParticle &
G4PrimaryParticle::operator=(const G4PrimaryParticle &right)
{ return *this; }
int G4PrimaryParticle::operator==(const G4PrimaryParticle &right) const
{ return false; }
int G4PrimaryParticle::operator!=(const G4PrimaryParticle &right) const
{ return true; }
void G4PrimaryParticle::Print() const
{
G4cout << "==== PDGcode " << PDGcode << " Particle name ";
if(G4code != NULL)
{ G4cout << G4code->GetParticleName() << endl; }
else
{ G4cout << "is not defined in G4." << endl; }
G4cout << " Momentum ( " << Px << ", " << Py << ", " << Pz << " )" << endl;
G4cout << " Polarization ( " << polX << ", " << polY << ", "
<< polZ << " )" << endl;
if(daughterParticle != NULL)
{
G4cout << ">>>> Daughters" << endl;
daughterParticle->Print();
}
if(nextParticle != NULL)
{ nextParticle->Print(); }
else
{ G4cout << "<<<< End of link" << endl; }
}
+164
View File
@@ -0,0 +1,164 @@
// 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: G4PrimaryTransformer.cc,v 2.2 1998/10/10 10:51:25 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4PrimaryTransformer.hh"
#include "G4Event.hh"
#include "G4PrimaryVertex.hh"
#include "G4ParticleDefinition.hh"
#include "G4DynamicParticle.hh"
#include "G4Track.hh"
#include "G4ThreeVector.hh"
#include "G4DecayProducts.hh"
#include "G4ios.hh"
G4PrimaryTransformer::G4PrimaryTransformer()
:verboseLevel(0)
{
particleTable = G4ParticleTable::GetParticleTable();
}
G4PrimaryTransformer::~G4PrimaryTransformer()
{;}
G4TrackVector* G4PrimaryTransformer::GimmePrimaries(G4Event* anEvent)
{
TV.clearAndDestroy();
G4int n_vertex = anEvent->GetNumberOfPrimaryVertex();
if(n_vertex==0) return NULL;
for( int i=0; i<n_vertex; i++ )
{ GenerateTracks( anEvent->GetPrimaryVertex(i) ); }
return &TV;
}
void G4PrimaryTransformer::GenerateTracks(G4PrimaryVertex* primaryVertex)
{
G4double X0 = primaryVertex->GetX0();
G4double Y0 = primaryVertex->GetY0();
G4double Z0 = primaryVertex->GetZ0();
G4double T0 = primaryVertex->GetT0();
#ifdef G4VERBOSE
if(verboseLevel>1)
{
G4cout << "G4PrimaryTransformer::PrimaryVertex ("
<< X0 / mm << "(mm),"
<< Y0 / mm << "(mm),"
<< Z0 / mm << "(mm),"
<< T0 / nanosecond << "(nsec))" << endl;
}
#endif
G4PrimaryParticle* primaryParticle = primaryVertex->GetPrimary();
while( primaryParticle != NULL )
{
GenerateSingleTrack( primaryParticle, X0, Y0, Z0, T0 );
primaryParticle = primaryParticle->GetNext();
}
}
void G4PrimaryTransformer::GenerateSingleTrack
(G4PrimaryParticle* primaryParticle,
G4double x0,G4double y0,G4double z0,G4double t0)
{
G4ParticleDefinition* partDef = GetDefinition(primaryParticle);
if((!partDef)||partDef->IsShortLived())
// The particle is not defined in GEANT4, check daughters
{
#ifdef G4VERBOSE
if(verboseLevel>2)
{
G4cout << "Primary particle (PDGcode " << primaryParticle->GetPDGcode()
<< ") --- Ignored" << endl;
}
#endif
G4PrimaryParticle* daughter = primaryParticle->GetDaughter();
while(daughter)
{
GenerateSingleTrack(daughter,x0,y0,z0,t0);
daughter = daughter->GetNext();
}
}
// The particle is defined in GEANT4
else
{
// Create G4DynamicParticle object
#ifdef G4VERBOSE
if(verboseLevel>1)
{
G4cout << "Primary particle (" << partDef->GetParticleName()
<< ") --- Transfered with momentum " << primaryParticle->GetMomentum()
<< endl;
}
#endif
G4DynamicParticle* DP =
new G4DynamicParticle(partDef,primaryParticle->GetMomentum());
DP->SetPolarization(primaryParticle->GetPolX(),
primaryParticle->GetPolY(),
primaryParticle->GetPolZ());
// Set decay products to the DynamicParticle
SetDecayProducts( primaryParticle, DP );
// Create G4Track object
G4Track* track = new G4Track(DP,t0,G4ThreeVector(x0,y0,z0));
// Set parentID to 0 as a primary particle
track->SetParentID(0);
// Store it to G4TrackVector
TV.insert( track );
}
}
void G4PrimaryTransformer::SetDecayProducts
(G4PrimaryParticle* mother, G4DynamicParticle* motherDP)
{
G4PrimaryParticle* daughter = mother->GetDaughter();
if(!daughter) return;
G4DecayProducts* decayProducts = motherDP->GetPreAssignedDecayProducts();
if(!decayProducts)
{
decayProducts = new G4DecayProducts(*motherDP);
motherDP->SetPreAssignedDecayProducts(decayProducts);
}
while(daughter)
{
G4ParticleDefinition* partDef = GetDefinition(daughter);
if(!partDef)
{
#ifdef G4VERBOSE
if(verboseLevel>2)
{
G4cout << " >> Decay product (PDGcode " << daughter->GetPDGcode()
<< ") --- Ignored" << endl;
}
#endif
SetDecayProducts(daughter,motherDP);
}
else
{
#ifdef G4VERBOSE
if(verboseLevel>1)
{
G4cout << " >> Decay product (" << partDef->GetParticleName()
<< ") --- Attached with momentum " << daughter->GetMomentum()
<< endl;
}
#endif
G4DynamicParticle*DP
= new G4DynamicParticle(partDef,daughter->GetMomentum());
decayProducts->PushProducts(DP);
SetDecayProducts(daughter,DP);
}
daughter = daughter->GetNext();
}
}
+66
View File
@@ -0,0 +1,66 @@
// 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: G4PrimaryVertex.cc,v 2.4 1998/11/11 11:19:42 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4PrimaryVertex.hh"
#include "G4ios.hh"
G4Allocator<G4PrimaryVertex> aPrimaryVertexAllocator;
G4PrimaryVertex::G4PrimaryVertex()
:X0(0.),Y0(0.),Z0(0.),T0(0.),numberOfParticle(0),nextVertex(NULL),
theParticle(NULL),theTail(NULL)
{;}
G4PrimaryVertex::G4PrimaryVertex(
G4double x0,G4double y0,G4double z0,G4double t0)
:X0(x0),Y0(y0),Z0(z0),T0(t0),numberOfParticle(0),nextVertex(NULL),
theParticle(NULL),theTail(NULL)
{;}
G4PrimaryVertex::G4PrimaryVertex(G4ThreeVector xyz0,G4double t0)
:T0(t0),numberOfParticle(0),nextVertex(NULL),
theParticle(NULL),theTail(NULL)
{
X0=xyz0.x();
Y0=xyz0.y();
Z0=xyz0.z();
}
G4PrimaryVertex::~G4PrimaryVertex()
{
if(theParticle != NULL)
{ delete theParticle; }
if(nextVertex != NULL)
{ delete nextVertex; }
}
const G4PrimaryVertex &
G4PrimaryVertex::operator=(const G4PrimaryVertex &right)
{ return *this; }
int G4PrimaryVertex::operator==(const G4PrimaryVertex &right) const
{ return false; }
int G4PrimaryVertex::operator!=(const G4PrimaryVertex &right) const
{ return true; }
void G4PrimaryVertex::Print() const
{
G4cout << "Vertex ( "
<< X0 << ", " << Y0 << ", " << Z0 << ", " << T0 << " )" << endl;
G4cout << "#### Primary particles" << endl;
G4PrimaryParticle* aPrim = theParticle;
if(aPrim != NULL)
{
aPrim->Print();
aPrim = aPrim->GetNext();
}
}
+224
View File
@@ -0,0 +1,224 @@
// 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: G4StackManager.cc,v 2.2 1998/07/13 16:50:19 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Last Modification : 09/Dec/96 M.Asai
//
#include "G4StackManager.hh"
#include "G4StackingMessenger.hh"
#include "evmandefs.hh"
#include "G4ios.hh"
G4StackManager::G4StackManager()
:verboseLevel(0),userStackingAction(NULL)
{
theMessenger = new G4StackingMessenger(this);
urgentStack = new G4TrackStack;
waitingStack = new G4TrackStack;
postponeStack = new G4TrackStack;
}
G4StackManager::~G4StackManager()
{
if(userStackingAction) delete userStackingAction;
delete urgentStack;
delete waitingStack;
delete postponeStack;
delete theMessenger;
}
const G4StackManager & G4StackManager::operator=
(const G4StackManager &) { return *this; }
int G4StackManager::operator==(const G4StackManager &)
const{ return false; }
int G4StackManager::operator!=(const G4StackManager &)
const{ return true; }
G4int G4StackManager::PushOneTrack(G4Track *newTrack)
{
G4ClassificationOfNewTrack classification;
if(userStackingAction)
{ classification = userStackingAction->ClassifyNewTrack( newTrack ); }
else
{ classification = DefaultClassification( newTrack ); }
if(classification==fKill) // delete newTrack without stacking
{
#ifdef G4VERBOSE
if( verboseLevel > 0 )
{
G4cout << " ---> G4Track " << newTrack << " (trackID "
<< newTrack->GetTrackID() << ", parentID "
<< newTrack->GetParentID() << ") is not to be stored." << endl;
}
#endif
delete newTrack;
}
else
{
G4StackedTrack * newStackedTrack = new G4StackedTrack( newTrack );
switch (classification)
{
case fUrgent:
urgentStack->PushToStack( newStackedTrack );
break;
case fWaiting:
waitingStack->PushToStack( newStackedTrack );
break;
case fPostpone:
postponeStack->PushToStack( newStackedTrack );
break;
case fKill:
break;
}
}
return GetNUrgentTrack();
}
G4Track * G4StackManager::PopNextTrack()
{
#ifdef G4VERBOSE
if( verboseLevel > 0 )
{
G4cout << "### pop requested out of "
<< GetNUrgentTrack() << " stacked tracks." << endl;
}
#endif
while( GetNUrgentTrack() == 0 )
{
#ifdef G4VERBOSE
if( verboseLevel > 0 ) G4cout << "### " << GetNWaitingTrack()
<< " waiting tracks are re-classified to" << endl;
#endif
waitingStack->TransferTo(urgentStack);
if(userStackingAction) userStackingAction->NewStage();
#ifdef G4VERBOSE
if( verboseLevel > 0 ) G4cout << " " << GetNUrgentTrack()
<< " urgent tracks and " << GetNWaitingTrack()
<< " waiting tracks." << endl;
#endif
if( ( GetNUrgentTrack()==0 ) && ( GetNWaitingTrack()==0 ) ) return NULL;
}
G4StackedTrack * selectedStackedTrack = urgentStack->PopFromStack();
G4Track * selectedTrack = selectedStackedTrack->GetTrack();
#ifdef G4VERBOSE
if( verboseLevel > 1 )
{
G4cout << "Selected G4StackedTrack : " << selectedStackedTrack
<< " with G4Track " << selectedStackedTrack->GetTrack()
<< " (trackID " << selectedStackedTrack->GetTrack()->GetTrackID()
<< ", parentID " << selectedStackedTrack->GetTrack()->GetParentID()
<< ")" << endl;
}
#endif
delete selectedStackedTrack;
return selectedTrack;
}
void G4StackManager::ReClassify()
{
G4StackedTrack * aStackedTrack;
G4TrackStack tmpStack;
if( !userStackingAction ) return;
if( GetNUrgentTrack() == 0 ) return;
urgentStack->TransferTo(&tmpStack);
while( (aStackedTrack=tmpStack.PopFromStack()) != NULL )
{
G4ClassificationOfNewTrack classification =
userStackingAction->ClassifyNewTrack( aStackedTrack->GetTrack() );
switch (classification)
{
case fKill:
delete aStackedTrack->GetTrack();
delete aStackedTrack;
break;
case fUrgent:
urgentStack->PushToStack( aStackedTrack );
break;
case fWaiting:
waitingStack->PushToStack( aStackedTrack );
break;
case fPostpone:
postponeStack->PushToStack( aStackedTrack );
break;
}
}
}
G4int G4StackManager::PrepareNewEvent()
{
if(userStackingAction) userStackingAction->PrepareNewEvent();
G4int n_passedFromPrevious = 0;
if( GetNPostponedTrack() > 0 )
{
#ifdef G4VERBOSE
if( verboseLevel > 0 )
{
G4cout << GetNPostponedTrack()
<< " postponed tracked are now shifted to the stack." << endl;
}
#endif
G4StackedTrack * aStackedTrack;
G4TrackStack tmpStack;
postponeStack->TransferTo(&tmpStack);
while( (aStackedTrack=tmpStack.PopFromStack()) != NULL )
{
G4Track* aTrack = aStackedTrack->GetTrack();
aTrack->SetParentID(-1);
G4ClassificationOfNewTrack classification;
if(userStackingAction)
{ classification = userStackingAction->ClassifyNewTrack( aTrack ); }
else
{ classification = DefaultClassification( aTrack ); }
if(classification==fKill)
{
delete aTrack;
delete aStackedTrack;
}
else
{
aTrack->SetTrackID(++n_passedFromPrevious);
switch (classification)
{
case fUrgent:
urgentStack->PushToStack( aStackedTrack );
break;
case fWaiting:
waitingStack->PushToStack( aStackedTrack );
break;
case fPostpone:
postponeStack->PushToStack( aStackedTrack );
break;
case fKill:
break;
}
}
}
}
return n_passedFromPrevious;
}
+37
View File
@@ -0,0 +1,37 @@
// 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: G4StackedTrack.cc,v 2.0 1998/07/02 16:54:06 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Last Modification : 02/Feb/96 M.Asai
//
#include "G4StackedTrack.hh"
G4Allocator<G4StackedTrack> aStackedTrackAllocator;
G4StackedTrack::G4StackedTrack()
{ }
G4StackedTrack::G4StackedTrack(G4Track * newTrack)
:track(newTrack),priorityWeight(0.),
previousStackedTrack(NULL),nextStackedTrack(NULL)
{ }
G4StackedTrack::~G4StackedTrack()
{ }
const G4StackedTrack & G4StackedTrack::operator=(const G4StackedTrack &right)
{ return *this; }
int G4StackedTrack::operator==(const G4StackedTrack &right) const
{ return false; }
int G4StackedTrack::operator!=(const G4StackedTrack &right) const
{ return true; }
+80
View File
@@ -0,0 +1,80 @@
// 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: G4StackingMessenger.cc,v 2.3 1998/07/13 16:50:21 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// --------------------------------------------------------------------
#include "G4StackingMessenger.hh"
#include "G4StackManager.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4ios.hh"
G4StackingMessenger::G4StackingMessenger(G4StackManager * fCont)
:fContainer(fCont)
{
stackDir = new G4UIdirectory("/event/stack/");
stackDir->SetGuidance("Stack control commands.");
statusCmd = new G4UIcmdWithoutParameter("/event/stack/status",this);
statusCmd->SetGuidance("List current status of the stack.");
clearCmd = new G4UIcmdWithAnInteger("/event/stack/clear",this);
clearCmd->SetGuidance("Clear stacked tracks.");
clearCmd->SetGuidance(" 2 : clear all tracks in all stacks");
clearCmd->SetGuidance(" 1 : clear tracks in the urgent and waiting stacks");
clearCmd->SetGuidance(" 0 : clear tracks in the waiting stack (default)");
clearCmd->SetGuidance("-1 : clear tracks in the urgent stack");
clearCmd->SetGuidance("-2 : clear tracks in the postponed stack");
clearCmd->SetParameterName("level",true);
clearCmd->SetDefaultValue(0);
clearCmd->SetRange("level>=-2&&level<=2");
clearCmd->AvailableForStates(GeomClosed,EventProc);
}
G4StackingMessenger::~G4StackingMessenger()
{
delete statusCmd;
delete clearCmd;
delete stackDir;
}
void G4StackingMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
{
if( command==statusCmd )
{
G4cout << "========================== Current status of the stack =====" << endl;
G4cout << " Number of tracks in the stack" << endl;
G4cout << " Urgent stack : " << fContainer->GetNUrgentTrack() << endl;
G4cout << " Waiting stack : " << fContainer->GetNWaitingTrack() << endl;
G4cout << " Postponed stack : " << fContainer->GetNPostponedTrack() << endl;
}
if( command==clearCmd )
{
G4int vc = clearCmd->GetNewIntValue(newValues);
switch (vc)
{
case 2:
fContainer->ClearPostponeStack();
case 1:
fContainer->ClearUrgentStack();
case 0:
fContainer->ClearWaitingStack();
break;
case -1:
fContainer->ClearUrgentStack();
break;
case -2:
fContainer->ClearPostponeStack();
break;
}
}
}
+135
View File
@@ -0,0 +1,135 @@
// 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: G4TrackStack.cc,v 2.1 1998/07/12 02:54:07 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Last Modification : 09/Dec/96 M.Asai
//
#include "G4TrackStack.hh"
G4TrackStack::G4TrackStack()
:n_stackedTrack(0),firstStackedTrack(NULL),lastStackedTrack(NULL)
{;}
G4TrackStack::~G4TrackStack()
{;}
const G4TrackStack & G4TrackStack::operator=(const G4TrackStack &right)
{
n_stackedTrack = right.n_stackedTrack;
firstStackedTrack = right.firstStackedTrack;
lastStackedTrack = right.lastStackedTrack;
return *this;
}
int G4TrackStack::operator==(const G4TrackStack &right) const
{ return (firstStackedTrack==right.firstStackedTrack); }
int G4TrackStack::operator!=(const G4TrackStack &right) const
{ return (firstStackedTrack!=right.firstStackedTrack); }
void G4TrackStack::TransferTo(G4TrackStack * aStack)
{
if(n_stackedTrack==0) return;
if(aStack->n_stackedTrack == 0)
{
*aStack = *this;
}
else
{
aStack->lastStackedTrack->SetNext( firstStackedTrack );
firstStackedTrack->SetPrevious( aStack->lastStackedTrack );
aStack->lastStackedTrack = lastStackedTrack;
aStack->n_stackedTrack += n_stackedTrack;
}
n_stackedTrack = 0;
firstStackedTrack = NULL;
lastStackedTrack = NULL;
}
G4StackedTrack * G4TrackStack::PopFromStack()
{
if( n_stackedTrack == 0 ) return NULL;
G4StackedTrack * aStackedTrack = lastStackedTrack;
GrabFromStack( aStackedTrack );
return aStackedTrack;
}
void G4TrackStack::PushToStack( G4StackedTrack * aStackedTrack )
{
if( n_stackedTrack == 0 )
{
aStackedTrack->SetPrevious( NULL );
firstStackedTrack = aStackedTrack;
}
else
{
lastStackedTrack->SetNext( aStackedTrack );
aStackedTrack->SetPrevious( lastStackedTrack );
}
lastStackedTrack = aStackedTrack;
n_stackedTrack++;
}
void G4TrackStack::GrabFromStack( G4StackedTrack * aStackedTrack )
{
if( n_stackedTrack == 1 )
{
firstStackedTrack = NULL;
lastStackedTrack = NULL;
}
else
{
if( aStackedTrack == firstStackedTrack )
{
firstStackedTrack = aStackedTrack->GetNext();
firstStackedTrack->SetPrevious( NULL );
}
else
{
if( aStackedTrack == lastStackedTrack )
{
lastStackedTrack = aStackedTrack->GetPrevious();
lastStackedTrack->SetNext( NULL );
}
else
{
aStackedTrack->GetPrevious()
->SetNext( aStackedTrack->GetNext() );
aStackedTrack->GetNext()
->SetPrevious( aStackedTrack->GetPrevious() );
}
}
}
n_stackedTrack--;
}
void G4TrackStack::clear()
{
G4StackedTrack * aStackedTrack = firstStackedTrack;
G4StackedTrack * nextStackedTrack;
if ( n_stackedTrack == 0 ) return;
// delete tracks in the stack
while( aStackedTrack != NULL )
{
nextStackedTrack = aStackedTrack->GetNext();
delete aStackedTrack->GetTrack();
delete aStackedTrack;
aStackedTrack = nextStackedTrack;
}
n_stackedTrack = 0;
firstStackedTrack = NULL;
lastStackedTrack = NULL;
}
+19
View File
@@ -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: G4UserEventAction.cc,v 2.1 1998/07/12 02:54:08 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4UserEventAction.hh"
void G4UserEventAction::BeginOfEventAction()
{;}
void G4UserEventAction::EndOfEventAction()
{;}
+37
View File
@@ -0,0 +1,37 @@
// 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: G4UserStackingAction.cc,v 2.2 1998/07/13 16:50:22 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Last Modification : 09/Dec/96 M.Asai
//
#include "G4UserStackingAction.hh"
#include "G4Track.hh"
#include "G4ios.hh"
G4UserStackingAction::G4UserStackingAction()
{;}
G4UserStackingAction::~G4UserStackingAction()
{;}
G4ClassificationOfNewTrack G4UserStackingAction::ClassifyNewTrack
(G4Track * const aTrack)
{
return fUrgent;
}
void G4UserStackingAction::NewStage()
{;}
void G4UserStackingAction::PrepareNewEvent()
{;}
+21
View File
@@ -0,0 +1,21 @@
// 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: G4VPrimaryGenerator.cc,v 2.0 1998/07/02 16:54:13 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
// G4VPrimaryGenerator
#include "G4VPrimaryGenerator.hh"
G4VPrimaryGenerator::G4VPrimaryGenerator()
{;}
G4VPrimaryGenerator::~G4VPrimaryGenerator()
{;}
+3
View File
@@ -0,0 +1,3 @@
*.out
*.dat
HP-G++
+215
View File
@@ -0,0 +1,215 @@
###############################################################################
### GNUmakefile for the G3 to G4 conversion package.
###
### T. Wenaus 20/11/1995
### Uses chunks of John Allison's generic makefiles.
###
### The presence of Fortran and several standalone programs
### make this package non-generic enough to require its
### own makefile.
###
### History: now in README file.
### !!!!! Please add -- or at least copy -- history updates !!!!!
### !!!!! to the g3tog4/README file - TW !!!!!
###
###############################################################################
G4TARGET = rztog4
name = G3toG4
curdir = $(shell /bin/pwd)
ifndef G4INSTALL
G4INSTALL = ../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/geometry/magneticfield/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/solids/CSG/include \
-I$(G4BASE)/geometry/solids/BREPS/include \
-I$(G4BASE)/geometry/solids/STEP/include \
-I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/general/include \
-I$(G4BASE)/processes/decay/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/tracking/include \
-Itest
### kludge for AIX
ifeq ($(FC),xlf)
cpp_include_flag=-WF,-I
### -d writes out F*.f file
# FCFLAGS += -d $(patsubst -I%,$(cpp_include_flag)%,$(CPPFLAGS))
FCFLAGS += -d $(patsubst -I%,$(cpp_include_flag)%,-Iinclude)
### xlf prepends .f name with F
dotf_prepend=F
else
### other compilers do not prepend .f name with F
dotf_prepend=
FCFLAGS += -Iinclude
endif
.SUFFIXES:
.SUFFIXES: .a .o .cc .cxx .c .f .F .d
### --------------------- vpaths ----------------------------------------------
vpath %.hh $(patsubst -I%,%,$(filter -I%,$(CPPFLAGS)))
vpath %.inc $(patsubst -I%,%,$(filter -I%,$(CPPFLAGS)))
G4LIBDIR := $(G4LIB)/$(G4SYSTEM)
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
G4BINDIR := $(G4BIN)/$(G4SYSTEM)
Fbinsources = src/$(G4TARGET).F
Fbinobjects = $(patsubst src/%.F,$(G4TMPDIR)/%.o,$(Fbinsources))
Flibsources = $(filter-out $(Fbinsources),$(wildcard src/*.F))
Flibobjects = $(patsubst src/%.F,$(G4TMPDIR)/%.o,$(Flibsources))
Fdependencies = $(patsubst %.o,%.d,$(Fbinobjects) $(Flibobjects))
###############################################################################
### user beware! .rz files made with cernlib v 95a cannot be read with later
### versions. You can use cernlib -v option to specify the cernlib version
###############################################################################
ifdef SLAC
cernlibv = 95a
else
cernlibv = pro
endif
cernlibs := $(shell cernlib -v $(cernlibv) geant321 packlib)
### .PHONY targets are executed regardless of time-stamp of any file of same
### name
.PHONY: global all lib bin libC libF ext geom
###--------------------- section to define explicit rules --------------------
##first: lib bin
first: lib
global: lib
all: ext lib bin examples
@echo $@ stage done in $(curdir)
examples: cltog4 clGeometry
@echo $@ stage done in $(curdir)
cltog4:
cd test; $(MAKE) "G4TARGET=cltog4"
clGeometry:
cd test; $(MAKE) "G4TARGET=clGeometry"
lib: libc #libF
@echo $@ stage done in $(curdir)
libc : $(G4LIBDIR)/lib$(name).a
@echo $@ stage done in $(curdir)
libF : $(G4LIBDIR)/lib$(name)F.a
@echo $@ stage done in $(curdir)
bin: $(G4BINDIR)/$(G4TARGET)
@echo $@ stage done in $(curdir)
### Make Fortran library.
$(G4LIBDIR)/lib$(name)F.a: $(Flibobjects)
@if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ;fi
@echo Creating/replacing object files in lib$(name)F.a
@ar r $@ $?
@if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then \
echo Running ranlib on lib$(name)F.a ; ranlib $@ ; fi
### rztog4: Standalone Fortran program that reads an RZ file and converts
### the geometry and other init structures therein to G4. A call
### list file and G4 C++ code are generated; either can be used
### on the G4 side to build the geometry.
$(G4BINDIR)/$(G4TARGET) : $(Fbinobjects) $(G4LIBDIR)/lib$(name)F.a
@if [ ! -d $(G4BINDIR) ] ; then mkdir $(G4BINDIR) ;fi
@echo Linking $(G4TARGET)
$(RM) $@
echo $(G4TARGET) dependencies: $^
$(FC) $(Fbinobjects) -o $@ $(G4LIBDIR)/lib$(name)F.a $(cernlibs)
@echo Finished linking $(G4TARGET)
###-------------------- locally defined pattern rules ------------------------
### Make the .o files from src/*.F
$(G4TMPDIR)/%.o : src/%.F
$(FC) $(FCFLAGS) -o $(G4TMPDIR)/$(*F).o -c src/$(*F).F
@file=$(dotf_prepend)$(*F).f;\
if [ -f $$file ]; then echo Moving $$file to $(G4TMPDIR)/$$file; \
mv $$file $(G4TMPDIR)/$$file; fi
### Move the .f files
$(G4TMPDIR)/%.f : %.f
@echo Moving $< to $@
@mv $< $@
### --------------------- .d files --------------------------------------------
### Make the .d file(s) and include it(them).
### g++ -MM is good at this, except it forgets the subdirectory (hence
### the echo $(@D)/).
$(G4TMPDIR)/%.d: src/%.F
@if [ ! -d $(G4TMP)/$(G4SYSTEM) ] ; then mkdir $(G4TMP)/$(G4SYSTEM) ;fi
@if [ ! -d $(G4TMPDIR) ] ; then mkdir $(G4TMPDIR) ;fi
@if test -f $@ ; then rm -f $@; fi
@echo $(G4LIBDIR)/lib$(name)F.a\($*.o\) $@ " : " $? "\\" > $@
@if test -f $< ; then awk '$$1=="#include" { print $$2 " \\" }' $< | tr -d \"\>\< >> $@ ; echo >> $@ ; fi
###@if test -f $< ; then echo Making $@ depend file for $<; awk '$$1=="#include" { print $$2 " \\" }' $< | tr -d \"\>\< >> $@ ; echo >> $@ ; fi
### --------------------- end of pattern rules --------------------------------
-include $(Fdependencies)
### --------------------- target for external packages-------------------------
ext:
# global targets
@cd $(G4BASE)/global; $(MAKE) global
@cd $(G4BASE)/geometry; $(MAKE) global
@cd $(G4BASE)/run; $(MAKE)
@cd $(G4BASE)/event; $(MAKE)
@cd $(G4BASE)/intercoms; $(MAKE)
@cd $(G4BASE)/interfaces; $(MAKE)
@cd $(G4BASE)/visualization; $(MAKE)
@cd $(G4BASE)/tracking; $(MAKE)
@cd $(G4BASE)/track; $(MAKE)
@cd $(G4BASE)/particles; $(MAKE) global
@cd $(G4BASE)/processes; $(MAKE) global
@cd $(G4BASE)/materials; $(MAKE)
@cd $(G4BASE)/digits+hits; $(MAKE) global
@cd $(G4BASE)/graphics_reps; $(MAKE)
cleanf:
$(RM) $(Flibobjects)
$(RM) $(Fbinobjects)
$(RM) $(Fdependencies)
$(RM) $(G4BINDIR)/$(G4TARGET)
include $(G4INSTALL)/config/common.gmk
test1:
@echo $(sources)
@echo $(objects)
@echo $(dependencies)
+482
View File
@@ -0,0 +1,482 @@
$Id: History,v 2.9 1998/11/17 17:47:40 lockman Exp $
G3toG4 Modification History (reverse chronological order, please !)
--------------------------------------------------------------------
g3tog4-00-03-04 12-Nov-1998 Bill Lockman
- G3medtable: dynamically instantiate a G4FieldManager(field*) object and
pass it to G4LogicalVolume by pointer.
- adapt G3toG3PhysicsList.* from N02
g3tog4-00-03-03 02-Nov-1998 Bill Lockman
- src: Added G3toG4RotationMatrix class, remove G3toG3SetRotation class;
- test: add parity.dat to test parity inversions
g3tog4-00-03-02 05-Oct-1998 Bill Lockman
- GNUmakefile, test/GNUmakefile mods by John Allison
g3tog4-00-03-01 21-Sep-1998 BIll Lockman
- svtwaf.dat: shrank size of svt mother volume just enclose the detectors.
g3tog4-00-02-02 17-Sep-1998 Bill Lockman
- implemented G4 capitalization convention for class names. g3tog4->G3toG4.
- clGeometry.cc: introduced G3toG4VisManager class;
added RunManager->Initialize
- added G3toG4SetRotation class to set rotation matrix elements directly,
including improper rotations (parity transforms). Check for orthonormality
and left-handedness.
g3tog4-00-02-01 21-Aug-1998 Bill Lockman
- GNUmakefile: removed 'bin' dependence from 'first' target
g3tog4-00-01-02 16-Jul-1998 Bill Lockman
- Mods to test/GNUmakefile by B. Lockman to link
g3tog4-00-01-01 07-Jul-1998 Gabriele Cosmo
- Several updates to test/GNUmakefile by J.Allison
- Removed obsolete tag g3tog4-00-07-00.
g3tog4-00-07-00 29-Jun-1998 Bill Lockman
- GNUmakefile:
- added an 'examples' target to build the examples in test/
- example/*/cltog4.* moved to test/. Removed all files in example from repo.
- test/GNUmakefile: added G4EXLIB=true flag
- test/clGeometry.cc, cltog4.cc: replaced #include "*.cc" with "*.hh"
g3tog4-00-06-06 26-Jun-1998 Gabriele Cosmo
- Again changes to GNUmakefiles according to the new structure in
processes/electromagnetic. (by J.Allison)
g3tog4-00-06-05 23-Jun-1998 Bill Lockman
- GNUmakefile:
- uncommented cernlibs function (John, did you comment this ???)
o build only the global processes library, not the processes sublibraries
o build the global digits+hits library
- example and test GNUmakefiles: link against global processes library
- removed test/GNUmakefile.G4VIS_USE, superceded by visualization/G4VIS_USE.gmk
- modified include paths in example/, test/ to include detector/include,
hits/include
- src/G4gsmate: if G3 vacuum state encountered (dens<G3_input_density), set
dens=0; if Z < 1, set Z=1, A=2.
g3tog4-00-06-04 22-Jun-1998 John Allison
- Changed GNUmakefiles to use G4VIS_USE.gmk.
- Introduced G4BASE in GNUmakefiles.
g3tog4-00-06-03 14-Jun-1998 Bill Lockman
- temporarily removed VACUUM from call list. This material causes SetCuts to
go into an infinite loop
- removed proton from macro files
- if Z<1, set Z=1, A=2.
- renamed test/clGeometry.g4macro to test/clGeometry.x
- added example/cltog4.x.
- example/cltog4.cc always runs in batch, no graphics.
g3tog4-00-06-02 12-Jun-1998 Bill Lockman
- simplified xlf include path
- treat as vacuum (A=2, Z=1, dens=0) if input density < 1.e-15 g/cm3
- G4makevol: assert Rmin>=0 && Rmax>=Rmin
g3tog4-00-06-00 07-Jun-1998 Bill Lockman
- added G4VisAttributes.hh header file to clGeometry.cc to define
stream operator for G4VisAttributes&
g3tog4-00-05-05 23-Apr-1998 Bill Lockman
- test/svtwaf.dat: took out PCON mother, replaced with TUBS.
g3tog4-00-05-04 21-Apr-1998 Bill Lockman
- tog4.F: Increased iia array dimension from 1k to 10k.
09-Apr-1998 Bill Lockman
- G4BuildGeom.cc: set vis attribute of top level volume to invisible
- test/src/clGeometry.cc: instantiate MyVisManager
- rename g4geom.cc to g4geom.cc.main
- in svtwaf.dat, make volume SSVD a G4Tubs instead of a PCON. Otherwise,
can't close the geometry.
- GNUmakefile: remove EXEC_BUILD = true
- example/GNUmakefile: add EXEC_BUILD = true
09-Apr-1998 Gabriele Cosmo
- Porting on DEC-cxx 6.0:
> fixed warnings about meaningless usage of the
"const" qualifier. Fixed files:
G3VolTable.hh, G3VolTable.cc
> fixed problem of partial override of G4VPVParameterisation class.
Files: G3CalcParams.hh, G3CalcParams.cc
07-Apr-1998 Bill Lockman
- GNUmakefile: Fbinobjects was misspelled => rztog4.d was not made.
- src/rztog4.F: check for existence of .rz file before continuing.
- src/G4makevol.cc: include G4BREPSolidPolyhedra.hh and G4BREPSolidPCone.hh
instead of .h
HEAD April 2, 98 G.Barrand
- G4VIS_USE_OPENINVENTOR -> G4VIS_USE_OIX in makefiles.
26-Mar-1998 Bill Lockman
- GNUmakefile: do not include rztog4.o in libG3toG4F.a, but explicitly in
link command. See README for what the different phony targets (all, lib, bin,
libC libF) do. In general, for both the top-level Makefile and the example
makefiles, gmake all will build everything, including the external libraries.
gmake all from the top-level makefile will additionally build both example
executables as well as rztog4. From the example directory, gmake all will
build the external libraries, the libG3toG4.a and libG3toG4.a libraries,
and the example executable executable.
- G4makevol.cc: added commented-out #include "G4BREPSolidPCone.hh" and
#include "G4BREPSolidPolyhedra.hh" (will convert in alpha06 release)
26th March 1998 John Allison
- Changed G4VisManager to MyVisManager in clGeometry.cc for vis-00-05-01
and later.
25-Mar-1998 Gabriele Cosmo
- Cleaned up warnings on DEC
g3tog4-00-04-02 06-Mar-1998 Bill Lockman
- Modified example and test GNUmakefiles to synch with latest G4 mods (mainly
vis and G4PhysicsList)
- test/clGeometry.cc use new method for instantiating vis manager
- broke off g3tog4DetectorConstruction executable code into .cc
- added g3tog4RunAction from test_skeleton
- added g3tog4PhysicsList from test_skeleton, dumped Process- and ParticleList
- updated example/GNUmakefile and cltog4.cc to synch with latest G4 changes
30th January 1998 Gabriele Cosmo (g3tog4-00-03-02)
- Modified order of link in test/GNUmakefile (G4intercoms)
27th January 1998 John Allison
- Simplyfied include GNUmakfile.G4VIS_USE in test/GNUmakefile.
- New way of instantiating G4VisManager in test/src/clGeometry.cc.
20-Jan-1998 Bill Lockman
- GNUmakefile: in 'ext', do only geometry (BREPS) and visualization (global)
- example/GNUmakefile: remove include GNUmakefile.common, replace with required
rules. Do not use default clean rule - it removes the $G4SYSTEM soft
links
- test/GNUmakefile: remove include GNUmakefile.common, replace with required
rules. Do not use default clean rule - it removes the $G4SYSTEM soft
links
- test/clGeometry.g4macro: modified
- test/include/g3tog4DetectorConstruction.hh: modified a comment
- test/src/clGeometry.cc: added an optional 3rd argument, a terminal type
- test/src/g3tog4PrimaryGeneratorAction.cc: changed some gun defaults
22-Dec-1997 Bill Lockman
added example/src, moved cltog4.cc there. Cleaned up g3tog4 makefiles.
20-Dec-1997 John Allison:
Changed ifdef OPENGL_WIDGET to ifdef G4VIS_USE_OPENGLXM in test/GNUmakefile.
Also eliminated LOADLIBS += -lGLw. (GLw is not used, I think.)
(These flags need tidying in all GNUmakefiles -JA)
g3tog4-00-02-03 12-Dec-1997 Lockman:
test/GNUmakefile: visualization code and library path cloned from run/example2.
test/src/clGeometry: added #include "G4VisRegisterGraphicsSystems.icc";
protect all visualization code inside #ifdef VISUALIZE_CLGEOMETRY...#endif
18 Nov 1997 B. Lockman:
src/G4gsmate.cc: changed | to ||
src/G3gsdetv.cc: currently disable
test/src/, include: updated g3tog4*.cc and *.hh from run/example1
g3tog4.F : commented out call to code generator
Removed G3G4Init.cc, G3Mother.cc, G3Mother.hh
GNUmakefile: if SLAC env. variable is set, use cernlib -v 95a, otherwise
use pro
example/GNUmakefile: updated pattern rules to build .d.
test/GNUmakefile: remove pattern rules, replace with include GNUmakefile.common
include/G3G4Interface.hh: G4BuildGeom now returns G4LogicalVolume*
include/G3VolTable.hh: added static G4LogicalVolume* mothLV; getLVx(G4String&)
now returns G4LogicalVolume* corresponding to a name, using
G4LogicalVolumeStore class; removed getTopVol method
src/G3VolTable.cc: removed G3Mother; Mother corresponds to the first volume
placed by G3toG4 (set by method setMother in in putLV.
src/G4BuildGeom.cc returns G4LogicalVolume* of first volume placed by G3toG4
src/G4gsatt.cc,G4gsdetv.cc,G4gsdv*.cc: replaced getLV(name) with getLVx(name)
src/G4gspos*.cc: use G4PVPlacement constructor which places volume inside
Logical mother volume.
src/G4makevol.cc: check that LV is not already placed; if so, do not place it.
Removed references to G3MOther; added G3Bound to chek the
radial bounds on PCON and PGON volumes
src/clparse.cc: removed GlobalMotherVolume and SubsystemMotherVolume logic.
src/g3tog4.F: remove ctop(G3G4Init)
test/src/g3tog4DetectorConstruction: G4LogicalVolume* G4BuildGeom; place
top-level volume.
08-Nov 1997 B. Lockman
cltog4.cc, clGeometry.cc: update to follow skeleton.cc pattern
G4makevol.cc: check parameters of PGON, PCON, adjust if necessary
tog4.F: new rz reader from Vladimir Berejnoi.
21-Jul 1997 G. Cosmo
G3toG4.hh: commented out extern declaration of min(). Porting on HP-UX10.
16-Jul 1997 B. Lockman
G3Mother.cc: set the vis attributes of the mother to be invisible
G4makevol.cc: commented out the forward declaration class RWTValVector<double>;
17-Jun-1997 T. Wenaus
- GNUmakefile mod to exclude g4geom.cc from library
- G3VolTable mod to add putLV(name, lvol) method for case when nothing
other than lvol pointer is known about the volume
- src/clparse.cc mods to use g3tog4 in the context of a Geant4
application of which g3tog4 is just a component:
- G4LogicalVolume* GlobalMotherVolume if non-null points to the
global mother to be used by g3tog4
- G4LogicalVolume* SubsystemMotherVolume is loaded with the lvol
immediately under the g3tog4 global mother (second gsvolu definition
during the parsing)
12-Jun-1997 B. Lockman
G3Mother.cc: set the vis attributes of the mother to be invisible
28-May-1997 B. Lockman
g3tog4/GNUmakefile : split lib into 'libf' and 'libc'
test,example/GNUmakefile : make libc target in to level makefile instead of lib
src/clGeometry.cc : made cltog4.cc a short version of clGeometry.cc
20-May-1997 B. Lockman
- test/GNUmakefile : added run to include path
- test/src/clGeometry.cc : add particle and hit generation
05-May-1997 B. Lockman
- src/clparse.cc: G3G4Init no longer calls G4Setup (G3Setup instantiates a
fixed-shape world volume. This is now handled in G3Mother, based on the
information in the call list file.) G3G4Init now just opens clparse.out.
- src/G4makevol.cc : SingletonMother->Instance(G4LogicalVolume* lvol)
- src/G4BuildGeom returns G3Vol.getPV() (see below)
- G3Mother : Singleton class whose data memebers _instance and _LV are
initialized from a call in G4Makevol
o src/G3Mother::Instance(G4LogicalVolume * LV) stores the pointer to the
singleton object (_instance) and the pointer to the logical mother volume
(_instance->_LV); places mother volume; store pointer to physcal mother
volume in G3VolTable: G3Vol.setMother(motherWorldPhys)
- src/G3VolTable.cc :
o G4LogicalVolume* G3VolTable::getLV() returns the pointer to the top-level
logical mother volume
o G4VPhysicalVolume* G3VolTable::getPV() returns the pointer to the top-level
physical mother volume
- test/src/clGeometry.cc:
o geometry is now closed in G4BuildGeom when G3ggclas is called
03-May-1997 B. Lockman
- summary : got rid of artifical top level volume, replaced with top level
logical volume defined in call list file; place it.
- src/G3Mother.cc, include/G3Mother.hh : singleton class to hold copy of
mother volume name. Can be accessed from anywhere
- src/G3VolTable.cc, include/G3VolTable.hh : added getTopVol(), returns a
pointer to the top level logical volume
- src/G3makevol.cc: fill singleton class
- src/G4BuildGeom.cc: invoke getTopVol, create top level physical volume
from logical volume, no longer done in G4Setup.
02-May-1997 B. Lockman
- src/jshape.F: translate HYPE, ELTU and CTUBS shape numbers into names
- src/G4gsdv*.cc: call G4gsvolu with zeronpars
28-Apr-1997 B. Lockman :
- example,test/GNUmakefile :
o added 'ext' target which depends on g4ext (phony) and 'all'. The former
simply runs the 'ext' target in the top-level GNUmakefile.
25-Apr-1997 B. Lockman :
- src/G4gsdvn2.cc: fixed array overrun
- src/G4gspos, G4gsposp, G4gsvolu: fixed some small memory leaks
- src/rztog4.F : added optional second argument to specify the call list file
- src/clparse.cc : G4bool _debug (local) controls printing of each read line
- test/src/clGeometry.cc : define world volume for tracking : G4TransportationManager::getTransportationManager()->getNavigatorForTracking()->SetWorldVolume( pGeometries );
24-Apr-1997 B. Lockman :
-test/src/clGeometry.cc:
o instantiated a geometry before G4VisManager
23-Apr-1997 B. Lockman :
- GNUmakefile:
o added 'all' to 'ext' dependencies. gmake ext now builds all the
needed libraries and makes the rztog4 executable. cltog4 executable is made
by example/GNUmakefile; clGeometry executable is made by test/GNUmakefile.
o added lG4run to library list in all three GNUmakefiles
- src/G4gsvolu:
o changed 'delete param' to 'delete [] param'
02-Apr-1997 B. Lockman :
- phase out GNUmakefile-ext. Replace with 'ext' target in GNUmakefile; also
added a 'geom' target which updates geometry/, including STEP and BREPS,
and merges all .o files into geometry/$G4SYSTEM/libG4geometry.a. Thus:
using prototype/GNUmakefile g3tog4/GNUmakefile
---------------------------------------------
either type: "gmake" followed by "gmake ext"
or type: "gmake vis" followed by "gmake geom"
---------------------------------------------
where 'ext' updates particle+matter, global, interfaces, visualization and
geometry, including BREPS and STEP,
and 'geom' updates geometry only, including BREPS and STEP
- example/: added cltog4.cc, removed from src/.
07-Apr-1997 B. Lockman
- GNUmakefiles: particle+matter/GNUmakefile global target now produeces
libraries in particles, processes, management and materials. Modify library
path accordingly.
- src/G4makefile: Updated to construct G4Para.
31-Mar-1997 B. Lockman :
- src/G4gsrotm.cc:
o Incorporated proper coordinate-system rotation calculated from Euler angles.
The convention in Geant3 is to specify the roation matrix as a rotation of
the coordinate system, not a rotation of the body, as was done in Geant3.
The c.s. rotation matrix is the transpose of the body rotation matrix.
27-Mar-1997 B. Lockman :
- moved cltog4.cc from src to example so that it doesnt get put into g3tog4
library. Thus, libG3toG4.a will contain no main routine. This avoids
conflicts with mains in other packages (like visualization/test). Added
GNUmakefile to example to build cltog4 target. Commented cltog4 target in
g3tog4/GNUmakefile.
20-Mar-1997 B. Lockman :
- src/G4makevol.cc:
o G4BREPSolidPCone, Polyhedra require the number of sections = nz -1
- GNUmakefile :
o removed -include ../global/GNUmakefile.common
o added clean_libs, clean (doesnt remove $G4SYSTEM/), clean-all (removes
$G4SYSTEM)
o put in libG3toG4.a target, depends on ../$(G4SYSTEM)/libG3toG4.a. Rule is to
run ../GNUmakefile which now just makes the libraries
o typing 'gmake' will make 'all' target
typing 'gmake lib' or 'gmake bin' will make the libraries and binaries
o remove binaries before rebuilding
- src/GLKludge.cc , include/GLKludge.hh : currently G4BREPSolidPCone and
G4BREPSolidPolyhedra cant handle cases where z[i] = z[i-1], add 10 microns
to z[i] as a temporary kludge if z[i] <= z[i-1]
19-Mar-1997 B. Lockman :
- GNUmakefile-ext:
o currently builds geometry global target using geometry/GNUmakefile.test
18-Mar-1997 B. Lockman :
- GNUmakefile-ext:
o updating of external packages needed by g3tog4 now done in
GNUmakefile-ext. Invoke 'global' target in packages supporting this.
This target removes the libraries in the lower level
package directories and consolidates them in the top-level package
directories, simplifying the library path somewhat in GNUmakefile and
example/GNUmakefile. This also makes the libraries defined here
compatable with those defined in visualization/test/GNUmakefile.
o added a clean_libs target to remove all libraries (invoked from the command
line; 'all' does not depend on it)
Mar 16 '97 TW
- GNUmakefile:
o minor typo fix CPPFLAGS -> $(CPPFLAGS)
o consolidated histories back into this file; please keep this file a
single comprehensive history of g3tog4 package modifications.
14-Mar-1997 Lockman:
- GNUmakefile:
o Added vpath %.a to provide library search path
o make cltog4 dependent on all the libraries in G4LIBS
11-Mar-1997 B. Lockman :
- GNUmakefile:
o added tracking, intercoms to library path ;
now update BREPS, STEP, CSG targets in GNUmakefile-ext
04-Mar-1997 B. Lockman :
- GNUmakefile:
o added LDFLAGS variable to allow user to specify link options from
from the cmd line
17-Jan-1997 B. Lockman :
- GNUmakefile:
o updated include path to include BREPS, STEP and graphics_reps.
o updated library path to include BREPS, STEP libraries
o Added phony BREPS and STEP targets to insure these packages are
compiled (really should be done in the top-level GNUmakefile)
15-Jan-1997 B. Lockman :
- GNUmakefile:
o rewrote include path after directory restructuring
o rewrote library path after directory restructuring
- g3routines.F : run-time formatting of call list file implemented.
- mztog4.F, rztog4.F : put tog4 into a separate file
- tog4.F : dimensioned orig, fact to 5000
29-Oct-1996 B. Lockman :
- GNUmakefile:
o rewrote include path after directory restructuring
o rewrite library path after directory restructuring
02-Oct-1996 B. Lockman :
- GNUmakefile:
o in making/updating libG3toG4F.a, run ranlib on this library, not
libG3toG4.a
01-Oct-1996 B. Lockman :
- GNUmakefile:
o modified FCFLAGS to replace -I with -WF,-I to define cpp include
path for xlf compiler
o added -d option for xlf compiler to write intermediate .f file
o added -g option to produce debug symbols
o added $(fsources) (*.f filobals.hhles) to 'all' dependencies
o moved 'all' rule to below definition of $(cernlibs) so that
$(fsources) is defined
o defined pattern rule to move .f files to $(G4SYSTEM)
o moved -include ../global/GNUmakefile.common after explicit rules
and before pattern rules definition. This file defines the
variables $(sources) (src/*.cc) and $(dependencies) (corresponding
.d files) as well as some pattern rules (which are redefined
locally)
Sep 24 '96 TW
- completion of handling of all cases of Indexing via individual logical
volume objects created for each instantiation, with physical volume list
of the instantiations kept in the G3Vol data structure and used to
place daughters in the logical volume of each instantiation.
(Temporary, pending a proper G4 implementation of Indexed placement.)
- turn off geometry optimisation (takes forever for big geometries!!)
Sep 15 '96 TW
- G4Cons incorporated
- Indexed GSVOLUs via negative length parameters finished (G3CalcParamsFn
extended)
Sep 10 '96 TW
- implementation of gspos (-ve params), gsposp via G4PVPlacement;
G3Vol structure keeps track of G4LogicalVolumes created and placed
for G3 parametrised volume invocations. (no G4PVIndexed, originally
foreseen)
- G4Trd implemented
- G4PVReplica, G4PVParameterised implemented
- placeholder solid eliminated; NPAR=0 cases handled as described
- cltog4 interface improved
- clparse inactive geometry calls instated; all now active
- GSDV* routines fully implemented
- $$$ pending rot matrix handling question (no access to matrix);
GSROTM otherwise updated
- GNUmakefile fixes & improvements
Sep 3 '96 TW
- GNUmakefile fix for $G4SYSTEM directory creation
Aug 25 '96 T. Wenaus
- begin this mod history
- update G3toG4 code for class structure mods since last update (12/95)
- update the GNUmakefile to properly compile source in src/, example/
and build executables rztocl, cltog4, and (if example code present)
g4geom in $G4SYSTEM)/
- add .d file generation for Fortran code and code in example/
+82
View File
@@ -0,0 +1,82 @@
G3toG4
------
The Geant4 facility to convert Geant3 to GEant4 volumes.
See the documentation section of the repository for more information.
19-Mar-1997:
'gmake' issued from the test/ subdirectory will create an executable
'clGeometry' which reads the call list file generated by rztog4, builds a
geometry and calls the visualization package. This has been tested with the
visualization based on OpenGL and Mesa (freeware OpenGL).
To use the visualization, you need to set one or more of the following
environment variables:
setenv G4VIS_USE_DAWN
setenv G4VIS_USE_OPACS
setenv G4VIS_USE_OPENGL
setenv G4VIS_USE_OPENGLX
setenv G4VIS_USE_OPENGLXM
setenv G4VIS_USE_OPENINVENTOR
setenv G4VIS_USE_RAYX
setenv G4VIS_USE_VRML1
The following gmake invocations do the following
gmake libF : build libG3toG4F.a (rztog4 object archive)
gmake libC : build libG3toG4.a (code to parse call list file and call G4
routines)
gmake lib : libC and libF targets
gmake bin : build rztog4 executable
gmake : build lib targets
gmake ext : build external packages, including BREPS and STEP
gmake examples: build cltog4 and clGeometry executables
gmake cltog4: build cltog4 executable
gmake clGeometry: build clGeometry executable
gmake all : ext lib bin examples
The code in the visualization subdirectory OpenGL/ must be compiled on a
machine on which the OpenGL header files have been installed. The compilation
of G3toG4 and external packages is done as follows:
gmake all
In the global/GNUmakefile.architecture file, you need to specify where to
find the OpenGL libraries. I currently use the freeware version of OpenGL
called 'Mesa'. I specify
OGLLIBS := -L$(OGLHOME)/lib -lMesaGL -lMesaGLU -lMesaaux -lMesatk
The AIX version is
OGLLIBS := -L$(OGLHOME)/lib -lGLX -lGLU -lGL -lXGLW -lglobalm5
Notes on the implementation (Sep 24 '96)
----------------------------------------
- PGON, PCON still not in; awaiting Geant4 constructors. 100m^3
boxes are generated for PGON, PCON at present.
- MANY not available in Geant4 yet.
- GSPOSP implemented via individual logical volumes for each instantiation
(G4PVIndexed doesn't exist yet)
- GSDV* routines for dividing volumes implemented, using
G4PVReplicas, G4PVParametrised
- GSROTM is implemented
- hits are not implemented. Hit code is do-nothing. (It is
coded up, but hit class references are commented out.)
The digits+hits code has to be updated before G3toG4's
hit code can be activated.
- GSPART has to be updated.
- Usage of magnetic field class has to be turned on.
- Use of G4UserLimits has to be reviewed and turned on.
- GNUmakefile is tested only on HP
See History file for modificartion history.
+3
View File
@@ -0,0 +1,3 @@
*.out
*.dat
g3tog4code*.cc
+1
View File
@@ -0,0 +1 @@
*.rz
+77
View File
@@ -0,0 +1,77 @@
// 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: G3CalcParams.hh,v 2.3 1998/10/05 15:26:05 lockman Exp $
// GEANT4 tag $Name: geant4-00 $
//
// class G3CalcParams
//
// Class inheriting from G4VPVParameterisation to provide GSDVN
// functionality
//
// History:
// 03.09.96 T. Wenaus Initial version
#ifndef G3CALCPARAMS_HH
#define G3CALCPARAMS_HH
#include <math.h>
#include "globals.hh"
#include "G4VPVParameterisation.hh"
class G3CalcParams: public G4VPVParameterisation
{
public:
G3CalcParams(G4int ndiv, G4double width, G4double offset)
{ fNdiv = ndiv; fWidth = width; fOffset = offset;}
void ComputeTransformation(const G4int n,
G4VPhysicalVolume *pRep) const;
void ComputeDimensions(G4Box &pBox,
const G4int,
const G4VPhysicalVolume *pRep) const;
void ComputeDimensions(G4Tubs &,
const G4int,
const G4VPhysicalVolume *) const;
void ComputeDimensions(G4Trd &,
const G4int,
const G4VPhysicalVolume *) const;
void ComputeDimensions(G4Trap &,
const G4int,
const G4VPhysicalVolume *) const;
void ComputeDimensions(G4Cons &,
const G4int,
const G4VPhysicalVolume *) const;
void ComputeDimensions(G4Sphere &,
const G4int,
const G4VPhysicalVolume *) const;
void ComputeDimensions(G4Torus &,
const G4int,
const G4VPhysicalVolume *) const;
void ComputeDimensions(G4Para &,
const G4int,
const G4VPhysicalVolume *) const;
void ComputeDimensions(G4Hype &,
const G4int,
const G4VPhysicalVolume *) const;
private:
G4int fNdiv;
G4double fWidth;
G4double fOffset;
};
#endif
+41
View File
@@ -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: G3DetTable.hh,v 2.1 1998/07/12 02:54:11 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// G3 materials table.
// Maps G3 material indices to their G4 material object counterparts.
// Maintains a linked List of G3 material index/G4 material pointer pairs.
#include <rw/gdlist.h>
#include "globals.hh"
class G4VSensitiveDetector;
struct DetTableEntry {
G4String name;
G4int detid;
G4VSensitiveDetector* detpt;
};
declare (RWGDlist, DetTableEntry)
class G3DetTable {
private:
RWGDlist(DetTableEntry) DetT;
RWGDlist(DetTableEntry)* DetTable;
public:
G3DetTable();
~G3DetTable();
G4VSensitiveDetector* get(G4String name);
G4int GetID(G4String name);
void put(G4String name, G4int detid, G4VSensitiveDetector* detpt);
};
extern G3DetTable G3Det;
+88
View File
@@ -0,0 +1,88 @@
// 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: G3G4Interface.hh,v 2.1 1998/07/12 02:54:11 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Interfaces for G3 equivalent routines
//
#include "globals.hh"
class G4LogicalVolume;
void G4gsvolu(G4String name, G4String shape, G4int nmed, G4double* par,
G4int npar);
void G4gspos(G4String name, G4int num, G4String moth, G4double x,
G4double y, G4double z, G4int irot, G4String only);
void G4gsposp(G4String name, G4int num, G4String moth, G4double x,
G4double y, G4double z, G4int irot, G4String only,
G4double* Rpar, G4int npar);
void G4gsrotm(G4int irot, G4double theta1, G4double phi1,
G4double theta2, G4double phi2, G4double theta3, G4double phi3);
void G4gsatt(G4String name, G4String attr, G4int ival);
void G4gsdvn(G4String vname, G4String vmoth, G4int ndiv, G4int iaxis);
void G4gsdvt(G4String name, G4String moth, G4double Step, G4int iaxis,
G4int numed, G4int ndvmx);
void G4gsdvx(G4String name, G4String moth, G4int ndiv, G4int iaxis,
G4double Step, G4double c0, G4int numed, G4int ndvmx);
void G4gsdvn2(G4String name, G4String moth, G4int ndiv, G4int iaxis,
G4double c0, G4int numed);
void G4gsdvt2(G4String name, G4String moth, G4double Step, G4int iaxis,
G4double c0, G4int numed, G4int ndvmx);
void G4gsmate(G4int imate, G4String name, G4double a, G4double z,
G4double dens, G4double radl, G4int nwbf, G4double* ubuf);
void G4gsmixt(G4int imate, G4String name, G4double a[], G4double* z,
G4double dens, G4int nlmat, G4double* wmat);
void G4gstmed(G4int itmed, G4String name, G4int nmat, G4int isvol,
G4int ifield, G4double fieldm, G4double tmaxfd,
G4double stemax, G4double deemax, G4double epsil,
G4double stmin, G4double* par, G4int npar);
void G4gstpar(G4int itmed, G4String chpar, G4double parval);
void G4gspart(G4int ipart, G4String chnpar, G4int itrtyp, G4double amass,
G4double charge, G4double tlife, G4double* ubuf,
G4int nwb);
void G4gsdk(G4int ipart, G4double* bratio, G4int* mode);
void G4gsdet(G4String chset, G4String chdet, G4int nv, G4String* chnmsv,
G4int* nbitsv, G4int idtyp, G4int nwhi, G4int nwdi);
void G4gsdetv(G4String chset, G4String chdet, G4int idtyp, G4int nwhi,
G4int nwdi);
void G4gsdeta(G4String chset, G4String chdet, G4String chali,
G4int nwhi, G4int nwdi);
void G4gsdeth(G4String chset, G4String chdet, G4int nh, G4String* chnamh,
G4int* nbitsh, G4double* orig, G4double* fact);
void G4gsdetd(G4String chset, G4String chdet, G4int nd, G4String* chnmsd,
G4int* nbitsd);
void G4gsdetu(G4String chset, G4String chdet, G4int nupar, G4double* upar);
void G4ggclos();
G4LogicalVolume* G4BuildGeom(G4String& inFile);
+38
View File
@@ -0,0 +1,38 @@
// 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: G3MatTable.hh,v 2.1 1998/07/12 02:54:12 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// G3 materials table.
// Maps G3 material indices to their G4 material object counterparts.
// Maintains a linked List of G3 material index/G4 material pointer pairs.
#include <rw/gdlist.h>
#include "globals.hh"
#include "G4Material.hh"
struct MatTableEntry {
G4int matid;
G4Material* matpt;
};
declare (RWGDlist, MatTableEntry)
class G3MatTable {
private:
RWGDlist(MatTableEntry) MatT;
RWGDlist(MatTableEntry)* MatTable;
public:
G3MatTable();
~G3MatTable();
G4Material* get(G4int matid);
void put(G4int* matid, G4Material* matpt);
};
extern G3MatTable G3Mat;
+50
View File
@@ -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: G3MedTable.hh,v 2.1 1998/07/12 02:54:13 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// G3 materials table.
// Maps G3 material indices to their G4 material object counterparts.
// Maintains a linked List of G3 material index/G4 material pointer pairs.
#include <rw/gdlist.h>
#include "globals.hh"
#include "G4Material.hh"
class G4MagneticField;
class G4UserLimits;
struct MedTableEntry {
G4int medid;
G4Material* matpt;
G4MagneticField* magpt;
G4UserLimits* limpt;
G4int isvol;
G4double deemax;
G4double epsil;
};
declare (RWGDlist, MedTableEntry)
class G3MedTable {
private:
RWGDlist(MedTableEntry) MedT;
RWGDlist(MedTableEntry)* MedTable;
public:
G3MedTable();
~G3MedTable();
G4Material* GetMat(G4int medid); // get associated material
G4MagneticField* GetMag(G4int medid);
G4UserLimits* GetLim(G4int medid);
void put(G4int medid, G4Material* matpt, G4MagneticField* field,
G4UserLimits* limits, G4int isvol,
G4double deemax, G4double epsil);
};
extern G3MedTable G3Med;
+38
View File
@@ -0,0 +1,38 @@
// 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: G3PartTable.hh,v 2.1 1998/07/12 02:54:13 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// G3 materials table.
// Maps G3 material indices to their G4 material object counterparts.
// Maintains a linked List of G3 material index/G4 material pointer pairs.
#include <rw/gdlist.h>
#include "globals.hh"
#include "G4ParticleDefinition.hh"
struct PartTableEntry {
G4int partid;
G4ParticleDefinition* partpt;
};
declare (RWGDlist, PartTableEntry)
class G3PartTable {
private:
RWGDlist(PartTableEntry) PartT;
RWGDlist(PartTableEntry)* PartTable;
public:
G3PartTable();
~G3PartTable();
G4ParticleDefinition* get(G4int partid);
void put(G4int* partid, G4ParticleDefinition* partpt);
};
extern G3PartTable G3Part;
+38
View File
@@ -0,0 +1,38 @@
// 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: G3RotTable.hh,v 2.1 1998/07/12 02:54:14 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// G3 materials table.
// Maps G3 material indices to their G4 material object counterparts.
// Maintains a linked List of G3 material index/G4 material pointer pairs.
#include <rw/gdlist.h>
#include "globals.hh"
#include "G4RotationMatrix.hh"
struct RotTableEntry {
G4int rotid;
G4RotationMatrix* rotpt;
};
declare (RWGDlist, RotTableEntry)
class G3RotTable {
private:
RWGDlist(RotTableEntry) RotT;
RWGDlist(RotTableEntry)* RotTable;
public:
G3RotTable();
~G3RotTable();
G4RotationMatrix* get(G4int rotid);
void put(G4int* rotid, G4RotationMatrix* rotpt);
};
extern G3RotTable G3Rot;
+100
View File
@@ -0,0 +1,100 @@
// 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: G3VolTable.hh,v 2.1 1998/07/12 02:54:15 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// G3 logical volume table.
// Maps G3 logical volume names to their G4 logical volume object
// counterparts.
// Maintains a linked List of G3 volume names//G4 logical volume pointer
// pairs.
#include <rw/gdlist.h>
#include <rw/tpordvec.h>
#include "globals.hh"
#include "geomdefs.hh"
#include "G4VSolid.hh"
#include "G4LogicalVolume.hh"
struct VolTableEntry {
G4String vname;
G4VSolid* solid;
G4LogicalVolume* lvpt;
G4VPhysicalVolume* pvpt;
G4double rangehi[3]; // ranges
G4double rangelo[3]; // ranges
EAxis *axiscode; // axis codes
G4int tmed;
G4String shape;
G4double* par;
G4int npar;
G4int count; // number of instantiations for vols indexed due to -ve pars
RWTPtrOrderedVector<G4LogicalVolume> lVols; // vector of instantiated volumes
RWTPtrOrderedVector<G4VPhysicalVolume> pVols; // vector of instantiated phys volumes
};
declare (RWGDlist, VolTableEntry)
class G3VolTable {
private:
RWGDlist(VolTableEntry) VolT;
RWGDlist(VolTableEntry)* VolTable;
VolTableEntry* curEntry;
G4int ScanTmed;
G4int nEntry;
EAxis Rect[3];
EAxis Polar[3];
static G4VPhysicalVolume* mothPV; // mother of all mothers
static G4LogicalVolume* mothLV; // mother of all mothers logical volume
RWTPtrOrderedVector<G4VPhysicalVolume>* pVolsPtr;
public:
G3VolTable();
~G3VolTable();
G4LogicalVolume* GetLV();
G4LogicalVolume* GetLVx(G4String &);
G4LogicalVolume* GetLV(G4String* vname);
G4VPhysicalVolume* GetPV(); // simply return the mother of all volumes
G4VPhysicalVolume* GetPV(G4int npv); // Use pVols table of last retrieved phys vol
// FindPV : look up PV in table to use in placement; if no associated PV, use
// global mother
void FindPV(G4int* npv, G4String* vname);
// MatchPV: look up PV only
void MatchPV(G4int* npv, G4String* vname);
void GetLVPars(G4String* vname, G4int iaxis, G4double* rangehi,
G4double* rangelo, EAxis*,
G4String* shape, G4int* nmed, G4double* par[],
G4int* npar, G4VSolid* solid);
void GetLVInfo(G4String* vname, G4String* shape, G4int* nmed);
void AddConstituentLVol(G4String* vname, G4LogicalVolume* lvol);
void PutLV(G4String* vname, G4LogicalVolume* lvpt, G4int tmed,
G4double rnghi[], G4double rnglo[],
EAxis axis, G4String shape,
G4double par[], G4int npar, G4VSolid* solid);
// For case where nothing is known about the volume; it doesn't
// come from g3tog4 (eg. externally specified global mother)
void PutLV(G4String* vname, G4LogicalVolume* lvpt);
// Builds List of all physical volume instantiations of a Indexed volume implemented
// as individual logical volumes (so when daughters are added, they must be added
// to the logical volumes of all the physical volumes in this List)
void PutPV(G4String* vname, G4VPhysicalVolume* lvpt);
// For non-Indexed volumes, builds a List of one element only
void PutPV1(G4String* vname, G4VPhysicalVolume* lvpt);
void MatchTmed(G4int tmed);
G4LogicalVolume* NextTmed();
G4int GetEntryCount() { return VolTable->entries();};
void SetMother(G4VPhysicalVolume* mpv); // set mother-of-all
void SetMother(G4LogicalVolume* mlv); // set mother-of-all
void SetMother(); // set mother of all pointers to null
VolTableEntry* find(G4String* vname); // find entry from vol name
G4int Increment(G4String* vname); // Increment instantiation counter
};
extern G3VolTable G3Vol; // logical volumes
+55
View File
@@ -0,0 +1,55 @@
// 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: G3toG4.hh,v 2.0 1998/07/02 16:15:57 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef _G3TOG4_
#define _G3TOG4_
#include "globals.hh"
extern G4int Ipar[1000];
extern G4double Rpar[1000];
extern RWCString Spar[1000];
//extern G4double min(G4double, G4double);
void G3fillParams(RWCString *tokens, char *ptypes);
G4bool G3NegVolPars(G4double pars[], G4int* np, G4String vol, G4String moth,
char* routine);
#include "G3G4Interface.hh"
// Parameter types for Geant routines
// s=string i=integer r=real capitalized=array
// In case of arrays, the last integer before the array is the
// number of elements.
#define PTgsvolu "ssiiR"
#define PTgspos "sisrrris"
#define PTgsposp "sisrrrisiR"
#define PTgsatt "ssi"
#define PTgsrotm "irrrrrr"
#define PTgsdvn "ssii"
#define PTgsdvt "ssriii"
#define PTgsdvx "ssiirrii"
#define PTgsdvn2 "ssiiri"
#define PTgsdvt2 "ssririi"
#define PTgsmate "isrrrriR"
#define PTgsmixt "isriRRR"
#define PTgstmed "isiiirrrrrriR"
#define PTgstpar "isr"
#define PTgspart "isirrriR"
#define PTgsdk "iiRI"
#define PTgsdet "ssiSIiii"
#define PTgsdetv "ssiii"
#define PTgsdeta "sssii"
#define PTgsdeth "ssiSIRR"
#define PTgsdetd "ssiSI"
#define PTgsdetu "ssiR"
#endif
+26
View File
@@ -0,0 +1,26 @@
* 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: G3toG4.inc,v 2.1 1998/09/18 08:54:55 lockman Exp $
* GEANT4 tag $Name: geant4-00 $
*
integer maxlines
parameter (maxlines = 750) ! max no. of cmd lines per C++ source file
integer irot_index
integer imat_index
character context*4
logical doclist ! Build call list
logical docode ! Build C++ code
logical dogeom ! Build the Geant geometry as well
integer lunlist ! Output logical unit for call list
integer luncode ! Output logical unit for code
integer nfile ! Current source code file number
integer nlines ! Current source code line count
common /g3tog4_c/ irot_index, imat_index,
+ doclist, docode, dogeom, lunlist, luncode, context, nfile,
+ nlines
@@ -0,0 +1,32 @@
// 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: G3toG4RotationMatrix.hh,v 2.1 1998/11/07 04:11:44 lockman Exp $
//
#ifndef _G3toG4ROTATION_
#define _G3toG4ROTATION_
#include "G4RotationMatrix.hh"
#include "globals.hh"
class G3toG4RotationMatrix : public G4RotationMatrix
{
public:
G3toG4RotationMatrix();
void SetRotationMatrixByCol(const G4ThreeVector& Col1,
const G4ThreeVector& Col2,
const G4ThreeVector& Col3);
void SetRotationMatrixByRow(const G4ThreeVector& Row1,
const G4ThreeVector& Row2,
const G4ThreeVector& Row3);
~G3toG4RotationMatrix();
};
#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: G3toG4SetRotation.hh,v 2.1 1998/09/18 08:55:18 lockman Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef _G3TOG4ROTATION_
#define _G3TOG4ROTATION_
#include "G4RotationMatrix.hh"
#include "globals.hh"
class G3toG4SetRotation : public G4RotationMatrix
{
public:
G3toG4SetRotation();
G3toG4SetRotation(const G4ThreeVector& col1,
const G4ThreeVector& col2,
const G4ThreeVector& col3);
~G3toG4SetRotation(){;}
inline void Setxx(const G4double axx) {rxx = axx;
}
inline void Setxy(const G4double axy) {rxy = axy;
}
inline void Setxz(const G4double axz) {rxz = axz;
}
inline void Setyx(const G4double ayx) {ryx = ayx;
}
inline void Setyy(const G4double ayy) {ryy = ayy;
}
inline void Setyz(const G4double ayz) {ryz = ayz;
}
inline void Setzx(const G4double azx) {rzx = azx;
}
inline void Setzy(const G4double azy) {rzy = azy;
}
inline void Setzz(const G4double azz) {rzz = azz;
}
};
#endif

Some files were not shown because too many files have changed in this diff Show More