better just warning than error in case of mirrors requesting when putting to local...
[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",
368ca218 12 const char *outFileName = "AliAOD.root",
d0e7e1bf 13 Bool_t bKineFilter = kTRUE)
14{
3dd9f9e3 15
17d9550f 16 gSystem->Load("libTree");
17 gSystem->Load("libGeom");
18 gSystem->Load("libPhysics");
19 gSystem->Load("libVMC");
20 gSystem->Load("libSTEERBase");
21 gSystem->Load("libESD");
22 gSystem->Load("libAOD");
e95e4176 23
17d9550f 24 gSystem->Load("libANALYSIS");
25 gSystem->Load("libANALYSISalice");
d5061c46 26 gSystem->Load("libCORRFW");
40a0a69c 27 gSystem->Load("libPWGHFbase");
28 gSystem->Load("libPWGmuon");
e95e4176 29
35d4b769 30 TChain *chain = new TChain("esdTree");
e95e4176 31 // Steering input chain
32 chain->Add(inFileName);
33 AliAnalysisManager *mgr = new AliAnalysisManager("ESD to AOD", "Analysis Manager");
34
35 // Input
36 AliESDInputHandler* inpHandler = new AliESDInputHandler();
08dccdc4 37 inpHandler->SetReadFriends(kFALSE);
fdce1c9b 38 inpHandler->SetReadTags();
e95e4176 39 mgr->SetInputEventHandler (inpHandler);
e95e4176 40 // Output
41 AliAODHandler* aodHandler = new AliAODHandler();
42 aodHandler->SetOutputFileName(outFileName);
43 mgr->SetOutputEventHandler(aodHandler);
44
d0e7e1bf 45 // MC Truth
46 if(bKineFilter){
47 AliMCEventHandler* mcHandler = new AliMCEventHandler();
48 mgr->SetMCtruthEventHandler(mcHandler);
49 }
50
51
52 // Tasks
53 // Filtering of MC particles (decays conversions etc)
54 // this task is also needed to set the MCEventHandler
55 // to the AODHandler, this will not be needed when
56 // AODHandler goes to ANALYSISalice
57 AliAnalysisTaskMCParticleFilter *kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Filter");
58 if (bKineFilter) mgr->AddTask(kinefilter);
59
35d4b769 60 // Barrel Tracks
e95e4176 61 AliAnalysisTaskESDfilter *filter = new AliAnalysisTaskESDfilter("Filter");
62 mgr->AddTask(filter);
35d4b769 63 // Muons
64 AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter");
65 mgr->AddTask(esdmuonfilter);
e95e4176 66
fdce1c9b 67 // Cuts on primary tracks
215fb466 68 AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Standard");
69 esdTrackCutsL->SetMinNClustersTPC(50);
70 esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
fdce1c9b 71 esdTrackCutsL->SetMaxCovDiagonalElements(2, 2, 0.5, 0.5, 2);
215fb466 72 esdTrackCutsL->SetRequireTPCRefit(kTRUE);
20da34af 73 esdTrackCutsL->SetMaxDCAToVertexXY(3.0);
75bcd466 74 esdTrackCutsL->SetMaxDCAToVertexZ(3.0);
75 esdTrackCutsL->SetDCAToVertex2D(kTRUE);
fdce1c9b 76 esdTrackCutsL->SetRequireSigmaToVertex(kFALSE);
d0e7e1bf 77 esdTrackCutsL->SetAcceptKinkDaughters(kFALSE);
b6594780 78 // ITS stand-alone tracks
79 AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("AliESDtrackCuts", "ITS stand-alone");
80 esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);
215fb466 81
82 AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
83 trackFilter->AddCuts(esdTrackCutsL);
b6594780 84 trackFilter->AddCuts(esdTrackCutsITSsa);
215fb466 85
fdce1c9b 86 // Cuts on V0s
87 AliESDv0Cuts* esdV0Cuts = new AliESDv0Cuts("AliESDv0Cuts", "Standard pp");
88 esdV0Cuts->SetMinRadius(0.2);
52672e29 89 esdV0Cuts->SetMaxRadius(200);
fdce1c9b 90 esdV0Cuts->SetMinDcaPosToVertex(0.05);
91 esdV0Cuts->SetMinDcaNegToVertex(0.05);
52672e29 92 esdV0Cuts->SetMaxDcaV0Daughters(1.0);
fdce1c9b 93 esdV0Cuts->SetMinCosinePointingAngle(0.99);
94 AliAnalysisFilter* v0Filter = new AliAnalysisFilter("v0Filter");
95 v0Filter->AddCuts(esdV0Cuts);
96
97
98//
215fb466 99 filter->SetTrackFilter(trackFilter);
fdce1c9b 100 filter->SetV0Filter(v0Filter);
101
102
103// Create AOD Tags
104 AliAnalysisTaskTagCreator* tagTask = new AliAnalysisTaskTagCreator("AOD Tag Creator");
105 mgr->AddTask(tagTask);
215fb466 106
e95e4176 107 // Pipelining
d0e7e1bf 108 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
f5fa84ac 109 AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
d0e7e1bf 110
111
fdce1c9b 112 AliAnalysisDataContainer *coutputT
113 = mgr->CreateContainer("cTag", TTree::Class(), AliAnalysisManager::kOutputContainer, "AOD.tag.root");
6518ad6b 114
115 coutput1->SetSpecialOutput();
116 coutputT->SetSpecialOutput();
fdce1c9b 117
d0e7e1bf 118 if(bKineFilter) {
119 mgr->ConnectInput (kinefilter, 0, cinput1 );
120 mgr->ConnectOutput (kinefilter, 0, coutput1 );
121 }
122
e95e4176 123 mgr->ConnectInput (filter, 0, cinput1 );
124 mgr->ConnectOutput(filter, 0, coutput1);
125
35d4b769 126 mgr->ConnectInput (esdmuonfilter, 0, cinput1 );
f5fa84ac 127// mgr->ConnectOutput(esdmuonfilter, 0, coutput1);
35d4b769 128
fdce1c9b 129 mgr->ConnectInput (tagTask, 0, cinput1);
130 mgr->ConnectOutput(tagTask, 1, coutputT);
131
e95e4176 132 //
133 // Run the analysis
134 //
135 mgr->InitAnalysis();
136 mgr->PrintStatus();
137 mgr->StartAnalysis("local", chain);
df9db588 138}
b6594780 139