]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/RESONANCES/AliRsnPairParticle.cxx
Package revised - New AnalysisTask's - Added more functions
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnPairParticle.cxx
index ab9999e0a7a6162e3a533015186efdcbdaf1b78b..8dc04936d9a61955c23e9fcd1605019d52862f52 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "AliRsnPairParticle.h"
 
-ClassImp (AliRsnPairParticle)
+ClassImp(AliRsnPairParticle)
 
 //_____________________________________________________________________________
 AliRsnPairParticle::AliRsnPairParticle()
@@ -38,26 +38,29 @@ AliRsnPairParticle::AliRsnPairParticle()
 // Initializes all variables to meaningless values.
 //
 
-    Int_t i, j;
-
-    for (i = 0; i < 3; i++) {
-        fPTot[i] = 0.0;
-        fPTotMC[i] = 0.0;
-        if (i < 2) {
-            fMotherLabel[i] = -1;
-            fMotherPDG[i] = 0;
-            fDaughter[i] = 0x0;
-        }
-        for (j = 0; j < 2; j++) {
-            fPTrack[j][i] = 0.0;
-            fPTrackMC[j][i] = 0.0;
-        }
+  Int_t i, j;
+
+  for (i = 0; i < 3; i++)
+  {
+    fPTot[i] = 0.0;
+    fPTotMC[i] = 0.0;
+    if (i < 2)
+    {
+      fMotherLabel[i] = -1;
+      fMotherPDG[i] = 0;
+      fDaughter[i] = 0x0;
     }
+    for (j = 0; j < 2; j++)
+    {
+      fPTrack[j][i] = 0.0;
+      fPTrackMC[j][i] = 0.0;
+    }
+  }
 }
 
 //_____________________________________________________________________________
 AliRsnPairParticle::AliRsnPairParticle(const AliRsnPairParticle &obj) :
-  TObject(obj)
+    TObject(obj)
 {
 //
 // Copy constructor.
@@ -65,20 +68,23 @@ AliRsnPairParticle::AliRsnPairParticle(const AliRsnPairParticle &obj) :
 // Does not duplicate pointers.
 //
 
-    Int_t i, j;
-    for (i = 0; i < 3; i++) {
-        fPTot[i] = obj.fPTot[i];
-        fPTotMC[i] = obj.fPTotMC[i];
-        if (i < 2) {
-            fMotherLabel[i] = obj.fMotherLabel[i];
-            fMotherPDG[i] = obj.fMotherPDG[i];
-            fDaughter[i] = obj.fDaughter[i];
-        }
-        for (j = 0; j < 2; j++) {
-            fPTrack[j][i] = obj.fPTrack[j][i];
-            fPTrackMC[j][i] = obj.fPTrackMC[j][i];
-        }
+  Int_t i, j;
+  for (i = 0; i < 3; i++)
+  {
+    fPTot[i] = obj.fPTot[i];
+    fPTotMC[i] = obj.fPTotMC[i];
+    if (i < 2)
+    {
+      fMotherLabel[i] = obj.fMotherLabel[i];
+      fMotherPDG[i] = obj.fMotherPDG[i];
+      fDaughter[i] = obj.fDaughter[i];
+    }
+    for (j = 0; j < 2; j++)
+    {
+      fPTrack[j][i] = obj.fPTrack[j][i];
+      fPTrackMC[j][i] = obj.fPTrackMC[j][i];
     }
+  }
 }
 
 //_____________________________________________________________________________
@@ -90,22 +96,25 @@ AliRsnPairParticle& AliRsnPairParticle::operator=(const AliRsnPairParticle &obj)
 // Does not duplicate pointers.
 //
 
-    Int_t i, j;
-    for (i = 0; i < 3; i++) {
-        fPTot[i] = obj.fPTot[i];
-        fPTotMC[i] = obj.fPTotMC[i];
-        if (i < 2) {
-            fMotherLabel[i] = obj.fMotherLabel[i];
-            fMotherPDG[i] = obj.fMotherPDG[i];
-            fDaughter[i] = obj.fDaughter[i];
-        }
-        for (j = 0; j < 2; j++) {
-            fPTrack[j][i] = obj.fPTrack[j][i];
-            fPTrackMC[j][i] = obj.fPTrackMC[j][i];
-        }
+  Int_t i, j;
+  for (i = 0; i < 3; i++)
+  {
+    fPTot[i] = obj.fPTot[i];
+    fPTotMC[i] = obj.fPTotMC[i];
+    if (i < 2)
+    {
+      fMotherLabel[i] = obj.fMotherLabel[i];
+      fMotherPDG[i] = obj.fMotherPDG[i];
+      fDaughter[i] = obj.fDaughter[i];
+    }
+    for (j = 0; j < 2; j++)
+    {
+      fPTrack[j][i] = obj.fPTrack[j][i];
+      fPTrackMC[j][i] = obj.fPTrackMC[j][i];
     }
+  }
 
-    return (*this);
+  return (*this);
 }
 
 //_____________________________________________________________________________
@@ -128,18 +137,19 @@ Double_t AliRsnPairParticle::GetInvMass(Double_t mass0, Double_t mass1)
 // and the sum of their energies as they result from assigned masses.
 //
 
-    if (!fDaughter[0] || !fDaughter[1]) {
-        AliError("One of the two tracks is NULL in this pair!");
-        return -1000.0;
-    }
+  if (!fDaughter[0] || !fDaughter[1])
+  {
+    AliError("One of the two tracks is NULL in this pair!");
+    return -1000.0;
+  }
 
-    // compute track energies using the shortcut method defined in AliRsnDaughter
-    Double_t etot = 0.0;
-    etot += fDaughter[0]->E(mass0);
-    etot += fDaughter[1]->E(mass1);
+  // compute track energies using the shortcut method defined in AliRsnDaughter
+  Double_t etot = 0.0;
+  etot += fDaughter[0]->E(mass0);
+  etot += fDaughter[1]->E(mass1);
 
-    // compute & return invariant mass
-    return  TMath::Sqrt (etot * etot - GetP2());
+  // compute & return invariant mass
+  return  TMath::Sqrt(etot * etot - GetP2());
 }
 
 //_____________________________________________________________________________
