]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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 | ||
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
3831f268 | 18 | /////////////////////////////////////////////////////// |
a9e2aefa | 19 | // |
3831f268 | 20 | // Reconstructed track hit |
21 | // in | |
22 | // ALICE | |
23 | // dimuon | |
24 | // spectrometer | |
25 | // | |
26 | /////////////////////////////////////////////////////// | |
a9e2aefa | 27 | |
3831f268 | 28 | #include "AliMUONTrackHit.h" |
30178c30 | 29 | #include "AliMUONHitForRec.h" |
d12a7158 | 30 | #include "AliLog.h" |
a9e2aefa | 31 | |
32 | ClassImp(AliMUONTrackHit) // Class implementation in ROOT context | |
33 | ||
30178c30 | 34 | //__________________________________________________________________________ |
35 | AliMUONTrackHit::AliMUONTrackHit() | |
36 | : TObject() | |
37 | { | |
38 | // Default constructor | |
39 | fHitForRecPtr = 0; | |
40 | fNextTrackHitWithSameHitForRec = 0; | |
41 | fPrevTrackHitWithSameHitForRec = 0; | |
42 | } | |
43 | ||
a9e2aefa | 44 | //__________________________________________________________________________ |
45 | AliMUONTrackHit::AliMUONTrackHit(AliMUONHitForRec* Hit) | |
46 | { | |
47 | // Constructor from the HitForRec pointed to by "Hit" | |
48 | fHitForRecPtr = Hit; // pointer to HitForRec | |
49 | // links from/to HitForRec | |
50 | if (Hit->GetNTrackHits() == 0) { | |
51 | fPrevTrackHitWithSameHitForRec = NULL; | |
52 | Hit->SetFirstTrackHitPtr(this); | |
53 | } | |
54 | else { | |
55 | fPrevTrackHitWithSameHitForRec = Hit->GetLastTrackHitPtr(); | |
56 | fNextTrackHitWithSameHitForRec = NULL; | |
57 | } | |
58 | Hit->SetLastTrackHitPtr(this); | |
59 | fNextTrackHitWithSameHitForRec = NULL; | |
60 | Hit->SetNTrackHits(Hit->GetNTrackHits() + 1); | |
61 | } | |
62 | ||
d12a7158 | 63 | //__________________________________________________________________________ |
64 | AliMUONTrackHit::AliMUONTrackHit (const AliMUONTrackHit& theMUONTrackHit) | |
65 | : TObject(theMUONTrackHit) | |
66 | { | |
67 | // Protected copy constructor | |
68 | ||
69 | AliFatal("Not implemented."); | |
70 | } | |
71 | ||
72 | //__________________________________________________________________________ | |
73 | AliMUONTrackHit & AliMUONTrackHit::operator=(const AliMUONTrackHit& rhs) | |
74 | { | |
75 | // Protected assignement operator | |
76 | ||
77 | if (this == &rhs) return *this; | |
78 | ||
79 | AliFatal("Not implemented."); | |
80 | ||
81 | return *this; | |
82 | } | |
83 | ||
84 | ||
956019b6 | 85 | //__________________________________________________________________________ |
86 | AliMUONTrackHit::~AliMUONTrackHit() | |
87 | { | |
88 | // Destructor | |
8429a5e4 | 89 | // Update links between HitForRec's and TrackHit's |
90 | // connected to the current TrackHit being removed. | |
91 | AliMUONHitForRec *hit = fHitForRecPtr; // pointer to HitForRec | |
92 | // remove current TrackHit in HitForRec links | |
93 | if (this == hit->GetFirstTrackHitPtr()) | |
94 | hit->SetFirstTrackHitPtr(fNextTrackHitWithSameHitForRec); // if first | |
95 | if (this == hit->GetLastTrackHitPtr()) | |
96 | hit->SetLastTrackHitPtr(fPrevTrackHitWithSameHitForRec); // if last | |
97 | hit->SetNTrackHits(hit->GetNTrackHits() - 1); // decrement NTrackHits of hit | |
98 | // update link to next TrackHit of previous TrackHit | |
99 | if (fPrevTrackHitWithSameHitForRec != NULL) | |
100 | fPrevTrackHitWithSameHitForRec-> | |
101 | SetNextTrackHitWithSameHitForRec(fNextTrackHitWithSameHitForRec); | |
102 | // update link to previous TrackHit of next TrackHit | |
103 | if (fNextTrackHitWithSameHitForRec) | |
104 | fNextTrackHitWithSameHitForRec-> | |
105 | SetPrevTrackHitWithSameHitForRec(fPrevTrackHitWithSameHitForRec); | |
956019b6 | 106 | // to be checked thoroughly !!!! |
107 | // with Root counter of AliMUONTrackHit objects, | |
108 | // with loop over all these links after the update | |
109 | } | |
110 | ||
a9e2aefa | 111 | //__________________________________________________________________________ |
2a941f4e | 112 | Int_t AliMUONTrackHit::Compare(const TObject* TrackHit) const |
a9e2aefa | 113 | { |
5b64e914 | 114 | // "Compare" function to sort with decreasing Z (spectro. muon Z <0). |
115 | // Returns 1 (0, -1) if Z of current TrackHit | |
a9e2aefa | 116 | // is smaller than (equal to, larger than) Z of TrackHit |
117 | if (fHitForRecPtr->GetZ() < | |
5b64e914 | 118 | ((AliMUONTrackHit*)TrackHit)->fHitForRecPtr->GetZ()) return(1); |
a9e2aefa | 119 | else if (fHitForRecPtr->GetZ() == |
120 | ((AliMUONTrackHit*)TrackHit)->fHitForRecPtr->GetZ()) return( 0); | |
5b64e914 | 121 | else return(-1); |
a9e2aefa | 122 | } |