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