How to get Edep histogram in ROOT?

I made a simulation of Co-60, but I do not know what happen when I try to save the data. What I need is this spectrum
I have these results, but I can not made the gamma spectrum of Co-60:

I made the saving in RunAction:
void runaction::BeginOfRunAction(const G4Run*){
// initializate the run manager to store the hits
G4AnalysisManager*man = G4AnalysisManager::Instance();
//man->SetHistoDictoryName(“histograms”);
// create the root file
man->OpenFile(“output.root”);

man->CreateH1("Edep","Counts",200,0,2.5*MeV);

man->CreateNtuple("Hits","Edep in NaI");
man->CreateNtupleFColumn("Edep");
man->FinishNtuple(); 

}

and in my sensitive detector class:

sensitivedetector::~sensitivedetector(){}

G4bool sensitivedetector::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist){
G4double edep= aStep->GetTotalEnergyDeposit();
// show us the edep
G4cout<< "Energy deposited is"<<edep<<G4endl;

G4AnalysisManager*man = G4AnalysisManager::Instance();
man->FillH1(0,edep);

man->FillNtupleFColumn(0,edep);
man->AddNtupleRow();

}

Hi, you are saving the edep of each hit in your detector. I think you should integrate the edep of the hits within one event. Look at the Sensitive Detector Class of the radioprotection advanced example. There, the edep of the hits is integrated at the end of each event.

Cheers

I was trying to get gamma spectra of Co-60, but the ntuple gives me that.

Can you explain me better?
Also, I made a histogram, but it does not have sense.

It looks like you are recording each individual energy deposit from each step in the event. If your simulation is simple, where the only active volume is the detector, then what you should do is sum (integrate) all of the Edep values in each event.

The total energy will have a peak at the incident gamma energy, and will have a tail corresponding to energy which was “lost” (secondaries which escape out of the detector volume).

What is the way to do that?
I am saving edep in sensitive detector class and making ntuples with run action. I can not understand.

Should you response me, I will thank you a lot.

In your N-tuple, include the event number. Then, in your analysis code afterward, as you loop over rows, sum up all the Edep values for the same event number.

Can you show me an example please?
It is still not understood.

As mentioned in my first post, look at the radioprotection example, in the Sensitive Detector Class