1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //====================================================================================================================================================
18 // Description of an ALICE muon forward track pair, i.e. a pair of AliMuonForwardTrack objects
20 // Contact author: antonio.uras@cern.ch
22 //====================================================================================================================================================
25 #include "AliMUONTrackParam.h"
26 #include "TParticle.h"
27 #include "AliMuonForwardTrack.h"
28 #include "AliMUONTrackExtrap.h"
29 #include "TClonesArray.h"
30 #include "TDatabasePDG.h"
31 #include "TLorentzVector.h"
33 #include "AliMuonForwardTrackPair.h"
35 ClassImp(AliMuonForwardTrackPair)
37 //====================================================================================================================================================
39 AliMuonForwardTrackPair::AliMuonForwardTrackPair():
41 fMuonForwardTracks(0),
45 fXPointOfClosestApproach(9999),
46 fYPointOfClosestApproach(9999),
47 fZPointOfClosestApproach(9999)
50 // default constructor
52 fMuonForwardTracks = new TClonesArray("AliMuonForwardTrack", 2);
56 //====================================================================================================================================================
58 AliMuonForwardTrackPair::AliMuonForwardTrackPair(AliMuonForwardTrack *track0, AliMuonForwardTrack *track1):
60 fMuonForwardTracks(0),
64 fXPointOfClosestApproach(9999),
65 fYPointOfClosestApproach(9999),
66 fZPointOfClosestApproach(9999)
69 fMuonForwardTracks = new TClonesArray("AliMuonForwardTrack", 2);
71 new ((*fMuonForwardTracks)[0]) AliMuonForwardTrack(*track0);
72 new ((*fMuonForwardTracks)[1]) AliMuonForwardTrack(*track1);
75 SetPointOfClosestApproach();
79 //====================================================================================================================================================
81 AliMuonForwardTrackPair::AliMuonForwardTrackPair(const AliMuonForwardTrackPair& trackPair):
83 fMuonForwardTracks(trackPair.fMuonForwardTracks),
84 fKinemMC(trackPair.fKinemMC),
85 fKinem(trackPair.fKinem),
86 fIsKinemSet(trackPair.fIsKinemSet),
87 fXPointOfClosestApproach(trackPair.fXPointOfClosestApproach),
88 fYPointOfClosestApproach(trackPair.fYPointOfClosestApproach),
89 fZPointOfClosestApproach(trackPair.fZPointOfClosestApproach)
96 //====================================================================================================================================================
98 AliMuonForwardTrackPair& AliMuonForwardTrackPair::operator=(const AliMuonForwardTrackPair& trackPair) {
100 // Asignment operator
102 // check assignement to self
103 if (this == &trackPair) return *this;
105 // base class assignement
106 AliMuonForwardTrackPair::operator=(trackPair);
111 fMuonForwardTracks = trackPair.fMuonForwardTracks;
112 fKinemMC = trackPair.fKinemMC;
113 fKinem = trackPair.fKinem;
114 fIsKinemSet = trackPair.fIsKinemSet;
115 fXPointOfClosestApproach = trackPair.fXPointOfClosestApproach;
116 fYPointOfClosestApproach = trackPair.fYPointOfClosestApproach;
117 fZPointOfClosestApproach = trackPair.fZPointOfClosestApproach;
123 //====================================================================================================================================================
125 Double_t AliMuonForwardTrackPair::GetWeightedOffset(Double_t x, Double_t y, Double_t z) {
127 Double_t weightedOffset[2]={0};
129 weightedOffset[0] = GetTrack(0)->GetWeightedOffset(x, y, z);
130 weightedOffset[1] = GetTrack(1)->GetWeightedOffset(x, y, z);
132 Double_t weightedOffsetDimuon = TMath::Sqrt(0.5 * (weightedOffset[0]*weightedOffset[0] + weightedOffset[1]*weightedOffset[1]));
134 return weightedOffsetDimuon;
138 //====================================================================================================================================================
140 Double_t AliMuonForwardTrackPair::GetMassWithoutMFT(Double_t x, Double_t y, Double_t z, Int_t nClusters) {
142 Int_t idCluster[2] = {0};
144 idCluster[0] = GetTrack(0)->GetNMUONClusters() - nClusters;
145 idCluster[1] = GetTrack(1)->GetNMUONClusters() - nClusters;
147 if (idCluster[0]<0) idCluster[0] = 0;
148 if (idCluster[1]<0) idCluster[1] = 0;
150 AliMUONTrackParam *param0 = GetTrack(0)->GetTrackParamAtMUONCluster(idCluster[0]);
151 AliMUONTrackParam *param1 = GetTrack(1)->GetTrackParamAtMUONCluster(idCluster[1]);
153 AliDebug(2, Form("MUON before extrap: 1st muon = (%f, %f, %f) 2nd muon = (%f, %f, %f)",
154 param0->Px(), param0->Py(), param0->Pz(), param1->Px(), param1->Py(), param1->Pz()));
156 AliDebug(2, Form("Extrapolating 1st muon from z = %f to z = %f", param0->GetZ(), z));
157 AliMUONTrackExtrap::ExtrapToVertex(param0, x, y, z, 0., 0.); // this should reproduce what is done in AliMUONESDInterface::MUONToESD(...)
158 AliDebug(2, Form("Extrapolating 2nd muon from z = %f to z = %f", param1->GetZ(), z));
159 AliMUONTrackExtrap::ExtrapToVertex(param1, x, y, z, 0., 0.); // this should reproduce what is done in AliMUONESDInterface::MUONToESD(...)
161 AliDebug(2, Form("MUON after extrap: 1st muon = (%f, %f, %f) 2nd muon = (%f, %f, %f)",
162 param0->Px(), param0->Py(), param0->Pz(), param1->Px(), param1->Py(), param1->Pz()));
164 Double_t momentum[2] = {0};
166 momentum[0] = param0->P();
167 momentum[1] = param1->P();
169 Double_t mMu = TDatabasePDG::Instance()->GetParticle("mu-")->Mass();
173 dimu.SetE(TMath::Sqrt(mMu*mMu + momentum[0]*momentum[0]) + TMath::Sqrt(mMu*mMu + momentum[1]*momentum[1]));
175 dimu.SetPx(param0->Px() + param1->Px());
176 dimu.SetPy(param0->Py() + param1->Py());
177 dimu.SetPz(param0->Pz() + param1->Pz());
183 //====================================================================================================================================================
185 void AliMuonForwardTrackPair::SetKinemMC() {
187 if ( !(GetTrack(0)->GetMCTrackRef()) || !(GetTrack(1)->GetMCTrackRef()) ) return;
189 AliDebug(2, Form("MC: 1st muon = (%f, %f, %f) 2nd muon = (%f, %f, %f)",
190 GetTrack(0)->GetMCTrackRef()->Px(), GetTrack(0)->GetMCTrackRef()->Py(), GetTrack(0)->GetMCTrackRef()->Pz(),
191 GetTrack(1)->GetMCTrackRef()->Px(), GetTrack(1)->GetMCTrackRef()->Py(), GetTrack(1)->GetMCTrackRef()->Pz()));
193 fKinemMC.SetE(GetTrack(0)->GetMCTrackRef()->Energy() + GetTrack(1)->GetMCTrackRef()->Energy());
195 fKinemMC.SetPx(GetTrack(0)->GetMCTrackRef()->Px() + GetTrack(1)->GetMCTrackRef()->Px());
196 fKinemMC.SetPy(GetTrack(0)->GetMCTrackRef()->Py() + GetTrack(1)->GetMCTrackRef()->Py());
197 fKinemMC.SetPz(GetTrack(0)->GetMCTrackRef()->Pz() + GetTrack(1)->GetMCTrackRef()->Pz());
201 //====================================================================================================================================================
203 void AliMuonForwardTrackPair::SetKinem(Double_t z, Int_t nClusters) {
205 // if (!fMuonForwardTracks) return kFALSE;
206 // if (!fMuonForwardTracks->At(0) || !fMuonForwardTracks->At(1)) return kFALSE;
208 Int_t idCluster[2] = {0};
210 idCluster[0] = GetTrack(0)->GetNMFTClusters() - nClusters;
211 idCluster[1] = GetTrack(1)->GetNMFTClusters() - nClusters;
213 if (idCluster[0]<0) idCluster[0] = 0;
214 if (idCluster[1]<0) idCluster[1] = 0;
216 Double_t momentum[2] = {0};
218 AliMUONTrackParam *param0 = GetTrack(0)->GetTrackParamAtMFTCluster(idCluster[0]);
219 AliMUONTrackParam *param1 = GetTrack(1)->GetTrackParamAtMFTCluster(idCluster[1]);
221 AliDebug(2, Form("MFT before extrap: 1st muon = (%f, %f, %f) 2nd muon = (%f, %f, %f)",
222 param0->Px(), param0->Py(), param0->Pz(), param1->Px(), param1->Py(), param1->Pz()));
224 if (TMath::Abs(z)<1e6) {
225 AliDebug(2, Form("Extrapolating 1st muon from z = %f to z = %f", param0->GetZ(), z));
226 AliMUONTrackExtrap::ExtrapToZCov(param0, z);
227 AliDebug(2, Form("Extrapolating 2nd muon from z = %f to z = %f", param1->GetZ(), z));
228 AliMUONTrackExtrap::ExtrapToZCov(param1, z);
231 AliDebug(2, Form("MFT after extrap: 1st muon = (%f, %f, %f) 2nd muon = (%f, %f, %f)",
232 param0->Px(), param0->Py(), param0->Pz(), param1->Px(), param1->Py(), param1->Pz()));
234 momentum[0] = (param0->P());
235 momentum[1] = (param1->P());
237 Double_t mMu = TDatabasePDG::Instance()->GetParticle("mu-")->Mass();
239 fKinem.SetE(TMath::Sqrt(mMu*mMu + momentum[0]*momentum[0]) + TMath::Sqrt(mMu*mMu + momentum[1]*momentum[1]));
240 fKinem.SetPx(param0->Px() + param1->Px());
241 fKinem.SetPy(param0->Py() + param1->Py());
242 fKinem.SetPz(param0->Pz() + param1->Pz());
248 //====================================================================================================================================================
250 void AliMuonForwardTrackPair::SetPointOfClosestApproach() {
252 AliMUONTrackParam *param0 = GetTrack(0)->GetTrackParamAtMFTCluster(0);
253 AliMUONTrackParam *param1 = GetTrack(1)->GetTrackParamAtMFTCluster(0);
255 Double_t step = 1.; // in cm
256 Double_t startPoint = 0.;
258 Double_t r[3]={0}, z[3]={startPoint, startPoint+step, startPoint+2*step};
260 for (Int_t i=0; i<3; i++) {
261 AliMUONTrackExtrap::ExtrapToZCov(param0, z[i]);
262 AliMUONTrackExtrap::ExtrapToZCov(param1, z[i]);
263 Double_t dX = param0->GetNonBendingCoor() - param1->GetNonBendingCoor();
264 Double_t dY = param0->GetBendingCoor() - param1->GetBendingCoor();
265 r[i] = TMath::Sqrt(dX*dX + dY*dY);
268 Double_t researchDirection=0.;
270 if (r[0]>r[1] && r[1]>r[2]) researchDirection = +1.; // towards z positive
271 else if (r[0]<r[1] && r[1]<r[2]) researchDirection = -1.; // towards z negative
272 else if (r[0]<r[1] && r[1]>r[2]) {
273 AliError("Point of closest approach cannot be found for dimuon (no minima)");
277 while (TMath::Abs(researchDirection)>0.5) {
278 if (researchDirection>0.) {
281 z[2] = z[1]+researchDirection*step;
286 z[0] = z[1]+researchDirection*step;
288 if (TMath::Abs(z[0])>900.) {
289 AliError("Point of closest approach cannot be found for dimuon (no minima)");
292 for (Int_t i=0; i<3; i++) {
293 AliMUONTrackExtrap::ExtrapToZCov(param0, z[i]);
294 AliMUONTrackExtrap::ExtrapToZCov(param1, z[i]);
295 Double_t dX = param0->GetNonBendingCoor() - param1->GetNonBendingCoor();
296 Double_t dY = param0->GetBendingCoor() - param1->GetBendingCoor();
297 r[i] = TMath::Sqrt(dX*dX + dY*dY);
299 researchDirection=0.;
300 if (r[0]>r[1] && r[1]>r[2]) researchDirection = +1.; // towards z positive
301 else if (r[0]<r[1] && r[1]<r[2]) researchDirection = -1.; // towards z negative
304 AliDebug(2,"Minimum region has been found");
307 while (step>AliMFTConstants::fPrecisionPointOfClosestApproach) {
310 for (Int_t i=0; i<3; i++) {
311 AliMUONTrackExtrap::ExtrapToZCov(param0, z[i]);
312 AliMUONTrackExtrap::ExtrapToZCov(param1, z[i]);
313 Double_t dX = param0->GetNonBendingCoor() - param1->GetNonBendingCoor();
314 Double_t dY = param0->GetBendingCoor() - param1->GetBendingCoor();
315 r[i] = TMath::Sqrt(dX*dX + dY*dY);
317 if (r[0]<r[1]) z[1] = z[0];
318 else if (r[2]<r[1]) z[1] = z[2];
322 fZPointOfClosestApproach = z[1];
323 AliMUONTrackExtrap::ExtrapToZCov(param0, fZPointOfClosestApproach);
324 AliMUONTrackExtrap::ExtrapToZCov(param1, fZPointOfClosestApproach);
325 fXPointOfClosestApproach = 0.5*(param0->GetNonBendingCoor() + param1->GetNonBendingCoor());
326 fYPointOfClosestApproach = 0.5*(param0->GetBendingCoor() + param1->GetBendingCoor());
328 AliDebug(2,Form("Point of Closest Approach: (%f, %f, %f)",fXPointOfClosestApproach,fYPointOfClosestApproach,fZPointOfClosestApproach));
332 //====================================================================================================================================================
334 Bool_t AliMuonForwardTrackPair::IsResonance() {
336 Bool_t result = kFALSE;
338 Int_t labelMC[2] = {0};
339 Int_t codePDG[2] = {0};
341 for (Int_t iTrack=0; iTrack<2; iTrack++) {
342 labelMC[iTrack] = GetTrack(iTrack)->GetParentMCLabel(0);
343 codePDG[iTrack] = GetTrack(iTrack)->GetParentPDGCode(0);
346 AliDebug(1, Form("Muons' mothers: (%d, %d)", labelMC[0], labelMC[1]));
348 if (labelMC[0]==labelMC[1] && codePDG[0]==codePDG[1] && (codePDG[0]== 113 ||
354 codePDG[0]==100443 ||
356 codePDG[0]==100553 ) ) result = kTRUE;
358 if (result) AliDebug(1, Form("Pair is a resonance %d", codePDG[0]));
364 //====================================================================================================================================================