]>
Commit | Line | Data |
---|---|---|
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 |
21 | // in | |
22 | // ALICE | |
23 | // dimuon | |
24 | // spectrometer | |
25 | // | |
26 | /////////////////////////////////////////////////// | |
a9e2aefa | 27 | |
2457f726 | 28 | #include <stdlib.h> // for exit() |
29 | #include <Riostream.h> | |
30 | ||
63ed9c6b | 31 | #include "AliMUONTrack.h" |
34f1bfa0 | 32 | |
de2cd600 | 33 | #include "AliMUONTrackParam.h" |
a9e2aefa | 34 | #include "AliMUONHitForRec.h" |
35 | #include "AliMUONSegment.h" | |
d837040f | 36 | #include "AliMUONConstants.h" |
a9e2aefa | 37 | |
63ed9c6b | 38 | #include "AliLog.h" |
39 | ||
63ed9c6b | 40 | #include <TMath.h> |
63ed9c6b | 41 | |
7945aae7 | 42 | /// \cond CLASSIMP |
63ed9c6b | 43 | ClassImp(AliMUONTrack) // Class implementation in ROOT context |
7945aae7 | 44 | /// \endcond |
63ed9c6b | 45 | |
46 | //__________________________________________________________________________ | |
30178c30 | 47 | AliMUONTrack::AliMUONTrack() |
54d7ba50 | 48 | : TObject(), |
54d7ba50 | 49 | fTrackParamAtVertex(), |
50 | fTrackParamAtHit(0x0), | |
51 | fHitForRecAtHit(0x0), | |
54d7ba50 | 52 | fNTrackHits(0), |
54d7ba50 | 53 | fFitFMin(-1.), |
54 | fMatchTrigger(kFALSE), | |
55 | fChi2MatchTrigger(0.), | |
56 | fTrackID(0) | |
d837040f | 57 | { |
2457f726 | 58 | /// Default constructor |
d837040f | 59 | } |
60 | ||
a9e2aefa | 61 | //__________________________________________________________________________ |
de2cd600 | 62 | AliMUONTrack::AliMUONTrack(AliMUONSegment* BegSegment, AliMUONSegment* EndSegment) |
54d7ba50 | 63 | : TObject(), |
54d7ba50 | 64 | fTrackParamAtVertex(), |
65 | fTrackParamAtHit(0x0), | |
66 | fHitForRecAtHit(0x0), | |
54d7ba50 | 67 | fNTrackHits(0), |
54d7ba50 | 68 | fFitFMin(-1.), |
69 | fMatchTrigger(kFALSE), | |
70 | fChi2MatchTrigger(0.), | |
71 | fTrackID(0) | |
a9e2aefa | 72 | { |
2457f726 | 73 | /// Constructor from two Segment's |
54d7ba50 | 74 | |
d837040f | 75 | fTrackParamAtHit = new TClonesArray("AliMUONTrackParam",10); |
b8dc484b | 76 | fHitForRecAtHit = new TClonesArray("AliMUONHitForRec",10); |
de2cd600 | 77 | |
78 | if (BegSegment) { //AZ | |
79 | AddTrackParamAtHit(0,BegSegment->GetHitForRec1()); | |
80 | AddTrackParamAtHit(0,BegSegment->GetHitForRec2()); | |
81 | AddTrackParamAtHit(0,EndSegment->GetHitForRec1()); | |
82 | AddTrackParamAtHit(0,EndSegment->GetHitForRec2()); | |
83 | fTrackParamAtHit->Sort(); // sort TrackParamAtHit according to increasing Z | |
84 | } | |
a9e2aefa | 85 | } |
86 | ||
87 | //__________________________________________________________________________ | |
de2cd600 | 88 | AliMUONTrack::AliMUONTrack(AliMUONSegment* Segment, AliMUONHitForRec* HitForRec) |
54d7ba50 | 89 | : TObject(), |
54d7ba50 | 90 | fTrackParamAtVertex(), |
91 | fTrackParamAtHit(0x0), | |
92 | fHitForRecAtHit(0x0), | |
54d7ba50 | 93 | fNTrackHits(0), |
54d7ba50 | 94 | fFitFMin(-1.), |
95 | fMatchTrigger(kFALSE), | |
96 | fChi2MatchTrigger(0.), | |
97 | fTrackID(0) | |
a9e2aefa | 98 | { |
2457f726 | 99 | /// Constructor from one Segment and one HitForRec |
54d7ba50 | 100 | |
d837040f | 101 | fTrackParamAtHit = new TClonesArray("AliMUONTrackParam",10); |
b8dc484b | 102 | fHitForRecAtHit = new TClonesArray("AliMUONHitForRec",10); |
de2cd600 | 103 | |
104 | AddTrackParamAtHit(0,Segment->GetHitForRec1()); | |
105 | AddTrackParamAtHit(0,Segment->GetHitForRec2()); | |
106 | AddTrackParamAtHit(0,HitForRec); | |
107 | fTrackParamAtHit->Sort(); // sort TrackParamAtHit according to increasing Z | |
a9e2aefa | 108 | } |
109 | ||
8429a5e4 | 110 | //__________________________________________________________________________ |
111 | AliMUONTrack::~AliMUONTrack() | |
112 | { | |
2457f726 | 113 | /// Destructor |
d837040f | 114 | if (fTrackParamAtHit) { |
115 | // delete the TClonesArray of pointers to TrackParam | |
116 | delete fTrackParamAtHit; | |
117 | fTrackParamAtHit = NULL; | |
118 | } | |
b8dc484b | 119 | |
120 | if (fHitForRecAtHit) { | |
121 | // delete the TClonesArray of pointers to HitForRec | |
122 | delete fHitForRecAtHit; | |
123 | fHitForRecAtHit = NULL; | |
124 | } | |
8429a5e4 | 125 | } |
126 | ||
956019b6 | 127 | //__________________________________________________________________________ |
30178c30 | 128 | AliMUONTrack::AliMUONTrack (const AliMUONTrack& theMUONTrack) |
54d7ba50 | 129 | : TObject(theMUONTrack), |
54d7ba50 | 130 | fTrackParamAtVertex(theMUONTrack.fTrackParamAtVertex), |
131 | fTrackParamAtHit(0x0), | |
132 | fHitForRecAtHit(0x0), | |
54d7ba50 | 133 | fNTrackHits(theMUONTrack.fNTrackHits), |
54d7ba50 | 134 | fFitFMin(theMUONTrack.fFitFMin), |
135 | fMatchTrigger(theMUONTrack.fMatchTrigger), | |
136 | fChi2MatchTrigger(theMUONTrack.fChi2MatchTrigger), | |
137 | fTrackID(theMUONTrack.fTrackID) | |
a9e2aefa | 138 | { |
2457f726 | 139 | ///copy constructor |
de2cd600 | 140 | Int_t maxIndex = 0; |
141 | ||
e516b01d | 142 | // necessary to make a copy of the objects and not only the pointers in TClonesArray. |
a8865299 | 143 | if (theMUONTrack.fTrackParamAtHit) { |
de2cd600 | 144 | maxIndex = (theMUONTrack.fTrackParamAtHit)->GetEntriesFast(); |
145 | fTrackParamAtHit = new TClonesArray("AliMUONTrackParam",maxIndex); | |
146 | for (Int_t index = 0; index < maxIndex; index++) { | |
147 | new ((*fTrackParamAtHit)[index]) AliMUONTrackParam(*(AliMUONTrackParam*)theMUONTrack.fTrackParamAtHit->At(index)); | |
a8865299 | 148 | } |
149 | } | |
e516b01d | 150 | |
b8dc484b | 151 | // necessary to make a copy of the objects and not only the pointers in TClonesArray. |
a8865299 | 152 | if (theMUONTrack.fHitForRecAtHit) { |
de2cd600 | 153 | maxIndex = (theMUONTrack.fHitForRecAtHit)->GetEntriesFast(); |
154 | fHitForRecAtHit = new TClonesArray("AliMUONHitForRec",maxIndex); | |
155 | for (Int_t index = 0; index < maxIndex; index++) { | |
156 | new ((*fHitForRecAtHit)[index]) AliMUONHitForRec(*(AliMUONHitForRec*)theMUONTrack.fHitForRecAtHit->At(index)); | |
a8865299 | 157 | } |
158 | } | |
b8dc484b | 159 | |
a9e2aefa | 160 | } |
161 | ||
956019b6 | 162 | //__________________________________________________________________________ |
30178c30 | 163 | AliMUONTrack & AliMUONTrack::operator=(const AliMUONTrack& theMUONTrack) |
a9e2aefa | 164 | { |
2457f726 | 165 | /// Asignment operator |
30178c30 | 166 | // check assignement to self |
167 | if (this == &theMUONTrack) | |
a9e2aefa | 168 | return *this; |
61adb9bd | 169 | |
30178c30 | 170 | // base class assignement |
171 | TObject::operator=(theMUONTrack); | |
172 | ||
de2cd600 | 173 | fTrackParamAtVertex = theMUONTrack.fTrackParamAtVertex; |
e516b01d | 174 | |
de2cd600 | 175 | Int_t maxIndex = 0; |
176 | ||
e516b01d | 177 | // necessary to make a copy of the objects and not only the pointers in TClonesArray. |
a8865299 | 178 | fTrackParamAtHit = 0; |
179 | if (theMUONTrack.fTrackParamAtHit) { | |
180 | fTrackParamAtHit = new TClonesArray("AliMUONTrackParam",10); | |
de2cd600 | 181 | maxIndex = (theMUONTrack.fTrackParamAtHit)->GetEntriesFast(); |
182 | for (Int_t index = 0; index < maxIndex; index++) { | |
183 | new ((*fTrackParamAtHit)[fTrackParamAtHit->GetEntriesFast()]) | |
184 | AliMUONTrackParam(*(AliMUONTrackParam*)(theMUONTrack.fTrackParamAtHit)->At(index)); | |
a8865299 | 185 | } |
186 | } | |
e516b01d | 187 | |
b8dc484b | 188 | // necessary to make a copy of the objects and not only the pointers in TClonesArray. |
a8865299 | 189 | fHitForRecAtHit = 0; |
de2cd600 | 190 | if (theMUONTrack.fHitForRecAtHit) { |
a8865299 | 191 | fHitForRecAtHit = new TClonesArray("AliMUONHitForRec",10); |
de2cd600 | 192 | maxIndex = (theMUONTrack.fHitForRecAtHit)->GetEntriesFast(); |
193 | for (Int_t index = 0; index < maxIndex; index++) { | |
194 | new ((*fHitForRecAtHit)[fHitForRecAtHit->GetEntriesFast()]) | |
195 | AliMUONHitForRec(*(AliMUONHitForRec*)(theMUONTrack.fHitForRecAtHit)->At(index)); | |
a8865299 | 196 | } |
197 | } | |
de2cd600 | 198 | |
30178c30 | 199 | fNTrackHits = theMUONTrack.fNTrackHits; |
30178c30 | 200 | fFitFMin = theMUONTrack.fFitFMin; |
30178c30 | 201 | fMatchTrigger = theMUONTrack.fMatchTrigger; |
202 | fChi2MatchTrigger = theMUONTrack.fChi2MatchTrigger; | |
b8dc484b | 203 | fTrackID = theMUONTrack.fTrackID; |
30178c30 | 204 | |
61adb9bd | 205 | return *this; |
a9e2aefa | 206 | } |
207 | ||
8429a5e4 | 208 | //__________________________________________________________________________ |
de2cd600 | 209 | void AliMUONTrack::AddTrackParamAtHit(AliMUONTrackParam *trackParam, AliMUONHitForRec *hitForRec) |
8429a5e4 | 210 | { |
2457f726 | 211 | /// Add TrackParamAtHit if "trackParam" != NULL else create empty TrackParamAtHit |
212 | /// Update link to HitForRec if "hitForRec" != NULL | |
de2cd600 | 213 | if (!fTrackParamAtHit) { |
214 | fTrackParamAtHit = new TClonesArray("AliMUONTrackParam",10); | |
215 | fNTrackHits = 0; | |
956019b6 | 216 | } |
2457f726 | 217 | AliMUONTrackParam* trackParamAtHit; |
218 | if (trackParam) trackParamAtHit = new ((*fTrackParamAtHit)[fNTrackHits]) AliMUONTrackParam(*trackParam); | |
219 | else trackParamAtHit = new ((*fTrackParamAtHit)[fNTrackHits]) AliMUONTrackParam(); | |
220 | if (hitForRec) trackParamAtHit->SetHitForRecPtr(hitForRec); | |
de2cd600 | 221 | fNTrackHits++; |
956019b6 | 222 | } |
223 | ||
224 | //__________________________________________________________________________ | |
de2cd600 | 225 | void AliMUONTrack::AddHitForRecAtHit(const AliMUONHitForRec *hitForRec) |
956019b6 | 226 | { |
2457f726 | 227 | /// Add hitForRec to the array of hitForRec at hit |
de2cd600 | 228 | if (!fHitForRecAtHit) |
229 | fHitForRecAtHit = new TClonesArray("AliMUONHitForRec",10); | |
230 | ||
231 | if (!hitForRec) | |
232 | AliFatal("AliMUONTrack::AddHitForRecAtHit: hitForRec == NULL"); | |
233 | ||
234 | new ((*fHitForRecAtHit)[fHitForRecAtHit->GetEntriesFast()]) AliMUONHitForRec(*hitForRec); | |
04b5ea16 | 235 | } |
236 | ||
b8dc484b | 237 | //__________________________________________________________________________ |
238 | Bool_t* AliMUONTrack::CompatibleTrack(AliMUONTrack * Track, Double_t Sigma2Cut) const | |
239 | { | |
2457f726 | 240 | /// Return kTRUE/kFALSE for each chamber if hit is compatible or not |
b8dc484b | 241 | TClonesArray *hitArray, *thisHitArray; |
242 | AliMUONHitForRec *hit, *thisHit; | |
243 | Int_t chamberNumber; | |
244 | Float_t deltaZ; | |
245 | Float_t deltaZMax = 1.; // 1 cm | |
246 | Float_t chi2 = 0; | |
247 | Bool_t *nCompHit = new Bool_t[AliMUONConstants::NTrackingCh()]; | |
248 | ||
249 | for ( Int_t ch = 0; ch < AliMUONConstants::NTrackingCh(); ch++) { | |
250 | nCompHit[ch] = kFALSE; | |
251 | } | |
252 | ||
253 | thisHitArray = this->GetHitForRecAtHit(); | |
254 | ||
255 | hitArray = Track->GetHitForRecAtHit(); | |
256 | ||
257 | for (Int_t iHthis = 0; iHthis < thisHitArray->GetEntriesFast(); iHthis++) { | |
258 | thisHit = (AliMUONHitForRec*) thisHitArray->At(iHthis); | |
259 | chamberNumber = thisHit->GetChamberNumber(); | |
260 | if (chamberNumber < 0 || chamberNumber > AliMUONConstants::NTrackingCh()) continue; | |
261 | nCompHit[chamberNumber] = kFALSE; | |
262 | for (Int_t iH = 0; iH < hitArray->GetEntriesFast(); iH++) { | |
263 | hit = (AliMUONHitForRec*) hitArray->At(iH); | |
264 | deltaZ = TMath::Abs(thisHit->GetZ() - hit->GetZ()); | |
265 | chi2 = thisHit->NormalizedChi2WithHitForRec(hit,Sigma2Cut); // set cut to 4 sigmas | |
266 | if (chi2 < 3. && deltaZ < deltaZMax) { | |
267 | nCompHit[chamberNumber] = kTRUE; | |
268 | break; | |
269 | } | |
270 | } | |
271 | } | |
272 | ||
273 | return nCompHit; | |
274 | } | |
a9e2aefa | 275 | |
8429a5e4 | 276 | //__________________________________________________________________________ |
30178c30 | 277 | Int_t AliMUONTrack::HitsInCommon(AliMUONTrack* Track) const |
8429a5e4 | 278 | { |
2457f726 | 279 | /// Returns the number of hits in common between the current track ("this") |
280 | /// and the track pointed to by "Track". | |
8429a5e4 | 281 | Int_t hitsInCommon = 0; |
de2cd600 | 282 | AliMUONTrackParam *trackParamAtHit1, *trackParamAtHit2; |
8429a5e4 | 283 | // Loop over hits of first track |
de2cd600 | 284 | trackParamAtHit1 = (AliMUONTrackParam*) this->fTrackParamAtHit->First(); |
285 | while (trackParamAtHit1) { | |
8429a5e4 | 286 | // Loop over hits of second track |
de2cd600 | 287 | trackParamAtHit2 = (AliMUONTrackParam*) Track->fTrackParamAtHit->First(); |
288 | while (trackParamAtHit2) { | |
289 | // Increment "hitsInCommon" if both TrackParamAtHits point to the same HitForRec | |
290 | if ((trackParamAtHit1->GetHitForRecPtr()) == (trackParamAtHit2->GetHitForRecPtr())) hitsInCommon++; | |
291 | trackParamAtHit2 = (AliMUONTrackParam*) Track->fTrackParamAtHit->After(trackParamAtHit2); | |
292 | } // trackParamAtHit2 | |
293 | trackParamAtHit1 = (AliMUONTrackParam*) this->fTrackParamAtHit->After(trackParamAtHit1); | |
294 | } // trackParamAtHit1 | |
8429a5e4 | 295 | return hitsInCommon; |
296 | } | |
297 | ||
d837040f | 298 | //__________________________________________________________________________ |
de2cd600 | 299 | void AliMUONTrack::RecursiveDump(void) const |
a9e2aefa | 300 | { |
2457f726 | 301 | /// Recursive dump of AliMUONTrack, i.e. with dump of TrackParamAtHit's and attached HitForRec's |
de2cd600 | 302 | AliMUONTrackParam *trackParamAtHit; |
303 | AliMUONHitForRec *hitForRec; | |
304 | cout << "Recursive dump of Track: " << this << endl; | |
305 | // Track | |
306 | this->Dump(); | |
307 | for (Int_t trackHitIndex = 0; trackHitIndex < fNTrackHits; trackHitIndex++) { | |
308 | trackParamAtHit = (AliMUONTrackParam*) ((*fTrackParamAtHit)[trackHitIndex]); | |
309 | // TrackHit | |
310 | cout << "TrackParamAtHit: " << trackParamAtHit << " (index: " << trackHitIndex << ")" << endl; | |
311 | trackParamAtHit->Dump(); | |
312 | hitForRec = trackParamAtHit->GetHitForRecPtr(); | |
313 | // HitForRec | |
314 | cout << "HitForRec: " << hitForRec << endl; | |
315 | hitForRec->Dump(); | |
a9e2aefa | 316 | } |
de2cd600 | 317 | return; |
a9e2aefa | 318 | } |
04b5ea16 | 319 | |
6464217e | 320 | //_____________________________________________- |
321 | void AliMUONTrack::Print(Option_t* opt) const | |
322 | { | |
2457f726 | 323 | /// Printing Track information |
324 | /// "full" option for printing all the information about the track | |
6464217e | 325 | TString sopt(opt); |
326 | sopt.ToUpper(); | |
327 | ||
328 | if ( sopt.Contains("FULL") ) { | |
329 | cout << "<AliMUONTrack> No.Clusters=" << setw(2) << GetNTrackHits() << | |
330 | // ", Bending P="<< setw(8) << setprecision(5) << 1./GetInverseBendingMomentum() << | |
331 | //", NonBendSlope=" << setw(8) << setprecision(5) << GetNonBendingSlope()*180./TMath::Pi() << | |
332 | //", BendSlope=" << setw(8) << setprecision(5) << GetBendingSlope()*180./TMath::Pi() << | |
333 | ", Match2Trig=" << setw(1) << GetMatchTrigger() << | |
334 | ", Chi2-tracking-trigger=" << setw(8) << setprecision(5) << GetChi2MatchTrigger() << endl ; | |
335 | GetTrackParamAtHit()->First()->Print("full"); | |
336 | } | |
337 | else { | |
338 | cout << "<AliMUONTrack>"; | |
339 | GetTrackParamAtHit()->First()->Print(""); | |
340 | ||
341 | } | |
342 | ||
343 | } |