Working on the electron cut
[u/mrichter/AliRoot.git] / prod / LHC09c1 / CreateAODfromESD.C
CommitLineData
456aec39 1#if !defined(__CINT__) || defined(__MAKECINT__)
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"
9#endif
10
11void CreateAODfromESD(const char *inFileName = "AliESDs.root",
12 const char *outFileName = "AliAODs.root",
13 Bool_t bKineFilter = kTRUE)
14{
15
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");
23
24 gSystem->Load("libANALYSIS");
25 gSystem->Load("libANALYSISalice");
26 gSystem->Load("libCORRFW");
27 gSystem->Load("libPWG3muon");
28
29 TChain *chain = new TChain("esdTree");
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();
36 inpHandler->SetReadTags();
37 mgr->SetInputEventHandler (inpHandler);
38 // Output
39 AliAODHandler* aodHandler = new AliAODHandler();
40 aodHandler->SetOutputFileName(outFileName);
41 mgr->SetOutputEventHandler(aodHandler);
42
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
58 // Barrel Tracks
59 AliAnalysisTaskESDfilter *filter = new AliAnalysisTaskESDfilter("Filter");
60 mgr->AddTask(filter);
61 // Muons
62 AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter");
63 mgr->AddTask(esdmuonfilter);
64
65 // Cuts on primary tracks
66 AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Standard");
67 esdTrackCutsL->SetMinNClustersTPC(50);
68 esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
69 esdTrackCutsL->SetMaxCovDiagonalElements(2, 2, 0.5, 0.5, 2);
70 esdTrackCutsL->SetRequireTPCRefit(kTRUE);
71 esdTrackCutsL->SetMaxDCAToVertexXY(3.0);
72 esdTrackCutsL->SetMaxDCAToVertexZ(3.0);
73 esdTrackCutsL->SetDCAToVertex2D(kTRUE);
74 esdTrackCutsL->SetRequireSigmaToVertex(kFALSE);
75 esdTrackCutsL->SetAcceptKinkDaughters(kFALSE);
76 // ITS stand-alone tracks
77 AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("AliESDtrackCuts", "ITS stand-alone");
78 esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);
79
80 AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
81 trackFilter->AddCuts(esdTrackCutsL);
82 trackFilter->AddCuts(esdTrackCutsITSsa);
83
84 // Cuts on V0s
85 AliESDv0Cuts* esdV0Cuts = new AliESDv0Cuts("AliESDv0Cuts", "Standard pp");
86 esdV0Cuts->SetMinRadius(0.2);
87 esdV0Cuts->SetMaxRadius(200);
88 esdV0Cuts->SetMinDcaPosToVertex(0.05);
89 esdV0Cuts->SetMinDcaNegToVertex(0.05);
90 esdV0Cuts->SetMaxDcaV0Daughters(1.0);
91 esdV0Cuts->SetMinCosinePointingAngle(0.99);
92 AliAnalysisFilter* v0Filter = new AliAnalysisFilter("v0Filter");
93 v0Filter->AddCuts(esdV0Cuts);
94
95
96//
97 filter->SetTrackFilter(trackFilter);
98 filter->SetV0Filter(v0Filter);
99
100
101// Create AOD Tags
102 AliAnalysisTaskTagCreator* tagTask = new AliAnalysisTaskTagCreator("AOD Tag Creator");
103 mgr->AddTask(tagTask);
104
105 // Pipelining
106 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
107 AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
108
109
110 AliAnalysisDataContainer *coutputT
111 = mgr->CreateContainer("cTag", TTree::Class(), AliAnalysisManager::kOutputContainer, "AOD.tag.root");
112
113 coutput1->SetSpecialOutput();
114 coutputT->SetSpecialOutput();
115
116 if(bKineFilter) {
117 mgr->ConnectInput (kinefilter, 0, cinput1 );
118 mgr->ConnectOutput (kinefilter, 0, coutput1 );
119 }
120
121 mgr->ConnectInput (filter, 0, cinput1 );
122 mgr->ConnectOutput(filter, 0, coutput1);
123
124 mgr->ConnectInput (esdmuonfilter, 0, cinput1 );
125// mgr->ConnectOutput(esdmuonfilter, 0, coutput1);
126
127 mgr->ConnectInput (tagTask, 0, cinput1);
128 mgr->ConnectOutput(tagTask, 1, coutputT);
129
130 //
131 // Run the analysis
132 //
133 mgr->InitAnalysis();
134 mgr->PrintStatus();
135 mgr->StartAnalysis("local", chain);
136}
137