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
+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);
}