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