Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:17

0001 #include <cassert>
0002 #include "OPTICKS_LOG.hh"
0003 #include "SEvt.hh"
0004 #include "SProcessHits_EPH.h"
0005 #include "NPFold.h"
0006 
0007 int main(int argc, char** argv)
0008 {
0009     OPTICKS_LOG(argc, argv);
0010 
0011     SEvt* evt = SEvt::Create(SEvt::EGPU);   // instanciation may load input_photons
0012     assert(evt);
0013 
0014     std::cout << SEvt::DescINSTANCE() ;
0015 
0016 
0017     bool ip = SEvt::HasInputPhoton(SEvt::EGPU) ;
0018 
0019 #ifdef WITH_OLD_FRAME
0020     sframe fr = sframe::Fabricate(0.f,0.f,1000.f) ;
0021     evt->setFrame(fr);
0022 #else
0023     sfr fr = sfr::MakeFromTranslateExtent<float>(0.f,0.f,1000.f,2000.f);
0024     evt->setFr(fr);
0025 #endif
0026 
0027 
0028     for(int i=0 ; i < 3 ; i++)
0029     {
0030         if(!ip) SEvt::AddTorchGenstep();
0031 
0032         evt->beginOfEvent(i);  // setIndex and does genstep setup for input photons
0033         assert( SEvt::Get(0) == evt );
0034 
0035         int npc = SEvt::GetNumPhotonCollected(0) ;
0036         for(int j=0 ; j < npc ; j++)
0037         {
0038             int track_id = j ;
0039             spho label = spho::Fabricate(track_id);
0040             evt->beginPhoton(label);
0041 
0042 
0043             sctx& ctx = evt->current_ctx ;
0044 
0045             ctx.p.set_flag(BOUNDARY_TRANSMIT);
0046             evt->pointPhoton(label);
0047 
0048             ctx.p.set_flag(BOUNDARY_TRANSMIT);
0049             evt->pointPhoton(label);
0050 
0051             ctx.p.set_flag(BOUNDARY_TRANSMIT);
0052             evt->pointPhoton(label);
0053 
0054             evt->addProcessHitsStamp(0);
0055             evt->addProcessHitsStamp(1);
0056 
0057             evt->addProcessHitsStamp(0);
0058             evt->addProcessHitsStamp(1);
0059 
0060             evt->addProcessHitsStamp(1);
0061 
0062 
0063             // currently needed to avoid consistent_flag assert in SEvt::finalPhoton
0064             ctx.p.set_flag(SURFACE_DETECT);
0065             label.set_eph(EPH::SAVENORM);
0066 
0067             evt->pointPhoton(label);
0068 
0069             evt->finalPhoton(label) ;  // sctx::end copies {seq,sup} into sevent arrays
0070         }
0071 
0072         std::cout << evt->descVec() << std::endl ;
0073 
0074 
0075         // see QSim::simulate for the needed incantation
0076         evt->gather();
0077         evt->topfold->concat();
0078         evt->topfold->clear_subfold();
0079 
0080 
0081         evt->endOfEvent(i);
0082 
0083         assert( SEvt::Get(0) == evt );
0084     }
0085 
0086     std::cout << evt->descDbg() ;
0087 
0088     return 0 ;
0089 }