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