G4SDManager Class Reference

#include <G4SDManager.hh>


Public Member Functions

 ~G4SDManager ()
void AddNewDetector (G4VSensitiveDetector *aSD)
void Activate (G4String dName, G4bool activeFlag)
G4int GetCollectionID (G4String colName)
G4int GetCollectionID (G4VHitsCollection *aHC)
G4VSensitiveDetector * FindSensitiveDetector (G4String dName, G4bool warning=true)
G4HCofThisEvent * PrepareNewEvent ()
void TerminateCurrentEvent (G4HCofThisEvent *HCE)
void AddNewCollection (G4String SDname, G4String DCname)
void SetVerboseLevel (G4int vl)
G4SDStructure * GetTreeTop () const
void ListTree () const
G4int GetCollectionCapacity () const
G4HCtable * GetHCtable () const

Static Public Member Functions

static G4SDManager * GetSDMpointer ()
static G4SDManager * GetSDMpointerIfExist ()

Protected Member Functions

 G4SDManager ()


Detailed Description

Definition at line 50 of file G4SDManager.hh.


Constructor & Destructor Documentation

G4SDManager::G4SDManager (  )  [protected]

Definition at line 52 of file G4SDManager.cc.

00052                         :verboseLevel(0)
00053 {
00054   G4String topName = "/";
00055   treeTop = new G4SDStructure(topName);
00056   theMessenger = new G4SDmessenger(this);
00057   HCtable = new G4HCtable;
00058 }

G4SDManager::~G4SDManager (  ) 

Definition at line 60 of file G4SDManager.cc.

00061 {
00062   delete theMessenger;
00063   delete HCtable;
00064   delete treeTop;
00065 }


Member Function Documentation

void G4SDManager::Activate ( G4String  dName,
G4bool  activeFlag 
)

Definition at line 119 of file G4SDManager.cc.

References G4SDStructure::Activate(), and G4String::prepend().

Referenced by G4TheRayTracer::RestoreUserActions(), G4SDmessenger::SetNewValue(), and G4TheRayTracer::StoreUserActions().

00120 {
00121   G4String pathName = dName;
00122   if( pathName(0) != '/' ) pathName.prepend("/");
00123   treeTop->Activate(pathName,activeFlag);
00124 }

void G4SDManager::AddNewCollection ( G4String  SDname,
G4String  DCname 
)

Definition at line 88 of file G4SDManager.cc.

References G4cout, G4endl, G4Exception(), JustWarning, and G4HCtable::Registor().

Referenced by AddNewDetector(), and G4MultiFunctionalDetector::RegisterPrimitive().

00089 {
00090   G4int i = HCtable->Registor(SDname,DCname);
00091   if(verboseLevel>0)
00092   {
00093     if(i<0) {
00094      G4ExceptionDescription ED;
00095      ED << "G4SDManager::AddNewCollection : the collection <"
00096       << SDname << "/" << DCname << "> has already been reginstered." << G4endl;
00097      G4Exception("G4SDManager::AddNewCollection","Det0001",JustWarning,ED);
00098     }
00099     else
00100     {
00101       G4cout << "G4SDManager::AddNewCollection : the collection <"
00102        << SDname << "/" << DCname << "> is registered at " << i << G4endl;
00103     }
00104   }
00105 }

void G4SDManager::AddNewDetector ( G4VSensitiveDetector *  aSD  ) 

Definition at line 67 of file G4SDManager.cc.

References AddNewCollection(), G4SDStructure::AddNewDetector(), G4cout, G4endl, G4VSensitiveDetector::GetCollectionName(), G4VSensitiveDetector::GetName(), G4VSensitiveDetector::GetNumberOfCollections(), G4VSensitiveDetector::GetPathName(), and G4String::prepend().

Referenced by G4VScoringMesh::G4VScoringMesh().

00068 {
00069   G4int numberOfCollections = aSD->GetNumberOfCollections();
00070   G4String pathName = aSD->GetPathName();
00071   if( pathName(0) != '/' ) pathName.prepend("/");
00072   if( pathName(pathName.length()-1) != '/' ) pathName += "/";
00073   treeTop->AddNewDetector(aSD,pathName);
00074   if(numberOfCollections<1) return;
00075   for(G4int i=0;i<numberOfCollections;i++)
00076   {
00077     G4String SDname = aSD->GetName();
00078     G4String DCname = aSD->GetCollectionName(i);
00079     AddNewCollection(SDname,DCname);
00080   }
00081   if( verboseLevel > 0 )
00082   {
00083     G4cout << "New sensitive detector <" << aSD->GetName()
00084          << "> is registored at " << pathName << G4endl;
00085   }
00086 }