@@ -153,22 +163,52 @@ Double_t AliRsnPairParticle::GetInvMassMC(Double_t mass0, Double_t mass1)
 // and the sum of their energies as they result from assigned masses.
 //
 
-    if (!fDaughter[0] || !fDaughter[1]) {
-        AliError("One of the two tracks is NULL in this pair!");
-        return -1000.0;
-    }
-    if (!fDaughter[0]->GetMCInfo() || !fDaughter[1]->GetMCInfo()) {
-        AliError("One of the two tracks has a NULL MCInfo in this pair!");
-        return -1000.0;
-    }
+  if (!fDaughter[0] || !fDaughter[1])
+  {
+    AliError("One of the two tracks is NULL in this pair!");
+    return -1000.0;
+  }
+  if (!fDaughter[0]->GetMCInfo() || !fDaughter[1]->GetMCInfo())
+  {
+    AliError("One of the two tracks has a NULL MCInfo in this pair!");
+    return -1000.0;
+  }
+
+  // compute track energies using the shortcut method defined in AliRsnDaughter
+  Double_t etot = 0.0;
+  etot += fDaughter[0]->GetMCInfo()->E(mass0);
+  etot += fDaughter[1]->GetMCInfo()->E(mass1);
+
+  // compute & return invariant mass
+  return  TMath::Sqrt(etot * etot - GetP2());
+}
+
+//_____________________________________________________________________________
+Double_t AliRsnPairParticle::GetEtot(Double_t mass0, Double_t mass1) const
+{
+//
+// Compute total pair energy from the sum of single track energies
+// with a necessary mass hypothesis (rec. values).
+//
+    Double_t etot = 0.0;
+    etot += fDaughter[0]->E(mass0);
+    etot += fDaughter[1]->E(mass1);
+    
+    return etot;
+}
 
-    // compute track energies using the shortcut method defined in AliRsnDaughter
+//_____________________________________________________________________________
+Double_t AliRsnPairParticle::GetEtotMC(Double_t mass0, Double_t mass1) const
+{
+//
+// Compute total pair energy from the sum of single track energies
+// with a necessary mass hypothesis (MC values).
+//
     Double_t etot = 0.0;
     etot += fDaughter[0]->GetMCInfo()->E(mass0);
     etot += fDaughter[1]->GetMCInfo()->E(mass1);
-
-    // compute & return invariant mass
-    return  TMath::Sqrt (etot * etot - GetP2());
+    
+    return etot;
 }
 
 //_____________________________________________________________________________
@@ -179,14 +219,14 @@ Double_t AliRsnPairParticle::GetAngle() const
 // Return value is in DEGREES.
 //
 
-    Double_t dotProd = 0.0;
-    dotProd += fDaughter[0]->Px() * fDaughter[1]->Px();
-    dotProd += fDaughter[0]->Py() * fDaughter[1]->Pz();
-    dotProd += fDaughter[0]->Pz() * fDaughter[1]->Pz();
-    
-    Double_t cosAngle = dotProd / (fDaughter[0]->P() * fDaughter[1]->P());
-    
-    return TMath::ACos(cosAngle) * TMath::RadToDeg();
+  Double_t dotProd = 0.0;
+  dotProd += fDaughter[0]->Px() * fDaughter[1]->Px();
+  dotProd += fDaughter[0]->Py() * fDaughter[1]->Pz();
+  dotProd += fDaughter[0]->Pz() * fDaughter[1]->Pz();
+
+  Double_t cosAngle = dotProd / (fDaughter[0]->P() * fDaughter[1]->P());
+
+  return TMath::ACos(cosAngle) * TMath::RadToDeg();
 }
 
 //_____________________________________________________________________________
@@ -201,21 +241,24 @@ Bool_t AliRsnPairParticle::IsTruePair(Int_t refPDG)
 // if the mother is the same and its PDG code is equal to the argument.
 //
 
