]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/RESONANCES/AliRsnValue.cxx
Removed old ME classes, since the nex event mixing has been introduced and is integra...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnValue.cxx
index 67bdba33afcf416fadb119b24d5940226e9978f4..82bf6d984c44758a3c04feea3ccee585bdfc41d3 100644 (file)
@@ -20,30 +20,30 @@ ClassImp(AliRsnValue)
 
 //_____________________________________________________________________________
 AliRsnValue::AliRsnValue() :
-  AliRsnTarget(),
-  fComputedValue(0),
-  fValueType(kValueTypes),
-  fBinArray(0),
-  fSupportObject(0x0)
+   AliRsnTarget(),
+   fComputedValue(0),
+   fValueType(kValueTypes),
+   fBinArray(0),
+   fSupportObject(0x0)
 {
 //
 // Default constructor without arguments.
 // Initialize data members to meaningless values.
-// This method is provided for ROOT streaming, 
+// This method is provided for ROOT streaming,
 // but should never be used directly by a user.
 //
 
-  AssignTarget();
+   AssignTarget();
 }
 
 //_____________________________________________________________________________
 AliRsnValue::AliRsnValue
 (const char *name, EValueType type, Int_t nbins, Double_t min, Double_t max) :
-  AliRsnTarget(name, AliRsnTarget::kTargetTypes),
-  fComputedValue(0.0),
-  fValueType(type),
-  fBinArray(0),
-  fSupportObject(0x0)
+   AliRsnTarget(name, AliRsnTarget::kTargetTypes),
+   fComputedValue(0.0),
+   fValueType(type),
+   fBinArray(0),
+   fSupportObject(0x0)
 {
 //
 // Main constructor (version 1).
@@ -57,18 +57,18 @@ AliRsnValue::AliRsnValue
 // binning array, in order not to allocate memory when this is useless.
 //
 
-  AssignTarget();
-  SetBins(nbins, min, max);
+   AssignTarget();
+   SetBins(nbins, min, max);
 }
 
 //_____________________________________________________________________________
 AliRsnValue::AliRsnValue
 (const char *name, EValueType type, Double_t min, Double_t max, Double_t step) :
-  AliRsnTarget(name, AliRsnTarget::kTargetTypes),
-  fComputedValue(0.0),
-  fValueType(type),
-  fBinArray(0),
-  fSupportObject(0x0)
+   AliRsnTarget(name, AliRsnTarget::kTargetTypes),
+   fComputedValue(0.0),
+   fValueType(type),
+   fBinArray(0),
+   fSupportObject(0x0)
 {
 //
 // Main constructor (version 2).
@@ -77,18 +77,18 @@ AliRsnValue::AliRsnValue
 // the required interval.
 //
 
-  AssignTarget();
-  SetBins(min, max, step);
+   AssignTarget();
+   SetBins(min, max, step);
 }
 
 //_____________________________________________________________________________
 AliRsnValue::AliRsnValue
 (const char *name, EValueType type, Int_t nbins, Double_t *array) :
-  AliRsnTarget(name, AliRsnTarget::kTargetTypes),
-  fComputedValue(0.0),
-  fValueType(type),
-  fBinArray(0),
-  fSupportObject(0x0)
+   AliRsnTarget(name, AliRsnTarget::kTargetTypes),
+   fComputedValue(0.0),
+   fValueType(type),
+   fBinArray(0),
+   fSupportObject(0x0)
 {
 //
 // Main constructor (version 3).
@@ -96,26 +96,26 @@ AliRsnValue::AliRsnValue
 // and creates a set of variable bins delimited by the passed array.
 //
 
-  AssignTarget();
-  SetBins(nbins, array);
+   AssignTarget();
+   SetBins(nbins, array);
 }
 
 //_____________________________________________________________________________
