Back to home page

EIC code displayed by LXR

 
 

    


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

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