Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #pragma once
0002 
0003 /**
0004 sscint.h : replace (but stay similar to) : npy/NStep.hpp optixrap/cu/scintillationstep.h
0005 ============================================================================================
0006 
0007 * FOLLOWING PATTERN OF storch.h and scerenkov.h
0008 
0009 For now just implemnet for JUNO specific variant : collectGenstep_DsG4Scintillation_r4695
0010 
0011 **/
0012 
0013 
0014 #if defined(__CUDACC__) || defined(__CUDABE__)
0015    #define SSCINT_METHOD __device__
0016 #else
0017    #define SSCINT_METHOD
0018 #endif
0019 
0020 #include "OpticksGenstep.h"
0021 #include "OpticksPhoton.h"
0022 
0023 //#include "scurand.h"
0024 #include "scuda.h"
0025 #include "smath.h"
0026 #include "squad.h"
0027 
0028 #if defined(__CUDACC__) || defined(__CUDABE__)
0029 #else
0030 #include <string>
0031 #endif
0032 
0033 
0034 struct sscint
0035 {
0036     // ctrl
0037     unsigned gentype ;
0038     unsigned trackid ;
0039     unsigned matline ;
0040     unsigned numphoton ;
0041 
0042     float3   pos ;  // formerly x0
0043     float    time ; // formerly t0
0044 
0045     float3 DeltaPosition ;
0046     float  step_length ;
0047 
0048     int code;
0049     float charge ;
0050     float weight ;
0051     float meanVelocity ;
0052 
0053     int   scnt ;
0054     float f41 ;
0055     float f42 ;
0056     float f43 ;
0057 
0058     float ScintillationTime ;
0059     float f51 ;
0060     float f52 ;
0061     float f53 ;
0062 
0063 
0064 #if defined(__CUDACC__) || defined(__CUDABE__)
0065 #else
0066    float* cdata() const {  return (float*)&gentype ; }
0067    static void FillGenstep( sscint& gs, int genstep_id, int numphoton_per_genstep, bool dump ) ;
0068    std::string desc() const ;
0069 
0070 
0071 
0072 #endif
0073 
0074 };
0075 
0076 
0077 #if defined(__CUDACC__) || defined(__CUDABE__)
0078 #else
0079 #include <sstream>
0080 
0081 inline void sscint::FillGenstep( sscint& gs, int genstep_id, int numphoton_per_genstep, bool dump )
0082 {
0083     gs.gentype = OpticksGenstep_SCINTILLATION ;
0084     gs.trackid = 0u ;
0085     gs.matline = 0u ;
0086     gs.numphoton = numphoton_per_genstep  ;
0087 
0088     // fabricate some values for the genstep
0089 
0090     gs.pos.x = 100.f ;
0091     gs.pos.y = 100.f ;
0092     gs.pos.z = 100.f ;
0093     gs.time = 20.f ;
0094 
0095     gs.DeltaPosition.x = 1000.f ;
0096     gs.DeltaPosition.y = 1000.f ;
0097     gs.DeltaPosition.z = 1000.f ;
0098     gs.step_length = 1000.f ;
0099 
0100     gs.code = 1 ;
0101     gs.charge = 1.f ;
0102     gs.weight = 1.f ;
0103     gs.meanVelocity = 10.f ;
0104 
0105     gs.scnt = 0 ;
0106     gs.f41 = 0.f ;
0107     gs.f42 = 0.f ;
0108     gs.f43 = 0.f ;
0109 
0110     gs.ScintillationTime = 10.f ;
0111     gs.f51 = 0.f ;
0112     gs.f52 = 0.f ;
0113     gs.f53 = 0.f ;
0114 }
0115 
0116 inline std::string sscint::desc() const
0117 {
0118     std::stringstream ss ;
0119     ss << "sscint::desc"
0120        << " gentype " << gentype
0121        << " numphoton " << numphoton
0122        << " pos ("
0123        << " " << std::setw(7) << std::fixed << std::setprecision(2) << pos.x
0124        << " " << std::setw(7) << std::fixed << std::setprecision(2) << pos.y
0125        << " " << std::setw(7) << std::fixed << std::setprecision(2) << pos.z
0126        << ") "
0127        << " ScintillationTime " << ScintillationTime
0128        ;
0129     std::string s = ss.str();
0130     return s ;
0131 }
0132 
0133 
0134 #endif
0135