Skip to content

Commit 5a8de99

Browse files
committed
adjusting template
1 parent 137fb9a commit 5a8de99

5 files changed

Lines changed: 213 additions & 119 deletions

File tree

LICENSE

Lines changed: 0 additions & 91 deletions
This file was deleted.

LICENSE.md

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# GEMC Software License
2+
3+
*Version 1.0, August 25, 2025*
4+
5+
> [!WARNING]
6+
> Copyright (c) 2006–2025,
7+
> Maurizio Ungaro and Thomas Jefferson National Accelerator Facility (`Jefferson Lab`).
8+
> <br/>
9+
> All rights not expressly granted under this license are reserved.
10+
11+
<br/>
12+
This software includes voluntary contributions made to the GEMC project.
13+
Additional information about GEMC may be provided in the accompanying
14+
documentation or repository.
15+
16+
Installation, use, reproduction, display, modification, and redistribution of
17+
this software, with or without modification, in source and binary forms, are
18+
permitted on a non-exclusive basis. Any exercise of rights by you under this
19+
license is subject to the following conditions:
20+
21+
<br/>
22+
23+
-----
24+
25+
<br/>
26+
27+
### 1\. Redistributions
28+
29+
Redistributions of this software, in whole or in part, with or without
30+
modification, must reproduce the above copyright notice and these license
31+
conditions in (a) the source code, (b) the user documentation, and (c) any
32+
other materials provided with the redistributed software.
33+
34+
<br/>
35+
36+
-----
37+
38+
<br/>
39+
40+
### 2\. User Documentation
41+
42+
The user documentation, if any, included with a redistribution, must
43+
include the following notice:
44+
45+
```
46+
This product includes the GEMC software developed by Maurizio Ungaro
47+
at Thomas Jefferson National Accelerator Facility (Jefferson Lab).
48+
```
49+
50+
If that is where third-party acknowledgments normally appear, this
51+
acknowledgment must also be reproduced in any modified version of this
52+
software itself.
53+
54+
<br/>
55+
56+
-----
57+
58+
<br/>
59+
60+
### 3\. Scientific Citation
61+
62+
Publications or presentations that use this software
63+
or results produced with it must include the following citation:
64+
65+
```bash
66+
M. Ungaro, Geant4 Monte-Carlo (GEMC): A database-driven simulation program,
67+
EPJ Web of Conferences 295, 05005 (2024),
68+
https://doi.org/10.1051/epjconf/202429505005
69+
```
70+
71+
```latex
72+
\bibitem{2024EPJWC.29505005U}
73+
{Ungaro}, M.: Geant4 Monte-Carlo (GEMC) A database-driven simulation program.
74+
\newblock European Physical Journal Web of Conferences \textbf{295}, 05005 (2024).
75+
\newblock \doi{10.1051/epjconf/202429505005}
76+
```
77+
78+
```bibtex
79+
@INPROCEEDINGS{2024EPJWC.29505005U,
80+
author = { {Ungaro}, Maurizio,
81+
title = "{Geant4 Monte-Carlo (GEMC) A database-driven simulation program}",
82+
booktitle = {European Physical Journal Web of Conferences},
83+
year = 2024,
84+
series = {European Physical Journal Web of Conferences},
85+
volume = {295},
86+
month = may,
87+
eid = {05005},
88+
pages = {05005},
89+
doi = {10.1051/epjconf/202429505005},
90+
adsurl = {https://ui.adsabs.harvard.edu/abs/2024EPJWC.29505005U},
91+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
92+
}
93+
```
94+
95+
<br/>
96+
97+
-----
98+
99+
<br/>
100+
101+
### 4\. Names and Endorsement
102+
103+
The names `GEMC` and `GEMC: Geant4 Monte-Carlo` may not be used to endorse or promote
104+
software or products derived from this software except with prior written permission
105+
from the copyright holders. For permissions, contact: [gemc@jlab.org](mailto: gemc@jlab.org).
106+
If this software is redistributed in a modified form, the name and reference of the modified
107+
version must be clearly distinguishable from that of this software.
108+
109+
<br/>
110+
111+
-----
112+
113+
<br/>
114+
115+
### 5\. Modifications
116+
117+
You are under no obligation to provide anyone with any modifications of this software
118+
that you may develop, including but not limited to bug fixes, patches, upgrades, or other
119+
enhancements or derivatives of features, functionality, or performance.
120+
However, if you publish or distribute your modifications without contemporaneously
121+
requiring users to enter into a separate written license agreement, then you are deemed to
122+
have granted Maurizio Ungaro, Jefferson Lab, and all contributors to GEMC a license to your
123+
modifications, including modifications protected by any patent owned or controlled by you,
124+
under the conditions of this license.
125+
126+
<br/>
127+
128+
-----
129+
130+
<br/>
131+
132+
### 6\. Patents
133+
134+
You may not include this software, in whole or in part, in any patent o
135+
r patent application in respect of any modification of this software developed
136+
by you.
137+
138+
<br/>
139+
140+
-----
141+
142+
<br/>
143+
144+
### 7\. Third-Party Software
145+
146+
This software may be distributed with or may require third-party components (including,
147+
without limitation, Geant4, CLHEP, Qt, ROOT, SQLite, Assimp, and others) that are separately
148+
licensed. Such components are provided under their respective licenses, and you must comply
149+
with those licenses in addition to this one. Where required (for example, by the Geant4
150+
license), you must reproduce the applicable notices and acknowledgments in your redistribution.
151+
152+
<br/>
153+
154+
-----
155+
156+
<br/>
157+
158+
### 8\. DISCLAIMER
159+
160+
**THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY
161+
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
162+
MERCHANTABILITY, SATISFACTORY QUALITY, AND FITNESS FOR A PARTICULAR PURPOSE OR USE
163+
ARE DISCLAIMED. THE COPYRIGHT HOLDERS AND CONTRIBUTORS MAKE NO REPRESENTATION THAT
164+
THE SOFTWARE, OR MODIFICATIONS THEREOF, WILL NOT INFRINGE ANY PATENT, COPYRIGHT,
165+
TRADE SECRET, OR OTHER PROPRIETARY RIGHT.**
166+
167+
<br/>
168+
169+
-----
170+
171+
<br/>
172+
173+
### 9\. LIMITATION OF LIABILITY
174+
175+
**IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
176+
INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES OF ANY
177+
CHARACTER INCLUDING, WITHOUT LIMITATION, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
178+
LOSS OF USE, DATA, OR PROFITS, OR BUSINESS INTERRUPTION, HOWEVER CAUSED AND ON ANY THEORY
179+
OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY, OR OTHERWISE,
180+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
181+
OF SUCH DAMAGES.**
182+
183+
<br/>
184+
185+
-----
186+
187+
<br/>
188+
189+
### 10\. Termination
190+
191+
This license shall terminate with immediate effect and without notice if you fail
192+
to comply with any of its terms, or if you institute litigation against any copyright
193+
holder or contributor with regard to this software.

