From 23cdfaf3832615210b7db9ad6d50e881f930e36d Mon Sep 17 00:00:00 2001 From: pulvir Date: Sat, 6 Nov 2010 17:56:49 +0000 Subject: [PATCH] First version of macros for current phi 7 TeV analysis --> train --- .../train/LHC2010-7TeV-phi/AddRsnAnalysis.C | 70 ++++++ .../train/LHC2010-7TeV-phi/AddRsnAnalysisMC.C | 73 ++++++ .../train/LHC2010-7TeV-phi/AddRsnEfficiency.C | 181 ++++++++++++++ .../train/LHC2010-7TeV-phi/ConfigESDCutsITS.C | 25 ++ .../train/LHC2010-7TeV-phi/ConfigESDCutsTPC.C | 28 +++ .../macros/train/LHC2010-7TeV-phi/RsnConfig.C | 228 ++++++++++++++++++ .../train/LHC2010-7TeV-phi/RsnConfigDipNoSA.C | 12 + .../train/LHC2010-7TeV-phi/RsnConfigDipSA.C | 12 + .../train/LHC2010-7TeV-phi/RsnConfigMC.C | 120 +++++++++ .../train/LHC2010-7TeV-phi/RsnConfigNoSA.C | 12 + .../train/LHC2010-7TeV-phi/RsnConfigSA.C | 12 + 11 files changed, 773 insertions(+) create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysis.C create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysisMC.C create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnEfficiency.C create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsITS.C create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsTPC.C create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipNoSA.C create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipSA.C create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigMC.C create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigNoSA.C create mode 100644 PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigSA.C diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysis.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysis.C new file mode 100644 index 00000000000..30cc0f9845c --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysis.C @@ -0,0 +1,70 @@ +// +// This macro serves to add the RSN analysis task to the steering macro. +// +// Inputs: +// - dataLabel = a string with informations about the type of data +// which could be needed to be ported to the config macro +// to set up some cuts +// - configMacro = macro which configures the analysis; it has *ALWAYS* +// defined inside a function named 'RsnConfigTask()', +// whatever the name of the macro itself, whose first two +// arguments must have to be the task and the 'dataLabel' argument. +// +Bool_t AddRsnAnalysis +( + const char *options, + const char *configs = "RsnConfigNoSA.C RsnConfigSA.C RsnConfigDipNoSA.C RsnConfigDipSA.C" +) +{ + // retrieve analysis manager + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + + // interpret config string + TString strDataLabel(options); + Bool_t isSim = strDataLabel.Contains("sim"); + Bool_t isMC = strDataLabel.Contains("MC"); + + // initialize task with all available slots, even if not all of them will be used: + AliRsnAnalysisSE *task = new AliRsnAnalysisSE("RsnAnalysis"); + task->SetZeroEventPercentWarning(100.0); + task->SelectCollisionCandidates(); + if (isMC) task->SetMCOnly(kTRUE); + + // if not MC kinematics, set cuts for events : primary vertex range and type + if (!isMC) + { + AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE); + task->GetEventCuts()->AddCut(cutVertex); + task->GetEventCuts()->SetCutScheme("cutVertex"); + } + + // add the task to manager + mgr->AddTask(task); + + // load and execute configuration macroes + 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); + cout << "***** Processing config macro '" << ostr->GetString().Data() << endl; + gROOT->ProcessLine(Form(".x %s(\"%s\",\"%s\")", ostr->GetString().Data(), task->GetName(), options)); + } + + // connect input container according to source choice + mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); + + // create paths for the output in the common file + Char_t commonPath[500]; + sprintf(commonPath, "%s", AliAnalysisManager::GetCommonFileName()); + + // create containers for output + AliAnalysisDataContainer *outputInfo = mgr->CreateContainer("RsnInfo", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath); + AliAnalysisDataContainer *outputHist = mgr->CreateContainer("RsnHist", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath); + mgr->ConnectOutput(task, 1, outputInfo); + mgr->ConnectOutput(task, 2, outputHist); + + return kTRUE; +} diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysisMC.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysisMC.C new file mode 100644 index 00000000000..571214d1bf2 --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysisMC.C @@ -0,0 +1,73 @@ +// +// This macro serves to add the RSN analysis task to the steering macro. +// +// Inputs: +// - dataLabel = a string with informations about the type of data +// which could be needed to be ported to the config macro +// to set up some cuts +// - configMacro = macro which configures the analysis; it has *ALWAYS* +// defined inside a function named 'RsnConfigTask()', +// whatever the name of the macro itself, whose first two +// arguments must have to be the task and the 'dataLabel' argument. +// +Bool_t AddAnalysisTaskRsn +( + const char *options, + const char *configs = "RsnConfig2010PhiFcnRealisticNoSA.C \ + RsnConfig2010PhiFcnRealisticWithSA.C \ + RsnConfig2010PhiFcnRealisticDipNoSA.C \ + RsnConfig2010PhiFcnRealisticDipWithSA.C" +) +{ + // retrieve analysis manager + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + + // interpret config string + TString strDataLabel(options); + Bool_t isSim = strDataLabel.Contains("sim"); + Bool_t isMC = strDataLabel.Contains("MC"); + + // initialize task with all available slots, even if not all of them will be used: + AliRsnAnalysisSE *task = new AliRsnAnalysisSE("RsnAnalysis"); + task->SetZeroEventPercentWarning(100.0); + task->SelectCollisionCandidates(); + if (isMC) task->SetMCOnly(kTRUE); + + // if not MC kinematics, set cuts for events : primary vertex range and type + if (!isMC) + { + AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE); + task->GetEventCuts()->AddCut(cutVertex); + task->GetEventCuts()->SetCutScheme("cutVertex"); + } + + // add the task to manager + mgr->AddTask(task); + + // load and execute configuration macroes + 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); + cout << "***** Processing config macro '" << ostr->GetString().Data() << endl; + gROOT->ProcessLine(Form(".x %s(\"%s\",\"%s\")", ostr->GetString().Data(), task->GetName(), options)); + } + + // connect input container according to source choice + mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); + + // create paths for the output in the common file + Char_t commonPath[500]; + sprintf(commonPath, "%s", AliAnalysisManager::GetCommonFileName()); + + // create containers for output + AliAnalysisDataContainer *outputInfo = mgr->CreateContainer("RsnInfo", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath); + AliAnalysisDataContainer *outputHist = mgr->CreateContainer("RsnHist", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath); + mgr->ConnectOutput(task, 1, outputInfo); + mgr->ConnectOutput(task, 2, outputHist); + + return kTRUE; +} diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnEfficiency.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnEfficiency.C new file mode 100644 index 00000000000..0a1cff9e3f5 --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnEfficiency.C @@ -0,0 +1,181 @@ +// +// This macro add an analysis task for computing efficiency. +// It will have as output an AliCFContainer with several steps: +// +// 0) all resonances in MC which decay in the pair specified +// 1) subset of (0) whose daughters are in acceptance +// 2) subset of (1) whose daughters satisfy quality track cuts (covariance, chi square && nTPCclusters) +// 3) subset of (2) whose daughters satisfy primary track cuts (nsigma to vertex, no kink daughters) +// 4) subset of (3) whose daughters satisty the BB TPC compatibility cut at 3 sigma +// +Bool_t AddRsnEfficiency(const char *dataLabel) +{ + // load useful macros + gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsITS.C"); + gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsTPC.C"); + + // retrieve analysis manager + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + + // create task + AliRsnAnalysisEffSE *task[2]; + task[0] = new AliRsnAnalysisEffSE("RsnTaskEffNoSA"); + task[1] = new AliRsnAnalysisEffSE("RsnTaskEffSA"); + + // pair definition: + // phi --> K+ K- + AliRsnPairDef *pairPhi = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455); + + // axis definition + // 0) invariant mass + // 1) transverse momentum + // 2) rapidity + // 3) multiplicity + Double_t pt [] = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0, 10.0}; + Double_t y [] = {-1.0, -0.9, -0.8, -0.7, -0.6, -0.5, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}; + Double_t mult[] = {0.0, 5.0, 9.0, 14.0, 22.0, 100000.0}; + Int_t npt = sizeof(pt ) / sizeof(pt [0]); + Int_t ny = sizeof(y ) / sizeof(y [0]); + Int_t nmult = sizeof(mult) / sizeof(mult[0]); + AliRsnValue *axisIM = new AliRsnValue("IM" , AliRsnValue::kPairInvMass , 1000 , 0.9, 1.9); + AliRsnValue *axisPt = new AliRsnValue("PT" , AliRsnValue::kPairPt , npt , pt); + AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY , ny , y); + AliRsnValue *axisMult = new AliRsnValue("Mult", AliRsnValue::kEventMultESDcuts, nmult, mult); + ConfigESDCutsTPC(axisMult->GetCuts()); + + // define cuts for event selection: + // this will determine the filling of bins in the "info" histograms + // and should be computed as additional correction factor in efficiency + AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE); + + // define standard 2010 track quality/PID cuts: + // - first index: [0] = no PID, [1] = PID + // - second index: [0] = no ITS, [1] = ITS + AliRsnCutESD2010 *cuts2010[2][2]; + cuts2010[0][0] = new AliRsnCutESD2010("cutESD2010nopidNoSA"); + cuts2010[0][1] = new AliRsnCutESD2010("cutESD2010nopidSA"); + cuts2010[1][0] = new AliRsnCutESD2010("cutESD2010pidNoSA"); + cuts2010[1][1] = new AliRsnCutESD2010("cutESD2010pidSA"); + // since both indexes are 0/1, the boolean settings + // are done according to them, for clarity + for (Int_t ipid = 0; ipid < 2; ipid++) + { + for (Int_t iits = 0; iits < 2; iits++) + { + // all work with MC here + cuts2010[ipid][iits]->SetMC(kTRUE); + + // all use global tracks + cuts2010[ipid][iits]->SetUseGlobal(kTRUE); + + // other flags, depend on indexes + cuts2010[ipid][iits]->SetUseITSSA((Bool_t)iits); + cuts2010[ipid][iits]->SetCheckITS((Bool_t)ipid); + cuts2010[ipid][iits]->SetCheckTPC((Bool_t)ipid); + cuts2010[ipid][iits]->SetCheckTOF((Bool_t)ipid); + + // basic quality settings + ConfigESDCutsITS(cuts2010[ipid][iits]->GetCutsITS()); + ConfigESDCutsTPC(cuts2010[ipid][iits]->GetCutsTPC()); + } + } + + // define cut on dip angle: + AliRsnCutStd *cutDip = new AliRsnCutStd("cutDip", AliRsnCut::kMother, AliRsnCutStd::kDipAngle, 0.0, 0.04); + + // define a common path for the output file + Char_t commonPath[500]; + sprintf(commonPath, "%s", AliAnalysisManager::GetCommonFileName()); + + // add all the steps + // two-folded loop on the two tasks, where one contains the ITS-SA and the other doesn't + for (Int_t itask = 0; itask < 2; itask++) + { + // add pair definition, to choose the checked resonance + task[itask]->AddPairDef(pairPhi); + + // add the output histogram axis + task[itask]->AddAxis(axisIM); + task[itask]->AddAxis(axisPt); + task[itask]->AddAxis(axisY); + task[itask]->AddAxis(axisMult); + + // add the cut only when working on ESD, not on MC only + task[itask]->GetEventCuts()->AddCut(cutVertex); + task[itask]->GetEventCuts()->SetCutScheme("cutVertex"); + + // + // *** STEP 0 - All resonances which decay in the specified pair + // + // This step does not need any kind of definition, since + // its requirement is automatically checked during execution, + // but to avoid segfaults, it is better to initialize a cut manager. + // + AliRsnCutManager *mgr_step0 = new AliRsnCutManager("mc_step0", ""); + + // + // *** STEP 1 - All resonances which decay into tracked particles + // + // This step does not need any kind of definition, since + // its requirement is automatically checked during execution, + // but to avoid segfaults, it is better to initialize a cut manager. + // + AliRsnCutManager *mgr_step1 = new AliRsnCutManager("reco_step0", ""); + + // + // *** STEP 2 - Reconstruction & track quality + // + + AliRsnCutSet *set_step2 = new AliRsnCutSet("cuts_step2", AliRsnCut::kDaughter); + AliRsnCutManager *mgr_step2 = new AliRsnCutManager("esd_step2", ""); + + set_step2->AddCut(cuts2010[0][itask]); + set_step2->SetCutScheme(cuts2010[0][itask]->GetName()); + mgr_step2->SetCommonDaughterCuts(set_step2); + + // + // *** STEP 3 - PID + // + + AliRsnCutSet *set_step3 = new AliRsnCutSet("cuts_step3", AliRsnCut::kDaughter); + AliRsnCutManager *mgr_step3 = new AliRsnCutManager("esd_step3", ""); + + set_step3->AddCut(cuts2010[1][itask]); + set_step3->SetCutScheme(cuts2010[1][itask]->GetName()); + mgr_step3->SetCommonDaughterCuts(set_step3); + + // + // *** STEP 4 - Dip angle + // + + AliRsnCutSet *set_step4 = new AliRsnCutSet("cuts_step4", AliRsnCut::kMother); + AliRsnCutManager *mgr_step4 = new AliRsnCutManager("esd_step4", ""); + + set_step4->AddCut(cutDip); + set_step4->SetCutScheme(Form("!%s", cutDip->GetName())); + mgr_step4->SetMotherCuts(set_step4); + + // add all steps to the task + task[itask]->AddStepMC (mgr_step0); + task[itask]->AddStepESD(mgr_step1); + task[itask]->AddStepESD(mgr_step2); + task[itask]->AddStepESD(mgr_step3); + task[itask]->AddStepESD(mgr_step4); + + // add the task to the manager and connect to input + mgr->AddTask(task[itask]); + mgr->ConnectInput(task[itask], 0, mgr->GetCommonInputContainer()); + + // create paths for the output in the common file + TString infoname(task[itask]->GetName()); + TString histname(task[itask]->GetName()); + infoname.ReplaceAll("TaskEff", "Info"); + histname.ReplaceAll("TaskEff", "Hist"); + AliAnalysisDataContainer *outputInfo = mgr->CreateContainer(infoname.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, commonPath); + AliAnalysisDataContainer *outputHist = mgr->CreateContainer(histname.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, commonPath); + mgr->ConnectOutput(task[itask], 1, outputInfo); + mgr->ConnectOutput(task[itask], 2, outputHist); + } + + return kTRUE; +} diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsITS.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsITS.C new file mode 100644 index 00000000000..b5599d383bd --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsITS.C @@ -0,0 +1,25 @@ +// +// This macro is defined in order to have a unique point +// where the standard cuts are configured, in order to be sure +// that all common parts of the cuts will be defined coherently +// +void ConfigESDCutsITS(AliESDtrackCuts * &cuts) +{ + // general acceptance/pt cuts + cuts->SetPtRange(0.15, 10.0); + cuts->SetEtaRange(-0.8, 0.8); + + // DCA cuts + cuts->SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55"); + cuts->SetMaxDCAToVertexZ(2.0); + cuts->SetDCAToVertex2D(kFALSE); + cuts->SetRequireSigmaToVertex(kFALSE); + + // ITS related cuts for TPC+ITS tracks + cuts->SetRequireITSStandAlone(kTRUE); + cuts->SetRequireITSPureStandAlone(kFALSE); + cuts->SetRequireITSRefit(kTRUE); + cuts->SetMinNClustersITS(4); + cuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); + cuts->SetMaxChi2PerClusterITS(3.0); +} diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsTPC.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsTPC.C new file mode 100644 index 00000000000..f007d579ed0 --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsTPC.C @@ -0,0 +1,28 @@ +// +// This macro is defined in order to have a unique point +// where the standard cuts are configured, in order to be sure +// that all common parts of the cuts will be defined coherently +// +void ConfigESDCutsTPC(AliESDtrackCuts * &cuts) +{ + // general acceptance/pt cuts + cuts->SetPtRange(0.15, 10.0); + cuts->SetEtaRange(-0.8, 0.8); + + // DCA cuts + cuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0224/pt^1.78"); + cuts->SetMaxDCAToVertexZ(2.0); + cuts->SetDCAToVertex2D(kFALSE); + cuts->SetRequireSigmaToVertex(kFALSE); + + // TPC related cuts for TPC+ITS tracks + cuts->SetMinNClustersTPC(70); + cuts->SetMaxChi2PerClusterTPC(4); + cuts->SetAcceptKinkDaughters(kFALSE); + cuts->SetRequireTPCRefit(kTRUE); + + // ITS related cuts for TPC+ITS tracks + cuts->SetRequireITSRefit(kTRUE); + cuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); +} + diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C new file mode 100644 index 00000000000..853c72619a1 --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C @@ -0,0 +1,228 @@ +// +// 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. +// +// Generally speaking, one has to define the following objects for each resonance: +// +// 1 - an AliRsnPairDef to define the resonance decay channel to be studied +// 2 - an AliRsnPair{Ntuple|Functions} where the output is stored +// 3 - one or more AliRsnCut objects to define track selections +// which will have then to be organized into AliRsnCutSet objects +// 4 - an AliRsnCutManager to include all cuts to be applied (see point 3) +// 5 - definitions to build the TNtuple or histograms which are returned +// +// The return value is used to know if the configuration was successful +// +Bool_t RsnConfig +( + const char *taskName, + const char *options, + const char *config +) +{ + // load useful macros + gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsITS.C"); + gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsTPC.C"); + + // interpret the useful information from second argument + TString opt(options); + Bool_t isSim = opt.Contains("sim"); + Bool_t isData = opt.Contains("data"); + Bool_t isESD = opt.Contains("ESD"); + Bool_t isAOD = opt.Contains("AOD"); + + // interpret the specific info from third argument + // which should be fixed in the various calls to this function + TString opt(config); + Bool_t realPID = opt.Contains("realistic"); + Bool_t perfPID = opt.Contains("perfect"); + Bool_t addITSSA = opt.Contains("its"); + Bool_t dipAngleCut = opt.Contains("dip"); + Int_t typePID = 0; + if (realPID) typePID = 1; + else if (perfPID) typePID = 2; + + // info + const Char_t *pid[3] = {"nopid", "realistic", "perfect"}; + Info("RsnConfig2010PhiFcn", "=== Specific configuration: %s ===", config); + Info("RsnConfig2010PhiFcn", "--> PID : %s", pid[typePID]); + Info("RsnConfig2010PhiFcn", "--> ITS standalone: %s", (addITSSA ? "INCLUDED" : "EXCLUDED")); + Info("RsnConfig2010PhiFcn", "--> dip-angle cut : %s", (dipAngleCut ? "INCLUDED" : "EXCLUDED")); + + // generate a common suffix depending on chosen options + TString suffix(pid[typePID]); + if (addITSSA) suffix += "_sa"; else suffix += "_nosa"; + if (dipAngleCut) suffix += "_dip"; + Info("RsnConfig2010PhiFcn", "--> 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) + { + Error("RsnConfig2010PhiFcn", "Task not found"); + return kFALSE; + } + + // + // -- Setup pairs --------------------------------------------------------------------------------- + // + + // decay channels + AliRsnPairDef *pairDefPM = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455); + AliRsnPairDef *pairDefPP = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '+', 333, 1.019455); + AliRsnPairDef *pairDefMM = new AliRsnPairDef(AliPID::kKaon, '-', AliPID::kKaon, '-', 333, 1.019455); + + // computation objects + AliRsnPairFunctions *pairPM = new AliRsnPairFunctions(Form("PairPM_%s", suffix.Data()), pairDefPM); + AliRsnPairFunctions *truePM = new AliRsnPairFunctions(Form("TruePM_%s", suffix.Data()), pairDefPM); + AliRsnPairFunctions *pairPP = new AliRsnPairFunctions(Form("PairPP_%s", suffix.Data()), pairDefPP); + AliRsnPairFunctions *pairMM = new AliRsnPairFunctions(Form("PairMM_%s", suffix.Data()), pairDefMM); + + // + // -- Setup cuts ---------------------------------------------------------------------------------- + // + + // track cut ----------------------- + // --> global cuts for 2010 analysis + // --> most options are set to right values by default + AliRsnCutESD2010 *cuts2010_esd = new AliRsnCutESD2010(Form("cuts2010_esd_%s", suffix.Data())); + AliRsnCutAOD2010 *cuts2010_aod = new AliRsnCutAOD2010(Form("cuts2010_aod_%s", suffix.Data())); + // ----> set the flag for sim/data management (which sets some other options) + cuts2010_esd->SetMC(isSim); + cuts2010_aod->SetMC(isSim); + // ----> include or not the ITS standalone (TPC is always in) + cuts2010_esd->SetUseGlobal(kTRUE); + cuts2010_esd->SetUseITSSA (addITSSA); + cuts2010_aod->SetUseGlobal(kTRUE); + cuts2010_aod->SetUseITSSA (addITSSA); + // ----> require to check PID or not, depending on the label + if (realPID) + { + // if doing realistic PID, it must be activated + cuts2010_esd->SetCheckITS (kTRUE); + cuts2010_esd->SetCheckTPC (kTRUE); + cuts2010_esd->SetCheckTOF (kTRUE); + cuts2010_aod->SetCheckITS (kTRUE); + cuts2010_aod->SetCheckTPC (kTRUE); + cuts2010_aod->SetCheckTOF (kTRUE); + } + else + { + // otherwise (both for no pid and perfect PID) + // the PID cuts are deactivated + cuts2010_esd->SetCheckITS (kFALSE); + cuts2010_esd->SetCheckTPC (kFALSE); + cuts2010_esd->SetCheckTOF (kFALSE); + cuts2010_aod->SetCheckITS (kFALSE); + cuts2010_aod->SetCheckTPC (kFALSE); + cuts2010_aod->SetCheckTOF (kFALSE); + } + // ----> set all other defaults + ConfigESDCutsTPC(cuts2010_esd->GetCutsTPC()); + ConfigESDCutsITS(cuts2010_esd->GetCutsITS()); + + // track cut ----------------------------- + // --> perfect PID for check of PID issues + AliRsnCutPID *cutPID = new AliRsnCutPID("cutPID", AliPID::kKaon, 0.0, kTRUE); + + // pair cut ---------------------- + // --> dip angle between daughters + AliRsnCutStd *cutDip = new AliRsnCutStd("cutDip", AliRsnCut::kMother, AliRsnCutStd::kDipAngle, 0.02, 1.1); + + // cut set for tracks------------------------ + // --> only common cuts for tracks are needed + // --> standard 2010 cuts are applied always + TString cutSchemeTrack; + AliRsnCutSet *cutSetDaughterCommon = new AliRsnCutSet("commonDaughterCuts", AliRsnCut::kDaughter); + if (isESD) + { + cutSetDaughterCommon->AddCut(cuts2010_esd); + cutSchemeTrack += cuts2010_esd->GetName(); + } + else if (isAOD) + { + cutSetDaughterCommon->AddCut(cuts2010_aod); + cutSchemeTrack += cuts2010_aod->GetName(); + } + else + { + Error("Required ESD or AOD"); + return kFALSE; + } + if (perfPID) + { + cutSetDaughterCommon->AddCut(cutPID); + cutSchemeTrack += "&cutPID"; + } + cutSetDaughterCommon->SetCutScheme(cutSchemeTrack.Data()); + + // cut set for pairs--------------------------------------- + // --> add dip angle cut (but then include only if required) + AliRsnCutSet *cutSetPair = new AliRsnCutSet("cutsPair", AliRsnCut::kMother); + cutSetPair->AddCut(cutDip); + cutSetPair->SetCutScheme(cutDip->GetName()); + + // configure cut managers ------------------- + // --> track cuts are always defined, so add them by default + pairPM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon); + truePM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon); + pairPP->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon); + pairMM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon); + // --> pair cut is added only when dip angle cut is required + if (dipAngleCut) + { + pairPM->GetCutManager()->SetMotherCuts(cutSetPair); + truePM->GetCutManager()->SetMotherCuts(cutSetPair); + pairPP->GetCutManager()->SetMotherCuts(cutSetPair); + pairMM->GetCutManager()->SetMotherCuts(cutSetPair); + } + + // set additional option for true pairs when needed + truePM->SetOnlyTrue (kTRUE); + truePM->SetCheckDecay(kTRUE); + + // + // -- Setup functions ----------------------------------------------------------------------------- + // + + // function axes + Double_t pt [] = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0, 10.0}; + Double_t y [] = {-1.0, -0.9, -0.8, -0.7, -0.6, -0.5, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}; + Double_t mult[] = {0.0, 5.0, 9.0, 14.0, 22.0, 100000.0}; + Int_t npt = sizeof(pt ) / sizeof(pt [0]); + Int_t ny = sizeof(y ) / sizeof(y [0]); + Int_t nmult = sizeof(mult) / sizeof(mult[0]); + AliRsnValue *axisIM = new AliRsnValue("IM" , AliRsnValue::kPairInvMass , 1000 , 0.9, 1.9); + AliRsnValue *axisPt = new AliRsnValue("PT" , AliRsnValue::kPairPt , npt , pt); + AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY , ny , y); + AliRsnValue *axisMult = new AliRsnValue("Mult", AliRsnValue::kEventMultESDcuts, nmult, mult); + ConfigESDCutsTPC(axisMult->GetCuts()); + + // create function and add axes + AliRsnFunction *fcnImPtY = new AliRsnFunction; + fcnImPtY->AddAxis(axisIM); + fcnImPtY->AddAxis(axisPt); + fcnImPtY->AddAxis(axisY); + fcnImPtY->AddAxis(axisMult); + + // add functions to pairs + pairPM->AddFunction(fcnImPtY); + truePM->AddFunction(fcnImPtY); + pairPP->AddFunction(fcnImPtY); + pairMM->AddFunction(fcnImPtY); + + // + // -- Conclusion ---------------------------------------------------------------------------------- + // + + // add all created AliRsnPair objects to the AliRsnAnalysisManager in the task + task->GetAnalysisManager()->Add(pairPM); + task->GetAnalysisManager()->Add(pairPP); + task->GetAnalysisManager()->Add(pairMM); + if (isSim) task->GetAnalysisManager()->Add(truePM); + + return kTRUE; +} diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipNoSA.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipNoSA.C new file mode 100644 index 00000000000..deabdd7f4fa --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipNoSA.C @@ -0,0 +1,12 @@ +// +// Configuration: (see loaded macro for details) +// +// - PID: realistic (full) +// - ITS: not included +// - dip: included +// +Bool_t RsnConfigDipNoSA(const char *taskName, const char *options) +{ + gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C"); + return RsnConfig(taskName, options, "realistic+dip"); +} diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipSA.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipSA.C new file mode 100644 index 00000000000..0502806bb69 --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigDipSA.C @@ -0,0 +1,12 @@ +// +// Configuration: (see loaded macro for details) +// +// - PID: realistic (full) +// - ITS: included +// - dip: included +// +Bool_t RsnConfigDipSA(const char *taskName, const char *options) +{ + gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C"); + return RsnConfig(taskName, options, "realistic+its+dip"); +} diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigMC.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigMC.C new file mode 100644 index 00000000000..7e8e9f96f73 --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigMC.C @@ -0,0 +1,120 @@ +// +// 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. +// +// Generally speaking, one has to define the following objects for each resonance: +// +// 1 - an AliRsnPairDef to define the resonance decay channel to be studied +// 2 - an AliRsnPair{Ntuple|Functions} where the output is stored +// 3 - one or more AliRsnCut objects to define track selections +// which will have then to be organized into AliRsnCutSet objects +// 4 - an AliRsnCutManager to include all cuts to be applied (see point 3) +// 5 - definitions to build the TNtuple or histograms which are returned +// +// The return value is used to know if the configuration was successful +// +Bool_t RsnConfigMC(const char *taskName, const char *options) +{ + // info + Info("RsnConfig2010PhiFcnMC", "Starting configuration"); + + // retrieve analysis manager & task + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + AliRsnAnalysisSE *task = (AliRsnAnalysisSE*)mgr->GetTask(taskName); + + // for safety, return if no task is passed + if (!task) + { + Error("ConfigTaskRsn", "Task not found"); + return kFALSE; + } + + // interpret the useful information from second argument + TString opt(options); + Bool_t isMC = opt.Contains("MC"); + Bool_t isSim = opt.Contains("sim"); + Bool_t isData = opt.Contains("data"); + Bool_t isPass1 = opt.Contains("pass1"); + Bool_t isPass2 = opt.Contains("pass2"); + if (!isMC) + { + Info("RsnConfig2010PhiFcnMC", "Config skipped for not pure MonteCarlo samples"); + return kTRUE; + } + + // + // -- Setup pairs --------------------------------------------------------------------------------- + // + + // decay channels + AliRsnPairDef *pairDefPM = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455); + AliRsnPairDef *pairDefPP = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '+', 333, 1.019455); + AliRsnPairDef *pairDefMM = new AliRsnPairDef(AliPID::kKaon, '-', AliPID::kKaon, '-', 333, 1.019455); + + // computation objects + AliRsnPairFunctions *pairPM = new AliRsnPairFunctions("PairPM_mc", pairDefPM); + AliRsnPairFunctions *truePM = new AliRsnPairFunctions("TruePM_mc", pairDefPM); + AliRsnPairFunctions *pairPP = new AliRsnPairFunctions("PairPP_mc", pairDefPP); + AliRsnPairFunctions *pairMM = new AliRsnPairFunctions("PairMM_mc", pairDefMM); + + // + // -- Setup cuts ---------------------------------------------------------------------------------- + // + + // track cut ----------------------------- + // --> perfect PID for check of PID issues + AliRsnCutPID *cutPID = new AliRsnCutPID("cutPID", AliPID::kKaon, 0.0, kTRUE); + + // cut sets --------------------------------- + // --> only common cuts for tracks are needed + // --> standard 2010 cuts are applied only when working on ESD + AliRsnCutSet *cutSetDaughterCommon = new AliRsnCutSet("commonDaughterCuts", AliRsnCut::kDaughter); + cutSetDaughterCommon->AddCut(cutPID); + cutSetDaughterCommon->SetCutScheme("cutPID"); + cout << "Cut scheme: " << cutSetDaughterCommon->GetCutScheme() << endl; + + // configure cut managers ------------------- + pairPM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon); + truePM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon); + pairPP->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon); + pairMM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon); + + // set additional option for true pairs when needed + truePM->SetOnlyTrue (kTRUE); + truePM->SetCheckDecay(kTRUE); + + // + // -- Setup functions ----------------------------------------------------------------------------- + // + + // function axes + Double_t y[] = {-0.8, -0.7, -0.6, -0.5, 0.5, 0.6, 0.7, 0.8}; + Int_t ny = sizeof(y) / sizeof(y[0]); + AliRsnValue *axisIM = new AliRsnValue("IM", AliRsnValue::kPairInvMass, 2000, 0.9, 2.9); + AliRsnValue *axisPt = new AliRsnValue("PT", AliRsnValue::kPairPt, 100, 0.0, 10.0); + AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY, ny, y); + + // create function and add axes + AliRsnFunction *fcnImPtY = new AliRsnFunction; + fcnImPtY->AddAxis(axisIM); + fcnImPtY->AddAxis(axisPt); + fcnImPtY->AddAxis(axisY); + + // add functions to pairs + pairPM->AddFunction(fcnImPtY); + truePM->AddFunction(fcnImPtY); + pairPP->AddFunction(fcnImPtY); + pairMM->AddFunction(fcnImPtY); + + // + // -- Conclusion ---------------------------------------------------------------------------------- + // + + // add all created AliRsnPair objects to the AliRsnAnalysisManager in the task + task->GetAnalysisManager()->Add(pairPM); + task->GetAnalysisManager()->Add(pairPP); + task->GetAnalysisManager()->Add(pairMM); + task->GetAnalysisManager()->Add(truePM); + + return kTRUE; +} diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigNoSA.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigNoSA.C new file mode 100644 index 00000000000..1b752457fd5 --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigNoSA.C @@ -0,0 +1,12 @@ +// +// Configuration: (see loaded macro for details) +// +// - PID: realistic (full) +// - ITS: not included +// - dip: not included +// +Bool_t RsnConfigNoSA(const char *taskName, const char *options) +{ + gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C"); + return RsnConfig(taskName, options, "realistic"); +} diff --git a/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigSA.C b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigSA.C new file mode 100644 index 00000000000..f6a48c17571 --- /dev/null +++ b/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfigSA.C @@ -0,0 +1,12 @@ +// +// Configuration: (see loaded macro for details) +// +// - PID: realistic (full) +// - ITS: included +// - dip: not included +// +Bool_t RsnConfigSA(const char *taskName, const char *options) +{ + gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/RsnConfig.C"); + return RsnConfig(taskName, options, "realistic+its"); +} -- 2.39.3