TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_Resolution.C
CommitLineData
344100c4 1void AddTask_Resolution( TString V0ReaderEventCutNumber = "8000000",
48a2b226 2 TString V0ReaderPhotonCutNumber = "060000084001001500000000",
344100c4 3 TString TaskEventCutnumber = "8000011",
48a2b226 4 TString TaskPhotonCutnumber = "092000092170008260400000",
344100c4 5 Bool_t IsMC = kTRUE,
6 Int_t IsHeavyIon = 0,
7 TString cutnumberAODBranch = "0000000060084001001500000",
8 Bool_t doEtaShiftV0Reader = kFALSE
72395bd9 9 ){
63674d67 10
63674d67 11 //get the current analysis manager
12 // ================= Load Librariers =================================
13 gSystem->Load("libCore.so");
14 gSystem->Load("libTree.so");
15 gSystem->Load("libGeom.so");
16 gSystem->Load("libVMC.so");
17 gSystem->Load("libPhysics.so");
18 gSystem->Load("libMinuit");
19 gSystem->Load("libSTEERBase");
20 gSystem->Load("libESD");
21 gSystem->Load("libAOD");
22 gSystem->Load("libANALYSIS");
23 gSystem->Load("libANALYSISalice");
63674d67 24 gSystem->Load("libCDB.so");
25 gSystem->Load("libSTEER.so");
26 gSystem->Load("libSTEERBase.so");
af472fff 27 gSystem->Load("libTender.so");
28 gSystem->Load("libTenderSupplies.so");
4e1b9acf 29 gSystem->Load("libPWGflowBase.so");
30 gSystem->Load("libPWGflowTasks.so");
31 gSystem->Load("libPWGGAGammaConv.so");
32
63674d67 33 // ================== GetAnalysisManager ===============================
34 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
35 if (!mgr) {
36 Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
37 return ;
38 }
72395bd9 39
63674d67 40 // ================== GetInputEventHandler =============================
41 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
42
43 //========= Add PID Reponse to ANALYSIS manager ====
44 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
45 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
46 AddTaskPIDResponse(isMC);
47 }
72395bd9 48
63674d67 49 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
50 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
51 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
52
53 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
54 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
55 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
72395bd9 56
63674d67 57 if (!mgr) {
58 Error("AddTask_V0ReaderV1", "No analysis manager found.");
59 return;
60 }
72395bd9 61
344100c4 62 AliConvEventCuts *fEventCuts=NULL;
63 if(V0ReaderEventCutNumber!=""){
64 fEventCuts= new AliConvEventCuts(V0ReaderEventCutNumber.Data(),V0ReaderEventCutNumber.Data());
65 fEventCuts->SetPreSelectionCutFlag(kTRUE);
66 if(fEventCuts->InitializeCutsFromCutString(V0ReaderEventCutNumber.Data())){
67 fV0ReaderV1->SetEventCuts(fEventCuts);
68 fEventCuts->SetFillCutHistograms("",kTRUE);
63674d67 69 if (IsHeavyIon==2){
344100c4 70 fEventCuts->SelectCollisionCandidates(AliVEvent::kINT7);
71 fEventCuts->DoEtaShift(doEtaShiftV0Reader);
63674d67 72 }
344100c4 73 }
74 }
75
76 // Set AnalysisCut Number
77 AliConversionPhotonCuts *fCuts=NULL;
78 if(V0ReaderPhotonCutNumber!=""){
79 fCuts= new AliConversionPhotonCuts(V0ReaderPhotonCutNumber.Data(),V0ReaderPhotonCutNumber.Data());
80 fCuts->SetPreSelectionCutFlag(kTRUE);
81 fCuts->SetIsHeavyIon(IsHeavyIon);
82 if(fCuts->InitializeCutsFromCutString(V0ReaderPhotonCutNumber.Data())){
63674d67 83 fV0ReaderV1->SetConversionCuts(fCuts);
84 fCuts->SetFillCutHistograms("",kTRUE);
85 }
86 }
87
88
89 if(inputHandler->IsA()==AliAODInputHandler::Class()){
90 // AOD mode
91 fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
92 }
93 fV0ReaderV1->Init();
72395bd9 94
63674d67 95 AliLog::SetGlobalLogLevel(AliLog::kInfo);
72395bd9 96
63674d67 97 //connect input V0Reader
98 mgr->AddTask(fV0ReaderV1);
99 mgr->ConnectInput(fV0ReaderV1,0,cinput);
72395bd9 100
63674d67 101 } else {
102 Error("AddTask_V0ReaderV1", "Cannot execute AddTask, V0ReaderV1 already exists.");
103 }
72395bd9 104
344100c4 105 AliConvEventCuts *analysisEventCuts = new AliConvEventCuts();
106 analysisEventCuts->InitializeCutsFromCutString(TaskEventCutnumber.Data());
107 analysisEventCuts->SetFillCutHistograms("",kFALSE);
72395bd9 108
344100c4 109 AliConversionPhotonCuts *analysisCuts = new AliConversionPhotonCuts();
110 analysisCuts->InitializeCutsFromCutString(TaskPhotonCutnumber.Data());
63674d67 111 analysisCuts->SetFillCutHistograms("",kFALSE);
344100c4 112
113 AliAnalysisTaskResolution *fResolution= new AliAnalysisTaskResolution(Form("%s_%s_Resolution",(analysisEventCuts->GetCutNumber()).Data(), (analysisCuts->GetCutNumber()).Data()));
114 fResolution->SetEventCuts(analysisEventCuts,IsHeavyIon);
63674d67 115 fResolution->SetConversionCuts(analysisCuts,IsHeavyIon);
116 fResolution->SetIsMC(IsMC);
117 mgr->AddTask(fResolution);
344100c4 118
63674d67 119 AliAnalysisDataContainer *coutput1 =
344100c4 120 mgr->CreateContainer(Form("GammaConvResolution_%s_%s", TaskEventCutnumber.Data(), TaskPhotonCutnumber.Data()), TList::Class(),
121 AliAnalysisManager::kOutputContainer, Form("GammaConv_Resolution_%s_%s.root", TaskEventCutnumber.Data(), TaskPhotonCutnumber.Data()));
72395bd9 122
63674d67 123 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
124 mgr->ConnectInput(fResolution, 0, cinput1 );
125 mgr->ConnectOutput (fResolution, 1, coutput1);
72395bd9 126 //connect containers
344100c4 127 return;
72395bd9 128}
129