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