|
|
|||
File indexing completed on 2026-04-05 07:49:37
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 /// \file CalorHit.hh 0027 /// \brief Definition of the B4c::CalorHit class 0028 0029 #ifndef B4cCalorHit_h 0030 #define B4cCalorHit_h 1 0031 0032 #include "G4Allocator.hh" 0033 #include "G4THitsCollection.hh" 0034 #include "G4Threading.hh" 0035 #include "G4ThreeVector.hh" 0036 #include "G4VHit.hh" 0037 #include "globals.hh" 0038 0039 namespace B4c 0040 { 0041 0042 /// Calorimeter hit class 0043 /// 0044 /// It defines data members to store the the energy deposit and track lengths 0045 /// of charged particles in a selected volume: 0046 /// - fEdep, fTrackLength 0047 0048 class CalorHit : public G4VHit 0049 { 0050 public: 0051 CalorHit() = default; 0052 CalorHit(const CalorHit&) = default; 0053 ~CalorHit() override = default; 0054 0055 // operators 0056 CalorHit& operator=(const CalorHit&) = default; 0057 G4bool operator==(const CalorHit&) const; 0058 0059 inline void* operator new(size_t); 0060 inline void operator delete(void*); 0061 0062 // methods from base class 0063 void Draw() override {} 0064 void Print() override; 0065 0066 // methods to handle data 0067 void Add(G4double de, G4double dl); 0068 0069 // get methods 0070 G4double GetEdep() const; 0071 G4double GetTrackLength() const; 0072 0073 private: 0074 G4double fEdep = 0.; ///< Energy deposit in the sensitive volume 0075 G4double fTrackLength = 0.; ///< Track length in the sensitive volume 0076 }; 0077 0078 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0079 0080 using CalorHitsCollection = G4THitsCollection<CalorHit>; 0081 0082 extern G4ThreadLocal G4Allocator<CalorHit>* CalorHitAllocator; 0083 0084 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0085 0086 inline void* CalorHit::operator new(size_t) 0087 { 0088 if (!CalorHitAllocator) { 0089 CalorHitAllocator = new G4Allocator<CalorHit>; 0090 } 0091 void* hit; 0092 hit = (void*)CalorHitAllocator->MallocSingle(); 0093 return hit; 0094 } 0095 0096 inline void CalorHit::operator delete(void* hit) 0097 { 0098 if (!CalorHitAllocator) { 0099 CalorHitAllocator = new G4Allocator<CalorHit>; 0100 } 0101 CalorHitAllocator->FreeSingle((CalorHit*)hit); 0102 } 0103 0104 inline void CalorHit::Add(G4double de, G4double dl) 0105 { 0106 fEdep += de; 0107 fTrackLength += dl; 0108 } 0109 0110 inline G4double CalorHit::GetEdep() const 0111 { 0112 return fEdep; 0113 } 0114 0115 inline G4double CalorHit::GetTrackLength() const 0116 { 0117 return fTrackLength; 0118 } 0119 0120 } // namespace B4c 0121 0122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0123 0124 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|