![]() |
|
|||
File indexing completed on 2025-02-23 09:21:44
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 // 0027 /// \file medical/DICOM/include/DicomRun.hh 0028 /// \brief Definition of the DicomRun class 0029 // 0030 0031 #ifndef DicomRun_h 0032 #define DicomRun_h 1 0033 0034 #include "G4Event.hh" 0035 #include "G4Run.hh" 0036 #include "G4THitsMap.hh" 0037 0038 #include <vector> 0039 0040 //--------------------------------------------------------------------- 0041 /// DicomRun class 0042 /// 0043 /// Example implementation for multi-functional-detector and 0044 /// primitive scorer. 0045 /// This DicomRun class has collections which accumulate 0046 /// a event information into a run information. 0047 //--------------------------------------------------------------------- 0048 0049 class DicomRun : public G4Run 0050 { 0051 public: 0052 // constructor and destructor. 0053 // vector of multifunctionaldetector name has to given to constructor. 0054 DicomRun(); 0055 DicomRun(const std::vector<G4String> mfdName); 0056 virtual ~DicomRun(); 0057 0058 // virtual method from G4Run. 0059 // The method is overriden in this class for scoring. 0060 virtual void RecordEvent(const G4Event*); 0061 0062 // Access methods for scoring information. 0063 // - Number of HitsMap for this RUN. 0064 // This is equal to number of collections. 0065 size_t GetNumberOfHitsMap() const { return fRunMap.size(); } 0066 // - Get HitsMap of this RUN. 0067 // by sequential number, by multifucntional name and collection name, 0068 // and by collection name with full path. 0069 G4THitsMap<G4double>* GetHitsMap(G4int i) const { return fRunMap[i]; } 0070 G4THitsMap<G4double>* GetHitsMap(const G4String& detName, const G4String& colName) const; 0071 G4THitsMap<G4double>* GetHitsMap(const G4String& fullName) const; 0072 0073 void ConstructMFD(const std::vector<G4String>&); 0074 0075 virtual void Merge(const G4Run*); 0076 0077 private: 0078 std::vector<G4String> fCollName; 0079 std::vector<G4int> fCollID; 0080 std::vector<G4THitsMap<G4double>*> fRunMap; 0081 }; 0082 0083 //========================================================================== 0084 // Generic Functions to help with merge 0085 //========================================================================== 0086 template<typename T> 0087 inline void Copy(std::vector<T>& main, const std::vector<T>& data) 0088 { 0089 for (size_t i = main.size(); i < data.size(); ++i) { 0090 main.push_back(data.at(i)); 0091 } 0092 } 0093 //========================================================================== 0094 template<typename T> 0095 inline size_t Copy(std::vector<T*>& main, const std::vector<T*>& data) 0096 { 0097 size_t size_diff = data.size() - main.size(); 0098 for (size_t i = main.size(); i < data.size(); ++i) { 0099 main.push_back(new T(*data.at(i))); 0100 } 0101 return size_diff; 0102 } 0103 //========================================================================== 0104 template<typename T> 0105 inline void Print(const std::vector<T>& data) 0106 { 0107 G4cout << G4endl; 0108 for (size_t i = 0; i < data.size(); ++i) { 0109 G4cout << "\t\t" << i << " \t\t " << data.at(i) << G4endl; 0110 } 0111 G4cout << G4endl; 0112 } 0113 //========================================================================== 0114 0115 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |