Geant4 HitMaps - discrepancy during and after the simulation?


I am using Geant4 10.4.2 to create a HitMap at a detector, where the particle hit position is stored in NTupleDColumns by the AnalysisManager. I created the HitMap with two approaches:

  1. Do it directly in Geant4, like
    AnalysisManager->FillH2(0, StoredHit1->GetInteractionPosition().x(), StoredHit1->GetInteractionPosition().y())

  2. On the other hand, I have a small C++ program to read the tracking data directly from a ROOT tree (where this exact data is written to by the Analysis Manager) AFTER the simulation and put it in a HitMap afterwards.
    TTree * trackingtree =(TTree*)file->Get(“Tracking”);

    trackingtree->SetBranchAddress(“D1X”, &x1);
    trackingtree->SetBranchAddress(“D1Y”, &y1);


However, these two approaches lead to different results (but the number of tracks used is the same in both cases). In the case where I read the data from the ROOT file and put it into HitMaps afterwards is a lot more blurry. So far, I couldn’t find the reason for this problem - maybe someone already had the same issue and solved it? In advance, thank you very much for your help!

Regards, Stefanie