AliPhysics  vAN-20150924 (e816f45)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AddTaskVertexingHF.C
Go to the documentation of this file.
1 AliAnalysisTaskSEVertexingHF *AddTaskVertexingHF(const char* fname="AliAOD.VertexingHF.root") {
2  //
3  // Creates a task for heavy flavour vertexing and adds it to the analysis manager.
4  // andrea.dainese@lnl.infn.it
5  //
6 
7  // Get the pointer to the existing analysis manager via the static access method.
8  //==============================================================================
9  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
10  if (!mgr) {
11  ::Error("AddTaskVertexingHF", "No analysis manager to connect to.");
12  return NULL;
13  }
14 
15  // This task requires an ESD or AOD input handler and an AOD output handler.
16  // Check this using the analysis manager.
17  //===============================================================================
18  TString type = mgr->GetInputEventHandler()->GetDataType();
19  if (!type.Contains("ESD") && !type.Contains("AOD")) {
20  ::Error("AddTaskVertexingHF", "HF vertexing task needs the manager to have an ESD or AOD input handler.");
21  return NULL;
22  }
23  // Check if AOD output handler exist.
24  AliAODHandler *aodh = (AliAODHandler*)mgr->GetOutputEventHandler();
25  if (!aodh) {
26  ::Error("AddTaskVertexingHF", "HF vertexing task needs the manager to have an AOD output handler.");
27  return NULL;
28  }
29 
30  // Create the task, add it to the manager and configure it.
31  //===========================================================================
32  AliAnalysisTaskSEVertexingHF *hfTask = new AliAnalysisTaskSEVertexingHF("vertexing HF");
33  hfTask->SetDeltaAODFileName(fname);
34  mgr->AddTask(hfTask);
35 
36  //
37  // Create containers for input/output
38  AliAnalysisDataContainer *coutputListOfCuts = mgr->CreateContainer("ListOfCuts",TList::Class(),AliAnalysisManager::kOutputContainer,hfTask->GetDeltaAODFileName()); //cuts
39 
40  mgr->ConnectInput(hfTask,0,mgr->GetCommonInputContainer());
41  mgr->ConnectOutput(hfTask,0,mgr->GetCommonOutputContainer());
42  mgr->ConnectOutput(hfTask,1,coutputListOfCuts);
43 
44  return hfTask;
45 }
AliAnalysisTaskSEVertexingHF * AddTaskVertexingHF(const char *fname="AliAOD.VertexingHF.root")