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