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