@@ -74,6 +74,7 @@ extern GPUSettingsStandalone configStandalone;
7474GPUReconstruction *rec, *recAsync, *recPipeline;
7575GPUChainTracking *chainTracking, *chainTrackingAsync, *chainTrackingPipeline;
7676GPUChainITS *chainITS, *chainITSAsync, *chainITSPipeline;
77+ std::string eventsDir;
7778void unique_ptr_aligned_delete (char * v)
7879{
7980 operator delete (v, std::align_val_t (GPUCA_BUFFER_ALIGNMENT));
@@ -277,21 +278,19 @@ int32_t ReadConfiguration(int argc, char** argv)
277278int32_t SetupReconstruction ()
278279{
279280 if (!configStandalone.eventGenerator ) {
280- char filename[256 ];
281- snprintf (filename, 256 , " events/%s/" , configStandalone.eventsDir );
282281 if (configStandalone.noEvents ) {
283- configStandalone. eventsDir = " NON_EXISTING" ;
282+ eventsDir = " NON_EXISTING" ;
284283 configStandalone.rundEdx = false ;
285- } else if (rec->ReadSettings (filename )) {
284+ } else if (rec->ReadSettings (eventsDir. c_str () )) {
286285 printf (" Error reading event config file\n " );
287286 return 1 ;
288287 }
289- printf (" Read event settings from dir %s (solenoidBz: %f, constBz %d, maxTimeBin %d)\n " , filename , rec->GetGRPSettings ().solenoidBzNominalGPU , (int32_t )rec->GetGRPSettings ().constBz , rec->GetGRPSettings ().grpContinuousMaxTimeBin );
288+ printf (" Read event settings from dir %s (solenoidBz: %f, constBz %d, maxTimeBin %d)\n " , eventsDir. c_str () , rec->GetGRPSettings ().solenoidBzNominalGPU , (int32_t )rec->GetGRPSettings ().constBz , rec->GetGRPSettings ().grpContinuousMaxTimeBin );
290289 if (configStandalone.testSyncAsync ) {
291- recAsync->ReadSettings (filename );
290+ recAsync->ReadSettings (eventsDir. c_str () );
292291 }
293292 if (configStandalone.proc .doublePipeline ) {
294- recPipeline->ReadSettings (filename );
293+ recPipeline->ReadSettings (eventsDir. c_str () );
295294 }
296295 }
297296
@@ -504,23 +503,19 @@ int32_t SetupReconstruction()
504503
505504int32_t ReadEvent (int32_t n)
506505{
507- char filename[256 ];
508- snprintf (filename, 256 , " events/%s/" GPUCA_EVDUMP_FILE " .%d.dump" , configStandalone.eventsDir , n);
509506 if (configStandalone.inputcontrolmem && !configStandalone.preloadEvents ) {
510507 rec->SetInputControl (inputmemory.get (), configStandalone.inputcontrolmem );
511508 }
512- int32_t r = chainTracking->ReadData (filename );
509+ int32_t r = chainTracking->ReadData ((eventsDir + GPUCA_EVDUMP_FILE " . " + std::to_string (n) + " .dump " ). c_str () );
513510 if (r) {
514511 return r;
515512 }
516513#if defined(GPUCA_TPC_GEOMETRY_O2) && defined(GPUCA_BUILD_QA) && !defined(GPUCA_O2_LIB)
517514 if ((configStandalone.proc .runQA || configStandalone.eventDisplay ) && !configStandalone.QA .noMC ) {
518515 chainTracking->ForceInitQA ();
519- snprintf (filename, 256 , " events/%s/mc.%d.dump" , configStandalone.eventsDir , n);
520516 chainTracking->GetQA ()->UpdateChain (chainTracking);
521- if (chainTracking->GetQA ()->ReadO2MCData (filename)) {
522- snprintf (filename, 256 , " events/%s/mc.%d.dump" , configStandalone.eventsDir , 0 );
523- if (chainTracking->GetQA ()->ReadO2MCData (filename) && configStandalone.proc .runQA ) {
517+ if (chainTracking->GetQA ()->ReadO2MCData ((eventsDir + " mc." + std::to_string (n) + " .dump" ).c_str ())) {
518+ if (chainTracking->GetQA ()->ReadO2MCData ((eventsDir + " mc.0.dump" ).c_str ()) && configStandalone.proc .runQA ) {
524519 throw std::runtime_error (" Error reading O2 MC dump" );
525520 }
526521 }
@@ -725,6 +720,7 @@ int32_t main(int argc, char** argv)
725720 if (ReadConfiguration (argc, argv)) {
726721 return 1 ;
727722 }
723+ eventsDir = std::string (configStandalone.absoluteEventsDir ? " " : " events/" ) + configStandalone.eventsDir + " /" ;
728724
729725 GPUSettingsDeviceBackend deviceSet;
730726 deviceSet.deviceType = configStandalone.runGPU ? GPUDataTypes::GetDeviceType (configStandalone.gpuType .c_str ()) : GPUDataTypes::DeviceType::CPU;
@@ -787,9 +783,7 @@ int32_t main(int argc, char** argv)
787783
788784 for (nEventsInDirectory = 0 ; true ; nEventsInDirectory++) {
789785 std::ifstream in;
790- char filename[256 ];
791- snprintf (filename, 256 , " events/%s/" GPUCA_EVDUMP_FILE " .%d.dump" , configStandalone.eventsDir , nEventsInDirectory);
792- in.open (filename, std::ifstream::binary);
786+ in.open ((eventsDir + GPUCA_EVDUMP_FILE " ." + std::to_string (nEventsInDirectory) + " .dump" ).c_str (), std::ifstream::binary);
793787 if (in.fail ()) {
794788 break ;
795789 }
@@ -801,7 +795,7 @@ int32_t main(int argc, char** argv)
801795 }
802796
803797 if (configStandalone.eventGenerator ) {
804- genEvents::RunEventGenerator (chainTracking);
798+ genEvents::RunEventGenerator (chainTracking, eventsDir );
805799 return 0 ;
806800 }
807801
@@ -811,7 +805,7 @@ int32_t main(int argc, char** argv)
811805 } else {
812806 if (nEvents == -1 || nEvents > nEventsInDirectory) {
813807 if (nEvents >= 0 ) {
814- printf (" Only %d events available in directors %s (%d events requested)\n " , nEventsInDirectory, configStandalone. eventsDir , nEvents);
808+ printf (" Only %d events available in directory %s (%d events requested)\n " , nEventsInDirectory, eventsDir. c_str () , nEvents);
815809 }
816810 nEvents = nEventsInDirectory;
817811 }
0 commit comments