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