Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:50:30

0001 #pragma once
0002 #include <string>
0003 #include <sstream>
0004 #include <cstdint>
0005 
0006 #include "G4Types.hh"
0007 #include "G4ThreeVector.hh"
0008 
0009 /**1
0010 U4Hit 
0011 ------
0012 
0013 Type used in G4Opticks interface, NB all Geant4 types no Opticks ones.
0014 
0015 Note that Opticks does not use the Geant4 system of units approach, it 
0016 picks a standard set of units suited to optical physics and uses
0017 these unless described otherwise. 
0018 
0019 * distances (mm)
0020 * wavelength (nm)
0021 * energy (eV)
0022 * time (ns) 
0023 
0024 Reasons for this include that Opticks mostly uses float precision only 
0025 resorting to double precision where that is unavoidable. This is 
0026 contrary to Geant4 which uses double precision everywhere. 
0027 Also Opticks compartmentalizes its dependency on Geant4 headers to 
0028 only a few of its highest level sub-packages.
0029 
0030 1**/
0031 
0032 struct U4Hit 
0033 {
0034     G4ThreeVector local_position ; 
0035     G4ThreeVector global_position ; 
0036     G4double      time ; 
0037     G4ThreeVector local_direction ; 
0038     G4ThreeVector global_direction ; 
0039     G4double      weight ; 
0040     G4ThreeVector local_polarization ; 
0041     G4ThreeVector global_polarization ; 
0042     G4double      wavelength ; 
0043 
0044     G4int         boundary ;
0045     G4int         sensorIndex ;
0046     G4int         nodeIndex ;
0047     uint64_t      photonIndex ;
0048     G4int         flag_mask ; 
0049     G4int         sensor_identifier ; 
0050     G4bool        is_cerenkov ; 
0051     G4bool        is_reemission ; 
0052 
0053     void zero() ; 
0054     std::string desc() const ; 
0055 };
0056 
0057 
0058 #include "U4ThreeVector.h"
0059 
0060 inline void U4Hit::zero() 
0061 {
0062     local_position.set(0.,0.,0.); 
0063     global_position.set(0.,0.,0.); 
0064     time = 0. ; 
0065     local_direction.set(0.,0.,0.); 
0066     global_direction.set(0.,0.,0.); 
0067     weight = 0. ; 
0068     local_polarization.set(0.,0.,0.); 
0069     global_polarization.set(0.,0.,0.); 
0070     wavelength = 0. ; 
0071     boundary = 0 ; 
0072     sensorIndex = 0 ; 
0073     nodeIndex = 0 ; 
0074     photonIndex = 0 ; 
0075     flag_mask = 0 ; 
0076     sensor_identifier = 0 ; 
0077     is_cerenkov = false ; 
0078     is_reemission = false ; 
0079 }
0080 
0081 
0082 inline std::string U4Hit::desc() const
0083 {
0084     std::stringstream ss ; 
0085 
0086     ss << "U4Hit::desc" 
0087        << " lpos " << U4ThreeVector::Desc(local_position) 
0088        << " gpos " << U4ThreeVector::Desc(global_position) 
0089        ; 
0090 
0091     std::string s = ss.str(); 
0092     return s ; 
0093 }
0094 
0095 
0096 
0097 
0098 struct U4HitExtra
0099 {
0100     G4ThreeVector boundary_pos ; 
0101     G4double      boundary_time ;     
0102 
0103     G4double      origin_time ;     
0104     G4int         origin_trackID ; 
0105 };
0106 
0107 
0108 
0109