Geant4 Cross Reference |
1 //******************************************** 1 2 // LocateInterruption_GammaAtExit.C 3 // Root command file 4 // Type: root LocateInterruption_GammaAtExit.C 5 // 6 // It is used by reading GammaAtExit.dat file 7 // 8 // 9 // More information is available in UserGuide 10 // Created by Z.LI LP2i Bordeaux 2022 11 //******************************************** 12 13 #include <math.h> 14 #include <stdint.h> 15 #include <stdio.h> 16 #include <string.h> 17 18 #include <vector> 19 20 struct ParticleInfo 21 { 22 float energy_keV; 23 float mx; 24 float my; 25 float mz; 26 }; 27 28 // struct ParticleInfo 29 // { 30 // float energy_keV; 31 // float mx; 32 // float my; 33 // float mz; 34 // float x; 35 // float y; 36 // float z; 37 // }; 38 39 struct RunInfo 40 { 41 // uint_16t 42 uint8_t projectionIndex; // 1 byte 43 uint16_t sliceIndex; // 44 uint16_t pixelIndex; 45 uint32_t nbParticle; // 4 bytes int 46 }; 47 48 void LocateInterruption_GammaAtExit() 49 { 50 FILE* input = fopen("../build/GammaAtExit_1. 51 if (input == NULL) { 52 printf("error for opening the input file\n 53 return; 54 } 55 56 RunInfo runInfo; 57 int projection = 0; // the projection when 58 59 //****************************************** 60 //**************************Detection parame 61 //****************************************** 62 63 const int nbProjection = 10; 64 const int nbSlice = 1; 65 const int nbPixel = 20; 66 67 //****************************************** 68 //**************************Detection parame 69 //****************************************** 70 71 int runID = -1; 72 while (fread(&runInfo, sizeof(RunInfo), 1, i 73 runID++; 74 75 runInfo.projectionIndex = runID / (nbSlice 76 int remain = runID % (nbSlice * nbPixel); 77 runInfo.sliceIndex = remain / nbPixel; 78 runInfo.pixelIndex = remain % nbPixel; 79 80 int nbParticle = runInfo.nbParticle; 81 std::vector<ParticleInfo> gammaAtExit(nbPa 82 fread(&gammaAtExit[0], sizeof(ParticleInfo 83 84 printf("---------ProjectionIndex=%d, Slice 85 runInfo.projectionIndex, runInfo.sl 86 87 projection = runInfo.projectionIndex; 88 } 89 90 printf("-----------------------It is interru 91 projection); 92 fclose(input); 93 } 94