mirror of
https://github.com/jwinterm/geant4-radiation-labs.git
synced 2026-10-28 06:18:37 +01:00
Built site for gh-pages
This commit is contained in:
+25
-25
@@ -520,23 +520,23 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
||||
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a><span class="fu">nano</span> mylab.mac</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<p>Or use your preferred text editor (gedit, vim, etc.)</p></li>
|
||||
<li><p>Add the following commands to your macro file:</p>
|
||||
<pre><code># My custom run for Lab 2
|
||||
# Author: [Your Name]
|
||||
|
||||
# Initialize the kernel
|
||||
/run/initialize
|
||||
|
||||
# Set the particle to a proton
|
||||
/gun/particle proton
|
||||
|
||||
# Set the proton's kinetic energy to 150 MeV
|
||||
/gun/energy 150 MeV
|
||||
|
||||
# Print progress every 100 events
|
||||
/run/printProgress 100
|
||||
|
||||
# Run 1000 events
|
||||
/run/beamOn 1000</code></pre></li>
|
||||
<div class="sourceCode" id="cb21"><pre class="sourceCode default code-with-copy"><code class="sourceCode default"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a># My custom run for Lab 2</span>
|
||||
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a># Author: [Your Name]</span>
|
||||
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb21-4"><a href="#cb21-4" aria-hidden="true" tabindex="-1"></a># Initialize the kernel</span>
|
||||
<span id="cb21-5"><a href="#cb21-5" aria-hidden="true" tabindex="-1"></a>/run/initialize</span>
|
||||
<span id="cb21-6"><a href="#cb21-6" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb21-7"><a href="#cb21-7" aria-hidden="true" tabindex="-1"></a># Set the particle to a proton</span>
|
||||
<span id="cb21-8"><a href="#cb21-8" aria-hidden="true" tabindex="-1"></a>/gun/particle proton</span>
|
||||
<span id="cb21-9"><a href="#cb21-9" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb21-10"><a href="#cb21-10" aria-hidden="true" tabindex="-1"></a># Set the proton's kinetic energy to 150 MeV</span>
|
||||
<span id="cb21-11"><a href="#cb21-11" aria-hidden="true" tabindex="-1"></a>/gun/energy 150 MeV</span>
|
||||
<span id="cb21-12"><a href="#cb21-12" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb21-13"><a href="#cb21-13" aria-hidden="true" tabindex="-1"></a># Print progress every 100 events</span>
|
||||
<span id="cb21-14"><a href="#cb21-14" aria-hidden="true" tabindex="-1"></a>/run/printProgress 100</span>
|
||||
<span id="cb21-15"><a href="#cb21-15" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb21-16"><a href="#cb21-16" aria-hidden="true" tabindex="-1"></a># Run 1000 events</span>
|
||||
<span id="cb21-17"><a href="#cb21-17" aria-hidden="true" tabindex="-1"></a>/run/beamOn 1000</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div></li>
|
||||
<li><p>Save and close the file.</p></li>
|
||||
<li><p>Run the simulation using your new macro:</p>
|
||||
<div class="sourceCode" id="cb22"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> build</span>
|
||||
@@ -554,15 +554,15 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
||||
<p>Let’s create additional macro files to explore different simulation scenarios:</p>
|
||||
<ol type="1">
|
||||
<li><p>Create a macro for electron simulation (<code>electron_beam.mac</code>):</p>
|
||||
<pre><code>/run/initialize
|
||||
/gun/particle e-
|
||||
/gun/energy 50 MeV
|
||||
/run/beamOn 500</code></pre></li>
|
||||
<div class="sourceCode" id="cb23"><pre class="sourceCode default code-with-copy"><code class="sourceCode default"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a>/run/initialize</span>
|
||||
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a>/gun/particle e-</span>
|
||||
<span id="cb23-3"><a href="#cb23-3" aria-hidden="true" tabindex="-1"></a>/gun/energy 50 MeV</span>
|
||||
<span id="cb23-4"><a href="#cb23-4" aria-hidden="true" tabindex="-1"></a>/run/beamOn 500</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div></li>
|
||||
<li><p>Create a macro for neutron simulation (<code>neutron_beam.mac</code>):</p>
|
||||
<pre><code>/run/initialize
|
||||
/gun/particle neutron
|
||||
/gun/energy 14 MeV
|
||||
/run/beamOn 1000</code></pre></li>
|
||||
<div class="sourceCode" id="cb24"><pre class="sourceCode default code-with-copy"><code class="sourceCode default"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a>/run/initialize</span>
|
||||
<span id="cb24-2"><a href="#cb24-2" aria-hidden="true" tabindex="-1"></a>/gun/particle neutron</span>
|
||||
<span id="cb24-3"><a href="#cb24-3" aria-hidden="true" tabindex="-1"></a>/gun/energy 14 MeV</span>
|
||||
<span id="cb24-4"><a href="#cb24-4" aria-hidden="true" tabindex="-1"></a>/run/beamOn 1000</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div></li>
|
||||
<li><p>Run each simulation and compare the results:</p>
|
||||
<div class="sourceCode" id="cb25"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./exampleB1</span> ../electron_beam.mac</span>
|
||||
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./exampleB1</span> ../neutron_beam.mac</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div></li>
|
||||
|
||||
+22
-22
@@ -535,16 +535,16 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
||||
<div class="sourceCode" id="cb18"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> ..</span>
|
||||
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a><span class="fu">nano</span> lab3.mac</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<p>Add these contents:</p>
|
||||
<pre><code># Lab 3 Data Collection Run
|
||||
# Simulate 10,000 events with default 6 MeV gammas
|
||||
|
||||
# Force single-threaded mode so we get ONE CSV file, not one per worker.
|
||||
# Must come BEFORE /run/initialize.
|
||||
/run/numberOfThreads 1
|
||||
|
||||
/run/initialize
|
||||
/run/printProgress 1000
|
||||
/run/beamOn 10000</code></pre>
|
||||
<div class="sourceCode" id="cb19"><pre class="sourceCode default code-with-copy"><code class="sourceCode default"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a># Lab 3 Data Collection Run</span>
|
||||
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a># Simulate 10,000 events with default 6 MeV gammas</span>
|
||||
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a># Force single-threaded mode so we get ONE CSV file, not one per worker.</span>
|
||||
<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a># Must come BEFORE /run/initialize.</span>
|
||||
<span id="cb19-6"><a href="#cb19-6" aria-hidden="true" tabindex="-1"></a>/run/numberOfThreads 1</span>
|
||||
<span id="cb19-7"><a href="#cb19-7" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb19-8"><a href="#cb19-8" aria-hidden="true" tabindex="-1"></a>/run/initialize</span>
|
||||
<span id="cb19-9"><a href="#cb19-9" aria-hidden="true" tabindex="-1"></a>/run/printProgress 1000</span>
|
||||
<span id="cb19-10"><a href="#cb19-10" aria-hidden="true" tabindex="-1"></a>/run/beamOn 10000</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<p>This will run 10,000 events and print progress every 1,000 events. <code>/run/numberOfThreads 1</code> keeps Geant4 from running multi-threaded, which would otherwise produce one CSV file per worker thread.</p></li>
|
||||
<li><p>Run the simulation:</p>
|
||||
<div class="sourceCode" id="cb20"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> build</span>
|
||||
@@ -803,21 +803,21 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
||||
<div class="sourceCode" id="cb34"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb34-1"><a href="#cb34-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> ~/g4-labs/lab3/B1</span>
|
||||
<span id="cb34-2"><a href="#cb34-2" aria-hidden="true" tabindex="-1"></a><span class="fu">nano</span> proton_beam.mac</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<p>Add:</p>
|
||||
<pre><code>/run/numberOfThreads 1
|
||||
/run/initialize
|
||||
/gun/particle proton
|
||||
/gun/energy 150 MeV
|
||||
/run/printProgress 1000
|
||||
/run/beamOn 10000</code></pre></li>
|
||||
<div class="sourceCode" id="cb35"><pre class="sourceCode default code-with-copy"><code class="sourceCode default"><span id="cb35-1"><a href="#cb35-1" aria-hidden="true" tabindex="-1"></a>/run/numberOfThreads 1</span>
|
||||
<span id="cb35-2"><a href="#cb35-2" aria-hidden="true" tabindex="-1"></a>/run/initialize</span>
|
||||
<span id="cb35-3"><a href="#cb35-3" aria-hidden="true" tabindex="-1"></a>/gun/particle proton</span>
|
||||
<span id="cb35-4"><a href="#cb35-4" aria-hidden="true" tabindex="-1"></a>/gun/energy 150 MeV</span>
|
||||
<span id="cb35-5"><a href="#cb35-5" aria-hidden="true" tabindex="-1"></a>/run/printProgress 1000</span>
|
||||
<span id="cb35-6"><a href="#cb35-6" aria-hidden="true" tabindex="-1"></a>/run/beamOn 10000</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div></li>
|
||||
<li><p>Create electron beam macro:</p>
|
||||
<div class="sourceCode" id="cb36"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb36-1"><a href="#cb36-1" aria-hidden="true" tabindex="-1"></a><span class="fu">nano</span> electron_beam.mac</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<p>Add:</p>
|
||||
<pre><code>/run/numberOfThreads 1
|
||||
/run/initialize
|
||||
/gun/particle e-
|
||||
/gun/energy 50 MeV
|
||||
/run/printProgress 1000
|
||||
/run/beamOn 10000</code></pre></li>
|
||||
<div class="sourceCode" id="cb37"><pre class="sourceCode default code-with-copy"><code class="sourceCode default"><span id="cb37-1"><a href="#cb37-1" aria-hidden="true" tabindex="-1"></a>/run/numberOfThreads 1</span>
|
||||
<span id="cb37-2"><a href="#cb37-2" aria-hidden="true" tabindex="-1"></a>/run/initialize</span>
|
||||
<span id="cb37-3"><a href="#cb37-3" aria-hidden="true" tabindex="-1"></a>/gun/particle e-</span>
|
||||
<span id="cb37-4"><a href="#cb37-4" aria-hidden="true" tabindex="-1"></a>/gun/energy 50 MeV</span>
|
||||
<span id="cb37-5"><a href="#cb37-5" aria-hidden="true" tabindex="-1"></a>/run/printProgress 1000</span>
|
||||
<span id="cb37-6"><a href="#cb37-6" aria-hidden="true" tabindex="-1"></a>/run/beamOn 10000</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div></li>
|
||||
<li><p>Run simulations and rename output files. Remember: each run produces <code>B1_output_nt_B1_t0.csv</code>, so we rename it after each run before it gets overwritten.</p>
|
||||
<div class="sourceCode" id="cb38"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb38-1"><a href="#cb38-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> build</span>
|
||||
<span id="cb38-2"><a href="#cb38-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
|
||||
@@ -418,15 +418,15 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> ..</span>
|
||||
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="fu">nano</span> lab4.mac</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<p>Add:</p>
|
||||
<pre><code># Lab 4: PET scanner data run
|
||||
|
||||
# Force single-threaded mode so we get ONE CSV file, not one per worker.
|
||||
# Must come BEFORE /run/initialize. (Same trick as Lab 3.)
|
||||
/run/numberOfThreads 1
|
||||
|
||||
/run/initialize
|
||||
/run/printProgress 5000
|
||||
/run/beamOn 50000</code></pre></li>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode default code-with-copy"><code class="sourceCode default"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a># Lab 4: PET scanner data run</span>
|
||||
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a># Force single-threaded mode so we get ONE CSV file, not one per worker.</span>
|
||||
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a># Must come BEFORE /run/initialize. (Same trick as Lab 3.)</span>
|
||||
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a>/run/numberOfThreads 1</span>
|
||||
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a>/run/initialize</span>
|
||||
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a>/run/printProgress 5000</span>
|
||||
<span id="cb13-9"><a href="#cb13-9" aria-hidden="true" tabindex="-1"></a>/run/beamOn 50000</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div></li>
|
||||
<li><p>Run the simulation in batch mode:</p>
|
||||
<div class="sourceCode" id="cb14"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> build</span>
|
||||
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./exampleB3a</span> ../lab4.mac</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
|
||||
+3
-3
@@ -2,11 +2,11 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://jwinterm.github.io/geant4-radiation-labs/lab4_exampleB3/lab4.html</loc>
|
||||
<lastmod>2026-04-27T02:33:01.840Z</lastmod>
|
||||
<lastmod>2026-04-27T02:51:54.213Z</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://jwinterm.github.io/geant4-radiation-labs/lab2_exampleB1/lab2.html</loc>
|
||||
<lastmod>2026-04-27T02:23:54.000Z</lastmod>
|
||||
<lastmod>2026-04-27T02:52:20.535Z</lastmod>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://jwinterm.github.io/geant4-radiation-labs/index.html</loc>
|
||||
@@ -18,6 +18,6 @@
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://jwinterm.github.io/geant4-radiation-labs/lab3_modifyB1/lab3.html</loc>
|
||||
<lastmod>2026-04-27T02:32:51.882Z</lastmod>
|
||||
<lastmod>2026-04-27T02:51:25.961Z</lastmod>
|
||||
</url>
|
||||
</urlset>
|
||||
|
||||
Reference in New Issue
Block a user