File indexing completed on 2025-01-18 09:17:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <math.h>
0014 #include <stdint.h>
0015 #include <stdio.h>
0016 #include <string.h>
0017
0018 #include <vector>
0019
0020 struct ParticleInfo
0021 {
0022 float energy_keV;
0023 float mx;
0024 float my;
0025 float mz;
0026 };
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 struct RunInfo
0040 {
0041
0042 uint8_t projectionIndex;
0043 uint16_t sliceIndex;
0044 uint16_t pixelIndex;
0045 uint32_t nbParticle;
0046 };
0047
0048 void LocateInterruption_ProtonAtExit()
0049 {
0050 FILE* input = fopen("../build/ProtonAtExit_1.dat", "rb");
0051 if (input == NULL) {
0052 printf("error for opening the input file\n");
0053 return;
0054 }
0055
0056 RunInfo runInfo;
0057 int projection = 0;
0058
0059
0060
0061
0062
0063 const int nbProjection = 10;
0064 const int nbSlice = 128;
0065 const int nbPixel = 20;
0066
0067
0068
0069
0070
0071 int runID = -1;
0072 while (fread(&runInfo, sizeof(RunInfo), 1, input)) {
0073 runID++;
0074
0075 runInfo.projectionIndex = runID / (nbSlice * nbPixel);
0076 int remain = runID % (nbSlice * nbPixel);
0077 runInfo.sliceIndex = remain / nbPixel;
0078 runInfo.pixelIndex = remain % nbPixel;
0079
0080 int nbParticle = runInfo.nbParticle;
0081 std::vector<ParticleInfo> protonAtExit(nbParticle);
0082 fread(&protonAtExit[0], sizeof(ParticleInfo), nbParticle, input);
0083
0084 printf("---------ProjectionIndex=%d, SliceIndex=%d, PixelIndex=%d, nbParticle = %d\n",
0085 runInfo.projectionIndex, runInfo.sliceIndex, runInfo.pixelIndex, nbParticle);
0086
0087 projection = runInfo.projectionIndex;
0088 }
0089
0090 printf("-----------------------It is interrupted at ProjectionIndex = %d--------------------\n",
0091 projection);
0092 fclose(input);
0093 }