Separated AddTasks for pp, PbPb, pPb & added root file for reweighting spectra
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvV1_pp.C
CommitLineData
33bbd991 1void AddTask_GammaConvV1_pp( Int_t trainConfig = 1, //change different set of cuts
2 Bool_t isMC = kFALSE, //run MC
3 Bool_t enableQAMesonTask = kFALSE, //enable QA in AliAnalysisTaskGammaConvV1
4 Bool_t enableQAPhotonTask = kFALSE // enable additional QA task
5 TString fileNameInputForWeighting = "MCSpectraInput.root" // path to file for weigting input
6 ) {
7
8 // ================= Load Librariers =================================
9 gSystem->Load("libCore.so");
10 gSystem->Load("libTree.so");
11 gSystem->Load("libGeom.so");
12 gSystem->Load("libVMC.so");
13 gSystem->Load("libPhysics.so");
14 gSystem->Load("libMinuit");
15 gSystem->Load("libSTEERBase");
16 gSystem->Load("libESD");
17 gSystem->Load("libAOD");
18 gSystem->Load("libANALYSIS");
19 gSystem->Load("libANALYSISalice");
20 gSystem->Load("libPWGGAGammaConv.so");
21 gSystem->Load("libCDB.so");
22 gSystem->Load("libSTEER.so");
23 gSystem->Load("libSTEERBase.so");
24 gSystem->Load("libTENDER.so");
25 gSystem->Load("libTENDERSupplies.so");
26
27 // ================== GetAnalysisManager ===============================
28 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
29 if (!mgr) {
30 Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
31 return ;
32 }
33
34 // ================== GetInputEventHandler =============================
35 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
36
37 //========= Add PID Reponse to ANALYSIS manager ====
38 if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
39 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
40 AddTaskPIDResponse(isMC);
41 }
42
43 //========= Set Cutnumber for V0Reader ================================
44 TString cutnumber = "0000000002084000002200000";
45
46 //========= Add V0 Reader to ANALYSIS manager if not yet existent =====
47 if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
48 AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
49
50 fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
51 fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
52 fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
53
54 if (!mgr) {
55 Error("AddTask_V0ReaderV1", "No analysis manager found.");
56 return;
57 }
58
59 // Set AnalysisCut Number
60 AliConversionCuts *fCuts=NULL;
61 if(cutnumber!=""){
62 fCuts= new AliConversionCuts(cutnumber.Data(),cutnumber.Data());
63 fCuts->SetPreSelectionCutFlag(kTRUE);
64 if(fCuts->InitializeCutsFromCutString(cutnumber.Data())){
65 fV0ReaderV1->SetConversionCuts(fCuts);
66 fCuts->SetFillCutHistograms("",kTRUE);
67 }
68 }
69 fV0ReaderV1->Init();
70
71 AliLog::SetGlobalLogLevel(AliLog::kInfo);
72
73 //================================================
74 // data containers for V0Reader
75 //================================================
76 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
77 //connect input V0Reader
78 mgr->AddTask(fV0ReaderV1);
79 mgr->ConnectInput(fV0ReaderV1,0,cinput);
80
81 }
82
83 //================================================
84 //========= Add task to the ANALYSIS manager =====
85 //================================================
86 // data containers
87 //================================================
88 // find input container
89 AliAnalysisTaskGammaConvV1 *task=NULL;
90 task= new AliAnalysisTaskGammaConvV1(Form("GammaConvV1_%i",trainConfig));
91 task->SetIsHeavyIon(0);
92 task->SetIsMC(isMC);
93 // Cut Numbers to use in Analysis
94 Int_t numberOfCuts = 4;
95
96 TString *cutarray = new TString[numberOfCuts];
97 TString *mesonCutArray = new TString[numberOfCuts];
98
99 if(trainConfig === 1){
100 cutarray[ 0] = "0000012002093663003800000"; mesonCutArray[0] = "01631031009"; //standard cut Pi0 pp 2.76TeV without SDD , only boxes
101 cutarray[ 1] = "0001012002093663003800000"; mesonCutArray[1] = "01631031009"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND , only boxes
102 cutarray[ 2] = "0000012002093260003800000"; mesonCutArray[2] = "01631031009"; //standard cut Gamma pp 2-76TeV , only boxes
103 cutarray[ 3] = "0000012002093260003800000"; mesonCutArray[3] = "01631031009"; //standard cut Gamma pp 2-76TeV , only boxes
104 } else if (trainConfig == 2) {
105 cutarray[ 0] = "0000011002093663003800000"; mesonCutArray[0] = "01631031009"; //standard cut Pi0 pp 2.76TeV without SDD , only Minbias MC
106 cutarray[ 1] = "0001011002093663003800000"; mesonCutArray[1] = "01631031009"; //standard cut Pi0 pp 2.76TeV without SDD, V0AND
107 cutarray[ 2] = "0000011002093260003800000"; mesonCutArray[2] = "01631031009"; //standard cut Gamma pp 2-76TeV
108 cutarray[ 3] = "0000011002093260003800000"; mesonCutArray[3] = "01631031009"; //standard cut Gamma pp 2-76TeV , only boxes
109 } else if (trainConfig == 3) {
110 cutarray[ 0] = "0002011002093663003800000"; mesonCutArray[0] = "01631031009"; //standard cut Pi0 pp 2.76TeV with SDD , only Minbias MC
111 cutarray[ 1] = "0003011002093663003800000"; mesonCutArray[1] = "01631031009"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND , only Minbias MC
112 cutarray[ 2] = "0002012002093663003800000"; mesonCutArray[2] = "01631031009"; //standard cut Pi0 pp 2.76TeV with SDD , only Boxes MC
113 cutarray[ 3] = "0003012002093663003800000"; mesonCutArray[3] = "01631031009"; //standard cut Pi0 pp 2.76TeV with SDD, V0AND, only Boxes MC
114 } else {
115 Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
116 return;
117 }
118
119 TList *ConvCutList = new TList();
120 TList *MesonCutList = new TList();
121
122 TList *HeaderList = new TList();
123 TObjString *Header2 = new TObjString("BOX");
124 HeaderList->Add(Header2);
125
126 ConvCutList->SetOwner(kTRUE);
127 AliConversionCuts **analysisCuts = new AliConversionCuts*[numberOfCuts];
128 MesonCutList->SetOwner(kTRUE);
129 AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
130
131
132 for(Int_t i = 0; i<numberOfCuts; i++){
133 analysisCuts[i] = new AliConversionCuts();
134 analysisCuts[i]->InitializeCutsFromCutString(cutarray[i].Data());
135 ConvCutList->Add(analysisCuts[i]);
136
137 analysisCuts[i]->SetFillCutHistograms("",kFALSE);
138 analysisMesonCuts[i] = new AliConversionMesonCuts();
139 analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
140 MesonCutList->Add(analysisMesonCuts[i]);
141 analysisMesonCuts[i]->SetFillCutHistograms("");
142 analysisCuts[i]->SetAcceptedHeader(HeaderList);
143 }
144
145 task->SetConversionCutList(numberOfCuts,ConvCutList);
146 task->SetMesonCutList(numberOfCuts,MesonCutList);
147 task->SetMoveParticleAccordingToVertex(kTRUE);
148 task->SetDoMesonAnalysis(kTRUE);
149 if (enableQAMesonTask) task->SetDoMesonQA(kTRUE); //Attention new switch for Pi0 QA
150 if (enableQAMesonTask) task->SetDoPhotonQA(kTRUE); //Attention new switch small for Photon QA
151
152 //connect containers
153 AliAnalysisDataContainer *coutput =
154 mgr->CreateContainer("GammaConvV1", TList::Class(),
155 AliAnalysisManager::kOutputContainer,Form("GammaConvV1_%i.root",trainConfig));
156
157 mgr->AddTask(task);
158 mgr->ConnectInput(task,0,cinput);
159 mgr->ConnectOutput(task,1,coutput);
160
161 return;
162
163}