From 6aff50152f455e6de76e372322f0208359d6532e Mon Sep 17 00:00:00 2001 From: pulvir Date: Mon, 24 Jan 2011 12:22:41 +0000 Subject: [PATCH] Solved some of the issues raised by coverity server. --- PWG2/RESONANCES/AliRsnAnalysisManager.cxx | 1 - PWG2/RESONANCES/AliRsnCutBetheBloch.cxx | 6 +- PWG2/RESONANCES/AliRsnCutDaughterType.cxx | 4 +- PWG2/RESONANCES/AliRsnCutESDPrimary.cxx | 5 +- PWG2/RESONANCES/AliRsnCutPID.cxx | 10 +- PWG2/RESONANCES/AliRsnCutValue.cxx | 7 - PWG2/RESONANCES/AliRsnExpression.cxx | 2 +- PWG2/RESONANCES/AliRsnTarget.cxx | 34 ++- PWG2/RESONANCES/AliRsnTarget.h | 30 ++- PWG2/RESONANCES/AliRsnValue.cxx | 48 ++--- .../train/LHC2010-pp7TeV/AddRsnAnalysisPhi.C | 4 +- .../LHC2010-pp7TeV/AddRsnAnalysisPhiRes.C | 37 ++-- .../train/LHC2010-pp7TeV/RsnConfigPhiRes.C | 201 ++++++++++-------- 13 files changed, 205 insertions(+), 184 deletions(-) diff --git a/PWG2/RESONANCES/AliRsnAnalysisManager.cxx b/PWG2/RESONANCES/AliRsnAnalysisManager.cxx index 358256c8c22..737c42c2805 100644 --- a/PWG2/RESONANCES/AliRsnAnalysisManager.cxx +++ b/PWG2/RESONANCES/AliRsnAnalysisManager.cxx @@ -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); diff --git a/PWG2/RESONANCES/AliRsnCutBetheBloch.cxx b/PWG2/RESONANCES/AliRsnCutBetheBloch.cxx index 8ee144d6aae..26467a64019 100644 --- a/PWG2/RESONANCES/AliRsnCutBetheBloch.cxx +++ b/PWG2/RESONANCES/AliRsnCutBetheBloch.cxx @@ -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(object); + AliRsnDaughter *track = fDaughter; + + // if track is meaningful, retrieve its ESD format AliESDtrack *esd = track->GetRefESDtrack(); if (!esd) { AliError("ESD information unavailable"); diff --git a/PWG2/RESONANCES/AliRsnCutDaughterType.cxx b/PWG2/RESONANCES/AliRsnCutDaughterType.cxx index 0ff9abd526d..7032b3a7006 100644 --- a/PWG2/RESONANCES/AliRsnCutDaughterType.cxx +++ b/PWG2/RESONANCES/AliRsnCutDaughterType.cxx @@ -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(object); + AliRsnDaughter *daughter = fDaughter; AliVTrack *track = dynamic_cast(daughter->GetRef()); AliESDtrack *esdT = dynamic_cast(daughter->GetRef()); ULong_t status = 0x0; diff --git a/PWG2/RESONANCES/AliRsnCutESDPrimary.cxx b/PWG2/RESONANCES/AliRsnCutESDPrimary.cxx index ec6cf6a0038..7aeed5a1a6c 100644 --- a/PWG2/RESONANCES/AliRsnCutESDPrimary.cxx +++ b/PWG2/RESONANCES/AliRsnCutESDPrimary.cxx @@ -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(object); + AliRsnDaughter *daughter = fDaughter; + AliESDtrack *esdTrack = daughter->GetRefESDtrack(); if (!esdTrack) { diff --git a/PWG2/RESONANCES/AliRsnCutPID.cxx b/PWG2/RESONANCES/AliRsnCutPID.cxx index ca6863af6c9..b34973bb3fb 100644 --- a/PWG2/RESONANCES/AliRsnCutPID.cxx +++ b/PWG2/RESONANCES/AliRsnCutPID.cxx @@ -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(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; } //__________________________________________________________________________________________________ diff --git a/PWG2/RESONANCES/AliRsnCutValue.cxx b/PWG2/RESONANCES/AliRsnCutValue.cxx index 0f469c76229..94d8a0c3b23 100644 --- a/PWG2/RESONANCES/AliRsnCutValue.cxx +++ b/PWG2/RESONANCES/AliRsnCutValue.cxx @@ -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); diff --git a/PWG2/RESONANCES/AliRsnExpression.cxx b/PWG2/RESONANCES/AliRsnExpression.cxx index 893d6538e9f..ebf696beae4 100644 --- a/PWG2/RESONANCES/AliRsnExpression.cxx +++ b/PWG2/RESONANCES/AliRsnExpression.cxx @@ -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; diff --git a/PWG2/RESONANCES/AliRsnTarget.cxx b/PWG2/RESONANCES/AliRsnTarget.cxx index 106f4dd65dd..80b8bfe3053 100644 --- a/PWG2/RESONANCES/AliRsnTarget.cxx +++ b/PWG2/RESONANCES/AliRsnTarget.cxx @@ -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(object) == 0x0) + fDaughter = dynamic_cast(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(object) == 0x0) + fDaughter = 0x0; + fMother = dynamic_cast(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(object) == 0x0) + fDaughter = 0x0; + fMother = 0x0; + fEvent = dynamic_cast(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; } //______________________________________________________________________________ diff --git a/PWG2/RESONANCES/AliRsnTarget.h b/PWG2/RESONANCES/AliRsnTarget.h index d98d7eb20c0..a1235e87120 100644 --- a/PWG2/RESONANCES/AliRsnTarget.h +++ b/PWG2/RESONANCES/AliRsnTarget.h @@ -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) }; diff --git a/PWG2/RESONANCES/AliRsnValue.cxx b/PWG2/RESONANCES/AliRsnValue.cxx index 6494b096121..67bdba33afc 100644 --- a/PWG2/RESONANCES/AliRsnValue.cxx +++ b/PWG2/RESONANCES/AliRsnValue.cxx @@ -304,18 +304,40 @@ Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC) AliRsnDaughter *daughter = dynamic_cast(object); AliRsnMother *mother = dynamic_cast(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(fSupportObject); AliRsnPairDef *pairDef = dynamic_cast(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) diff --git a/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/AddRsnAnalysisPhi.C b/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/AddRsnAnalysisPhi.C index be2749d1a31..c6f3b709930 100644 --- a/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/AddRsnAnalysisPhi.C +++ b/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/AddRsnAnalysisPhi.C @@ -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()); diff --git a/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/AddRsnAnalysisPhiRes.C b/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/AddRsnAnalysisPhiRes.C index 126bbaf58f8..304ab2146a5 100644 --- a/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/AddRsnAnalysisPhiRes.C +++ b/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/AddRsnAnalysisPhiRes.C @@ -10,43 +10,30 @@ // 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()); diff --git a/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/RsnConfigPhiRes.C b/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/RsnConfigPhiRes.C index 45f7ec94ee1..09cae4c182a 100644 --- a/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/RsnConfigPhiRes.C +++ b/PWG2/RESONANCES/macros/train/LHC2010-pp7TeV/RsnConfigPhiRes.C @@ -1,18 +1,3 @@ -/* -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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. @@ -28,123 +13,153 @@ // // 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); -- 2.39.3