Implementing a hypernucleus with weak decay

Dear experts,

I am trying to implement a hypernucleus which can weak decay into pi- and a nucleus. But, I have never succeeded in letting it decay.
I would like to have your advice. The method I am trying may be wrong.
I am using geant4.10.04.p02.

I created the class “G4CL12” which is inherited from G4Ions as follows.

— part of Contents of –
#include “G4CL12.hh”
#includce “G4ParticleTable.hh”
#include “G4IonTable.hh”
#include “G4DecayTable.hh”
#include “G4SystemOfUnits.hh”
#include “G4PhaseSpaceDecayChannel.hh”

G4CL12* G4CL12::theInstance = 0;

G4CL12* G4CL12::Definition()
if(theInstance !=0) return theInstance;

G4IonTable *ionTable = G4IonTable::GetIonTable();

const G4String name = “CL12”;

G4int J=0;

G4double life = 0.2632e-9*s;//Lambda life time
G4bool stable = false;

G4int A = 12;
G4int Z = 6;
G4int L = 1;
G4double charge = G4double(Z)*eplus;
G4double Eex = 0;
G4int lvl = 0;

G4double mass = ionTable->GetNucleusMass(Z, A, L)+ Eex;
G4int encoding = ionTable->GetNucleusEncoding(Z,A,L,Eex,lvl);

anInstance = new G4Ions( name, mass, 197.0MeV,//width def=0MeV
J, +1, 0,
0, 0, 0,
“nucleus”, 0, A, encoding,
stable, life, 0, false,//short lived
“generic”, 0,
Eex, lvl );

G4double Qvalue = -1.*MeV;

G4DecayTable* decayTable =new G4DecayTable();

G4String daughter = ionTable->GetIonName(Z+1, A, 0, 0.);
G4VDecayChannel* channel = new G4PhaseSpaceDecayChannel(name,1.000, 2,daughter,“pi-”);




theInstance = reinterpret_cast<G4CL12*>(anInstance);
return theInstance;

I also try to add the decay process in ConstructGeneral() in my physics list, but there was warning “g4processmanager::getattribute() index out of range”.

G4ParticleDefinition *particle = G4CL12::CL12();

G4ProcessManager* pmanager = particle->GetProcessManager();

if (theDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);