]>
Commit | Line | Data |
---|---|---|
808c4b8b | 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 | ||
e5d42f45 | 11 | void CreateStandardAODfromESD() |
808c4b8b | 12 | { |
e5d42f45 | 13 | |
14 | const char *inFileName = "AliESDs.root"; | |
15 | const char *outFileName = "AliAOD.root"; | |
16 | Bool_t writeKineToAOD = kTRUE; | |
17 | TString mode="local"; // "grid" | |
18 | ||
808c4b8b | 19 | gSystem->Load("libTree"); |
20 | gSystem->Load("libGeom"); | |
21 | gSystem->Load("libPhysics"); | |
22 | gSystem->Load("libVMC"); | |
23 | gSystem->Load("libSTEERBase"); | |
24 | gSystem->Load("libESD"); | |
25 | gSystem->Load("libAOD"); | |
26 | ||
27 | gSystem->Load("libANALYSIS"); | |
28 | gSystem->Load("libANALYSISalice"); | |
29 | gSystem->Load("libPWG3muon"); | |
30 | ||
e5d42f45 | 31 | TChain *chain=0; |
32 | if(mode=="local") { // local | |
33 | chain = new TChain("esdTree"); | |
34 | // Steering input chain | |
35 | chain->Add(inFileName); | |
36 | } else if(mode=="grid") { // grid | |
37 | const char *collectionfile = "esd_coll1.xml"; | |
38 | TGrid::Connect("alien:",0,0,"t") ; | |
39 | //Create an AliRunTagCuts and an AliEventTagCuts Object and impose some selection criteria | |
40 | AliRunTagCuts *runCuts = new AliRunTagCuts(); | |
41 | AliEventTagCuts *eventCuts = new AliEventTagCuts(); | |
42 | AliLHCTagCuts *lhcCuts = new AliLHCTagCuts(); | |
43 | AliDetectorTagCuts *detCuts = new AliDetectorTagCuts(); | |
44 | // eventCuts->SetMultiplicityRange(0,20000); | |
45 | //Create an AliTagAnalysis Object and chain the tags | |
46 | AliTagAnalysis *tagAna = new AliTagAnalysis(); | |
47 | tagAna->SetType("ESD"); | |
48 | TAlienCollection *coll = TAlienCollection::Open(collectionfile); | |
49 | TGridResult *tagResult = coll->GetGridResult("",0,0); | |
50 | tagResult->Print(); | |
51 | tagAna->ChainGridTags(tagResult); | |
52 | //Create a new esd chain and assign the chain that is returned by querying the tags | |
53 | chain = tagAna->QueryTags(runCuts,lhcCuts,detCuts,eventCuts); | |
54 | } else { | |
55 | printf("ERROR: mode has to be \"local\" or \"grid\"\n"); | |
56 | return; | |
57 | } | |
58 | ||
808c4b8b | 59 | AliAnalysisManager *mgr = new AliAnalysisManager("ESD to AOD", "Analysis Manager"); |
60 | ||
61 | // Input | |
62 | AliESDInputHandler* inpHandler = new AliESDInputHandler(); | |
63 | mgr->SetInputEventHandler (inpHandler); | |
64 | ||
65 | // Output | |
66 | AliAODHandler* aodHandler = new AliAODHandler(); | |
67 | aodHandler->SetOutputFileName(outFileName); | |
68 | mgr->SetOutputEventHandler(aodHandler); | |
69 | ||
70 | // MC Truth | |
71 | AliMCEventHandler* mcHandler = new AliMCEventHandler(); | |
72 | if(writeKineToAOD) mgr->SetMCtruthEventHandler(mcHandler); | |
73 | ||
74 | // Tasks | |
75 | ||
76 | // Filtering of MC particles (decays conversions etc) | |
77 | // this task is also needed to set the MCEventHandler | |
78 | // to the AODHandler, this will not be needed when | |
79 | // AODHandler goes to ANALYSISalice | |
80 | AliAnalysisTaskMCParticleFilter *kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Filter"); | |
81 | if(writeKineToAOD) mgr->AddTask(kinefilter); | |
82 | ||
83 | // Barrel Tracks | |
84 | AliAnalysisTaskESDfilter *filter = new AliAnalysisTaskESDfilter("Filter"); | |
85 | mgr->AddTask(filter); | |
86 | ||
87 | // Muons | |
88 | AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter"); | |
89 | mgr->AddTask(esdmuonfilter); | |
90 | ||
91 | AliESDtrackCuts* esdTrackCutsHF = new AliESDtrackCuts("AliESDtrackCuts", "Heavy flavour"); | |
92 | esdTrackCutsHF->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny); | |
93 | ||
94 | AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter"); | |
95 | trackFilter->AddCuts(esdTrackCutsHF); | |
96 | ||
97 | filter->SetTrackFilter(trackFilter); | |
98 | ||
99 | // Pipelining | |
100 | AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain", TChain::Class(), | |
101 | AliAnalysisManager::kInputContainer); | |
102 | ||
103 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(), | |
104 | AliAnalysisManager::kOutputContainer, | |
105 | "default"); | |
106 | ||
107 | ||
108 | mgr->ConnectInput(filter,0,cinput1); | |
109 | mgr->ConnectOutput(filter,0,coutput1); | |
110 | ||
111 | mgr->ConnectInput(esdmuonfilter,0,cinput1); | |
112 | mgr->ConnectOutput(esdmuonfilter,0,coutput1); | |
113 | ||
114 | if(writeKineToAOD) { | |
115 | mgr->ConnectInput(kinefilter,0,cinput1); | |
116 | mgr->ConnectOutput(kinefilter,0,coutput1); | |
117 | } | |
118 | // | |
119 | // Run the analysis | |
120 | // | |
121 | mgr->InitAnalysis(); | |
122 | mgr->PrintStatus(); | |
e5d42f45 | 123 | mgr->StartAnalysis(mode.Data(),chain); |
808c4b8b | 124 | |
125 | return; | |
126 | } |