]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTrackHit.cxx
Double inclusion of AliResponse removed.
[u/mrichter/AliRoot.git] / MUON / AliMUONTrackHit.cxx
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
16 /*
17 $Log$
18 Revision 1.4  2000/07/18 16:04:06  gosset
19 AliMUONEventReconstructor package:
20 * a few minor modifications and more comments
21 * a few corrections
22   * right sign for Z of raw clusters
23   * right loop over chambers inside station
24   * symmetrized covariance matrix for measurements (TrackChi2MCS)
25   * right sign of charge in extrapolation (ExtrapToZ)
26   * right zEndAbsorber for Branson correction below 3 degrees
27 * use of TVirtualFitter instead of TMinuit for AliMUONTrack::Fit
28 * no parameter for AliMUONTrack::Fit() but more fit parameters in Track object
29
30 Revision 1.3  2000/06/25 13:06:39  hristov
31 Inline functions moved from *.cxx to *.h files instead of forward declarations
32
33 Revision 1.2  2000/06/15 07:58:49  morsch
34 Code from MUON-dev joined
35
36 Revision 1.1.2.3  2000/06/12 10:11:45  morsch
37 Dummy copy constructor and assignment operator added
38
39 Revision 1.1.2.2  2000/06/09 12:58:05  gosset
40 Removed comment beginnings in Log sections of .cxx files
41 Suppressed most violations of coding rules
42
43 Revision 1.1.2.1  2000/06/07 14:44:53  gosset
44 Addition of files for track reconstruction in C++
45 */
46
47 //__________________________________________________________________________
48 //
49 // Reconstructed track hit in ALICE dimuon spectrometer
50 //__________________________________________________________________________
51
52 #include "AliMUONTrackHit.h" 
53
54 #include "AliMUONHitForRec.h" 
55
56 ClassImp(AliMUONTrackHit) // Class implementation in ROOT context
57
58   //__________________________________________________________________________
59 AliMUONTrackHit::AliMUONTrackHit(AliMUONHitForRec* Hit)
60 {
61   // Constructor from the HitForRec pointed to by "Hit"
62   fHitForRecPtr = Hit; // pointer to HitForRec
63   // links from/to HitForRec
64   if (Hit->GetNTrackHits() == 0) {
65     fPrevTrackHitWithSameHitForRec = NULL;
66     Hit->SetFirstTrackHitPtr(this);
67   }
68   else {
69     fPrevTrackHitWithSameHitForRec = Hit->GetLastTrackHitPtr();
70     fNextTrackHitWithSameHitForRec = NULL;
71   }
72   Hit->SetLastTrackHitPtr(this);
73   fNextTrackHitWithSameHitForRec = NULL;
74   Hit->SetNTrackHits(Hit->GetNTrackHits() + 1);
75 }
76
77   //__________________________________________________________________________
78 AliMUONTrackHit::AliMUONTrackHit (const AliMUONTrackHit& MUONTrackHit)
79 {
80 // Dummy copy constructor
81 }
82
83   //__________________________________________________________________________
84 AliMUONTrackHit & AliMUONTrackHit::operator=(const AliMUONTrackHit& MUONTrackHit)
85 {
86 // Dummy assignment operator
87     return *this;
88 }
89
90
91   //__________________________________________________________________________
92 AliMUONTrackHit::~AliMUONTrackHit()
93 {
94   // Destructor
95   // Update links between HitForRec's and TrackHit's
96   // connected to the current TrackHit being removed.
97   AliMUONHitForRec *hit = fHitForRecPtr; // pointer to HitForRec
98   // remove current TrackHit in HitForRec links
99   if (this == hit->GetFirstTrackHitPtr())
100     hit->SetFirstTrackHitPtr(fNextTrackHitWithSameHitForRec); // if first
101   if (this == hit->GetLastTrackHitPtr())
102     hit->SetLastTrackHitPtr(fPrevTrackHitWithSameHitForRec); // if last
103   hit->SetNTrackHits(hit->GetNTrackHits() - 1); // decrement NTrackHits of hit
104   // update link to next TrackHit of previous TrackHit
105   if (fPrevTrackHitWithSameHitForRec != NULL)
106     fPrevTrackHitWithSameHitForRec->
107       SetNextTrackHitWithSameHitForRec(fNextTrackHitWithSameHitForRec);
108   // update link to previous TrackHit of next TrackHit
109   if (fNextTrackHitWithSameHitForRec)
110     fNextTrackHitWithSameHitForRec->
111       SetPrevTrackHitWithSameHitForRec(fPrevTrackHitWithSameHitForRec);
112   // to be checked thoroughly !!!!
113   // with Root counter of AliMUONTrackHit objects,
114   // with loop over all these links after the update
115 }
116
117   //__________________________________________________________________________
118 Int_t AliMUONTrackHit::Compare(TObject* TrackHit)
119 {
120   // "Compare" function to sort with increasing Z.
121   // Returns -1 (0, +1) if Z of current TrackHit
122   // is smaller than (equal to, larger than) Z of TrackHit
123   if (fHitForRecPtr->GetZ() <
124       ((AliMUONTrackHit*)TrackHit)->fHitForRecPtr->GetZ()) return(-1);
125   else if (fHitForRecPtr->GetZ() ==
126            ((AliMUONTrackHit*)TrackHit)->fHitForRecPtr->GetZ()) return( 0);
127   else return(+1);
128 }