本文整理汇总了C++中AliAnalysisManager::GetTasks方法的典型用法代码示例。如果您正苦于以下问题:C++ AliAnalysisManager::GetTasks方法的具体用法?C++ AliAnalysisManager::GetTasks怎么用?C++ AliAnalysisManager::GetTasks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AliAnalysisManager
的用法示例。
在下文中一共展示了AliAnalysisManager::GetTasks方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintManager
void PrintManager(TObject *mgrObj) {
AliAnalysisManager *mgr = (AliAnalysisManager *)mgrObj;
if (!mgr->InitAnalysis()) return;
mgr->RunLocalInit();
mgr->PrintStatus();
Printf("Analysis Manager : %s '%s'",mgr->GetName(),mgr->GetTitle() );
TObjArray *a = mgr->GetTasks();
if (a) Printf("Tasks total : %d",a->GetEntries());
TIter next(mgr->GetTasks());
AliAnalysisTask *task;
while ((task = (AliAnalysisTask *) next())) {
if (task->IsA() == AliRsnMiniAnalysisTask::Class()) {
Printf(" Task [RSN-MINI] : %s '%s'",task->GetName(),task->GetTitle());
AliRsnMiniAnalysisTask *rsnMiniTask = (AliRsnMiniAnalysisTask *)task;
rsnMiniTask->Print();
} else if (task->IsA() == AliRsnAnalysisTask::Class()) {
Printf(" Task [RSN-----] : %s '%s'",task->GetName(),task->GetTitle());
AliRsnAnalysisTask *rsnTask = (AliRsnAnalysisTask *)task;
rsnTask->Print();
AliVEventHandler *ih = mgr->GetInputEventHandler();
if (ih == AliMultiInputEventHandler::Class()) {
AliMultiInputEventHandler *ihMulti = (AliMultiInputEventHandler *) ih;
TIter nextIH(ihMulti->InputEventHandlers());
AliRsnInputHandler *rsnIH = 0;
while ((ih = (AliVEventHandler *) nextIH())) {
if (ih->IsA() == AliRsnInputHandler::Class()) {
rsnIH = ih;
AliRsnDaughterSelector *ds = rsnIH->GetSelector();
ds->Print();
}
}
}
} else {
Printf(" Task [--------] : %s '%s'",task->GetName(),task->GetTitle());
}
}
}
示例2: run
void run(const Char_t *files=NULL, Bool_t mc=kFALSE, Bool_t tpid=kTRUE, Bool_t tchg=kFALSE, Bool_t tpp=kTRUE, Long64_t nev=1234567890, Long64_t first = 0)
{
TStopwatch timer;
timer.Start();
// VERY GENERAL SETTINGS
//AliLog::SetGlobalLogLevel(AliLog::kError);
if(gSystem->Load("libANALYSIS.so")<0) return;
if(gSystem->Load("libANALYSISalice.so")<0) return;
if(gSystem->Load("libTender.so")<0) return;
if(gSystem->Load("libTenderSupplies.so")<0) return;
// if(gSystem->Load("libMES.so")<0) return;
if(gSystem->Load("libPWGLFspectra.so")<0) return;
// DEFINE DATA CHAIN
TChain *chain = NULL;
if(!files) chain = MakeChainLST();
else chain = MakeChainLST(files);
if(!chain) return;
chain->Lookup();
chain->GetListOfFiles()->Print();
Long64_t nfound=chain->GetEntries();
printf("\tENTRIES FOUND [%lli] REQUESTED [%lli]\n", nfound, nev>nfound?nfound:nev);
// BUILD ANALYSIS MANAGER
AliAnalysisManager *mgr = new AliAnalysisManager("Multiplicity and Event Shape");
AliESDInputHandler *esdH = new AliESDInputHandler();
AliMCEventHandler *mcH(NULL);
mgr->SetInputEventHandler(esdH);
if(mc) mgr->SetMCtruthEventHandler(mcH = new AliMCEventHandler());
//mgr->SetDebugLevel(10);
mgr->SetSkipTerminate(kTRUE);
// LOAD tasks
// ******************* PID response ******************
gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
if(!mc) AddTaskPIDResponse();
else AddTaskPIDResponse(kTRUE,kTRUE,kTRUE,2);
// ******************* Tenders ***********************
AliTender *aliTender(NULL);
gROOT->LoadMacro("$ALICE_PHYSICS/TENDER/TenderSupplies/AddTaskTender.C");
if(!mc){ // for DATA
aliTender = (AliTender*)AddTaskTender(!mc, kTRUE, kTRUE, kTRUE, kTRUE, kFALSE, kTRUE, kFALSE, kFALSE);
// (useV0, useTPC, !!! useTOF=kFALSE for MC !!!, useTRD, usePID, useVTX, useT0, useEmc, usePtFix)
} else { // for MC
aliTender = (AliTender*)AddTaskTender(!mc, kTRUE, kFALSE, kTRUE, kTRUE, kTRUE, kTRUE, kFALSE, kFALSE); // (useV0, useTPC, !!! useTOF=kFALSE for MC !!!, useTRD, usePID, useVTX, useT0, useEmc, usePtFix)
}
aliTender->SetHandleOCDB(kTRUE);
//aliTender->SetDefaultCDBStorage(Form("alien://folder=/alice/data/2010/OCDB?cacheFolder=%s/local", gSystem->ExpandPathName("$HOME")));
// aliTender->SetDefaultCDBStorage(Form("local://%s/local/alice/data/2010/OCDB", gSystem->ExpandPathName("$HOME")));
// ******************* Physics Selection *************
gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(mc); // 0 = real data; 1 = MC
// ******************* MES Tender ******************
gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/SPECTRA/MultEvShape/AddMEStender.C");
AddMEStender(mc);
// ******************* MES PID task ******************
if(tpid){
gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/SPECTRA/MultEvShape/AddMESpidTask.C");
AddMESpidTask(mc);
}
//
// // ******************* MES CHG task ******************
if(tchg){
gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/SPECTRA/MultEvShape/AddMESchgTask.C");
AddMESchgTask(mc);
}
//
// // ******************* MES ppCol task ******************
if(tpp){
gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/SPECTRA/MultEvShape/AddMESppColTask.C");
AddMESppColTask(mc);
}
if (!mgr->InitAnalysis()) return;
mgr->PrintStatus();
mgr->StartAnalysis("local", chain, nev, first);
timer.Stop();
timer.Print();
// verbosity
printf("\tCLEANING TASK LIST:\n");
mgr->GetTasks()->Delete();
if(mcH) delete mcH;
delete esdH;
delete chain;
}
示例3: AddTasksEmcalFjetSparseMaker
//.........这里部分代码省略.........
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;
}
示例4: AddTask_TrainTreeAnalysis
//_____________________________________________________________________________________________________
AliAnalysisTask* AddTask_TrainTreeAnalysis(Bool_t isGrid=kFALSE, TString prod="LHC10h", Int_t reducedEventType=-1, Bool_t writeTree=kTRUE, TString tasks="dst", TString pathForMacros="$ALICE_PHYSICS/PWGDQ/reducedTree/macros") {
//
// AddTask macro for the TreeMaker analysis task and eventual other dependent tasks
//
//TString alienPath = alienPathForMacros;
//TString alirootPath("$ALICE_PHYSICS/PWGDQ/reducedTree/macros");
TObjArray* tasksArray = tasks.Tokenize(";");
if(tasksArray->GetEntries()==0) {
printf("ERROR: In AddTask_TrainTreeAnalysis(), no tasks are provided as argument, nothing to add to the AliAnalysisManager! \n");
return 0x0;
}
AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// check if the dst TreeMaker is included in the list of tasks and add it to the train if needed
Bool_t makeTrees = kFALSE;
AliAnalysisTask* treeMaker = 0x0;
// NOTE: if the tree maker needs to be in the train, then this has to be the first task specified in the tasks string
// Also, the name specified in the "tasks" argument has to contain the keyword "dst", case insensitive
TString treeTask = tasksArray->At(0)->GetName();
treeTask.ToLower();
if(treeTask.Contains("dst")) makeTrees = kTRUE;
if(makeTrees) {
TString addTaskFullPath = "";
if(isGrid) {
//Int_t errCode = gSystem->Exec(Form("alien_cp %s/AddTask_%s.C .", alienPath.Data(), tasksArray->At(0)->GetName()));
Int_t errCode = gSystem->Exec(Form("alien_cp %s/AddTask_%s.C .", pathForMacros.Data(), tasksArray->At(0)->GetName()));
if(errCode) {
//printf("ERROR: In AddTask_TrainTreeAnalysis(), could not copy %s/AddTask_%s.C from the grid directory %s \n", alienPath.Data(), tasksArray->At(0)->GetName(), alienPath.Data());
printf("ERROR: In AddTask_TrainTreeAnalysis(), could not copy %s/AddTask_%s.C from the grid directory %s \n", pathForMacros.Data(), tasksArray->At(0)->GetName(), pathForMacros.Data());
return 0x0;
}
else addTaskFullPath = gSystem->pwd();
}
else {
//addTaskFullPath = alirootPath.Data();
addTaskFullPath = pathForMacros.Data();
}
addTaskFullPath += "/AddTask_";
addTaskFullPath += tasksArray->At(0)->GetName();
addTaskFullPath += ".C";
if (!gROOT->GetListOfGlobalFunctions()->FindObject(Form("AddTask_%s", tasksArray->At(0)->GetName()))){
gROOT->LoadMacro(addTaskFullPath.Data());
}
gROOT->ProcessLine(Form("AddTask_%s(%d,%d,\"%s\")", tasksArray->At(0)->GetName(), reducedEventType, (writeTree ? 1 : 0), prod.Data()));
treeMaker = (AliAnalysisTask*)mgr->GetTasks()->FindObject("DSTTreeMaker");
if(!treeMaker) {
printf("ERROR: In AddTask_TrainTreeAnalysis(), something went wrong! The tree maker could not be added to the analysis manager!");
return 0x0;
}
if(tasksArray->GetEntries()==1) // no other tasks to be included, return
return treeMaker;
} // end if(makeTrees)
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// check if there are consumer tasks for the tree maker and add them to the train
AliAnalysisTask* firstConsumerTask = 0x0;
for(Int_t i=(makeTrees ? 1 : 0); i<tasksArray->GetEntries(); ++i) {
TString task = tasksArray->At(i)->GetName();
TString addTaskFullPath = "";
if(isGrid) {
//Int_t errCode = gSystem->Exec(Form("alien_cp %s/AddTask_%s.C .", alienPath.Data(), task.Data()));
Int_t errCode = gSystem->Exec(Form("alien_cp %s/AddTask_%s.C .", pathForMacros.Data(), task.Data()));
if(errCode) {
//printf("ERROR: In AddTask_TrainTreeAnalysis(), could not copy %s/AddTask_%s.C from the grid directory %s \n", alienPath.Data(), task.Data(), alienPath.Data());
printf("ERROR: In AddTask_TrainTreeAnalysis(), could not copy %s/AddTask_%s.C from the grid directory %s \n", pathForMacros.Data(), task.Data(), pathForMacros.Data());
return 0x0;
}
else addTaskFullPath = gSystem->pwd();
}
else {
//addTaskFullPath = alirootPath.Data();
addTaskFullPath = pathForMacros.Data();
}
addTaskFullPath = Form("%s/AddTask_%s.C", addTaskFullPath.Data(), task.Data());
if (!gROOT->GetListOfGlobalFunctions()->FindObject(Form("AddTask_%s", task.Data()))){
gROOT->LoadMacro(addTaskFullPath.Data());
}
Int_t runMode = AliAnalysisTaskReducedEventProcessor::kUseOnTheFlyReducedEvents;
if(!makeTrees) runMode = AliAnalysisTaskReducedEventProcessor::kUseEventsFromTree;
gROOT->ProcessLine(Form("AddTask_%s(kTRUE,%d,\"%s\")", tasksArray->At(i)->GetName(), runMode, prod.Data()));
if(!firstConsumerTask) firstConsumerTask = (AliAnalysisTask*)mgr->GetTasks()->At(mgr->GetTasks()->GetEntries()-1);
}
if(treeMaker) return treeMaker;
if(firstConsumerTask) return firstConsumerTask;
return 0x0;
}
示例5: EmcalJetCDF
//.........这里部分代码省略.........
jetcont_full = anaTaskCDFfull->AddJetContainer(fulljet, antikt, recomb, 0.4, acc_fulljets, "Jet");
CDF::jetContSetParams (jetcont_full, 1., 500., 0, 2);
if (isMC) {
jetcont_full = AddJetContainerJetTask(dynamic_cast<AliAnalysisTaskEmcalJetCDF*>(anaTaskCDFfull_MC), pFuJet02Task_MC, acc_fulljets);
CDF::jetContSetParams (jetcont_full, 1., 500., 0, 0);
jetcont_full = AddJetContainerJetTask(dynamic_cast<AliAnalysisTaskEmcalJetCDF*>(anaTaskCDFfull_MC), pFuJet04Task_MC, acc_fulljets);
CDF::jetContSetParams (jetcont_full, 1., 500., 0, 0);
}
jetcont_full = NULL;
}
// add jet containers to sample task for charged jets
if (bDoChargedJets && bDoSample) {
AliJetContainer* jetCont02chg_sample = sampleTaskchg->AddJetContainer(chgjet, antikt, recomb, 0.2, acc_chgjets, "Jet");
AliJetContainer* jetCont04chg_sample = sampleTaskchg->AddJetContainer(chgjet, antikt, recomb, 0.4, acc_chgjets, "Jet");
if (iBeamType != AliAnalysisTaskEmcal::kpp) {
jetCont02chg_sample->SetRhoName(sRhoChName);
jetCont02chg_sample->SetPercAreaCut(0.6);
jetCont04chg_sample->SetRhoName(sRhoChName);
jetCont04chg_sample->SetPercAreaCut(0.6);
}
}
// add jet containers to sample task for full jets
if (bDoFullJets && bDoSample) {
AliJetContainer* jetCont02full_sample = sampleTaskfull->AddJetContainer(fulljet, antikt, recomb, 0.2, acc_fulljets, "Jet");
AliJetContainer* jetCont04full_sample = sampleTaskfull->AddJetContainer(fulljet, antikt, recomb, 0.4, acc_fulljets, "Jet");
if (iBeamType != AliAnalysisTaskEmcal::kpp) {
jetCont02full_sample->SetRhoName(sRhoFuName);
jetCont02full_sample->SetPercAreaCut(0.6);
jetCont04full_sample->SetRhoName(sRhoFuName);
jetCont04full_sample->SetPercAreaCut(0.6);
}
}
TObjArray* tasks_list = pMgr->GetTasks(); TIter task_iter (tasks_list); AliAnalysisTaskSE* task = NULL;
while (( task = dynamic_cast<AliAnalysisTaskSE*>(task_iter.Next()) )) {
if (task->InheritsFrom("AliAnalysisTaskEmcal")) {
Printf("Setting beam type %d for task %s", iBeamType, static_cast<AliAnalysisTaskEmcal*>(task)->GetName());
static_cast<AliAnalysisTaskEmcal*>(task)->SetForceBeamType(iBeamType);
}
}
// Let's start #########################################################################################################
if ( !pMgr->InitAnalysis() ) { std::cout << ">>>>>>>>>>>>>> AliAnalysisManager Initialising FAILED!!! " << std::endl; return NULL; }
std::cout << "##-->> Initialising Analysis :: Status :" << std::endl;
pMgr->PrintStatus();
pMgr->SetUseProgressBar(bUseProgBar, 100);
// task profiling
if ( kUseSysInfo > 0 ) {
for ( int i = 0; i < pMgr->GetTopTasks()->GetEntries(); i++ ) { pMgr->ProfileTask (i); }
}
CDF::SaveManager("train.root");
if ( ManagerMode == AnalysisType::local ) { // start local analysis
// enable class level debugging for these classes
if ( debug > 2 ) {
// pMgr->AddClassDebug("AliJetContainer", 100);
// pMgr->AddClassDebug("AliEmcalJetTask", 100);
if (bDoCDF) { pMgr->AddClassDebug("AliAnalysisTaskEmcalJetCDF", 100); }
if (bDoSample) { pMgr->AddClassDebug("AliAnalysisTaskEmcalJetSample", 100); }
}
TChain* pChain = CDF::CreateChain(kDataSource.Data(), "auto", "", iNumFiles);
if (!pChain) { std::cout << ">>>>>>>>>>>>>> CHAIN NOT CREATED <<<<<<<<<<<<<<" << std::endl; return NULL; }
// start analysis
Printf("Starting LOCAL Analysis...");
pMgr->StartAnalysis( cAnalysisType, pChain, iNumEvents );
}
if ( ManagerMode == AnalysisType::grid ) { // start grid analysis
// start analysis
Printf("Starting GRID Analysis...");
ListLibs += kGridExtraFiles;
if ( ListLibs.Length() ) { plugin->SetAdditionalLibs ( ListLibs.Data() ); }
if ( ListLibsExtra.Length() ) { plugin->SetAdditionalRootLibs ( ListLibsExtra.Data() ); }
if ( PluginMode == PluginType::test )
{ plugin->StartAnalysis(iNumEvents); }
else {
pMgr->SetDebugLevel(0);
plugin->StartAnalysis();
}
}
cout << "END of EmcalJetCDF.C" << std::endl;
return pMgr;
}