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
+38
View File
@@ -0,0 +1,38 @@
# $Id: GNUmakefile,v 2.2 1998/11/18 18:35:43 kurasige Exp $
# -----------------------------------------------------------
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
# -----------------------------------------------------------
name := G4readout
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)/processes/management/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/tracking/include \
-I$(G4BASE)/run/include \
-I$(G4BASE)/digits+hits/detector/include \
-I$(G4BASE)/digits+hits/hits/include \
-I$(G4BASE)/digits+hits/digits/include \
-I$(G4BASE)/event/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/intercoms/include
include $(G4INSTALL)/config/common.gmk
.PHONY: global
global: lib
+38
View File
@@ -0,0 +1,38 @@
$Id: History,v 2.2 1998/07/14 19:20:53 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 *
----------------------------------------------------------
July 15, 98 M.Asai (tag readout-00-01-02)
July 4, 98 M.Asai (tag readout-00-01-01)
- Ready for the beta release
June 30, 98 M.Asai (tag readout-00-07-01)
- G4Allocator is introduced to G4DCofThisEvnet and G4DigiCollection.
June 11, 98 G.Cosmo (readout-00-06-02)
- removed CR characters from G4DCtable.hh.cc and
G4VDigitizerModule.hh.cc (P.Urban)
June 8, 98 M.Asai
- tagged as readout-00-06-01
June 6, 98 M.Asai
- Created.
- Introduce first versions of codes
+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: G4DCtable.hh,v 2.1 1998/07/12 03:08:23 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4DCtable_H
#define G4DCtable_H 1
#include "globals.hh"
#include <rw/tvordvec.h>
class G4DCtable
{
public:
G4DCtable();
~G4DCtable();
public:
G4int Registor(G4String SDname,G4String DCname);
G4int GetCollectionID(G4String DCname);
private:
RWTValOrderedVector<G4String> DMlist;
RWTValOrderedVector<G4String> DClist;
public:
inline G4int entries() const
{ return DClist.entries(); }
};
#endif
+42
View File
@@ -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: G4DMmessenger.hh,v 2.1 1998/07/12 03:08:24 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4DMmessenger_h
#define G4DMmessenger_h 1
#include "G4UImessenger.hh"
class G4DigiManager;
class G4UIdirectory;
class G4UIcmdWithAnInteger;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAString;
class G4DMmessenger: public G4UImessenger
{
public:
G4DMmessenger(G4DigiManager * DigiManager);
~G4DMmessenger();
void SetNewValue(G4UIcommand * command,G4String newValues);
private:
G4DigiManager * fDMan;
G4UIdirectory* digiDir;
G4UIcmdWithoutParameter* listCmd;
G4UIcmdWithAString* digiCmd;
G4UIcmdWithAnInteger* verboseCmd;
};
#endif
+78
View File
@@ -0,0 +1,78 @@
// 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: G4DigiManager.hh,v 2.1 1998/07/12 03:08:25 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4DigiManager_h
#define G4DigiManager_h 1
#include "globals.hh"
class G4Event;
#include "G4VDigitizerModule.hh"
class G4VHitsCollection;
class G4VDigiCollection;
class G4DMmessenger;
#include "G4DCtable.hh"
class G4RunManager;
class G4SDManager;
#include <rw/tpordvec.h>
class G4DigiManager
{
public:
static G4DigiManager* GetDMpointer();
static G4DigiManager* GetDMpointerIfExist();
protected:
G4DigiManager();
public:
~G4DigiManager();
void AddNewModule(G4VDigitizerModule* DM);
void Digitize(G4String mName);
G4VDigitizerModule* FindDigitizerModule(G4String mName);
const G4VHitsCollection* GetHitsCollection(G4int HCID, G4int eventID = 0);
const G4VDigiCollection* GetDigiCollection(G4int DCID, G4int eventID = 0);
G4int GetHitsCollectionID(G4String HCname);
G4int GetDigiCollectionID(G4String DCname);
void SetDigiCollection(G4int DCID, G4VDigiCollection* aDC);
void SetVerboseLevel(G4int vl);
void List() const;
private:
static G4DigiManager * fDManager;
G4int verboseLevel;
RWTPtrOrderedVector<G4VDigitizerModule> DMtable;
G4DCtable* DCtable;
G4DMmessenger* theMessenger;
G4RunManager* runManager;
G4SDManager* SDManager;
public:
inline G4int GetVerboseLevel() const
{ return verboseLevel; }
inline G4int GetCollectionCapacity() const
{ return DCtable->entries(); }
inline G4int GetModuleCapacity() const
{ return DMtable.entries(); }
inline G4DCtable* GetDCtable() const
{ return DCtable; }
inline void RestoreDCtable(G4DCtable* dc)
{
if(DCtable) delete DCtable;
DCtable = dc;
}
};
#endif
@@ -0,0 +1,53 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VDigitizerModule.hh,v 2.1 1998/07/12 03:08:26 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4VDigitizerModule_H
#define G4VDigitizerModule_H 1
class G4DigiManager;
class G4VDigiCollection;
#include "globals.hh"
#include <rw/tvordvec.h>
class G4VDigitizerModule
{
public:
G4VDigitizerModule(G4String modName);
virtual ~G4VDigitizerModule();
int operator==(const G4VDigitizerModule &right) const;
int operator!=(const G4VDigitizerModule &right) const;
public:
virtual void Digitize() = 0;
protected:
void StoreDigiCollection(G4VDigiCollection* aDC);
void StoreDigiCollection(G4int DCID,G4VDigiCollection* aDC);
protected:
G4DigiManager* DigiManager;
G4String moduleName;
RWTValOrderedVector<G4String> collectionName;
G4int verboseLevel;
public:
inline G4int GetNumberOfCollections() const
{ return collectionName.entries(); }
inline G4String GetCollectionName(G4int i) const
{ return collectionName[i]; }
inline G4String GetName() const
{ return moduleName; }
inline void SetVerboseLevel(G4int val)
{ verboseLevel = val; }
};
#endif
+58
View File
@@ -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: G4DCtable.cc,v 2.1 1998/07/12 03:08:27 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4DCtable.hh"
G4DCtable::G4DCtable() {;}
G4DCtable::~G4DCtable() {;}
G4int G4DCtable::Registor(G4String DMname,G4String DCname)
{
for(int i=0;i<DClist.entries();i++)
{ if(DClist[i]==DCname && DMlist[i]==DMname) return -1; }
DClist.insert(DCname);
DMlist.insert(DMname);
return DClist.entries();
}
G4int G4DCtable::GetCollectionID(G4String DCname)
{
G4int i = -1;
if(DCname.index("/")==RW_NPOS) // DCname only
{
for(G4int j=0;j<DClist.entries();j++)
{
if(DClist[j]==DCname)
{
if(i>=0) return -2;
i = j;
}
}
}
else
{
for(G4int j=0;j<DClist.entries();j++)
{
G4String tgt = DMlist[j];
tgt += "/";
tgt += DClist[j];
if(tgt==DCname)
{
if(i>=0) return -2;
i = j;
}
}
}
return i;
}
+56
View File
@@ -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: G4DMmessenger.cc,v 2.1 1998/07/12 03:08:27 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// ---------------------------------------------------------------------
#include "G4DMmessenger.hh"
#include "G4DigiManager.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
G4DMmessenger::G4DMmessenger(G4DigiManager* DigiManager):fDMan(DigiManager)
{
digiDir = new G4UIdirectory("/digi/");
digiDir->SetGuidance("DigitizerModule");
listCmd = new G4UIcmdWithoutParameter("/digi/List",this);
listCmd->SetGuidance("List names of digitizer modules.");
digiCmd = new G4UIcmdWithAString("/digi/Digitize",this);
digiCmd->SetGuidance("Invoke Digitize method of a digitizer module");
digiCmd->SetParameterName("moduleName",false);
verboseCmd = new G4UIcmdWithAnInteger("/digi/Verbose",this);
verboseCmd->SetGuidance("Set the Verbose level.");
verboseCmd->SetParameterName("level",false);
}
G4DMmessenger::~G4DMmessenger()
{
delete listCmd;
delete digiCmd;
delete verboseCmd;
delete digiDir;
}
void G4DMmessenger::SetNewValue(G4UIcommand * command,G4String newVal)
{
if( command==listCmd )
{ fDMan->List(); }
if( command==digiCmd )
{ fDMan->Digitize(newVal); }
if( command==verboseCmd )
{ fDMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal)); }
return;
}
+191
View File
@@ -0,0 +1,191 @@
// 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: G4DigiManager.cc,v 2.2 1998/07/13 17:28:17 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4DigiManager.hh"
#include "G4Event.hh"
#include "G4VHitsCollection.hh"
#include "G4VDigiCollection.hh"
#include "G4DMmessenger.hh"
#include "G4DCofThisEvent.hh"
#include "G4RunManager.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
G4DigiManager* G4DigiManager::fDManager = 0;
G4DigiManager* G4DigiManager::GetDMpointer()
{
if(!fDManager)
{
fDManager = new G4DigiManager;
}
return fDManager;
}
G4DigiManager* G4DigiManager::GetDMpointerIfExist()
{ return fDManager; }
G4DigiManager::G4DigiManager():verboseLevel(0)
{
theMessenger = new G4DMmessenger(this);
runManager = G4RunManager::GetRunManager();
SDManager = G4SDManager::GetSDMpointer();
DCtable = new G4DCtable;
}
G4DigiManager::~G4DigiManager()
{
DMtable.clearAndDestroy();
delete DCtable;
delete theMessenger;
}
void G4DigiManager::AddNewModule(G4VDigitizerModule* DM)
{
G4String DMname = DM->GetName();
if(DMtable.index(DM) != RW_NPOS)
{
G4cout << "<" << DMname << "> has already been registored." << endl;
return;
}
else if( verboseLevel > 0 )
{
G4cout << "New DigitizerModule <" << DMname
<< "> is registored." << endl;
}
DMtable.insert(DM);
G4int numberOfCollections = DM->GetNumberOfCollections();
for(int i=0;i<numberOfCollections;i++)
{
G4String DCname = DM->GetCollectionName(i);
if( DCtable->Registor(DMname,DCname) < 0 )
{
G4cout << "DigiCollection <" << DCname
<< "> has already been registored with "
<< DMname << " DigitizerModule." << endl;
}
else if( verboseLevel > 0 )
{
G4cout << "DigiCollection " << DCname
<< " is registored. " << endl;
}
}
runManager->SetDCtable(DCtable);
}
void G4DigiManager::Digitize(G4String mName)
{
G4VDigitizerModule* aDM = FindDigitizerModule(mName);
if(aDM)
{ aDM->Digitize(); }
else
{ G4cout << "Unknown digitizer module <" << mName << ">. Digitize() ignored." << endl; }
}
G4VDigitizerModule* G4DigiManager::FindDigitizerModule(G4String mName)
{
for(G4int i=0;i<DMtable.entries();i++)
{
if(DMtable[i]->GetName() == mName) return DMtable[i];
}
return NULL;
}
const G4VHitsCollection* G4DigiManager::GetHitsCollection(G4int HCID,G4int eventID)
{
const G4Event* evt = NULL;
if(eventID==0)
{ evt = runManager->GetCurrentEvent(); }
else
{ evt = runManager->GetPreviousEvent(eventID); }
if(evt==NULL) return NULL;
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
if(HCE==NULL) return NULL;
return HCE->GetHC(HCID);
}
const G4VDigiCollection* G4DigiManager::GetDigiCollection(G4int DCID,G4int eventID)
{
const G4Event* evt = NULL;
if(eventID==0)
{ evt = runManager->GetCurrentEvent(); }
else
{ evt = runManager->GetPreviousEvent(eventID); }
if(evt==NULL) return NULL;
G4DCofThisEvent* DCE = evt->GetDCofThisEvent();
if(DCE==NULL) return NULL;
return DCE->GetDC(DCID);
}
G4int G4DigiManager::GetHitsCollectionID(G4String HCname)
{
return SDManager->GetCollectionID(HCname);
}
G4int G4DigiManager::GetDigiCollectionID(G4String DCname)
{
G4int i = DCtable->GetCollectionID(DCname);
if(i==-2)
{ G4cout << "< " << DCname << "> is ambegious." << endl; }
return i;
}
void G4DigiManager::SetDigiCollection(G4int DCID,G4VDigiCollection* aDC)
{
const G4Event* consEvt = runManager->GetCurrentEvent();
if(consEvt==NULL)
{
G4cout << "G4DigiManager::SetDigiCollection --- "
<< "Event object is not available." << endl;
return;
}
G4Event* evt = (G4Event*)consEvt;
G4DCofThisEvent* DCE = evt->GetDCofThisEvent();
if(DCE==NULL)
{
DCE = new G4DCofThisEvent(DCtable->entries());
evt->SetDCofThisEvent(DCE);
if(verboseLevel>0)
{ G4cout << "DCofThisEvent object is added to current G4Event." << endl; }
}
DCE->AddDigiCollection(DCID,aDC);
if(verboseLevel>0)
{
G4cout << aDC->GetName() << " is stored at " << DCID
<< "-th slot of G4DCofThisEvent." << endl;
}
}
void G4DigiManager::SetVerboseLevel(G4int val)
{
verboseLevel = val;
for(G4int i=0;i<DMtable.entries();i++)
{ DMtable[i]->SetVerboseLevel(val); }
}
void G4DigiManager::List() const
{
for(G4int i=0;i<DMtable.entries();i++)
{ G4cout << " " << i << " : " << DMtable[i]->GetName() << endl; }
}
+46
View File
@@ -0,0 +1,46 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VDigitizerModule.cc,v 2.1 1998/07/12 03:08:28 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#include "G4VDigitizerModule.hh"
#include "G4VDigiCollection.hh"
#include "G4DigiManager.hh"
G4VDigitizerModule::G4VDigitizerModule(G4String modName)
:verboseLevel(0)
{
moduleName = modName;
DigiManager = G4DigiManager::GetDMpointer();
}
G4VDigitizerModule::~G4VDigitizerModule()
{;}
int G4VDigitizerModule::operator==(const G4VDigitizerModule &right) const
{ return (moduleName==right.moduleName); }
int G4VDigitizerModule::operator!=(const G4VDigitizerModule &right) const
{ return (moduleName!=right.moduleName); }
void G4VDigitizerModule::StoreDigiCollection(G4VDigiCollection* aDC)
{
G4String DCnam = moduleName;
DCnam += "/";
DCnam += aDC->GetName();
G4int DCID = DigiManager->GetDigiCollectionID(DCnam);
if(DCID>=0) StoreDigiCollection(DCID,aDC);
}
void G4VDigitizerModule::StoreDigiCollection(G4int DCID,G4VDigiCollection* aDC)
{
DigiManager->SetDigiCollection(DCID,aDC);
}