-AliRsnValue::AliRsnValue(const AliRsnValue& copy) : 
-  AliRsnTarget(copy),
-  fComputedValue(copy.fComputedValue),
-  fValueType(copy.fValueType),
-  fBinArray(copy.fBinArray),
-  fSupportObject(copy.fSupportObject)
+AliRsnValue::AliRsnValue(const AliRsnValue& copy) :
+   AliRsnTarget(copy),
+   fComputedValue(copy.fComputedValue),
+   fValueType(copy.fValueType),
+   fBinArray(copy.fBinArray),
+   fSupportObject(copy.fSupportObject)
 {
 //
 // Copy constructor.
 // Duplicates the binning array and copies all settings.
-// Calls also the function that assigns properly the 
+// Calls also the function that assigns properly the
 // expected target, depending on the computation type.
 //
 
-  AssignTarget();
+   AssignTarget();
 }
 
 //_____________________________________________________________________________
@@ -126,15 +126,15 @@ AliRsnValue& AliRsnValue::operator=(const AliRsnValue& copy)
 // Works like copy constructor.
 //
 
-  AliRsnTarget::operator=(copy);
-  
-  fComputedValue = copy.fComputedValue;
-  fBinArray = copy.fBinArray;
-  fSupportObject = copy.fSupportObject;
-  
-  AssignTarget();
-  
-  return (*this);
+   AliRsnTarget::operator=(copy);
+
+   fComputedValue = copy.fComputedValue;
+   fBinArray = copy.fBinArray;
+   fSupportObject = copy.fSupportObject;
+
+   AssignTarget();
+
+   return (*this);
 }
 
 //_____________________________________________________________________________
@@ -145,22 +145,21 @@ void AliRsnValue::SetBins(Int_t nbins, Double_t min, Double_t max)
 // where the number of bins, minimum and maximum are given.
 //
 
-  if (!nbins)
-  {
-    fBinArray.Set(0);
-    return;
-  }
-
-  fBinArray.Set(nbins + 1);
-  
-  Double_t mymax = TMath::Max(min, max);
-  Double_t mymin = TMath::Min(min, max);
-  
-  Int_t    k = 0;
-  Double_t binSize = (mymax - mymin) / ((Double_t)nbins);
-  
-  fBinArray[0] = mymin;
-  for (k = 1; k <= nbins; k++) fBinArray[k] = fBinArray[k-1] + binSize;
+   if (!nbins) {
+      fBinArray.Set(0);
+      return;
+   }
+
+   fBinArray.Set(nbins + 1);
+
+   Double_t mymax = TMath::Max(min, max);
+   Double_t mymin = TMath::Min(min, max);
+
+   Int_t    k = 0;
+   Double_t binSize = (mymax - mymin) / ((Double_t)nbins);
+
+   fBinArray[0] = mymin;
+   for (k = 1; k <= nbins; k++) fBinArray[k] = fBinArray[k - 1] + binSize;
 }
 
 //_____________________________________________________________________________
@@ -171,10 +170,10 @@ void AliRsnValue::SetBins(Double_t min, Double_t max, Double_t step)
 // where the bin size, minimum and maximum are given.
 //
 
-  Double_t dblNbins = TMath::Abs(max - min) / step;
-  Int_t    intNbins = ((Int_t)dblNbins) + 1;
-  
-  SetBins(intNbins, min, max);
+   Double_t dblNbins = TMath::Abs(max - min) / step;
+   Int_t    intNbins = ((Int_t)dblNbins) + 1;
+
+   SetBins(intNbins, min, max);
 }
 
 //_____________________________________________________________________________
@@ -185,13 +184,12 @@ void AliRsnValue::SetBins(Int_t nbins, Double_t *array)
 // using the same way it is done in TAxis
 //
 
-  if (!nbins)
-  {
-    fBinArray.Set(0);
-    return;
-  }
-  
-  fBinArray.Adopt(nbins, array);
+   if (!nbins) {
+      fBinArray.Set(0);
+      return;
+   }
+
+   fBinArray.Adopt(nbins, array);
 }
 
 //_____________________________________________________________________________
@@ -201,39 +199,38 @@ const char* AliRsnValue::GetValueTypeName() const
 // This method returns a string to give a name to each possible
 // computation value.
 //
