Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-30 07:50:59

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