]>
Commit | Line | Data |
---|---|---|
9b4cb8c1 | 1 | void AddTask_GammaConvV1_pPb3( Int_t trainConfig = 1, //change different set of cuts |
2 | Bool_t isMC = kFALSE, //run MC | |
3 | Int_t enableQAMesonTask = 0, //enable QA in AliAnalysisTaskGammaConvV1 | |
4 | Int_t enableQAPhotonTask = 0, // enable additional QA task | |
5 | TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input | |
6 | Int_t doWeightingPart = 0, //enable Weighting | |
7 | TString generatorName = "DPMJET", | |
344100c4 | 8 | TString cutnumberAODBranch = "8000000160084000001500000" // cutnumber for AOD branch |
9b4cb8c1 | 9 | ) { |
344100c4 | 10 | |
11 | Int_t isHeavyIon = 2; | |
12 | ||
13 | // ================= Load Librariers ================================= | |
14 | gSystem->Load("libCore.so"); | |
15 | gSystem->Load("libTree.so"); | |
16 | gSystem->Load("libGeom.so"); | |
17 | gSystem->Load("libVMC.so"); | |
18 | gSystem->Load("libPhysics.so"); | |
19 | gSystem->Load("libMinuit"); | |
20 | gSystem->Load("libSTEERBase"); | |
21 | gSystem->Load("libESD"); | |
22 | gSystem->Load("libAOD"); | |
23 | gSystem->Load("libANALYSIS"); | |
24 | gSystem->Load("libANALYSISalice"); | |
25 | gSystem->Load("libPWGGAGammaConv.so"); | |
26 | gSystem->Load("libCDB.so"); | |
27 | gSystem->Load("libSTEER.so"); | |
28 | gSystem->Load("libSTEERBase.so"); | |
29 | gSystem->Load("libTENDER.so"); | |
30 | gSystem->Load("libTENDERSupplies.so"); | |
31 | ||
32 | // ================== GetAnalysisManager =============================== | |
33 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
34 | if (!mgr) { | |
35 | Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found."); | |
36 | return ; | |
37 | } | |
38 | ||
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 | ||
48 | //========= Set Cutnumber for V0Reader ================================ | |
49 | //offline V0Finder | |
50 | TString cutnumberPhoton = "160084001001500000000"; | |
51 | TString cutnumberEvent = "8000000"; | |
52 | Bool_t doEtaShift = kFALSE; | |
53 | AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); | |
54 | //========= Add V0 Reader to ANALYSIS manager if not yet existent ===== | |
55 | if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){ | |
56 | AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1"); | |
57 | ||
58 | fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE); | |
59 | fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output | |
60 | fV0ReaderV1->SetUseAODConversionPhoton(kTRUE); | |
61 | ||
62 | if (!mgr) { | |
63 | Error("AddTask_V0ReaderV1", "No analysis manager found."); | |
64 | return; | |
65 | } | |
66 | ||
67 | AliConvEventCuts *fEventCuts=NULL; | |
68 | if(cutnumberEvent!=""){ | |
69 | fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data()); | |
70 | fEventCuts->SetPreSelectionCutFlag(kTRUE); | |
71 | if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){ | |
72 | fEventCuts->DoEtaShift(doEtaShift); | |
73 | fV0ReaderV1->SetEventCuts(fEventCuts); | |
74 | fEventCuts->SetFillCutHistograms("",kTRUE); | |
75 | } | |
76 | } | |
77 | ||
78 | // Set AnalysisCut Number | |
79 | AliConversionPhotonCuts *fCuts=NULL; | |
80 | if(cutnumberPhoton!=""){ | |
81 | fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data()); | |
82 | fCuts->SetPreSelectionCutFlag(kTRUE); | |
83 | fCuts->SetIsHeavyIon(isHeavyIon); | |
84 | if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){ | |
85 | fV0ReaderV1->SetConversionCuts(fCuts); | |
86 | fCuts->SetFillCutHistograms("",kTRUE); | |
87 | } | |
88 | } | |
89 | if(inputHandler->IsA()==AliAODInputHandler::Class()){ | |
90 | // AOD mode | |
91 | cout << "AOD handler: adding " << cutnumberAODBranch.Data() << " as conversion branch" << endl; | |
92 | fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data())); | |
93 | } | |
94 | fV0ReaderV1->Init(); | |
95 | ||
96 | AliLog::SetGlobalLogLevel(AliLog::kInfo); | |
97 | ||
98 | //connect input V0Reader | |
99 | mgr->AddTask(fV0ReaderV1); | |
100 | mgr->ConnectInput(fV0ReaderV1,0,cinput); | |
101 | ||
102 | } | |
103 | ||
104 | //================================================ | |
105 | //========= Add task to the ANALYSIS manager ===== | |
106 | //================================================ | |
107 | // find input container | |
108 | AliAnalysisTaskGammaConvV1 *task=NULL; | |
109 | task= new AliAnalysisTaskGammaConvV1(Form("GammaConvV1_%i",trainConfig)); | |
110 | task->SetIsHeavyIon(isHeavyIon); | |
111 | task->SetIsMC(isMC); | |
112 | // Cut Numbers to use in Analysis | |
113 | Int_t numberOfCuts = 4; | |
114 | ||
115 | TString *eventCutArray = new TString[numberOfCuts]; | |
116 | TString *photonCutArray = new TString[numberOfCuts]; | |
117 | TString *mesonCutArray = new TString[numberOfCuts]; | |
118 | Bool_t doEtaShiftIndCuts = kFALSE; | |
119 | TString stringShift = ""; | |
120 | ||
121 | if (trainConfig == 1) { | |
122 | eventCutArray[ 0] = "8000011"; photonCutArray[ 0] = "102092170008260400000"; mesonCutArray[ 0] = "01621035009000"; // all Photon Qualities //offline V0Finder | |
123 | eventCutArray[ 1] = "8000011"; photonCutArray[ 1] = "102092170008260420000"; mesonCutArray[ 1] = "01621035009000"; // only photon quality 1 //offline V0Finder | |
124 | eventCutArray[ 2] = "8000011"; photonCutArray[ 2] = "102092170008260430000"; mesonCutArray[ 2] = "01621035009000"; // only photon quality 2 //offline V0Finder | |
125 | eventCutArray[ 3] = "8000011"; photonCutArray[ 3] = "102092170008260440000"; mesonCutArray[ 3] = "01621035009000"; // only photon quality 3 //offline V0Finder | |
126 | } else if (trainConfig == 2) { | |
127 | eventCutArray[ 0] = "8000012"; photonCutArray[ 0] = "102092170008260400000"; mesonCutArray[ 0] = "01621035009000"; // all Photon Qualities //offline V0Finder | |
128 | eventCutArray[ 0] = "8000012"; photonCutArray[ 1] = "102092170008260420000"; mesonCutArray[ 1] = "01621035009000"; // only photon quality 1 //offline V0Finder | |
129 | eventCutArray[ 0] = "8000012"; photonCutArray[ 2] = "102092170008260430000"; mesonCutArray[ 2] = "01621035009000"; // only photon quality 2 //offline V0Finder | |
130 | eventCutArray[ 0] = "8000012"; photonCutArray[ 3] = "102092170008260440000"; mesonCutArray[ 3] = "01621035009000"; // only photon quality 3 //offline V0Finder | |
131 | } else { | |
132 | Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration"); | |
133 | return; | |
9b4cb8c1 | 134 | } |
344100c4 | 135 | |
136 | TList *EventCutList = new TList(); | |
9b4cb8c1 | 137 | TList *ConvCutList = new TList(); |
138 | TList *MesonCutList = new TList(); | |
139 | ||
140 | TList *HeaderList = new TList(); | |
141 | if (doWeightingPart==1) { | |
142 | TObjString *Header1 = new TObjString("pi0_1"); | |
143 | HeaderList->Add(Header1); | |
144 | } | |
145 | if (doWeightingPart==2){ | |
146 | TObjString *Header3 = new TObjString("eta_2"); | |
147 | HeaderList->Add(Header3); | |
148 | } | |
149 | if (doWeightingPart==3) { | |
150 | TObjString *Header1 = new TObjString("pi0_1"); | |
151 | HeaderList->Add(Header1); | |
152 | TObjString *Header3 = new TObjString("eta_2"); | |
153 | HeaderList->Add(Header3); | |
154 | } | |
155 | ||
156 | ||
157 | Bool_t doWeighting = kFALSE; | |
158 | if (doWeightingPart == 1 || doWeightingPart == 2 || doWeightingPart == 3) doWeighting = kTRUE; | |
159 | ||
344100c4 | 160 | EventCutList->SetOwner(kTRUE); |
161 | AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts]; | |
9b4cb8c1 | 162 | ConvCutList->SetOwner(kTRUE); |
163 | AliConversionCuts **analysisCuts = new AliConversionCuts*[numberOfCuts]; | |
164 | MesonCutList->SetOwner(kTRUE); | |
165 | AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts]; | |
166 | ||
167 | ||
168 | for(Int_t i = 0; i<numberOfCuts; i++){ | |
169 | ||
344100c4 | 170 | analysisEventCuts[i] = new AliConvEventCuts(); |
9b4cb8c1 | 171 | if ( trainConfig == 1 ){ |
172 | if (doWeighting){ | |
173 | if (generatorName.CompareTo("DPMJET")==0){ | |
344100c4 | 174 | analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kTRUE, kFALSE, fileNameInputForWeighting, "Pi0_DPMJET_LHC13b2_efix_pPb_5023GeV_MBV0A", "Eta_DPMJET_LHC13b2_efix_pPb_5023GeV_MBV0A", "","Pi0_Fit_Data_pPb_5023GeV_MBV0A","Eta_Fit_Data_pPb_5023GeV_MBV0A"); |
9b4cb8c1 | 175 | } else if (generatorName.CompareTo("HIJING")==0){ |
344100c4 | 176 | analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kTRUE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13e7_pPb_5023GeV_MBV0A", "Eta_Hijing_LHC13e7_pPb_5023GeV_MBV0A", "","Pi0_Fit_Data_pPb_5023GeV_MBV0A","Eta_Fit_Data_pPb_5023GeV_MBV0A"); |
9b4cb8c1 | 177 | } |
178 | } | |
179 | } | |
180 | if ( trainConfig == 2 ){ | |
181 | if (doWeighting){ | |
344100c4 | 182 | analysisEventCuts[i]->SetUseReweightingWithHistogramFromFile(kTRUE, kTRUE, kFALSE, fileNameInputForWeighting, "Pi0_Hijing_LHC13e7_addSig_pPb_5023GeV_MBV0A", "Eta_Hijing_LHC13e7_addSig_pPb_5023GeV_MBV0A", "","Pi0_Fit_Data_pPb_5023GeV_MBV0A","Eta_Fit_Data_pPb_5023GeV_MBV0A"); |
9b4cb8c1 | 183 | } |
184 | ||
185 | } | |
186 | ||
344100c4 | 187 | analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data()); |
9b4cb8c1 | 188 | if (doEtaShiftIndCuts) { |
344100c4 | 189 | analysisEventCuts[i]->DoEtaShift(doEtaShiftIndCuts); |
190 | analysisEventCuts[i]->SetEtaShift(stringShift); | |
191 | } | |
192 | if (trainConfig == 179 || trainConfig == 180) { | |
193 | analysisEventCuts[0]->DoEtaShift(kTRUE); | |
194 | analysisEventCuts[0]->SetEtaShift(-0.215); | |
9b4cb8c1 | 195 | } |
196 | ||
344100c4 | 197 | EventCutList->Add(analysisEventCuts[i]); |
198 | analysisEventCuts[i]->SetFillCutHistograms("",kFALSE); | |
199 | ||
200 | analysisCuts[i] = new AliConversionPhotonCuts(); | |
201 | analysisCuts[i]->InitializeCutsFromCutString(photonCutArray[i].Data()); | |
202 | analysisCuts[i]->SetIsHeavyIon(isHeavyIon); | |
9b4cb8c1 | 203 | ConvCutList->Add(analysisCuts[i]); |
9b4cb8c1 | 204 | analysisCuts[i]->SetFillCutHistograms("",kFALSE); |
344100c4 | 205 | |
9b4cb8c1 | 206 | analysisMesonCuts[i] = new AliConversionMesonCuts(); |
207 | analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data()); | |
208 | MesonCutList->Add(analysisMesonCuts[i]); | |
209 | analysisMesonCuts[i]->SetFillCutHistograms(""); | |
344100c4 | 210 | analysisEventCuts[i]->SetAcceptedHeader(HeaderList); |
9b4cb8c1 | 211 | } |
212 | ||
344100c4 | 213 | task->SetEventCutList(numberOfCuts,EventCutList); |
9b4cb8c1 | 214 | task->SetConversionCutList(numberOfCuts,ConvCutList); |
215 | task->SetMesonCutList(numberOfCuts,MesonCutList); | |
216 | task->SetMoveParticleAccordingToVertex(kTRUE); | |
217 | task->SetDoMesonAnalysis(kTRUE); | |
218 | task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA | |
219 | task->SetDoPhotonQA(enableQAPhotonTask); //Attention new switch small for Photon QA | |
220 | ||
221 | //connect containers | |
222 | AliAnalysisDataContainer *coutput = | |
223 | mgr->CreateContainer(Form("GammaConvV1_%i",trainConfig), TList::Class(), | |
224 | AliAnalysisManager::kOutputContainer,Form("GammaConvV1_%i.root",trainConfig)); | |
225 | ||
226 | mgr->AddTask(task); | |
227 | mgr->ConnectInput(task,0,cinput); | |
228 | mgr->ConnectOutput(task,1,coutput); | |
229 | ||
230 | return; | |
231 | ||
232 | } |