File indexing completed on 2026-04-10 07:50:30
0001 #pragma once
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "scuda.h"
0012 #include "sphoton.h"
0013 #include "sphit.h"
0014
0015 #include "SEvt.hh"
0016 #include "U4Hit.h"
0017 #include "U4ThreeVector.h"
0018
0019 struct U4HitGet
0020 {
0021 static void ConvertFromPhoton(U4Hit& hit, const sphoton& global, const sphoton& local, const sphit& ht );
0022 static void FromEvt_EGPU(U4Hit& hit, unsigned idx );
0023 static void FromEvt_ECPU(U4Hit& hit, unsigned idx );
0024 static void FromEvt(U4Hit& hit, unsigned idx, int eidx );
0025 };
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 inline void U4HitGet::ConvertFromPhoton(U4Hit& hit, const sphoton& global, const sphoton& local, const sphit& ht )
0036 {
0037 hit.zero();
0038
0039 U4ThreeVector::FromFloat3( hit.global_position, global.pos );
0040 U4ThreeVector::FromFloat3( hit.global_direction, global.mom );
0041 U4ThreeVector::FromFloat3( hit.global_polarization, global.pol );
0042
0043 hit.time = double(global.time) ;
0044 hit.weight = 1. ;
0045 hit.wavelength = double(global.wavelength);
0046
0047 U4ThreeVector::FromFloat3( hit.local_position, local.pos );
0048 U4ThreeVector::FromFloat3( hit.local_direction, local.mom );
0049 U4ThreeVector::FromFloat3( hit.local_polarization, local.pol );
0050
0051 hit.sensorIndex = ht.sensor_index ;
0052 hit.sensor_identifier = ht.sensor_identifier ;
0053 hit.nodeIndex = -1 ;
0054
0055 hit.boundary = global.boundary() ;
0056 hit.photonIndex = global.get_index() ;
0057 hit.flag_mask = global.flagmask ;
0058 hit.is_cerenkov = global.is_cerenkov() ;
0059 hit.is_reemission = global.is_reemit() ;
0060 }
0061
0062
0063 inline void U4HitGet::FromEvt_EGPU(U4Hit& hit, unsigned idx ){ FromEvt(hit, idx, SEvt::EGPU); }
0064 inline void U4HitGet::FromEvt_ECPU(U4Hit& hit, unsigned idx ){ FromEvt(hit, idx, SEvt::ECPU); }
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081 inline void U4HitGet::FromEvt(U4Hit& hit, unsigned idx, int eidx )
0082 {
0083 sphoton global ;
0084 sphoton local ;
0085
0086 SEvt* sev = SEvt::Get(eidx);
0087 sev->getHit( global, idx);
0088
0089 sphit ht ;
0090 sev->getLocalHit( ht, local, idx);
0091
0092 ConvertFromPhoton(hit, global, local, ht );
0093 }
0094
0095
0096