Back to home page

EIC code displayed by LXR

 
 

    


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

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 ExGflashHit.hh
0028 /// \brief Definition of the ExGflashHit class
0029 //
0030 #ifndef ExGflashHit_h
0031 #define ExGflashHit_h 1
0032 
0033 #include "G4Allocator.hh"
0034 #include "G4RotationMatrix.hh"
0035 #include "G4THitsCollection.hh"
0036 #include "G4ThreeVector.hh"
0037 #include "G4VHit.hh"
0038 
0039 class G4LogicalVolume;
0040 
0041 class ExGflashHit : public G4VHit
0042 {
0043   public:
0044     ExGflashHit();
0045     ExGflashHit(G4LogicalVolume* logVol);
0046     ~ExGflashHit() override;
0047     ExGflashHit(const ExGflashHit& right);
0048     const ExGflashHit& operator=(const ExGflashHit& right);
0049     G4bool operator==(const ExGflashHit& right) const;
0050 
0051     inline void* operator new(size_t);
0052     inline void operator delete(void* aHit);
0053     void* operator new(size_t, void* p) { return p; }
0054 #ifndef G4NOT_ISO_DELETES
0055     void operator delete(void*, void*) {}
0056 #endif
0057 
0058     void Draw() override;
0059     void Print() override;
0060 
0061   private:
0062     G4double fEdep;
0063     G4ThreeVector fPos;
0064     G4int fCrystalNumber;
0065     G4ThreeVector fStart;
0066     G4RotationMatrix fRot;
0067     const G4LogicalVolume* fLogV;
0068 
0069   public:
0070     inline void SetEdep(G4double de) { fEdep = de; };
0071     inline void AddEdep(G4double de) { fEdep += de; };
0072     inline G4double GetEdep() { return fEdep; };
0073     inline void SetPos(G4ThreeVector xyz) { fPos = xyz; };
0074     inline G4int GetCrystalNum() { return fCrystalNumber; };
0075     inline void SetCrystalNum(G4int num) { fCrystalNumber = num; };
0076     inline G4ThreeVector GetPos() { return fPos; };
0077     inline void SetStart(G4ThreeVector xyz) { fStart = xyz; };
0078     inline G4ThreeVector GetStart() { return fStart; };
0079 
0080     inline void SetRot(G4RotationMatrix rmat) { fRot = rmat; };
0081     inline G4RotationMatrix GetRot() { return fRot; };
0082     inline const G4LogicalVolume* GetLogV() { return fLogV; };
0083 };
0084 
0085 using ExGflashHitsCollection = G4THitsCollection<ExGflashHit>;
0086 
0087 extern G4ThreadLocal G4Allocator<ExGflashHit>* ExGflashHitAllocator;
0088 
0089 inline void* ExGflashHit::operator new(size_t)
0090 {
0091   if (!ExGflashHitAllocator) ExGflashHitAllocator = new G4Allocator<ExGflashHit>;
0092   return (void*)ExGflashHitAllocator->MallocSingle();
0093 }
0094 
0095 inline void ExGflashHit::operator delete(void* aHit)
0096 {
0097   ExGflashHitAllocator->FreeSingle((ExGflashHit*)aHit);
0098 }
0099 
0100 #endif