Fix bug introduced in rev28206 - Thanks to Bogdan! (Javier)
[u/mrichter/AliRoot.git] / STEER / CreateAODfromESD.C
CommitLineData
e985a35a 1#if !defined(__CINT__) || defined(__MAKECINT__)
e95e4176 2#include <TChain.h>
3#include <TSystem.h>
4#include "AliAnalysisManager.h"
5#include "AliESDInputHandler.h"
6#include "AliAODHandler.h"
7#include "AliAnalysisTaskESDfilter.h"
8#include "AliAnalysisDataContainer.h"
e985a35a 9#endif
10
cf22b3fc 11void CreateAODfromESD(const char *inFileName = "AliESDs.root",
eebdd52e 12 const char *outFileName = "AliAODs.root") {
3dd9f9e3 13
17d9550f 14 gSystem->Load("libTree");
15 gSystem->Load("libGeom");
16 gSystem->Load("libPhysics");
17 gSystem->Load("libVMC");
18 gSystem->Load("libSTEERBase");
19 gSystem->Load("libESD");
20 gSystem->Load("libAOD");
e95e4176 21
17d9550f 22 gSystem->Load("libANALYSIS");
23 gSystem->Load("libANALYSISalice");
35d4b769 24 gSystem->Load("libPWG3muon");
e95e4176 25
35d4b769 26 TChain *chain = new TChain("esdTree");
e95e4176 27 // Steering input chain
28 chain->Add(inFileName);
29 AliAnalysisManager *mgr = new AliAnalysisManager("ESD to AOD", "Analysis Manager");
30
31 // Input
32 AliESDInputHandler* inpHandler = new AliESDInputHandler();
fdce1c9b 33 inpHandler->SetReadTags();
e95e4176 34 mgr->SetInputEventHandler (inpHandler);
35
36 // Output
37 AliAODHandler* aodHandler = new AliAODHandler();
38 aodHandler->SetOutputFileName(outFileName);
39 mgr->SetOutputEventHandler(aodHandler);
40
41 // Task
35d4b769 42 // Barrel Tracks
e95e4176 43 AliAnalysisTaskESDfilter *filter = new AliAnalysisTaskESDfilter("Filter");
44 mgr->AddTask(filter);
35d4b769 45 // Muons
46 AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter");
47 mgr->AddTask(esdmuonfilter);
e95e4176 48
fdce1c9b 49 // Cuts on primary tracks
215fb466 50 AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Standard");
51 esdTrackCutsL->SetMinNClustersTPC(50);
52 esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
fdce1c9b 53 esdTrackCutsL->SetMaxCovDiagonalElements(2, 2, 0.5, 0.5, 2);
215fb466 54 esdTrackCutsL->SetRequireTPCRefit(kTRUE);
20da34af 55 esdTrackCutsL->SetMaxDCAToVertexXY(3.0);
fdce1c9b 56 esdTrackCutsL->SetRequireSigmaToVertex(kFALSE);
215fb466 57 esdTrackCutsL->SetAcceptKingDaughters(kFALSE);
58
59 AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
60 trackFilter->AddCuts(esdTrackCutsL);
61
fdce1c9b 62 // Cuts on V0s
63 AliESDv0Cuts* esdV0Cuts = new AliESDv0Cuts("AliESDv0Cuts", "Standard pp");
64 esdV0Cuts->SetMinRadius(0.2);
65 esdV0Cuts->SetMaxRadius(100);
66 esdV0Cuts->SetMinDcaPosToVertex(0.05);
67 esdV0Cuts->SetMinDcaNegToVertex(0.05);
68 esdV0Cuts->SetMaxDcaV0Daughters(0.5);
69 esdV0Cuts->SetMinCosinePointingAngle(0.99);
70 AliAnalysisFilter* v0Filter = new AliAnalysisFilter("v0Filter");
71 v0Filter->AddCuts(esdV0Cuts);
72
73
74//
215fb466 75 filter->SetTrackFilter(trackFilter);
fdce1c9b 76 filter->SetV0Filter(v0Filter);
77
78
79// Create AOD Tags
80 AliAnalysisTaskTagCreator* tagTask = new AliAnalysisTaskTagCreator("AOD Tag Creator");
81 mgr->AddTask(tagTask);
215fb466 82
e95e4176 83 // Pipelining
f5fa84ac 84 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
85 AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
fdce1c9b 86 AliAnalysisDataContainer *coutputT
87 = mgr->CreateContainer("cTag", TTree::Class(), AliAnalysisManager::kOutputContainer, "AOD.tag.root");
88
e95e4176 89 mgr->ConnectInput (filter, 0, cinput1 );
90 mgr->ConnectOutput(filter, 0, coutput1);
91
35d4b769 92 mgr->ConnectInput (esdmuonfilter, 0, cinput1 );
f5fa84ac 93// mgr->ConnectOutput(esdmuonfilter, 0, coutput1);
35d4b769 94
fdce1c9b 95 mgr->ConnectInput (tagTask, 0, cinput1);
96 mgr->ConnectOutput(tagTask, 1, coutputT);
97
e95e4176 98 //
99 // Run the analysis
100 //
101 mgr->InitAnalysis();
102 mgr->PrintStatus();
103 mgr->StartAnalysis("local", chain);
df9db588 104}