Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4SDManager << 27 // 23 // 28 // Class description: << 24 // $Id: G4SDManager.hh,v 1.2 2004/05/03 08:14:01 gcosmo Exp $ >> 25 // GEANT4 tag $Name: geant4-07-00-patch-01 $ 29 // 26 // 30 // This is a singleton class which manages the << 27 31 // The user cannot access to the constructor. << 32 // only existing object can be got via G4SDMan << 33 // static method. The first invokation of this << 34 // the singleton object. << 35 // << 36 // Author: Makoto Asai << 37 // ------------------------------------------- << 38 #ifndef G4SDManager_h 28 #ifndef G4SDManager_h 39 #define G4SDManager_h 1 29 #define G4SDManager_h 1 40 30 41 #include "G4HCtable.hh" << 42 #include "G4SDStructure.hh" << 43 #include "globals.hh" 31 #include "globals.hh" 44 #include "G4VSDFilter.hh" << 32 #include "G4SDStructure.hh" 45 << 33 #include "G4HCtable.hh" 46 #include <vector> << 47 << 48 class G4VHitsCollection; 34 class G4VHitsCollection; 49 class G4VSensitiveDetector; 35 class G4VSensitiveDetector; 50 class G4HCofThisEvent; 36 class G4HCofThisEvent; 51 class G4SDmessenger; 37 class G4SDmessenger; 52 38 53 class G4SDManager << 39 // class description: >> 40 // >> 41 // This is a singleton class which manages the sensitive detectors. >> 42 // The user cannot access to the constructor. The pointer of the >> 43 // only existing object can be got via G4SDManager::GetSDMpointer() >> 44 // static method. The first invokation of this static method makes >> 45 // the singleton object. >> 46 // >> 47 >> 48 class G4SDManager 54 { 49 { 55 public: << 50 public: // with description 56 // Returns the pointer to the singleton obje << 51 static G4SDManager* GetSDMpointer(); 57 static G4SDManager* GetSDMpointer(); << 52 // Returns the pointer to the singleton object. 58 << 53 public: 59 // Returns current pointer to the singleton << 54 static G4SDManager* GetSDMpointerIfExist(); 60 // Caller is responsible for checking value << 55 61 static G4SDManager* GetSDMpointerIfExist(); << 56 protected: 62 << 57 G4SDManager(); 63 G4SDManager(const G4SDManager&) = delete; << 58 64 G4SDManager& operator=(const G4SDManager&) = << 59 public: 65 ~G4SDManager(); << 60 ~G4SDManager(); 66 << 61 67 // Register sensitive detector instance << 62 public: // with description 68 // This method must be invoked when the user << 63 void AddNewDetector(G4VSensitiveDetector*aSD); 69 void AddNewDetector(G4VSensitiveDetector* aS << 64 // Registors the user's sensitive detector. This method must be invoked 70 << 65 // when the user construct his/her sensitive detector. 71 // Activate/inactivate the registered sensit << 66 void Activate(G4String dName, G4bool activeFlag); 72 // For the inactivated detectors, hits colle << 67 // Activate/inactivate the registered sensitive detector. For the inactivated 73 // object. << 68 // detectors, hits collections will not be stored to the G4HCofThisEvent object. 74 void Activate(const G4String& dName, G4bool << 69 G4int GetCollectionID(G4String colName); 75 << 70 G4int GetCollectionID(G4VHitsCollection * aHC); 76 // Return ID number of sensitive detector wi << 71 // These two methods return the ID number of the sensitive detector. 77 G4int GetCollectionID(const G4String& colNam << 72 78 << 73 public: 79 // Return ID number of sensitive detector cr << 74 G4VSensitiveDetector* FindSensitiveDetector(G4String dName, G4bool warning = true); 80 G4int GetCollectionID(G4VHitsCollection* aHC << 75 G4HCofThisEvent* PrepareNewEvent(); 81 << 76 void TerminateCurrentEvent(G4HCofThisEvent* HCE); 82 G4VSensitiveDetector* FindSensitiveDetector( << 77 83 G4HCofThisEvent* PrepareNewEvent(); << 78 private: 84 void TerminateCurrentEvent(G4HCofThisEvent* << 79 static G4SDManager * fSDManager; 85 void AddNewCollection(const G4String& SDname << 80 G4SDStructure * treeTop; 86 << 81 G4int verboseLevel; 87 inline void SetVerboseLevel(G4int vl) << 82 G4HCtable* HCtable; 88 { << 83 G4SDmessenger* theMessenger; 89 verboseLevel = vl; << 84 90 treeTop->SetVerboseLevel(vl); << 85 public: 91 } << 86 inline void SetVerboseLevel(G4int vl) 92 inline G4SDStructure* GetTreeTop() const { r << 87 { 93 inline void ListTree() const { treeTop->List << 88 verboseLevel = vl; 94 inline G4int GetCollectionCapacity() const { << 89 treeTop->SetVerboseLevel(vl); 95 inline G4HCtable* GetHCtable() const { retur << 90 } 96 << 91 inline G4SDStructure* GetTreeTop() const 97 void RegisterSDFilter(G4VSDFilter* filter); << 92 { return treeTop; } 98 void DeRegisterSDFilter(G4VSDFilter* filter) << 93 inline void ListTree() const 99 << 94 { treeTop->ListTree(); } 100 protected: << 95 inline G4int GetCollectionCapacity() const 101 G4SDManager(); << 96 { return HCtable->entries(); } 102 << 97 inline G4HCtable* GetHCtable() const 103 private: << 98 { return HCtable; } 104 void DestroyFilters(); << 99 105 << 106 private: << 107 static G4ThreadLocal G4SDManager* fSDManager << 108 G4SDStructure* treeTop; << 109 G4int verboseLevel{0}; << 110 G4HCtable* HCtable; << 111 G4SDmessenger* theMessenger; << 112 std::vector<G4VSDFilter*> FilterList; << 113 }; 100 }; 114 101 >> 102 >> 103 >> 104 115 #endif 105 #endif >> 106 116 107