Processing experimental data under multiple threads

I recently designed an experiment in which radioactive seeds were placed in the center of a water phantom. I am using G4PVParameterised to place some micro elements in the water phantom, while these microelements were defined as SD to record the location and energy deposition of radioactive particles.

But I have some questions about data handling, as described in the G4 manual, if you use GEANT4 in multi-threaded mode and need to accumulate values, you need to override two virtual functions in G4Run. My experiment extracts the position information and energy deposition of the particle inside the SD, and I add the obtained energy deposition value to a variable under the file. The logic of the code is the same as the B4c example. Here is my code.

DicomSD::DicomSD(G4String name)
: G4VSensitiveDetector(name)


void DicomSD::Initialize(G4HCofThisEvent* hce)
    = new HadCalorimeterHitsCollection(SensitiveDetectorName,collectionName[0]);
  if (fHCID<0) {
    fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection);

    for(auto X=0;X<kNofX;X++ ){
      for(auto Y=0;Y<kNofY;Y++){
        for(auto Z=0;Z<kNofZ;Z++){

          fHitsCollection->insert(new DicomHit());



G4bool DicomSD::ProcessHits(G4Step* step, G4TouchableHistory*)
  auto touchable = step->GetPreStepPoint()->GetTouchable();
  auto hitid = touchable->GetCopyNumber();
  auto hit = (*fHitsCollection)[hitid];

  return true;


class DicomHit : public G4VHit
    DicomHit(G4int iCol,G4int iRow);
    DicomHit(const DicomHit &right) = default;
    ~DicomHit() override;

    AttValues() const override;

    void SetEdep(G4double de) { fEdep = de; }
    void AddEdep(G4double de) { fEdep += de; }
    G4double GetEdep() const { return fEdep; }

    G4double fEdep = 0.;

I created 196608 Hit in DicomSD::Initialize function. In DicomSD::ProcessHits function, I get the ID number of the SD where the particle is located by touchable and find the corresponding Hit in fHitsCollection by this ID number. Then call the AddEdep function in DicomHit to add the energy deposited in DicomSD::ProcessHits by step->GetTotalEnergyDeposit() to the G4double fEdep variable in the DicomHit file.

My question is that getting energy deposition in SD requires constant accumulation to fEdep in the DicomHit file . So the energy deposition obtained needs to rewrite the two virtual functions in G4Run like the manual says? And I really don’t understand what kind of data the manual is referring to when it says cumulative values.

Thank you all for your replies.