]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Solved some of the issues raised by coverity server.
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Jan 2011 12:22:41 +0000 (12:22 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Jan 2011 12:22:41 +0000 (12:22 +0000)
13 files changed:
PWG2/RESONANCES/AliRsnAnalysisManager.cxx
PWG2/RESONANCES/AliRsnCutBetheBloch.cxx
PWG2/RESONANCES/AliRsnCutDaughterType.cxx
PWG2/RESONANCES/AliRsnCutESDPrimary.cxx
PWG2/RESONANCES/AliRsnCutPID.cxx
PWG2/RESONANCES/AliRsnCutValue.cxx
PWG2/RESONANCES/AliRsnExpression.cxx
PWG2/RESONANCES/AliRsnTarget.cxx
PWG2/RESONANCES/AliRsnTarget.h
PWG2/RESONANCES/AliRsnValue.cxx
PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/AddRsnAnalysisPhi.C
PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/AddRsnAnalysisPhiRes.C
PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/RsnConfigPhiRes.C

index 358256c8c22dba325cbb1321ceb3edb79bc506a5..737c42c280532d0977eb22401da5707cb5b7b887 100644 (file)
@@ -134,7 +134,6 @@ void AliRsnAnalysisManager::InitAllPairs(TList *list)
   Int_t i = 0;
   while ((pair = (AliRsnPair*)next())) 
   {
-    if (!pair) continue;
     AliDebug(AliLog::kDebug+1, Form("InitAllPairs of the PairManager(%s) [%d] ...", pair->GetName(), i++));
     pair->Init("", list);
     
index 8ee144d6aae32ab4cdb4b7b457318958d3ef1541..26467a640193b724c96821c0e4a536873c8c9b63 100644 (file)
@@ -117,10 +117,12 @@ Bool_t AliRsnCutBetheBloch::IsSelected(TObject *object)
 //
 
   // dynamic cast the object into AliRsnDaughter
-  if (!TargetOK(object)) return kFALSE;
+  if (!TargetOK(object, AliRsnTarget::kDaughter)) return kFALSE;
 
   // retrieve the TPC signal
-  AliRsnDaughter *track = dynamic_cast<AliRsnDaughter*>(object);
+  AliRsnDaughter *track = fDaughter;
+  
+  // if track is meaningful, retrieve its ESD format
   AliESDtrack    *esd   = track->GetRefESDtrack();
   if (!esd) {
     AliError("ESD information unavailable");
index 0ff9abd526d6fccf4429f9eff8f3c0d63961f9a5..7032b3a7006819a3a67e864916a5b24f7ac1fdc9 100644 (file)
@@ -52,11 +52,11 @@ Bool_t AliRsnCutDaughterType::IsSelected(TObject *object)
 //
 
   // coherence check
-  if (!TargetOK(object)) return kFALSE;
+  if (!TargetOK(object, AliRsnTarget::kDaughter)) return kFALSE;
   
   // check the daughter according to the selected type
   // in some cases this means to retrieve the track status
-  AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(object);
+  AliRsnDaughter *daughter = fDaughter;
   AliVTrack   *track  = dynamic_cast<AliVTrack*>(daughter->GetRef());
   AliESDtrack *esdT   = dynamic_cast<AliESDtrack*>(daughter->GetRef());
   ULong_t      status = 0x0;
index ec6cf6a0038b2ce9c71dfcb350e557fe8dd4ea60..7aeed5a1a6c8405521d6eb4da32d034d1b2bd4b7 100644 (file)
@@ -52,10 +52,11 @@ Bool_t AliRsnCutESDPrimary::IsSelected(TObject *object)
 //
 
   // coherence check
-  if (!TargetOK(object)) return kFALSE;
+  if (!TargetOK(object, AliRsnTarget::kDaughter)) return kFALSE;
   
   // retrieve the TPC signal
-  AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(object);
+  AliRsnDaughter *daughter = fDaughter;
+  
   AliESDtrack *esdTrack = daughter->GetRefESDtrack();
   if (!esdTrack) 
   {
index ca6863af6c97737a8fd1db37f275d45a1a34459b..b34973bb3fb6391f640f5feb3fbb8468d9bf1cf7 100644 (file)
@@ -263,30 +263,32 @@ Bool_t AliRsnCutPID::IsSelected(TObject *object)
   
   // convert the object into the unique correct type
   
-  if (!TargetOK(object))
+  if (!TargetOK(object, AliRsnTarget::kDaughter))
   {
     AliError(Form("[%s]: this cut works only with AliRsnDaughter objects", GetName()));
     return kTRUE;
   }
   
   // if target is OK, do a dynamic cast
-  AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(object);
+  AliRsnDaughter *daughter = fDaughter;
   
   // depending on the PID type, recalls the appropriate method:
   // in case of perfect PID, checks only if the PID type is 
   // corresponding to the request in the cut (fMinI)
   // while in case of realistic PID checks also the probability
   // to be within the required interval
-  if (fPerfect)
+  if (fPerfect && daughter)
   {
     fCutValueI = PerfectPID(daughter);
     return OkValueI();
   }
-  else
+  else if (daughter)
   {
     fCutValueI = RealisticPID(daughter, fCutValueD);
     return OkValueI() && OkRangeD();
   }
+  else
+    return kFALSE;
 }
 
 //__________________________________________________________________________________________________
index 0f469c76229695faafe8f793b22165538ac75d0d..94d8a0c3b23b313b396ecd15fb15389017d0cfc6 100644 (file)
@@ -95,13 +95,6 @@ Bool_t AliRsnCutValue::IsSelected(TObject *object)
   // make sure that target of this object matches that
   // of the inserted value object
   SetTargetType(fValue.GetTargetType());
-
-  // check target coherence
-  if (!TargetOK(object))
-  {
-    AliWarning("Returning kFALSE");
-    return kFALSE;
-  }
   
   // try to compute values
   Bool_t success = fValue.Eval(object);
index 893d6538e9f974f1ce672e83e719c6ab53daa35e..ebf696beae4c80c7e35a039f68033e8cbe00f1ef 100644 (file)
@@ -262,7 +262,7 @@ AliRsnExpression* AliRsnExpression::Element(TObjArray &st, Int_t &i)
   default:
     i--; // push back
     AliErrorGeneral("AliRsnExpression::Element", Form("Unexpected symbol on input. %s", token.Data()));
-    if (result) delete result;
+    //if (result) delete result;
     result = new AliRsnExpression;
   }
   return result;
index 106f4dd65dd37a9903206086ea4e4f4bdf5e6c7d..80b8bfe305371e13987a51913999188e42ce9027 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "AliLog.h"
 
-#include "AliRsnEvent.h"
 #include "AliRsnDaughter.h"
 #include "AliRsnMother.h"
 
@@ -22,7 +21,7 @@ ClassImp(AliRsnTarget)
 AliRsnEvent* AliRsnTarget::fgCurrentEvent = 0x0;
 
 //_____________________________________________________________________________
-Bool_t AliRsnTarget::TargetOK(TObject *object)
+Bool_t AliRsnTarget::TargetOK(TObject *object, ETargetType ref)
 {
 //
 // This method compares the target type stored as data member
@@ -41,34 +40,47 @@ Bool_t AliRsnTarget::TargetOK(TObject *object)
   switch (fTargetType)
   {
     case kDaughter:
-      if (dynamic_cast<AliRsnDaughter*>(object) == 0x0)
+      fDaughter = dynamic_cast<AliRsnDaughter*>(object);
+      fMother   = 0x0;
+      fEvent    = 0x0;
+      if (fDaughter)
+        return kTRUE;
+      else
       {
         AliError(Form("[%s] Target mismatch: expected 'AliRsnDaughter', passed '%s'", GetName(), object->ClassName()));
         Print();
         return kFALSE;
       }
-      break;
     case kMother:
-      if (dynamic_cast<AliRsnMother*>(object) == 0x0)
+      fDaughter = 0x0;
+      fMother   = dynamic_cast<AliRsnMother*>(object);
+      fEvent    = 0x0;
+      if (fMother)
+        return kTRUE;
+      else
       {
         AliError(Form("[%s] Target mismatch: expected 'AliRsnMother', passed '%s'", GetName(), object->ClassName()));
         Print();
         return kFALSE;
       }
-      break;
     case kEvent:
-      if (dynamic_cast<AliRsnEvent*>(object) == 0x0)
+      fDaughter = 0x0;
+      fMother   = 0x0;
+      fEvent    = dynamic_cast<AliRsnEvent*>(object);
+      if (fEvent)
+        return kTRUE;
+      else
       {
         AliError(Form("[%s] Target mismatch: expected 'AliRsnEvent', passed '%s'", GetName(), object->ClassName()));
         Print();
         return kFALSE;
       }
-      break;
     default:
-      return kTRUE;
+      fDaughter = 0x0;
+      fMother   = 0x0;
+      fEvent    = 0x0;
+      return kFALSE;
   }
-  
-  return kTRUE;
 }
 
 //______________________________________________________________________________
index d98d7eb20c078dbb415a1feef3b24525bc3ea4bb..a1235e871200ad8424bb1928134307eae53cc1ce 100644 (file)
@@ -16,6 +16,9 @@
 
 #include "AliRsnEvent.h"
 
+class AliRsnDaughter;
+class AliRsnMother;
+
 class AliRsnTarget : public TNamed
 {
   public:
@@ -28,18 +31,21 @@ class AliRsnTarget : public TNamed
       kTargetTypes
     };
 
-    AliRsnTarget() : fTargetType(kTargetTypes) { /*nothing*/ }
-    AliRsnTarget(const char *name, ETargetType type) : TNamed(name, ""), fTargetType(type) { /*nothing*/ }
-    AliRsnTarget(const AliRsnTarget& copy) : TNamed(copy), fTargetType(copy.fTargetType) { /*nothing*/ }
-    AliRsnTarget& operator=(const AliRsnTarget& copy) { TNamed::operator=(copy); fTargetType = copy.fTargetType; return (*this); }
+    AliRsnTarget() : fTargetType(kTargetTypes), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
+    AliRsnTarget(const char *name, ETargetType type) : TNamed(name, ""), fTargetType(type), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
+    AliRsnTarget(const AliRsnTarget& copy) : TNamed(copy), fTargetType(copy.fTargetType), fDaughter(0x0), fMother(0x0), fEvent(0x0) { /*nothing*/ }
+    AliRsnTarget& operator=(const AliRsnTarget& copy) { TNamed::operator=(copy); fTargetType = copy.fTargetType; fDaughter = 0x0; fMother = 0x0; fEvent = 0x0; return (*this); }
     virtual ~AliRsnTarget() { /*nothing*/ }
     
-    Bool_t         IsTarget(ETargetType targetType)  {return (fTargetType == targetType);}
-    ETargetType    GetTargetType() const             {return fTargetType;}
-    Char_t         GetTargetTypeChar() const;
-    const char*    GetTargetTypeName() const;
-    void           SetTargetType(ETargetType type)   {fTargetType = type;}
-    Bool_t         TargetOK(TObject *object);
+    Bool_t           IsTarget(ETargetType targetType)  {return (fTargetType == targetType);}
+    ETargetType      GetTargetType() const             {return fTargetType;}
+    Char_t           GetTargetTypeChar() const;
+    const char*      GetTargetTypeName() const;
+    void             SetTargetType(ETargetType type)   {fTargetType = type;}
+    Bool_t           TargetOK(TObject *object, ETargetType ref);
+    AliRsnDaughter*  GetTargetDaughter()               {return fDaughter;}
+    AliRsnMother*    GetTargetMother()                 {return fMother;}
+    AliRsnEvent*     GetTargetEvent()                  {return fEvent;}
     
     static AliRsnEvent*  GetCurrentEvent()                   {return fgCurrentEvent;}
     static void          SetCurrentEvent(AliRsnEvent *event) {fgCurrentEvent = event;}
@@ -51,6 +57,10 @@ class AliRsnTarget : public TNamed
     ETargetType         fTargetType;     //  target type selected for this object
     static AliRsnEvent *fgCurrentEvent;  //! pointer to current event (useful in many cases)
     
+    AliRsnDaughter     *fDaughter;       //  utility pointer to target object (daughter)
+    AliRsnMother       *fMother;         //  utility pointer to target object (mother)
+    AliRsnEvent        *fEvent;          //  utility pointer to target object (event)
+    
     // ROOT dictionary
     ClassDef(AliRsnTarget, 1)
 };
index 6494b0961212a412fcac93ab8bef75008b61e917..67bdba33afcf416fadb119b24d5940226e9978f4 100644 (file)
@@ -304,18 +304,40 @@ Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC)
   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)