api/system_template.py

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ def write_templates(system, variations):
125125
print(f' * {v}')
126126
print()
127127

128-
# create directory if not existing
128+
# create the directory if not existing
129129
if not os.path.exists(system):
130130
os.makedirs(system)
131131

132132
system_script = system + '/' + system + '.py'
133-
geo_script = system + '/geometry_' + system + '.py'
133+
geo_script = system + '/geometry.py'
134134
mat_script = system + '/materials.py'
135135
yaml = system + '/' + system + '.yaml'
136136
readme = system + '/README.md'
@@ -143,12 +143,12 @@ def write_templates(system, variations):
143143
ps.write('from utils_api import GConfiguration\n\n')
144144
ps.write(f'# {system}:\n')
145145
ps.write('from materials import define_materials\n')
146-
ps.write(f'from geometry import build_geometry\n\n')
146+
ps.write(f'from geometry import build_{system}\n\n')
147147
ps.write('def main():\n')
148148
ps.write(' # Define GConfiguration name, factory and description.\n')
149149
ps.write(f' configuration = GConfiguration(\'{experiment}\', \'{system}\')\n\n')
150150
ps.write(' define_materials(configuration)\n')
151-
ps.write(f' build_geometry(configuration)\n')
151+
ps.write(f' build_{system}(configuration)\n')
152152
ps.write(' configuration.printC()\n\n\n')
153153
ps.write('if __name__ == "__main__":\n')
154154
ps.write(' main()\n\n\n')
@@ -187,54 +187,46 @@ def write_templates(system, variations):
187187
pg.write('def build_mother_volume(configuration):\n')
188188
pg.write(' gvolume = GVolume(\'absorber\')\n')
189189
pg.write(' gvolume.description = \'scintillator box\'\n')
190-
pg.write(' gvolume.make_box(100.0, 100.0, 100.0)\n')
190+
pg.write(' gvolume.make_box(100.0, 100.0, 1.0)\n')
191191
pg.write(' gvolume.material = \'carbonFiber\'\n')
192192
pg.write(' gvolume.color = \'3399FF\'\n')
193193
pg.write(' gvolume.digitization = \'flux\'\n')
194+
pg.write(' gvolume.set_position(0, 0, 100)\n')
195+
pg.write(' gvolume.style = 1\n')
194196
pg.write(' gvolume.set_identifier(\'box\', 2) # identifier for this box\n')
195-
196-
pg.write(' gvolume.style = 0\n')
197197
pg.write(' gvolume.publish(configuration)\n\n')
198+
198199
pg.write('def build_target(configuration):\n')
199200
pg.write(' gvolume = GVolume(\'target\')\n')
200201
pg.write(' gvolume.description = \'epoxy target\'\n')
201-
pg.write(' gvolume.mother = \'absorber\'\n')
202202
pg.write(' gvolume.make_tube(0, 20, 40, 0, 360)\n')
203203
pg.write(' gvolume.material = \'epoxy\'\n')
204-
pg.write(' gvolume.color = \'ff0000\'\n')
205204
pg.write(' gvolume.publish(configuration)\n\n\n\n')
206205

