Import Geant4 0.0.0 source tree
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# $Id: GNUmakefile,v 2.0 1998/07/02 16:14:54 gunter Exp $
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
name := G4detector
|
||||
|
||||
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)/track/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/materials/include \
|
||||
-I$(G4BASE)/geometry/management/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/digits+hits/hits/include \
|
||||
-I$(G4BASE)/intercoms/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
$Id: History,v 2.0 1998/07/02 16:14:40 gunter 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 *
|
||||
----------------------------------------------------------
|
||||
|
||||
June 6, 98 M.Asai
|
||||
- Created.
|
||||
@@ -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: G4HCtable.hh,v 2.1 1998/07/12 02:53:17 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4HCtable_H
|
||||
#define G4HCtable_H 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include <rw/tvordvec.h>
|
||||
|
||||
class G4HCtable
|
||||
{
|
||||
public:
|
||||
G4HCtable();
|
||||
~G4HCtable();
|
||||
|
||||
public:
|
||||
G4int Registor(G4String SDname,G4String HCname);
|
||||
G4int GetCollectionID(G4String HCname);
|
||||
|
||||
private:
|
||||
RWTValOrderedVector<G4String> SDlist;
|
||||
RWTValOrderedVector<G4String> HClist;
|
||||
|
||||
public:
|
||||
inline G4int entries() const
|
||||
{ return HClist.entries(); }
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
// 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: G4SDManager.hh,v 2.1 1998/07/12 02:53:19 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4SDManager_h
|
||||
#define G4SDManager_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4SDStructure.hh"
|
||||
#include "G4HCtable.hh"
|
||||
class G4VHitsCollection;
|
||||
class G4VSensitiveDetector;
|
||||
class G4HCofThisEvent;
|
||||
class G4SDmessenger;
|
||||
|
||||
class G4SDManager
|
||||
{
|
||||
public:
|
||||
static G4SDManager* GetSDMpointer();
|
||||
static G4SDManager* GetSDMpointerIfExist();
|
||||
|
||||
protected:
|
||||
G4SDManager();
|
||||
|
||||
public:
|
||||
~G4SDManager();
|
||||
void AddNewDetector(G4VSensitiveDetector*aSD);
|
||||
G4HCofThisEvent* PrepareNewEvent();
|
||||
void TerminateCurrentEvent(G4HCofThisEvent* HCE);
|
||||
void Activate(G4String dName, G4bool activeFlag);
|
||||
G4int GetCollectionID(G4String colName);
|
||||
G4int GetCollectionID(G4VHitsCollection * aHC);
|
||||
G4VSensitiveDetector* FindSensitiveDetector(G4String dName);
|
||||
|
||||
private:
|
||||
static G4SDManager * fSDManager;
|
||||
G4SDStructure * treeTop;
|
||||
G4int verboseLevel;
|
||||
G4HCtable* HCtable;
|
||||
G4SDmessenger* theMessenger;
|
||||
|
||||
public:
|
||||
inline void SetVerboseLevel(G4int vl)
|
||||
{
|
||||
verboseLevel = vl;
|
||||
treeTop->SetVerboseLevel(vl);
|
||||
}
|
||||
inline G4SDStructure* GetTreeTop() const
|
||||
{ return treeTop; }
|
||||
inline void ListTree() const
|
||||
{ treeTop->ListTree(); }
|
||||
inline G4int GetCollectionCapacity() const
|
||||
{ return HCtable->entries(); }
|
||||
inline G4HCtable* GetHCtable() const
|
||||
{ return HCtable; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
// 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: G4SDStructure.hh,v 2.1 1998/07/12 02:53:19 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4SDStructure_h
|
||||
#define G4SDStructure_h 1
|
||||
|
||||
// Globals
|
||||
#include "globals.hh"
|
||||
// G4VSensitiveDetector
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
// RWTPtrOrderedVector
|
||||
#include <rw/tpordvec.h>
|
||||
|
||||
class G4HCofThisEvent;
|
||||
|
||||
class G4SDStructure
|
||||
{
|
||||
public:
|
||||
G4SDStructure(G4String aPath);
|
||||
~G4SDStructure();
|
||||
|
||||
int operator==(const G4SDStructure &right) const;
|
||||
|
||||
void AddNewDetector(G4VSensitiveDetector*aSD, G4String treeStructure);
|
||||
void Activate(G4String aName, G4bool sensitiveFlag);
|
||||
void Initialize(G4HCofThisEvent*HCE);
|
||||
void Terminate(G4HCofThisEvent*HCE);
|
||||
G4VSensitiveDetector* FindSensitiveDetector(G4String aName);
|
||||
G4VSensitiveDetector* GetSD(G4String aName);
|
||||
void ListTree();
|
||||
|
||||
private:
|
||||
G4SDStructure* FindSubDirectory(G4String subD);
|
||||
G4String ExtractDirName(G4String aPath);
|
||||
|
||||
private:
|
||||
RWTPtrOrderedVector<G4SDStructure> structure;
|
||||
RWTPtrOrderedVector<G4VSensitiveDetector> detector;
|
||||
G4String pathName;
|
||||
G4String dirName;
|
||||
G4int verboseLevel;
|
||||
|
||||
public:
|
||||
inline void SetVerboseLevel(G4int vl)
|
||||
{
|
||||
verboseLevel = vl;
|
||||
for(int i=0; i<structure.entries(); i++)
|
||||
{ structure(i)->SetVerboseLevel(vl); }
|
||||
for(int j=0; j<detector.entries(); j++)
|
||||
{ detector(j)->SetVerboseLevel(vl); }
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// 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: G4SDmessenger.hh,v 2.1 1998/07/12 02:53:20 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4SDmessenger_h
|
||||
#define G4SDmessenger_h 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class G4SDManager;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWithAnInteger;
|
||||
|
||||
class G4SDmessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
G4SDmessenger(G4SDManager * SDManager);
|
||||
~G4SDmessenger();
|
||||
void SetNewValue(G4UIcommand * command,G4String newValues);
|
||||
|
||||
private:
|
||||
G4SDManager * fSDMan;
|
||||
G4UIdirectory* hitsDir;
|
||||
G4UIcmdWithoutParameter* listCmd;
|
||||
G4UIcmdWithAString* activeCmd;
|
||||
G4UIcmdWithAString* inactiveCmd;
|
||||
G4UIcmdWithAnInteger* verboseCmd;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
// 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: G4SensitiveVolumeList.hh,v 2.1 1998/07/12 02:53:20 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file --- Copyright CERN 1996
|
||||
// CERN Geneva Switzerland
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// History: first implementation, based on Hits+Digi domain
|
||||
// object model of April 1996, S.Piperov
|
||||
//
|
||||
// ---------------- G4SensitiveVolumeList -----------------
|
||||
|
||||
#ifndef G4SensitiveVolumeList_h
|
||||
#define G4SensitiveVolumeList_h 1
|
||||
|
||||
#include <rw/tpordvec.h>
|
||||
#include <rw/tvordvec.h>
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
|
||||
class G4SensitiveVolumeList
|
||||
{
|
||||
|
||||
public:
|
||||
//Constructors
|
||||
G4SensitiveVolumeList();
|
||||
G4SensitiveVolumeList(const G4SensitiveVolumeList &right);
|
||||
|
||||
//Destructor
|
||||
~G4SensitiveVolumeList();
|
||||
|
||||
//Assignment Operation
|
||||
const G4SensitiveVolumeList & operator=(const G4SensitiveVolumeList &right
|
||||
);
|
||||
|
||||
//Equality Operations
|
||||
G4int operator==(const G4SensitiveVolumeList &right) const;
|
||||
G4int operator!=(const G4SensitiveVolumeList &right) const;
|
||||
|
||||
|
||||
//Other Operations
|
||||
G4bool CheckPV(const G4VPhysicalVolume *pvp) const;
|
||||
G4bool CheckLV(const G4LogicalVolume *lvp) const;
|
||||
|
||||
//Get and Set Operations for Has Relationships
|
||||
const RWTPtrOrderedVector<G4VPhysicalVolume>& GetThePhysicalVolumeList() const;
|
||||
void SetThePhysicalVolumeList(const RWTPtrOrderedVector<G4VPhysicalVolume> value);
|
||||
|
||||
const RWTPtrOrderedVector<G4LogicalVolume>& GetTheLogicalVolumeList() const;
|
||||
void SetTheLogicalVolumeList(const RWTPtrOrderedVector<G4LogicalVolume> value);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//Data Members for Has Relationships
|
||||
|
||||
RWTPtrOrderedVector<G4VPhysicalVolume> thePhysicalVolumeList;
|
||||
RWTPtrOrderedVector<G4LogicalVolume> theLogicalVolumeList;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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: G4SensitiveVolumeList.icc,v 2.0 1998/07/02 16:14:33 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// -----------------------------------------------------------
|
||||
// Inline functions of GEANT 4 class header file.
|
||||
// --- Copyright CERN 1996, CERN Geneva Switzerland ---
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD group
|
||||
// History: first implementation, based on Hits+Digi domain
|
||||
// object model of April 1996, S.Piperov
|
||||
//
|
||||
// ---------------- G4SensitiveVolumeList -----------------
|
||||
|
||||
|
||||
//Get and Set Operations for Has Relationships
|
||||
|
||||
inline const RWTPtrOrderedVector<G4VPhysicalVolume>& G4SensitiveVolumeList::get_the_G4VPhysicalVolume_list() const { return the_G4VPhysicalVolume_list; }
|
||||
|
||||
inline void G4SensitiveVolumeList::set_the_G4VPhysicalVolume_list(const RWTPtrOrderedVector<G4VPhysicalVolume> value) { the_G4VPhysicalVolume_list = value; }
|
||||
|
||||
|
||||
inline const RWTPtrOrderedVector<G4LogicalVolume>& G4SensitiveVolumeList::get_the_G4LogicalVolume() const { return the_G4LogicalVolume_list; }
|
||||
|
||||
inline void G4SensitiveVolumeList::set_the_G4LogicalVolume(const RWTPtrOrderedVector<G4LogicalVolume> value) { the_G4LogicalVolume_list = value; }
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// 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: G4VReadOutGeometry.hh,v 2.1 1998/07/12 02:53:20 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4VReadOutGeometry_h
|
||||
#define G4VReadOutGeometry_h
|
||||
|
||||
#include "G4SensitiveVolumeList.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
|
||||
class G4Navigator;
|
||||
|
||||
class G4VReadOutGeometry
|
||||
{
|
||||
protected:
|
||||
virtual G4VPhysicalVolume* Build() = 0; // must return the world of the ROGeometry;
|
||||
|
||||
public:
|
||||
G4VReadOutGeometry();
|
||||
G4VReadOutGeometry(const G4VReadOutGeometry &right);
|
||||
G4VReadOutGeometry(G4String);
|
||||
virtual ~G4VReadOutGeometry();
|
||||
|
||||
const G4VReadOutGeometry & operator=(const G4VReadOutGeometry &right);
|
||||
|
||||
G4int operator==(const G4VReadOutGeometry &right) const;
|
||||
G4int operator!=(const G4VReadOutGeometry &right) const;
|
||||
|
||||
// buildROGeomety must be invoked to Build (ie Build() method)
|
||||
// the ROGeometry. It sets up in addition the needed
|
||||
// the G4Navigator used to navigate inside this ROGeometry.
|
||||
void BuildROGeometry();
|
||||
G4bool CheckROVolume(G4Step*,G4TouchableHistory*&);
|
||||
|
||||
protected:
|
||||
G4bool FindROTouchable(G4Step*);
|
||||
|
||||
G4VPhysicalVolume* ROworld;
|
||||
G4SensitiveVolumeList* fincludeList;
|
||||
G4SensitiveVolumeList* fexcludeList;
|
||||
G4String name;
|
||||
|
||||
private:
|
||||
G4Navigator* ROnavigator;
|
||||
G4TouchableHistory* touchableHistory;
|
||||
|
||||
public:
|
||||
inline const G4SensitiveVolumeList* GetIncludeList() const
|
||||
{ return fincludeList; }
|
||||
inline void SetIncludeList(G4SensitiveVolumeList* value)
|
||||
{ fincludeList = value; }
|
||||
inline const G4SensitiveVolumeList* GetExcludeList() const
|
||||
{ return fexcludeList; }
|
||||
inline void SetExcludeList(G4SensitiveVolumeList* value)
|
||||
{ fexcludeList = value; }
|
||||
inline G4String GetName() const
|
||||
{ return name; }
|
||||
inline void SetName(G4String value)
|
||||
{ name = value; }
|
||||
// ADDED:
|
||||
inline G4VPhysicalVolume* GetROWorld() const
|
||||
{ return ROworld;}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
// 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: G4VSensitiveDetector.hh,v 2.1 1998/07/12 02:53:21 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4VSensitiveDetector_h
|
||||
#define G4VSensitiveDetector_h 1
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4VReadOutGeometry.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include <rw/tvordvec.h>
|
||||
|
||||
class G4VSensitiveDetector
|
||||
{
|
||||
|
||||
public:
|
||||
G4VSensitiveDetector(G4String name);
|
||||
G4VSensitiveDetector(const G4VSensitiveDetector &right);
|
||||
|
||||
virtual ~G4VSensitiveDetector();
|
||||
|
||||
const G4VSensitiveDetector & operator=(const G4VSensitiveDetector &right);
|
||||
|
||||
int operator==(const G4VSensitiveDetector &right) const;
|
||||
int operator!=(const G4VSensitiveDetector &right) const;
|
||||
|
||||
virtual void Initialize(G4HCofThisEvent*HCE);
|
||||
virtual void EndOfEvent(G4HCofThisEvent*HCE);
|
||||
virtual void clear();
|
||||
|
||||
virtual void DrawAll();
|
||||
virtual void PrintAll();
|
||||
|
||||
protected:
|
||||
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist) = 0;
|
||||
|
||||
G4int GetCollectionID(G4int i);
|
||||
G4String SensitiveDetectorName; // detector name
|
||||
G4String thePathName; // directory path
|
||||
G4String fullPathName; // path + detector name
|
||||
G4int verboseLevel;
|
||||
G4bool active;
|
||||
RWTValOrderedVector<G4String> collectionName;
|
||||
|
||||
private:
|
||||
G4VReadOutGeometry * ROgeometry;
|
||||
|
||||
public:
|
||||
inline G4bool Hit(G4Step*aStep)
|
||||
{
|
||||
G4bool ack = true;
|
||||
G4TouchableHistory* ROhis = NULL;
|
||||
if(!isActive())
|
||||
{ ack = false; }
|
||||
else if(ROgeometry)
|
||||
{ ack = ROgeometry->CheckROVolume(aStep,ROhis); }
|
||||
if(ack)
|
||||
{ ack = ProcessHits(aStep,ROhis); }
|
||||
return ack;
|
||||
}
|
||||
inline G4int GetNumberOfCollections()
|
||||
{ return collectionName.entries(); };
|
||||
inline G4String GetCollectionName(G4int id)
|
||||
{ return collectionName[id]; };
|
||||
inline void SetVerboseLevel(G4int vl)
|
||||
{ verboseLevel = vl; };
|
||||
inline void Activate(G4bool activeFlag)
|
||||
{ active = activeFlag; };
|
||||
inline G4bool isActive()
|
||||
{ return active; };
|
||||
inline G4String GetName()
|
||||
{ return SensitiveDetectorName; };
|
||||
inline G4String GetPathName()
|
||||
{ return thePathName; };
|
||||
inline G4String GetFullPathName()
|
||||
{ return fullPathName; };
|
||||
inline void SetROgeometry(G4VReadOutGeometry*value)
|
||||
{ ROgeometry = value; };
|
||||
inline G4VReadOutGeometry* GetROgeometry()
|
||||
{ return ROgeometry; };
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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: G4HCtable.cc,v 2.1 1998/07/12 02:53:29 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4HCtable.hh"
|
||||
|
||||
G4HCtable::G4HCtable() {;}
|
||||
|
||||
G4HCtable::~G4HCtable() {;}
|
||||
|
||||
G4int G4HCtable::Registor(G4String SDname,G4String HCname)
|
||||
{
|
||||
for(int i=0;i<HClist.entries();i++)
|
||||
{ if(HClist[i]==HCname && SDlist[i]==SDname) return -1; }
|
||||
HClist.insert(HCname);
|
||||
SDlist.insert(SDname);
|
||||
return HClist.entries();
|
||||
}
|
||||
|
||||
G4int G4HCtable::GetCollectionID(G4String HCname)
|
||||
{
|
||||
G4int i = -1;
|
||||
if(HCname.index("/")==RW_NPOS) // HCname only
|
||||
{
|
||||
for(G4int j=0;j<HClist.entries();j++)
|
||||
{
|
||||
if(HClist[j]==HCname)
|
||||
{
|
||||
if(i>=0) return -2;
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(G4int j=0;j<HClist.entries();j++)
|
||||
{
|
||||
G4String tgt = SDlist[j];
|
||||
tgt += "/";
|
||||
tgt += HClist[j];
|
||||
if(tgt==HCname)
|
||||
{
|
||||
if(i>=0) return -2;
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
// 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: G4SDManager.cc,v 2.2 1998/07/13 16:50:04 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SDmessenger.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4VHitsCollection.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
|
||||
G4SDManager* G4SDManager::fSDManager = 0;
|
||||
|
||||
G4SDManager* G4SDManager::GetSDMpointer()
|
||||
{
|
||||
if(!fSDManager)
|
||||
{
|
||||
fSDManager = new G4SDManager;
|
||||
}
|
||||
return fSDManager;
|
||||
}
|
||||
|
||||
G4SDManager* G4SDManager::GetSDMpointerIfExist()
|
||||
{ return fSDManager; }
|
||||
|
||||
G4SDManager::G4SDManager():verboseLevel(0)
|
||||
{
|
||||
G4String topName = "/";
|
||||
treeTop = new G4SDStructure(topName);
|
||||
theMessenger = new G4SDmessenger(this);
|
||||
HCtable = new G4HCtable;
|
||||
}
|
||||
|
||||
G4SDManager::~G4SDManager()
|
||||
{
|
||||
delete theMessenger;
|
||||
}
|
||||
|
||||
void G4SDManager::AddNewDetector(G4VSensitiveDetector*aSD)
|
||||
{
|
||||
G4String pathName = aSD->GetPathName();
|
||||
G4int numberOfCollections = aSD->GetNumberOfCollections();
|
||||
if( pathName(0) != '/' ) pathName.prepend("/");
|
||||
if( pathName(pathName.length()-1) != '/' ) pathName += "/";
|
||||
treeTop->AddNewDetector(aSD,pathName);
|
||||
for(int i=0;i<numberOfCollections;i++)
|
||||
{
|
||||
G4String SDname = aSD->GetName();
|
||||
G4String DCname = aSD->GetCollectionName(i);
|
||||
HCtable->Registor(SDname,DCname);
|
||||
}
|
||||
if( verboseLevel > 0 )
|
||||
{
|
||||
G4cout << "New sensitive detector <" << aSD->GetName()
|
||||
<< "> is registored at " << pathName << endl;
|
||||
}
|
||||
}
|
||||
|
||||
G4HCofThisEvent* G4SDManager::PrepareNewEvent()
|
||||
{
|
||||
G4HCofThisEvent* HCE = new G4HCofThisEvent(HCtable->entries());
|
||||
treeTop->Initialize(HCE);
|
||||
return HCE;
|
||||
}
|
||||
|
||||
void G4SDManager::TerminateCurrentEvent(G4HCofThisEvent* HCE)
|
||||
{
|
||||
treeTop->Terminate(HCE);
|
||||
}
|
||||
|
||||
void G4SDManager::Activate(G4String dName, G4bool activeFlag)
|
||||
{
|
||||
G4String pathName = dName;
|
||||
if( pathName(0) != '/' ) pathName.prepend("/");
|
||||
treeTop->Activate(pathName,activeFlag);
|
||||
}
|
||||
|
||||
G4VSensitiveDetector* G4SDManager::FindSensitiveDetector(G4String dName)
|
||||
{
|
||||
G4String pathName = dName;
|
||||
if( pathName(0) != '/' ) pathName.prepend("/");
|
||||
return treeTop->FindSensitiveDetector(pathName);
|
||||
}
|
||||
|
||||
G4int G4SDManager::GetCollectionID(G4String colName)
|
||||
{
|
||||
G4int id = HCtable->GetCollectionID(colName);
|
||||
if(id==-1)
|
||||
{ G4cout << "<" << colName << "> is not found." << endl; }
|
||||
else if(id==-2)
|
||||
{ G4cout << "<" << colName << "> is ambiguous." << endl; }
|
||||
return id;
|
||||
}
|
||||
|
||||
G4int G4SDManager::GetCollectionID(G4VHitsCollection* aHC)
|
||||
{
|
||||
G4String HCname = aHC->GetSDname();
|
||||
HCname += "/";
|
||||
HCname += aHC->GetName();
|
||||
return GetCollectionID(HCname);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
// 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: G4SDStructure.cc,v 2.2 1998/07/13 16:50:05 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
// G4SDStructure
|
||||
#include "G4SDStructure.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4SDStructure::G4SDStructure(G4String aPath):verboseLevel(0)
|
||||
{
|
||||
pathName = aPath;
|
||||
dirName = aPath;
|
||||
int i = dirName.length();
|
||||
if( i > 1 )
|
||||
{
|
||||
dirName.remove(i-1);
|
||||
int isl = dirName.last('/');
|
||||
dirName.remove(0,isl+1);
|
||||
dirName += "/";
|
||||
}
|
||||
}
|
||||
|
||||
G4SDStructure::~G4SDStructure()
|
||||
{
|
||||
}
|
||||
|
||||
int G4SDStructure::operator==(const G4SDStructure &right) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void G4SDStructure::AddNewDetector(G4VSensitiveDetector*aSD,
|
||||
G4String treeStructure)
|
||||
{
|
||||
G4String remainingPath = treeStructure;
|
||||
remainingPath.remove(0,pathName.length());
|
||||
if( ! remainingPath.isNull() )
|
||||
{ // The detector should be kept in subdirectory.
|
||||
// First, check if the subdirectoy exists.
|
||||
G4String subD = ExtractDirName( remainingPath );
|
||||
G4SDStructure* tgtSDS = FindSubDirectory(subD);
|
||||
if( tgtSDS == NULL )
|
||||
{ // Subdirectory not found. Create a new directory.
|
||||
subD.prepend(pathName);
|
||||
tgtSDS = new G4SDStructure(subD);
|
||||
structure.insert( tgtSDS );
|
||||
}
|
||||
tgtSDS->AddNewDetector(aSD,treeStructure);
|
||||
}
|
||||
else
|
||||
{ // The sensitive detector should be kept in this directory.
|
||||
G4VSensitiveDetector* tgtSD = GetSD( aSD->GetName() );
|
||||
if( tgtSD != NULL )
|
||||
{
|
||||
G4cout << aSD->GetName() << " had already stored in "
|
||||
<< pathName << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
detector.insert( aSD );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4SDStructure* G4SDStructure::FindSubDirectory(G4String subD)
|
||||
{
|
||||
for( int i=0; i<structure.entries(); i++ )
|
||||
{
|
||||
if( subD == structure(i)->dirName ) return structure(i);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
G4VSensitiveDetector* G4SDStructure::GetSD(G4String aSDName)
|
||||
{
|
||||
for( int i=0; i<detector.entries(); i++ )
|
||||
{
|
||||
G4VSensitiveDetector* tgtSD = detector(i);
|
||||
if( aSDName == tgtSD->GetName() ) return tgtSD;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
G4String G4SDStructure::ExtractDirName(G4String aName)
|
||||
{
|
||||
G4String subD = aName;
|
||||
int i = aName.first('/');
|
||||
if( i != RW_NPOS ) subD.remove(i+1);
|
||||
return subD;
|
||||
}
|
||||
|
||||
void G4SDStructure::Activate(G4String aName, G4bool sensitiveFlag)
|
||||
{
|
||||
G4String aPath = aName;
|
||||
aPath.remove(0,pathName.length());
|
||||
if( aPath.first('/') != RW_NPOS )
|
||||
{ // Command is ordered for a subdirectory.
|
||||
G4String subD = ExtractDirName(aPath);
|
||||
G4SDStructure* tgtSDS = FindSubDirectory(subD);
|
||||
if( tgtSDS == NULL )
|
||||
{ // The subdirectory is not found
|
||||
G4cout << subD << " is not found in " << pathName << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
tgtSDS->Activate(aName,sensitiveFlag);
|
||||
}
|
||||
}
|
||||
else if( aPath.isNull() )
|
||||
{ // Command is ordered for all detectors in this directory.
|
||||
for( int i=0; i<detector.entries(); i++)
|
||||
{
|
||||
detector(i)->Activate(sensitiveFlag);
|
||||
}
|
||||
for( int j=0;j<structure.entries(); j++)
|
||||
{
|
||||
structure(j)->Activate(G4String("/"),sensitiveFlag);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Command is ordered to a particular detector.
|
||||
G4VSensitiveDetector* tgtSD = GetSD(aPath);
|
||||
if( tgtSD == NULL )
|
||||
{ // The detector is not found.
|
||||
G4cout << aPath << " is not found in " << pathName << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
tgtSD->Activate(sensitiveFlag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4VSensitiveDetector* G4SDStructure::FindSensitiveDetector(G4String aName)
|
||||
{
|
||||
G4String aPath = aName;
|
||||
aPath.remove(0,pathName.length());
|
||||
if( aPath.first('/') != RW_NPOS )
|
||||
{ // SD exists in sub-directory
|
||||
G4String subD = ExtractDirName(aPath);
|
||||
G4SDStructure* tgtSDS = FindSubDirectory(subD);
|
||||
if( tgtSDS == NULL )
|
||||
{ // The subdirectory is not found
|
||||
G4cout << subD << " is not found in " << pathName << endl;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return tgtSDS->FindSensitiveDetector(aName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // SD must exist in this directory
|
||||
G4VSensitiveDetector* tgtSD = GetSD(aPath);
|
||||
if( tgtSD == NULL )
|
||||
{ // The detector is not found.
|
||||
G4cout << aPath << " is not found in " << pathName << endl;
|
||||
}
|
||||
return tgtSD;
|
||||
}
|
||||
}
|
||||
|
||||
void G4SDStructure::Initialize(G4HCofThisEvent*HCE)
|
||||
{
|
||||
int i;
|
||||
// Broadcast to subdirectories.
|
||||
for( i=0; i<structure.entries(); i++ )
|
||||
{
|
||||
structure(i)->Initialize(HCE);
|
||||
}
|
||||
// Initialize all detectors in this directory.
|
||||
for( i=0; i<detector.entries(); i++ )
|
||||
{
|
||||
if(detector(i)->isActive()) detector(i)->Initialize(HCE);
|
||||
}
|
||||
}
|
||||
|
||||
void G4SDStructure::Terminate(G4HCofThisEvent*HCE)
|
||||
{
|
||||
int i;
|
||||
// Broadcast to subdirectories.
|
||||
for( i=0; i<structure.entries(); i++ )
|
||||
{
|
||||
structure(i)->Terminate(HCE);
|
||||
}
|
||||
// Initialize all detectors in this directory.
|
||||
for( i=0; i<detector.entries(); i++ )
|
||||
{
|
||||
if(detector(i)->isActive()) detector(i)->EndOfEvent(HCE);
|
||||
}
|
||||
}
|
||||
|
||||
void G4SDStructure::ListTree()
|
||||
{
|
||||
G4cout << pathName << endl;
|
||||
for(int i=0; i<detector.entries(); i++)
|
||||
{
|
||||
G4VSensitiveDetector* sd = detector(i);
|
||||
G4cout << pathName << sd->GetName();
|
||||
if( sd->isActive() )
|
||||
{ G4cout << " *** Active "; }
|
||||
else
|
||||
{ G4cout << " XXX Inactive "; }
|
||||
G4cout << endl;
|
||||
}
|
||||
for(int j=0; j<structure.entries(); j++)
|
||||
{ structure(j)->ListTree(); }
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
// 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: G4SDmessenger.cc,v 2.2 1998/07/14 17:24:16 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#include "G4SDmessenger.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
G4SDmessenger::G4SDmessenger(G4SDManager* SDManager):fSDMan(SDManager)
|
||||
{
|
||||
hitsDir = new G4UIdirectory("/hits/");
|
||||
hitsDir->SetGuidance("Sensitive detectors and Hits");
|
||||
|
||||
listCmd = new G4UIcmdWithoutParameter("/hits/list",this);
|
||||
listCmd->SetGuidance("List sensitive detector tree.");
|
||||
|
||||
activeCmd = new G4UIcmdWithAString("/hits/activate",this);
|
||||
activeCmd->SetGuidance("Activate sensitive detector(s).");
|
||||
activeCmd->SetParameterName("detector",true);
|
||||
activeCmd->SetDefaultValue("/");
|
||||
|
||||
inactiveCmd = new G4UIcmdWithAString("/hits/inactivate",this);
|
||||
inactiveCmd->SetGuidance("Inactivate sensitive detector(s).");
|
||||
inactiveCmd->SetParameterName("detector",true);
|
||||
inactiveCmd->SetDefaultValue("/");
|
||||
|
||||
verboseCmd = new G4UIcmdWithAnInteger("/hits/verbose",this);
|
||||
verboseCmd->SetGuidance("Set the Verbose level.");
|
||||
verboseCmd->SetParameterName("level",false);
|
||||
}
|
||||
|
||||
G4SDmessenger::~G4SDmessenger()
|
||||
{
|
||||
delete listCmd;
|
||||
delete activeCmd;
|
||||
delete inactiveCmd;
|
||||
delete verboseCmd;
|
||||
delete hitsDir;
|
||||
}
|
||||
|
||||
void G4SDmessenger::SetNewValue(G4UIcommand * command,G4String newVal)
|
||||
{
|
||||
if( command==listCmd )
|
||||
{ fSDMan->ListTree(); }
|
||||
if( command==activeCmd )
|
||||
{ fSDMan->Activate(newVal,1); }
|
||||
if( command==inactiveCmd )
|
||||
{ fSDMan->Activate(newVal,0); }
|
||||
if( command==verboseCmd )
|
||||
{ fSDMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal)); }
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// 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: G4SensitiveVolumeList.cc,v 2.1 1998/07/12 02:53:31 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, CN Division, ASD Group
|
||||
// History: first implementation June'96, based on Hits+Digi
|
||||
// domain model of April 1996, S.Piperov
|
||||
//
|
||||
// ---------------- G4SensitiveVolumeList -----------------
|
||||
|
||||
#include "G4SensitiveVolumeList.hh"
|
||||
|
||||
//Constructors
|
||||
G4SensitiveVolumeList::G4SensitiveVolumeList()
|
||||
{
|
||||
}
|
||||
|
||||
G4SensitiveVolumeList::G4SensitiveVolumeList(const G4SensitiveVolumeList &right)
|
||||
{
|
||||
thePhysicalVolumeList = right.thePhysicalVolumeList;
|
||||
theLogicalVolumeList = right.theLogicalVolumeList;
|
||||
}
|
||||
|
||||
|
||||
//Destructor
|
||||
G4SensitiveVolumeList::~G4SensitiveVolumeList()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//Assignment Operation
|
||||
const G4SensitiveVolumeList & G4SensitiveVolumeList::operator=(const G4SensitiveVolumeList &right)
|
||||
{
|
||||
thePhysicalVolumeList = right.thePhysicalVolumeList;
|
||||
theLogicalVolumeList = right.theLogicalVolumeList;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//Equality Operations
|
||||
G4int G4SensitiveVolumeList::operator==(const G4SensitiveVolumeList &right) const
|
||||
{
|
||||
return (this == (G4SensitiveVolumeList *) &right);
|
||||
}
|
||||
|
||||
G4int G4SensitiveVolumeList::operator!=(const G4SensitiveVolumeList &right) const
|
||||
{
|
||||
return (this != (G4SensitiveVolumeList *) &right);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Other Operations
|
||||
G4bool G4SensitiveVolumeList::CheckPV(const G4VPhysicalVolume * pvp) const
|
||||
{
|
||||
if (thePhysicalVolumeList.entries()==0) return false;
|
||||
for(int i=0;i<thePhysicalVolumeList.entries();i++)
|
||||
{ if(thePhysicalVolumeList(i)==pvp) return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
G4bool G4SensitiveVolumeList::CheckLV(const G4LogicalVolume * lvp) const
|
||||
{
|
||||
if (theLogicalVolumeList.entries()==0) return false;
|
||||
for(int i=0;i<theLogicalVolumeList.entries();i++)
|
||||
{ if(theLogicalVolumeList(i)==lvp) return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
// 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: G4VReadOutGeometry.cc,v 2.1 1998/07/12 02:53:31 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4VReadOutGeometry.hh"
|
||||
#include "G4Navigator.hh"
|
||||
|
||||
|
||||
G4VReadOutGeometry::G4VReadOutGeometry()
|
||||
:ROworld(NULL),touchableHistory(NULL),
|
||||
fincludeList(NULL),fexcludeList(NULL)
|
||||
{
|
||||
name = "unknown";
|
||||
ROnavigator = new G4Navigator();
|
||||
}
|
||||
|
||||
G4VReadOutGeometry::G4VReadOutGeometry(const G4VReadOutGeometry &right)
|
||||
{
|
||||
fincludeList = right.fincludeList;
|
||||
fexcludeList = right.fexcludeList;
|
||||
name = right.name;
|
||||
ROworld = right.ROworld;
|
||||
touchableHistory = NULL;
|
||||
// COPY CONSTRUCTOR NOT STRAIGHT FORWARD: need to copy the touchabelHistory
|
||||
// VALUE, same foe navigator and same for the World+Geom hierachy ??
|
||||
}
|
||||
|
||||
G4VReadOutGeometry::G4VReadOutGeometry(G4String n)
|
||||
:name(n),ROworld(NULL),touchableHistory(NULL),
|
||||
fincludeList(NULL),fexcludeList(NULL)
|
||||
{
|
||||
ROnavigator = new G4Navigator();
|
||||
}
|
||||
|
||||
G4VReadOutGeometry::~G4VReadOutGeometry()
|
||||
{
|
||||
//if(ROworld) delete ROworld; //should we do ? will it delete the goem tree also ?
|
||||
if(fincludeList) delete fincludeList;
|
||||
if(fexcludeList) delete fexcludeList;
|
||||
if(touchableHistory) delete touchableHistory;
|
||||
if(ROnavigator) delete ROnavigator;
|
||||
}
|
||||
|
||||
const G4VReadOutGeometry & G4VReadOutGeometry::operator=(const G4VReadOutGeometry &right)
|
||||
{
|
||||
fincludeList = right.fincludeList;
|
||||
fexcludeList = right.fexcludeList;
|
||||
name = right.name;
|
||||
ROworld = right.ROworld;
|
||||
touchableHistory = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4int G4VReadOutGeometry::operator==(const G4VReadOutGeometry &right) const
|
||||
{ return (this == (G4VReadOutGeometry *) &right); }
|
||||
|
||||
G4int G4VReadOutGeometry::operator!=(const G4VReadOutGeometry &right) const
|
||||
{ return (this != (G4VReadOutGeometry *) &right); }
|
||||
|
||||
void G4VReadOutGeometry::BuildROGeometry()
|
||||
{
|
||||
ROworld = Build();
|
||||
ROnavigator->SetWorldVolume(ROworld);
|
||||
}
|
||||
|
||||
G4bool G4VReadOutGeometry::CheckROVolume(G4Step*currentStep,G4TouchableHistory*& ROhist)
|
||||
{
|
||||
ROhist = NULL;
|
||||
G4bool incFlg = true;
|
||||
G4VPhysicalVolume* PV = currentStep->GetPreStepPoint()->GetPhysicalVolume();
|
||||
if((fexcludeList)&&(fexcludeList->CheckPV(PV)))
|
||||
{ incFlg = false; }
|
||||
else if ((fincludeList)&&(fincludeList->CheckPV(PV)))
|
||||
{ incFlg = true; }
|
||||
else if((fexcludeList)&&(fexcludeList->CheckLV(PV->GetLogicalVolume())))
|
||||
{ incFlg = false; }
|
||||
else if((fincludeList)&&(fincludeList->CheckLV(PV->GetLogicalVolume())))
|
||||
{ incFlg = true; }
|
||||
if(!incFlg) return false;
|
||||
|
||||
if(ROworld)
|
||||
{ incFlg = FindROTouchable(currentStep); }
|
||||
if(incFlg)
|
||||
{ ROhist = touchableHistory; }
|
||||
return incFlg;
|
||||
}
|
||||
|
||||
G4bool G4VReadOutGeometry::FindROTouchable(G4Step*currentStep)
|
||||
{
|
||||
// Update G4TouchableHistory object (touchableHistory)
|
||||
// using the parallel readout world (ROworld)
|
||||
// Return false in case the current Step is outside of the
|
||||
// sensitive volume of the readout world.
|
||||
|
||||
// At first invokation, creates the touchable history. Note
|
||||
// that default value (false) of Locate method is used.
|
||||
if(!touchableHistory)
|
||||
{
|
||||
touchableHistory = new G4TouchableHistory();
|
||||
ROnavigator->LocateGlobalPointAndUpdateTouchable(
|
||||
currentStep->GetPreStepPoint()->GetPosition(),
|
||||
touchableHistory);
|
||||
}
|
||||
else
|
||||
{
|
||||
ROnavigator->LocateGlobalPointAndUpdateTouchable(
|
||||
currentStep->GetPreStepPoint()->GetPosition(),
|
||||
touchableHistory,
|
||||
true);
|
||||
}
|
||||
// Can the above be improved by the use of an isotropic safety
|
||||
// in order to avoid LocateGlobalPointAndUpdateTouchable
|
||||
// at each Step ?
|
||||
// Should require that an RO geometry is notified at the
|
||||
// starting of a track to avoid possible confusion looking
|
||||
// at the safety value only.
|
||||
|
||||
// checks if volume is sensitive:
|
||||
G4VPhysicalVolume* currentVolume;
|
||||
// checks first if a physical volume exists here:
|
||||
if ( currentVolume = touchableHistory->GetVolume() )
|
||||
{
|
||||
return currentVolume->GetLogicalVolume()->
|
||||
GetSensitiveDetector() != NULL;
|
||||
}
|
||||
// no sensitive volume found: returns false
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// 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: G4VSensitiveDetector.cc,v 2.1 1998/07/12 02:53:32 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// G4VSensitiveDetector
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
G4VSensitiveDetector::G4VSensitiveDetector(G4String name)
|
||||
:verboseLevel(0),active(true),ROgeometry(NULL)
|
||||
{
|
||||
size_t sLast = name.last('/');
|
||||
if(sLast==RW_NPOS)
|
||||
{ // detector name only
|
||||
SensitiveDetectorName = name;
|
||||
thePathName = "/";
|
||||
}
|
||||
else
|
||||
{ // name conatin the directory path
|
||||
SensitiveDetectorName = name;
|
||||
SensitiveDetectorName.remove(0,sLast+1);
|
||||
thePathName = name;
|
||||
thePathName.remove(sLast+1,name.length()-sLast);
|
||||
if(thePathName(0)!='/') thePathName.prepend("/");
|
||||
}
|
||||
fullPathName = thePathName + SensitiveDetectorName;
|
||||
}
|
||||
|
||||
G4VSensitiveDetector::G4VSensitiveDetector(const G4VSensitiveDetector &right)
|
||||
{
|
||||
}
|
||||
|
||||
G4VSensitiveDetector::~G4VSensitiveDetector()
|
||||
{
|
||||
}
|
||||
|
||||
const G4VSensitiveDetector & G4VSensitiveDetector::operator=(const G4VSensitiveDetector &right)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
int G4VSensitiveDetector::operator==(const G4VSensitiveDetector &right) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int G4VSensitiveDetector::operator!=(const G4VSensitiveDetector &right) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
G4int G4VSensitiveDetector::GetCollectionID(G4int i)
|
||||
{
|
||||
return G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[i]);
|
||||
}
|
||||
|
||||
//----- following methoods are abstract methods to be
|
||||
//----- implemented in the concrete classes
|
||||
|
||||
void G4VSensitiveDetector::Initialize(G4HCofThisEvent*HCE)
|
||||
{
|
||||
}
|
||||
|
||||
void G4VSensitiveDetector::EndOfEvent(G4HCofThisEvent*HCE)
|
||||
{
|
||||
}
|
||||
|
||||
void G4VSensitiveDetector::clear()
|
||||
{
|
||||
}
|
||||
|
||||
void G4VSensitiveDetector::DrawAll()
|
||||
{
|
||||
}
|
||||
|
||||
void G4VSensitiveDetector::PrintAll()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user