CMakeLists.txt 13.7 KB
Newer Older
1
2
# =====   Generate the needed shell scripts   ================================
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_tra_file.C)
3
4
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_transport_json_config.C)
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_digi_json_config.C)
5
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_tra_beam.C)
6
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_digi.C)
7
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_reco.C)
8
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_qa.C)
9
10
11
12
13
# ============================================================================


# =====   Copy the .rootrc file into the directory from which root is executed
# --- Otherwise the rootalias file is not loaded
14
file(COPY ${CBMROOT_SOURCE_DIR}/macro/include/.rootrc
15
16
17
18
19
	DESTINATION ${CBMROOT_BINARY_DIR}/macro/run)
# ============================================================================


# =====   Define variables for tests   =======================================
20
if(${CBM_TEST_MODEL} MATCHES Weekly)
21
  Set(nEvents 100)
22
23
  Set(uploadHistJPG 1)
  Set(pullDevAllowed .2)
24
  Set(randomSeed 1)
25
26
else()
  Set(nEvents 3)
27
28
  Set(uploadHistJPG 0)
  Set(pullDevAllowed .5)
29
  Set(randomSeed 1)
30
endIf()
31

32
33
34
math(EXPR timeOutTime "${nEvents} * 200")
math(EXPR nBeam "${nEvents} * 3")
# ============================================================================
35

36
37

# =====   Define the different setups to be tested with   ====================
38
if(NOT ${CBM_TEST_MODEL} MATCHES Experimental )
39
  List(APPEND cbm_setup sis100_hadron sis100_electron sis100_muon_lmvm
40
41
  	sis100_muon_jpsi sis300_electron)
else()
42
  List(APPEND cbm_setup sis100_electron sis100_muon_jpsi)
43
44
45
46
47
endif()
# ============================================================================


# =====   Cleanup the data directory   =======================================
48
add_test(run_cleanup ${CMAKE_COMMAND}
49
	-P ${CMAKE_SOURCE_DIR}/cmake/scripts/cleanmacrodir.cmake)
50
set_tests_properties(run_cleanup PROPERTIES
51
	TIMEOUT ${timeOutTime}
52
	FIXTURES_SETUP run_cleanup
53
54
55
56
57
58
59
60
)
# ============================================================================


# =====   Define tests for each setup   ======================================
foreach(setup IN LISTS cbm_setup)

  # --- Short name for setup
61
  if(setup MATCHES sis100_hadron)
62
  	set(sname s100h)
63
  elseif(setup MATCHES sis100_electron)
64
  	set(sname s100e)
65
  elseif(setup MATCHES sis100_muon_lmvm)
66
  	set(sname s100m2)
67
  elseif(setup MATCHES sis100_muon_jpsi)
68
  	set(sname s100m3)
69
  elseif(setup MATCHES sis300_electron)
70
71
72
73
74
  	set(sname s300e)
  else()
  	set(sname test)
  endif()

75
76
77
  # --- Test run_transport_json_config
  # --- Transport run using run_transport_json_config.C
  set(testname run_transport_json_config)
