CbmRootManager [message #5493] |
Tue, 27 November 2007 16:13 |
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 #5500 is a reply to message #5495] |
Tue, 27 November 2007 16:54 |
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 #5509 is a reply to message #5508] |
Wed, 28 November 2007 08:47 |
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
|
|
|