@@ -317,6 +317,26 @@ bool helpOnCommandLine(ConfigContext const& configcontext)
317317 return helpasked;
318318}
319319
320+ // Finding out if the current process is the master DPL driver process,
321+ // first setting up the topology. Might be important to know when we write
322+ // files (to prevent that multiple processes write the same file)
323+ bool isMasterWorkflowDefinition (ConfigContext const & configcontext)
324+ {
325+ int argc = configcontext.argc ();
326+ auto argv = configcontext.argv ();
327+ bool ismaster = true ;
328+ for (int argi = 0 ; argi < argc; ++argi) {
329+ LOG (INFO) << argi << " " << argv[argi];
330+ // when channel-config is present it means that this is started as
331+ // as FairMQDevice which means it is already a forked process
332+ if (strcmp (argv[argi], " --channel-config" )) {
333+ ismaster = false ;
334+ break ;
335+ }
336+ }
337+ return ismaster;
338+ }
339+
320340// ------------------------------------------------------------------
321341
322342// / This function is required to be implemented to define the workflow
@@ -326,21 +346,20 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
326346 // check if we merely construct the topology to create help options
327347 // if this is the case we don't need to read from GRP
328348 bool helpasked = helpOnCommandLine (configcontext);
349+ bool ismaster = isMasterWorkflowDefinition (configcontext);
329350
330351 // Reserve one entry which fill be filled with the SimReaderSpec
331352 // at the end. This places the processor at the beginning of the
332353 // workflow in the upper left corner of the GUI.
333354 WorkflowSpec specs (1 );
334355
335- o2::conf::ConfigurableParam::updateFromFile (configcontext.options ().get <std::string>(" configFile" ));
356+ using namespace o2 ::conf;
357+ ConfigurableParam::updateFromFile (configcontext.options ().get <std::string>(" configFile" ));
336358
337359 // Update the (declared) parameters if changed from the command line
338360 // Note: In the future this should be done only on a dedicated processor managing
339361 // the parameters and then propagated automatically to all devices
340- o2::conf::ConfigurableParam::updateFromString (configcontext.options ().get <std::string>(" configKeyValues" ));
341-
342- // write the configuration used for the digitizer workflow
343- o2::conf::ConfigurableParam::writeINI (" o2digitizerworkflow_configuration.ini" );
362+ ConfigurableParam::updateFromString (configcontext.options ().get <std::string>(" configKeyValues" ));
344363
345364 // which sim productions to overlay and digitize
346365 auto simPrefixes = splitString (configcontext.options ().get <std::string>(" sims" ), ' ,' );
@@ -355,6 +374,17 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
355374 }
356375 }
357376
377+ // update the digitization configuration with the right geometry file
378+ // we take the geometry from the first simPrefix (could actually check if they are
379+ // all compatible)
380+ auto geomfilename = o2::conf::NameConf::getGeomFileName (simPrefixes[0 ]);
381+ ConfigurableParam::setValue (" DigiParams.digitizationgeometry" , geomfilename);
382+
383+ // write the configuration used for the digitizer workflow
384+ if (ismaster) {
385+ o2::conf::ConfigurableParam::writeINI (std::string (o2::base::NameConf::DIGITIZATIONCONFIGFILE));
386+ }
387+
358388 // onlyDet takes precedence on skipDet
359389 DetFilterer filterers[2 ] = {
360390 whitelister (configcontext.options ().get <std::string>(" onlyDet" ), " none" , ' ,' ),
@@ -393,7 +423,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
393423
394424 // the TPC part
395425 // we need to init this anyway since TPC is treated a bit special (for the moment)
396- if (!helpasked) {
426+ if (!helpasked && ismaster ) {
397427 initTPC ();
398428 }
399429
0 commit comments