Import Geant4 6.0.0 source tree
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * 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: G4DCofThisEvent.hh,v 1.1 2003/10/03 10:14:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#ifndef G4DCofThisEvent_h
|
||||
#define G4DCofThisEvent_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4VDigiCollection.hh"
|
||||
//#include "g4rw/tpordvec.h"
|
||||
#include <vector>
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a class which stores digi collections generated at one event.
|
||||
// This class is exclusively constructed by G4DigiManager when the first
|
||||
// digi collection of an event is passed to the manager, and this class
|
||||
// object is deleted by G4RunManager when a G4Event class object is deleted.
|
||||
// Almost all public methods must be used by Geant4 kernel classes and
|
||||
// the user should not invoke them. The user can use two const methods,
|
||||
// GetDC() and GetNumberOfCollections() for accessing to the stored digi
|
||||
// collection(s).
|
||||
|
||||
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:
|
||||
std::vector<G4VDigiCollection*> * DC;
|
||||
|
||||
public: // with description
|
||||
inline G4VDigiCollection* GetDC(G4int i) const
|
||||
{ return (*DC)[i]; }
|
||||
// Returns a pointer to a digi collection. Null will be returned
|
||||
// if the particular collection is not stored at the current event.
|
||||
// The integer argument is ID number which is assigned by G4DigiManager
|
||||
// and the number can be obtained by G4DigiManager::GetDigiCollectionID()
|
||||
// method.
|
||||
inline G4int GetNumberOfCollections() const
|
||||
{
|
||||
G4int n = 0;
|
||||
for(size_t i=0;i<DC->size();i++)
|
||||
{
|
||||
if((*DC)[i]) n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
// Returns the number of digi collections which are stored in this class
|
||||
// object.
|
||||
public:
|
||||
inline G4int GetCapacity() const
|
||||
{
|
||||
return DC->size();
|
||||
}
|
||||
};
|
||||
|
||||
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,164 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * 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: G4TDigiCollection.hh,v 1.1 2003/10/03 10:14:17 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#ifndef G4TDigiCollection_h
|
||||
#define G4TDigiCollection_h 1
|
||||
|
||||
#include "G4VDigiCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "globals.hh"
|
||||
#include <vector>
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a template class of digi collection and parametrized by
|
||||
// The concrete class of G4VDigi. This is a uniform collection for
|
||||
// a particular concrete digi class objects.
|
||||
// An intermediate layer class G4DigiCollection appeared in this
|
||||
// header file is used just for G4Allocator, because G4Allocator
|
||||
// cannot be instansiated with a template class. Thus G4DigiCollection
|
||||
// class MUST NOT be directly used by the user.
|
||||
|
||||
class G4DigiCollection : public G4VDigiCollection
|
||||
{
|
||||
public:
|
||||
G4DigiCollection();
|
||||
G4DigiCollection(G4String detName,G4String colNam);
|
||||
virtual ~G4DigiCollection();
|
||||
G4int operator==(const G4DigiCollection &right) const;
|
||||
|
||||
protected:
|
||||
void* theCollection;
|
||||
};
|
||||
|
||||
extern G4Allocator<G4DigiCollection> aDCAllocator;
|
||||
|
||||
template <class T> class G4TDigiCollection : public G4DigiCollection
|
||||
{
|
||||
public:
|
||||
G4TDigiCollection();
|
||||
public: // with description
|
||||
G4TDigiCollection(G4String detName,G4String colNam);
|
||||
// Constructor.
|
||||
public:
|
||||
virtual ~G4TDigiCollection();
|
||||
G4int operator==(const G4TDigiCollection &right) const;
|
||||
|
||||
inline void *operator new(size_t);
|
||||
inline void operator delete(void* aDC);
|
||||
public: // with description
|
||||
virtual void DrawAllDigi();
|
||||
virtual void PrintAllDigi();
|
||||
// These two methods invokes Draw() and Print() methods of all of
|
||||
// digit objects stored in this collection, respectively.
|
||||
|
||||
public: // with description
|
||||
inline T* operator[](size_t i) const
|
||||
{ return (*((std::vector<T*>*)theCollection))[i]; }
|
||||
// Returns a pointer to a concrete digi object.
|
||||
inline std::vector<T*>* GetVector() const
|
||||
{ return (std::vector<T*>*)theCollection; }
|
||||
// Returns a collection vector.
|
||||
inline G4int insert(T* aHit)
|
||||
{
|
||||
std::vector<T*>*theDigiCollection
|
||||
= (std::vector<T*>*)theCollection;
|
||||
theDigiCollection->push_back(aHit);
|
||||
return theDigiCollection->size();
|
||||
}
|
||||
// Insert a digi object. Total number of digi objects stored in this
|
||||
// collection is returned.
|
||||
inline G4int entries() const
|
||||
{
|
||||
std::vector<T*>*theDigiCollection
|
||||
= (std::vector<T*>*)theCollection;
|
||||
return theDigiCollection->size();
|
||||
}
|
||||
// Returns the number of digi objcets stored in this collection.
|
||||
};
|
||||
|
||||
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()
|
||||
{
|
||||
std::vector<T*> * theDigiCollection
|
||||
= new std::vector<T*>;
|
||||
theCollection = (void*)theDigiCollection;
|
||||
}
|
||||
|
||||
template <class T> G4TDigiCollection<T>::G4TDigiCollection(G4String detName,G4String colNam)
|
||||
: G4DigiCollection(detName,colNam)
|
||||
{
|
||||
std::vector<T*> * theDigiCollection
|
||||
= new std::vector<T*>;
|
||||
theCollection = (void*)theDigiCollection;
|
||||
}
|
||||
|
||||
template <class T> G4TDigiCollection<T>::~G4TDigiCollection()
|
||||
{
|
||||
std::vector<T*> * theDigiCollection
|
||||
= (std::vector<T*>*)theCollection;
|
||||
//theDigiCollection->clearAndDestroy();
|
||||
for(size_t i=0;i<theDigiCollection->size();i++)
|
||||
{ delete (*theDigiCollection)[i]; }
|
||||
theDigiCollection->clear();
|
||||
delete theDigiCollection;
|
||||
}
|
||||
|
||||
template <class T> G4int G4TDigiCollection<T>::operator==(const G4TDigiCollection<T> &right) const
|
||||
{ return (collectionName==right.collectionName); }
|
||||
|
||||
template <class T> void G4TDigiCollection<T>::DrawAllDigi()
|
||||
{
|
||||
std::vector<T*> * theDigiCollection
|
||||
= (std::vector<T*>*)theCollection;
|
||||
size_t n = theDigiCollection->size();
|
||||
for(size_t i=0;i<n;i++)
|
||||
{ (*theDigiCollection)[i]->Draw(); }
|
||||
}
|
||||
|
||||
template <class T> void G4TDigiCollection<T>::PrintAllDigi()
|
||||
{
|
||||
std::vector<T*> * theDigiCollection
|
||||
= (std::vector<T*>*)theCollection;
|
||||
size_t n = theDigiCollection->size();
|
||||
for(size_t i=0;i<n;i++)
|
||||
{ (*theDigiCollection)[i]->Print(); }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * 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: G4VDigi.hh,v 1.1 2003/10/03 10:14:32 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#ifndef G4VDigi_h
|
||||
#define G4VDigi_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is the base class of digi object. The user should derive this
|
||||
// base class to make his/her own digi class. Two virtual method Draw()
|
||||
// and Print() can be implemented if the user wants these functionarities.
|
||||
// If a concrete digi class is used as a transient class, G4Allocator
|
||||
// must be used.
|
||||
|
||||
class G4VDigi
|
||||
{
|
||||
|
||||
public:
|
||||
G4VDigi();
|
||||
virtual ~G4VDigi();
|
||||
|
||||
G4int operator==(const G4VDigi &right) const;
|
||||
|
||||
virtual void Draw();
|
||||
virtual void Print();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * 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: G4VDigiCollection.hh,v 1.1 2003/10/03 10:14:48 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#ifndef G4VDigiCollection_h
|
||||
#define G4VDigiCollection_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is the base class of digi collection. The user is advised to
|
||||
// use G4TDigiCollection template class in case his/her collection is
|
||||
// transient. While, in case the collection is persistent with ODBMS,
|
||||
// the concrete collection class can be directly derived from this
|
||||
// class.
|
||||
// Geant4 kernel will use this class methods.
|
||||
|
||||
class G4VDigiCollection
|
||||
{
|
||||
public:
|
||||
G4VDigiCollection();
|
||||
G4VDigiCollection(G4String DMnam,G4String colNam);
|
||||
virtual ~G4VDigiCollection();
|
||||
G4int 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
|
||||
|
||||
Reference in New Issue
Block a user