modification in addTask for AOD creation.
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_ConversionAODProduction.C
CommitLineData
ae947965 1AliAnalysisTask *AddTask_ConversionAODProduction(Int_t dataset=0, Bool_t isMC = kFALSE){
d30a006f 2
fc98dbf3 3 // Before doing anything, we load the needed library
4 gSystem->Load("libPWGGAGammaConv.so");
d30a006f 5 // dataset 0: pp
6 // dataset 1: PbPb
ae947965 7 // dataset 2: pPb
d30a006f 8
9 //get the current analysis manager
10 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
11 if (!mgr) {
fc98dbf3 12 Error("AddTask_V0ReaderV1", "No analysis manager found.");
13 return 0;
d30a006f 14 }
15
ae947965 16 //========= Add PID Reponse to ANALYSIS manager ====
17 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
18 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
19 AddTaskPIDResponse(isMC);
20 }
21
d30a006f 22 TString analysiscut;
ae947965 23 TString analysiscutB;
d30a006f 24
ae947965 25 if(dataset == 1){
fc98dbf3 26 // Old cut string, no longer compatible with AliConversionCuts
27 // analysiscut="900177009350113211200001000000000";
28 // New cut string as of April 2013
ae947965 29 analysiscut= "1000000060084000001500000";
30 analysiscutB="1000000160084000001500000";
31 } else if (dataset == 2){
32 analysiscut= "8000000060084000001500000";
33 analysiscutB="8000000160084000001500000";
34 } else{
35 // analysiscut="
36 analysiscut ="0000000060084001001500000";
37 analysiscutB="0000000160084001001500000";
d30a006f 38 }
39
40 //========= Add V0 Reader to ANALYSIS manager =====
41
42 AliV0ReaderV1 *fV0Reader=new AliV0ReaderV1("ConvGammaAODProduction");
43 fV0Reader->SetCreateAODs(kTRUE);
44 fV0Reader->SetUseOwnXYZCalculation(kTRUE);
ae947965 45 fV0Reader->SetUseAODConversionPhoton(kTRUE);
701932b8 46// fV0Reader->CheckAODConsistency();
ae947965 47
48 AliV0ReaderV1 *fV0ReaderB=new AliV0ReaderV1("ConvGammaAODProductionB");
49 fV0ReaderB->SetCreateAODs(kTRUE);
50 fV0ReaderB->SetUseOwnXYZCalculation(kTRUE);
51 fV0ReaderB->SetUseAODConversionPhoton(kTRUE);
52 fV0ReaderB->CheckAODConsistency();
53
d30a006f 54 // Set AnalysisCut Number
55 AliConversionCuts *fCuts= new AliConversionCuts(analysiscut.Data(),analysiscut.Data());
ae947965 56 AliConversionCuts *fCutsB= new AliConversionCuts(analysiscutB.Data(),analysiscutB.Data());
d30a006f 57 if(fCuts->InitializeCutsFromCutString(analysiscut.Data())){
fc98dbf3 58 fV0Reader->SetConversionCuts(fCuts);
d30a006f 59 }
60 fV0Reader->Init();
d30a006f 61
ae947965 62 if(fCutsB->InitializeCutsFromCutString(analysiscutB.Data())){
63 fV0ReaderB->SetConversionCuts(fCutsB);
64 }
65 fV0ReaderB->Init();
66
67
d30a006f 68 AliLog::SetGlobalLogLevel(AliLog::kInfo);
69
70 //================================================
71 // data containers
72 //================================================
73 // find input container
74 //below the trunk version
75 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
76
77 // connect input V0Reader
78 fV0Reader->SelectCollisionCandidates(AliVEvent::kAny);
ae947965 79 mgr->AddTask(fV0Reader);
d30a006f 80 mgr->ConnectInput (fV0Reader,0,cinput);
81
ae947965 82 fV0ReaderB->SelectCollisionCandidates(AliVEvent::kAny);
83 mgr->AddTask(fV0ReaderB);
84 mgr->ConnectInput (fV0ReaderB,0,cinput);
85
d30a006f 86 return fV0Reader;
87}