]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/macros/AddTaskV0QA.C
Updating ITS macros (Ruben)
[u/mrichter/AliRoot.git] / PWGPP / macros / AddTaskV0QA.C
1 ///////////////////////////////////////////////////////////////////////////////
2 // Macro to setup AliAnalysisTaskV0QA for
3 // V0 performance QA to run on PWGPP QA train.
4 // ESD and MC input handlers must be attached to AliAnalysisManager
5 // 
6 // Output:
7 // V0QA.root file with V0QA for gammas,K0s,Lambdas, antilambdas is created.
8 //
9 // The file contains 4 THnSparse generic histograms which
10 // have to be analysed using the macros 
11 // PWGPP/macros/plotSparseK0.C
12 // PWGPP/macros/plotSparseGamma.C
13 // PWGPP/macros/plotSparseL.C
14 // PWGPP/macros/plotSparseAL.C
15 // 
16 // 14.10.09 A. Marin  a.marin@gsi.de
17 ///////////////////////////////////////
18  
19 AliAnalysisTaskV0QA *AddTaskV0QA(Bool_t bUseMCInfo=kTRUE)
20 {
21 // Creates a filter task and adds it to the analysis manager.
22
23    // Get the pointer to the existing analysis manager via the static access method.
24    //==============================================================================
25    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
26    if (!mgr) {
27       ::Error("AddTaskV0QA", "No analysis manager to connect to.");
28       return NULL;
29    }   
30    
31    // This task requires an ESD input handler and an AOD output handler.
32    // Check this using the analysis manager.
33    //===============================================================================
34    TString type = mgr->GetInputEventHandler()->GetDataType();
35    if (!type.Contains("ESD")) {
36       ::Error("AddTaskV0QA", "V0QA task needs the manager to have an ESD input handler.");
37       return NULL;
38    }   
39
40    // Check if MC handler is connected in case kine filter requested
41    AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
42    if (!mcH && bUseMCInfo)) {
43       ::Error("AddTaskV0QA", "No MC handler connected");
44       return NULL;
45    }   
46    
47    // Create the task, add it to the manager and configure it.
48    //===========================================================================   
49    // Barrel tracks filter
50    AliAnalysisTaskV0QA * v0QA = new AliAnalysisTaskV0QA("V0QA");
51    mgr->AddTask(v0QA);
52
53
54    // Create ONLY the output containers for the data produced by the task.
55    // Get and connect other common input/output containers via the manager as below
56    //==============================================================================
57    mgr->ConnectInput  (v0QA,  0, mgr->GetCommonInputContainer());
58
59    // Create containers for output
60
61    AliAnalysisDataContainer *coutput_v0QA =  
62    mgr->CreateContainer("V0QA", TList::Class(), 
63                         AliAnalysisManager::kOutputContainer, Form("%s:%s", mgr->GetCommonFileName(),v0QA->GetName()));
64    mgr->ConnectOutput(v0QA, 1, coutput_v0QA);
65         
66
67    return v0QA;
68 }