AliPhysics  a0db429 (a0db429)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
AddHFMCCheck.C
Go to the documentation of this file.
1 AliAnalysisTaskCheckHFMCProd *AddHFMCCheck(Int_t system=0, Bool_t readMC=kTRUE){
2 
3  // Creates, configures and attaches to the train the task for QA of ITS standalone tracks
4  // Get the pointer to the existing analysis manager via the static access method.
5  //==============================================================================
6  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
7  if (!mgr) {
8  ::Error("AliAnalysisTaskCheckHFMCProd", "No analysis manager to connect to.");
9  return NULL;
10  }
11 
12  // Check the analysis type using the event handlers connected to the analysis manager.
13  //==============================================================================
14  if (!mgr->GetInputEventHandler()) {
15  ::Error("AliAnalysisTaskCheckHFMCProd", "This task requires an input event handler");
16  return NULL;
17  }
18 
19  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
20  if(type.Contains("AOD")){
21  ::Error("AliAnalysisTaskCheckHFMCProd", "This task requires to run on ESD");
22  return NULL;
23  }
24 
25  //Bool_t isMC=kFALSE;
26  //if (mgr->GetMCtruthEventHandler()) isMC=kTRUE;
27 
28  // Add MC handler (for kinematics)
29  if(readMC){
30  AliMCEventHandler* handler = new AliMCEventHandler;
31  handler->SetReadTR(kFALSE);
32  mgr->SetMCtruthEventHandler(handler);
33  }
34  // Create and configure the task
36  if(system==1) task->SetPbPb();
37  if(system==2) task->SetpPb();
38  task->SetReadMC(readMC);
39  mgr->AddTask(task);
40 
41  // Create ONLY the output containers for the data produced by the task.
42  // Get and connect other common input/output containers via the manager as below
43  //==============================================================================
44  TString outputFileName = AliAnalysisManager::GetCommonFileName();
45  outputFileName += ":HFMCCheck";
46 
47  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clistHFMCCheck",
48  TList::Class(),
49  AliAnalysisManager::kOutputContainer,
50  outputFileName );
51 
52  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
53  mgr->ConnectOutput(task, 1, coutput1);
54  return task;
55 }
AliAnalysisTaskCheckHFMCProd * AddHFMCCheck(Int_t system=0, Bool_t readMC=kTRUE)
Definition: AddHFMCCheck.C:1