-  
-  switch (fValueType)
-  {
-    case kTrackP:             return "SingleTrackPtot";
-    case kTrackPt:            return "SingleTrackPt";
-    case kTrackEta:           return "SingleTrackEta";
-    case kPairP1:             return "PairPtotDaughter1";
-    case kPairP2:             return "PairPtotDaughter2";
-    case kPairP1t:            return "PairPtDaughter1";
-    case kPairP2t:            return "PairPtDaughter2";
-    case kPairP1z:            return "PairPzDaughter1";
-    case kPairP2z:            return "PairPzDaughter2";
-    case kPairInvMass:        return "PairInvMass";
-    case kPairInvMassMC:      return "PairInvMassMC";
-    case kPairInvMassRes:     return "PairInvMassResolution";
-    case kPairPt:             return "PairPt";
-    case kPairPz:             return "PairPz";
-    case kPairEta:            return "PairEta";
-    case kPairMt:             return "PairMt";
-    case kPairY:              return "PairY";
-    case kPairPhi:            return "PairPhi";
-    case kPairPhiMC:          return "PairPhiMC";
-    case kPairPtRatio:        return "PairPtRatio";
-    case kPairDipAngle:       return "PairDipAngle";
-    case kPairCosThetaStar:   return "PairCosThetaStar";
-    case kPairQInv:           return "PairQInv";
-    case kPairAngleToLeading: return "PairAngleToLeading";
-    case kEventLeadingPt:     return "EventLeadingPt";
-    case kEventMult:          return "EventMult";
-    case kEventMultESDCuts:   return "EventMultESDCuts";
-    case kEventVz:            return "EventVz";
-    default:                  return "Undefined";
-  }
+
+   switch (fValueType) {
+      case kTrackP:             return "SingleTrackPtot";
+      case kTrackPt:            return "SingleTrackPt";
+      case kTrackEta:           return "SingleTrackEta";
+      case kPairP1:             return "PairPtotDaughter1";
+      case kPairP2:             return "PairPtotDaughter2";
+      case kPairP1t:            return "PairPtDaughter1";
+      case kPairP2t:            return "PairPtDaughter2";
+      case kPairP1z:            return "PairPzDaughter1";
+      case kPairP2z:            return "PairPzDaughter2";
+      case kPairInvMass:        return "PairInvMass";
+      case kPairInvMassMC:      return "PairInvMassMC";
+      case kPairInvMassRes:     return "PairInvMassResolution";
+      case kPairPt:             return "PairPt";
+      case kPairPz:             return "PairPz";
+      case kPairEta:            return "PairEta";
+      case kPairMt:             return "PairMt";
+      case kPairY:              return "PairY";
+      case kPairPhi:            return "PairPhi";
+      case kPairPhiMC:          return "PairPhiMC";
+      case kPairPtRatio:        return "PairPtRatio";
+      case kPairDipAngle:       return "PairDipAngle";
+      case kPairCosThetaStar:   return "PairCosThetaStar";
+      case kPairQInv:           return "PairQInv";
+      case kPairAngleToLeading: return "PairAngleToLeading";
+      case kEventLeadingPt:     return "EventLeadingPt";
+      case kEventMult:          return "EventMult";
+      case kEventMultESDCuts:   return "EventMultESDCuts";
+      case kEventVz:            return "EventVz";
+      default:                  return "Undefined";
+   }
 }
 
 //_____________________________________________________________________________
@@ -243,50 +240,49 @@ void AliRsnValue::AssignTarget()
 // This method assigns the target to be expected by this object
 // in the computation, depending on its type chosen in the enum.
 //
