From 295b65bfe4e64cb53359e8c7bf01a0bb8a73234b Mon Sep 17 00:00:00 2001 From: fbellini Date: Thu, 30 Jan 2014 09:48:36 +0100 Subject: [PATCH] Added analysis config macros for L* analysis in p-Pb (Sarita) --- .../RESONANCES/macros/mini/AddTaskLStarPPb.C | 176 ++++++++++++++++++ .../macros/mini/AnalysisSetupLStarPPb.C | 176 ++++++++++++++++++ PWGLF/RESONANCES/macros/mini/ConfigLStarPPb.C | 121 ++++++++++++ 3 files changed, 473 insertions(+) create mode 100644 PWGLF/RESONANCES/macros/mini/AddTaskLStarPPb.C create mode 100644 PWGLF/RESONANCES/macros/mini/AnalysisSetupLStarPPb.C create mode 100644 PWGLF/RESONANCES/macros/mini/ConfigLStarPPb.C diff --git a/PWGLF/RESONANCES/macros/mini/AddTaskLStarPPb.C b/PWGLF/RESONANCES/macros/mini/AddTaskLStarPPb.C new file mode 100644 index 00000000000..f3228945918 --- /dev/null +++ b/PWGLF/RESONANCES/macros/mini/AddTaskLStarPPb.C @@ -0,0 +1,176 @@ +// +// General macro to configure the RSN analysis task. +// It calls all configs desired by the user, by means +// of the boolean switches defined in the first lines. +// --- +// Inputs: +// 1) flag to know if running on MC or data +// 2) path where all configs are stored +// --- +// Returns: +// kTRUE --> initialization successful +// kFALSE --> initialization failed (some config gave errors) +// + +Bool_t useLStar = 1; + + +AliRsnMiniAnalysisTask * AddTaskLStarPPb +( + Bool_t isMC, + Bool_t isPP, + const char *path, + Int_t nmix = 0 +) +{ + // + // -- INITIALIZATION ---------------------------------------------------------------------------- + // + + //------------------------------------------- + // event cuts + //------------------------------------------- + UInt_t triggerMask = AliVEvent::kINT7; + Bool_t rmFirstEvtChunk = kTRUE; //needed for pA 2013 + Bool_t rejectPileUp = kTRUE; //best if used, for pA 2013 + Int_t MinPlpContribSPD = 5; //default value if used + Bool_t useMVPileUpSelection = kFALSE; // + Int_t MinPlpContribMV = 5; //default value if used + Bool_t useVtxCut2013pA = kTRUE; //default use recommended 2013 pA vtx selection + Double_t vtxZcut = 10.0; //cm, default cut on vtx z + + + + // retrieve analysis manager + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + + // create the task and connect with physics selection + AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask("RSN", isMC); + + //task->UseESDTriggerMask(triggerMask); //ESD + task->SelectCollisionCandidates(triggerMask); //AOD + + // settings + if (isPP) + task->UseMultiplicity("QUALITY"); + else + task->UseCentrality("V0M"); + + // set mixing + task->UseContinuousMix(); + //task->UseBinnedMix(); + task->SetNMix(nmix); + task->SetMaxDiffVz(1.0); + task->SetMaxDiffMult(10.0); + //task->SetMaxDiffAngle(20); + // if (!isPP) task->SetMaxDiffAngle(20.0*TMath::DegToRad()); //set angle diff in rad + + mgr->AddTask(task); + + // + // -- EVENT CUTS (same for all configs) --------------------------------------------------------- + // + + // cut on primary vertex: + // - 2nd argument --> |Vz| range + // - 3rd argument --> minimum required number of contributors + // - 4th argument --> tells if TPC stand-alone vertexes must be accepted + AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", vtxZcut, 0, kFALSE); + + // set the check for pileup + //if (isPP) cutVertex->SetCheckPileUp(kTRUE); + + //set check for pileup in 2013 ############# + + AliRsnCutEventUtils *cutEventUtils = new AliRsnCutEventUtils("cutEventUtils", rmFirstEvtChunk, rejectPileUp); + cutEventUtils->SetUseVertexSelection2013pA(useVtxCut2013pA); + ::Info("AddTaskLStarPPb", Form(":::::::::::::::::: Vertex cut as pA 2013: %s", (useVtxCut2013pA?"ON":"OFF"))); + if (useMVPileUpSelection){ + cutEventUtils->SetUseMVPlpSelection(useMVPileUpSelection); + cutEventUtils->SetMinPlpContribMV(MinPlpContribMV); + cutEventUtils->SetMinPlpContribSPD(MinPlpContribSPD); + ::Info("AddTaskLStarPPb", Form("Multiple-vtx Pile-up rejection settings: MinPlpContribMV = %i, MinPlpContribSPD = %i", MinPlpContribMV, MinPlpContribSPD)); + } else { + cutEventUtils->SetMinPlpContribSPD(MinPlpContribSPD); + ::Info("AddTaskLStarPPb", Form("SPD Pile-up rejection settings: MinPlpContribSPD = %i", MinPlpContribSPD)); + } + ::Info("AddTaskLStarPPb", Form(":::::::::::::::::: Pile-up rejection mode: %s", (rejectPileUp?"ON":"OFF"))); + ::Info("AddTaskLStarPPb", Form("::::::::::::: Remove first event in chunk: %s", (rmFirstEvtChunk?"ON":"OFF"))); + + + + + // define and fill cut set + AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent); + eventCuts->AddCut(cutEventUtils); + eventCuts->AddCut(cutVertex); + eventCuts->SetCutScheme(Form("%s&%s", cutEventUtils->GetName(), cutVertex->GetName())); + //eventCuts->SetCutScheme(cutVertex->GetName()); + + // set cuts in task + task->SetEventCuts(eventCuts); + + // + // -- EVENT-ONLY COMPUTATIONS ------------------------------------------------------------------- + // + + // second argument tells if the value must be taken from MC + // (when this can be done) + // after creating the value, the task returns its ID + + // VERTEX POSITION + Int_t vertexID = task->CreateValue(AliRsnMiniValue::kVz, kFALSE); + AliRsnMiniOutput *outVertex = task->CreateOutput("eventVertex", "HIST", "EVENT"); + outVertex->AddAxis(vertexID, 400, -20.0, 20.0); + + + // initialize value computation for multiplicity/centrality + Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE); + AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT"); + // set axes, by passing value ID and defining the binning + if (isPP) + outMult->AddAxis(multID, 300, 0.0, 300.0); + else + outMult->AddAxis(multID, 100, 0.0, 100.0); + +// TH2F* hvz=new TH2F("hVzVsCent","", 100, 0., 100., 240, -12.0, 12.0); +// task->SetEventQAHist("vz",hvz);//plugs this histogram into the fHAEventVz data member + +// TH2F* hmc=new TH2F("MultiVsCent","", 400, 0., 400., 400, 0., 400.); +// hmc->GetYaxis()->SetTitle("QUALITY"); +// task->SetEventQAHist("multicent",hmc);//plugs this histogram into the fHAEventMultiCent data member + + + // + // -- PAIR CUTS (common to all resonances) ------------------------------------------------------ + // + + AliRsnCutMiniPair *cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange); + //cutY->SetRangeD(-0.5, 0.5); + cutY->SetRangeD(-0.465, 0.035);// 0 < y_cm < 0.5; y_cm = y_lab + 0.465 + + AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother); + cutsPair->AddCut(cutY); + cutsPair->SetCutScheme(cutY->GetName()); + + // + // -- CONFIGS ----------------------------------------------------------------------------------- + // + + + if (useLStar) { + gROOT->LoadMacro(Form("%s/ConfigLStarPPb.C", path)); + ConfigLStarPPb(task, isMC, isPP, "LStar", cutsPair); + } + + // + // -- CONTAINERS -------------------------------------------------------------------------------- + // + + const char *file = AliAnalysisManager::GetCommonFileName(); + AliAnalysisDataContainer *output = mgr->CreateContainer("RsnOut", TList::Class(), AliAnalysisManager::kOutputContainer, file); + mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); + mgr->ConnectOutput(task, 1, output); + + return task; +} diff --git a/PWGLF/RESONANCES/macros/mini/AnalysisSetupLStarPPb.C b/PWGLF/RESONANCES/macros/mini/AnalysisSetupLStarPPb.C new file mode 100644 index 00000000000..363e42b8794 --- /dev/null +++ b/PWGLF/RESONANCES/macros/mini/AnalysisSetupLStarPPb.C @@ -0,0 +1,176 @@ +/* Macro for setup of Lambda* analysis in PPb collisions. +// Created by Sarita Sahoo, 30 Jan. 2014 +// +// +// This macro sets all the aspects of configuration of an Analysis Train run +// which are always the same for all kinds of analysis (local, PROOF, AliEn) +// +// Inputs: +// +// - nmix = number of mixings to do (if > 0, initialize mixing stuff) +// - options = a set of keywords which drive some configurations +// - outputFileName = name of file produced by train +// - configPath = a path where all required config macros are stored +// +// Notes: +// +// - in case the source is an ESD, and if inputs are a MC production +// the MC input handler is created by default +// +// Returns: +// +// - if successful: the name of the expected input TTree (esdTree or aodTree) +// - if failed : NULL +*/ + +TString Setup +( + Int_t nmix, + const char *options, + const char *outputFileName, + const char *macroPath = "." +) +{ + + + // prepare output + TString out(""); + + // + // === EXAMINE OPTIONS ========================================================================== + // + + // this is done using the utility 'RsnOptions.C' + // which provides a unique way to interpret them + + TString opt(options); + opt.ToUpper(); + + Bool_t isMC = opt.Contains("MC") || (!opt.Contains("DATA")); + Bool_t isPP = opt.Contains("PP") || (!opt.Contains("PBPB")); + Bool_t isESD = opt.Contains("ESD"); + Bool_t useTender = opt.Contains("TENDER"); + Bool_t noV0 = opt.Contains("NOV0"); + + // + // === LOAD LIBRARIES =========================================================================== + // + + // load analysis libraries + gSystem->Load("libCore.so"); + gSystem->Load("libGeom.so"); + gSystem->Load("libVMC.so"); + gSystem->Load("libMinuit.so"); + gSystem->Load("libPhysics.so"); + gSystem->Load("libTree.so"); + gSystem->Load("libSTEERBase.so"); + gSystem->Load("libESD.so"); + gSystem->Load("libAOD.so"); + gSystem->Load("libANALYSIS.so"); + gSystem->Load("libANALYSISalice.so"); + gSystem->Load("libEventMixing.so"); + gSystem->Load("libCORRFW.so"); + gSystem->Load("libPWGLFresonances.so"); + + + // tender-related libraries + if (isESD && useTender) { + ::Info("AnalysisSetup", "Loading tender libraries"); + gSystem->Load("libTENDER.so"); + gSystem->Load("libTENDERSupplies.so"); + } else if (!isESD) { + useTender = kFALSE; + } + + // load development RSN library + if (!AliAnalysisAlien::SetupPar("PWGLFresonances.par")) return ""; + + // + // === CREATE ANALYSIS MANAGER ================================================================== + // + + AliAnalysisManager *mgr = new AliAnalysisManager("RsnAnalysisManager"); + mgr->SetCommonFileName(outputFileName); + ::Info("AnalysisSetup", "Common file name: %s", outputFileName); + + // + // === INPUT / OUTPUT HANDLER CONFIGURATION ===================================================== + // + + if (isESD) { + out = "esdTree"; + ::Info("AnalysisSetup", "Creating ESD handler"); + AliESDInputHandler *esdHandler = new AliESDInputHandler(); + mgr->SetInputEventHandler(esdHandler); + if (isMC) { + ::Info("AnalysisSetup", "Creating MC handler"); + AliMCEventHandler *mcHandler = new AliMCEventHandler(); + mgr->SetMCtruthEventHandler(mcHandler); + } + } else { + out = "aodTree"; + ::Info("AnalysisSetup", "Creating AOD handler"); + AliAODInputHandler *aodHandler = new AliAODInputHandler(); + mgr->SetInputEventHandler(aodHandler); + } + + // + // === TENDER TASK (ESD only -- optional) ======================================================= + // + + if (isESD && useTender) { + ::Info("AnalysisSetup", "Adding tender (and then accepting V0 info)", options); + gROOT->LoadMacro(Form("%s/AddTaskTender.C", macroPath)); + AddTaskTender(); + noV0 = kFALSE; + } + + // + // === PHYSICS SELECTION (ESD only) ============================================================= + // + + if (isESD) { + ::Info("AnalysisSetup", "Add physics selection by default on ESD analysis"); + gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPhysicsSelection.C"); + AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC); + if (noV0) { + ::Info("AnalysisSetup", "Skip of V0 info is required"); + physSelTask->GetPhysicsSelection()->SetSkipV0(kTRUE); + } + } + + // + // === CENTRALITY/PLANE (ESD only) ============================================================== + // + if (isESD && !isPP) { + ::Info("AnalysisSetup", "Add centrality and event plane computation tasks"); + gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskCentrality.C"); + gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskEventplane.C"); + AliCentralitySelectionTask* taskCentrality = (AliCentralitySelectionTask*)AddTaskCentrality(); + if (isMC) { + ::Info("AnalysisSetup", "Setting centrality computation for MC"); + taskCentrality->SetMCInput(); + } + AddTaskEventplane(); + } + // + // === PID RESPONSE ============================================================================= + // + + gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDResponse.C"); + AddTaskPIDResponse(isMC,kTRUE,kTRUE); + + //gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDqa.C "); + //AddTaskPIDqa(); + + // + // === OTHER TASKS ============================================================================== + // + + // add RSN task + gROOT->LoadMacro(Form("%s/AddTaskLStarPPb.C", macroPath)); + if (!AddTaskLStarPPb(isMC, isPP, macroPath, nmix)) return ""; + + ::Info("AnalysisSetup", "Setup successful"); + return out; +} diff --git a/PWGLF/RESONANCES/macros/mini/ConfigLStarPPb.C b/PWGLF/RESONANCES/macros/mini/ConfigLStarPPb.C new file mode 100644 index 00000000000..46732de9ac8 --- /dev/null +++ b/PWGLF/RESONANCES/macros/mini/ConfigLStarPPb.C @@ -0,0 +1,121 @@ +// +// *** Configuration script for Lambda*->P+K- analysis with 2010 runs *** +// +// A configuration script for RSN package needs to define the followings: +// +// (1) decay tree of each resonance to be studied, which is needed to select +// true pairs and to assign the right mass to all candidate daughters +// (2) cuts at all levels: single daughters, tracks, events +// (3) output objects: histograms or trees +// +Bool_t ConfigLStarPPb +( + AliRsnMiniAnalysisTask *task, + Bool_t isMC, + Bool_t isPP, + const char *suffix, + AliRsnCutSet *cutsPair +) +{ + // manage suffix + if (strlen(suffix) > 0) suffix = Form("_%s", suffix); + //if (strlen(suffix) > 0) suffix = "suffix_"; + + //////////////// + + Int_t aodFilterBit = 10; + + + /////////////// + + // + // -- Define track cuts ------------------------------------------------------------------------- + // + Float_t nSigmaTPC=2.0; + gROOT->LoadMacro("AddMonitorOutput.C"); + + + AliRsnCutSetDaughterParticle * cutP; + cutP = new AliRsnCutSetDaughterParticle("P_LStar",AliRsnCutSetDaughterParticle::kTPCpidMatchPPB2011 , AliPID::kProton, nSigmaTPC, aodFilterBit); + + AliRsnCutSetDaughterParticle * cutK; + cutK = new AliRsnCutSetDaughterParticle("K_LStar",AliRsnCutSetDaughterParticle::kTPCpidMatchPPB2011 , AliPID::kKaon, nSigmaTPC, aodFilterBit); + + + //Int_t iCutQ = task->AddTrackCuts(cutQ); + Int_t iCutP = task->AddTrackCuts(cutP); + Int_t iCutK = task->AddTrackCuts(cutK); + + //AddMonitorOutput(isMC, cutQ->GetMonitorOutput(),"NoSIGN"); + AddMonitorOutput(isMC, cutP->GetMonitorOutput(),"NoSIGN"); + AddMonitorOutput(isMC, cutK->GetMonitorOutput(),"NoSIGN"); + + + // + // -- Values ------------------------------------------------------------------------------------ + // + + /* invariant mass */ Int_t imID = task->CreateValue(AliRsnMiniValue::kInvMass, kFALSE); + /* IM resolution */ Int_t resID = task->CreateValue(AliRsnMiniValue::kInvMassRes, kTRUE); + /* transv. momentum */ Int_t ptID = task->CreateValue(AliRsnMiniValue::kPt, kFALSE); + /* centrality */ Int_t centID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE); + + // + // -- Create all needed outputs ----------------------------------------------------------------- + // + + // use an array for more compact writing, which are different on mixing and charges + // [0] = unlike + // [1] = mixing + // [2] = like ++ + // [3] = like -- + Bool_t use [12] = { 1 , 1 , 1 , 1 , 1 , 1 , isMC , isMC , isMC , isMC , isMC , isMC }; + Bool_t useIM [12] = { 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1}; + TString name [12] = {"Unlike1", "Unlike2", "Mixing1", "Mixing2", "LikePP", "LikeMM", "Trues1", "Trues2", "Res1" , "Res2" ,"Mother1", "Mother2"}; + TString comp [12] = {"PAIR" , "PAIR" , "MIX" , "MIX" , "PAIR" , "PAIR" , "TRUE" , "TRUE" , "TRUE" , "TRUE" , "MOTHER", "MOTHER"}; + TString output [12] = {"SPARSE" , "SPARSE" , "SPARSE" , "SPARSE" , "SPARSE", "SPARSE", "SPARSE", "SPARSE", "SPARSE", "SPARSE", "SPARSE", "SPARSE" }; + Char_t charge1 [12] = {'+' , '-' , '+' , '-' , '+' , '-' , '+' , '-' , '+' , '-' , '+' , '-'}; + Char_t charge2 [12] = {'-' , '+' , '-' , '+' , '+' , '-' , '-' , '+' , '-' , '+' , '-' , '+'}; + Int_t cutID1 [12] = { iCutP , iCutP , iCutP , iCutP , iCutP , iCutP , iCutP , iCutP , iCutP , iCutP , iCutP , iCutP }; + Int_t cutID2 [12] = { iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK }; + /////// + + + //////// + for (Int_t i = 0; i < 12; i++) { + if (!use[i]) continue; + // create output + AliRsnMiniOutput *out = task->CreateOutput(Form("Lstar_%s%s", name[i].Data(), suffix), output[i].Data(), comp[i].Data()); + // selection settings + out->SetCutID(0, cutID1[i]); + out->SetCutID(1, cutID2[i]); + out->SetDaughter(0, AliRsnDaughter::kProton); + out->SetDaughter(1, AliRsnDaughter::kKaon); + out->SetCharge(0, charge1[i]); + out->SetCharge(1, charge2[i]); + out->SetMotherPDG(3124); + out->SetMotherMass(1.5195); + // pair cuts + out->SetPairCuts(cutsPair); + // axis X: invmass (or resolution) + if (useIM[i]) + out->AddAxis(imID, 900, 1.3, 2.2); + else + out->AddAxis(resID, 200, -0.02, 0.02); + // axis Y: transverse momentum + out->AddAxis(ptID, 1000, 0.0, 100.0); + // axis Z: centrality-multiplicity + //if (!isPP) + // out->AddAxis(centID, 100, 0.0, 100.0); + //else + // out->AddAxis(centID, 400, 0.0, 400.0); + + // axis W: pseudorapidity + // out->AddAxis(etaID, 20, -1.0, 1.0); + // axis J: rapidity + // out->AddAxis(yID, 10, -0.5, 0.5); + + } + + return kTRUE; +} -- 2.43.0