+      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)
+      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;
@@ -336,28 +358,6 @@ Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC)
   // cast the support object to the types which could be needed
   AliESDtrackCuts *esdCuts = dynamic_cast<AliESDtrackCuts*>(fSupportObject);
   AliRsnPairDef   *pairDef = dynamic_cast<AliRsnPairDef*>(fSupportObject);
-
-  // 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)
-  if (daughter)
-  {
-    pRec = daughter->Psim();
-    pSim = daughter->Prec();
-  }
-  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();
-  }
     
   // compute value depending on type
   switch (fValueType)
index be2749d1a31c9157119dab39badc93eb90c77ce1..c6f3b709930a1286c843890212cbce10e0cef4b1 100644 (file)
@@ -30,8 +30,8 @@ Bool_t AddRsnAnalysisPhi
   mgr->AddTask(task);
   
   // execute the related config with settings for adding and not adding ITS-SA
-  gROOT->ProcessLine(Form(".x %s/%s(%s,%s,%s)", configPath, configMacro, taskName, options                , configPath));
-  gROOT->ProcessLine(Form(".x %s/%s(%s,%s,%s)", configPath, configMacro, taskName, Form("its+%s", options), configPath));
+  gROOT->ProcessLine(Form(".x %s/%s.C(%s,%s,%s)", configPath, configMacro, taskName, options                , configPath));
+  gROOT->ProcessLine(Form(".x %s/%s.C(%s,%s,%s)", configPath, configMacro, taskName, Form("its+%s", options), configPath));
   
   // connect input container according to source choice
   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
