AliHadCorrTask* AddTaskHadCorr( const char *nTracks = "EmcalTracks", const char *nClusters = "EmcalClusters", const char *outClusName = "CaloClustersCorr", const Double_t hadcorr = 1, const Double_t minPt = 0.15, const Double_t phiMatch = 0.050, const Double_t etaMatch = 0.025, const Double_t Eexcl = 0, const Bool_t trackClus = kTRUE, const Bool_t histo = kFALSE, const char *outputname = "AnalysisResults.root" ) { // Get the pointer to the existing analysis manager via the static access method. //============================================================================== AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { ::Error("AddTaskHadCorr", "No analysis manager to connect to."); return 0; } // Check the analysis type using the event handlers connected to the analysis manager. //============================================================================== AliVEventHandler* handler = mgr->GetInputEventHandler(); if (!handler) { ::Error("AddTaskHadCorr", "This task requires an input event handler"); return 0; } enum EDataType_t { kUnknown, kESD, kAOD }; EDataType_t dataType = kUnknown; if (handler->InheritsFrom("AliESDInputHandler")) { dataType = kESD; } else if (handler->InheritsFrom("AliAODInputHandler")) { dataType = kAOD; } //------------------------------------------------------- // Init the task and do settings //------------------------------------------------------- TString trackName(nTracks); TString clusName(nClusters); if (trackName == "usedefault") { if (dataType == kESD) { trackName = "Tracks"; } else if (dataType == kAOD) { trackName = "tracks"; } else { trackName = ""; } } if (clusName == "usedefault") { if (dataType == kESD) { clusName = "CaloClusters"; } else if (dataType == kAOD) { clusName = "caloClusters"; } else { clusName = ""; } } TString name(Form("HadCorr_%s_%s", trackName.Data(), clusName.Data())); if (strcmp(outClusName, "") != 0) name += Form("_%s", outClusName); AliHadCorrTask *hcor = new AliHadCorrTask(name, histo); hcor->SetOutClusName(outClusName); hcor->SetPhiMatch(phiMatch); hcor->SetEtaMatch(etaMatch); hcor->SetHadCorr(hadcorr); hcor->SetEexcl(Eexcl); hcor->SetTrackClus(trackClus); AliParticleContainer* trackCont = 0; if (trackName == "Tracks" || trackName == "tracks") { trackCont = hcor->AddTrackContainer(trackName); } else { trackCont = hcor->AddParticleContainer(trackName); } trackCont->SetParticlePtCut(minPt); AliClusterContainer *clusCont = hcor->AddClusterContainer(clusName); if (clusCont) clusCont->SetClusNonLinCorrEnergyCut(minPt); //------------------------------------------------------- // Final settings, pass to manager and set the containers //------------------------------------------------------- mgr->AddTask(hcor); // Create containers for input/output mgr->ConnectInput (hcor, 0, mgr->GetCommonInputContainer() ); if (histo) { AliAnalysisDataContainer *cohcor = mgr->CreateContainer(name, TList::Class(), AliAnalysisManager::kOutputContainer, outputname); mgr->ConnectOutput(hcor,1,cohcor); } return hcor; }
Bool_t AddTasksEmcalFjetSparseMaker() { AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (bIsInfoAOD) { gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODHandler.C"); AliAODInputHandler *aodIH = AddAODHandler(); } else { gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddESDHandler.C"); AliESDInputHandler *esdIH = AddESDHandler(); // esdIH->SetReadFriends(kFALSE); } if (bAnaInfoMC && (!bIsInfoAOD)) { gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddMCHandler.C"); AliMCEventHandler *mctEH = AddMCHandler(kTRUE); } if (bOutputAOD) { gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODOutputHandler.C"); AliAODHandler *aodH = AddAODOutputHandler(); aodH->SetOutputFileName("AliAOD.PicoJets.root"); aodH->SetFillAOD(kTRUE); aodH->SetCreateNonStandardAOD(); mgr->SetOutputEventHandler(aodH); } //============================================================================= if (bIsPhysSel) { gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/AddTaskEmcalPhysicsSelection.C"); AliEmcalPhysicsSelectionTask *taksPhysSel = AddTaskEmcalPhysicsSelection(kTRUE, kTRUE, wTriggerMask, 5., 5., 10., kTRUE, -1, -1, -1, -1); if (bAnaInfoMC) { AliEmcalPhysicsSelection *pPhysSel = static_cast<AliEmcalPhysicsSelection*>(taksPhysSel->GetPhysicsSelection()); if (!pPhysSel) return kTRUE; pPhysSel->SetAnalyzeMC(); } } if (bIsCentSel) { gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C"); AliCentralitySelectionTask *taskCentSel = AddTaskCentrality(kTRUE, bIsAOD); if (bAnaInfoMC) taskCentSel->SetMCInput(); } if (bIsEvPnSel) { gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskEventplane.C"); AliEPSelectionTask *taskEventPlane = AddTaskEventplane(); if (bAnaInfoMC) taskEventPlane->SetUseMCRP(); } if (bIsRespPID) { gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); AliAnalysisTaskSE *taskRespPID = AddTaskPIDResponse(bAnaInfoMC); } //============================================================================= gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/AddTaskEmcalSetup.C"); AliEmcalSetupTask *taskSetupEMCal = AddTaskEmcalSetup(); taskSetupEMCal->SetGeoPath("$ALICE_PHYSICS/OADB/EMCAL"); gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/AddTaskEmcalPreparation.C"); AliAnalysisTaskSE *taskEmcMaker = AddTaskEmcalPreparation(sPeriodIn); gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/EMCALJetTasks/macros/AddTaskJetPreparation.C"); AliAnalysisTaskSE *taskHadCorr = AddTaskJetPreparation(sPeriodIn.Data(), sUsedTrksRD.Data(), (bAnaInfoMC ? sUsedTrksMC.Data() : ""), sInputClsRD.Data(), sUsedClusRD.Data(), 2., 0., 0.03, 0.015, 0.15, wTriggerMask, kTRUE, // do trk clus kTRUE, // histos kTRUE, // make pico trk kFALSE, // make trigger kFALSE, // is EMCal train 1., // track eff kTRUE, // do AOD track prop kTRUE, // modify match kFALSE, // use old bit kFALSE, // trigger QA 4); // cent bin //============================================================================= gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C"); /*AliEmcalJetTask *taskAkt = AddTaskEmcalJet(sUsedTrksRD.Data(), sUsedClusRD.Data(), 1, // anti-kT dJetRadius, nJetType, dTrkPtCut, dCluEnCut);*/ //============================================================================= AliAnalysisTaskEmcalFjetSparseMaker *taskEmcalSM = new AliAnalysisTaskEmcalFjetSparseMaker("AliAnalysisTaskEmcalFjetSM"); //taskEmcalSM->SetForceBeamType(0); //taskEmcalSM->SetIsPythia(kTRUE); /*taskEmcalSM->SetCaloTriggerPatchInfoName("EmcalTriggers"); taskEmcalSM->SetTriggerTypeSel(AliAnalysisTaskEmcal::kJ2); taskEmcalSM->SetMainPatchType(AliAnalysisTaskEmcal::kTriggerLevel1Jet);*/ AliParticleContainer *pContTrks = taskEmcalSM->AddParticleContainer(sUsedTrksRD.Data()); pContTrks->SetParticlePtCut(dTrkPtCut); AliClusterContainer *pContClus = taskEmcalSM->AddClusterContainer(sUsedClusRD.Data()); pContClus->SetClusPtCut(dCluEnCut); /*AliJetContainer *pContJets = taskEmcalSM->AddJetContainer(taskAkt->GetName(), sCutType.Data(), dJetRadius); pContJets->SetPercAreaCut(dJetAreaCut); pContJets->SetJetPtCut(dJetPtCut); //pContJets->SetRhoName(sUsedRho.Data()); //pContJets->SetLocalRhoName(); pContJets->SetLeadingHadronType(nLeading); pContJets->ConnectParticleContainer(taskEmcalSM->GetParticleContainer()); pContJets->ConnectClusterContainer(taskEmcalSM->GetClusterContainer()); pContJets->SetNameTitle(taskEmcalSM->GetNameJet().Data(), taskEmcalSM->GetNameJet().Data());*/ mgr->AddTask(taskEmcalSM); mgr->ConnectInput(taskEmcalSM, 0, mgr->GetCommonInputContainer()); mgr->ConnectOutput(taskEmcalSM, 1, mgr->CreateContainer("listGeneralH", TList::Class(), AliAnalysisManager::kOutputContainer, AliAnalysisManager::GetCommonFileName())); mgr->ConnectOutput(taskEmcalSM, 2, mgr->CreateContainer("listEmcalEvH", TList::Class(), AliAnalysisManager::kOutputContainer, "AnalysisResults_EmcalEvH.root")); mgr->ConnectOutput(taskEmcalSM, 3, mgr->CreateContainer("listEmcalTrk", TList::Class(), AliAnalysisManager::kOutputContainer, "AnalysisResults_EmcalTrk.root")); mgr->ConnectOutput(taskEmcalSM, 4, mgr->CreateContainer("listEmcalClu", TList::Class(), AliAnalysisManager::kOutputContainer, "AnalysisResults_EmcalClu.root")); /*mgr->ConnectOutput(taskEmcalSM, 5, mgr->CreateContainer("listEmcalJet", TList::Class(), AliAnalysisManager::kOutputContainer, "AnalysisResults_EmcalJet.root"));*/ //============================================================================= TObjArray *aTasks = mgr->GetTasks(); for (Int_t i=0; i<aTasks->GetEntries(); i++) { AliAnalysisTaskEmcal *taskJE = dynamic_cast<AliAnalysisTaskEmcal*>(aTasks->At(i)); if (taskJE) if (taskJE->InheritsFrom("AliAnalysisTaskEmcal")) { taskJE->SetVzRange(-10., 10.); if (!sCentEsti.IsNull()) { taskJE->SetCentralityEstimator(sCentEsti.Data()); taskJE->SetCentRange(dCentMin, dCentMax); } } if (wTriggerMask) { AliAnalysisTaskSE *taskSE = dynamic_cast<AliAnalysisTaskSE*>(aTasks->At(i)); if (taskSE) if (!(taskSE->InheritsFrom("AliPhysicsSelectionTask"))) { taskSE->SelectCollisionCandidates(wTriggerMask); } } } //============================================================================= return kFALSE; }
AliJJetTask* AddTaskJJet( // FIXME: Really need default values? Is this needed by AliROOT? Or, let's remove it to reduce mistakes Int_t trigger = AliVEvent::kEMCEJE, const char *taskname = "AliJJetTask", int debug = 1, int doRecoMCPartleJet = 0, // if do Jet Reconstruction with MC Particle. only for MC int doRecoTrackJet = 1, // if do Jet Reconstruction with Reconstructed track. both of MC,Data int isMC = 0, // If this event is MC ( both of particle, track ) int nR = 3, //Number(1-3) of R parameters in order from list 0.4, 0.5, 0.6 int doBackgroundEst = 0 // If user wants to do background estimation with kt-algorithm ) { //============================================================================== // Get the pointer to the existing analysis manager via the static access method. //============================================================================== AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { ::Error("AddTaskJJet", "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("AddTaskJJet", "This task requires an input event handler"); return NULL; } //------------------------------------------------------- // Init the task and do settings //------------------------------------------------------- TString name(taskname); //name += trigger; // FIXME: Why not? Could be //TString tracksName = "PicoTracks"; //TString tracksName = "PicoTracks"; //TString clustersName = "EmcCaloClusters"; //TString clustersCorrName = "CaloClustersCorr"; TString tracksName = "tracks"; TString clustersCorrName = "caloClusters"; TString tracksNameMC = "mcparticles"; //Check these TString rhoName = ""; // FIXME: Comment me if(nR < 1) nR = 1; if(nR > 3) nR = 3; //------------------------------------------------------- // LOAD EMCALJetTasks and Variables //------------------------------------------------------- gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C"); if(doRecoTrackJet){ const int nTrackJetFinder = 2*nR; }else{ const int nTrackJetFinder = 0; } if(doRecoMCPartleJet){ const int nMCParticleJetFinder = 2*nR; }else{ const int nMCParticleJetFinder = 0; } const int nJetFinder = nMCParticleJetFinder + nTrackJetFinder; if(doBackgroundEst){ if(doRecoTrackJet){ const int nktTrackFinders = 1; } else{ const int nktTrackFinders = 0; } if(nMCParticleJetFinder){ const int nktMCParticleFinders = 1; } else{ const int nktMCParticleFinders = 0; } const int nktFinders = nktTrackFinders + nktMCParticleFinders; } else{ const int nktFinders = 0; } int countJetFinder = 0; // Counter for number of current Jet Finders //------------------------------------------------------- // AliJJetTask , AliEmcalJetTask, AliJetContainer //------------------------------------------------------- AliJJetTask *jtTask = new AliJJetTask(name, nJetFinder + nktFinders); jtTask->SetMC( isMC ) ; // Set isMC explicitly. jtTask->SetnR( nR ) ; // Set number of jet resolution parameters. jtTask->Setnkt( nktFinders ) ; // Set information about if kt algorithm reconstruction was done or not. jtTask->SetDebug( debug ); jtTask->SelectCollisionCandidates( trigger ); // WARNING: default is AliVEvent::kEMCEJE. Double check it! AliEmcalJetTask *jetFinderTask[nJetFinder]; for( int i=0;i<nJetFinder;i++ ) jetFinderTask[i] = NULL; AliJetContainer *jetCont[nJetFinder]; for( int i=0;i<nJetFinder;i++ ) jetCont[i] = NULL; AliEmcalJetTask *ktFinderTask[nktFinders]; for( int i=0;i<nktFinders;i++) ktFinderTask[i] = NULL; AliJetContainer *ktCont[nktFinders]; //0 for Data and 1 for MC. Implementation for different R left for later. for( int i=0;i<nktFinders;i++) ktCont[i] = NULL; double ktConeSizes[1]={ 0.4}; int ktJetTypes [1]={ 1};// 0:FullJet 1:Charged TString ktTypes [1]={"TCP"};// Check if 100% sure about this //------------------------------------------------------- // Reconstructed Track Jets : Both of Data, MC //------------------------------------------------------- if( doRecoTrackJet ){ //================= Variables for array int iStart = countJetFinder; int iEnd = countJetFinder += nTrackJetFinder; //================= AddTaskEmcalJet // We have 6 type of recos double aConeSizes[6]={ 0.4, 0.5, 0.6, 0.4, 0.5, 0.6 }; int aJetType [6]={ 0, 0, 0, 1, 1, 1 }; // 0 :FullJet 1:Charged TString aType [6]={ "EMCAL", "EMCAL", "EMCAL", "TPC", "TPC", "TPC" }; double bConeSizes[3] = {0.4,0.5,0.6}; int bJetType[2] = {0,1}; int bType[2] = {"EMCAL","TPC"}; //================= Containers : Track, Cluster AliTrackContainer* partCont = new AliTrackContainer(tracksName); partCont->SetFilterHybridTracks(kFALSE); //partCont->SetFilterHybridTracks(kTRUE); AliParticleContainer *trackCont = partCont; trackCont->SetClassName("AliVTrack"); //AliParticleContainer *trackCont = jtTask->AddParticleContainer( tracksName ); if (trackCont) jtTask->AdoptParticleContainer(trackCont); AliClusterContainer *clusterCont = jtTask->AddClusterContainer( clustersCorrName ); clusterCont->SetClassName("AliAODCaloCluster"); //================= LOOP for configuraion //for(int i=iStart ; i<iEnd; i++){ for(int itype = 0; itype < 2; itype++){ for(int iR = 0; iR < nR; iR++){ int iF = iStart + itype*nR + iR; //== Variables //int iHere = iStart - countJetFinder; // array index based 0 in a block int iHere = i-iStart; // array index based 0 in a block //double consize = aConeSizes[iHere]; //int jettype = aJetType [iHere]; //int type = aType [iHere]; double consize = bConeSizes[iR]; int jettype = bJetType[itype]; int type = bType[itype]; //== JetFinderTask, JetContainer TString _clustersCorrName = ( type == "EMCAL" ? clustersCorrName : "" ); // Check if it is EMCAL jetFinderTask[iF] = AddTaskEmcalJet( tracksName, _clustersCorrName, AliJetContainer::antikt_algorithm, consize, jettype, 0.15, 0.300, 0.005, 1, "Jet", 5. ); // anti-kt jetFinderTask[iF]->SelectCollisionCandidates(trigger); jtTask->SetTrackOrMCParticle( iF, AliJJetTask::kJRecoTrack ); // TODO: Move this to AddJetContainer cout << jetFinderTask[iF]->GetName() << endl; jetCont[iF] = jtTask->AddJetContainer( jetFinderTask[iF]->GetName(), type, consize ); // TODO: SetTrackOrMCParticle here if( jetCont[iF] ) { jetCont[iF]->SetRhoName( rhoName ); jetCont[iF]->ConnectParticleContainer( trackCont ); if ( type == "EMCAL" ) jetCont[iF]->ConnectClusterContainer( clusterCont ); jetCont[iF]->SetZLeadingCut( 0.98, 0.98 ); // FIXME: Comments me and others jetCont[iF]->SetPercAreaCut( 0.6 ); jetCont[iF]->SetJetPtCut( 5 ); jetCont[iF]->SetLeadingHadronType( 0 ); } } } // for i } // if doRecoTrackJet //------------------------------------------------------- // MC Particles Jets //------------------------------------------------------- if( doRecoMCPartleJet ){ //================= Variables for array int iStart = countJetFinder; int iEnd = countJetFinder += nMCParticleJetFinder; // WARN: this is a real end + 1 //================= AddTaskEmcalJet // We have 3 type of recos double aConeSizesMC[6]={ 0.4, 0.5, 0.6, 0.4, 0.5, 0.6 }; int aJetTypeMC [6]={ 0, 0, 0, 1, 1, 1 }; // 0 :FullJet 1:Charged TString aTypeMC [6]={ "TPC", "TPC", "TPC", "TPC", "TPC", "TPC" }; double bConeSizes[3] = {0.4,0.5,0.6}; int bJetType[2] = {0,1}; int bType[2] = {"EMCAL","TPC"}; char *nrho = rhoName; //================= Containers : MC Particle AliMCParticleContainer *mcTrackCont = jtTask->AddMCParticleContainer(tracksNameMC); mcTrackCont->SelectPhysicalPrimaries(kTRUE); mcTrackCont->SetClassName("AliAODMCParticle"); //================= LOOP for configuraion for(int itype = 0; itype < 2; itype++){ for(int iR = 0; iR < nR; iR++){ int iF = iStart + itype*nR + iR; //== Variables //int iHere = iStart - countJetFinder; // array index based 0 in a block //int iHere = i - iStart; // array index based 0 in a block //double consizeMC = aConeSizesMC[iHere]; //int jettype = aJetTypeMC [iHere]; //int type = aTypeMC [iHere]; double consizeMC = bConeSizes[iR]; int jettype = bJetType[itype]; int type = bType[itype]; //== JetFinderTask, JetContainer TString _clustersCorrName = ( type == "EMCAL" ? clustersCorrName : "" ); // Check if it is EMCAL // FIXME: Good for MC particles also? //No clusters in mc particles? jetFinderTask[iF] = AddTaskEmcalJet( tracksNameMC, "", AliJetContainer::antikt_algorithm, consizeMC, jettype, 0.15, 0.300, 0.005, 1, "Jet", 5. ); // anti-kt jetFinderTask[iF]->SelectCollisionCandidates(trigger); cout << jetFinderTask[iF]->GetName() << endl; //jetFinderTask[i]->GetParticleContainer(0)->SelectPhysicalPrimaries(kTRUE); // FIXME: DUPLICATION? not needed here, I think // FIXME: Why before ConnectParticleContainer? //I don't think the order matters // FIXME: Is this means, we don't need to make particle container manually? jtTask->SetTrackOrMCParticle( iF, AliJJetTask::kJMCParticle ); // TODO: Move this to AddJetContainer FIXME: Maybe not possible in easy jetCont[iF] = jtTask->AddJetContainer( jetFinderTask[iF]->GetName(), type, consizeMC ); // TODO: SetTrackOrMCParticle here if(jetCont[iF]) { jetCont[iF]->SetRhoName( rhoName ); jetCont[iF]->ConnectParticleContainer( mcTrackCont ); // if ( aType[iHere] == "EMCAL" ) jetCont[i]->ConnectClusterContainer( clusterCont ); jetCont[iF]->SetZLeadingCut( 0.98, 0.98 ); // FIXME: Comments me and others jetCont[iF]->SetPercAreaCut( 0.6 ); jetCont[iF]->SetJetPtCut( 5 ); jetCont[iF]->SetLeadingHadronType( 0 ); } } } // for i } // if doRecoMCPartleJet //------------------------------------------------------- // kt-algorithm //------------------------------------------------------- if (doBackgroundEst) { double ktConeSize = ktConeSizes[0]; int ktJetType = ktJetTypes[0]; TString ktType = ktTypes[0]; if (doRecoTrackJet) { TString _clustersCorrName = ( ktType == "EMCAL" ? clustersCorrName : "" ); ktFinderTask[0] = AddTaskEmcalJet( tracksName, _clustersCorrName, AliJetContainer::kt_algorithm, ktConeSize, ktJetType, 0.15, 0.300, 0.005, 1, "Jet", 5. ); // kt ktFinderTask[0]->SelectCollisionCandidates(trigger); jtTask->SetTrackOrMCParticle( iEnd, AliJJetTask::kJRecoTrack ); cout << ktFinderTask[0]->GetName() << endl; ktCont[0] = jtTask->AddJetContainer( ktFinderTask[0]->GetName(), ktJetType, ktConeSize ); if( ktCont[0] ) { ktCont[0]->SetRhoName( rhoName ); ktCont[0]->ConnectParticleContainer( trackCont ); if ( type == "EMCAL" ) ktCont[0]->ConnectClusterContainer( clusterCont ); ktCont[0]->SetZLeadingCut( 0.98, 0.98 ); ktCont[0]->SetPercAreaCut( 0.6 ); ktCont[0]->SetJetPtCut( 5 ); ktCont[0]->SetLeadingHadronType( 0 ); } } // if doRecoTrackJet if (doRecoMCPartleJet) { TString _clustersCorrName = ( ktType == "EMCAL" ? clustersCorrName : "" ); ktFinderTask[1] = AddTaskEmcalJet( tracksNameMC, "", AliJetContainer::kt_algorithm, ktConeSize, ktJetType, 0.15, 0.300, 0.005, 1, "Jet", 5. ); // kt ktFinderTask[1]->SelectCollisionCandidates(trigger); jtTask->SetTrackOrMCParticle( iEnd+1, AliJJetTask::kJMCParticle ); ktCont[1] = jtTask->AddJetContainer( ktFinderTask[1]->GetName(), ktJetType, ktConeSize ); if( ktCont[1] ) { ktCont[1]->SetRhoName( rhoName ); ktCont[1]->ConnectParticleContainer( trackCont ); if ( type == "EMCAL" ) ktCont[0]->ConnectClusterContainer( clusterCont ); ktCont[1]->SetZLeadingCut( 0.98, 0.98 ); ktCont[1]->SetPercAreaCut( 0.6 ); ktCont[1]->SetJetPtCut( 5 ); ktCont[1]->SetLeadingHadronType( 0 ); } } // if doRecoTrackJet } // if doBackgroundEst //------------------------------------------------------- // Final settings, pass to manager and set the containers //------------------------------------------------------- Printf("name: %s",name.Data()); mgr->AddTask(jtTask); // Create containers for input/output AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer() ; TString contname(name); contname += "_histos"; cout << "Create container " << contname << endl; AliAnalysisDataContainer *coutput = mgr->CreateContainer(contname.Data(), TList::Class(),AliAnalysisManager::kOutputContainer, Form("%s", AliAnalysisManager::GetCommonFileName())); mgr->ConnectInput (jtTask, 0, cinput ); mgr->ConnectOutput (jtTask, 1, coutput ); // MUST HAVE IT, DON"T KNOW WHY ??? maybe from EMCALJET code return jtTask; }
AliAnalysisTaskDeltaPt* AddTaskDeltaPt( const char *ntracks = "Tracks", const char *nclusters = "CaloClusters", const char *njets = "Jets", const char *nembtracks = "TracksEmbedded", const char *nembclusters = "CaloClustersEmbedded", const char *nembjets = "EmbJets", const char *nrandtracks = "TracksRandomized", const char *nrandclusters = "CaloClustersRandomized", const char *nrho = "Rho", Double_t jetradius = 0.2, Double_t jetareacut = 0.557, Double_t trackptcut = 0.15, Double_t clusptcut = 0.30, const char *type = "TPC", const char *taskname = "AliAnalysisTaskDeltaPt" ) { // Get the pointer to the existing analysis manager via the static access method. //============================================================================== AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { ::Error("AddTaskDeltaPt", "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("AddTaskDeltaPt", "This task requires an input event handler"); return NULL; } //------------------------------------------------------- // Init the task and do settings //------------------------------------------------------- TString name; if (strcmp(ntracks, "") == 0 && strcmp(nclusters, "") == 0) name = Form("%s_%s_R0%d_%s",taskname,nrho,(Int_t)floor(jetradius*100+0.5),type); else if (strcmp(ntracks, "") == 0) name = Form("%s_%s_%s_R0%d_%s",taskname,nclusters,nrho,(Int_t)floor(jetradius*100+0.5),type); else if (strcmp(nclusters, "") == 0) name = Form("%s_%s_%s_R0%d_%s",taskname,ntracks,nrho,(Int_t)floor(jetradius*100+0.5),type); else name = Form("%s_%s_%s_%s_R0%d_%s",taskname,ntracks,nclusters,nrho,(Int_t)floor(jetradius*100+0.5),type); AliAnalysisTaskDeltaPt* jetTask = new AliAnalysisTaskDeltaPt(name); jetTask->SetConeRadius(jetradius); jetTask->SetRhoName(nrho,-1); if (strcmp(type,"TPC")==0) jetTask->SetConeEtaPhiTPC(); else if (strcmp(type,"EMCAL")==0) jetTask->SetConeEtaPhiEMCAL(); AliParticleContainer *partCont = jetTask->AddParticleContainer(ntracks); if (partCont) { partCont->SetName("Tracks"); partCont->SetParticlePtCut(trackptcut); } AliClusterContainer *clusCont = jetTask->AddClusterContainer(nclusters); if (clusCont) { clusCont->SetName("CaloClusters"); clusCont->SetClusPtCut(clusptcut); } AliJetContainer *jetCont = jetTask->AddJetContainer(njets,type,jetradius); if (jetCont) { jetCont->SetName("Jets"); jetCont->SetPercAreaCut(jetareacut); jetCont->SetRhoName(nrho); jetCont->ConnectParticleContainer(partCont); jetCont->ConnectClusterContainer(clusCont); } AliParticleContainer *embPartCont = jetTask->AddParticleContainer(nembtracks); if (embPartCont) { embPartCont->SetName("EmbTracks"); embPartCont->SetParticlePtCut(trackptcut); } AliClusterContainer *embClusCont = jetTask->AddClusterContainer(nembclusters); if (embClusCont) { embClusCont->SetName("EmbClusters"); embClusCont->SetClusPtCut(clusptcut); } AliJetContainer *embJetCont = jetTask->AddJetContainer(nembjets,type,jetradius); if (embJetCont) { embJetCont->SetName("EmbJets"); embJetCont->SetPercAreaCut(jetareacut); embJetCont->SetRhoName(nrho); embJetCont->ConnectParticleContainer(embPartCont); embJetCont->ConnectClusterContainer(embClusCont); } AliParticleContainer *randPartCont = jetTask->AddParticleContainer(nrandtracks); if (randPartCont) { randPartCont->SetName("RandTracks"); randPartCont->SetParticlePtCut(trackptcut); } AliClusterContainer *randClusCont = jetTask->AddClusterContainer(nrandclusters); if (randClusCont) { randClusCont->SetName("RandClusters"); randClusCont->SetClusPtCut(clusptcut); } //------------------------------------------------------- // Final settings, pass to manager and set the containers //------------------------------------------------------- mgr->AddTask(jetTask); // Create containers for input/output AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); TString contname(name); contname += "_histos"; AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), TList::Class(),AliAnalysisManager::kOutputContainer, Form("%s", AliAnalysisManager::GetCommonFileName())); mgr->ConnectInput(jetTask, 0, cinput1); mgr->ConnectOutput(jetTask, 1, coutput1); return jetTask; }
AliAnalysisTaskPWGJEQA* AddTaskPWGJEQA( const char* ntracks = "usedefault", const char* nclusters = "usedefault", const char* ncells = "usedefault", const char *nGenLev = "mcparticles", Bool_t doTrackQA = kTRUE, Bool_t doCaloQA = kTRUE, Bool_t doJetQA = kTRUE, Bool_t doEventQA = kTRUE, Double_t trackPtCut = 0.15, Double_t clusECut = 0.30, const char* suffix = "" ) { // Get the pointer to the existing analysis manager via the static access method AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { ::Error("AddTaskPWGJEQA", "No analysis manager to connect to."); return NULL; } // Check the analysis type using the event handlers connected to the analysis manager AliVEventHandler* handler = mgr->GetInputEventHandler(); if (!handler) { ::Error("AddTaskPWGJEQA", "This task requires an input event handler"); return NULL; } enum EDataType_t { kUnknown, kESD, kAOD }; EDataType_t dataType = kUnknown; if (handler->InheritsFrom("AliESDInputHandler")) { dataType = kESD; } else if (handler->InheritsFrom("AliAODInputHandler")) { dataType = kAOD; } // Init the task and do settings TString trackName(ntracks); TString clusName(nclusters); TString cellName(ncells); if (trackName == "usedefault") { if (dataType == kESD) { trackName = "Tracks"; } else if (dataType == kAOD) { trackName = "tracks"; } else { trackName = ""; } } if (clusName == "usedefault") { if (dataType == kESD) { clusName = "CaloClusters"; } else if (dataType == kAOD) { clusName = "caloClusters"; } else { clusName = ""; } } if (ncells == "usedefault") { if (dataType == kESD) { cellName = "EMCALCells"; } else if (dataType == kAOD) { cellName = "emcalCells"; } else { cellName = ""; } } TString name("AliAnalysisTaskPWGJEQA"); if (!trackName.IsNull()) { name += "_"; name += trackName; } if (!clusName.IsNull()) { name += "_"; name += clusName; } if (!cellName.IsNull()) { name += "_"; name += cellName; } if (strcmp(suffix,"")) { name += "_"; name += suffix; } AliAnalysisTaskPWGJEQA* qaTask = new AliAnalysisTaskPWGJEQA(name); qaTask->SetVzRange(-10,10); qaTask->SetNeedEmcalGeom(kFALSE); qaTask->SetCaloCellsName(cellName); qaTask->SetDetectorLevelName(trackName); if (nGenLev && strcmp(nGenLev,"")!=0) qaTask->SetGeneratorLevelName(nGenLev); qaTask->SetDoTrackQA(doTrackQA); qaTask->SetDoCaloQA(doCaloQA); qaTask->SetDoJetQA(doJetQA); qaTask->SetDoEventQA(doEventQA); // Add the detector-level track container if (trackName == "tracks" || trackName == "Tracks") { AliTrackContainer* trackCont = qaTask->AddTrackContainer(trackName); trackCont->SetFilterHybridTracks(kTRUE); } else if (!trackName.IsNull()) { qaTask->AddParticleContainer(trackName); } AliParticleContainer *partCont = qaTask->GetParticleContainer(trackName); if (partCont) { partCont->SetParticlePtCut(trackPtCut); } // Add the generator-level container, if specified if (nGenLev && strcmp(nGenLev,"")!=0) { AliMCParticleContainer* mcpartCont = qaTask->AddMCParticleContainer(nGenLev); mcpartCont->SelectPhysicalPrimaries(kTRUE); mcpartCont->SetParticlePtCut(0); } // Add the cluster container AliClusterContainer *clusterCont = qaTask->AddClusterContainer(clusName); if (clusterCont) { clusterCont->SetClusECut(0.); clusterCont->SetClusPtCut(0.); clusterCont->SetClusHadCorrEnergyCut(clusECut); clusterCont->SetDefaultClusterEnergy(AliVCluster::kHadCorr); } // Final settings, pass to manager and set the containers mgr->AddTask(qaTask); // Create containers for input/output AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ; TString contName = TString::Format("%s_histos", name.Data()); TString commonoutput; commonoutput = mgr->GetCommonFileName(); AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contName.Data(), TList::Class(),AliAnalysisManager::kOutputContainer, commonoutput); mgr->ConnectInput (qaTask, 0, cinput1 ); mgr->ConnectOutput (qaTask, 1, coutput1 ); return qaTask; }