Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 /// \file optical/LXe/include/LXePMTHit.hh 28 /// \brief Definition of the LXePMTHit class 29 // 30 // 31 #ifndef LXePMTHit_h 32 #define LXePMTHit_h 1 33 34 #include "G4Allocator.hh" 35 #include "G4LogicalVolume.hh" 36 #include "G4THitsCollection.hh" 37 #include "G4VHit.hh" 38 #include "G4VPhysicalVolume.hh" 39 40 class LXePMTHit : public G4VHit 41 { 42 public: 43 LXePMTHit() = default; 44 LXePMTHit(const LXePMTHit& right); 45 ~LXePMTHit() override = default; 46 47 const LXePMTHit& operator=(const LXePMTHit& right); 48 G4bool operator==(const LXePMTHit& right) const; 49 50 inline void* operator new(size_t); 51 inline void operator delete(void* aHit); 52 53 void Draw() override; 54 void Print() override; 55 56 inline void SetDrawit(G4bool b) { fDrawit = b; } 57 inline G4bool GetDrawit() { return fDrawit; } 58 59 inline void IncPhotonCount() { ++fPhotons; } 60 inline G4int GetPhotonCount() { return fPhotons; } 61 62 inline void SetPMTNumber(G4int n) { fPmtNumber = n; } 63 inline G4int GetPMTNumber() { return fPmtNumber; } 64 65 inline void SetPMTPhysVol(G4VPhysicalVolume* physVol) { fPhysVol = physVol; } 66 inline G4VPhysicalVolume* GetPMTPhysVol() { return fPhysVol; } 67 68 inline void SetPMTPos(G4double x, G4double y, G4double z) { fPos = G4ThreeVector(x, y, z); } 69 70 inline G4ThreeVector GetPMTPos() { return fPos; } 71 72 private: 73 G4int fPmtNumber = -1; 74 G4int fPhotons = 0; 75 G4ThreeVector fPos; 76 G4VPhysicalVolume* fPhysVol = nullptr; 77 G4bool fDrawit = false; 78 }; 79 80 typedef G4THitsCollection<LXePMTHit> LXePMTHitsCollection; 81 82 extern G4ThreadLocal G4Allocator<LXePMTHit>* LXePMTHitAllocator; 83 84 inline void* LXePMTHit::operator new(size_t) 85 { 86 if (!LXePMTHitAllocator) LXePMTHitAllocator = new G4Allocator<LXePMTHit>; 87 return (void*)LXePMTHitAllocator->MallocSingle(); 88 } 89 90 inline void LXePMTHit::operator delete(void* aHit) 91 { 92 LXePMTHitAllocator->FreeSingle((LXePMTHit*)aHit); 93 } 94 95 #endif 96