index 126bbaf58f85e414eb9d442cff6e04eba141907b..304ab2146a588646cd018bd12ad2508b0d4c53d5 100644 (file)
 //                   whatever the name of the macro itself, whose first two
 //                   arguments must have to be the task and the 'dataLabel' argument.
 //
-Bool_t AddRsnAnalysisRes
+Bool_t AddRsnAnalysisPhiRes
 (
-  const char *options,
-  const char *configs = "RsnConfigResNoSA.C RsnConfigResSA.C",
-  const char *path    = "$(ALICE_INSTALL)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/fixed_rapidity"
+  const char *options     = "", 
+  const char *taskName    = "RsnAnalysis",
+  const char *configMacro = "RsnConfigPhiRes",
+  const char *configPath  = "$(ALICE_INSTALL)/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV"
 )
 {
   // retrieve analysis manager
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
     
   // create the task and connect with physics selection
-  AliRsnAnalysisSE *task = new AliRsnAnalysisSE("RsnAnalysis");
+  AliRsnAnalysisSE *task = new AliRsnAnalysisSE(taskName);
   task->SetZeroEventPercentWarning(100.0);
   task->SelectCollisionCandidates();
 
   // add the task to manager
   mgr->AddTask(task);
-
-  // load and execute all required configuration macroes in the string (arg #2)
-  TString    sList   = configs;
-  TObjArray *list    = sList.Tokenize(" ");
-  Int_t      nConfig = list->GetEntries();
-  Int_t      iConfig = 0;
-  for (iConfig = 0; iConfig < nConfig; iConfig++)
-  {
-    TObjString *ostr = (TObjString*)list->At(iConfig);
-    
-    // the config macro is assumed to be stored in the path in argument #3
-    // and to have three arguments: task name, a free string of options and the path where it is stored
-    // --> all of them is a string, and then it must be passed with the quote marks
-    const char *macro     = ostr->GetString().Data();
-    const char *argName   = Form("\"%s\"", task->GetName());
-    const char *argOption = Form("\"%s\"", options);
-    const char *argPath   = Form("\"%s\"", path);
-    gROOT->ProcessLine(Form(".x %s/%s(%s,%s,%s)", path, macro, argName, argOption, argPath));
-  }
-
+  
+  // execute the related config with settings for adding and not adding ITS-SA
+  gROOT->LoadMacro(Form("%s/%s.C", configPath, configMacro));
+  gROOT->ProcessLine(Form("%s(\"%s\",\"%s\",\"%s\")", configMacro, taskName, options                , configPath));
+  gROOT->ProcessLine(Form("%s(\"%s\",\"%s\",\"%s\")", configMacro, taskName, Form("its+%s", options), configPath));
+  
   // connect input container according to source choice
   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
 
index 45f7ec94ee19379874065ae0a7ada1a6f3789a8a..09cae4c182a56a8a95f65d47563935641638da2e 100644 (file)
@@ -1,18 +1,3 @@
-/*
-#include <TROOT.h>
-#include <TString.h>
-#include <AliAnalysisManager.h>
-#include <AliRsnAnalysisSE.h>
-#include <AliRsnCutESD2010.h>
-#include <AliRsnCutValue.h>
-#include <AliRsnPairFunctions.h>
-#include <AliRsnFunction.h>
-#include <AliRsnCutPrimaryVertex.h>
-
-#include "config/QualityCutsITS.C"
-#include "config/QualityCutsTPC.C"
-*/
-
 //
 // This function configures the entire task for all resonances the user is interested in.
 // This is done by creating all configuration objects which are defined in the package.
 //
 // The return value is used to know if the configuration was successful
 //
-Bool_t RsnConfigRes
+Bool_t RsnConfigPhiRes
 (
   const char *taskName, 
   const char *options,
-  const char *config,
   const char *path
 )
 {
+  // retrieve analysis manager & task and exit in case of failure
+  AliAnalysisManager *mgr  = AliAnalysisManager::GetAnalysisManager();
+  AliRsnAnalysisSE   *task = (AliRsnAnalysisSE*)mgr->GetTask(taskName);
+  if (!task)
+  {
+    Error("RsnConfigPhi", "Task not found");
+    return kFALSE;
+  }
+  
   // load useful macros
   gROOT->LoadMacro(Form("%s/QualityCutsITS.C", path));
   gROOT->LoadMacro(Form("%s/QualityCutsTPC.C", path));
   
   // interpret the useful information from second argument
   TString opt(options);
-  Bool_t  isSim = kTRUE;
-  
-  // interpret the specific info from third argument
-  // which should be fixed in the various calls to this function
-  TString conf(config);
-  Bool_t addPID    = conf.Contains("pid");
-  Bool_t addITSSA  = conf.Contains("its");
-  Bool_t addDipCut = conf.Contains("dip");
-      
-  // generate a common suffix depending on chosen options
-  TString suffix;
-  if (addPID)    suffix += "_pid";
-  if (addITSSA)  suffix += "_its";
-  Info("RsnConfig", "=== Specific configuration: %s ====================================================", config);
-  Info("RsnConfig", "=== suffix used           : %s ====================================================", suffix.Data());
-
-  // retrieve analysis manager & task
-  AliAnalysisManager *mgr  = AliAnalysisManager::GetAnalysisManager();
-  AliRsnAnalysisSE   *task = (AliRsnAnalysisSE*)mgr->GetTask(taskName);
-
-  // for safety, return if no task is passed
-  if (!task)
+  TString suffix("_pid");
+  Bool_t isSim    = opt.Contains("sim");
+  Bool_t isData   = opt.Contains("data");
+  Bool_t addITSSA = opt.Contains("its");
+  if (!isSim && !isData)
   {
-    Error("RsnConfig2010PhiFcn", "Task not found");
+    Error("RsnConfigPhi", "Required to know if working on data or MC");
     return kFALSE;
   }
+  if (addITSSA) suffix += "_its";
   
-  //
-  // -- Setup event cuts (added directly to task) ---------------------------------------------------
-  //
+  // define some names using a standard part plus the above suffix
+  TString truePMname(suffix);
+  TString esdCutName(suffix);
+  
+  truePMname.Prepend("TruePM");
+  esdCutName.Prepend("cutESD2010");
   
-  // define a common cut on primary vertex, which also checks pile-up
-  AliRsnCutPrimaryVertex *cutVertex  = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
-  cutVertex->SetCheckPileUp(kTRUE);
-  task->GetEventCuts()->AddCut(cutVertex);
-  task->GetEventCuts()->SetCutScheme("cutVertex");
-
   //
-  // -- Setup pairs ---------------------------------------------------------------------------------
+  // -- Setup pair definition (phi decay trees)  and pairs ------------------------------------------
   //
 
   // decay channels
   AliRsnPairDef *pairDefPM = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455);
 
   // computation objects
-  AliRsnPairFunctions *truePM = new AliRsnPairFunctions(Form("TrueResPM%s", suffix.Data()), pairDefPM);
+  AliRsnPairFunctions *truePM = new AliRsnPairFunctions(truePMname.Data(), pairDefPM);
+  
+  // set additional option for true pairs
+  truePM->SetOnlyTrue  (kTRUE);
+  truePM->SetCheckDecay(kTRUE);
+  
+  //
+  // -- Setup event cuts ----------------------------------------------------------------------------
+  //
+  
+  // cut on primary vertex:
+  // - 2nd argument = 10.0     --> require |Vz| <= 10 cm
+  // - 3rd argument = 0        --> disable check on number of contributors
+  // - 4th argument = 'kFALSE' --> reject TPC stand-alone primary vertex
+  AliRsnCutPrimaryVertex *cutVertex  = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
+  
+  // check pile-up with SPD
+  cutVertex->SetCheckPileUp(kTRUE);
 
   //
-  // -- Setup cuts ----------------------------------------------------------------------------------
+  // -- Setup single track cuts ---------------------------------------------------------------------
   //
 
-  // track cut -----------------------
-  // --> global cuts for 2010 analysis
-  // --> most options are set to right values by default
-  // --> second argument in constructor tells if we are working in simulation or not
-  AliRsnCutESD2010 *cuts2010 = new AliRsnCutESD2010(Form("cuts2010%s", suffix.Data()), isSim);
-  // --> set the reference particle for PID
+  // cut on track quality/PID:
+  // 2nd argument (variable) --> 'kTRUE' for MonteCarlo, 'kFALSE' for data
+  AliRsnCutESD2010 *cuts2010 = new AliRsnCutESD2010(esdCutName.Data(), isSim);
+  
+  // specify that PID is for kaons
   cuts2010->SetPID(AliPID::kKaon);
-  // --> include or not the ITS standalone (TPC is always in)
+  
+  // TPC+ITS tracks are always added, ITS-SA depends on options
   cuts2010->SetUseITSTPC(kTRUE);
   cuts2010->SetUseITSSA (addITSSA);
-  // --> set the quality cuts using the general macro and using the 'Copy()' method in AliESDtrackCuts
+  
+  // set quality cuts according to standard macro (defined outside)
   cuts2010->CopyCutsTPC(QualityCutsTPC());
   cuts2010->CopyCutsITS(QualityCutsITS());
-  // --> set values for PID flags, depending on the choice expressed in the options
-  cuts2010->SetCheckITS (addPID);
-  cuts2010->SetCheckTPC (addPID);
-  cuts2010->SetCheckTOF (addPID);
-  // --> set the ITS PID-related variables
+  
+  // add always the PID check
+  cuts2010->SetCheckITS(kTRUE);
+  cuts2010->SetCheckTPC(kTRUE);
+  cuts2010->SetCheckTOF(kTRUE);
+  
+  // set the ITS PID-related variables
   cuts2010->SetITSband(3.0);
-  // --> set the TPC PID-related variables
+  
+  // set the TPC PID-related variables
   Double_t bbPar[5];
-  bbPar[0] = 2.15898 / 50.0;
-  bbPar[1] = 1.75295E1;
-  bbPar[2] = 3.40030E-9;
-  bbPar[3] = 1.96178;
-  bbPar[4] = 3.91720;
+  if (isSim)
+  {
+    bbPar[0] = 2.15898 / 50.0;
+    bbPar[1] = 1.75295E1;
+    bbPar[2] = 3.40030E-9;
+    bbPar[3] = 1.96178;
+    bbPar[4] = 3.91720;
+  }
+  else
+  {
+    bbPar[0] = 1.41543 / 50.0;
+    bbPar[1] = 2.63394E1;
+    bbPar[2] = 5.0411E-11;
+    bbPar[3] = 2.12543;
+    bbPar[4] = 4.88663;
+  }
   cuts2010->SetTPCrange(3.0, 5.0);
   cuts2010->SetTPCpLimit(0.35);
   cuts2010->GetESDpid()->GetTPCResponse().SetBetheBlochParameters(bbPar[0], bbPar[1], bbPar[2], bbPar[3], bbPar[4]);
-  // --> set the TOF PID-related variables
+  
+  // set the TOF PID-related variables
   cuts2010->SetTOFrange(-3.0, 3.0);
   
-  // pair cut ----------------------------------------
-  // --> dip angle between daughters: (it is a cosine)
-  AliRsnCutValue *cutY   = new AliRsnCutValue("cutY"  , AliRsnValue::kPairY       , -0.5 , 0.5 );
+  //
+  // -- Setup track pair cuts -----------------------------------------------------------------------
+  //
+  
+  // rapidity window
+  AliRsnCutValue *cutY = new AliRsnCutValue("cutY", AliRsnValue::kPairY, -0.5, 0.5);
+  
+  // this cut requires a support object to retrieve default mass
   cutY->GetValueObj()->SetSupportObject(pairDefPM);
-
-  // setup cut set for tracks------------------------------------------------------------
-  // --> in this case, only common cuts are applied, depending if working with ESD or AOD
-  // --> these cuts are added always
+  
+  //
+  // -- Add cuts to cut collections -----------------------------------------------------------------
+  //
+  
+  // event cuts are added directly to task, and only the first time
+  if (task->GetEventCuts()->GetCuts()->FindObject("cutVertex") == 0x0)
+  {
+    task->GetEventCuts()->AddCut(cutVertex);
+    task->GetEventCuts()->SetCutScheme("cutVertex");
+  }
+  
+  // single track cuts are added to each pair as common ones for both daughters
   truePM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010);
   truePM->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cuts2010->GetName());
   
