Skip to content

Commit e763588

Browse files
sawenzelclaude
andcommitted
Keep the Cave chunk-seeding counters in members
This moves the two counters of Cave::BeginPrimary out of function-local statics, like the detector stepping state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ca6568d commit e763588

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

‎Detectors/Passive/include/DetectorsPassive/Cave.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ class Cave : public FairDetector
7777

7878
bool mHasZDC = true; //! flag indicating if ZDC will be included
7979
bool mHasRB24 = true; //! flag indicating if RB24 will be included
80+
int mPrimaryCounter = 0; //! primaries started, for the internal chunk seeding
81+
int mChunkSeedCounter = 1; //! next seed index of the internal chunk seeding
8082
ClassDefOverride(o2::passive::Cave, 1);
8183
};
8284
} // namespace passive

‎Detectors/Passive/src/Cave.cxx‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,22 +146,19 @@ void Cave::FinishPrimary()
146146
// setting
147147
void Cave::BeginPrimary()
148148
{
149-
static int primcounter = 0;
150-
151149
// only do it, if not in pure trackSeeding mode
152150
if (!o2::conf::SimCutParams::Instance().trackSeed) {
153151
auto& conf = o2::conf::SimConfig::Instance();
154152
auto chunks = conf.getInternalChunkSize();
155153
if (chunks != -1) {
156-
if (primcounter % chunks == 0) {
157-
static int counter = 1;
158-
auto seed = counter + 10;
154+
if (mPrimaryCounter % chunks == 0) {
155+
auto seed = mChunkSeedCounter + 10;
159156
gRandom->SetSeed(seed);
160-
counter++;
157+
mChunkSeedCounter++;
161158
}
162159
}
163160
}
164-
primcounter++;
161+
mPrimaryCounter++;
165162
}
166163

167164
bool Cave::ProcessHits(FairVolume*)

0 commit comments

Comments
 (0)