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