|
|
|
Re: Problem with secondary tracks [message #12381 is a reply to message #12379] |
Thu, 28 July 2011 23:24 |
Mohammad Al-Turany
Messages: 518 Registered: April 2004 Location: GSI, Germany
|
first-grade participant |
From: 46.248.220*
|
|
Hi,
If I understand your code in "PndTpcDetector::ProcessHits" you are miss-using the trackID variable, this member variable comes from the base class FairMCPoint and the whole filtering is based on this inheritance (The FairMCStack has no idea about detector or experiments code).
To explain this: The trackID is used normally as unique identifier of a track, i.e: it is the index of this track in the array, and when you get the mother ID of a track you get also the index of that mother in the array. In your code you are setting the trackID to the mother ID:
Bool_t PndTpcDetector::ProcessHits( FairVolume *v)
........
TParticle* mother=gMC->GetStack()->GetCurrentTrack();
if(mother->IsPrimary()) secID = 0;
else while(!mother->IsPrimary()){
trackID=mother->GetFirstMother();
mother=dynamic_cast<PndStack*>(gMC->GetStack())->GetParticle(trackID);
//std::cout<<"Fetching mother id="<<trackID<<std::endl;
}
// trackID is now ID of primary mother
// if the mother is already primary, secID is 0
// else secID is an (arbitrary) number !=0
.............
//gotta love TClonesArray syntax!
PndTpcPoint* p=AddHit(trackID, secID, volumeID, pos.Vect(), mom.Vect(),
time, length, eLoss);
As you see, the PndTpcPoint has a variable trackID which does not correspond to the track index anymore, and this will miss up the whole filtering! So I would suggest you to define a new variable in your TpcPoint which hold the info you need without miss-using the trackID.
Hope this will help you, now I will enjoy the rest of my vacation!
Cheers,
Mohammad
|
|
|
|