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 // Support class for various common operation on MFT objects
20 // Contact author: antonio.uras@cern.ch
22 //====================================================================================================================================================
24 #include "AliMUONTrackParam.h"
25 #include "AliMUONTrackExtrap.h"
26 #include "AliAODTrack.h"
27 #include "AliAODDimuon.h"
28 #include "TLorentzVector.h"
29 #include "AliMFTConstants.h"
30 #include "TDatabasePDG.h"
34 #include "AliMFTSupport.h"
36 ClassImp(AliMFTSupport)
38 //====================================================================================================================================================
40 Bool_t AliMFTSupport::ExtrapAODMuonToZ(AliAODTrack *muon, Double_t z, Double_t xy[2]) {
42 if (!(muon->Pz()!=0)) return kFALSE;
44 AliMUONTrackParam *param = new AliMUONTrackParam();
46 param -> SetNonBendingCoor(muon->XAtDCA());
47 param -> SetBendingCoor(muon->YAtDCA());
49 param -> SetNonBendingSlope(muon->Px()/muon->Pz());
50 param -> SetBendingSlope(muon->Py()/muon->Pz());
51 param -> SetInverseBendingMomentum( muon->Charge() * (1./muon->Pz()) / (TMath::Sqrt(1+TMath::Power(muon->Py()/muon->Pz(),2))) );
53 AliMUONTrackExtrap::ExtrapToZ(param, z);
54 xy[0] = param->GetNonBendingCoor();
55 xy[1] = param->GetBendingCoor();
61 //====================================================================================================================================================
63 Bool_t AliMFTSupport::RefitAODDimuonWithCommonVertex(AliAODDimuon *dimuon, Double_t *vertex, TLorentzVector &kinem) {
65 Double_t fXPointOfClosestApproach=0, fYPointOfClosestApproach=0, fZPointOfClosestApproach=0;
67 AliAODTrack *muon0 = dimuon->GetMu(0);
68 AliAODTrack *muon1 = dimuon->GetMu(1);
70 if (!(muon0->Pz()!=0 && muon1->Pz()!=0)) return kFALSE;
72 AliMUONTrackParam *param0 = new AliMUONTrackParam();
73 AliMUONTrackParam *param1 = new AliMUONTrackParam();
75 param0 -> SetNonBendingCoor(muon0->XAtDCA());
76 param1 -> SetNonBendingCoor(muon1->XAtDCA());
78 param0 -> SetBendingCoor(muon0->YAtDCA());
79 param1 -> SetBendingCoor(muon1->YAtDCA());
84 param0 -> SetNonBendingSlope(muon0->Px()/muon0->Pz());
85 param1 -> SetNonBendingSlope(muon1->Px()/muon1->Pz());
87 param0 -> SetBendingSlope(muon0->Py()/muon0->Pz());
88 param1 -> SetBendingSlope(muon1->Py()/muon1->Pz());
90 param0 -> SetInverseBendingMomentum( muon0->Charge() * (1./muon0->Pz()) / (TMath::Sqrt(1+TMath::Power(muon0->Py()/muon0->Pz(),2))) );
91 param1 -> SetInverseBendingMomentum( muon1->Charge() * (1./muon1->Pz()) / (TMath::Sqrt(1+TMath::Power(muon1->Py()/muon1->Pz(),2))) );
93 Double_t step = 1.; // in cm
94 Double_t startPoint = 0.;
96 Double_t r[3]={0}, z[3]={startPoint, startPoint+step, startPoint+2*step};
98 for (Int_t i=0; i<3; i++) {
99 AliMUONTrackExtrap::ExtrapToZ(param0, z[i]);
100 AliMUONTrackExtrap::ExtrapToZ(param1, z[i]);
101 Double_t dX = param0->GetNonBendingCoor() - param1->GetNonBendingCoor();
102 Double_t dY = param0->GetBendingCoor() - param1->GetBendingCoor();
103 r[i] = TMath::Sqrt(dX*dX + dY*dY);
106 Double_t researchDirection=0.;
108 if (r[0]>r[1] && r[1]>r[2]) researchDirection = +1.; // towards z positive
109 else if (r[0]<r[1] && r[1]<r[2]) researchDirection = -1.; // towards z negative
110 else if (r[0]<r[1] && r[1]>r[2]) {
111 printf("E-AliMFTSupport::RefitAODDimuonWithCommonVertex: Point of closest approach cannot be found for dimuon (no minima)\n");
115 while (TMath::Abs(researchDirection)>0.5) {
116 if (researchDirection>0.) {
119 z[2] = z[1]+researchDirection*step;
124 z[0] = z[1]+researchDirection*step;
126 if (TMath::Abs(z[0])>900.) {
127 printf("E-AliMFTSupport::RefitAODDimuonWithCommonVertex: Point of closest approach cannot be found for dimuon (no minima)\n");
130 for (Int_t i=0; i<3; i++) {
131 AliMUONTrackExtrap::ExtrapToZ(param0, z[i]);
132 AliMUONTrackExtrap::ExtrapToZ(param1, z[i]);
133 Double_t dX = param0->GetNonBendingCoor() - param1->GetNonBendingCoor();
134 Double_t dY = param0->GetBendingCoor() - param1->GetBendingCoor();
135 r[i] = TMath::Sqrt(dX*dX + dY*dY);
137 researchDirection=0.;
138 if (r[0]>r[1] && r[1]>r[2]) researchDirection = +1.; // towards z positive
139 else if (r[0]<r[1] && r[1]<r[2]) researchDirection = -1.; // towards z negative
143 while (step>AliMFTConstants::fPrecisionPointOfClosestApproach) {
146 for (Int_t i=0; i<3; i++) {
147 AliMUONTrackExtrap::ExtrapToZ(param0, z[i]);
148 AliMUONTrackExtrap::ExtrapToZ(param1, z[i]);
149 Double_t dX = param0->GetNonBendingCoor() - param1->GetNonBendingCoor();
150 Double_t dY = param0->GetBendingCoor() - param1->GetBendingCoor();
151 r[i] = TMath::Sqrt(dX*dX + dY*dY);
153 if (r[0]<r[1]) z[1] = z[0];
154 else if (r[2]<r[1]) z[1] = z[2];
158 fZPointOfClosestApproach = z[1];
159 AliMUONTrackExtrap::ExtrapToZ(param0, fZPointOfClosestApproach);
160 AliMUONTrackExtrap::ExtrapToZ(param1, fZPointOfClosestApproach);
161 fXPointOfClosestApproach = 0.5*(param0->GetNonBendingCoor() + param1->GetNonBendingCoor());
162 fYPointOfClosestApproach = 0.5*(param0->GetBendingCoor() + param1->GetBendingCoor());
164 //-------------------------------------------------------------------------------------------------------------------------------------------------
166 vertex[0] = fXPointOfClosestApproach;
167 vertex[1] = fYPointOfClosestApproach;
168 vertex[2] = fZPointOfClosestApproach;
170 Double_t pTot[3] = {0};
171 pTot[0] = param0->Px() + param1->Px();
172 pTot[1] = param0->Py() + param1->Py();
173 pTot[2] = param0->Pz() + param1->Pz();
175 Double_t massMu = TDatabasePDG::Instance()->GetParticle("mu-")->Mass();
177 Double_t energy0 = TMath::Sqrt(massMu*massMu + param0->Px()*param0->Px() + param0->Py()*param0->Py() + param0->Pz()*param0->Pz());
178 Double_t energy1 = TMath::Sqrt(massMu*massMu + param1->Px()*param1->Px() + param1->Py()*param1->Py() + param1->Pz()*param1->Pz());
180 kinem.SetPxPyPzE(pTot[0], pTot[1], pTot[2], energy0+energy1);
186 //====================================================================================================================================================