diff --git a/CMakeLists.txt b/CMakeLists.txt index ff249f8..dcee463 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,8 +73,6 @@ ENDMACRO (ADD_PCT_EXECUTABLE) # Executables IF(PCT_WITH_ROOT AND NOT WIN32) - ADD_PCT_EXECUTABLE(pctpairprotons pctpairprotons.cxx) - TARGET_LINK_LIBRARIES(pctpairprotons ${ROOT_LIBRARIES}) ADD_PCT_EXECUTABLE(pctpairprotonsLomaLinda pctpairprotonsLomaLinda.cxx) TARGET_LINK_LIBRARIES(pctpairprotonsLomaLinda ${ROOT_LIBRARIES}) ADD_PCT_EXECUTABLE(pctpairprotonsLMU_IMPCT pctpairprotonsLMU_IMPCT.cxx) diff --git a/gate/protonct.py b/gate/protonct.py new file mode 100644 index 0000000..edb0555 --- /dev/null +++ b/gate/protonct.py @@ -0,0 +1,155 @@ +import math +import argparse + +import opengate as gate +from scipy.spatial.transform import Rotation + + +def protonct(output, + projections=720, + protons_per_projection=1000, + visu=False, + verbose=False +): + + # Units + nm = gate.g4_units.nm + mm = gate.g4_units.mm + cm = gate.g4_units.cm + m = gate.g4_units.m + sec = gate.g4_units.second + MeV = gate.g4_units.MeV + Bq = gate.g4_units.Bq + + # Simulation + sim = gate.Simulation() + + sim.random_engine = 'MersenneTwister' + sim.random_seed = 'auto' + sim.check_volumes_overlap = False + sim.visu = visu + sim.visu_type = 'vrml' + sim.g4_verbose = False + sim.progress_bar = verbose + sim.number_of_threads = 1 + + sim.run_timing_intervals = [[j * sec, (j + 1) * sec] for j in range(projections)] + + # Misc + yellow = [1, 1, 0, .5] + blue = [0, 0, 1, .5] + + # Geometry + sim.volume_manager.add_material_database(gate.utility.get_contrib_path() / 'GateMaterials.db') + sim.world.material = 'Vacuum' + sim.world.size = [4 * m, 4 * m, 4 * m] + sim.world.color = [0, 0, 0, 0] + + # Phantom + + def add_spiral(sim): + # Mother of all + spiral = sim.add_volume('Tubs', name='Spiral') + spiral.rmin = 0 * cm + spiral.rmax = 10 * cm + spiral.dz = 40 * cm + spiral.material = 'Water' + spiral.color = blue + spiral.rotation = Rotation.from_euler('y', 90, degrees=True).as_matrix() + + # Spiral rotation + tr, rot = gate.geometry.utility.volume_orbiting_transform('x', 0, 360, projections, spiral.translation, spiral.rotation) + spiral.add_dynamic_parametrisation(translation=tr, rotation=rot) + + # Spiral inserts + sradius = 4 + radius = list(range(0, 100 - sradius // 2, sradius)) + sangle = 139 + angles = [math.radians(a) for a in range(0, sangle * len(radius), sangle)] + posx = [radius[i] * math.cos(angles[i]) for i in range(len(radius))] + posy = [radius[i] * math.sin(angles[i]) for i in range(len(radius))] + + def add_spiral_insert(sim, mother, name, rmin=0 * mm, rmax=1 * mm, dz=40 * cm, material='Aluminium', translation=None, color=None): + + if translation is None: + translation = [0 * mm, 0 * mm, 0 * mm] + + if color is None: + color = yellow + + spiral_insert = sim.add_volume('Tubs', name=name) + spiral_insert.mother = mother.name + spiral_insert.rmin = rmin + spiral_insert.rmax = rmax + spiral_insert.dz = dz + spiral_insert.material = material + spiral_insert.translation = translation + spiral_insert.color = color + + for i in range(len(radius)): + add_spiral_insert(sim, spiral, f'SpiralInsert{i:02d}', translation=[posx[i] * mm, posy[i] * mm, 0]) + + add_spiral(sim) + + # Beam + source = sim.add_source('GenericSource', 'mybeam') + source.particle = 'proton' + source.energy.mono = 200 * MeV + source.energy.type = 'mono' + source.position.type = 'box' + source.position.size = [16 * mm, 1 * nm, 1 * nm] + source.position.translation = [0, 0, -1060 * mm] + source.direction.type = 'focused' + source.direction.focus_point = [0, 0, -1000 * mm] + source.activity = protons_per_projection * Bq + + # Physics list + sim.physics_manager.physics_list_name = 'QGSP_BIC_EMZ' + + # Phase spaces + + def add_detector(sim, name, translation): + plane = sim.add_volume('Box', 'PlanePhaseSpace' + name) + plane.size = [400 * mm, 400 * mm, 1 * nm] + plane.translation = translation + plane.material = 'Vacuum' + plane.color = yellow + + phase_space = sim.add_actor('PhaseSpaceActor', 'PhaseSpace' + name) + phase_space.attached_to = plane.name + phase_space.attributes = [ + 'RunID', + 'EventID', + 'TrackID', + 'TrackCreatorProcess', + 'KineticEnergy', + 'Position', + 'Direction', + 'PreGlobalTime' + ] + phase_space.output_filename = f'{output}/PhaseSpace{name}.root' + + ps_filter = sim.add_filter('ParticleFilter', 'Filter' + name) + ps_filter.particle = 'proton' + phase_space.filters.append(ps_filter) + + add_detector(sim, 'In', [0, 0, -110 * mm]) + add_detector(sim, 'Out', [0, 0, 110 * mm]) + + # Particle stats + stat = sim.add_actor('SimulationStatisticsActor', 'stat') + stat.output_filename = f'{output}/protonct.txt' + + sim.run() + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('-o', '--output', help="Output folder", default='output') + parser.add_argument('-p', '--projections', help="Number of projections", default=720, type=int) + parser.add_argument('-n', '--protons-per-projection', help="Number of protons per projection", default=1000, type=int) + parser.add_argument('--visu', help="Enable visualization", default=False, action='store_true') + parser.add_argument('--verbose', help="Verbose execution", default=False, action='store_true') + args = parser.parse_args() + + protonct(**vars(args)) diff --git a/mac/AlCylInWatCyl.mac b/mac/AlCylInWatCyl.mac deleted file mode 100644 index 47af015..0000000 --- a/mac/AlCylInWatCyl.mac +++ /dev/null @@ -1,16 +0,0 @@ -# Mother of all -/gate/world/daughters/name WatCyl -/gate/world/daughters/insert cylinder -/gate/WatCyl/geometry/setRmin 0 mm -/gate/WatCyl/geometry/setRmax 100 mm -/gate/WatCyl/geometry/setHeight 10 m -/gate/WatCyl/setMaterial Water - -/gate/WatCyl/daughters/name AlCyl -/gate/WatCyl/daughters/insert cylinder -/gate/AlCyl/geometry/setRmin 0 mm -/gate/AlCyl/geometry/setRmax 20 mm -/gate/AlCyl/geometry/setHeight 10 m -/gate/AlCyl/placement/setTranslation 0 80 0 mm -/gate/AlCyl/setMaterial Aluminium - diff --git a/mac/beam.mac b/mac/beam.mac deleted file mode 100644 index dd44bc5..0000000 --- a/mac/beam.mac +++ /dev/null @@ -1,19 +0,0 @@ -/gate/source/addSource mybeam gps -/gate/source/mybeam/gps/particle proton -/gate/source/mybeam/gps/ene/mono 200 MeV -/gate/source/mybeam/gps/ene/type Mono -#/gate/source/mybeam/gps/ene/type Gauss -#/gate/source/mybeam/gps/ene/sigma 0.5 MeV -/gate/source/mybeam/gps/pos/halfx 8 mm -/gate/source/mybeam/gps/pos/halfy 1 mm -/gate/source/mybeam/gps/pos/centre 1060 0 0 mm -/gate/source/mybeam/gps/pos/rot1 0 1 0 -/gate/source/mybeam/gps/pos/rot2 0 0 1 -/gate/source/mybeam/gps/pos/type Plane -/gate/source/mybeam/gps/pos/shape Rectangle -/gate/source/mybeam/gps/direction -1 0 0 -/gate/source/mybeam/gps/ang/type focused -/gate/source/mybeam/gps/ang/rot1 0 1 0 -/gate/source/mybeam/gps/ang/rot2 0 0 1 -/gate/source/mybeam/gps/ang/focuspoint 1000 0 0 mm - diff --git a/mac/ctp528.mac b/mac/ctp528.mac deleted file mode 100644 index ecbf8a6..0000000 --- a/mac/ctp528.mac +++ /dev/null @@ -1,316 +0,0 @@ -# Mother of all -/gate/world/daughters/name Catphan -/gate/world/daughters/insert cylinder -/gate/Catphan/geometry/setRmin 0 mm -/gate/Catphan/geometry/setRmax 100 mm -#/gate/Catphan/geometry/setHeight 40 mm -/gate/Catphan/geometry/setHeight 400 m -/gate/Catphan/setMaterial Water - -# Beads -/gate/Catphan/daughters/name Beads -/gate/Catphan/daughters/insert sphere -/gate/Beads/placement/setTranslation 0 -20 2.5 mm -/gate/Beads/geometry/setRmin 0 mm -/gate/Beads/geometry/setRmax 0.28 mm -/gate/Beads/setMaterial Carbide -/gate/Beads/repeaters/insert linear -/gate/Beads/linear/setRepeatNumber 2 -/gate/Beads/linear/setRepeatVector 0 40 7.5 mm -/gate/Beads/linear/autoCenter false - -# Pairs of line -/gate/Catphan/daughters/name Line1 -/gate/Catphan/daughters/insert box -/gate/Line1/geometry/setXLength 5 mm -/gate/Line1/geometry/setZLength 2 mm -/gate/Line1/setMaterial Aluminium -/gate/Line1/repeaters/insert linear -/gate/Line1/linear/autoCenter false -/gate/Line1/placement/setRotationAxis 0 0 1 -/gate/Line1/geometry/setYLength 5.000000 mm -/gate/Line1/placement/setTranslation -45.828042 13.455132 0 mm -/gate/Line1/linear/setRepeatNumber 2 -/gate/Line1/linear/setRepeatVector -1.797166 -9.837184 0 mm -/gate/Line1/placement/setRotationAngle 169.646745 deg - -/gate/Catphan/daughters/name Line2 -/gate/Catphan/daughters/insert box -/gate/Line2/geometry/setXLength 5 mm -/gate/Line2/geometry/setZLength 2 mm -/gate/Line2/setMaterial Aluminium -/gate/Line2/repeaters/insert linear -/gate/Line2/linear/autoCenter false -/gate/Line2/placement/setRotationAxis 0 0 1 -/gate/Line2/geometry/setYLength 2.500000 mm -/gate/Line2/placement/setTranslation -35.475663 31.808644 0 mm -/gate/Line2/linear/setRepeatNumber 3 -/gate/Line2/linear/setRepeatVector -3.034553 -3.973850 0 mm -/gate/Line2/placement/setRotationAngle 142.633542 deg - -/gate/Catphan/daughters/name Line3 -/gate/Catphan/daughters/insert box -/gate/Line3/geometry/setXLength 5 mm -/gate/Line3/geometry/setZLength 2 mm -/gate/Line3/setMaterial Aluminium -/gate/Line3/repeaters/insert linear -/gate/Line3/linear/autoCenter false -/gate/Line3/placement/setRotationAxis 0 0 1 -/gate/Line3/geometry/setYLength 1.666667 mm -/gate/Line3/placement/setTranslation -17.709594 44.201034 0 mm -/gate/Line3/linear/setRepeatNumber 4 -/gate/Line3/linear/setRepeatVector -2.999841 -1.453294 0 mm -/gate/Line3/placement/setRotationAngle 115.848186 deg - -/gate/Catphan/daughters/name Line4 -/gate/Catphan/daughters/insert box -/gate/Line4/geometry/setXLength 5 mm -/gate/Line4/geometry/setZLength 2 mm -/gate/Line4/setMaterial Aluminium -/gate/Line4/repeaters/insert linear -/gate/Line4/linear/autoCenter false -/gate/Line4/placement/setRotationAxis 0 0 1 -/gate/Line4/geometry/setYLength 1.250000 mm -/gate/Line4/placement/setTranslation -3.549381 47.433131 0 mm -/gate/Line4/linear/setRepeatNumber 4 -/gate/Line4/linear/setRepeatVector -2.479779 -0.317324 0 mm -/gate/Line4/placement/setRotationAngle 97.292206 deg - -/gate/Catphan/daughters/name Line5 -/gate/Catphan/daughters/insert box -/gate/Line5/geometry/setXLength 5 mm -/gate/Line5/geometry/setZLength 2 mm -/gate/Line5/setMaterial Aluminium -/gate/Line5/repeaters/insert linear -/gate/Line5/linear/autoCenter false -/gate/Line5/placement/setRotationAxis 0 0 1 -/gate/Line5/geometry/setYLength 1.000000 mm -/gate/Line5/placement/setTranslation 12.400601 45.896352 0 mm -/gate/Line5/linear/setRepeatNumber 4 -/gate/Line5/linear/setRepeatVector -1.951004 0.439983 0 mm -/gate/Line5/placement/setRotationAngle 77.291465 deg - -/gate/Catphan/daughters/name Line6 -/gate/Catphan/daughters/insert box -/gate/Line6/geometry/setXLength 5 mm -/gate/Line6/geometry/setZLength 2 mm -/gate/Line6/setMaterial Aluminium -/gate/Line6/repeaters/insert linear -/gate/Line6/linear/autoCenter false -/gate/Line6/placement/setRotationAxis 0 0 1 -/gate/Line6/geometry/setYLength 0.833333 mm -/gate/Line6/placement/setTranslation 26.753758 39.304284 0 mm -/gate/Line6/linear/setRepeatNumber 5 -/gate/Line6/linear/setRepeatVector -1.417543 0.876555 0 mm -/gate/Line6/placement/setRotationAngle 58.268910 deg - -/gate/Catphan/daughters/name Line7 -/gate/Catphan/daughters/insert box -/gate/Line7/geometry/setXLength 5 mm -/gate/Line7/geometry/setZLength 2 mm -/gate/Line7/setMaterial Aluminium -/gate/Line7/repeaters/insert linear -/gate/Line7/linear/autoCenter false -/gate/Line7/placement/setRotationAxis 0 0 1 -/gate/Line7/geometry/setYLength 0.714286 mm -/gate/Line7/placement/setTranslation 37.882809 28.711174 0 mm -/gate/Line7/linear/setRepeatNumber 5 -/gate/Line7/linear/setRepeatVector -0.905047 1.105308 0 mm -/gate/Line7/placement/setRotationAngle 39.311253 deg - -/gate/Catphan/daughters/name Line8 -/gate/Catphan/daughters/insert box -/gate/Line8/geometry/setXLength 5 mm -/gate/Line8/geometry/setZLength 2 mm -/gate/Line8/setMaterial Aluminium -/gate/Line8/repeaters/insert linear -/gate/Line8/linear/autoCenter false -/gate/Line8/placement/setRotationAxis 0 0 1 -/gate/Line8/geometry/setYLength 0.625000 mm -/gate/Line8/placement/setTranslation 44.530180 16.605857 0 mm -/gate/Line8/linear/setRepeatNumber 5 -/gate/Line8/linear/setRepeatVector -0.475030 1.156221 0 mm -/gate/Line8/placement/setRotationAngle 22.335160 deg - -/gate/Catphan/daughters/name Line9 -/gate/Catphan/daughters/insert box -/gate/Line9/geometry/setXLength 5 mm -/gate/Line9/geometry/setZLength 2 mm -/gate/Line9/setMaterial Aluminium -/gate/Line9/repeaters/insert linear -/gate/Line9/linear/autoCenter false -/gate/Line9/placement/setRotationAxis 0 0 1 -/gate/Line9/geometry/setYLength 0.555556 mm -/gate/Line9/placement/setTranslation 47.359156 3.910156 0 mm -/gate/Line9/linear/setRepeatNumber 5 -/gate/Line9/linear/setRepeatVector -0.123752 1.104198 0 mm -/gate/Line9/placement/setRotationAngle 6.394694 deg - -/gate/Catphan/daughters/name Line10 -/gate/Catphan/daughters/insert box -/gate/Line10/geometry/setXLength 5 mm -/gate/Line10/geometry/setZLength 2 mm -/gate/Line10/setMaterial Aluminium -/gate/Line10/repeaters/insert linear -/gate/Line10/linear/autoCenter false -/gate/Line10/placement/setRotationAxis 0 0 1 -/gate/Line10/geometry/setYLength 0.500000 mm -/gate/Line10/placement/setTranslation 46.633815 -9.115909 0 mm -/gate/Line10/linear/setRepeatNumber 5 -/gate/Line10/linear/setRepeatVector 0.165963 0.986132 0 mm -/gate/Line10/placement/setRotationAngle -9.553183 deg - -/gate/Catphan/daughters/name Line11 -/gate/Catphan/daughters/insert box -/gate/Line11/geometry/setXLength 5 mm -/gate/Line11/geometry/setZLength 2 mm -/gate/Line11/setMaterial Aluminium -/gate/Line11/repeaters/insert linear -/gate/Line11/linear/autoCenter false -/gate/Line11/placement/setRotationAxis 0 0 1 -/gate/Line11/geometry/setYLength 0.454545 mm -/gate/Line11/placement/setTranslation 42.681425 -20.876717 0 mm -/gate/Line11/linear/setRepeatNumber 5 -/gate/Line11/linear/setRepeatVector 0.379795 0.825955 0 mm -/gate/Line11/placement/setRotationAngle -24.694140 deg - -/gate/Catphan/daughters/name Line12 -/gate/Catphan/daughters/insert box -/gate/Line12/geometry/setXLength 5 mm -/gate/Line12/geometry/setZLength 2 mm -/gate/Line12/setMaterial Aluminium -/gate/Line12/repeaters/insert linear -/gate/Line12/linear/autoCenter false -/gate/Line12/placement/setRotationAxis 0 0 1 -/gate/Line12/geometry/setYLength 0.416667 mm -/gate/Line12/placement/setTranslation 35.882092 -31.141781 0 mm -/gate/Line12/linear/setRepeatNumber 5 -/gate/Line12/linear/setRepeatVector 0.532286 0.641183 0 mm -/gate/Line12/placement/setRotationAngle -39.698166 deg - -/gate/Catphan/daughters/name Line13 -/gate/Catphan/daughters/insert box -/gate/Line13/geometry/setXLength 5 mm -/gate/Line13/geometry/setZLength 2 mm -/gate/Line13/setMaterial Aluminium -/gate/Line13/repeaters/insert linear -/gate/Line13/linear/autoCenter false -/gate/Line13/placement/setRotationAxis 0 0 1 -/gate/Line13/geometry/setYLength 0.384615 mm -/gate/Line13/placement/setTranslation 27.312855 -38.873931 0 mm -/gate/Line13/linear/setRepeatNumber 5 -/gate/Line13/linear/setRepeatVector 0.620329 0.454871 0 mm -/gate/Line13/placement/setRotationAngle -53.748416 deg - -/gate/Catphan/daughters/name Line14 -/gate/Catphan/daughters/insert box -/gate/Line14/geometry/setXLength 5 mm -/gate/Line14/geometry/setZLength 2 mm -/gate/Line14/setMaterial Aluminium -/gate/Line14/repeaters/insert linear -/gate/Line14/linear/autoCenter false -/gate/Line14/placement/setRotationAxis 0 0 1 -/gate/Line14/geometry/setYLength 0.357143 mm -/gate/Line14/placement/setTranslation 17.127773 -44.313504 0 mm -/gate/Line14/linear/setRepeatNumber 5 -/gate/Line14/linear/setRepeatVector 0.661293 0.269991 0 mm -/gate/Line14/placement/setRotationAngle -67.790942 deg - -/gate/Catphan/daughters/name Line15 -/gate/Catphan/daughters/insert box -/gate/Line15/geometry/setXLength 5 mm -/gate/Line15/geometry/setZLength 2 mm -/gate/Line15/setMaterial Aluminium -/gate/Line15/repeaters/insert linear -/gate/Line15/linear/autoCenter false -/gate/Line15/placement/setRotationAxis 0 0 1 -/gate/Line15/geometry/setYLength 0.333333 mm -/gate/Line15/placement/setTranslation 6.627700 -47.042726 0 mm -/gate/Line15/linear/setRepeatNumber 5 -/gate/Line15/linear/setRepeatVector 0.658414 0.104571 0 mm -/gate/Line15/placement/setRotationAngle -80.975476 deg - -/gate/Catphan/daughters/name Line16 -/gate/Catphan/daughters/insert box -/gate/Line16/geometry/setXLength 5 mm -/gate/Line16/geometry/setZLength 2 mm -/gate/Line16/setMaterial Aluminium -/gate/Line16/repeaters/insert linear -/gate/Line16/linear/autoCenter false -/gate/Line16/placement/setRotationAxis 0 0 1 -/gate/Line16/geometry/setYLength 0.312500 mm -/gate/Line16/placement/setTranslation -4.962477 -47.246526 0 mm -/gate/Line16/linear/setRepeatNumber 5 -/gate/Line16/linear/setRepeatVector 0.622570 -0.055056 0 mm -/gate/Line16/placement/setRotationAngle -95.053723 deg - -/gate/Catphan/daughters/name Line17 -/gate/Catphan/daughters/insert box -/gate/Line17/geometry/setXLength 5 mm -/gate/Line17/geometry/setZLength 2 mm -/gate/Line17/setMaterial Aluminium -/gate/Line17/repeaters/insert linear -/gate/Line17/linear/autoCenter false -/gate/Line17/placement/setRotationAxis 0 0 1 -/gate/Line17/geometry/setYLength 0.294118 mm -/gate/Line17/placement/setTranslation -15.500074 -44.905883 0 mm -/gate/Line17/linear/setRepeatNumber 5 -/gate/Line17/linear/setRepeatVector 0.558947 -0.183299 0 mm -/gate/Line17/placement/setRotationAngle -108.156176 deg - -/gate/Catphan/daughters/name Line18 -/gate/Catphan/daughters/insert box -/gate/Line18/geometry/setXLength 5 mm -/gate/Line18/geometry/setZLength 2 mm -/gate/Line18/setMaterial Aluminium -/gate/Line18/repeaters/insert linear -/gate/Line18/linear/autoCenter false -/gate/Line18/placement/setRotationAxis 0 0 1 -/gate/Line18/geometry/setYLength 0.277778 mm -/gate/Line18/placement/setTranslation -25.209113 -40.264536 0 mm -/gate/Line18/linear/setRepeatNumber 5 -/gate/Line18/linear/setRepeatVector 0.475139 -0.287897 0 mm -/gate/Line18/placement/setRotationAngle -121.212560 deg - -/gate/Catphan/daughters/name Line19 -/gate/Catphan/daughters/insert box -/gate/Line19/geometry/setXLength 5 mm -/gate/Line19/geometry/setZLength 2 mm -/gate/Line19/setMaterial Aluminium -/gate/Line19/repeaters/insert linear -/gate/Line19/linear/autoCenter false -/gate/Line19/placement/setRotationAxis 0 0 1 -/gate/Line19/geometry/setYLength 0.263158 mm -/gate/Line19/placement/setTranslation -33.048388 -34.124579 0 mm -/gate/Line19/linear/setRepeatNumber 5 -/gate/Line19/linear/setRepeatVector 0.383110 -0.360881 0 mm -/gate/Line19/placement/setRotationAngle -133.288612 deg - -/gate/Catphan/daughters/name Line20 -/gate/Catphan/daughters/insert box -/gate/Line20/geometry/setXLength 5 mm -/gate/Line20/geometry/setZLength 2 mm -/gate/Line20/setMaterial Aluminium -/gate/Line20/repeaters/insert linear -/gate/Line20/linear/autoCenter false -/gate/Line20/placement/setRotationAxis 0 0 1 -/gate/Line20/geometry/setYLength 0.250000 mm -/gate/Line20/placement/setTranslation -39.892531 -25.791986 0 mm -/gate/Line20/linear/setRepeatNumber 5 -/gate/Line20/linear/setRepeatVector 0.276972 -0.416277 0 mm -/gate/Line20/placement/setRotationAngle -146.362000 deg - -/gate/Catphan/daughters/name Line21 -/gate/Catphan/daughters/insert box -/gate/Line21/geometry/setXLength 5 mm -/gate/Line21/geometry/setZLength 2 mm -/gate/Line21/setMaterial Aluminium -/gate/Line21/repeaters/insert linear -/gate/Line21/linear/autoCenter false -/gate/Line21/placement/setRotationAxis 0 0 1 -/gate/Line21/geometry/setYLength 0.238095 mm -/gate/Line21/placement/setTranslation -44.669221 -16.163694 0 mm -/gate/Line21/linear/setRepeatNumber 5 -/gate/Line21/linear/setRepeatVector 0.167627 -0.445711 0 mm -/gate/Line21/placement/setRotationAngle -159.389233 deg - diff --git a/mac/detector.mac b/mac/detector.mac deleted file mode 100644 index 8dc6838..0000000 --- a/mac/detector.mac +++ /dev/null @@ -1,31 +0,0 @@ -/gate/world/daughters/name Plane{DetectorName} -/gate/world/daughters/insert box -/gate/Plane{DetectorName}/geometry/setXLength 1 nm -/gate/Plane{DetectorName}/geometry/setYLength 400 mm -/gate/Plane{DetectorName}/geometry/setZLength 400 mm -/gate/Plane{DetectorName}/setMaterial Air -/gate/Plane{DetectorName}/vis/setVisible 1 -/gate/Plane{DetectorName}/vis/setColor yellow - -/gate/actor/addActor PhaseSpaceActor {DetectorName} -/gate/actor/{DetectorName}/save output/{DetectorName}.root -/gate/actor/{DetectorName}/attachTo Plane{DetectorName} -/gate/actor/{DetectorName}/enableEkine true -/gate/actor/{DetectorName}/enableXPosition false -/gate/actor/{DetectorName}/enableYPosition true -/gate/actor/{DetectorName}/enableZPosition true -/gate/actor/{DetectorName}/enableXDirection true -/gate/actor/{DetectorName}/enableYDirection true -/gate/actor/{DetectorName}/enableZDirection true -/gate/actor/{DetectorName}/enableProductionVolume false -/gate/actor/{DetectorName}/enableProductionProcess false -/gate/actor/{DetectorName}/enableParticleName false -/gate/actor/{DetectorName}/enableWeight false -/gate/actor/{DetectorName}/enableTime true -/gate/actor/{DetectorName}/storeSecondaries true -/gate/actor/{DetectorName}/useVolumeFrame false -/gate/actor/{DetectorName}/storeOutgoingParticles false -#/gate/actor/{DetectorName}/setMaxFileSize -/gate/actor/{DetectorName}/addFilter particleFilter -/gate/actor/{DetectorName}/particleFilter/addParticle proton - diff --git a/mac/fan.mac b/mac/fan.mac deleted file mode 100644 index ae7f0f6..0000000 --- a/mac/fan.mac +++ /dev/null @@ -1,52 +0,0 @@ -# WaterSph -/gate/world/daughters/name WaterSph -/gate/world/daughters/insert sphere -/gate/WaterSph/placement/setTranslation 100 0 0 cm -/gate/WaterSph/geometry/setRmin 90 cm -/gate/WaterSph/geometry/setRmax 110 cm -/gate/WaterSph/setMaterial Water -/gate/WaterSph/vis/setVisible 0 -/gate/WaterSph/vis/setColor blue - -# BoneInsert1 -/gate/WaterSph/daughters/name BoneInsert1 -/gate/WaterSph/daughters/insert sphere -/gate/BoneInsert1/placement/setTranslation 0 0 0 cm -/gate/BoneInsert1/geometry/setRmin 90 cm -/gate/BoneInsert1/geometry/setRmax 92 cm -/gate/BoneInsert1/geometry/setThetaStart 88 deg -/gate/BoneInsert1/geometry/setDeltaTheta 4 deg -/gate/BoneInsert1/geometry/setPhiStart 175 deg -/gate/BoneInsert1/geometry/setDeltaPhi 2 deg -/gate/BoneInsert1/setMaterial SpineBone -/gate/WaterSph/vis/setVisible 1 -/gate/WaterSph/vis/setColor white - -# BoneInsert2 -/gate/WaterSph/daughters/name BoneInsert2 -/gate/WaterSph/daughters/insert sphere -/gate/BoneInsert2/placement/setTranslation 0 0 0 cm -/gate/BoneInsert2/geometry/setRmin 99 cm -/gate/BoneInsert2/geometry/setRmax 101 cm -/gate/BoneInsert2/geometry/setThetaStart 88 deg -/gate/BoneInsert2/geometry/setDeltaTheta 4 deg -/gate/BoneInsert2/geometry/setPhiStart 179 deg -/gate/BoneInsert2/geometry/setDeltaPhi 2 deg -/gate/BoneInsert2/setMaterial SpineBone -/gate/WaterSph/vis/setVisible 1 -/gate/WaterSph/vis/setColor white - -# BoneInsert3 -/gate/WaterSph/daughters/name BoneInsert3 -/gate/WaterSph/daughters/insert sphere -/gate/BoneInsert3/placement/setTranslation 0 0 0 cm -/gate/BoneInsert3/geometry/setRmin 108 cm -/gate/BoneInsert3/geometry/setRmax 110 cm -/gate/BoneInsert3/geometry/setThetaStart 88 deg -/gate/BoneInsert3/geometry/setDeltaTheta 4 deg -/gate/BoneInsert3/geometry/setPhiStart 183 deg -/gate/BoneInsert3/geometry/setDeltaPhi 2 deg -/gate/BoneInsert3/setMaterial SpineBone -/gate/BoneInsert3/vis/setVisible 1 -/gate/BoneInsert3/vis/setColor white - diff --git a/mac/physicslist_EM_std.mac b/mac/physicslist_EM_std.mac deleted file mode 100644 index b75b3d9..0000000 --- a/mac/physicslist_EM_std.mac +++ /dev/null @@ -1,44 +0,0 @@ - -#===================================== -# Electromagnetic processes -#===================================== - -#============= -# For Leptons -#============= - -/gate/physics/addProcess PhotoElectric -/gate/physics/processes/PhotoElectric/setModel StandardModel - -/gate/physics/addProcess Compton -/gate/physics/processes/Compton/setModel StandardModel - -/gate/physics/addProcess GammaConversion -/gate/physics/processes/GammaConversion/setModel StandardModel - -/gate/physics/addProcess ElectronIonisation -/gate/physics/processes/ElectronIonisation/setModel StandardModel e- -/gate/physics/processes/ElectronIonisation/setModel StandardModel e+ -/gate/physics/processes/ElectronIonisation/setStepFunction e+ 0.2 0.1 mm -/gate/physics/processes/ElectronIonisation/setStepFunction e- 0.2 0.1 mm -/gate/physics/processes/ElectronIonisation/setLinearLossLimit electron 0.01 - -/gate/physics/addProcess Bremsstrahlung -/gate/physics/processes/Bremsstrahlung/setModel StandardModel e- -/gate/physics/processes/Bremsstrahlung/setModel StandardModel e+ - -/gate/physics/addProcess PositronAnnihilation - -/gate/physics/addProcess eMultipleScattering -/gate/physics/processes/eMultipleScattering/setGeometricalStepLimiterType e- distanceToBoundary -/gate/physics/processes/eMultipleScattering/setGeometricalStepLimiterType e+ distanceToBoundary - -#========= -# Options -#========= - -/gate/physics/setEMin 0.1 keV -/gate/physics/setEMax 10 GeV -/gate/physics/setDEDXBinning 350 -/gate/physics/setLambdaBinning 350 - diff --git a/mac/physicslist_HAD_std.mac b/mac/physicslist_HAD_std.mac deleted file mode 100644 index 7fb3f63..0000000 --- a/mac/physicslist_HAD_std.mac +++ /dev/null @@ -1,80 +0,0 @@ -#===================================== -# EM processes for hadrons -#===================================== - -/gate/physics/addProcess HadronIonisation -/gate/physics/removeProcess HadronIonisation deuteron -/gate/physics/removeProcess HadronIonisation triton -/gate/physics/removeProcess HadronIonisation He3 -/gate/physics/removeProcess HadronIonisation alpha -/gate/physics/removeProcess HadronIonisation GenericIon -/gate/physics/processes/HadronIonisation/setStepFunction proton 0.2 0.05 mm -/gate/physics/processes/HadronIonisation/setStepFunction pi+ 0.2 0.05 mm -/gate/physics/processes/HadronIonisation/setStepFunction pi- 0.2 0.05 mm -/gate/physics/processes/HadronIonisation/setLinearLossLimit proton 0.01 - -/gate/physics/addProcess IonIonisation -/gate/physics/processes/IonIonisation/setStepFunction GenericIon 0.1 0.02 mm -/gate/physics/processes/IonIonisation/setStepFunction alpha 0.1 0.02 mm -/gate/physics/processes/IonIonisation/setStepFunction deuteron 0.1 0.02 mm -/gate/physics/processes/IonIonisation/setStepFunction triton 0.1 0.02 mm -/gate/physics/processes/IonIonisation/setStepFunction He3 0.1 0.02 mm - -/gate/physics/addProcess hMultipleScattering - -#===================================== -# Hadronic processes for hadrons -#===================================== - -/gate/physics/addProcess HadronElastic GenericIon -/gate/physics/processes/HadronElastic/setModel G4LElastic GenericIon - -/gate/physics/addProcess HadronElastic -/gate/physics/processes/HadronElastic/setModel G4HadronElastic -/gate/physics/processes/HadronElastic/setDataSet G4HadronElasticDataSet - -/gate/physics/addProcess ProtonInelastic -/gate/physics/processes/ProtonInelastic/setModel G4BinaryCascade -/gate/physics/processes/ProtonInelastic/G4BinaryCascade/setEmin 170 MeV -/gate/physics/processes/ProtonInelastic/G4BinaryCascade/setEmax 500 GeV -/gate/physics/processes/ProtonInelastic/setModel PreCompound -/gate/physics/processes/ProtonInelastic/PreCompound/setEmin 0 MeV -/gate/physics/processes/ProtonInelastic/PreCompound/setEmax 170 MeV - -/gate/physics/addProcess IonInelastic -/gate/physics/processes/IonInelastic/setModel G4BinaryLightIonReaction -/gate/physics/processes/IonInelastic/setModel G4LEDeuteronInelastic deuteron -/gate/physics/processes/IonInelastic/setModel G4LETritonInelastic triton -/gate/physics/processes/IonInelastic/setModel G4LEAlphaInelastic alpha -/gate/physics/processes/IonInelastic/G4BinaryLightIonReaction/setEmin 80 MeV deuteron -/gate/physics/processes/IonInelastic/G4BinaryLightIonReaction/setEmax 20 GeV deuteron -/gate/physics/processes/IonInelastic/G4BinaryLightIonReaction/setEmin 80 MeV triton -/gate/physics/processes/IonInelastic/G4BinaryLightIonReaction/setEmax 20 GeV triton -/gate/physics/processes/IonInelastic/G4BinaryLightIonReaction/setEmin 80 MeV alpha -/gate/physics/processes/IonInelastic/G4BinaryLightIonReaction/setEmax 20 GeV alpha -/gate/physics/processes/IonInelastic/G4LEDeuteronInelastic/setEmin 0 MeV deuteron -/gate/physics/processes/IonInelastic/G4LEDeuteronInelastic/setEmax 80 MeV deuteron -/gate/physics/processes/IonInelastic/G4LETritonInelastic/setEmin 0 MeV triton -/gate/physics/processes/IonInelastic/G4LETritonInelastic/setEmax 80 MeV triton -/gate/physics/processes/IonInelastic/G4LEAlphaInelastic/setEmin 0 MeV alpha -/gate/physics/processes/IonInelastic/G4LEAlphaInelastic/setEmax 80 MeV alpha -/gate/physics/processes/IonInelastic/setDataSet G4IonsShenCrossSection GenericIon -/gate/physics/processes/IonInelastic/setDataSet G4TripathiLightCrossSection deuteron -/gate/physics/processes/IonInelastic/setDataSet G4TripathiLightCrossSection triton -/gate/physics/processes/IonInelastic/setDataSet G4TripathiLightCrossSection alpha - -/gate/physics/addProcess PionPlusInelastic -/gate/physics/processes/PionPlusInelastic/setModel G4LEPionPlusInelastic - -/gate/physics/addProcess PionMinusInelastic -/gate/physics/processes/PionMinusInelastic/setModel G4LEPionMinusInelastic - -/gate/physics/addProcess NeutronCapture -/gate/physics/processes/NeutronCapture/setModel G4LCapture -/gate/physics/addProcess Fission -/gate/physics/processes/Fission/setModel G4LFission -/gate/physics/addProcess NeutronInelastic -/gate/physics/processes/NeutronInelastic/setModel PreCompound - -/gate/physics/addProcess Decay - diff --git a/mac/protonct.mac b/mac/protonct.mac deleted file mode 100644 index 345774c..0000000 --- a/mac/protonct.mac +++ /dev/null @@ -1,51 +0,0 @@ -# Geometry -/gate/geometry/setMaterialDatabase data/GateMaterials.db -/gate/world/setMaterial Air -/gate/world/geometry/setXLength 4 m -/gate/world/geometry/setYLength 4 m -/gate/world/geometry/setZLength 4 m - -# Phantom -/control/execute mac/spiral.mac -/gate/Spiral/moves/insert rotation -/gate/Spiral/rotation/setSpeed 1 deg/s -/gate/Spiral/rotation/setAxis 0 0 1 - -# Beam -/control/execute mac/beam.mac - -# Physics list -/control/execute mac/physicslist_EM_std.mac -/control/execute mac/physicslist_HAD_std.mac - -# Phase spaces -/control/alias DetectorName PhaseSpaceIn -/control/execute mac/detector.mac -/gate/Plane{DetectorName}/placement/setTranslation 110 0 0 mm - -/control/alias DetectorName PhaseSpaceOut -/control/execute mac/detector.mac -/gate/Plane{DetectorName}/placement/setTranslation -110 0 0 mm - -# Particles stats -/gate/actor/addActor SimulationStatisticActor stat -/gate/actor/stat/save output/protonct.txt - -# DEBUG -#/control/execute mac/visu.mac -#/gate/output/verbose 4 -#/gate/verbose 4 - -# Main -/gate/run/initialize - -/gate/random/setEngineName MersenneTwister -/gate/random/setEngineSeed auto - -/gate/application/setTimeSlice 1 s -/gate/application/setTimeStart 0 s -/gate/application/setTimeStop 360 s - -/gate/application/setTotalNumberOfPrimaries 720000 -/gate/application/start - diff --git a/mac/spiral.mac b/mac/spiral.mac deleted file mode 100644 index 80e873b..0000000 --- a/mac/spiral.mac +++ /dev/null @@ -1,285 +0,0 @@ -# Mother of all -/gate/world/daughters/name Spiral -/gate/world/daughters/insert cylinder -/gate/Spiral/geometry/setRmin 0 cm -/gate/Spiral/geometry/setRmax 10 cm -/gate/Spiral/geometry/setHeight 40 cm -/gate/Spiral/setMaterial Water -/gate/Spiral/vis/setColor yellow -/gate/Spiral/vis/setVisible 1 - -# Insert at radius 0.00 mm and angle 0.00 degree -/gate/Spiral/daughters/name SpiralInsert01 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert01/geometry/setRmin 0 mm -/gate/SpiralInsert01/geometry/setRmax 1 mm -/gate/SpiralInsert01/geometry/setHeight 40 cm -/gate/SpiralInsert01/setMaterial Aluminium -/gate/SpiralInsert01/placement/setTranslation 0.0000 0.0000 0 mm -/gate/SpiralInsert01/vis/setColor yellow -/gate/SpiralInsert01/vis/setVisible 1 - -# Insert at radius 4.00 mm and angle 139.00 degree -/gate/Spiral/daughters/name SpiralInsert02 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert02/geometry/setRmin 0 mm -/gate/SpiralInsert02/geometry/setRmax 1 mm -/gate/SpiralInsert02/geometry/setHeight 40 cm -/gate/SpiralInsert02/setMaterial Aluminium -/gate/SpiralInsert02/placement/setTranslation -3.0188 2.6242 0 mm -/gate/SpiralInsert02/vis/setColor yellow -/gate/SpiralInsert02/vis/setVisible 1 - -# Insert at radius 8.00 mm and angle 278.00 degree -/gate/Spiral/daughters/name SpiralInsert03 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert03/geometry/setRmin 0 mm -/gate/SpiralInsert03/geometry/setRmax 1 mm -/gate/SpiralInsert03/geometry/setHeight 40 cm -/gate/SpiralInsert03/setMaterial Aluminium -/gate/SpiralInsert03/placement/setTranslation 1.1134 -7.9221 0 mm -/gate/SpiralInsert03/vis/setColor yellow -/gate/SpiralInsert03/vis/setVisible 1 - -# Insert at radius 12.00 mm and angle 417.00 degree -/gate/Spiral/daughters/name SpiralInsert04 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert04/geometry/setRmin 0 mm -/gate/SpiralInsert04/geometry/setRmax 1 mm -/gate/SpiralInsert04/geometry/setHeight 40 cm -/gate/SpiralInsert04/setMaterial Aluminium -/gate/SpiralInsert04/placement/setTranslation 6.5357 10.0640 0 mm -/gate/SpiralInsert04/vis/setColor yellow -/gate/SpiralInsert04/vis/setVisible 1 - -# Insert at radius 16.00 mm and angle 556.00 degree -/gate/Spiral/daughters/name SpiralInsert05 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert05/geometry/setRmin 0 mm -/gate/SpiralInsert05/geometry/setRmax 1 mm -/gate/SpiralInsert05/geometry/setHeight 40 cm -/gate/SpiralInsert05/setMaterial Aluminium -/gate/SpiralInsert05/placement/setTranslation -15.3802 -4.4102 0 mm -/gate/SpiralInsert05/vis/setColor yellow -/gate/SpiralInsert05/vis/setVisible 1 - -# Insert at radius 20.00 mm and angle 695.00 degree -/gate/Spiral/daughters/name SpiralInsert06 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert06/geometry/setRmin 0 mm -/gate/SpiralInsert06/geometry/setRmax 1 mm -/gate/SpiralInsert06/geometry/setHeight 40 cm -/gate/SpiralInsert06/setMaterial Aluminium -/gate/SpiralInsert06/placement/setTranslation 18.1262 -8.4524 0 mm -/gate/SpiralInsert06/vis/setColor yellow -/gate/SpiralInsert06/vis/setVisible 1 - -# Insert at radius 24.00 mm and angle 834.00 degree -/gate/Spiral/daughters/name SpiralInsert07 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert07/geometry/setRmin 0 mm -/gate/SpiralInsert07/geometry/setRmax 1 mm -/gate/SpiralInsert07/geometry/setHeight 40 cm -/gate/SpiralInsert07/setMaterial Aluminium -/gate/SpiralInsert07/placement/setTranslation -9.7617 21.9251 0 mm -/gate/SpiralInsert07/vis/setColor yellow -/gate/SpiralInsert07/vis/setVisible 1 - -# Insert at radius 28.00 mm and angle 973.00 degree -/gate/Spiral/daughters/name SpiralInsert08 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert08/geometry/setRmin 0 mm -/gate/SpiralInsert08/geometry/setRmax 1 mm -/gate/SpiralInsert08/geometry/setHeight 40 cm -/gate/SpiralInsert08/setMaterial Aluminium -/gate/SpiralInsert08/placement/setTranslation -8.1864 -26.7765 0 mm -/gate/SpiralInsert08/vis/setColor yellow -/gate/SpiralInsert08/vis/setVisible 1 - -# Insert at radius 32.00 mm and angle 1112.00 degree -/gate/Spiral/daughters/name SpiralInsert09 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert09/geometry/setRmin 0 mm -/gate/SpiralInsert09/geometry/setRmax 1 mm -/gate/SpiralInsert09/geometry/setHeight 40 cm -/gate/SpiralInsert09/setMaterial Aluminium -/gate/SpiralInsert09/placement/setTranslation 27.1375 16.9574 0 mm -/gate/SpiralInsert09/vis/setColor yellow -/gate/SpiralInsert09/vis/setVisible 1 - -# Insert at radius 36.00 mm and angle 1251.00 degree -/gate/Spiral/daughters/name SpiralInsert10 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert10/geometry/setRmin 0 mm -/gate/SpiralInsert10/geometry/setRmax 1 mm -/gate/SpiralInsert10/geometry/setHeight 40 cm -/gate/SpiralInsert10/setMaterial Aluminium -/gate/SpiralInsert10/placement/setTranslation -35.5568 5.6316 0 mm -/gate/SpiralInsert10/vis/setColor yellow -/gate/SpiralInsert10/vis/setVisible 1 - -# Insert at radius 40.00 mm and angle 1390.00 degree -/gate/Spiral/daughters/name SpiralInsert11 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert11/geometry/setRmin 0 mm -/gate/SpiralInsert11/geometry/setRmax 1 mm -/gate/SpiralInsert11/geometry/setHeight 40 cm -/gate/SpiralInsert11/setMaterial Aluminium -/gate/SpiralInsert11/placement/setTranslation 25.7115 -30.6418 0 mm -/gate/SpiralInsert11/vis/setColor yellow -/gate/SpiralInsert11/vis/setVisible 1 - -# Insert at radius 44.00 mm and angle 1529.00 degree -/gate/Spiral/daughters/name SpiralInsert12 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert12/geometry/setRmin 0 mm -/gate/SpiralInsert12/geometry/setRmax 1 mm -/gate/SpiralInsert12/geometry/setHeight 40 cm -/gate/SpiralInsert12/setMaterial Aluminium -/gate/SpiralInsert12/placement/setTranslation 0.7679 43.9933 0 mm -/gate/SpiralInsert12/vis/setColor yellow -/gate/SpiralInsert12/vis/setVisible 1 - -# Insert at radius 48.00 mm and angle 1668.00 degree -/gate/Spiral/daughters/name SpiralInsert13 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert13/geometry/setRmin 0 mm -/gate/SpiralInsert13/geometry/setRmax 1 mm -/gate/SpiralInsert13/geometry/setHeight 40 cm -/gate/SpiralInsert13/setMaterial Aluminium -/gate/SpiralInsert13/placement/setTranslation -32.1183 -35.6710 0 mm -/gate/SpiralInsert13/vis/setColor yellow -/gate/SpiralInsert13/vis/setVisible 1 - -# Insert at radius 52.00 mm and angle 1807.00 degree -/gate/Spiral/daughters/name SpiralInsert14 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert14/geometry/setRmin 0 mm -/gate/SpiralInsert14/geometry/setRmax 1 mm -/gate/SpiralInsert14/geometry/setHeight 40 cm -/gate/SpiralInsert14/setMaterial Aluminium -/gate/SpiralInsert14/placement/setTranslation 51.6124 6.3372 0 mm -/gate/SpiralInsert14/vis/setColor yellow -/gate/SpiralInsert14/vis/setVisible 1 - -# Insert at radius 56.00 mm and angle 1946.00 degree -/gate/Spiral/daughters/name SpiralInsert15 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert15/geometry/setRmin 0 mm -/gate/SpiralInsert15/geometry/setRmax 1 mm -/gate/SpiralInsert15/geometry/setHeight 40 cm -/gate/SpiralInsert15/setMaterial Aluminium -/gate/SpiralInsert15/placement/setTranslation -46.4261 31.3148 0 mm -/gate/SpiralInsert15/vis/setColor yellow -/gate/SpiralInsert15/vis/setVisible 1 - -# Insert at radius 60.00 mm and angle 2085.00 degree -/gate/Spiral/daughters/name SpiralInsert16 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert16/geometry/setRmin 0 mm -/gate/SpiralInsert16/geometry/setRmax 1 mm -/gate/SpiralInsert16/geometry/setHeight 40 cm -/gate/SpiralInsert16/setMaterial Aluminium -/gate/SpiralInsert16/placement/setTranslation 15.5291 -57.9555 0 mm -/gate/SpiralInsert16/vis/setColor yellow -/gate/SpiralInsert16/vis/setVisible 1 - -# Insert at radius 64.00 mm and angle 2224.00 degree -/gate/Spiral/daughters/name SpiralInsert17 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert17/geometry/setRmin 0 mm -/gate/SpiralInsert17/geometry/setRmax 1 mm -/gate/SpiralInsert17/geometry/setHeight 40 cm -/gate/SpiralInsert17/setMaterial Aluminium -/gate/SpiralInsert17/placement/setTranslation 28.0558 57.5228 0 mm -/gate/SpiralInsert17/vis/setColor yellow -/gate/SpiralInsert17/vis/setVisible 1 - -# Insert at radius 68.00 mm and angle 2363.00 degree -/gate/Spiral/daughters/name SpiralInsert18 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert18/geometry/setRmin 0 mm -/gate/SpiralInsert18/geometry/setRmax 1 mm -/gate/SpiralInsert18/geometry/setHeight 40 cm -/gate/SpiralInsert18/setMaterial Aluminium -/gate/SpiralInsert18/placement/setTranslation -62.5943 -26.5697 0 mm -/gate/SpiralInsert18/vis/setColor yellow -/gate/SpiralInsert18/vis/setVisible 1 - -# Insert at radius 72.00 mm and angle 2502.00 degree -/gate/Spiral/daughters/name SpiralInsert19 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert19/geometry/setRmin 0 mm -/gate/SpiralInsert19/geometry/setRmax 1 mm -/gate/SpiralInsert19/geometry/setHeight 40 cm -/gate/SpiralInsert19/setMaterial Aluminium -/gate/SpiralInsert19/placement/setTranslation 68.4761 -22.2492 0 mm -/gate/SpiralInsert19/vis/setColor yellow -/gate/SpiralInsert19/vis/setVisible 1 - -# Insert at radius 76.00 mm and angle 2641.00 degree -/gate/Spiral/daughters/name SpiralInsert20 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert20/geometry/setRmin 0 mm -/gate/SpiralInsert20/geometry/setRmax 1 mm -/gate/SpiralInsert20/geometry/setHeight 40 cm -/gate/SpiralInsert20/setMaterial Aluminium -/gate/SpiralInsert20/placement/setTranslation -39.1429 65.1447 0 mm -/gate/SpiralInsert20/vis/setColor yellow -/gate/SpiralInsert20/vis/setVisible 1 - -# Insert at radius 80.00 mm and angle 2780.00 degree -/gate/Spiral/daughters/name SpiralInsert21 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert21/geometry/setRmin 0 mm -/gate/SpiralInsert21/geometry/setRmax 1 mm -/gate/SpiralInsert21/geometry/setHeight 40 cm -/gate/SpiralInsert21/setMaterial Aluminium -/gate/SpiralInsert21/placement/setTranslation -13.8919 -78.7846 0 mm -/gate/SpiralInsert21/vis/setColor yellow -/gate/SpiralInsert21/vis/setVisible 1 - -# Insert at radius 84.00 mm and angle 2919.00 degree -/gate/Spiral/daughters/name SpiralInsert22 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert22/geometry/setRmin 0 mm -/gate/SpiralInsert22/geometry/setRmax 1 mm -/gate/SpiralInsert22/geometry/setHeight 40 cm -/gate/SpiralInsert22/setMaterial Aluminium -/gate/SpiralInsert22/placement/setTranslation 65.2803 52.8629 0 mm -/gate/SpiralInsert22/vis/setColor yellow -/gate/SpiralInsert22/vis/setVisible 1 - -# Insert at radius 88.00 mm and angle 3058.00 degree -/gate/Spiral/daughters/name SpiralInsert23 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert23/geometry/setRmin 0 mm -/gate/SpiralInsert23/geometry/setRmax 1 mm -/gate/SpiralInsert23/geometry/setHeight 40 cm -/gate/SpiralInsert23/setMaterial Aluminium -/gate/SpiralInsert23/placement/setTranslation -87.9464 3.0712 0 mm -/gate/SpiralInsert23/vis/setColor yellow -/gate/SpiralInsert23/vis/setVisible 1 - -# Insert at radius 92.00 mm and angle 3197.00 degree -/gate/Spiral/daughters/name SpiralInsert24 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert24/geometry/setRmin 0 mm -/gate/SpiralInsert24/geometry/setRmax 1 mm -/gate/SpiralInsert24/geometry/setHeight 40 cm -/gate/SpiralInsert24/setMaterial Aluminium -/gate/SpiralInsert24/placement/setTranslation 67.2845 -62.7438 0 mm -/gate/SpiralInsert24/vis/setColor yellow -/gate/SpiralInsert24/vis/setVisible 1 - -# Insert at radius 96.00 mm and angle 3336.00 degree -/gate/Spiral/daughters/name SpiralInsert25 -/gate/Spiral/daughters/insert cylinder -/gate/SpiralInsert25/geometry/setRmin 0 mm -/gate/SpiralInsert25/geometry/setRmax 1 mm -/gate/SpiralInsert25/geometry/setHeight 40 cm -/gate/SpiralInsert25/setMaterial Aluminium -/gate/SpiralInsert25/placement/setTranslation -10.0347 95.4741 0 mm -/gate/SpiralInsert25/vis/setColor yellow -/gate/SpiralInsert25/vis/setVisible 1 - diff --git a/pctpairprotons.cxx b/pctpairprotons.cxx deleted file mode 100644 index 16a74a7..0000000 --- a/pctpairprotons.cxx +++ /dev/null @@ -1,284 +0,0 @@ -#include "pctpairprotons_ggo.h" - -#include - -#include -#include -#include -#include -#include - -// Root includes -#include -#include - -#define MAX_RUNS 4096 - -struct ParticleData - { - float ekine; - itk::Vector position; - itk::Vector direction; - }; - -struct StoredParticleInfo - { - int trackID; - int nuclearProcess; - int creatorProcess; - int order; - }; - -struct ParticleInfo - { - int runID; - int eventID; - char name[256]; - }; - - -bool SetTreeBranch(TChain *tree, std::string branchName, void *add, bool mandatory=true) -{ - unsigned int found = 0; - tree->SetBranchStatus(branchName.c_str(), 1, &found); - if(!found) - { - if(mandatory) - { - std::cerr << "Could not load branch " - << branchName << std::endl; - exit(EXIT_FAILURE); - } - } - else - tree->SetBranchAddress(branchName.c_str(), add); - return found; -} - -void BranchParticleToPhaseSpace(struct ParticleInfo &pi, struct StoredParticleInfo &spi, struct ParticleData &pd, TChain *tree, args_info_pctpairprotons *args_info) -{ - tree->GetListOfBranches(); // force reading of chain - if(!SetTreeBranch(tree, "ParticleName", pi.name, false)) - strcpy(pi.name, "proton"); // If absent, assume that particles have been filtered - SetTreeBranch(tree, "RunID", &pi.runID); - SetTreeBranch(tree, "EventID", &pi.eventID); - SetTreeBranch(tree, "Ekine", &pd.ekine); - - SetTreeBranch(tree, args_info->proju_arg, pd.position.GetDataPointer()); - SetTreeBranch(tree, args_info->projv_arg, pd.position.GetDataPointer()+1); - SetTreeBranch(tree, std::string("d")+std::string(args_info->proju_arg), pd.direction.GetDataPointer()); - SetTreeBranch(tree, std::string("d")+std::string(args_info->projv_arg), pd.direction.GetDataPointer()+1); - SetTreeBranch(tree, std::string("d")+std::string(args_info->projw_arg), pd.direction.GetDataPointer()+2); - SetTreeBranch(tree, "TrackID", &spi.trackID); - - if(!SetTreeBranch(tree, "NuclearProcess", &spi.nuclearProcess, false)) - spi.nuclearProcess = -1; - if(!SetTreeBranch(tree, "CreatorProcess", &spi.creatorProcess, false)) - spi.creatorProcess = -1; - if(!SetTreeBranch(tree, "Order", &spi.order, false)) - spi.order = -1; -} - -void WritePairs(const std::vector< std::pair > &pairs, - const std::vector< StoredParticleInfo> &particlesInfo, - std::string fileName) -{ - itk::ImageRegion<2> region; - itk::ImageRegion<2>::SizeType size; - if(particlesInfo.back().nuclearProcess == -1) - size[0] = 5; - else - size[0] = 6; - size[1] = pairs.size(); - region.SetSize(size); - - typedef itk::Vector PixelType; - typedef itk::Image ImageType; - ImageType::Pointer img = ImageType::New(); - img->SetRegions(region); - img->Allocate(); - - itk::ImageRegionIterator it(img, region); - PixelType eet; - PixelType nuclearinfo; - - for(size_t i=0; i WriterType; - WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( fileName ); - writer->SetInput( img ); - TRY_AND_EXIT_ON_ITK_EXCEPTION( writer->Update() ); -} - -int main(int argc, char * argv[]) -{ - GGO(pctpairprotons, args_info); //RTK macro parsing options from .ggo file (rtkMacro.h) - - // Create root trees - TChain *treeIn = new TChain(args_info.psin_arg); - TChain *treeOut = new TChain(args_info.psout_arg); - treeIn->AddFile(args_info.inputIn_arg); - treeOut->AddFile(args_info.inputOut_arg); - - // Branch particles - struct ParticleInfo piIn, piOut; - struct StoredParticleInfo spiIn, spiOut; - struct ParticleData pdIn, pdOut; - BranchParticleToPhaseSpace(piIn, spiIn, pdIn, treeIn, &args_info); - BranchParticleToPhaseSpace(piOut, spiOut, pdOut, treeOut, &args_info); - pdIn.position[2] = args_info.planeIn_arg; - pdOut.position[2] = args_info.planeOut_arg; - - // Init - std::vector< std::vector< std::pair > > pairs(MAX_RUNS); - std::vector< std::vector< StoredParticleInfo > > particlesInfo(MAX_RUNS); - size_t nparticulesIn = treeIn->GetEntries(); - size_t nparticulesOut = treeOut->GetEntries(); - size_t iIn=0, iOut=0; - int prevEventIDIn = -1; - int prevEventIDOut = -1; - std::cout << iIn << " particles of input phase space processed (" - << 100*iIn/nparticulesIn << "%)" << std::flush; - - // Go over root files - while(iInGetEntry(iIn); - treeOut->GetEntry(iOut); - -// // Move to next adequate RunID -// if(piIn.runID!=args_info.runid_arg) -// { -// while(piIn.runID!=args_info.runid_arg && ++iInGetEntry(iIn); -// continue; -// } -// if(piOut.runID!=args_info.runid_arg) -// { -// while(piOut.runID!=args_info.runid_arg && ++iOutGetEntry(iOut); -// continue; -// } - - // Manage merged root files - if(piIn.eventID=prevEventIDOut && ++iOutGetEntry(iOut); - } - prevEventIDIn = piIn.eventID; - prevEventIDOut = piOut.eventID; - continue; - } - if(piOut.eventID=prevEventIDIn && ++iInGetEntry(iIn); - } - prevEventIDIn = piIn.eventID; - prevEventIDOut = piOut.eventID; - continue; - } - prevEventIDIn = piIn.eventID; - prevEventIDOut = piOut.eventID; - - // Condition 1: both particles must be protons - if( std::string(piOut.name) != std::string("proton") ) - { - iOut++; - continue; - } - if( std::string(piIn.name) != std::string("proton") ) - { - iIn++; - continue; - } - - // Condition 2: absolute time difference must be small -// if( pIn.time-pOut.time<-100.f ) - if(piIn.eventID < piOut.eventID) //1 primary per event in Gate - { - iIn++; - continue; - } -// if( pIn.time-pOut.time>100.f ) - if(piOut.eventID < piIn.eventID) - { - iOut++; - continue; - } - - // Corresponding protons found, add to vector if no nuclear interaction - if(piIn.runID>=args_info.minRun_arg && piIn.runID(pdIn, pdOut) ); - particlesInfo[piIn.runID].push_back( spiOut ); - } - - // There may be multiple protons to pair with an input proton so only - // increment the output counter. Note that there may also be multiple input - // protons associated to an output proton (secondary proton back scattering) but this is ignored. - iOut++; - } - - std::cout << "\r" - << nparticulesIn << " particles of input phase space processed (" - << 100 << "%)" - << std::endl - << "Writing..." - << std::endl; - - for(unsigned int i=0; i= min_run) & (ps['RunID'] < max_run)] @@ -131,10 +127,10 @@ def load_tree_as_df(root_file, tree_name): ps_np[:,1,2] = ps_run['w_out'] ps_np[:,2,0] = ps_run['du_in'] ps_np[:,2,1] = ps_run['dv_in'] - ps_np[:,2,2] = ps_run['dw_in'] * wweight + ps_np[:,2,2] = ps_run['dw_in'] ps_np[:,3,0] = ps_run['du_out'] ps_np[:,3,1] = ps_run['dv_out'] - ps_np[:,3,2] = ps_run['dw_out'] * wweight + ps_np[:,3,2] = ps_run['dw_out'] ps_np[:,4,0] = ps_run['KineticEnergy_in'] ps_np[:,4,1] = ps_run['KineticEnergy_out'] ps_np[:,4,2] = ps_run['TrackID'] if no_nuclear else ps_run['TrackID_out'] @@ -157,10 +153,6 @@ def main(): parser.add_argument('--max-run', help="Maximum run (exclusive)", default=1e6, type=int) parser.add_argument('--no-nuclear', help="Remove inelastic nuclear collisions", default=False, action='store_true') parser.add_argument('--verbose', '-v', help="Verbose execution", default=False, action='store_true') - parser.add_argument('--proju', help="Provide the name of the first axis in the root file", default='Y') - parser.add_argument('--projv', help="Provide the name of the second axis in the root file", default='Z') - parser.add_argument('--projw', help="Provide the name of the third axis in the root file", default='X') - parser.add_argument('--wweight', help="Weight of the third axis", default=-1., type=float) parser.add_argument('--psin', help="Name of tree in input phase space", default='PhaseSpace') parser.add_argument('--psout', help="Name of tree in output phase space", default='PhaseSpace') args_info = parser.parse_args()