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