Saving detector spectrum with energy bins unequally spaced (after calibration)

Hello everyone,

I want to save the spectrum of deposited energy in a detector.
I was able to create a histogram with a constant step size and I would like to know if it is possible to use a histogram in which energy values are specified for each bin. So as to obtain the spectrum based on a energy calibration of the detector (with energy bins unequally spaced).

These are the lines of code I use.

RunAction.cc
//
analysisManager->CreateH1(“1”,“Energy deposited”,1000,0.,2.500);

SteppingAction.cc
//
G4double EdepStep = aStep->GetTotalEnergyDeposit();
if (EdepStep > 0.) fEventAction->AddEdep(EdepStep);

EventAction.cc
//
analysisManager->FillH1(1, fTotalEnergyDeposit/MeV);

In Analysis.hh I included g4csv.hh to save the histogram in a csv file.

I am using geant4-10-06-patch-02.

like so?

G4int CreateH1(const G4String& name, const G4String& title,
               const std::vector<G4double>& edges,
               const G4String& unitName = "none",
               const G4String& fcnName = "none");

https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/BackupVersions/V10.6/html/Analysis/managers.html#creating-histograms