-  
-  switch (fValueType)
-  {
-    // track related values
-    case kTrackP:
-    case kTrackPt:
-    case kTrackEta:
-      SetTargetType(AliRsnTarget::kDaughter); // end of track-related values
-      break;
-    // pair related values
-    case kPairP1:
-    case kPairP2:
-    case kPairP1t:
-    case kPairP2t:
-    case kPairP1z:
-    case kPairP2z:
-    case kPairInvMass:
-    case kPairInvMassMC:
-    case kPairInvMassRes:
-    case kPairPt:
-    case kPairPz:
-    case kPairEta:
-    case kPairMt:
-    case kPairY:
-    case kPairPhi:
-    case kPairPhiMC:
-    case kPairPtRatio:
-    case kPairDipAngle:
-    case kPairCosThetaStar:
-    case kPairQInv:
-    case kPairAngleToLeading:
-      SetTargetType(AliRsnTarget::kMother); // end of pair-related values
-      break;
-    // event related values
-    case kEventLeadingPt:
-    case kEventMult:
-    case kEventMultESDCuts:
-    case kEventVz:
-      SetTargetType(AliRsnTarget::kEvent); // end of event-related values
-      break;
-    // undefined value
-    default:
-      SetTargetType(AliRsnTarget::kTargetTypes); // undefined targets
-  }
+
+   switch (fValueType) {
+         // track related values
+      case kTrackP:
+      case kTrackPt:
+      case kTrackEta:
+         SetTargetType(AliRsnTarget::kDaughter); // end of track-related values
+         break;
+         // pair related values
+      case kPairP1:
+      case kPairP2:
+      case kPairP1t:
+      case kPairP2t:
+      case kPairP1z:
+      case kPairP2z:
+      case kPairInvMass:
+      case kPairInvMassMC:
+      case kPairInvMassRes:
+      case kPairPt:
+      case kPairPz:
+      case kPairEta:
+      case kPairMt:
+      case kPairY:
+      case kPairPhi:
+      case kPairPhiMC:
+      case kPairPtRatio:
+      case kPairDipAngle:
+      case kPairCosThetaStar:
+      case kPairQInv:
+      case kPairAngleToLeading:
+         SetTargetType(AliRsnTarget::kMother); // end of pair-related values
+         break;
+         // event related values
+      case kEventLeadingPt:
+      case kEventMult:
+      case kEventMultESDCuts:
+      case kEventVz:
+         SetTargetType(AliRsnTarget::kEvent); // end of event-related values
+         break;
+         // undefined value
+      default:
+         SetTargetType(AliRsnTarget::kTargetTypes); // undefined targets
+   }
 }
 
 //_____________________________________________________________________________
@@ -300,217 +296,194 @@ Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC)
 // and the values must be taken with GetValue().
 //
 
