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