G4SDManager.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 
00030 #ifndef G4SDManager_h
00031 #define G4SDManager_h 1
00032 
00033 #include "globals.hh"
00034 #include "G4SDStructure.hh"
00035 #include "G4HCtable.hh"
00036 class G4VHitsCollection;
00037 class G4VSensitiveDetector;
00038 class G4HCofThisEvent;
00039 class G4SDmessenger;
00040 
00041 // class description:
00042 //
00043 //  This is a singleton class which manages the sensitive detectors.
00044 // The user cannot access to the constructor. The pointer of the
00045 // only existing object can be got via G4SDManager::GetSDMpointer()
00046 // static method. The first invokation of this static method makes
00047 // the singleton object.
00048 //
00049 
00050 class G4SDManager 
00051 {
00052   public: // with description
00053       static G4SDManager* GetSDMpointer();
00054       // Returns the pointer to the singleton object.
00055   public:
00056       static G4SDManager* GetSDMpointerIfExist();
00057 
00058   protected:
00059       G4SDManager();
00060 
00061   public:
00062       ~G4SDManager();
00063 
00064   public: // with description
00065       void AddNewDetector(G4VSensitiveDetector*aSD); 
00066       //  Registors the user's sensitive detector. This method must be invoked
00067       // when the user construct his/her sensitive detector.
00068       void Activate(G4String dName, G4bool activeFlag);
00069       //  Activate/inactivate the registered sensitive detector. For the inactivated
00070       // detectors, hits collections will not be stored to the G4HCofThisEvent object.
00071       G4int GetCollectionID(G4String colName);
00072       G4int GetCollectionID(G4VHitsCollection * aHC);
00073       //  These two methods return the ID number of the sensitive detector.
00074 
00075   public:
00076       G4VSensitiveDetector* FindSensitiveDetector(G4String dName, G4bool warning = true);
00077       G4HCofThisEvent* PrepareNewEvent();
00078       void TerminateCurrentEvent(G4HCofThisEvent* HCE);
00079       void AddNewCollection(G4String SDname,G4String DCname);
00080 
00081 
00082   private: 
00083       static G4SDManager * fSDManager;
00084       G4SDStructure * treeTop;
00085       G4int verboseLevel;
00086       G4HCtable* HCtable;
00087       G4SDmessenger* theMessenger;
00088 
00089   public:
00090       inline void SetVerboseLevel(G4int vl) 
00091       { 
00092         verboseLevel = vl; 
00093         treeTop->SetVerboseLevel(vl);
00094       }
00095       inline G4SDStructure* GetTreeTop() const
00096       { return treeTop; }
00097       inline void ListTree() const
00098       { treeTop->ListTree(); }
00099       inline G4int GetCollectionCapacity() const
00100       { return HCtable->entries(); }
00101       inline G4HCtable* GetHCtable() const
00102       { return HCtable; }
00103 
00104 };
00105 
00106 
00107 
00108 
00109 #endif
00110 

Generated on Mon May 27 17:49:48 2013 for Geant4 by  doxygen 1.4.7