GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » CbmRootManager
CbmRootManager [message #5493] Tue, 27 November 2007 16:13 Go to next message
Klaus Götzen is currently offline  Klaus Götzen
Messages: 293
Registered: June 2006
Location: GSI
first-grade participant
From: *ikf.physik.uni-frankfurt.de
Hi!

Within my CbmFastSim task I try to dump out two TClonesArrays of type TParticle like this

fCandidates = new TClonesArray("TParticle");
CbmRootManager::Instance()->Register("PndCandidates","FastSim", fCandidates, kTRUE);

fMcCandidates = new TClonesArray("TParticle");
CbmRootManager::Instance()->Register("PndMcCandidates","FastSim", fMcCandidates, kTRUE);

one with the smeared candidates and one with the original copy of the MCStack basically.

My task runs and in principle everything is fine, but in the root-file later there is a folder structure:

cbmroot/FastSim/PndCandidates
cbmroot/FastSim/PndMcCandidates

(in fact in the TBrowser you see 2 FastSim folders, either containing one subfolder!), where both folders are empty, and twice

cbmsim/PndCandidates

with exactly the same contents (apparently from that TClonesArray which was registered first...)

Anybody an idea, what I'm doing wrong?

Thanks and regards,
Klaus
Re: CbmRootManager [message #5494 is a reply to message #5493] Tue, 27 November 2007 16:26 Go to previous messageGo to next message
asanchez is currently offline  asanchez
Messages: 350
Registered: March 2006
first-grade participant
From: *gsi.de
hi klaus
maybe it is a stupid question,
but are you filling them inside the task?
Alicia S.
Re: CbmRootManager [message #5495 is a reply to message #5494] Tue, 27 November 2007 16:31 Go to previous messageGo to next message
Klaus Götzen is currently offline  Klaus Götzen
Messages: 293
Registered: June 2006
Location: GSI
first-grade participant
From: *ikf.physik.uni-frankfurt.de
I fill them in the Exec method with

TClonesArray &tracks = *fCandidates;
...
Int_t size = tracks.GetEntriesFast();
....
TParticle *p=new (tracks[size]) TParticle(ft->pdt(),0,0,0,0,0,ft->p4(),TLorentzVector(ft->startVtx(),t- >T()));

I think I copied this structure from some other module. Is there a better way?

Klaus
Re: CbmRootManager [message #5498 is a reply to message #5493] Tue, 27 November 2007 16:49 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hi,

The folder structure in the file is meant for internal use of the framework so it is ok that it is empty. The question is: In your output tree do you have two branches, namely PndCandidates and PndMcCandidates or not?

regards

Mohammad

Re: CbmRootManager [message #5500 is a reply to message #5495] Tue, 27 November 2007 16:54 Go to previous messageGo to next message
asanchez is currently offline  asanchez
Messages: 350
Registered: March 2006
first-grade participant
From: *gsi.de
What is your input file?

you should have something like that inside of
the Init method -----
like

InitStatus PndTofHitProducerIdeal::Init()
{

// Get input array
fPointarray = (TClonesArray*) ioman->GetObject("TofPoint");

//TofPoint is the branchname you want to read from
//input file

if ( ! fPointArray )
{
std::cout << "-W- PndTofHitProducerIdeal::Init: "
<< "No TofPoint array!" << std::endl;
return kERROR;
}

and then, you define where you want to save the output

//Create and register output array
fHitArray = new TClonesArray("PndTofHit");
ioman->Register("TofHit", "Tof", fHitArray, kTRUE);

return kSUCCESS;
}


In Exec to get fPointarray information,

// Loop over TofPoints
Int_t nPoints = fPointArray->GetEntriesFast();

for (Int_t iPoint = 0; iPoint < nPoints; iPoint++)
{
point = (PndTofPoint*) fPointArray->At(iPoint);

// Create new hit
new ((*fHitArray)[iPoint]) PndTofHit(trackID, detID,
point->GetDetName(),time, t1, position,dpos,iPoint, point->GetEnergyLoss(),1);

}

i hope it can help you

cheers
alicia.


Re: CbmRootManager [message #5501 is a reply to message #5498] Tue, 27 November 2007 16:56 Go to previous messageGo to next message
Klaus Götzen is currently offline  Klaus Götzen
Messages: 293
Registered: June 2006
Location: GSI
first-grade participant
From: *ikf.physik.uni-frankfurt.de
Hi Mohammad!

No, this is the problem! For some reason in the output file, there are two branches both named 'PndCandidates' which contain exactly the same.
But I found something in the console output, which might be of interest, namely the messages:

Warning in <TTree::Bronch>: Using split mode on a class: TParticle with a custom Streamer
Warning in <TTree::Bronch>: Using split mode on a class: TParticle with a custom Streamer

Probably it's somehow related to the problem, but I don't know how ...

Thanks,
Klaus
Re: CbmRootManager [message #5502 is a reply to message #5501] Tue, 27 November 2007 17:22 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hi klaus,

May be you can send me this code! or its in SVN? I do not think it is a good idea to copy the Stack again, because you can connect it at any time as a friend but it should also be possible to have two branches with deferent names and the same type of objects. So are you sure that when you add the entries to the TClonesArray that the pointers are not mixed somehow?

regards

Mohammad
Re: CbmRootManager [message #5503 is a reply to message #5502] Tue, 27 November 2007 17:30 Go to previous messageGo to next message
Klaus Götzen is currently offline  Klaus Götzen
Messages: 293
Registered: June 2006
Location: GSI
first-grade participant
From: *ikf.physik.uni-frankfurt.de
Hi Mohammad!

Thanks for your effort! The code is now in SVN:

Transmitting file data ..
Committed revision 1897.

So you can check out macro/fsim and fsim and run the macro 'macro/fsim/simfast.C'
The resulting output file then is fastsim.root. Hope it runs...

Klaus
Re: CbmRootManager [message #5504 is a reply to message #5503] Tue, 27 November 2007 19:54 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *dip.t-dialin.net
Hallo Klaus,

it was a bug in CbmRootManager, no body notice this because of the special case (Tasks in simulation and TClonesArray with same class type) any way it is corrected now in SVN, just update the base and it should work.

regards

Mohammad
Re: CbmRootManager [message #5508 is a reply to message #5504] Wed, 28 November 2007 08:30 Go to previous messageGo to next message
Klaus Götzen is currently offline  Klaus Götzen
Messages: 293
Registered: June 2006
Location: GSI
first-grade participant
From: *ikf.physik.uni-frankfurt.de
Thanks, I just updated. There was still a little bug in base/CbmVPoint.cxx, line 100 or so - an unmatched comment sign */
Could you update that, since I'm not able to check in base ...

Klaus
Re: CbmRootManager [message #5509 is a reply to message #5508] Wed, 28 November 2007 08:47 Go to previous message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hi,

It is corrected in SVN now, Sorry for that it was a very long day with many problems!

regards

Mohammad
Previous Topic: New external packages and major update of FairRoot
Next Topic: Happy new year and best wishes for 2008!!!
Goto Forum:
  


Current Time: Fri Jan 28 12:06:12 CET 2022

Total time taken to generate the page: 0.00788 seconds