78
  add_test(${testname} ${MACRO_DIR}/run_transport_json_config.sh \"\" 2 ${randomSeed})
79
80
81
  set_tests_properties(${testname} PROPERTIES
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
82
  	FIXTURES_REQUIRED run_cleanup
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  	FIXTURES_SETUP fixt_tra_json_config
  	RESOURCE_LOCK json_config_ParDb
  )

  # --- Test run_digi_json_config
  # --- Digitization run with using run_digi_json_config.C
  set(testname run_digi_json_config)
  add_test(${testname} ${MACRO_DIR}/run_digi_json_config.sh)
  set_tests_properties(${testname} PROPERTIES
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
  	FIXTURES_REQUIRED fixt_tra_json_config
  	FIXTURES_SETUP fixt_digi_json_config
  	RESOURCE_LOCK json_config_ParDb
  )

99
100
101
102
  # --- Test run_tra_coll
  # --- Transport run with collision events, using run_tra_file.C
  set(testname run_${sname}_tra_coll)
  set(input ${CBMROOT_SOURCE_DIR}/input/urqmd.auau.10gev.centr.root)
103
  add_test(${testname} ${MACRO_DIR}/run_tra_file.sh
104
  	\"${input}\" ${nEvents} \"data/${sname}_coll\" \"${setup}\" kGeant3 ${randomSeed})
105
  set_tests_properties(${testname} PROPERTIES
106
107
108
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
  	FIXTURES_REQUIRED cleanup
109
  	FIXTURES_SETUP fixt_tra_coll_${setup}
110
111
  	RESOURCE_LOCK collParDb_${setup}
  )
112

113
114
115
116
  # --- Test run_tra_sign
  # --- Transport run with signal events, using run_tra_file.C
  set(testname run_${sname}_tra_sign)
  set(input ${CBMROOT_SOURCE_DIR}/input/pluto.auau.8gev.omega.mpmm.0001.root)
117
  add_test(${testname} ${MACRO_DIR}/run_tra_file.sh
118
  	\"${input}\" ${nEvents} \"data/${sname}_sign\" \"${setup}\" kGeant3 ${randomSeed})
119
  set_tests_properties(${testname} PROPERTIES
120
121
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
122
  	FIXTURES_REQUIRED run_cleanup
123
  	FIXTURES_SETUP fixt_tra_sign_${setup}
124
125
  	RESOURCE_LOCK signParDb_${setup}
  )
126

127
128
129
  # --- Test run_tra_beam
  # --- Transport run with beam events, using run_tra_beam.C
  set(testname run_${sname}_tra_beam)
130
  add_test(${testname} ${MACRO_DIR}/run_tra_beam.sh
131
  	${nBeam} \"Au\" 10 -1 \"data/${sname}_beam\" \"${setup}\" kGeant3 ${randomSeed})
132
  set_tests_properties(${testname} PROPERTIES
133
134
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
135
  	FIXTURES_REQUIRED run_cleanup
136
  	FIXTURES_SETUP fixt_tra_beam_${setup}
137
138
  	RESOURCE_LOCK beamParDb_${setup}
  )
139

140
141
142
  # --- Test run_digi_ev
  # --- Detector response simulation, event-by-event, using run_digi.C
  set(testname run_${sname}_digi_ev)
143
  add_test(${testname} ${MACRO_DIR}/run_digi.sh
144
  	\"data/${sname}_coll\" -1 \"data/${sname}_ev\" -1.)
145
  set_tests_properties(${testname} PROPERTIES
146
147
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
148
149
	FIXTURES_REQUIRED fixt_tra_coll_${setup}
  	FIXTURES_SETUP fixt_digi_ev_${setup}
150
151
 	RESOURCE_LOCK collParDb_${setup}
  )
152

153
154
155
156
157
158
  # --- Test run_digi_ts
  # --- Detector response simulation, time-based, using run_digi.C
  set(testname run_${sname}_digi_ts)
  set(eventrate 1.e7)
  set(beamrate 1.e9)
  set(tslength 1.e6)
159
160
  add_test(${testname} ${MACRO_DIR}/run_digi.sh
  	\"data/${sname}_coll\" -1 \"data/${sname}_ts\"\ ${eventrate} ${tslength}
161
  	\"data/${sname}_sign\" \"data/${sname}_beam\" ${beamrate})
162
  set_tests_properties(${testname} PROPERTIES
163
164
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
165
166
 	FIXTURES_REQUIRED "fixt_tra_coll_${setup};fixt_tra_sign_${setup};fixt_tra_beam_${setup}"
  	FIXTURES_SETUP fixt_digi_ts_${setup}
167
168
 	RESOURCE_LOCK collParDb_${setup}
  )
169

170
  # --- Test run_reco_ev_ideal
171
  # --- Event-by-event reconstruction from event-based simulation
172
173
  # --- Ideal raw event builder
  set(testname run_${sname}_reco_ev_ideal)
174
  add_test(${testname} ${MACRODIR}/run_reco.sh
175
  	\"data/${sname}_ev\" -1 0 \"data/${sname}_eb_eb_ideal\" \"Ideal\" \"${setup}\" \"data/${sname}_coll\")
176
  set_tests_properties(${testname} PROPERTIES
177
178
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
179
	FIXTURES_REQUIRED fixt_digi_ev_${setup}
180
	FIXTURES_SETUP fixt_reco_ev_ideal_${setup}
181
182
 	RESOURCE_LOCK collParDb_${setup}
  )
183

184
185
186
187
188
189
190
191
192
193
  # --- Test run_reco_ev_real
  # --- Event-by-event reconstruction from event-based simulation
  # --- Real raw event builder
  set(testname run_${sname}_reco_ev_real)
  add_test(${testname} ${MACRODIR}/run_reco.sh
    \"data/${sname}_ev\" -1 0 \"data/${sname}_eb_eb_real\" \"Real\" \"${setup}\"
    \"data/${sname}_coll\")
  set_tests_properties(${testname} PROPERTIES
    TIMEOUT ${timeOutTime}
    PASS_REGULAR_EXPRESSION "Macro finished successfully"
194
    FIXTURES_REQUIRED fixt_digi_ev_${setup}
195
    FIXTURES_SETUP fixt_reco_ev_real_${setup}
196
197
    RESOURCE_LOCK collParDb_${setup}
  )
198

199
  # --- Test run_reco_ts_eb_ideal
200
  # --- Event-by-event reconstruction from time-based simulation
201
202
  # --- Ideal raw event builder
  set(testname run_${sname}_reco_ts_eb_ideal)
203
  add_test(${testname} ${MACRODIR}/run_reco.sh
204
205
206
207
208
  	\"data/${sname}_ts\" -1 0 \"data/${sname}_ts_eb_ideal\" \"Ideal\" \"${setup}\"
  	\"data/${sname}_coll\")
  set_tests_properties(${testname} PROPERTIES
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
209
	FIXTURES_REQUIRED fixt_digi_ts_${setup}
210
	FIXTURES_SETUP fixt_reco_ts_eb_ideal_${setup}
211
212
 	RESOURCE_LOCK collParDb_${setup}
  )
213

214
215
216
217
218
219
  # --- Test run_reco_ts_eb_real
  # --- Event-by-event reconstruction from time-based simulation
  # --- Real raw event builder
  set(testname run_${sname}_reco_ts_eb_real)
  add_test(${testname} ${MACRODIR}/run_reco.sh
  	\"data/${sname}_ts\" -1 0 \"data/${sname}_ts_eb_real\" \"Real\" \"${setup}\"
220
  	\"data/${sname}_coll\")
221
  set_tests_properties(${testname} PROPERTIES
222
223
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
224
	FIXTURES_REQUIRED fixt_digi_ts_${setup}
225
	FIXTURES_SETUP fixt_reco_ts_eb_real_${setup}
226
227
 	RESOURCE_LOCK collParDb_${setup}
  )
228

229
230
231
232
233
234
235
236
237
238
239
  # --- Test run_qa
  # --- Run QA tasks with Event-by-event reconstruction from time-based simulation
  # --- Real raw event builder
  set(testname run_${sname}_qa)
  add_test(${testname} ${MACRODIR}/run_qa.sh
  	\"data/${sname}_coll\" \"data/${sname}_ts\"  \"data/${sname}_ts_eb_real\" 
	\"data/${sname}_coll\" \"data/${sname}_qa\" \"${setup}\" -1 
	\"data/${sname}_sign\" \"data/${sname}_beam\" )
  set_tests_properties(${testname} PROPERTIES
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
240
241
	FIXTURES_REQUIRED "fixt_tra_coll_${setup};fixt_digi_ts_${setup};fixt_reco_ts_eb_real_${setup}"
	FIXTURES_SETUP fixt_qa_${setup}
242
243
244
 	RESOURCE_LOCK collParDb_${setup}
  )

245
246
247
248
  # --- Test run_reco_ts_tb
  # --- Time-based reconstruction from time-based simulation
  set(testname run_${sname}_reco_ts_tb)
  add_test(${testname} ${MACRODIR}/run_reco.sh
249
  	\"data/${sname}_ts\" -1 0 \"data/${sname}_ts_tb\" \"\" \"${setup}\"
250
  	\"data/${sname}_coll\")
251
  set_tests_properties(${testname} PROPERTIES
252
253
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
254
	FIXTURES_REQUIRED fixt_digi_ts_${setup}
255
	FIXTURES_SETUP fixt_reco_ts_tb_${setup}
256
257
 	RESOURCE_LOCK collParDb_${setup}
  )
258

259
260
261
  # --- Test run_transport_json_config
  # --- Transport run using run_transport_json_config.C
  set(testname run_transport_json_config)
262
  add_test(${testname} ${MACRO_DIR}/run_transport_json_config.sh \"\" 2 ${randomSeed})
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
  set_tests_properties(${testname} PROPERTIES
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
  	FIXTURES_REQUIRED cleanup
  	FIXTURES_SETUP fixt_tra_json_config
  	RESOURCE_LOCK json_config_ParDb
  )

  # --- Test run_digi_json_config
  # --- Digitization run with using run_digi_json_config.C
  set(testname run_digi_json_config)
  add_test(${testname} ${MACRO_DIR}/run_digi_json_config.sh)
  set_tests_properties(${testname} PROPERTIES
  	TIMEOUT ${timeOutTime}
  	PASS_REGULAR_EXPRESSION "Macro finished successfully"
  	FIXTURES_REQUIRED fixt_tra_json_config
  	FIXTURES_SETUP fixt_digi_json_config
  	RESOURCE_LOCK json_config_ParDb
  )


284
285
endforeach(setup IN LISTS cbm_setup)
# ============================================================================
286

287

288
289
290
291
292
293
294
295
296
# =====   mCBM 2021 tests   ==================================================
# ====> only if test TSA files for "typical runs" present
If(DEFINED ENV{RAW_DATA_PATH} )
  SET( RAW_DATA_PATH $ENV{RAW_DATA_PATH} )

  Message( STATUS "Raw data path provided => Performing mCBM 2021 tests using tsa files in ${RAW_DATA_PATH}" )

  ## Generate scripts
  GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_unpack_tsa.C )  # Unpackers
297
  GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2021/check_timing_any.C )  # Check Timing
298
299
300
301
302
303
304
  ## Run only if raw data files present
  ForEach(RUN 1588 )
    Message( STATUS "Checking if raw data file exists: ${RAW_DATA_PATH}/${RUN}_first20Ts.tsa" )
    If(EXISTS ${RAW_DATA_PATH}/${RUN}_first20Ts.tsa)
      Message( STATUS "Raw data file found, tests will be performed for mCBM run ${RUN}" )

      ## Define tests + dependencies
305
      ### Raw data analysis tests: unpacking
306
      Set(testname mcbm_unpack_2021_${RUN})
307
      Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/run/run_unpack_tsa.sh \"${RAW_DATA_PATH}/${RUN}_first20Ts.tsa\" ${RUN})
308
309
310
      Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "600")
      Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished successfully")
      set_tests_properties(${testname} PROPERTIES DEPENDS run_cleanup)
311
      set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED cleanup)
312
313
      Set(fixture_unpacked_${RUN} fixture_done_${testname})
      set_tests_properties(${testname} PROPERTIES FIXTURES_SETUP ${fixture_unpacked_${RUN}})
314
315
316
317
318
319
320
321
322
323
324

      ### Raw data analysis tests: time offsets check
      Set(testname mcbm_chktime_2021_${RUN})
      Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2021/check_timing_any.sh \"${CBMROOT_BINARY_DIR}/macro/run/data/${RUN}_first20Ts.digi.root\" ${RUN})
      Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "600")
      Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Macro finished successfully")
      set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_unpack_2021_${RUN})
      set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED ${fixture_unpacked_${RUN}})
      Set(fixture_chktime_${RUN} fixture_done_${testname})
      set_tests_properties(${testname} PROPERTIES FIXTURES_SETUP ${fixture_chktime_${RUN}})
    EndIf() # If(EXISTS ${RAW_DATA_PATH}/${RUN}_first20Ts.tsa))
325
326
327
328
329
  EndForEach() # ForEach(RUN 1588 )
EndIf() # If(DEFINED ENV{RAW_DATA_PATH} )
#####################
# ============================================================================

330
Install(FILES .rootrc run_tra_file.C run_tra_beam.C run_transport_json_config.C run_digi_json_config.C config.json
331
332
333
334
              run_digi.C run_reco.C run_unpack_online.C run_unpack_tsa.C
        DESTINATION share/cbmroot/macro/run
       )
Install(PROGRAMS run_tests.sh
335
336
337
        DESTINATION share/cbmroot/macro/run
       )
Install(CODE "FILE(MAKE_DIRECTORY \${CMAKE_INSTALL_PREFIX}/share/cbmroot/macro/run/data)")