+ Int_t primary =-1 ;
+ if(fIshunt == 1)
+ primary = gAlice->GetMCApp()->GetPrimary( gAlice->GetMCApp()->GetCurrentTrackNumber() );
+ else if(fIshunt == 2){
+ primary = gAlice->GetMCApp()->GetCurrentTrackNumber() ;
+ TParticle * part = gAlice->GetMCApp()->Particle(primary) ;
+ while ( !part->TestBit(kKeepBit) ) {
+ primary = part->GetFirstMother() ;
+ if(primary == -1) break ; //there is a possibility that particle passed e.g. thermal isulator and hits a side
+ //surface of the crystal. In this case it may have no primary at all.
+ //We can not easily separate this case from the case when this is part of the shower,
+ //developed in the neighboring crystal.
+ part = gAlice->GetMCApp()->Particle(primary) ;
+ }
+ }
+
+