GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Bugs, Fixes, Releases » crash
crash [message #20363] Thu, 23 February 2017 00:57 Go to next message
Gianluigi Boca is currently offline  Gianluigi Boca
Messages: 177
Registered: March 2004
first-grade participant
From: *pv.infn.it
Hi,
does anyone know why within the Init or Exec method of a class,
let's say in

sttmvdtracking/PndMixBackgroundEvents.cxx

class, the following very normal statements lead to an inexplicable
crash ?



TFile *f = new TFile("../dpm/digi_complete.root");
TTree * fTree = (TTree*) f->Get("cbmsim");
TClonesArray * fClone;
fTree->SetBranchAddress("MVDPixelDigis",&fClone);
fTree->GetEntry(5); // it crashes here




Note that other things like

fTree->Print()

for instance give a quite normal usual output. The file ../dpm/digi_complete.root
has been generated with the standard sim_complete.C and digi_complete.C
Macros in the trunk repository.


The crash doesn't happen if I do the same statements within the

root

interactive command.


Thanks in advance
Gianluigi
Re: crash [message #20370 is a reply to message #20363] Thu, 23 February 2017 21:01 Go to previous message
Tobias Stockmanns is currently offline  Tobias Stockmanns
Messages: 489
Registered: May 2007
first-grade participant
From: *netcologne.de
Dear Gianluigi,

the problem is the line:

TClonesArray* fClone;

You do not allocate memory for the TClonesArray which causes the crash.
Replace it with:

TClonesArray* fClone = new TClonesArray("PndSdsDigiPixel");

Cheers,

Tobias
Previous Topic: svn error when updating pandaroot on kronos
Next Topic: New PandaRoot release feb17
Goto Forum:
  


Current Time: Fri Apr 19 04:33:08 CEST 2024

Total time taken to generate the page: 0.00826 seconds