-    // if MC info is not available, the pairs is not true by default
-    if (!fDaughter[0]->GetMCInfo() || !fDaughter[1]->GetMCInfo()) {
-        return kFALSE;
-    }
-
-    // check that labels are the same
-    if (fDaughter[0]->GetMCInfo()->Mother() != fDaughter[1]->GetMCInfo()->Mother()) {
-        return kFALSE;
-    }
-
-    // if we reach this point, the two tracks have the same mother
-    // let's check now the PDG code of this common mother
-    Int_t motherPDG = TMath::Abs(fDaughter[0]->GetMCInfo()->MotherPDG());
-    if (refPDG == 0) return kTRUE;
-    else return (motherPDG == refPDG);
+  // if MC info is not available, the pairs is not true by default
+  if (!fDaughter[0]->GetMCInfo() || !fDaughter[1]->GetMCInfo())
+  {
+    AliInfo("Cannot know if the pairs is true or not because MC Info is not present");
+    return kFALSE;
+  }
+
+  // check that labels are the same
+  if (fDaughter[0]->GetMCInfo()->Mother() != fDaughter[1]->GetMCInfo()->Mother())
+  {
+    return kFALSE;
+  }
+
+  // if we reach this point, the two tracks have the same mother
+  // let's check now the PDG code of this common mother
+  Int_t motherPDG = TMath::Abs(fDaughter[0]->GetMCInfo()->MotherPDG());
+  if (refPDG == 0) return kTRUE;
+  else return (motherPDG == refPDG);
 }
 
 //_____________________________________________________________________________
@@ -227,43 +270,46 @@ void AliRsnPairParticle::SetPair(AliRsnDaughter *daughter1, AliRsnDaughter *daug
 // and computes the total momentum for REC data and MC if available
 //
 
-    Int_t i;
+  Int_t i;
 
-    fDaughter[0] = daughter1;
-    fDaughter[1] = daughter2;
-
-    // copy MC info (if available)
-    if (fDaughter[0]->GetMCInfo() && fDaughter[1]->GetMCInfo()) {
-        for (i = 0; i < 2; i++) {
-            fPTrackMC[i][0] = fDaughter[i]->GetMCInfo()->Px();
-            fPTrackMC[i][1] = fDaughter[i]->GetMCInfo()->Py();
-            fPTrackMC[i][2] = fDaughter[i]->GetMCInfo()->Pz();
-            fMotherPDG[i] = fDaughter[i]->GetMCInfo()->MotherPDG();
-        }
-        for (i = 0; i < 3; i++) fPTotMC[i] = fPTrackMC[0][i] + fPTrackMC[1][i];
-    }
+  fDaughter[0] = daughter1;
+  fDaughter[1] = daughter2;
 
-    // copy reconstructed info (always available)
-    for (i = 0; i < 2; i++) {
-        fPTrack[i][0] = fDaughter[i]->Px();
-        fPTrack[i][1] = fDaughter[i]->Py();
-        fPTrack[i][2] = fDaughter[i]->Pz();
+  // copy MC info (if available)
+  if (fDaughter[0]->GetMCInfo() && fDaughter[1]->GetMCInfo())
+  {
+    for (i = 0; i < 2; i++)
+    {
+      fPTrackMC[i][0] = fDaughter[i]->GetMCInfo()->Px();
+      fPTrackMC[i][1] = fDaughter[i]->GetMCInfo()->Py();
+      fPTrackMC[i][2] = fDaughter[i]->GetMCInfo()->Pz();
+      fMotherPDG[i] = fDaughter[i]->GetMCInfo()->MotherPDG();
     }
-    for (i = 0; i < 3; i++) fPTot[i] = fPTrack[0][i] + fPTrack[1][i];
+    for (i = 0; i < 3; i++) fPTotMC[i] = fPTrackMC[0][i] + fPTrackMC[1][i];
+  }
+
+  // copy reconstructed info (always available)
+  for (i = 0; i < 2; i++)
+  {
+    fPTrack[i][0] = fDaughter[i]->Px();
+    fPTrack[i][1] = fDaughter[i]->Py();
+    fPTrack[i][2] = fDaughter[i]->Pz();
+  }
+  for (i = 0; i < 3; i++) fPTot[i] = fPTrack[0][i] + fPTrack[1][i];
 }
 
 //_____________________________________________________________________________
-void AliRsnPairParticle::PrintInfo (const Option_t *option)
+void AliRsnPairParticle::PrintInfo(const Option_t *option)
 {
 //
-// Print some info of the pair. 
+// Print some info of the pair.
 // The options are passed to the AliRsnDaughter::Print() method
 //
 
-    AliInfo("======== BEGIN PAIR INFO ===========");
-    AliInfo("Track #1");
-    fDaughter[0]->Print(option);
-    AliInfo("Track #2");
-    fDaughter[1]->Print(option);
-    AliInfo ("========= END PAIR INFO ===========");
+  AliInfo("======== BEGIN PAIR INFO ===========");
+  AliInfo("Track #1");
+  fDaughter[0]->Print(option);
+  AliInfo("Track #2");
+  fDaughter[1]->Print(option);
+  AliInfo("========= END PAIR INFO ===========");
 }