Skip to content

Commit

Permalink
ALICE 3: proc_id is actually a long (#1675)
Browse files Browse the repository at this point in the history
* ALICE 3: proc_id is actually a long

...does not yet guarantee PYTHIA will accept it!

* Update generator_pythia8_ALICE3.C
  • Loading branch information
ddobrigk authored Jun 26, 2024
1 parent 483bc65 commit b737c27
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions MC/config/ALICE3/pythia8/generator_pythia8_ALICE3.C
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ public:
GeneratorPythia8ALICE3() {

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

if (alien_proc_id != NULL) {
seed = atoi(alien_proc_id);
LOG(info) << "Seed set to ALIEN_PROC_ID: " << seed;
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;
} 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(seed));
mPythia.readString("Random:seed = "+std::to_string(static_cast<int>(seed)));
}

/// Destructor
Expand All @@ -40,4 +42,4 @@ public:
FairGenerator *generator_pythia8_ALICE3()
{
return new GeneratorPythia8ALICE3();
}
}

0 comments on commit b737c27

Please sign in to comment.