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