Import Geant4 1.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:28:20 +02:00
parent aaa409b6ee
commit ca1c8cb059
2995 changed files with 106830 additions and 299600 deletions
+16 -20
View File
@@ -1,35 +1,31 @@
# $Id: GNUmakefile,v 1.1 1999/01/07 16:10:45 gunter Exp $
# $Id: GNUmakefile,v 1.9 1999/12/01 15:21:05 morita Exp $
name := G4pevents
G4ODBMS := true
G4ODBMS_INSTALLATION := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
# $(G4TMPDIR) will be overrided in common.gmk later.
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
G4OODDLX_BOOT := $(G4TMPSCHEMA_BOOT)
CPPFLAGS += \
-Iinclude \
-I$(G4TMPDIR) \
-I$(G4INSTALL)/source/run/include \
-I$(G4INSTALL)/source/event/include \
-I$(G4INSTALL)/source/global/management/include \
-I$(G4INSTALL)/source/global/HEPRandom/include \
-I$(G4INSTALL)/source/global/HEPGeometry/include \
-I$(G4INSTALL)/source/geometry/management/include \
-I$(G4INSTALL)/source/geometry/volumes/include \
-I$(G4INSTALL)/source/geometry/solids/CSG/include \
-I$(G4INSTALL)/source/events+tracks/include \
-I$(G4INSTALL)/source/processes/management/include \
-I$(G4INSTALL)/source/materials/include \
-I$(G4INSTALL)/source/particles/management/include \
-I$(G4INSTALL)/source/graphics_reps/include \
-I$(G4INSTALL)/source/tracking/include \
-I$(G4INSTALL)/source/track/include \
-I$(G4SCHEMA_HEADER_DIR) \
-I$(G4TMP)/$(G4SYSTEM)/G4phits \
-I$(G4TMP)/$(G4SYSTEM)/G4pdigits \
-I$(G4INSTALL)/source/persistency/global/include \
-I$(G4INSTALL)/source/persistency/digits+hits/digits/include \
-I$(G4INSTALL)/source/persistency/digits+hits/hits/include \
-I$(G4INSTALL)/source/persistency/management/include \
-I$(G4INSTALL)/source/event/include \
-I$(G4INSTALL)/source/tracking/include \
-I$(G4INSTALL)/source/global/management/include \
-I$(G4INSTALL)/source/graphics_reps/include \
-I$(G4INSTALL)/source/digits+hits/detector/include \
-I$(G4INSTALL)/source/digits+hits/hits/include \
-I$(G4INSTALL)/source/digits+hits/digits/include
@@ -45,6 +41,6 @@ include $(G4INSTALL)/config/common.gmk
# G4PEvent.ddl includes G4PPrimaryVertex.hh, so G4PPrimaryVertex.hh
# should be created before G4PEvent.hh.
$(G4TMPDIR)/G4PEvent.hh: $(G4TMPDIR)/G4PPrimaryVertex.hh
$(G4SCHEMA_HEADER_DIR)/G4PEvent.hh: $(G4SCHEMA_HEADER_DIR)/G4PPrimaryVertex.hh
#--------------------------------------------------------------------
+69 -29
View File
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PEvent.ddl,v 1.1 1999/01/07 16:10:46 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4PEvent.ddl,v 1.8 1999/11/28 21:54:17 morita Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4PEvent_h
@@ -14,8 +14,13 @@
#include "globals.hh"
#include "G4PersistentTypes.hh"
#include "G4Event.hh"
#include "G4PersistentSchema.hh"
#include "G4PPrimaryVertex.hh"
#include "G4PHCofThisEvent.hh"
#include "G4PDCofThisEvent.hh"
class G4Event;
#include "HepODBMS/odbms/HepODBMS.h"
@@ -27,6 +32,12 @@ class G4PEvent
public:
G4PEvent();
G4PEvent(const G4Event *evt);
G4PEvent(const G4Event *evt,
HepRef(G4PHCofThisEvent) pHC,
HepRef(G4PDCofThisEvent) pDC);
void InitPEvent(const G4Event *evt,
HepRef(G4PHCofThisEvent) pHC,
HepRef(G4PDCofThisEvent) pDC);
~G4PEvent();
private:
@@ -34,41 +45,70 @@ class G4PEvent
G4Pint eventID;
// PrimaryVertex
ooRef(G4PPrimaryVertex) thePrimaryVertex;
d_Ref<G4PPrimaryVertex> thePrimaryVertex;
G4Pint numberOfPrimaryVertex;
// HitsCollection
// G4HCofThisEvent* HC;
d_Ref<G4PHCofThisEvent> HC;
// TrajectoryContainer
// G4TrajectoryContainer * trajectoryContainer;
// DigiCollection
d_Ref<G4PDCofThisEvent> DC;
// TrajectoryContainer (not supported yet)
// d_Ref<G4PTrajectoryContainer> trajectoryContainer;
public:
inline void SetEventID(const G4Event *evt)
{ eventID = evt->GetEventID(); };
void SetEventID(const G4Event *evt);
inline G4int GetEventID() const
{ return eventID; };
{ return eventID; }
inline void AddPrimaryVertex( HepRef(G4PPrimaryVertex) aPrimaryVertex)
{
if( thePrimaryVertex == NULL )
{ thePrimaryVertex = aPrimaryVertex; }
else
{ thePrimaryVertex->SetNext( aPrimaryVertex ); }
numberOfPrimaryVertex++;
}
inline G4int GetNumberOfPrimaryVertex() const
{ return numberOfPrimaryVertex; }
inline HepRef(G4PPrimaryVertex) GetPrimaryVertex(G4int i=0) const
{
if( i == 0 )
{ return thePrimaryVertex; }
else if( i > 0 && i < numberOfPrimaryVertex )
{
HepRef(G4PPrimaryVertex) 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( HepRef(G4PHCofThisEvent) value)
{ HC = value; }
inline HepRef(G4PHCofThisEvent) GetHCofThisEvent() const
{ return HC; }
inline void SetDCofThisEvent( HepRef(G4PDCofThisEvent) value)
{ DC = value; }
inline HepRef(G4PDCofThisEvent) GetDCofThisEvent() const
{ return DC; }
// inline void AddPrimaryVertex()
// {
// primaryVertex should be added here
// ;
// };
// inline G4int GetNumberOfPrimaryVertex() const
// { return numberOfPrimaryVertex; };
// inline G4PrimaryVertex* GetPrimaryVertex(G4int i=0) const
// {
// primaryVertex should be added here
// ;
// };
// inline void SetHCofThisEvent()
// { HC = value; };
// inline G4HCofThisEvent* GetHCofThisEvent() const
// { return HC; };
// inline void SetTrajectoryContainer(G4TrajectoryContainer*value)
// { trajectoryContainer = value; };
// { trajectoryContainer = value; }
// inline G4TrajectoryContainer* GetTrajectoryContainer() const
// { return trajectoryContainer; };
// { return trajectoryContainer; }
G4Event* MakeTransientObject();
};
#endif
@@ -0,0 +1,94 @@
// This code implementation is the intellectual property of
// the 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: G4PPrimaryParticle.ddl,v 1.1 1999/12/05 22:32:25 morita Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4PPrimaryParticle_h
#define G4PPrimaryParticle_h 1
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4PersistentTypes.hh"
#include "G4PersistentSchema.hh"
#include "HepODBMS/odbms/HepODBMS.h"
class G4PrimaryParticle;
// class description:
//
// This is the persistent version of a class G4PrimaryParticle.
//
class G4PPrimaryParticle
: public HepPersObj
{
public:
G4PPrimaryParticle( G4PrimaryParticle* particle );
~G4PPrimaryParticle();
G4PrimaryParticle* MakeTransientObject();
private:
G4Pint PDGcode;
// G4ParticleDefinition * G4code;
G4Pdouble Px;
G4Pdouble Py;
G4Pdouble Pz;
d_Ref<G4PPrimaryParticle> nextParticle;
d_Ref<G4PPrimaryParticle> daughterParticle;
G4Pint trackID; // This will be set if this particle is
// sent to G4EventManager and converted to
// G4Track. Otherwise = -1.
G4Pdouble mass; // This is just for book keeping.
// This will not be used but the mass in
// G4ParticleDefinition will be used.
G4Pdouble polX;
G4Pdouble polY;
G4Pdouble polZ;
public: // with description
// followings are get methods available.
// "trackID" will be set if this particle is sent to G4EventManager and converted to
// G4Track. Otherwise = -1.
// "mass" is just for book keeping. This will not be used but the mass in
// G4ParticleDefinition will be used.
inline G4int GetPDGcode() const
{ return PDGcode; }
// inline G4ParticleDefinition * GetG4code() const
// { return G4code; }
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 HepRef(G4PPrimaryParticle) GetNext() const
{ return nextParticle; }
inline HepRef(G4PPrimaryParticle) GetDaughter() const
{ return daughterParticle; }
inline G4int GetTrackID() const
{ return trackID; }
inline G4double GetMass() const
{ return mass; }
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; }
};
#endif
@@ -1,12 +1,12 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PPrimaryVertex.ddl,v 1.1 1999/01/07 16:10:46 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4PPrimaryVertex.ddl,v 1.7 1999/12/05 22:32:26 morita Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
@@ -15,8 +15,13 @@
#define G4PPrimaryVertex_h 1
#include "globals.hh"
#include "G4PrimaryVertex.hh"
#include "G4PrimaryParticle.hh"
#include "G4ThreeVector.hh"
#include "G4PersistentTypes.hh"
#include "G4PersistentSchema.hh"
class G4PrimaryVertex;
class G4PPrimaryParticle;
#pragma ooclassref G4PPrimaryParticle "G4PPrimaryParticle_ref.hh"
#include "HepODBMS/odbms/HepODBMS.h"
@@ -28,15 +33,45 @@ class G4PPrimaryVertex
G4PPrimaryVertex(const G4PrimaryVertex* vertex);
~G4PPrimaryVertex();
private:
G4double X0;
G4double Y0;
G4double Z0;
G4double T0;
G4PrimaryParticle * theParticle;
G4PrimaryVertex* MakeTransientObject();
private:
G4Pdouble X0;
G4Pdouble Y0;
G4Pdouble Z0;
G4Pdouble T0;
d_Ref<G4PPrimaryParticle> theParticle;
d_Ref<G4PPrimaryParticle> theTail;
d_Ref<G4PPrimaryVertex> nextVertex;
G4Pint 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; }
HepRef(G4PPrimaryParticle) GetPrimary(G4int i) const;
inline void SetNext(HepRef(G4PPrimaryVertex) nv)
{
if(nextVertex == NULL)
{ nextVertex = nv; }
else
{ nextVertex->SetNext(nv); }
}
inline HepRef(G4PPrimaryVertex) GetNext() const
{ return nextVertex; }
G4PPrimaryVertex* nextVertex;
G4int numberOfParticle;
};
#endif
@@ -0,0 +1,76 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PersistentEventMan.hh,v 1.9 1999/11/28 21:54:17 morita Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// class G4PersistentEventMan
//
// A Utility class for storing and retrieving the event objects.
//
// This class is not persistent-capable.
//
// Member functions:
// =================
// G4bool Store(HepDbApplication* dbApp,
// const G4Event* anEvent);
// Store anEvent and associated objects into database.
// G4bool Retrieve(HepDbApplication* dbApp,
// G4Event*& anEvent);
// Retrieve anEvent and associated objects from database.
//
// History:
// 98.10.30 Y.Morita Splited from G4PersistencyManager
#ifndef G4PERSISTENTEVENTMAN_HH
#define G4PERSISTENTEVENTMAN_HH 1
#include "globals.hh"
#include "HepODBMS/odbms/HepODBMS.h"
#include "G4VPersistentSubMan.hh"
#include "G4VPersistentSubDbMan.hh"
#include "G4PEvent.hh"
class HepDbApplication;
class G4Event;
class G4PersistentHitMan;
class G4PersistentDigitMan;
class G4PersistentEventMan
: public G4VPersistentSubMan, public G4VPersistentSubDbMan
{
friend class G4PersistencyManager;
private:
// to be used by G4PersistencyManager only
G4PersistentEventMan();
G4PersistentEventMan( G4PersistentHitMan* aPHCMan,
G4PersistentDigitMan* aPDCMan );
~G4PersistentEventMan();
private:
G4PersistentHitMan* f_PHCMan;
G4PersistentDigitMan* f_PDCMan;
G4int f_currentEventID;
HepRef(G4PEvent) f_currentPEvent;
public:
inline G4int CurrentEventID()
{ return f_currentEventID; }
private:
G4bool Store( HepDbApplication* dbApp,
const G4Event* anEvent );
G4bool Retrieve( HepDbApplication* dbApp,
G4Event*& anEvent );
};
#endif
+88 -23
View File
@@ -1,50 +1,115 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PEvent.cc,v 1.1 1999/01/07 16:10:47 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4PEvent.cc,v 1.10.2.1 1999/12/07 20:50:05 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// G4PEvent
#include "G4PEvent.hh"
#include "G4PPrimaryVertex.hh"
#include "G4Event.hh"
G4PEvent::G4PEvent()
{
eventID =0;
// initialization of thePrimaryVertex is not necessary
// since Objectivity/DB will do it for you...
HepRef(G4PPrimaryVertex) thePrimaryVertex = NULL;
numberOfPrimaryVertex = 0;
// HC = NULL;
// trajectoryContainer = NULL;
}
:eventID(0),
thePrimaryVertex(NULL),numberOfPrimaryVertex(0),HC(NULL),DC(NULL)
{;}
G4PEvent::G4PEvent(const G4Event *evt)
:eventID(0),
thePrimaryVertex(NULL),numberOfPrimaryVertex(0),HC(NULL),DC(NULL)
{
InitPEvent(evt, NULL, NULL);
}
G4PEvent::G4PEvent(const G4Event *evt,
HepRef(G4PHCofThisEvent) pHC,
HepRef(G4PDCofThisEvent) pDC)
:eventID(0),
thePrimaryVertex(NULL),numberOfPrimaryVertex(0),HC(NULL),DC(NULL)
{
InitPEvent(evt, pHC, pDC);
}
void G4PEvent::InitPEvent(const G4Event *evt,
HepRef(G4PHCofThisEvent) pHC,
HepRef(G4PDCofThisEvent) pDC)
{
eventID = evt->GetEventID();
const G4PrimaryVertex* PV = evt->GetPrimaryVertex();
if(PV)
{ HepRef(G4PPrimaryVertex) thePrimaryVertex = new G4PPrimaryVertex(PV); }
else
{ HepRef(G4PPrimaryVertex) thePrimaryVertex = NULL; }
if(PV) thePrimaryVertex = new(ooThis()) G4PPrimaryVertex(PV);
numberOfPrimaryVertex = evt->GetNumberOfPrimaryVertex();
if(pHC!=NULL) HC = pHC;
if(pDC!=NULL) DC = pDC;
// const G4TrajectoryContainer* TC = evt->GetTrajectoryContainer();
// if(TC)
// { trajectoryContainer = new G4PTrajectoryContainer(TC); }
// else
// { trajectoryContainer = NULL; }
// if(TC) trajectoryContainer = new G4PTrajectoryContainer(TC);
}
G4PEvent::~G4PEvent()
{
// if(thePrimaryVertex) delete thePrimaryVertex;
// if(trajectoryContainer) delete trajectoryContainer;
if(thePrimaryVertex != NULL)
{
G4PPrimaryVertex* aPPV = (HepRef(G4PPrimaryVertex)) thePrimaryVertex;
HepDelete(aPPV);
}
if(HC != NULL)
{
G4PHCofThisEvent* aHC = (HepRef(G4PHCofThisEvent)) HC;
HepDelete(aHC);
}
if(DC != NULL)
{
G4PDCofThisEvent* aDC = (HepRef(G4PDCofThisEvent)) DC;
HepDelete(aDC);
}
// if(trajectoryContainer)
// HepDelete(trajectoryContainer);
}
G4Event* G4PEvent::MakeTransientObject()
{
G4Event* anEvt = new G4Event(eventID);
if(thePrimaryVertex != NULL)
{
G4PrimaryVertex* aPV = thePrimaryVertex->MakeTransientObject();
for( G4int i = 0; i<numberOfPrimaryVertex; i++ )
{
if( aPV != NULL )
{
anEvt->AddPrimaryVertex(aPV);
aPV = aPV->GetNext();
}
}
}
// Associate persistent Hits Collctions and Digits Collections
// to transient G4Event ... this requires an introduction of
// G4VHCofThisEvent and G4VDCofThisEvent in G4Event
// (will be implemented in next release)
// if(HC != NULL)
// anEvt->SetHCofThisEvent( HC );
// if(DC != NULL)
// anEvt->SetDCofThisEvent( DC );
return anEvt;
}
void G4PEvent::SetEventID(const G4Event *evt)
{
eventID = evt->GetEventID();
}
@@ -0,0 +1,68 @@
// This code implementation is the intellectual property of
// the 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: G4PPrimaryParticle.cc,v 1.1 1999/12/05 22:32:26 morita Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#include "G4PPrimaryParticle.hh"
#include "G4PrimaryParticle.hh"
G4PPrimaryParticle::G4PPrimaryParticle(G4PrimaryParticle* aParticle)
{
PDGcode = aParticle->GetPDGcode();
G4ParticleDefinition* ag4code = aParticle->GetG4code();
// if( ag4code != NULL )
// { ...will look up G4PParticleDefinition and set the G4code...; }
Px = aParticle->GetPx();
Py = aParticle->GetPy();
Pz = aParticle->GetPz();
G4PrimaryParticle* aNext = aParticle->GetNext();
if( aNext != NULL )
{ nextParticle = new(ooThis()) G4PPrimaryParticle( aNext ); }
G4PrimaryParticle* aDaughter = aParticle->GetDaughter();
if( aDaughter != NULL )
{ daughterParticle = new(ooThis()) G4PPrimaryParticle( aDaughter ); }
trackID = aParticle->GetTrackID();
mass = aParticle->GetMass();
polX = aParticle->GetPolX();
polY = aParticle->GetPolY();
polZ = aParticle->GetPolZ();
}
G4PPrimaryParticle::~G4PPrimaryParticle()
{
if(nextParticle != NULL)
{ HepDelete(nextParticle); }
if(daughterParticle != NULL)
{ HepDelete(daughterParticle); }
}
G4PrimaryParticle* G4PPrimaryParticle::MakeTransientObject()
{
G4PrimaryParticle* aParticle = new G4PrimaryParticle(PDGcode, Px, Py, Pz);
// aParticle->SetG4Code(...will lookup G4ParticleDefinition and set it...;)
if(nextParticle != NULL)
{ aParticle->SetNext( nextParticle->MakeTransientObject() ); }
if(daughterParticle != NULL)
{ aParticle->SetDaughter( daughterParticle->MakeTransientObject() ); }
aParticle->SetTrackID( trackID );
aParticle->SetMass( mass );
aParticle->SetPolarization( polX, polY, polZ );
return aParticle;
}
@@ -1,20 +1,24 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PPrimaryVertex.cc,v 1.1 1999/01/07 16:10:47 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4PPrimaryVertex.cc,v 1.6.2.1 1999/12/07 20:50:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#include "G4PPrimaryVertex.hh"
#include <assert.h>
#include "G4ios.hh"
#include "G4PrimaryVertex.hh"
#include "G4PPrimaryParticle.hh"
G4PPrimaryVertex::G4PPrimaryVertex()
:X0(0.),Y0(0.),Z0(0.),T0(0.),numberOfParticle(0),nextVertex(NULL),
theParticle(NULL)
:X0(0.),Y0(0.),Z0(0.),T0(0.),numberOfParticle(0),nextVertex(NULL)
// ,theParticle(NULL)
{;}
G4PPrimaryVertex::G4PPrimaryVertex(const G4PrimaryVertex* vertex)
@@ -25,22 +29,84 @@ G4PPrimaryVertex::G4PPrimaryVertex(const G4PrimaryVertex* vertex)
T0 = vertex->GetT0();
numberOfParticle = vertex->GetNumberOfParticle();
theParticle =
new(ooThis()) G4PPrimaryParticle( vertex->GetPrimary(0) );
HepRef(G4PPrimaryParticle) particle = theParticle;
for (G4int i=0; i<numberOfParticle; i++)
{
assert( particle != NULL );
particle = particle->GetNext();
}
theTail = particle;
const G4PrimaryVertex* nextVX = vertex->GetNext();
if(nextVX)
{ nextVertex = new G4PPrimaryVertex(nextVX); }
{ nextVertex = new(ooThis()) G4PPrimaryVertex(nextVX); }
else
{ nextVertex = NULL; }
theParticle = NULL;
}
G4PPrimaryVertex::~G4PPrimaryVertex()
{
if(theParticle != NULL)
{ delete theParticle; }
{
G4PPrimaryParticle* pp = (HepRef(G4PPrimaryParticle)) theParticle;
HepDelete(pp);
}
{ HepDelete(theParticle); }
if(theTail != NULL)
{
G4PPrimaryParticle* pt = (HepRef(G4PPrimaryParticle)) theTail;
HepDelete(pt);
}
{ HepDelete(theParticle); }
if(nextVertex != NULL)
{ delete nextVertex; }
{
G4PPrimaryVertex* nv = (HepRef(G4PPrimaryVertex)) nextVertex;
HepDelete(nv);
}
}
G4PrimaryVertex* G4PPrimaryVertex::MakeTransientObject()
{
G4PrimaryVertex* aPV = new G4PrimaryVertex(X0,Y0,Z0,T0);
if(theParticle != NULL)
{
G4PrimaryParticle* particle = theParticle->MakeTransientObject();
for( G4int i = 0; i<numberOfParticle; i++ )
{
assert( particle );
aPV->SetPrimary( particle );
particle = particle->GetNext();
}
}
if( nextVertex != NULL )
aPV->SetNext( nextVertex->MakeTransientObject() );
return aPV;
}
HepRef(G4PPrimaryParticle) G4PPrimaryVertex::GetPrimary(G4int i=0) const
{
if( i == 0 )
{ return theParticle; }
else if( i > 0 && i < numberOfParticle )
{
HepRef(G4PPrimaryParticle) particle = theParticle;
for( int j=0; j<i; j++ )
{
if( particle == NULL ) return NULL;
particle = particle->GetNext();
}
return particle;
}
else
{ return NULL; }
}
@@ -0,0 +1,103 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PersistentEventMan.cc,v 1.15 1999/12/02 19:40:51 morita Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// class G4PersistentEventMan
//
// Implementation for concrete G4PersistentEventMan.
//
// History:
// 98.01.08 Y.Morita Initial version
// 98.10.30 Y.Morita Splitted from G4PersistencyManager
#include "G4PersistentEventMan.hh"
#include "G4PersistentHitMan.hh"
#include "G4PersistentDigitMan.hh"
#include "HepODBMS/clustering/HepDbApplication.h"
#include "G4PersistentHitMan.hh"
#include "G4PersistentDigitMan.hh"
#include "G4Event.hh"
#include "G4ios.hh"
G4PersistentEventMan::G4PersistentEventMan()
: f_PHCMan(NULL), f_PDCMan(NULL), f_currentEventID(0)
{;}
G4PersistentEventMan::G4PersistentEventMan(
G4PersistentHitMan* aPHCMan,
G4PersistentDigitMan* aPDCMan )
: f_PHCMan(aPHCMan), f_PDCMan(aPDCMan)
{;}
G4PersistentEventMan::~G4PersistentEventMan()
{;}
//----------------------------------------------------------------------------
G4bool G4PersistentEventMan::Store( HepDbApplication* dbApp,
const G4Event* anEvent )
{
HepRef(G4PHCofThisEvent) aPHC = f_PHCMan->GetCurrentPHCofThisEvent();
HepRef(G4PDCofThisEvent) aPDC = f_PDCMan->GetCurrentPDCofThisEvent();
// Create persistent event
f_currentPEvent = new(f_container) G4PEvent(anEvent, aPHC, aPDC);
if( aPHC != NULL )
{ f_PHCMan->SetCurrentPHCofThisEvent(NULL); }
if( aPDC != NULL )
{ f_PDCMan->SetCurrentPDCofThisEvent(NULL); }
if( f_currentPEvent != NULL )
{
f_currentEventID = anEvent->GetEventID();
return true;
}
else
{
f_currentEventID = -1;
return false;
}
}
G4bool G4PersistentEventMan::Retrieve( HepDbApplication* dbApp,
G4Event*& anEvent )
{
G4bool theStatus = false;
anEvent = NULL;
ooItr(G4PEvent) pevt_iterator;
// set the new scan scope if the DB/Container has been changed by
// G4PersistencyManager
if( f_container != f_currentContainer )
{
f_currentContainer = f_container;
pevt_iterator.scan(f_currentContainer);
}
// Retrieve "next" G4PEvent in this scope and make a G4Event
if( pevt_iterator.next() )
{
G4Event* anEvt = pevt_iterator->MakeTransientObject();
if( anEvt != NULL )
{
anEvent = anEvt;
theStatus = true;
f_currentEventID = anEvent->GetEventID();
}
}
return theStatus;
}