added copy ctor and assignment
[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",
12 const char *outFileName = "AliAOD.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");
e95e4176 24 TChain *chain = new TChain("esdTree");
25
26 // Steering input chain
27 chain->Add(inFileName);
28 AliAnalysisManager *mgr = new AliAnalysisManager("ESD to AOD", "Analysis Manager");
29
30 // Input
31 AliESDInputHandler* inpHandler = new AliESDInputHandler();
32 mgr->SetInputEventHandler (inpHandler);
33
34 // Output
35 AliAODHandler* aodHandler = new AliAODHandler();
36 aodHandler->SetOutputFileName(outFileName);
37 mgr->SetOutputEventHandler(aodHandler);
38
39 // Task
40 AliAnalysisTaskESDfilter *filter = new AliAnalysisTaskESDfilter("Filter");
41 mgr->AddTask(filter);
42
43
44 // Pipelining
45 AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain", TChain::Class(),
46 AliAnalysisManager::kInputContainer);
47
48 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(),
49 AliAnalysisManager::kOutputContainer,
50 "default");
5f04e2f5 51
85ba66b8 52
e95e4176 53 mgr->ConnectInput (filter, 0, cinput1 );
54 mgr->ConnectOutput(filter, 0, coutput1);
55
56 //
57 // Run the analysis
58 //
59 mgr->InitAnalysis();
60 mgr->PrintStatus();
61 mgr->StartAnalysis("local", chain);
df9db588 62}