Message: wrongly computed number of bins for some selective energies by RunAction class Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question wrongly computed number of bins for some selective energies by RunAction class 

Forum: Run Management
Date: 08 Sep, 2009
From: M Tariq Siddique <M Tariq Siddique>

Hello, i am simply tring to compute the spectrum of gamma's by using a fixed energy width (10 keV/bin) for each bin the way i have created the number of bins using dynamic memory allocation in RunAction class is given below and the problem i am facing is that for some selected energies like 0.3 MeV it creates 29 bins and crashed down with "malloc(): memory corruption:" error. Can any body explain this thing to me i will be very much thankfull.

Code in RunAction Class:

    BinsPerMeV = 100;
    PrimaryCounts = 0;
    NumberBins = BinsPerMeV*primenergy;
	G4cout<<"Number of Bins "<<NumberBins<<"\nEnergy "<<primenergy<<G4endl;
    PhotonEnergySpectrum = new G4int[NumberBins]; 
	airmuvalue = new G4float[NumberBins];
//initialise spectrum at beginning of each run
    for(G4int i=0;i<=NumberBins;i++)
	PhotonEnergySpectrum[i] = airmuvalue[i] = 0;

Here is the output for 0.2 MeV (runs fine):

### Run 0 start. Number of Bins 20 Energy 0.2 Start Run processing.

---> Begin of event: 0

Here is the output for 0.3 MeV (crashed):

### Run 1 start. Number of Bins 29 Energy 0.3 *** glibc detected *** BASSGeom: malloc(): memory corruption: 0x08f99f30 ***

 Add Message Add Message
to: "wrongly computed number of bins for some selective energies by RunAction class"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]