MFT methods for muon and dimuon offset modified
authorauras <antonio.uras@cern.ch>
Fri, 25 Jul 2014 15:32:03 +0000 (17:32 +0200)
committerauras <antonio.uras@cern.ch>
Fri, 25 Jul 2014 15:32:03 +0000 (17:32 +0200)
MFT/AliMFTAnalysisTools.cxx
MFT/AliMFTAnalysisTools.h

index 34fef4b..3fed3ea 100644 (file)
@@ -128,18 +128,20 @@ Bool_t AliMFTAnalysisTools::ExtrapAODMuonToZ(AliAODTrack *muon, Double_t z, Doub
 
 //====================================================================================================================================================
 
-Double_t AliMFTAnalysisTools::GetAODMuonOffset(AliAODTrack *muon, Double_t xv, Double_t yv, Double_t zv) {
+Bool_t AliMFTAnalysisTools::GetAODMuonOffset(AliAODTrack *muon, Double_t xv, Double_t yv, Double_t zv, Double_t &offset) {
 
   Double_t xy[2] = {0};
   ExtrapAODMuonToZ(muon, zv, xy);
   
-  return TMath::Sqrt((xv-xy[0])*(xv-xy[0]) + (yv-xy[1])*(yv-xy[1]));
+  offset = TMath::Sqrt((xv-xy[0])*(xv-xy[0]) + (yv-xy[1])*(yv-xy[1]));
+
+  return kTRUE;
 
 }
 
 //====================================================================================================================================================
 
-Double_t AliMFTAnalysisTools::GetAODMuonWeightedOffset(AliAODTrack *muon, Double_t xv, Double_t yv, Double_t zv) {
+Bool_t AliMFTAnalysisTools::GetAODMuonWeightedOffset(AliAODTrack *muon, Double_t xv, Double_t yv, Double_t zv, Double_t &offset) {
 
   Double_t xy[2] = {0};
   TLorentzVector kinem(0,0,0,0);
@@ -159,15 +161,15 @@ Double_t AliMFTAnalysisTools::GetAODMuonWeightedOffset(AliAODTrack *muon, Double
     Double_t dX = xy[0] - xv;
     Double_t dY = xy[1] - yv;
     
-    Double_t weightedOffset = TMath::Sqrt(0.5*(dX*dX*covCoordinatesInverse(0,0) +
-                                              dY*dY*covCoordinatesInverse(1,1) +
-                                              2.*dX*dY*covCoordinatesInverse(0,1)));
+    offset = TMath::Sqrt(0.5*(dX*dX*covCoordinatesInverse(0,0) +
+                             dY*dY*covCoordinatesInverse(1,1) +
+                             2.*dX*dY*covCoordinatesInverse(0,1)));
     
-    return weightedOffset;
+    return kTRUE;
 
   }
   
-  return -999;
+  return kFALSE;
 
 }
 
@@ -369,7 +371,12 @@ Bool_t AliMFTAnalysisTools::CalculatePCA(TObjArray *muons, Double_t *pca, Double
   
   Double_t sum=0.,squareSum=0.;
   for (Int_t iMu=0; iMu<nMuons; iMu++) {
-    Double_t wOffset = AliMFTAnalysisTools::GetAODMuonWeightedOffset(muon[iMu],fXPointOfClosestApproach, fYPointOfClosestApproach, fZPointOfClosestApproach);
+    Double_t wOffset = 0;
+    if (!GetAODMuonWeightedOffset(muon[iMu],fXPointOfClosestApproach, fYPointOfClosestApproach, fZPointOfClosestApproach, wOffset)) {
+      for(Int_t jMu=0;jMu<nMuons;jMu++) delete param[jMu];
+      delete points;
+      return kFALSE;
+    }
     Double_t f = TMath::Exp(-0.5 * wOffset);
     sum += f;
     squareSum += f*f;
index 74c0f4c..f2239db 100644 (file)
@@ -36,8 +36,8 @@ public:
   static Bool_t ExtrapAODMuonToZ(AliAODTrack *muon, Double_t z, Double_t xy[2], TLorentzVector &kinem);
   static Bool_t ExtrapAODMuonToZ(AliAODTrack *muon, Double_t z, Double_t xy[2], TLorentzVector &kinem, TMatrixD &cov);
 
-  static Double_t GetAODMuonOffset(AliAODTrack *muon, Double_t xv, Double_t yv, Double_t zv);
-  static Double_t GetAODMuonWeightedOffset(AliAODTrack *muon, Double_t xv, Double_t yv, Double_t zv);
+  static Bool_t GetAODMuonOffset(AliAODTrack *muon, Double_t xv, Double_t yv, Double_t zv, Double_t &offset);
+  static Bool_t GetAODMuonWeightedOffset(AliAODTrack *muon, Double_t xv, Double_t yv, Double_t zv, Double_t &offset);
 
   static Bool_t CalculatePCA(AliAODDimuon *dimuon, Double_t *pca, Double_t &pcaQuality, TLorentzVector &kinem);
   static Bool_t CalculatePCA(TObjArray *muons, Double_t *pca, Double_t &pcaQuality, TLorentzVector &kinem);