* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.4 2000/07/11 18:24:59 fca
-Coding convention corrections + few minor bug fixes
+/* $Id$ */
-Revision 1.3 1999/09/29 09:24:29 fca
-Introduction of the Copyright and cvs Log
+//-----------------------------------------------------------------------
+// Base Hit class for all detectors
+// Contains the coordinates of the hit (single energy deposition)
+// and the number of correspondent track
+// Author:
+//-----------------------------------------------------------------------
-*/
+#include "TParticle.h"
#include "AliHit.h"
-#include "TParticle.h"
#include "AliRun.h"
-
+#include "AliMC.h"
+#include "AliStack.h"
+
ClassImp(AliHit)
-AliHit::AliHit()
+//_______________________________________________________________________
+AliHit::AliHit():
+ fTrack(0),
+ fX(0),
+ fY(0),
+ fZ(0)
{
//
// Default constructor
//
- fTrack=0;
}
-AliHit::AliHit(Int_t shunt, Int_t track)
+//_______________________________________________________________________
+AliHit::AliHit(Int_t shunt, Int_t track):
+ fTrack(0),
+ fX(0),
+ fY(0),
+ fZ(0)
{
//
// Standard constructor
//
- TClonesArray &particles = *(gAlice->Particles());
- if(shunt) {
- int primary = gAlice->GetPrimary(track);
- ((TParticle *)particles[primary])->SetBit(kKeepBit);
+ if(shunt == 1) {
+ int primary = gAlice->GetMCApp()->GetPrimary(track);
+ gAlice->GetMCApp()->Particle(primary)->SetBit(kKeepBit);
fTrack=primary;
+ }
+
+ else if (shunt == 2) {
+ // the "primary" particle associated to the hit is
+ // the last track that has been flagged in the StepManager
+ // used by PHOS to associate the hit with the decay gamma
+ // rather than with the original pi0
+ TParticle *part;
+ Int_t current;
+ Int_t parent=track;
+ while (1) {
+ current=parent;
+ part = gAlice->GetMCApp()->Particle(current);
+ parent=part->GetFirstMother();
+ if(parent<0 || part->TestBit(kKeepBit))
+ break;
+ }
+ fTrack=current;
} else {
fTrack=track;
- gAlice->FlagTrack(fTrack);
+ gAlice->GetMCApp()->FlagTrack(fTrack);
}
}
-
-