]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliHit.cxx
Inheritance from TObject. Automatic streamers.
[u/mrichter/AliRoot.git] / STEER / AliHit.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.6  2001/01/26 19:58:48  hristov
19 Major upgrade of AliRoot code
20
21 Revision 1.5  2000/07/12 08:56:25  fca
22 Coding convention correction and warning removal
23
24 Revision 1.4  2000/07/11 18:24:59  fca
25 Coding convention corrections + few minor bug fixes
26
27 Revision 1.3  1999/09/29 09:24:29  fca
28 Introduction of the Copyright and cvs Log
29
30 */
31
32 #include "AliHit.h"
33 #include "TParticle.h"
34 #include "AliRun.h"
35
36 ClassImp(AliHit)
37
38 AliHit::AliHit()
39 {
40   //
41   // Default constructor
42   //
43   fTrack=0;     
44 }
45
46 AliHit::AliHit(Int_t shunt, Int_t track)
47 {
48   //
49   // Standard constructor
50   //
51   if(shunt == 1) {
52     int primary = gAlice->GetPrimary(track);
53     gAlice->Particle(primary)->SetBit(kKeepBit);
54     fTrack=primary;
55   } 
56
57   else if (shunt == 2) {
58     // the "primary" particle associated to the hit is
59     // the last track that has been flagged in the StepManager
60     // used by PHOS to associate the hit with the decay gamma
61     // rather than with the original pi0 
62     TParticle *part;
63     Int_t current;
64     Int_t parent=track;
65     while (1) {
66       current=parent;
67       part = gAlice->Particle(current);
68       parent=part->GetFirstMother();    
69       if(parent<0 || part->TestBit(kKeepBit))
70         break;
71     }
72     fTrack=current;   
73   }
74
75   else {
76     fTrack=track;
77     gAlice->FlagTrack(fTrack);
78   }
79 }
80
81