Skip to content

Commit b606ab8

Browse files
committed
Fix for failing dataflow build
Hybrid generator includes Pythia8, so when the dataflow build happens, without this fix, the Pythia8 header is loaded. It's not found due to the nature of the dataflow build. This fix prevents the Hybrid generator loading if Pythia8 is not found and it includes also HepMC3, given that a similar issue might arise with that generator as well in the future.
1 parent c3ffb66 commit b606ab8

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

Generators/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ o2_add_library(Generators
2424
src/GeneratorTGenerator.cxx
2525
src/GeneratorExternalParam.cxx
2626
src/GeneratorFromFile.cxx
27-
src/GeneratorHybrid.cxx
28-
src/GeneratorHybridParam.cxx
2927
src/GeneratorFromO2KineParam.cxx
3028
src/GeneratorFileOrCmd.cxx
3129
src/GeneratorFileOrCmdParam.cxx
@@ -50,6 +48,8 @@ o2_add_library(Generators
5048
$<$<BOOL:${HepMC3_FOUND}>:src/GeneratorHepMC.cxx>
5149
$<$<BOOL:${HepMC3_FOUND}>:src/GeneratorHepMCParam.cxx>
5250
$<$<BOOL:${HepMC3_FOUND}>:src/AODToHepMC.cxx>
51+
$<$<AND:$<BOOL:${pythia_FOUND}>,$<BOOL:${HepMC3_FOUND}>>:src/GeneratorHybrid.cxx>
52+
$<$<AND:$<BOOL:${pythia_FOUND}>,$<BOOL:${HepMC3_FOUND}>>:src/GeneratorHybridParam.cxx>
5353
PUBLIC_LINK_LIBRARIES FairRoot::Base O2::SimConfig O2::CommonUtils O2::DetectorsBase O2::ZDCBase
5454
O2::SimulationDataFormat ${pythiaTarget} ${hepmcTarget}
5555
FairRoot::Gen

Generators/src/GeneratorFactory.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <fairlogger/Logger.h>
1919
#include <SimConfig/SimConfig.h>
2020
#include <Generators/GeneratorFromFile.h>
21-
#include <Generators/GeneratorHybrid.h>
2221
#include <Generators/GeneratorTParticle.h>
2322
#include <Generators/GeneratorTParticleParam.h>
2423
#ifdef GENERATORS_WITH_PYTHIA8
@@ -27,12 +26,15 @@
2726
#endif
2827
#include <Generators/GeneratorTGenerator.h>
2928
#include <Generators/GeneratorExternalParam.h>
30-
#include <Generators/GeneratorHybridParam.h>
3129
#include "Generators/GeneratorFromO2KineParam.h"
3230
#ifdef GENERATORS_WITH_HEPMC3
3331
#include <Generators/GeneratorHepMC.h>
3432
#include <Generators/GeneratorHepMCParam.h>
3533
#endif
34+
#if defined(GENERATORS_WITH_PYTHIA8) && defined(GENERATORS_WITH_HEPMC3)
35+
#include <Generators/GeneratorHybrid.h>
36+
#include <Generators/GeneratorHybridParam.h>
37+
#endif
3638
#include <Generators/PrimaryGenerator.h>
3739
#include <Generators/BoxGunParam.h>
3840
#include <Generators/TriggerParticle.h>
@@ -260,6 +262,7 @@ void GeneratorFactory::setPrimaryGenerator(o2::conf::SimConfig const& conf, Fair
260262
primGen->AddGenerator(boxGen);
261263
}
262264
}
265+
#if defined(GENERATORS_WITH_PYTHIA8) && defined(GENERATORS_WITH_HEPMC3)
263266
} else if (genconfig.compare("hybrid") == 0) { // hybrid using multiple generators
264267
LOG(info) << "Init hybrid generator";
265268
auto& hybridparam = GeneratorHybridParam::Instance();
@@ -276,6 +279,7 @@ void GeneratorFactory::setPrimaryGenerator(o2::conf::SimConfig const& conf, Fair
276279
}
277280
auto hybrid = new o2::eventgen::GeneratorHybrid(config);
278281
primGen->AddGenerator(hybrid);
282+
#endif
279283
} else {
280284
LOG(fatal) << "Invalid generator";
281285
}

Generators/src/GeneratorsLinkDef.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@
5252
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::eventgen::DecayerPythia8Param> + ;
5353
#pragma link C++ class o2::eventgen::GeneratorFactory + ;
5454
#endif
55-
#pragma link C++ class o2::eventgen::GeneratorFromFile + ;
56-
#pragma link C++ class o2::eventgen::GeneratorFromO2Kine + ;
55+
#if defined(GENERATORS_WITH_PYTHIA8) && defined(GENERATORS_WITH_HEPMC3)
5756
#pragma link C++ class o2::eventgen::GeneratorHybrid + ;
5857
#pragma link C++ class o2::eventgen::GeneratorHybridParam + ;
58+
#endif
59+
#pragma link C++ class o2::eventgen::GeneratorFromFile + ;
60+
#pragma link C++ class o2::eventgen::GeneratorFromO2Kine + ;
5961
#pragma link C++ class o2::eventgen::GeneratorFromO2KineParam + ;
6062
#pragma link C++ class o2::eventgen::O2KineGenConfig + ;
6163
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::eventgen::GeneratorFromO2KineParam> + ;

0 commit comments

Comments
 (0)