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