Skip to content

Commit b737c27

Browse files
authored
ALICE 3: proc_id is actually a long (#1675)
* ALICE 3: proc_id is actually a long ...does not yet guarantee PYTHIA will accept it! * Update generator_pythia8_ALICE3.C
1 parent 483bc65 commit b737c27

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

MC/config/ALICE3/pythia8/generator_pythia8_ALICE3.C

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,20 @@ public:
1818
GeneratorPythia8ALICE3() {
1919

2020
char* alien_proc_id = getenv("ALIEN_PROC_ID");
21-
int seed;
21+
uint64_t seedFull;
22+
uint64_t seed = 0;
2223

2324
if (alien_proc_id != NULL) {
24-
seed = atoi(alien_proc_id);
25-
LOG(info) << "Seed set to ALIEN_PROC_ID: " << seed;
25+
seedFull = static_cast<uint64_t>(atol(alien_proc_id));
26+
for(int ii=0; ii<29; ii++) // there might be a cleaner way but this will work
27+
seed |= ((seedFull) & (static_cast<uint64_t>(1) << static_cast<uint64_t>(ii)));
28+
LOG(info) << "Value of ALIEN_PROC_ID: " << seedFull <<" truncated to 0-28 bits: "<<seed<<endl;
2629
} else {
2730
LOG(info) << "Unable to retrieve ALIEN_PROC_ID";
2831
LOG(info) << "Setting seed to 0 (random)";
2932
seed = 0;
3033
}
31-
32-
mPythia.readString("Random:seed = "+std::to_string(seed));
34+
mPythia.readString("Random:seed = "+std::to_string(static_cast<int>(seed)));
3335
}
3436

3537
/// Destructor
@@ -40,4 +42,4 @@ public:
4042
FairGenerator *generator_pythia8_ALICE3()
4143
{
4244
return new GeneratorPythia8ALICE3();
43-
}
45+
}

0 commit comments

Comments
 (0)