]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliHit.cxx
Cleanup of STEER coding conventions
[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 /* $Header$ */
17
18 //-----------------------------------------------------------------------
19 //
20 //    Base Hit class for all detectors
21 //
22 //-----------------------------------------------------------------------
23
24 #include "TParticle.h"
25
26 #include "AliHit.h"
27 #include "AliRun.h"
28
29 ClassImp(AliHit)
30
31 //_______________________________________________________________________
32 AliHit::AliHit():
33   fTrack(0),
34   fX(0),
35   fY(0),
36   fZ(0)
37 {
38   //
39   // Default constructor
40   //
41 }
42
43 //_______________________________________________________________________
44 AliHit::AliHit(Int_t shunt, Int_t track):
45   fTrack(0),
46   fX(0),
47   fY(0),
48   fZ(0)
49 {
50   //
51   // Standard constructor
52   //
53   if(shunt == 1) {
54     int primary = gAlice->GetPrimary(track);
55     gAlice->Particle(primary)->SetBit(kKeepBit);
56     fTrack=primary;
57   } 
58
59   else if (shunt == 2) {
60     // the "primary" particle associated to the hit is
61     // the last track that has been flagged in the StepManager
62     // used by PHOS to associate the hit with the decay gamma
63     // rather than with the original pi0 
64     TParticle *part;
65     Int_t current;
66     Int_t parent=track;
67     while (1) {
68       current=parent;
69       part = gAlice->Particle(current);
70       parent=part->GetFirstMother();    
71       if(parent<0 || part->TestBit(kKeepBit))
72         break;
73     }
74     fTrack=current;   
75   }
76
77   else {
78     fTrack=track;
79     gAlice->FlagTrack(fTrack);
80   }
81 }