-  // setup cut set for pairs---------------
-  // --> add rapidity range cut
-  TString scheme(cutY->GetName());
+  // pair cuts are added to each pair
   truePM->GetCutManager()->GetMotherCuts()->AddCut(cutY);
   truePM->GetCutManager()->GetMotherCuts()->SetCutScheme(cutY->GetName());
-  
-  // set additional option for true pairs
-  truePM->SetOnlyTrue  (kTRUE);
-  truePM->SetCheckDecay(kTRUE);
 
   //
   // -- Setup functions -----------------------------------------------------------------------------
@@ -153,15 +168,15 @@ Bool_t RsnConfigRes
   // axis definition
   // 0) invariant mass
   // 1) transverse momentum
-  // 2) multiplicity
-  Double_t mult[] = {0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23., 24., 25., 30., 35., 40., 50., 60., 70., 80., 90., 100., 120., 140., 160., 180., 200., 1E+8};
-  Int_t    nmult  = sizeof(mult) / sizeof(mult[0]);
-  AliRsnValue *axisIM   = new AliRsnValue("IM", AliRsnValue::kPairInvMassRes  , 0.9,   1.4, 0.001);
-  AliRsnValue *axisPt   = new AliRsnValue("PT", AliRsnValue::kPairPt          , 0.0,   5.0, 0.100);
+  // 2) multiplicity (variable binning)
+  Double_t     mult[]   = {0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23., 24., 25., 30., 35., 40., 50., 60., 70., 80., 90., 100., 120., 140., 160., 180., 200., 1E+8};
+  Int_t        nmult    = sizeof(mult) / sizeof(mult[0]);
+  AliRsnValue *axisIM   = new AliRsnValue("IM", AliRsnValue::kPairInvMassRes  , -10.0, 10.0, 0.01);
+  AliRsnValue *axisPt   = new AliRsnValue("PT", AliRsnValue::kPairPt          ,   0.0,  5.0, 0.10);
   AliRsnValue *axisMult = new AliRsnValue("M" , AliRsnValue::kEventMultESDCuts, nmult, mult);
 
-  // initialize the support object: AliESDtrackCuts
-  // configured using the standard values
+  // multiplicity axis needs a support object
+  // of type AliESDtrackCuts, correctly configured
   AliESDtrackCuts *cuts = new AliESDtrackCuts(QualityCutsTPC());
   axisMult->SetSupportObject(cuts);