AliAnalysisTaskJetCluster *AddTaskJetCluster(char* bRec,char* bGen ,UInt_t filterMask,UInt_t iPhysicsSelectionFlag,Char_t *jf,Float_t radius,Int_t nSkip,Int_t kWriteAOD,char *deltaFile,Float_t ptTrackCut,Float_t etaTrackWindow,Float_t vertexWindow,Int_t nSkipCone,Int_t dice,Int_t smear,Bool_t useOADB,Double_t changeEfficiencyFraction) { // Creates a jet fider task, configures it and adds it to the analysis manager. kPtTrackCutCl = ptTrackCut; kTrackEtaWindowCl = etaTrackWindow; kVertexWindowCl = vertexWindow; TString outputFile(deltaFile); // Get the pointer to the existing analysis manager via the static access method. //============================================================================== AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { ::Error("AddTaskJetCluster", "No analysis manager to connect to."); return NULL; } // Check the analysis type using the event handlers connected to the analysis manager. //============================================================================== if (!mgr->GetInputEventHandler()) { ::Error("AddTaskJetCluster", "This task requires an input event handler"); return NULL; } TString type = mgr->GetInputEventHandler()->GetDataType(); TString typeRec(bRec); TString typeGen(bGen); if(!typeRec.Contains("AODextra") && !typeRec.Contains("AODMCextra")) { typeGen.ToUpper(); typeRec.ToUpper(); } cout << "typeRec: " << typeRec << endl; // Create the task and configure it. //=========================================================================== TString cAdd = ""; cAdd += Form("%02d_",(int)((radius+0.01)*10.)); cAdd += Form("B%d",(int)kBackgroundModeCl); cAdd += Form("_Filter%05d",filterMask); cAdd += Form("_Cut%05d",(int)(1000.*kPtTrackCutCl)); cAdd += Form("_Skip%02d",nSkip); if(dice>0 || smear>0) cAdd += Form("Detector%d%dFr%d",dice,smear,(int)(changeEfficiencyFraction*100.)); Printf("%s %E %d %d",cAdd.Data(),kPtTrackCutCl,dice,smear); AliAnalysisTaskJetCluster* clus = new AliAnalysisTaskJetCluster(Form("JetCluster%s_%s%s",bRec,jf,cAdd.Data())); // or a config file // clus->SetAnalysisType(AliAnalysisTaskJetCluster::kAnaMC); // if(iAODanalysis)clus->SetAODInput(kTRUE); // clus->SetDebugLevel(11); clus->SetFilterMask(filterMask); // clus->SetUseGlobalSelection(kTRUE); clus->SetVtxCuts(kVertexWindowCl,1); if(type == "AOD"){ // Assume all jet are produced already clus->SetAODTrackInput(kTRUE); clus->SetAODMCInput(kTRUE); } if (typeRec.Contains("AODMCHF")){ clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCHF); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if(typeRec.Contains("AODMC2b")){// work down from the top AODMC2b -> AODMC2 -> AODMC -> AOD clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCChargedAcceptance); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AODMC2")){ clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCCharged); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(5); } else if (typeRec.Contains("AODMCextraonly")) { clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCextraonly); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AODMCextra")) { clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCextra); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AODMC")){ clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCAll); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(5); } else if (typeRec.Contains("AODextraonly")) { clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODextraonly); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AODextra")) { clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODextra); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AOD")) { clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAOD); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } clus->SetRparam(radius); clus->SetGhostArea(0.005); clus->SetGhostEtamax(kTrackEtaWindowCl); switch (jf) { case "ANTIKT": clus->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh break; case "CA": clus->SetAlgorithm(1); // CA from fastjet/JetDefinition.hh break; case "KT": clus->SetAlgorithm(0); // kt from fastjet/JetDefinition.hh break; default: ::Error("AddTaskJetCluster", "Wrong jet finder selected\n"); return 0; } if(kWriteAOD){ if(outputFile.Length())clus->SetJetOutputFile(outputFile); clus->SetJetOutputBranch(Form("clusters%s_%s%s",bRec,jf,cAdd.Data())); clus->SetJetOutputMinPt(0); // store only jets / clusters above a certain threshold } clus->SetNSkipLeadingRan(nSkip); clus->SetNSkipLeadingCone(nSkipCone); if(iPhysicsSelectionFlag)clus->SelectCollisionCandidates(iPhysicsSelectionFlag); if(useOADB) { clus->SetUseTrResolutionFromOADB(); clus->SetUseTrEfficiencyFromOADB(); clus->SetChangeEfficiencyFraction(changeEfficiencyFraction); } mgr->AddTask(clus); // Create ONLY the output containers for the data produced by the task. // Get and connect other common input/output containers via the manager as below //============================================================================== AliAnalysisDataContainer *coutput1_clus = mgr->CreateContainer(Form("cluster_%s_%s_%s%s",bRec,bGen,jf,cAdd.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWGJE_cluster_%s_%s_%s%s",AliAnalysisManager::GetCommonFileName(),bRec,bGen,jf,cAdd.Data())); mgr->ConnectInput (clus, 0, mgr->GetCommonInputContainer()); mgr->ConnectOutput (clus, 0, mgr->GetCommonOutputContainer()); mgr->ConnectOutput (clus, 1, coutput1_clus ); return clus; }
//______________________________________________________________________________ void AddAnalysisTasks(const char *cdb_location) { // Add all analysis task wagons to the train AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); // // Tender and supplies. Needs to be called for every event. // AliAnalysisManager::SetCommonFileName("AODQA.root"); if (useTender) { gROOT->LoadMacro("$ALICE_PHYSICS/ANALYSIS/TenderSupplies/AddTaskTender.C"); // IF V0 tender needed, put kTRUE below AliAnalysisTaskSE *tender = AddTaskTender(useV0tender); // tender->SetDebugLevel(2); } // Clean Geometry: Ruben // gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/CalibMacros/commonMacros/CleanGeom.C++"); // CleanGeom* clgmTask = new CleanGeom("cleanGeom"); // mgr->AddTask(clgmTask); // AliAnalysisDataContainer *dummyInp = mgr->GetCommonInputContainer(); // if (dummyInp) mgr->ConnectInput(clgmTask,0,dummyInp); // // PIDResponse(JENS) // if (doPIDResponse) { gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); AliAnalysisTaskPIDResponse *PIDResponse = AddTaskPIDResponse(); // PIDResponse->SetUserDataRecoPass(1); // PIDResponse->SelectCollisionCandidates(AliVEvent::kAny); } // // PIDqa(JENS) // if (doPIDqa) { gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C"); AliAnalysisTaskPIDqa *PIDQA = AddTaskPIDqa(); PIDQA->SelectCollisionCandidates(AliVEvent::kAny); } // CDB connection // if (doCDBconnect && !useTender) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskCDBconnect.C"); AliTaskCDBconnect *taskCDB = AddTaskCDBconnect(cdb_location, 0 /*run_number*/); if (!taskCDB) return; AliCDBManager *cdb = AliCDBManager::Instance(); cdb->SetDefaultStorage(cdb_location); // taskCDB->SetRunNumber(run_number); } if (usePhysicsSelection) { // Physics selection task gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C"); mgr->RegisterExtraFile("event_stat.root"); AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(useMC); mgr->AddStatisticsTask(AliVEvent::kAny); } //Jacek if (iPWGPP) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskFilteredTree.C"); AddTaskFilteredTree("FilterEvents_Trees.root"); } // Centrality if (useCentrality) { if ( run_flag >= 1500 ) { gROOT->LoadMacro("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros/AddTaskMultSelection.C"); AliMultSelectionTask *taskMult = AddTaskMultSelection(); } else { // old scheme is only valid for PbPb if ( iCollision == kPbPb ) { gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C"); AliCentralitySelectionTask *taskCentrality = AddTaskCentrality(); //taskCentrality->SelectCollisionCandidates(AliVEvent::kAny); } } } // --- PWGLF - Forward ([email protected]) ----------------------------- if (iPWGLFForward && usePhysicsSelection) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/AddTaskForwardMult.C"); UShort_t pwglfForwardSys = 0; // iCollision+1; // pp:1, PbPb:2, pPb:3 UShort_t pwglfSNN = 0; // GeV, 0==unknown Short_t pwglfField = 0; AddTaskForwardMult(useMC && useTR, // Need track-refs pwglfForwardSys, // Collision system pwglfSNN, pwglfField); gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/AddTaskCentralMult.C"); AddTaskCentralMult(useMC, pwglfForwardSys, pwglfSNN, pwglfField); } //PWGAgammaconv if (iPWGGAgammaconv) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGGA/GammaConv/macros/AddTask_ConversionAODProduction.C"); Int_t dataset=iCollision; if( iCollision == kXeXe) dataset=kPbPb; if( iCollision == kPbp || iCollision == kpPb ) dataset=2; AliAnalysisTask *taskconv = AddTask_ConversionAODProduction(dataset, kFALSE, periodName); mgr->RegisterExtraFile("AliAODGammaConversion.root"); } if (iESDfilter) { // ESD filter task configuration. gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/ESDfilter/macros/AddTaskESDFilter.C"); if (iMUONcopyAOD) { printf("Registering delta AOD file\n"); mgr->RegisterExtraFile("AliAOD.Muons.root"); } Bool_t muonWithSPDTracklets = (iCollision==kPbPb || iCollision==kXeXe) ? kFALSE : kTRUE; // add SPD information to muon AOD only for pp AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, iMUONcopyAOD, // write Muon AOD kFALSE, // write dimuon AOD kFALSE, // usePhysicsSelection kFALSE, // centrality OBSOLETE kTRUE, // enable TPS only tracks kFALSE, // disable cascades kFALSE, // disable kinks run_flag, // run flag (YY00) 3, // muonMCMode //kTRUE, // useV0Filter kFALSE, // useV0Filter - turned off for PCM to make sense muonWithSPDTracklets, isMuonCaloPass, iPWGGAgammaconv); // Add PCMV0 AliEMCALGeometry::GetInstance("",""); } // ********** PWG3 wagons ****************************************************** // PWGHF vertexing if (iPWGHFvertexing) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGHF/vertexingHF/macros/AddTaskVertexingHF.C"); Int_t configHF=0; if(iCollision == kPbPb || iCollision == kXeXe) configHF=1; AliAnalysisTaskSEVertexingHF *taskvertexingHF = AddTaskVertexingHF(configHF,train_name,"",run_number,periodName); // Now we need to keep in sync with the ESD filter if (!taskvertexingHF) ::Warning("AnalysisTrainNew", "AliAnalysisTaskSEVertexingHF cannot run for this train conditions - EXCLUDED"); else mgr->RegisterExtraFile("AliAOD.VertexingHF.root"); taskvertexingHF->SelectCollisionCandidates(0); } // PWGDQ JPSI filtering (only pp) if (iPWGDQJPSIfilter && (iCollision==kpp)) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGDQ/dielectron/macros/AddTaskJPSIFilter.C"); AliAnalysisTaskSE *taskJPSIfilter = AddTaskJPSIFilter(); if (!taskJPSIfilter) ::Warning("AnalysisTrainNew", "AliAnalysisTaskDielectronFilter cannot run for this train conditions - EXCLUDED"); else mgr->RegisterExtraFile("AliAOD.Dielectron.root"); taskJPSIfilter->SelectCollisionCandidates(0); } // PWGHF D2h if (iPWGHFd2h) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGHF/vertexingHF/AddD2HTrain.C"); AddD2HTrain(kFALSE, 1,0,0,0,0,0,0,0,0,0,0); } // ********** PWG4 wagons ****************************************************** // Jet analysis // Configurations flags, move up? TString kDeltaAODJetName = "AliAOD.Jets.root"; // Bool_t kIsPbPb = (iCollision==kPbPb || iCollision==kXeXe); TString kDefaultJetBackgroundBranch = ""; TString kJetSubtractBranches = ""; UInt_t kHighPtFilterMask = 272;// from esd filter UInt_t iPhysicsSelectionFlag = 0; if (iJETAN) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/macros/AddTaskJets.C"); // Default jet reconstructor running on ESD's AliAnalysisTaskJets *taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction if (!taskjets) ::Fatal("AnalysisTrainNew", "AliAnalysisTaskJets cannot run for this train conditions - EXCLUDED"); if(kDeltaAODJetName.Length()>0) taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data()); if (iJETANdelta) { // AddTaskJetsDelta("AliAOD.Jets.root"); // need to modify this accordingly in the add task jets mgr->RegisterExtraFile(kDeltaAODJetName.Data()); TString cTmp(""); if(kIsPbPb){ // UA1 intrinsic background subtraction taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,2); // background subtraction if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data()); } // SICONE taskjets = AddTaskJets("AOD","SISCONE",0.4,kHighPtFilterMask,0.15,0); //no background subtration to be done later.... if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data()); cTmp = taskjets->GetNonStdBranch(); if(cTmp.Length()>0)kJetSubtractBranches += Form("%s ",cTmp.Data()); // Add the clusters.. gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/macros/AddTaskJetCluster.C"); AliAnalysisTaskJetCluster *taskCl = 0; Float_t fCenUp = 0; Float_t fCenLo = 0; Float_t fTrackEtaWindow = 0.9; taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow,0); // this one is for the background and random jets, random cones with no skip taskCl->SetBackgroundCalc(kTRUE); taskCl->SetNRandomCones(10); taskCl->SetCentralityCut(fCenLo,fCenUp); taskCl->SetGhostEtamax(fTrackEtaWindow); kDefaultJetBackgroundBranch = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch()); taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,2,1,kDeltaAODJetName.Data(),0.15); taskCl->SetCentralityCut(fCenLo,fCenUp); if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); taskCl->SetNRandomCones(10); kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch()); taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.2,0,1,kDeltaAODJetName.Data(),0.15); taskCl->SetCentralityCut(fCenLo,fCenUp); if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch()); // DO THE BACKGROUND SUBTRACTION if(kIsPbPb&&kJetSubtractBranches.Length()){ gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/macros/AddTaskJetBackgroundSubtract.C"); AliAnalysisTaskJetBackgroundSubtract *taskSubtract = 0; taskSubtract = AddTaskJetBackgroundSubtract(kJetSubtractBranches,1,"B0","B%d"); taskSubtract->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); if(kDeltaAODJetName.Length()>0)taskSubtract->SetNonStdOutputFile(kDeltaAODJetName.Data()); } } } }