Hi:
I defined a water tank and then split this tank into 505050 small micro elements. I defined each micro-element as a SD used to capture the energy deposition of particles inside the tank. I also defined a table, and since the size of each micro-element that makes up the tank is small enough, I defined each micro-element as a data point so that I can extract only the energy deposition when I extract the data. Here is the procedure I used to create the coordinate points.
void EventAction::EndOfEventAction(const G4Event* event)
{
if(fBoxHCID == -1){
fBoxHCID = G4SDManager::GetSDMpointer()->GetCollectionID("boxHitsCollection");
}
auto boxHC = GetHitsCollection(fBoxHCID,event);
auto analysisManager = G4AnalysisManager::Instance();
G4int count = 0;
for(int z = -25;z<25;z++){
for(int x = -25;x<25;x++){
for(int y = -25;y<25;y++){
auto boxHit = static_cast<CalorHit*>(boxHC->GetHit(count));
analysisManager->FillNtupleDColumn(0,x);
analysisManager->FillNtupleDColumn(1,y);
analysisManager->FillNtupleDColumn(2,z);
analysisManager->FillNtupleDColumn(3,boxHit->GetEdep());
analysisManager->AddNtupleRow();
count++;
}
}
}
}
As I envisioned at the end of the experiment a table of 125,000 rows would be created. But when I run it, I have a problem, I run it in multi-threaded mode and when /run/beamOn 10
I see that the csv file output by each thread is indeed 125000 rows, but when /run/beamOn 100
or /run/beamOn 1000
I see that the csv file output by each thread is repeated after After 125000 lines the coordinate points are created repeatedly.
That means that if many particles are launched using /run/beamOn
, then the csv file of each thread will have duplicate tables created.
I would like to ask you all what causes this. Thank you all for your replies.