-  // cast the input to the allowed types
-  AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(object);
-  AliRsnMother   *mother   = dynamic_cast<AliRsnMother*>(object);
-  
-  // common variables
-  TLorentzVector pRec;   // 4-momentum for single track or pair sum (reco)
-  TLorentzVector pSim;   // 4-momentum for single track or pair sum (MC)
-  TLorentzVector pRec0;  // 4-momentum of first daughter (reco)
-  TLorentzVector pSim0;  // 4-momentum of first daughter (MC)
-  TLorentzVector pRec1;  // 4-momentum of second daughter (reco)
-  TLorentzVector pSim1;  // 4-momentum of second daughter (MC)
-  
-  // check that the input object is the correct class type
-  switch (fTargetType)
-  {
-    case AliRsnTarget::kDaughter:
-      if (daughter)
-      {
-        pRec = daughter->Psim();
-        pSim = daughter->Prec();
-      }
-      else
-      {
-        AliError(Form("[%s] expected: AliRsnDaughter, passed: [%s]", GetName(), object->ClassName()));
-        return kFALSE;
-      }
-      break;
-    case AliRsnTarget::kMother:
-      if (mother)
-      {
-        pRec  = mother->Sum();
-        pSim  = mother->SumMC();
-        pRec0 = mother->GetDaughter(0)->Prec();
-        pRec1 = mother->GetDaughter(1)->Prec();
-        pSim0 = mother->GetDaughter(0)->Psim();
-        pSim1 = mother->GetDaughter(1)->Psim();
-      }
-      else
-      {
-        AliError(Form("[%s] expected: AliRsnMother, passed: [%s]", GetName(), object->ClassName()));
-        return kFALSE;
-      }
-      break;
-    case AliRsnTarget::kEvent:
-      if (!AliRsnTarget::GetCurrentEvent())
-      {
-        AliError(Form("[%s] expected: AliRsnEvent, passed: [%s]", GetName(), object->ClassName()));
-        return kFALSE;
-      }
-      break;
-    default:
-      AliError(Form("[%s] Wrong type", GetName()));
-      return kFALSE;
-  }
-
-  // cast the support object to the types which could be needed
-  AliESDtrackCuts *esdCuts = dynamic_cast<AliESDtrackCuts*>(fSupportObject);
-  AliRsnPairDef   *pairDef = dynamic_cast<AliRsnPairDef*>(fSupportObject);
-    
-  // compute value depending on type
-  switch (fValueType)
-  {
-    case kTrackP:
-      fComputedValue = useMC ? pSim.Mag() : pRec.Mag();
-      break;
-    case kTrackPt:
-      fComputedValue = useMC ? pSim.Perp() : pRec.Perp();
-      break;
-    case kTrackEta:
-      fComputedValue = useMC ? pSim.Eta() : pRec.Eta();
-      break;
-    case kPairP1:
-      fComputedValue = useMC ? pSim0.Mag() : pRec0.Mag();
-      break;
-    case kPairP2:
-      fComputedValue = useMC ? pSim1.Mag() : pRec1.Mag();
-      break;
-    case kPairP1t:
-      fComputedValue = useMC ? pSim0.Perp() : pRec0.Perp();
-      break;
-    case kPairP2t:
-      fComputedValue = useMC ? pSim1.Perp() : pRec1.Perp();
-      break;
-    case kPairP1z:
-      fComputedValue = useMC ? pSim0.Z() : pRec0.Z();
-      break;
-    case kPairP2z:
-      fComputedValue = useMC ? pSim1.Z() : pRec1.Z();
-      break;
-    case kPairInvMass:
-      fComputedValue = useMC ? pSim.M() : pRec.M();
-      break;
-    case kPairInvMassRes:
-      fComputedValue = (pSim.M() - pRec.M()) / pSim.M();
-      break;
-    case kPairPt:
-      fComputedValue = useMC ? pSim.Perp() : pRec.Perp();
-      break;
-    case kPairEta:
-      fComputedValue = useMC ? pSim.Eta() : pRec.Eta();
-      break;
-    case kPairMt:
-      // for this computation, replace the computed mass with the default mass
-      // for doing this, an initialized pairDef is required to get the mass
-      if (!pairDef)
-      {
-        AliError(Form("[%s] Required a correctly initialized PairDef to compute this value", GetName()));
-        fComputedValue = 1E+10;
-        return kFALSE;
-      }
-      else
-      {
-        pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass());
-        pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass());
-        fComputedValue = useMC ? pSim.Mt() : pRec.Mt();
-      }
-      break;
-    case kPairY:
-      // for this computation, replace the computed mass with the default mass
-      // for doing this, an initialized pairDef is required to get the mass
-      if (!pairDef)
-      {
-        AliError(Form("[%s] Required a correctly initialized PairDef to compute this value", GetName()));
-        fComputedValue = 1E+10;
-        return kFALSE;
-      }
-      else
-      {
-        pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass());
-        pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass());
-        fComputedValue = useMC ? pSim.Rapidity() : pRec.Rapidity();
-      }
-      break;
-    case kPairPhi:
-      fComputedValue = useMC ? pSim.Phi() : pRec.Phi();
-      break;
-    case kPairPtRatio:
-      if (useMC)
-      {
-        fComputedValue  = TMath::Abs(pSim0.Perp() - pSim1.Perp());
-        fComputedValue /= TMath::Abs(pSim0.Perp() + pSim1.Perp());
-      }
-      else
-      {
-        fComputedValue  = TMath::Abs(pRec0.Perp() - pRec1.Perp());
-        fComputedValue /= TMath::Abs(pRec0.Perp() + pRec1.Perp());
-      }
-      break;
-    case kPairDipAngle:
-      fComputedValue = useMC ? pSim0.Angle(pSim1.Vect()) : pRec0.Angle(pRec1.Vect());
-      fComputedValue = TMath::Abs(TMath::Cos(fComputedValue));
-      break;
-    case kPairCosThetaStar:
-      fComputedValue = mother->CosThetaStar(useMC);
-      break;
-    case kPairQInv:
-      pSim0 -= pSim1;
-      pRec0 -= pRec1;
-      fComputedValue = useMC ? pSim0.M() : pRec0.M();
-      break;
-    case kPairAngleToLeading:
-      {
-        AliRsnEvent *event = AliRsnTarget::GetCurrentEvent();
-         int ID1 = (mother->GetDaughter(0))->GetID();
-         int ID2 = (mother->GetDaughter(1))->GetID();
-         //int leadingID = event->SelectLeadingParticle(0);
-        Int_t leadingID = event->GetLeadingParticleID();
-         if (leadingID == ID1 || leadingID == ID2) return kFALSE;
-         AliRsnDaughter leadingPart = event->GetDaughter(leadingID);
-         AliVParticle  *ref = leadingPart.GetRef();
-         fComputedValue = ref->Phi() - mother->Sum().Phi();
-         //return angle w.r.t. leading particle in the range -pi/2, 3/2pi
-         while(fComputedValue >= TMath::Pi()) fComputedValue -= 2*TMath::Pi();
-         while(fComputedValue < -0.5*TMath::Pi()) fComputedValue += 2*TMath::Pi();
-         //Printf("%g", fComputedValue);
-      }
-      break;
-    case kEventMult:
-      fComputedValue = (Double_t)AliRsnTarget::GetCurrentEvent()->GetMultiplicity(0x0);
-      break;
-    case kEventMultESDCuts:
-      // this value requires an initialized ESDtrackCuts
-      if (!esdCuts)
-      {
-        AliError(Form("[%s] Required a correctly initialized ESDtrackCuts to compute this value", GetName()));
-        fComputedValue = 1E+10;
-        return kFALSE;
+   // cast the input to the allowed types
+   AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(object);
+   AliRsnMother   *mother   = dynamic_cast<AliRsnMother*>(object);
+
+   // common variables
+   TLorentzVector pRec;   // 4-momentum for single track or pair sum (reco)
+   TLorentzVector pSim;   // 4-momentum for single track or pair sum (MC)
+   TLorentzVector pRec0;  // 4-momentum of first daughter (reco)
+   TLorentzVector pSim0;  // 4-momentum of first daughter (MC)
+   TLorentzVector pRec1;  // 4-momentum of second daughter (reco)
+   TLorentzVector pSim1;  // 4-momentum of second daughter (MC)
+
+   // check that the input object is the correct class type
+   switch (fTargetType) {
+      case AliRsnTarget::kDaughter:
+         if (daughter) {
+            pRec = daughter->Psim();
+            pSim = daughter->Prec();
+         } else {
+            AliError(Form("[%s] expected: AliRsnDaughter, passed: [%s]", GetName(), object->ClassName()));
+            return kFALSE;
+         }
+         break;
+      case AliRsnTarget::kMother:
+         if (mother) {
+            pRec  = mother->Sum();
+            pSim  = mother->SumMC();
+            pRec0 = mother->GetDaughter(0)->Prec();
+            pRec1 = mother->GetDaughter(1)->Prec();
+            pSim0 = mother->GetDaughter(0)->Psim();
+            pSim1 = mother->GetDaughter(1)->Psim();
+         } else {
+            AliError(Form("[%s] expected: AliRsnMother, passed: [%s]", GetName(), object->ClassName()));
+            return kFALSE;
+         }
+         break;
+      case AliRsnTarget::kEvent:
+         if (!AliRsnTarget::GetCurrentEvent()) {
+            AliError(Form("[%s] expected: AliRsnEvent, passed: [%s]", GetName(), object->ClassName()));
+            return kFALSE;
+         }
+         break;
+      default:
+         AliError(Form("[%s] Wrong type", GetName()));
+         return kFALSE;
+   }
+
+   // cast the support object to the types which could be needed
+   AliESDtrackCuts *esdCuts = dynamic_cast<AliESDtrackCuts*>(fSupportObject);
+   AliRsnPairDef   *pairDef = dynamic_cast<AliRsnPairDef*>(fSupportObject);
+
+   // compute value depending on type
+   switch (fValueType) {
+      case kTrackP:
+         fComputedValue = useMC ? pSim.Mag() : pRec.Mag();
+         break;
+      case kTrackPt:
+         fComputedValue = useMC ? pSim.Perp() : pRec.Perp();
+         break;
+      case kTrackEta:
+         fComputedValue = useMC ? pSim.Eta() : pRec.Eta();
+         break;
+      case kPairP1:
+         fComputedValue = useMC ? pSim0.Mag() : pRec0.Mag();
+         break;
+      case kPairP2:
+         fComputedValue = useMC ? pSim1.Mag() : pRec1.Mag();
+         break;
+      case kPairP1t:
+         fComputedValue = useMC ? pSim0.Perp() : pRec0.Perp();
+         break;
+      case kPairP2t:
+         fComputedValue = useMC ? pSim1.Perp() : pRec1.Perp();
+         break;
+      case kPairP1z:
+         fComputedValue = useMC ? pSim0.Z() : pRec0.Z();
+         break;
+      case kPairP2z:
+         fComputedValue = useMC ? pSim1.Z() : pRec1.Z();
+         break;
+      case kPairInvMass:
+         fComputedValue = useMC ? pSim.M() : pRec.M();
+         break;
+      case kPairInvMassRes:
+         fComputedValue = (pSim.M() - pRec.M()) / pSim.M();
+         break;
+      case kPairPt:
+         fComputedValue = useMC ? pSim.Perp() : pRec.Perp();
+         break;
+      case kPairEta:
+         fComputedValue = useMC ? pSim.Eta() : pRec.Eta();
+         break;
+      case kPairMt:
+         // for this computation, replace the computed mass with the default mass
+         // for doing this, an initialized pairDef is required to get the mass
+         if (!pairDef) {
+            AliError(Form("[%s] Required a correctly initialized PairDef to compute this value", GetName()));
+            fComputedValue = 1E+10;
+            return kFALSE;
+         } else {
+            pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass());
+            pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass());
+            fComputedValue = useMC ? pSim.Mt() : pRec.Mt();
+         }
+         break;
+      case kPairY:
+         // for this computation, replace the computed mass with the default mass
+         // for doing this, an initialized pairDef is required to get the mass
+         if (!pairDef) {
+            AliError(Form("[%s] Required a correctly initialized PairDef to compute this value", GetName()));
+            fComputedValue = 1E+10;
+            return kFALSE;
+         } else {
+            pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass());
+            pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass());
+            fComputedValue = useMC ? pSim.Rapidity() : pRec.Rapidity();
+         }
+         break;
+      case kPairPhi:
+         fComputedValue = useMC ? pSim.Phi() : pRec.Phi();
+         break;
+      case kPairPtRatio:
+         if (useMC) {
+            fComputedValue  = TMath::Abs(pSim0.Perp() - pSim1.Perp());
+            fComputedValue /= TMath::Abs(pSim0.Perp() + pSim1.Perp());
+         } else {
+            fComputedValue  = TMath::Abs(pRec0.Perp() - pRec1.Perp());
+            fComputedValue /= TMath::Abs(pRec0.Perp() + pRec1.Perp());
+         }
+         break;
+      case kPairDipAngle:
+         fComputedValue = useMC ? pSim0.Angle(pSim1.Vect()) : pRec0.Angle(pRec1.Vect());
+         fComputedValue = TMath::Abs(TMath::Cos(fComputedValue));
+         break;
+      case kPairCosThetaStar:
+         fComputedValue = mother->CosThetaStar(useMC);
+         break;
+      case kPairQInv:
+         pSim0 -= pSim1;
+         pRec0 -= pRec1;
+         fComputedValue = useMC ? pSim0.M() : pRec0.M();
+         break;
+      case kPairAngleToLeading: {
+         AliRsnEvent *event = AliRsnTarget::GetCurrentEvent();
+         int ID1 = (mother->GetDaughter(0))->GetID();
+         int ID2 = (mother->GetDaughter(1))->GetID();
+         //int leadingID = event->SelectLeadingParticle(0);
+         Int_t leadingID = event->GetLeadingParticleID();
+         if (leadingID == ID1 || leadingID == ID2) return kFALSE;
+         AliRsnDaughter leadingPart = event->GetDaughter(leadingID);
+         AliVParticle  *ref = leadingPart.GetRef();
+         fComputedValue = ref->Phi() - mother->Sum().Phi();
+         //return angle w.r.t. leading particle in the range -pi/2, 3/2pi
+         while (fComputedValue >= TMath::Pi()) fComputedValue -= 2 * TMath::Pi();
+         while (fComputedValue < -0.5 * TMath::Pi()) fComputedValue += 2 * TMath::Pi();
+         //Printf("%g", fComputedValue);
       }
