forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
341 lines (296 loc) · 14.2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
#
# In applying this license CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.
# allsim is not a real library (i.e. not something that is built) but a
# convenient bag for all the deps needed in the executables below
add_library(allsim INTERFACE)
target_link_libraries(allsim
INTERFACE O2::SimConfig
O2::CommonUtils
O2::Steer
O2::SimSetup
O2::SimulationDataFormat
FairMQ::FairMQ
O2::CPVSimulation
O2::DetectorsPassive
O2::EMCALSimulation
O2::FDDSimulation
O2::Field
O2::HMPIDSimulation
O2::ITSSimulation
O2::MCHSimulation
O2::MFTSimulation
O2::MIDSimulation
O2::PHOSSimulation
O2::FT0Simulation
O2::TOFSimulation
O2::TPCSimulation
O2::TRDSimulation
O2::FV0Simulation
O2::ZDCSimulation
O2::FOCALSimulation
$<$<BOOL:${ENABLE_UPGRADES}>:O2::Alice3DetectorsPassive>
$<$<BOOL:${ENABLE_UPGRADES}>:O2::ITS3Simulation>
$<$<BOOL:${ENABLE_UPGRADES}>:O2::TRKSimulation>
$<$<BOOL:${ENABLE_UPGRADES}>:O2::FT3Simulation>
$<$<BOOL:${ENABLE_UPGRADES}>:O2::FCTSimulation>
$<$<BOOL:${ENABLE_UPGRADES}>:O2::IOTOFSimulation>
$<$<BOOL:${ENABLE_UPGRADES}>:O2::RICHSimulation>
$<$<BOOL:${ENABLE_UPGRADES}>:O2::ECalSimulation>
$<$<BOOL:${ENABLE_UPGRADES}>:O2::MI3Simulation>
O2::Generators)
add_library(internal::allsim ALIAS allsim)
o2_add_executable(device-runner
COMPONENT_NAME sim
SOURCES O2SimDeviceRunner.cxx
PUBLIC_LINK_LIBRARIES internal::allsim)
o2_add_executable(serial
COMPONENT_NAME sim
SOURCES o2sim.cxx
PUBLIC_LINK_LIBRARIES internal::allsim)
o2_add_executable(evalmat
COMPONENT_NAME sim
SOURCES o2sim_evalmat.cxx
PUBLIC_LINK_LIBRARIES internal::allsim)
o2_add_executable(sim
SOURCES o2sim_parallel.cxx
PUBLIC_LINK_LIBRARIES internal::allsim O2::Version
TARGETVARNAME simdriver)
o2_add_executable(primary-server-device-runner
COMPONENT_NAME sim
SOURCES O2PrimaryServerDeviceRunner.cxx
PUBLIC_LINK_LIBRARIES internal::allsim
TARGETVARNAME simexe)
if(ENABLE_UPGRADES)
o2_add_executable(serial-run5
COMPONENT_NAME sim
SOURCES o2sim.cxx
PUBLIC_LINK_LIBRARIES internal::allsim)
o2_add_executable(sim-run5
SOURCES o2sim_parallel.cxx
PUBLIC_LINK_LIBRARIES internal::allsim O2::Version
TARGETVARNAME simdriverrun5)
o2_add_executable(evalmat-run5
COMPONENT_NAME sim
SOURCES o2sim_evalmat.cxx
PUBLIC_LINK_LIBRARIES internal::allsim)
endif()
if(NOT APPLE)
set_property(TARGET ${simexe} PROPERTY LINK_WHAT_YOU_USE ON)
endif()
o2_add_executable(hit-merger-runner
COMPONENT_NAME sim
SOURCES O2HitMergerRunner.cxx
PUBLIC_LINK_LIBRARIES internal::allsim)
o2_add_executable(g4-determine-unknown-pdg-properties
COMPONENT_NAME sim
SOURCES g4DetermineUnknownPdgProperties.cxx
PUBLIC_LINK_LIBRARIES O2::O2TrivialMC MC::Geant4 MC::Geant4VMC O2::SimConfig)
o2_add_executable(mctracks-proxy
COMPONENT_NAME sim
SOURCES o2sim_mctracks_proxy.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::SimulationDataFormat)
o2_add_executable(kine-publisher
COMPONENT_NAME sim
SOURCES o2sim_kine_publisher.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::SimulationDataFormat O2::Steer)
o2_add_executable(dpl-eventgen
COMPONENT_NAME sim
SOURCES dpl_eventgen.cxx
PUBLIC_LINK_LIBRARIES O2::Generators O2::Framework O2::SimulationDataFormat)
o2_add_executable(hepmc-publisher
COMPONENT_NAME sim
SOURCES o2sim_hepmc_publisher.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::SimulationDataFormat O2::Steer MC::HepMC3)
o2_add_executable(mctracks-to-aod
COMPONENT_NAME sim
SOURCES o2sim_mctracks_to_aod.cxx ../Detectors/AOD/src/AODMcProducerHelpers.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::SimulationDataFormat)
target_include_directories(O2exe-sim-mctracks-to-aod
PRIVATE
../Detectors/AOD/include)
o2_add_executable(mc-to-hepmc
COMPONENT_NAME aod
SOURCES o2aod_mc_to_hepmc.cxx
PUBLIC_LINK_LIBRARIES
O2::Framework
O2::SimulationDataFormat
O2::Generators)
o2_add_dpl_workflow(mctracks-to-aod-simple-task
SOURCES SimExamples/McTracksToAOD/mctracks_to_aod_simple_task.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
COMPONENT_NAME Analysis)
o2_data_file(COPY o2simtopology_template.json DESTINATION config)
o2_data_file(COPY o2simdefaultdetectorlist.json DESTINATION config)
# * # add a complex simulation as a unit test (if simulation was enabled)
# perform
# * # some checks on kinematics and track references
# make workspace for simulation tests
set(SIMTESTDIR ${CMAKE_BINARY_DIR}/o2sim_tests)
file(MAKE_DIRECTORY ${SIMTESTDIR})
# define environment needed for simulation tests (during build phase)
# needed because the build environment is different to runtime environment
set(SIMENV "ALICE_O2SIM_DUMPLOG=ON;O2_ROOT=${CMAKE_BINARY_DIR}/stage;VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/share;ROOT_INCLUDE_PATH=$ENV{ROOT_INCLUDE_PATH}:$ENV{HEPMC3_ROOT}/include;ROOT_DYN_PATH=$ENV{ROOTSYS}/lib")
message(STATUS "SIMENV = ${SIMENV}")
o2_name_target(sim NAME o2simExecutable IS_EXE)
o2_name_target(sim-serial NAME o2simSerialExecutable IS_EXE)
if(ENABLE_UPGRADES)
o2_name_target(sim-serial-run5 NAME o2simSerialRun5Executable IS_EXE)
o2_name_target(sim-run5 NAME o2simRun5Executable IS_EXE)
o2_name_target(sim-evalmat-run5 NAME o2simEvalmatRun5Executable IS_EXE)
target_compile_definitions(${o2simSerialRun5Executable} PUBLIC SIM_RUN5)
target_compile_definitions(${o2simRun5Executable} PUBLIC SIM_RUN5)
target_compile_definitions(${o2simEvalmatRun5Executable} PUBLIC SIM_RUN5)
endif()
if (BUILD_TESTING)
o2_add_test_command(NAME o2sim_G4
WORKING_DIRECTORY ${SIMTESTDIR}
TIMEOUT 400
COMMAND $<TARGET_FILE:${o2simExecutable}>
COMMAND_LINE_ARGS -n
2
-j
2
-e
TGeant4
-o
o2simG4
--chunkSize
2
--skipModules
MFT ZDC
--seed
15946057944514955802
--configKeyValues
"align-geom.mDetectors=none"
ENVIRONMENT "${SIMENV}"
LABELS "g4;sim;long")
set_tests_properties(o2sim_G4
PROPERTIES PASS_REGULAR_EXPRESSION
"SIMULATION RETURNED SUCCESFULLY" FIXTURES_SETUP
G4)
set_property(TEST o2sim_G4 APPEND PROPERTY ENVIRONMENT ${G4ENV})
# # note that the MT is currently only supported in the non FairMQ version
# # switched off
# o2_add_test_command(NAME o2sim_G4_mt
# WORKING_DIRECTORY ${SIMTESTDIR}
# TIMEOUT 400
# COMMAND $<TARGET_FILE:${o2simSerialExecutable}>
# COMMAND_LINE_ARGS -n
# 1
# -e
# TGeant4
# --isMT
# on
# -o
# o2simG4MT
# ENVIRONMENT "${SIMENV}"
# LABELS "g4;sim;long")
#set_tests_properties(o2sim_G4_mt
# PROPERTIES PASS_REGULAR_EXPRESSION
# "Macro finished succesfully")
#set_property(TEST o2sim_G4_mt APPEND PROPERTY ENVIRONMENT ${G4ENV})
o2_add_test(CheckStackG4
SOURCES checkStack.cxx
NAME o2sim_checksimkinematics_G4
WORKING_DIRECTORY ${SIMTESTDIR}
COMMAND_LINE_ARGS o2simG4
PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::Steer O2::ITSSimulation
NO_BOOST_TEST
LABELS "g4;sim;long")
set_tests_properties(o2sim_checksimkinematics_G4
PROPERTIES FIXTURES_REQUIRED G4)
# GEANT3 simulation fails on Macs, so disable it.
if(NOT APPLE)
o2_add_test_command(NAME o2sim_G3
WORKING_DIRECTORY ${SIMTESTDIR}
COMMAND $<TARGET_FILE:${o2simExecutable}>
COMMAND_LINE_ARGS -n
2
-j
2
-e
TGeant3
-o
o2simG3
-g
pythia8pp
--chunkSize
10
--seed
15946057944514955802
--configKeyValues
"align-geom.mDetectors=none"
LABELS g3 sim long
ENVIRONMENT "${SIMENV}"
)
# set properties for G3 ... we use fixtures to force execution after G4 (since
# they require multiple CPUs)
set_tests_properties(o2sim_G3
PROPERTIES PASS_REGULAR_EXPRESSION
"SIMULATION RETURNED SUCCESFULLY"
FIXTURES_REQUIRED
G4
FIXTURES_SETUP
G3)
o2_add_test(CheckStackG3
SOURCES checkStack.cxx
NAME o2sim_checksimkinematics_G3
WORKING_DIRECTORY ${SIMTESTDIR}
COMMAND_LINE_ARGS o2simG3
PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::Steer O2::ITSSimulation
NO_BOOST_TEST
LABELS "g3;sim;long")
set_tests_properties(o2sim_checksimkinematics_G3
PROPERTIES FIXTURES_REQUIRED G3)
o2_add_test_command(NAME o2sim_hepmc
WORKING_DIRECTORY ${SIMTESTDIR}
TIMEOUT 400
COMMAND $<TARGET_FILE:${o2simExecutable}>
COMMAND_LINE_ARGS -n
2
-j
2
-g
hepmc
--configKeyValues
"GeneratorFileOrCmd.fileNames=${CMAKE_SOURCE_DIR}/Generators/share/data/pythia.hepmc;HepMC.version=2;align-geom.mDetectors=none"
-o
o2simhepmc
LABELS long sim hepmc3
ENVIRONMENT "${SIMENV}")
set_tests_properties(o2sim_hepmc
PROPERTIES PASS_REGULAR_EXPRESSION
"SIMULATION RETURNED SUCCESFULLY")
set_property(TEST o2sim_hepmc APPEND PROPERTY ENVIRONMENT ${G4ENV})
# somewhat analyse the logfiles as another means to detect problems
o2_add_test_command(NAME o2sim_G3_checklogs
WORKING_DIRECTORY ${SIMTESTDIR}
COMMAND ${CMAKE_SOURCE_DIR}/run/simlogcheck.sh
COMMAND_LINE_ARGS o2simG3_serverlog o2simG3_mergerlog o2simG3_workerlog0
LABELS long sim hepmc3)
set_tests_properties(o2sim_G3_checklogs
PROPERTIES FIXTURES_REQUIRED G3)
endif()
# somewhat analyse the logfiles as another means to detect problems
o2_add_test_command(NAME o2sim_G4_checklogs
WORKING_DIRECTORY ${SIMTESTDIR}
COMMAND ${CMAKE_SOURCE_DIR}/run/simlogcheck.sh
COMMAND_LINE_ARGS o2simG4_serverlog o2simG4_mergerlog o2simG4_workerlog0
LABELS long sim
)
set_tests_properties(o2sim_G4_checklogs
PROPERTIES FIXTURES_REQUIRED G4)
endif()
install(FILES o2-sim-client.py PERMISSIONS GROUP_READ GROUP_EXECUTE OWNER_EXECUTE OWNER_WRITE OWNER_READ WORLD_EXECUTE WORLD_READ DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY SimExamples/
DESTINATION examples
PATTERN *
PERMISSIONS GROUP_READ GROUP_EXECUTE OWNER_EXECUTE OWNER_WRITE OWNER_READ WORLD_EXECUTE WORLD_READ)