Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 08:37:32

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 SAXSSensitiveDetectorHit.hh
0027 /// \brief Definition of the SAXSSensitiveDetectorHit class
0028 
0029 #ifndef SAXSSensitiveDetectorHit_h
0030 #define SAXSSensitiveDetectorHit_h 1
0031 
0032 #include "G4Allocator.hh"
0033 #include "G4LogicalVolume.hh"
0034 #include "G4RotationMatrix.hh"
0035 #include "G4THitsCollection.hh"
0036 #include "G4ThreeVector.hh"
0037 #include "G4Transform3D.hh"
0038 #include "G4VHit.hh"
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 
0042 /// Sensitive Detector hit
0043 ///
0044 /// It records:
0045 /// - the spatial coordinate of the hit
0046 /// - the time at which the hit occurred
0047 /// - the type, ID, weight, momentum and energy of the impinging particle
0048 /// - the ID of the impinging particle parent
0049 
0050 class SAXSSensitiveDetectorHit : public G4VHit
0051 {
0052   public:
0053     SAXSSensitiveDetectorHit();
0054     SAXSSensitiveDetectorHit(const SAXSSensitiveDetectorHit& right);
0055     virtual ~SAXSSensitiveDetectorHit() { ; }
0056 
0057     const SAXSSensitiveDetectorHit& operator=(const SAXSSensitiveDetectorHit& right);
0058 
0059     int operator==(const SAXSSensitiveDetectorHit& right) const;
0060 
0061     inline void* operator new(size_t);
0062     inline void operator delete(void* aHit);
0063 
0064     virtual void Draw();
0065     virtual void Print();
0066 
0067   private:
0068     G4int fTrackID;
0069     G4int fTrackIDP;
0070     G4double fTime;
0071     G4ThreeVector fPos;
0072     G4ThreeVector fMom;
0073     G4double fEnergy;
0074     G4int fType;
0075     G4double fWeight;
0076 
0077   public:
0078     inline void SetTrackID(G4int z) { fTrackID = z; }
0079     inline G4int GetTrackID() const { return fTrackID; }
0080 
0081     inline void SetTrackIDP(G4int z) { fTrackIDP = z; }
0082     inline G4int GetTrackIDP() const { return fTrackIDP; }
0083 
0084     inline void SetTime(G4double t) { fTime = t; }
0085     inline G4double GetTime() const { return fTime; }
0086 
0087     inline void SetPos(G4ThreeVector xyz) { fPos = xyz; }
0088     inline G4ThreeVector GetPos() const { return fPos; }
0089 
0090     inline void SetMom(G4ThreeVector xyz) { fMom = xyz; }
0091     inline G4ThreeVector GetMom() const { return fMom; }
0092 
0093     inline void SetEnergy(G4double energy) { fEnergy = energy; }
0094     inline G4double GetEnergy() const { return fEnergy; }
0095 
0096     inline void SetType(G4int type) { fType = type; }
0097     inline G4int GetType() const { return fType; }
0098 
0099     inline void SetWeight(G4double weight) { fWeight = weight; }
0100     inline G4double GetWeight() const { return fWeight; }
0101 };
0102 
0103 using SensitiveDetectorHitsCollection = G4THitsCollection<SAXSSensitiveDetectorHit>;
0104 
0105 extern G4ThreadLocal G4Allocator<SAXSSensitiveDetectorHit>* hitAllocator;
0106 
0107 inline void* SAXSSensitiveDetectorHit::operator new(size_t)
0108 {
0109   if (!hitAllocator) {
0110     hitAllocator = new G4Allocator<SAXSSensitiveDetectorHit>;
0111   }
0112   return hitAllocator->MallocSingle();
0113 }
0114 
0115 inline void SAXSSensitiveDetectorHit::operator delete(void* aHit)
0116 {
0117   if (!hitAllocator) {
0118     hitAllocator = new G4Allocator<SAXSSensitiveDetectorHit>;
0119   }
0120   hitAllocator->FreeSingle((SAXSSensitiveDetectorHit*)aHit);
0121 }
0122 
0123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0124 
0125 #endif