![]() |
|
|||
File indexing completed on 2025-09-17 08:58:14
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4DCofThisEvent 0027 // 0028 // Class description: 0029 // 0030 // This is a class which stores digi collections generated at one event. 0031 // This class is exclusively constructed by G4DigiManager when the first 0032 // digi collection of an event is passed to the manager, and this class 0033 // object is deleted by G4RunManager when a G4Event class object is deleted. 0034 // Almost all public methods must be used by Geant4 kernel classes and 0035 // the user should not invoke them. The user can use two const methods, 0036 // GetDC() and GetNumberOfCollections() for accessing to the stored digi 0037 // collection(s). 0038 // 0039 // Author: Makoto Asai 0040 // -------------------------------------------------------------------- 0041 #ifndef G4DCofThisEvent_h 0042 #define G4DCofThisEvent_h 1 0043 0044 #include "G4Allocator.hh" 0045 #include "G4VDigiCollection.hh" 0046 #include "globals.hh" 0047 0048 #include <vector> 0049 0050 class G4DCofThisEvent 0051 { 0052 public: 0053 0054 G4DCofThisEvent(); 0055 explicit G4DCofThisEvent(G4int cap); 0056 ~G4DCofThisEvent(); 0057 G4DCofThisEvent(const G4DCofThisEvent&); 0058 G4DCofThisEvent& operator=(const G4DCofThisEvent&); 0059 0060 inline void* operator new(std::size_t); 0061 inline void operator delete(void* anDCoTE); 0062 0063 void AddDigiCollection(G4int DCID, G4VDigiCollection* aDC); 0064 0065 // Returns a pointer to a digi collection. 0066 // Returns `nullptr` if the particular collection is not stored in the current event. 0067 // The integer argument is ID number which is assigned by G4DigiManager 0068 // and the number can be obtained by G4DigiManager::GetDigiCollectionID() 0069 // method. 0070 inline G4VDigiCollection* GetDC(G4int i) const { return (*DC)[i]; } 0071 0072 // Return number of digi collections stored 0073 inline G4int GetNumberOfCollections() const 0074 { 0075 G4int n = 0; 0076 for (const G4VDigiCollection* dc : *DC) { 0077 if (dc != nullptr) ++n; 0078 } 0079 return n; 0080 } 0081 0082 inline std::size_t GetCapacity() const { return DC->size(); } 0083 0084 private: 0085 0086 std::vector<G4VDigiCollection*>* DC; 0087 }; 0088 0089 #if defined G4DIGI_ALLOC_EXPORT 0090 extern G4DLLEXPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_(); 0091 #else 0092 extern G4DLLIMPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_(); 0093 #endif 0094 0095 inline void* G4DCofThisEvent::operator new(std::size_t) 0096 { 0097 if (anDCoTHAllocator_G4MT_TLS_() == nullptr) { 0098 anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>; 0099 } 0100 return (void*)anDCoTHAllocator_G4MT_TLS_()->MallocSingle(); 0101 } 0102 0103 inline void G4DCofThisEvent::operator delete(void* anDCoTH) 0104 { 0105 anDCoTHAllocator_G4MT_TLS_()->FreeSingle((G4DCofThisEvent*)anDCoTH); 0106 } 0107 0108 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |