How to save mean of GetLocalTime() in each event

I am simulating a scintillator crystal with 1 MeV photon. Now in each event I am getting arrival time distribution of optical photon.
I am saving the time like this,
G4double time = postStepPoint->GetLocalTime();
G4AnalysisManager *man = G4AnalysisManager::Instance();
man->FillNtupleDColumn(0, 0, time);

However, I want to store the mean arrival time of optical photon for each event. How to implement it ?