-      fComputedValue = (Double_t)AliRsnTarget::GetCurrentEvent()->GetMultiplicity(esdCuts);
       break;
-    case kEventLeadingPt:
-      {
-         int leadingID = AliRsnTarget::GetCurrentEvent()->GetLeadingParticleID(); //fEvent->SelectLeadingParticle(0);
-         if(leadingID >= 0) 
-        {
-                 AliRsnDaughter leadingPart = AliRsnTarget::GetCurrentEvent()->GetDaughter(leadingID);
-                 AliVParticle *ref = leadingPart.GetRef();
-                 fComputedValue = ref->Pt();
-         }
-         else fComputedValue = 0;
+      case kEventMult:
+         fComputedValue = (Double_t)AliRsnTarget::GetCurrentEvent()->GetMultiplicity(0x0);
+         break;
+      case kEventMultESDCuts:
+         // this value requires an initialized ESDtrackCuts
+         if (!esdCuts) {
+            AliError(Form("[%s] Required a correctly initialized ESDtrackCuts to compute this value", GetName()));
+            fComputedValue = 1E+10;
+            return kFALSE;
+         }
+         fComputedValue = (Double_t)AliRsnTarget::GetCurrentEvent()->GetMultiplicity(esdCuts);
+         break;
+      case kEventLeadingPt: {
+         int leadingID = AliRsnTarget::GetCurrentEvent()->GetLeadingParticleID(); //fEvent->SelectLeadingParticle(0);
+         if (leadingID >= 0) {
+            AliRsnDaughter leadingPart = AliRsnTarget::GetCurrentEvent()->GetDaughter(leadingID);
+            AliVParticle *ref = leadingPart.GetRef();
+            fComputedValue = ref->Pt();
+         } else fComputedValue = 0;
       }
       break;
-    case kEventVz:
-      fComputedValue = AliRsnTarget::GetCurrentEvent()->GetRef()->GetPrimaryVertex()->GetZ();
-      break;
-    default:
-      AliError(Form("[%s] Invalid value type for this computation", GetName()));
-      return kFALSE;
-  }
-  
-  return kTRUE;
+      case kEventVz:
+         fComputedValue = AliRsnTarget::GetCurrentEvent()->GetRef()->GetPrimaryVertex()->GetZ();
+         break;
+      default:
+         AliError(Form("[%s] Invalid value type for this computation", GetName()));
+         return kFALSE;
+   }
+
+   return kTRUE;
 }
 
 //_____________________________________________________________________________