207-
geo_main = system + '/geometry.py'
208-
# ask_to_overwrite_file(geo_main)
209-
with open(f'{geo_main}', 'w') as pg:
210-
pg.write(f'from geometry_{system} import build_{system}\n\n')
211-
pg.write(f'def build_geometry(configuration):\n')
212-
pg.write(f' build_{system}(configuration)\n')
213206

214207
# ask_to_overwrite_file(yaml)
215208
with open(f'{yaml}', 'w') as pj:
216209
pj.write('runno: 1\n')
217210
pj.write('n: 10\n\n')
218211
pj.write('gparticle:\n')
219-
pj.write(' - name: e-\n')
212+
pj.write(' - name: proton\n')
220213
pj.write(' p: 1500\n')
221-
pj.write(' theta: 23.0\n')
214+
pj.write(' theta: 10.0\n')
222215
pj.write(' delta_theta: 4.0\n')
223-
pj.write(' delta_phi: 18.0\n')
224-
pj.write(' multiplicity: 4\n\n')
225-
pj.write(' - name: proton\n')
226-
pj.write(' p: 3000\n\n')
216+
pj.write(' delta_phi: 180.0\n')
217+
pj.write(' vz: -100.0\n')
227218
pj.write('verbosity:\n')
228-
pj.write(' - ghits: 2\n')
229-
pj.write(' - gsystem: 2\n')
230-
pj.write(' - gstreamer: 2\n')
231-
pj.write(' - general: 2\n\n')
219+
pj.write(' - ghits: 0\n')
220+
pj.write(' - gsystem: 1\n')
221+
pj.write(' - gstreamer: 0\n')
222+
pj.write(' - general: 1\n\n')
232223
pj.write('gsystem:\n')
233224
pj.write(f' - name: {system}\n')
234-
pj.write(' factory: ascii\n\n')
225+
pj.write(' factory: sqlite\n\n')
235226
pj.write('gstreamer:\n')
236227
pj.write(f' - filename: {system}.txt\n')
237228
pj.write(' format: ascii\n\n')
229+
pj.write('root: G4Box, 15*cm, 15*cm, 15*cm, G4_AIR\n')
238230

239231
# ask_to_overwrite_file(readme)
240232
with open(f'{readme}', 'w') as rm:

gstreamer/factories/ASCII/gstreamerASCIIConnection.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ bool GstreamerTextFactory::closeConnectionImpl() {
1919

2020
if (ofile->is_open()) { log->error(ERR_CANTCLOSEOUTPUT, "GstreamerTextFactory: could not close file " + filename()); }
2121

22-
delete ofile;
22+
/// delete ofile;
2323
return true;
2424
}

0 commit comments

Comments
 (0)