Message: GetRadLen, write in ROOT file -> Seg Fault Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question GetRadLen, write in ROOT file -> Seg Fault 

Forum: Run Management
Date: 19 Apr, 2010
From: Katalin Nikolics <Katalin Nikolics>

I'm trying to shoot geantinos through my beam pipe geometry and then write out the radiation length into a root-file (fill a tree with the data)! 1) I try to implement a method in my PrimaryGenerator.cc file:

void ExN01PrimaryGeneratorAction::RadLengthWrite()
 {
  G4Step* step = new G4Step();
  G4StepPoint* point1 = step->GetPreStepPoint();

  G4Material* material1 = point1  ->GetMaterial();

   G4double RadLength = material1->GetRadlen();

  std::cout<<" Radiation Length " << RadLength <<std::endl;  

  TFile* RLplot = new TFile("RLplot.root");
  TTree* tree = new TTree("tree","RadLength");
  G4Event *anEvent = new G4Event;

  tree->Branch("Event",&anEvent);

  G4int nevents = 100;
  for(G4int i=0;i<nevents;i++) {
    tree->Fill();
  }
  std::cout<<" Tree filled " <<std::endl;

and declared the void() as public and G4double RadLength as private in the header-file.

There is no error message when compiling but when I run the executable, there's a segmentation fault! Where's the problem? Do I have to turn my program into a ROOT-VMC?

Cheers, Kati

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Disagree: Re: GetRadLen, write in ROOT file -> Seg Fault   (Gumplinger Peter - 20 Apr, 2010)
 Add Message Add Message
to: "GetRadLen, write in ROOT file -> Seg Fault"

 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 ]