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