@@ -520,15 +493,14 @@ void AliRsnValue::Print(Option_t * /*option */) const
 // Print informations about this object
 //
 
-  AliInfo("=== VALUE INFO =================================================");
-  AliInfo(Form(" Name                  : %s", GetName()));
-  AliInfo(Form(" Type                  : %s", GetValueTypeName()));
-  AliInfo(Form(" Current computed value: %f", fComputedValue));
-  Int_t i;
-  for (i = 0; i < fBinArray.GetSize(); i++)
-  {
-    AliInfo(Form(" Bin limit #%d         = %f", i, fBinArray[i]));
-  }
-  AliInfo(Form(" Support object        : %s", (fSupportObject ? fSupportObject->ClassName() : " NO SUPPORT")));
-  AliInfo("=== END VALUE INFO =============================================");
+   AliInfo("=== VALUE INFO =================================================");
+   AliInfo(Form(" Name                  : %s", GetName()));
+   AliInfo(Form(" Type                  : %s", GetValueTypeName()));
+   AliInfo(Form(" Current computed value: %f", fComputedValue));
+   Int_t i;
+   for (i = 0; i < fBinArray.GetSize(); i++) {
+      AliInfo(Form(" Bin limit #%d         = %f", i, fBinArray[i]));
+   }
+   AliInfo(Form(" Support object        : %s", (fSupportObject ? fSupportObject->ClassName() : " NO SUPPORT")));
+   AliInfo("=== END VALUE INFO =============================================");
 }