File indexing completed on 2026-04-10 07:50:27
0001 #include "Deprecated_U4PhotonInfo.h"
0002 #include "U4Track.h"
0003 #include <iostream>
0004 #include <csignal>
0005
0006
0007 void test_SetGet()
0008 {
0009 G4Track* track = U4Track::MakePhoton();
0010 spho p0 = {1, 2, 3, {0,0,0,0}} ;
0011 Deprecated_U4PhotonInfo::Set(track, p0 );
0012 const G4Track* ctrack = track ;
0013 spho p1 = Deprecated_U4PhotonInfo::Get(ctrack);
0014 assert( p1.isIdentical(p0) );
0015
0016 std::cout
0017 << " track " << track << std::endl
0018 << " p0 " << p0.desc() << std::endl
0019 << " p1 " << p1.desc() << std::endl
0020 ;
0021 }
0022
0023 void test_GetRef()
0024 {
0025 G4Track* track = U4Track::MakePhoton();
0026 spho p0 = {1, 2, 3, {0,0,0,0}} ;
0027 Deprecated_U4PhotonInfo::Set(track, p0 );
0028 const G4Track* ctrack = track ;
0029 spho p1 = Deprecated_U4PhotonInfo::Get(ctrack);
0030 bool p1_expect = p1.isIdentical(p0) ;
0031 assert( p1_expect );
0032 if(!p1_expect) std::raise(SIGINT);
0033
0034 spho* p2 = Deprecated_U4PhotonInfo::GetRef(ctrack);
0035 bool p2_expect = p2->isIdentical(p0) ;
0036 assert( p2_expect );
0037 if(!p2_expect) std::raise(SIGINT);
0038
0039 std::cout << " p2 " << p2->desc() << " p2 from Deprecated_U4PhotonInfo::GetRef(ctrack) " << std::endl ;
0040
0041 p2->set_gen(10);
0042 p2->set_flg(101);
0043 std::cout << " p2 " << p2->desc() << " after p2->set_flg(101) p2->set_gen(10) " << std::endl ;
0044
0045 spho p3 = Deprecated_U4PhotonInfo::Get(ctrack);
0046 std::cout << " p3 " << p3.desc() << " Deprecated_U4PhotonInfo::Get(ctrack) by value reflects the change made using the pointer " << std::endl ;
0047
0048
0049 }
0050
0051
0052
0053 int main()
0054 {
0055
0056
0057
0058 test_GetRef();
0059
0060
0061
0062 return 0 ;
0063 }