]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliHit.cxx
order of filling in 2D hitsos and GetValues mthod correceted
[u/mrichter/AliRoot.git] / STEER / AliHit.cxx
index 6decbcb2c84be9cd61fea258eae7e5247aeeeecd..af79dd879023ba8b9197e384a875b83165bbbdb3 100644 (file)
 
 /*
 $Log$
+Revision 1.6  2001/01/26 19:58:48  hristov
+Major upgrade of AliRoot code
+
+Revision 1.5  2000/07/12 08:56:25  fca
+Coding convention correction and warning removal
+
+Revision 1.4  2000/07/11 18:24:59  fca
+Coding convention corrections + few minor bug fixes
+
+Revision 1.3  1999/09/29 09:24:29  fca
+Introduction of the Copyright and cvs Log
+
 */
 
 #include "AliHit.h"
 #include "TParticle.h"
 #include "AliRun.h"
+
 ClassImp(AliHit)
 
 AliHit::AliHit()
 {
-       fTrack=0;       
+  //
+  // Default constructor
+  //
+  fTrack=0;    
 }
 
 AliHit::AliHit(Int_t shunt, Int_t track)
 {
-  TClonesArray &particles = *(gAlice->Particles());
-  if(shunt) {
+  //
+  // Standard constructor
+  //
+  if(shunt == 1) {
     int primary = gAlice->GetPrimary(track);
-    ((TParticle *)particles[primary])->SetBit(Keep_Bit);
+    gAlice->Particle(primary)->SetBit(kKeepBit);
     fTrack=primary;
-  } else {
+  } 
+
+  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->Particle(current);
+      parent=part->GetFirstMother();    
+      if(parent<0 || part->TestBit(kKeepBit))
+       break;
+    }
+    fTrack=current;   
+  }
+
+  else {
     fTrack=track;
     gAlice->FlagTrack(fTrack);
   }