Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user