From e1d6ee8e877d981b72347486668704ac7b20cf76 Mon Sep 17 00:00:00 2001 From: miweber Date: Thu, 14 Jun 2012 15:22:04 +0000 Subject: [PATCH] BalanceFunction analysis in 1D: Update of conversion/HBT cuts; PID for AOD analysis included --- .../BalanceFunctions/AliAnalysisTaskBF.cxx | 10 +- PWGCF/EBYE/BalanceFunctions/AliBalance.cxx | 39 +- .../macros/AddTaskBalanceCentralityTrain.C | 37 +- .../macros/configBalanceFunctionAnalysis.C | 5 +- PWGCF/EBYE/macros/runBalanceFunctionPID.C | 487 ++++++++++++++++++ 5 files changed, 543 insertions(+), 35 deletions(-) create mode 100644 PWGCF/EBYE/macros/runBalanceFunctionPID.C diff --git a/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBF.cxx b/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBF.cxx index 173d60b23c0..66c58c9a681 100755 --- a/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBF.cxx +++ b/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBF.cxx @@ -711,7 +711,8 @@ void AliAnalysisTaskBF::UserExec(Option_t *) { continue; } Int_t gID = aodTrack->GetID(); - if (!aodTrack->TestFilterBit(nAODtrackCutBit)) trackMap->Add(gID, iTracks); + //if (!aodTrack->TestFilterBit(nAODtrackCutBit)) trackMap->Add(gID, iTracks); + if (aodTrack->TestFilterBit(1)) trackMap->Add(gID, iTracks); } AliAODTrack* newAodTrack; //===========================================// @@ -724,17 +725,16 @@ void AliAnalysisTaskBF::UserExec(Option_t *) { continue; } - // AOD track cuts - + // AOD track cuts // For ESD Filter Information: ANALYSIS/macros/AddTaskESDfilter.C - //===========================================// // take only TPC only tracks fHistTrackStats->Fill(aodTrack->GetFilterMap()); if(!aodTrack->TestFilterBit(nAODtrackCutBit)) continue; + Int_t gID = aodTrack->GetID(); newAodTrack = gID >= 0 ? aodTrack : gAOD->GetTrack(trackMap->GetValue(-1-gID)); - Printf("Label: %d - Pt: %lf (old) - %d - Pt: %lf(new)",gID,aodTrack->Pt(), newAodTrack->GetID(), newAodTrack->Pt()); + //Printf("Label: %d - Pt: %lf (old) - %d - Pt: %lf(new)",gID,aodTrack->Pt(), newAodTrack->GetID(), newAodTrack->Pt()); //===========================================// //fHistTrackStats->Fill(aodTrack->GetFilterMap()); diff --git a/PWGCF/EBYE/BalanceFunctions/AliBalance.cxx b/PWGCF/EBYE/BalanceFunctions/AliBalance.cxx index 9cf48c81a47..f0b4f9a8144 100644 --- a/PWGCF/EBYE/BalanceFunctions/AliBalance.cxx +++ b/PWGCF/EBYE/BalanceFunctions/AliBalance.cxx @@ -346,9 +346,9 @@ void AliBalance::CalculateBalance(Float_t fCentrality,vector **chargeV px2 = chargeVector[4]->at(j); py2 = chargeVector[5]->at(j); pz2 = chargeVector[6]->at(j); - pt2 = chargeVector[7]->at(i); + pt2 = chargeVector[7]->at(j); energy2 = chargeVector[8]->at(j); - + // filling the arrays // RAPIDITY @@ -394,7 +394,7 @@ void AliBalance::CalculateBalance(Float_t fCentrality,vector **chargeV if(dphi>180) dphi = 360 - dphi; //dphi should be between 0 and 180! // HBT like cut - if(bHBTcut){ + if(bHBTcut && charge1 * charge2 > 0){ //if( dphi < 3 || deta < 0.01 ){ // VERSION 1 // continue; @@ -405,20 +405,25 @@ void AliBalance::CalculateBalance(Float_t fCentrality,vector **chargeV // optimization if (TMath::Abs(deta) < 0.02 * 2.5 * 3) //twoTrackEfficiencyCutValue = 0.02 [default for dphicorrelations] { + + // phi in rad + Float_t phi1rad = phi1*TMath::DegToRad(); + Float_t phi2rad = phi2*TMath::DegToRad(); + // check first boundaries to see if is worth to loop and find the minimum - Float_t dphistar1 = GetDPhiStar(phi1*TMath::DegToRad(), pt1, charge1, phi2*TMath::DegToRad(), pt2, charge2, 0.8, bSign); - Float_t dphistar2 = GetDPhiStar(phi1*TMath::DegToRad(), pt1, charge1, phi2*TMath::DegToRad(), pt2, charge2, 2.5, bSign); + Float_t dphistar1 = GetDPhiStar(phi1rad, pt1, charge1, phi2rad, pt2, charge2, 0.8, bSign); + Float_t dphistar2 = GetDPhiStar(phi1rad, pt1, charge1, phi2rad, pt2, charge2, 2.5, bSign); const Float_t kLimit = 0.02 * 3; Float_t dphistarminabs = 1e5; Float_t dphistarmin = 1e5; - if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0) + + if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0 ) { for (Double_t rad=0.8; rad<2.51; rad+=0.01) { - Float_t dphistar = GetDPhiStar(phi1*TMath::DegToRad(), pt1, charge1, phi2*TMath::DegToRad(), pt2, charge2, rad, bSign); - + Float_t dphistar = GetDPhiStar(phi1rad, pt1, charge1, phi2rad, pt2, charge2, rad, bSign); Float_t dphistarabs = TMath::Abs(dphistar); if (dphistarabs < dphistarminabs) @@ -427,10 +432,10 @@ void AliBalance::CalculateBalance(Float_t fCentrality,vector **chargeV dphistarminabs = dphistarabs; } } - + if (dphistarminabs < 0.02 && TMath::Abs(deta) < 0.02) { - //Printf("Removed track pair %d %d with %f %f %f %f %d %f %f %d %f", i, j, deta, dphistarminabs, phi1, pt1, charge1, phi2, pt2, charge2, bSign); + //AliInfo(Form("HBT: Removed track pair %d %d with [[%f %f]] %f %f %f | %f %f %d %f %f %d %f", i, j, deta, dphi, dphistarminabs, dphistar1, dphistar2, phi1rad, pt1, charge1, phi2rad, pt2, charge2, bSign)); continue; } } @@ -443,6 +448,10 @@ void AliBalance::CalculateBalance(Float_t fCentrality,vector **chargeV { Float_t m0 = 0.510e-3; Float_t tantheta1 = 1e10; + + // phi in rad + Float_t phi1rad = phi1*TMath::DegToRad(); + Float_t phi2rad = phi2*TMath::DegToRad(); if (eta1 < -1e-10 || eta1 > 1e-10) tantheta1 = 2 * TMath::Exp(-eta1) / ( 1 - TMath::Exp(-2*eta1)); @@ -453,11 +462,11 @@ void AliBalance::CalculateBalance(Float_t fCentrality,vector **chargeV Float_t e1squ = m0 * m0 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1); Float_t e2squ = m0 * m0 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2); - - Float_t mass = 2 * m0 * m0 + 2 * ( TMath::Sqrt(e1squ * e2squ) - ( pt1 * pt2 * ( TMath::Cos(phi1 - phi2) + 1.0 / tantheta1 / tantheta2 ) ) ); - - if (mass < 0.04*0.04){ - //Printf("Removed track pair %d %d with %f %f %d %d ", i, j, deta, mass, charge1, charge2); + + Float_t masssqu = 2 * m0 * m0 + 2 * ( TMath::Sqrt(e1squ * e2squ) - ( pt1 * pt2 * ( TMath::Cos(phi1rad - phi2rad) + 1.0 / tantheta1 / tantheta2 ) ) ); + + if (masssqu < 0.04*0.04){ + //AliInfo(Form("Conversion: Removed track pair %d %d with [[%f %f] %f %f] %d %d <- %f %f %f %f %f %f ", i, j, deta, dphi, masssqu, charge1, charge2,eta1,eta2,phi1,phi2,pt1,pt2)); continue; } } diff --git a/PWGCF/EBYE/macros/AddTaskBalanceCentralityTrain.C b/PWGCF/EBYE/macros/AddTaskBalanceCentralityTrain.C index f6d7d8eac57..9301340b3ee 100644 --- a/PWGCF/EBYE/macros/AddTaskBalanceCentralityTrain.C +++ b/PWGCF/EBYE/macros/AddTaskBalanceCentralityTrain.C @@ -9,9 +9,9 @@ //=============================================// //PID config -Bool_t kUseNSigmaPID = kFALSE; +Bool_t kUseNSigmaPID = kTRUE; Double_t nSigmaMax = 3.0; -Bool_t kUseBayesianPID = kTRUE; +Bool_t kUseBayesianPID = kFALSE; Double_t gMinAcceptedProbability = 0.7; //_________________________________________________________// @@ -87,8 +87,9 @@ AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(Double_t centrMin=0., ::Error("AddTaskBF", "This task requires an input event handler"); return NULL; } - TString analysisType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" - if(dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())) analysisType = "MC"; + TString analysisType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" or "MC" + if(dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())) analysisType = "AOD"; + // for local changed BF configuration //gROOT->LoadMacro("./configBalanceFunctionAnalysis.C"); @@ -97,16 +98,16 @@ AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(Double_t centrMin=0., AliBalance *bfs = 0; // shuffled Balance function object if (analysisType=="ESD"){ - bf = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut); - if(gRunShuffling) bfs = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut); + bf = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut,kUsePID); + if(gRunShuffling) bfs = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut,kUsePID); } else if (analysisType=="AOD"){ - bf = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut); - if(gRunShuffling) bfs = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut); + bf = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut,kUsePID); + if(gRunShuffling) bfs = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut,kUsePID); } else if (analysisType=="MC"){ - bf = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut); - if(gRunShuffling) bfs = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut); + bf = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut,kUsePID); + if(gRunShuffling) bfs = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut,kUsePID); } else{ ::Error("AddTaskBF", "analysis type NOT known."); @@ -128,8 +129,8 @@ AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(Double_t centrMin=0., taskBF->SetUseBayesianPID(gMinAcceptedProbability); else if(kUseNSigmaPID) taskBF->SetUseNSigmaPID(nSigmaMax); - taskBF->SetParticleOfInterest(AliAnalysistaskBF::kProton); - taskBF->SetDetectorUsedForPID(AliAnalysisTaskBF::kTOFpid); + taskBF->SetParticleOfInterest(AliAnalysisTaskBF::kPion); + taskBF->SetDetectorUsedForPID(AliAnalysisTaskBF::kTPCpid); } } else if(analysisType == "AOD") { @@ -140,6 +141,16 @@ AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(Double_t centrMin=0., // set extra DCA cuts (-1 no extra cut) taskBF->SetExtraDCACutsAOD(DCAxy,DCAz); + // PID + if(kUsePID) { + if(kUseBayesianPID) + taskBF->SetUseBayesianPID(gMinAcceptedProbability); + else if(kUseNSigmaPID) + taskBF->SetUseNSigmaPID(nSigmaMax); + taskBF->SetParticleOfInterest(AliAnalysisTaskBF::kPion); + taskBF->SetDetectorUsedForPID(AliAnalysisTaskBF::kTPCpid); + } + // set extra TPC chi2 / nr of clusters cut taskBF->SetExtraTPCCutsAOD(maxTPCchi2, minNClustersTPC); @@ -180,7 +191,7 @@ AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(Double_t centrMin=0., mgr->ConnectOutput(taskBF, 1, coutQA); mgr->ConnectOutput(taskBF, 2, coutBF); if(gRunShuffling) mgr->ConnectOutput(taskBF, 3, coutBFS); - if(kUsePID && analysisType == "ESD") mgr->ConnectOutput(taskBF, 4, coutQAPID); + if(kUsePID) mgr->ConnectOutput(taskBF, 4, coutQAPID); return taskBF; } diff --git a/PWGCF/EBYE/macros/configBalanceFunctionAnalysis.C b/PWGCF/EBYE/macros/configBalanceFunctionAnalysis.C index d5ed4dbee3d..13e3b0ca34f 100644 --- a/PWGCF/EBYE/macros/configBalanceFunctionAnalysis.C +++ b/PWGCF/EBYE/macros/configBalanceFunctionAnalysis.C @@ -5,7 +5,8 @@ AliBalance *GetBalanceFunctionObject(const char* analysisLevel = "ESD", Double_t centrMax = 100., Bool_t bShuffle = kFALSE, Bool_t bHBTcut = kFALSE, - Bool_t bConversionCut = kFALSE) { + Bool_t bConversionCut = kFALSE, + Bool_t kUsePID = kTRUE) { //Function to setup the AliBalance object and return it AliBalance *gBalance = new AliBalance(); gBalance->SetAnalysisLevel(analysisLevel); @@ -27,7 +28,7 @@ AliBalance *GetBalanceFunctionObject(const char* analysisLevel = "ESD", //Qside gBalance->SetInterval(AliBalance::kQside,-1,1,100,0.0,2.0); //Qinv - gBalance->SetInterval(AliBalance::kQinv,-1,1,100,0.0,2.0); + gBalance->SetInterval(AliBalance::kQinv,-1,1,100,0.0,5.0); //Phi gBalance->SetInterval(AliBalance::kPhi,0.,360.,90,0.,180.0); diff --git a/PWGCF/EBYE/macros/runBalanceFunctionPID.C b/PWGCF/EBYE/macros/runBalanceFunctionPID.C new file mode 100644 index 00000000000..1caab057c9b --- /dev/null +++ b/PWGCF/EBYE/macros/runBalanceFunctionPID.C @@ -0,0 +1,487 @@ +// run.C +// +// Template run macro for AliBasicTask.cxx/.h with example layout of +// physics selections and options, in macro and task. +// +// Author: Arvinder Palaha +// +class AliAnalysisGrid; +class AliAnalysisTaskBF; +class AliBalance; + +//Centrality stuff +Int_t binfirst = 0; //where do we start numbering bins +Int_t binlast = 8; //where do we stop numbering bins +const Int_t numberOfCentralityBins = 9; +Float_t centralityArray[numberOfCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; // in centrality percentile + +//Systematic studies +const Int_t numberOfSyst = 13; +Float_t vZ[numberOfSyst] = {10.,12.,6.,8.,10.,10.,10.,10.,10.,10.,10.,10.,10.}; // global Vertex Z cut +Float_t DCAxy[numberOfSyst] = {-1.,2.4,2.4,2.4,2.2,2.0,1.8,2.4,2.4,2.4,2.4,2.4,2.4}; // DCA xy cut (afterburner, -1 = w/o additional cut) +Float_t DCAz[numberOfSyst] = {-1.,3.2,3.2,3.2,3.0,2.8,2.6,3.2,3.2,3.2,3.2,3.2,3.2}; // DCA z cut (afterburner, -1 = w/o additional cut) +Float_t ptMin[numberOfSyst] = {0.3,0.3,0.3,0.3,0.3,0.3,0.3,1.5,5.0,0.3,0.3,0.3,0.3}; // pt cuts +Float_t ptMax[numberOfSyst] = {1.5,1.5,1.5,1.5,1.5,1.5,1.5,5.0,10.0,10.0,1.5,1.5,1.5}; // pt cuts +Float_t etaMin[numberOfSyst] = {-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-0.8,-1.0,-0.6,-0.4}; // eta cuts +Float_t etaMax[numberOfSyst] = {0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,1.0,0.6,0.4}; // eta cuts +Bool_t kUsePID = kTRUE; + +//______________________________________________________________________________ +void runBalanceFunction( + const char* runtype = "local", // local, proof or grid + const char *gridmode = "", // Set the run mode (can be "full", "test", "offline", "submit", "terminate" or ""). Full & Test work for proof + const Int_t bunchN = 0, + const bool bAOD = 1, // 1 = AOD ANALYSIS, 0 = ESD ANALYSIS + const bool bMCtruth = 0, // 1 = MCEvent handler is on (MC truth), 0 = MCEvent handler is off (MC reconstructed/real data) + const bool bMCphyssel = 0, // 1 = looking at MC truth or reconstructed, 0 = looking at real data + const Long64_t nentries = 50000, // for local and proof mode, ignored in grid mode. Set to 1234567890 for all events. + const Long64_t firstentry = 0, // for local and proof mode, ignored in grid mode + TString proofdataset = "bunchPROOF", // path to dataset on proof cluster, for proof analysis + const char *proofcluster = "miweber@alice-caf.cern.ch", // which proof cluster to use in proof mode + const char *taskname = "BF_S3_pion_TOF" // sets name of grid generated macros + ) +{ + // check run type + if(runtype != "local" && runtype != "proof" && runtype != "grid"){ + Printf("\n\tIncorrect run option, check first argument of run macro"); + Printf("\tint runtype = local, proof or grid\n"); + return; + } + Printf("%s analysis chosen",runtype); + + // load libraries + gSystem->Load("libCore.so"); + gSystem->Load("libGeom.so"); + gSystem->Load("libVMC.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("libPWGCFebye.so"); + + // additional + + //compile standalone stuff + //gROOT->LoadMacro("$ALICE_ROOT/PWGCF/EBYE/BalanceFunction/AliBalance.cxx++g"); + //gROOT->LoadMacro("$ALICE_ROOT/PWGCF/EBYE/BalanceFunction/AliAnalysisTaskBF.cxx++g"); + + // add aliroot indlude path + //gROOT->ProcessLine(".include $PWD/."); + //gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT"))); + + gROOT->SetStyle("Plain"); + + // analysis manager + AliAnalysisManager* mgr = new AliAnalysisManager(Form("%s%i",taskname,bunchN)); + + if(runtype == "grid") { + // create the alien handler and attach it to the manager + AliAnalysisGrid *plugin = CreateAlienHandler(bAOD,bunchN,Form("%s%i",taskname,bunchN), gridmode, proofcluster, Form("%s_%d.txt",proofdataset.Data(),bunchN)); + mgr->SetGridHandler(plugin); + } + + // input handler (ESD or AOD) + AliVEventHandler* inputH = NULL; + if(!bAOD){ + inputH = new AliESDInputHandler(); + } + else{ + inputH = new AliAODInputHandler(); + } + mgr->SetInputEventHandler(inputH); + + //===================================================// + TChain *chain; + if(gridmode=="") { + chain = new TChain("aodTree"); // "esdTree" or "aodTree" + //chain->Add( "POINT TO YOUR LOCAL ESD" ); + chain -> Add("/glusterfs/alice1/alice3/alisrm/PbPbPID/AODsData/1/AliAOD.root"); + chain -> Add("/glusterfs/alice1/alice3/alisrm/PbPbPID/AODsData/2/AliAOD.root"); + chain -> Add("/glusterfs/alice1/alice3/alisrm/PbPbPID/AODsData/3/AliAOD.root"); + chain -> Add("/glusterfs/alice1/alice3/alisrm/PbPbPID/AODsData/4/AliAOD.root"); + chain -> Add("/glusterfs/alice1/alice3/alisrm/PbPbPID/AODsData/5/AliAOD.root"); + chain -> Add("/glusterfs/alice1/alice3/alisrm/PbPbPID/AODsData/6/AliAOD.root"); + chain -> Add("/glusterfs/alice1/alice3/alisrm/PbPbPID/AODsData/7/AliAOD.root"); + chain -> Add("/glusterfs/alice1/alice3/alisrm/PbPbPID/AODsData/8/AliAOD.root"); + chain -> Add("/glusterfs/alice1/alice3/alisrm/PbPbPID/AODsData/9/AliAOD.root"); + } + //===================================================// + + + + // mc event handler + if(bMCtruth) { + AliMCEventHandler* mchandler = new AliMCEventHandler(); + // Not reading track references + mchandler->SetReadTR(kFALSE); + mgr->SetMCtruthEventHandler(mchandler); + } + + //AOD output handler + if(bAOD){ + AliAODHandler* aodoutHandler = new AliAODHandler(); + aodoutHandler->SetOutputFileName("aod.root"); + mgr->SetOutputEventHandler(aodoutHandler); + } + + // === Physics Selection Task === + // + // In SelectCollisionCandidate(), default is kMB, so the task UserExec() + // function is only called for these events. + // Options are: + // kMB Minimum Bias trigger + // kMBNoTRD Minimum bias trigger where the TRD is not read out + // kMUON Muon trigger + // kHighMult High-Multiplicity Trigger + // kUserDefined For manually defined trigger selection + // + // Multiple options possible with the standard AND/OR operators && and || + // These all have the usual offline SPD or V0 selections performed. + // + // With a pointer to the physics selection object using physSelTask->GetPhysicsSelection(), + // one can manually set the selected and background classes using: + // AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL") + // AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL"); + // + // One can also specify multiple classes at once, or require a class to NOT + // trigger, for e.g. + // AddBGTriggerClass("+CSMBA-ABCE-NOPF-ALL -CSMBB-ABCE-NOPF-ALL"); + // + // NOTE that manually setting the physics selection overrides the standard + // selection, so it must be done in completeness. + // + // ALTERNATIVELY, one can make the physics selection inside the task + // UserExec(). + // For this case, comment out the task->SelectCol.... line, + // and see AliBasicTask.cxx UserExec() function for details on this. + + //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); + //AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel); + //if(!physSelTask) { Printf("no physSelTask"); return; } + //AliPhysicsSelection *physSel = physSelTask->GetPhysicsSelection(); + //physSel->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL");// #3119 #769"); + + // create task + + //Add the centrality determination task and the physics selection + + // (only on ESD level, in AODs centrality is already in header and events are selected) + if(!bAOD){ + gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C"); + AliCentralitySelectionTask *taskCentrality = AddTaskCentrality(); + + // Add physics selection task (NOT needed for AODs) + gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); + AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(bMCphyssel); + //Add the PID response + //if(kUsePID) { + //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); + //AddTaskPIDResponse(bMCphyssel); + //} + + } + + if(kUsePID) { + gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); + AddTaskPIDResponse(bMCphyssel); + } + + //Add the BF task (all centralities) + gROOT->LoadMacro("AddTaskBalanceCentralityTrain.C"); + AliAnalysisTaskBF *task = AddTaskBalanceCentralityTrain(0.,100.,kTRUE,"V0M",vZ[0],DCAxy[0],DCAz[0],ptMin[0],ptMax[0],etaMin[0],etaMax[0],-1,-1); + + // enable debug printouts + //mgr->SetDebugLevel(2); + //mgr->SetUseProgressBar(1,100); + if (!mgr->InitAnalysis()) return; + mgr->PrintStatus(); + + // start analysis + Printf("Starting Analysis...."); + if(runtype == "local") + mgr->StartAnalysis(runtype,chain); + else + mgr->StartAnalysis(runtype,nentries,firstentry); +} + + + +//______________________________________________________________________________ +AliAnalysisGrid* CreateAlienHandler(Bool_t bAOD, Int_t bunchN, const char *taskname, const char *gridmode, const char *proofcluster, const char *proofdataset) +{ + AliAnalysisAlien *plugin = new AliAnalysisAlien(); + // Set the run mode (can be "full", "test", "offline", "submit" or "terminate") + plugin->SetRunMode(gridmode); + + // Set versions of used packages + plugin->SetAPIVersion("V1.1x"); + plugin->SetROOTVersion("v5-33-02b"); + plugin->SetAliROOTVersion("v5-03-19-AN"); + + // Declare input data to be processed. + + // Method 1: Create automatically XML collections using alien 'find' command. + // Define production directory LFN + plugin->SetGridDataDir("/alice/data/2010/LHC10h/"); + // On real reconstructed data: + // plugin->SetGridDataDir("/alice/data/2009/LHC09d"); + + // Set data search pattern + //plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES + // Data pattern for reconstructed data + if(!bAOD){ + plugin->SetDataPattern("*ESDs/pass2/*ESDs.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH + } + else{ + plugin->SetDataPattern("*ESDs/pass2/AOD049/*/AliAOD.root"); + } + + plugin->SetRunPrefix("000"); // real data + // ...then add run numbers to be considered + //plugin->SetRunRange(114917,115322); + + if(bunchN==0){ + plugin->AddRunNumber(137366); + } + + //bunch1 + else if(bunchN == 1){ + plugin->AddRunNumber(139510); + plugin->AddRunNumber(139507); + plugin->AddRunNumber(139505); + plugin->AddRunNumber(139503); + plugin->AddRunNumber(139465); + plugin->AddRunNumber(139438); + plugin->AddRunNumber(139437); + plugin->AddRunNumber(139360); + plugin->AddRunNumber(139329); + plugin->AddRunNumber(139328); + } + + //bunch2 + else if(bunchN == 2){ + plugin->AddRunNumber(139314); + plugin->AddRunNumber(139310); + plugin->AddRunNumber(139309); + plugin->AddRunNumber(139173); + plugin->AddRunNumber(139107); + plugin->AddRunNumber(139105); + plugin->AddRunNumber(139038); + plugin->AddRunNumber(139037); + plugin->AddRunNumber(139036); + plugin->AddRunNumber(139029); + plugin->AddRunNumber(139028); + plugin->AddRunNumber(138872); + plugin->AddRunNumber(138871); + plugin->AddRunNumber(138870); + plugin->AddRunNumber(138837); + plugin->AddRunNumber(138732); + plugin->AddRunNumber(138730); + plugin->AddRunNumber(138666); + plugin->AddRunNumber(138662); + plugin->AddRunNumber(138653); + } + + else if(bunchN == 3){ + plugin->AddRunNumber(138652); + plugin->AddRunNumber(138638); + plugin->AddRunNumber(138624); + plugin->AddRunNumber(138621); + plugin->AddRunNumber(138583); + plugin->AddRunNumber(138582); + plugin->AddRunNumber(138579); + plugin->AddRunNumber(138578); + plugin->AddRunNumber(138534); + plugin->AddRunNumber(138469); + } + + else if(bunchN == 4){ + + plugin->AddRunNumber(138442); + plugin->AddRunNumber(138439); + plugin->AddRunNumber(138438); + plugin->AddRunNumber(138396); + plugin->AddRunNumber(138364); + plugin->AddRunNumber(138275); + plugin->AddRunNumber(138225); + plugin->AddRunNumber(138201); + plugin->AddRunNumber(138197); + plugin->AddRunNumber(138192); + } + + else if(bunchN == 5){ + + plugin->AddRunNumber(138190); + plugin->AddRunNumber(137848); + plugin->AddRunNumber(137844); + plugin->AddRunNumber(137752); + plugin->AddRunNumber(137751); + plugin->AddRunNumber(137724); + plugin->AddRunNumber(137722); + plugin->AddRunNumber(137718); + plugin->AddRunNumber(137704); + plugin->AddRunNumber(137693); + } + + else if(bunchN == 6){ + + plugin->AddRunNumber(137692); + plugin->AddRunNumber(137691); + plugin->AddRunNumber(137686); + plugin->AddRunNumber(137685); + plugin->AddRunNumber(137639); + plugin->AddRunNumber(137638); + plugin->AddRunNumber(137608); + plugin->AddRunNumber(137595); + plugin->AddRunNumber(137549); + plugin->AddRunNumber(137546); + + } + + else if(bunchN == 7){ + + plugin->AddRunNumber(137544); + plugin->AddRunNumber(137541); + plugin->AddRunNumber(137539); + plugin->AddRunNumber(137531); + plugin->AddRunNumber(137530); + plugin->AddRunNumber(137443); + plugin->AddRunNumber(137441); + plugin->AddRunNumber(137440); + plugin->AddRunNumber(137439); + plugin->AddRunNumber(137434); + + } + + else if(bunchN == 8){ + + plugin->AddRunNumber(137432); + plugin->AddRunNumber(137431); + plugin->AddRunNumber(137430); + plugin->AddRunNumber(137366); + plugin->AddRunNumber(137243); + plugin->AddRunNumber(137236); + plugin->AddRunNumber(137235); + plugin->AddRunNumber(137232); + plugin->AddRunNumber(137231); + plugin->AddRunNumber(137162); + plugin->AddRunNumber(137161); + } + + else{ + + stderr<<"BUNCH NOT THERE"<AddRunList("139510, 139507, 139505, 139503, 139465, 139438, 139437, 139360, 139329, 139328, 139314, 139310, 139309, 139173, 139107, 139105, 139038, 139037, 139036, 139029, 139028, 138872, 138871, 138870, 138837, 138732, 138730, 138666, 138662, 138653, 138652, 138638, 138624, 138621, 138583, 138582, 138579, 138578, 138534, 138469, 138442, 138439, 138438, 138396, 138364, 138275, 138225, 138201, 138197, 138192, 138190, 137848, 137844, 137752, 137751, 137724, 137722, 137718, 137704, 137693, 137692, 137691, 137686, 137685, 137639, 137638, 137608, 137595, 137549, 137546, 137544, 137541, 137539, 137531, 137530, 137443, 137441, 137440, 137439, 137434, 137432, 137431, 137430, 137366, 137243, 137236, 137235, 137232, 137231, 137162, 137161"); + + + + + + plugin->SetNrunsPerMaster(1); + plugin->SetOutputToRunNo(); + // comment out the next line when using the "terminate" option, unless + // you want separate merged files for each run + plugin->SetMergeViaJDL(); + + // Method 2: Declare existing data files (raw collections, xml collections, root file) + // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir()) + // XML collections added via this method can be combined with the first method if + // the content is compatible (using or not tags) + // plugin->AddDataFile("tag.xml"); + // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root"); + + // Define alien work directory where all files will be copied. Relative to alien $HOME. + plugin->SetGridWorkingDir(taskname); + + // Declare alien output directory. Relative to working directory. + plugin->SetGridOutputDir("out"); // In this case will be $HOME/taskname/out + + // Declare the analysis source files names separated by blancs. To be compiled runtime + // using ACLiC on the worker nodes. + // plugin->SetAnalysisSource("AliBalance.cxx AliAnalysisTaskBF.cxx"); + + // Declare all libraries (other than the default ones for the framework. These will be + // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here. + //plugin->AddIncludePath("-I."); + plugin->SetAdditionalLibs("libPWGCFebye.so"); + //plugin->SetAdditionalLibs("AliBalance.cxx AliBalance.h AliAnalysisTaskBF.cxx AliAnalysisTaskBF.h"); + + // Declare the output file names separated by blancs. + // (can be like: file.root or file.root@ALICE::Niham::File) + // To only save certain files, use SetDefaultOutputs(kFALSE), and then + // SetOutputFiles("list.root other.filename") to choose which files to save + plugin->SetDefaultOutputs(); + //plugin->SetOutputFiles("list.root"); + + // Optionally set a name for the generated analysis macro (default MyAnalysis.C) + plugin->SetAnalysisMacro(Form("%s.C",taskname)); + + // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore) + plugin->SetSplitMaxInputFileNumber(100); + + // Optionally modify the executable name (default analysis.sh) + plugin->SetExecutable(Form("%s.sh",taskname)); + + // set number of test files to use in "test" mode + plugin->SetNtestFiles(1); + + // Optionally resubmit threshold. + plugin->SetMasterResubmitThreshold(90); + + // Optionally set time to live (default 30000 sec) + plugin->SetTTL(90000); + + // Optionally set input format (default xml-single) + plugin->SetInputFormat("xml-single"); + + // Optionally modify the name of the generated JDL (default analysis.jdl) + plugin->SetJDLName(Form("%s.jdl",taskname)); + + // Optionally modify job price (default 1) + plugin->SetPrice(1); + + // Optionally modify split mode (default 'se') + plugin->SetSplitMode("se"); + + //plugin->SetUseSubmitPolicy(); + //plugin->SetKeepLogs(); + + //---------------------------------------------------------- + //--- PROOF MODE SPECIFIC SETTINGS ------------ + //---------------------------------------------------------- + // Proof cluster + plugin->SetProofCluster(proofcluster); + // Dataset to be used + plugin->SetProofDataSet(proofdataset); + // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard + plugin->SetProofReset(0); + // May limit number of workers + plugin->SetNproofWorkers(0); + // May limit the number of workers per slave + plugin->SetNproofWorkersPerSlave(1); + // May use a specific version of root installed in proof + plugin->SetRootVersionForProof("current"); + // May set the aliroot mode. Check http://aaf.cern.ch/node/83 + plugin->SetAliRootMode("default"); // Loads AF libs by default + // May request ClearPackages (individual ClearPackage not supported) + plugin->SetClearPackages(kFALSE); + // Plugin test mode works only providing a file containing test file locations, used in "local" mode also + plugin->SetFileForTestMode("files.txt"); // file should contain path name to a local directory containg *ESDs.root etc + // Request connection to alien upon connection to grid + plugin->SetProofConnectGrid(kFALSE); + + plugin->Print(); + + return plugin; +} + + -- 2.39.3