G4VSensitiveDetector * G4SDManager::FindSensitiveDetector ( G4String  dName,
G4bool  warning = true 
)

Definition at line 126 of file G4SDManager.cc.

References G4SDStructure::FindSensitiveDetector(), and G4String::prepend().

00127 {
00128   G4String pathName = dName;
00129   if( pathName(0) != '/' ) pathName.prepend("/");
00130   return treeTop->FindSensitiveDetector(pathName, warning);
00131 }

G4int G4SDManager::GetCollectionCapacity (  )  const [inline]

Definition at line 99 of file G4SDManager.hh.

References G4HCtable::entries().

00100       { return HCtable->entries(); }

G4int G4SDManager::GetCollectionID ( G4VHitsCollection *  aHC  ) 

Definition at line 143 of file G4SDManager.cc.

References GetCollectionID(), G4VHitsCollection::GetName(), and G4VHitsCollection::GetSDname().

00144 {
00145   G4String HCname = aHC->GetSDname();
00146   HCname += "/";
00147   HCname += aHC->GetName();
00148   return GetCollectionID(HCname);
00149 }

G4int G4SDManager::GetCollectionID ( G4String  colName  ) 

Definition at line 133 of file G4SDManager.cc.

References G4cout, G4endl, and G4HCtable::GetCollectionID().

Referenced by G4VSensitiveDetector::GetCollectionID(), G4VPrimitiveScorer::GetCollectionID(), GetCollectionID(), and G4DigiManager::GetHitsCollectionID().

00134 {
00135   G4int id = HCtable->GetCollectionID(colName);
00136   if(id==-1)
00137   { G4cout << "<" << colName << "> is not found." << G4endl; }
00138   else if(id==-2)
00139   { G4cout << "<" << colName << "> is ambiguous." << G4endl; }
00140   return id;
00141 }

G4HCtable* G4SDManager::GetHCtable (  )  const [inline]

Definition at line 101 of file G4SDManager.hh.

Referenced by G4RunManager::RunInitialization().

00102       { return HCtable; }

G4SDManager * G4SDManager::GetSDMpointer (  )  [static]

Definition at line 40 of file G4SDManager.cc.

Referenced by G4DigiManager::G4DigiManager(), G4VScoringMesh::G4VScoringMesh(), G4VSensitiveDetector::GetCollectionID(), G4VPrimitiveScorer::GetCollectionID(), and G4MultiFunctionalDetector::RegisterPrimitive().

00041 {
00042   if(!fSDManager)
00043   {
00044     fSDManager = new G4SDManager;
00045   }
00046   return fSDManager;
00047 }

G4SDManager * G4SDManager::GetSDMpointerIfExist (  )  [static]

Definition at line 49 of file G4SDManager.cc.

Referenced by G4EventManager::G4EventManager(), G4TheRayTracer::RestoreUserActions(), G4RunManager::RunInitialization(), G4TheRayTracer::StoreUserActions(), and G4RunManagerKernel::~G4RunManagerKernel().

00050 { return fSDManager; }

G4SDStructure* G4SDManager::GetTreeTop (  )  const [inline]

Definition at line 95 of file G4SDManager.hh.

00096       { return treeTop; }

void G4SDManager::ListTree (  )  const [inline]

Definition at line 97 of file G4SDManager.hh.

References G4SDStructure::ListTree().

Referenced by G4SDmessenger::SetNewValue().

00098       { treeTop->ListTree(); }

G4HCofThisEvent * G4SDManager::PrepareNewEvent (  ) 

Definition at line 107 of file G4SDManager.cc.

References G4HCtable::entries(), and G4SDStructure::Initialize().

00108 {
00109   G4HCofThisEvent* HCE = new G4HCofThisEvent(HCtable->entries());
00110   treeTop->Initialize(HCE);
00111   return HCE;
00112 }

void G4SDManager::SetVerboseLevel ( G4int  vl  )  [inline]

Definition at line 90 of file G4SDManager.hh.

References G4SDStructure::SetVerboseLevel().

Referenced by G4SDmessenger::SetNewValue().

00091       { 
00092         verboseLevel = vl; 
00093         treeTop->SetVerboseLevel(vl);
00094       }

void G4SDManager::TerminateCurrentEvent ( G4HCofThisEvent *  HCE  ) 

Definition at line 114 of file G4SDManager.cc.

References G4SDStructure::Terminate().

00115 {
00116   treeTop->Terminate(HCE);
00117 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:21 2013 for Geant4 by  doxygen 1.4.7