Skip to content

Commit

Permalink
Use new methods to seed Pythia8
Browse files Browse the repository at this point in the history
  • Loading branch information
sawenzel committed Jul 10, 2024
1 parent 633ed67 commit 121572c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions MC/config/ALICE3/pythia8/generator_pythia8_ALICE3.C
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ using namespace Pythia8;
#endif

// Default pythia8 minimum bias generator

class GeneratorPythia8ALICE3 : public o2::eventgen::GeneratorPythia8
{
public:
Expand All @@ -18,20 +17,16 @@ public:
GeneratorPythia8ALICE3() {

char* alien_proc_id = getenv("ALIEN_PROC_ID");
uint64_t seedFull;
uint64_t seed = 0;
int64_t seed = 0;

if (alien_proc_id != NULL) {
seedFull = static_cast<uint64_t>(atol(alien_proc_id));
for(int ii=0; ii<29; ii++) // there might be a cleaner way but this will work
seed |= ((seedFull) & (static_cast<uint64_t>(1) << static_cast<uint64_t>(ii)));
LOG(info) << "Value of ALIEN_PROC_ID: " << seedFull <<" truncated to 0-28 bits: "<<seed<<endl;
seed = static_cast<int64_t>(atol(alien_proc_id));
} else {
LOG(info) << "Unable to retrieve ALIEN_PROC_ID";
LOG(info) << "Setting seed to 0 (random)";
seed = 0;
}
mPythia.readString("Random:seed = "+std::to_string(static_cast<int>(seed)));
setInitialSeed(seed);
}

/// Destructor
Expand Down

0 comments on commit 121572c

Please sign in to comment.