Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:21

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 optical/LXe/include/LXePMTHit.hh
0028 /// \brief Definition of the LXePMTHit class
0029 //
0030 //
0031 #ifndef LXePMTHit_h
0032 #define LXePMTHit_h 1
0033 
0034 #include "G4Allocator.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4THitsCollection.hh"
0037 #include "G4VHit.hh"
0038 #include "G4VPhysicalVolume.hh"
0039 
0040 class LXePMTHit : public G4VHit
0041 {
0042   public:
0043     LXePMTHit() = default;
0044     LXePMTHit(const LXePMTHit& right);
0045     ~LXePMTHit() override = default;
0046 
0047     const LXePMTHit& operator=(const LXePMTHit& right);
0048     G4bool operator==(const LXePMTHit& right) const;
0049 
0050     inline void* operator new(size_t);
0051     inline void operator delete(void* aHit);
0052 
0053     void Draw() override;
0054     void Print() override;
0055 
0056     inline void SetDrawit(G4bool b) { fDrawit = b; }
0057     inline G4bool GetDrawit() { return fDrawit; }
0058 
0059     inline void IncPhotonCount() { ++fPhotons; }
0060     inline G4int GetPhotonCount() { return fPhotons; }
0061 
0062     inline void SetPMTNumber(G4int n) { fPmtNumber = n; }
0063     inline G4int GetPMTNumber() { return fPmtNumber; }
0064 
0065     inline void SetPMTPhysVol(G4VPhysicalVolume* physVol) { fPhysVol = physVol; }
0066     inline G4VPhysicalVolume* GetPMTPhysVol() { return fPhysVol; }
0067 
0068     inline void SetPMTPos(G4double x, G4double y, G4double z) { fPos = G4ThreeVector(x, y, z); }
0069 
0070     inline G4ThreeVector GetPMTPos() { return fPos; }
0071 
0072   private:
0073     G4int fPmtNumber = -1;
0074     G4int fPhotons = 0;
0075     G4ThreeVector fPos;
0076     G4VPhysicalVolume* fPhysVol = nullptr;
0077     G4bool fDrawit = false;
0078 };
0079 
0080 typedef G4THitsCollection<LXePMTHit> LXePMTHitsCollection;
0081 
0082 extern G4ThreadLocal G4Allocator<LXePMTHit>* LXePMTHitAllocator;
0083 
0084 inline void* LXePMTHit::operator new(size_t)
0085 {
0086   if (!LXePMTHitAllocator) LXePMTHitAllocator = new G4Allocator<LXePMTHit>;
0087   return (void*)LXePMTHitAllocator->MallocSingle();
0088 }
0089 
0090 inline void LXePMTHit::operator delete(void* aHit)
0091 {
0092   LXePMTHitAllocator->FreeSingle((LXePMTHit*)aHit);
0093 }
0094 
0095 #endif