]>
Commit | Line | Data |
---|---|---|
344100c4 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Authors: Svein Lindal, Daniel Lohner * | |
5 | * Version 1.0 * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | //////////////////////////////////////////////// | |
17 | //--------------------------------------------- | |
18 | // Class handling all kinds of selection cuts for | |
19 | // Gamma Conversion analysis | |
20 | //--------------------------------------------- | |
21 | //////////////////////////////////////////////// | |
22 | ||
23 | #include "AliConvEventCuts.h" | |
24 | ||
25 | #include "AliAODTrack.h" | |
26 | #include "AliESDtrack.h" | |
27 | #include "AliAnalysisManager.h" | |
28 | #include "AliInputEventHandler.h" | |
29 | #include "AliMCEventHandler.h" | |
30 | #include "AliAODHandler.h" | |
31 | #include "TH1.h" | |
32 | #include "TH2.h" | |
33 | #include "TF1.h" | |
34 | #include "AliStack.h" | |
35 | #include "TObjString.h" | |
36 | #include "AliAODEvent.h" | |
37 | #include "AliESDEvent.h" | |
38 | #include "AliCentrality.h" | |
39 | #include "TList.h" | |
40 | #include "TFile.h" | |
41 | #include "AliLog.h" | |
42 | #include "AliGenCocktailEventHeader.h" | |
43 | #include "AliGenDPMjetEventHeader.h" | |
44 | #include "AliGenPythiaEventHeader.h" | |
45 | #include "AliGenHijingEventHeader.h" | |
46 | #include "AliTriggerAnalysis.h" | |
47 | #include "AliV0ReaderV1.h" | |
48 | #include "AliAODMCParticle.h" | |
49 | #include "AliAODMCHeader.h" | |
50 | ||
51 | class iostream; | |
52 | ||
53 | using namespace std; | |
54 | ||
55 | ClassImp(AliConvEventCuts) | |
56 | ||
57 | ||
58 | const char* AliConvEventCuts::fgkCutNames[AliConvEventCuts::kNCuts] = { | |
59 | "HeavyIon", //0 | |
60 | "CentralityMin", //1 | |
61 | "CentralityMax", //2 | |
62 | "SelectSpecialTrigger", //3 | |
63 | "SelectSpecialSubTriggerClass", //4 | |
64 | "RemovePileUp", //5 | |
65 | "RejectExtraSignals", //6 | |
66 | }; | |
67 | ||
68 | ||
69 | //________________________________________________________________________ | |
70 | AliConvEventCuts::AliConvEventCuts(const char *name,const char *title) : | |
dc729816 | 71 | AliAnalysisCuts(name,title), |
72 | fHistograms(NULL), | |
73 | fHeaderList(NULL), | |
74 | fEventQuality(-1), | |
75 | fIsHeavyIon(0), | |
76 | fDetectorCentrality(0), | |
77 | fModCentralityClass(0), | |
78 | fMaxVertexZ(10), | |
79 | fCentralityMin(0), | |
80 | fCentralityMax(0), | |
81 | fMultiplicityMethod(0), | |
82 | fSpecialTrigger(0), | |
83 | fSpecialSubTrigger(0), | |
84 | fRemovePileUp(kFALSE), | |
85 | fRejectExtraSignals(0), | |
86 | fOfflineTriggerMask(0), | |
87 | fHasV0AND(kTRUE), | |
88 | fIsSDDFired(kTRUE), | |
89 | fRandom(0), | |
90 | fnHeaders(0), | |
91 | fNotRejectedStart(NULL), | |
92 | fNotRejectedEnd(NULL), | |
93 | fGeneratorNames(NULL), | |
94 | fCutString(NULL), | |
95 | fUtils(NULL), | |
96 | fEtaShift(0.0), | |
97 | fDoEtaShift(kFALSE), | |
98 | fDoReweightHistoMCPi0(kFALSE), | |
99 | fDoReweightHistoMCEta(kFALSE), | |
100 | fDoReweightHistoMCK0s(kFALSE), | |
101 | fPathTrFReweighting(""), | |
102 | fNameHistoReweightingPi0(""), | |
103 | fNameHistoReweightingEta(""), | |
104 | fNameHistoReweightingK0s(""), | |
105 | fNameFitDataPi0(""), | |
106 | fNameFitDataEta(""), | |
107 | fNameFitDataK0s(""), | |
108 | fHistoEventCuts(NULL), | |
109 | hCentrality(NULL), | |
110 | hCentralityVsNumberOfPrimaryTracks(NULL), | |
111 | hVertexZ(NULL), | |
112 | hTriggerClass(NULL), | |
113 | hTriggerClassSelected(NULL), | |
114 | hReweightMCHistPi0(NULL), | |
115 | hReweightMCHistEta(NULL), | |
116 | hReweightMCHistK0s(NULL), | |
117 | fFitDataPi0(NULL), | |
118 | fFitDataEta(NULL), | |
119 | fFitDataK0s(NULL), | |
120 | fAddedSignalPDGCode(0), | |
121 | fPreSelCut(kFALSE), | |
122 | fTriggerSelectedManually(kFALSE), | |
123 | fSpecialTriggerName(""), | |
124 | fSpecialSubTriggerName(""), | |
125 | fNSpecialSubTriggerOptions(0), | |
126 | fV0ReaderName(""), | |
127 | fCaloTriggers(NULL), | |
128 | fTriggerPatchInfo(NULL), | |
129 | fMainTriggerPatchEMCAL(NULL), | |
130 | fCaloTriggersName(""), | |
131 | fCaloTriggerPatchInfoName(""), | |
132 | fTriggersEMCAL(0), | |
133 | fTriggersEMCALSelected(-1), | |
134 | fEMCALTrigInitialized(kFALSE) | |
135 | ||
344100c4 | 136 | { |
137 | for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;} | |
138 | fCutString=new TObjString((GetCutNumber()).Data()); | |
139 | ||
140 | fUtils = new AliAnalysisUtils(); | |
141 | //if you do not want to apply the cut on the distance between the SPD and TRK vertex: | |
142 | //fUtils->SetCutOnZVertexSPD(kFALSE); | |
143 | ||
144 | ||
145 | } | |
146 | ||
147 | //________________________________________________________________________ | |
148 | AliConvEventCuts::AliConvEventCuts(const AliConvEventCuts &ref) : | |
dc729816 | 149 | AliAnalysisCuts(ref), |
150 | fHistograms(NULL), | |
151 | fHeaderList(ref.fHeaderList), | |
152 | fEventQuality(ref.fEventQuality), | |
153 | fIsHeavyIon(ref.fIsHeavyIon), | |
154 | fDetectorCentrality(ref.fDetectorCentrality), | |
155 | fModCentralityClass(ref.fModCentralityClass), | |
156 | fMaxVertexZ(ref.fMaxVertexZ), | |
157 | fCentralityMin(ref.fCentralityMin), | |
158 | fCentralityMax(ref.fCentralityMax), | |
159 | fMultiplicityMethod(ref.fMultiplicityMethod), | |
160 | fSpecialTrigger(ref.fSpecialTrigger), | |
161 | fSpecialSubTrigger(ref.fSpecialSubTrigger), | |
162 | fRemovePileUp(ref.fRemovePileUp), | |
163 | fRejectExtraSignals(ref.fRejectExtraSignals), | |
164 | fOfflineTriggerMask(ref.fOfflineTriggerMask), | |
165 | fHasV0AND(ref.fHasV0AND), | |
166 | fIsSDDFired(ref.fIsSDDFired), | |
167 | fRandom(ref.fRandom), | |
168 | fnHeaders(ref.fnHeaders), | |
169 | fNotRejectedStart(NULL), | |
170 | fNotRejectedEnd(NULL), | |
171 | fGeneratorNames(ref.fGeneratorNames), | |
172 | fCutString(NULL), | |
173 | fUtils(NULL), | |
174 | fEtaShift(ref.fEtaShift), | |
175 | fDoEtaShift(ref.fDoEtaShift), | |
176 | fDoReweightHistoMCPi0(ref.fDoReweightHistoMCPi0), | |
177 | fDoReweightHistoMCEta(ref.fDoReweightHistoMCEta), | |
178 | fDoReweightHistoMCK0s(ref.fDoReweightHistoMCK0s), | |
179 | fPathTrFReweighting(ref.fPathTrFReweighting), | |
180 | fNameHistoReweightingPi0(ref.fNameHistoReweightingPi0), | |
181 | fNameHistoReweightingEta(ref.fNameHistoReweightingEta), | |
182 | fNameHistoReweightingK0s(ref.fNameHistoReweightingK0s), | |
183 | fNameFitDataPi0(ref.fNameFitDataPi0), | |
184 | fNameFitDataEta(ref.fNameFitDataEta), | |
185 | fNameFitDataK0s(ref.fNameFitDataK0s), | |
186 | fHistoEventCuts(NULL), | |
187 | hCentrality(NULL), | |
188 | hCentralityVsNumberOfPrimaryTracks(NULL), | |
189 | hVertexZ(NULL), | |
190 | hTriggerClass(NULL), | |
191 | hTriggerClassSelected(NULL), | |
192 | hReweightMCHistPi0(ref.hReweightMCHistPi0), | |
193 | hReweightMCHistEta(ref.hReweightMCHistEta), | |
194 | hReweightMCHistK0s(ref.hReweightMCHistK0s), | |
195 | fFitDataPi0(ref.fFitDataPi0), | |
196 | fFitDataEta(ref.fFitDataEta), | |
197 | fFitDataK0s(ref.fFitDataK0s), | |
198 | fAddedSignalPDGCode(ref.fAddedSignalPDGCode), | |
199 | fPreSelCut(ref.fPreSelCut), | |
200 | fTriggerSelectedManually(ref.fTriggerSelectedManually), | |
201 | fSpecialTriggerName(ref.fSpecialTriggerName), | |
202 | fSpecialSubTriggerName(ref.fSpecialSubTriggerName), | |
203 | fNSpecialSubTriggerOptions(ref.fNSpecialSubTriggerOptions), | |
204 | fV0ReaderName(ref.fV0ReaderName), | |
205 | fCaloTriggers(NULL), | |
206 | fTriggerPatchInfo(NULL), | |
207 | fMainTriggerPatchEMCAL(NULL), | |
208 | fCaloTriggersName(ref.fCaloTriggersName), | |
209 | fCaloTriggerPatchInfoName(ref.fCaloTriggerPatchInfoName), | |
210 | fTriggersEMCAL(ref.fTriggersEMCAL), | |
211 | fTriggersEMCALSelected(ref.fTriggersEMCALSelected), | |
212 | fEMCALTrigInitialized(kFALSE) | |
344100c4 | 213 | { |
214 | // Copy Constructor | |
215 | for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];} | |
216 | fCutString=new TObjString((GetCutNumber()).Data()); | |
217 | fUtils = new AliAnalysisUtils(); | |
218 | // dont copy histograms (if you like histograms, call InitCutHistograms()) | |
219 | ||
220 | } | |
221 | ||
222 | ||
223 | //________________________________________________________________________ | |
224 | AliConvEventCuts::~AliConvEventCuts() { | |
225 | // Destructor | |
226 | //Deleting fHistograms leads to seg fault it it's added to output collection of a task | |
227 | // if(fHistograms) | |
228 | // delete fHistograms; | |
229 | // fHistograms = NULL; | |
230 | if(fCutString != NULL){ | |
231 | delete fCutString; | |
232 | fCutString = NULL; | |
233 | } | |
234 | if(fNotRejectedStart){ | |
235 | delete[] fNotRejectedStart; | |
236 | fNotRejectedStart = NULL; | |
237 | } | |
238 | if(fNotRejectedEnd){ | |
239 | delete[] fNotRejectedEnd; | |
240 | fNotRejectedEnd = NULL; | |
241 | } | |
242 | if(fGeneratorNames){ | |
243 | delete[] fGeneratorNames; | |
244 | fGeneratorNames = NULL; | |
245 | } | |
246 | if(fUtils){ | |
247 | delete fUtils; | |
248 | fUtils = NULL; | |
249 | } | |
250 | ||
251 | } | |
252 | ||
253 | //________________________________________________________________________ | |
254 | void AliConvEventCuts::InitCutHistograms(TString name, Bool_t preCut){ | |
255 | ||
256 | // Initialize Cut Histograms for QA (only initialized and filled if function is called) | |
257 | TH1::AddDirectory(kFALSE); | |
258 | ||
259 | if(fHistograms != NULL){ | |
260 | delete fHistograms; | |
261 | fHistograms=NULL; | |
262 | } | |
263 | if(fHistograms==NULL){ | |
264 | fHistograms=new TList(); | |
265 | fHistograms->SetOwner(kTRUE); | |
266 | if(name=="")fHistograms->SetName(Form("ConvEventCuts_%s",GetCutNumber().Data())); | |
267 | else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data())); | |
268 | } | |
269 | ||
270 | if (hReweightMCHistPi0){ | |
271 | hReweightMCHistPi0->SetName("MCInputForWeightingPi0"); | |
272 | fHistograms->Add(hReweightMCHistPi0); | |
273 | } | |
274 | if (hReweightMCHistEta){ | |
275 | hReweightMCHistEta->SetName("MCInputForWeightingEta"); | |
276 | fHistograms->Add(hReweightMCHistEta); | |
277 | } | |
278 | if (hReweightMCHistK0s){ | |
279 | hReweightMCHistK0s->SetName("MCInputForWeightingK0s"); | |
280 | fHistograms->Add(hReweightMCHistK0s); | |
281 | } | |
282 | ||
283 | hCentrality=new TH1F(Form("Centrality %s",GetCutNumber().Data()),"Centrality",100,0,100); | |
284 | fHistograms->Add(hCentrality); | |
285 | hCentralityVsNumberOfPrimaryTracks=new TH2F(Form("Centrality vs Primary Tracks %s",GetCutNumber().Data()),"Centrality vs Primary Tracks ",100,0,100,4000,0,4000); | |
286 | fHistograms->Add(hCentralityVsNumberOfPrimaryTracks); | |
287 | ||
288 | // Event Cuts and Info | |
289 | if(preCut){ | |
290 | fHistoEventCuts=new TH1F(Form("ESD_EventCuts %s",GetCutNumber().Data()),"Event Cuts",7,-0.5,6.5); | |
291 | fHistoEventCuts->GetXaxis()->SetBinLabel(1,"in"); | |
292 | fHistoEventCuts->GetXaxis()->SetBinLabel(2,"OfflineTrigger"); | |
293 | fHistoEventCuts->GetXaxis()->SetBinLabel(3,"nvtxcontr"); | |
294 | fHistoEventCuts->GetXaxis()->SetBinLabel(4,"VertexZ"); | |
295 | fHistoEventCuts->GetXaxis()->SetBinLabel(5,"pileup"); | |
296 | fHistoEventCuts->GetXaxis()->SetBinLabel(6,"centrsel"); | |
297 | fHistoEventCuts->GetXaxis()->SetBinLabel(7,"out"); | |
298 | fHistograms->Add(fHistoEventCuts); | |
299 | ||
300 | hVertexZ=new TH1F(Form("VertexZ %s",GetCutNumber().Data()),"VertexZ",1000,-50,50); | |
301 | fHistograms->Add(hVertexZ); | |
302 | ||
303 | hTriggerClass= new TH1F(Form("OfflineTrigger %s",GetCutNumber().Data()),"OfflineTrigger",35,-0.5,34.5); | |
304 | hTriggerClass->GetXaxis()->SetBinLabel( 1,"kMB"); | |
305 | hTriggerClass->GetXaxis()->SetBinLabel( 2,"kINT7"); | |
306 | hTriggerClass->GetXaxis()->SetBinLabel( 3,"kMUON"); | |
307 | hTriggerClass->GetXaxis()->SetBinLabel( 4,"kHighMult"); | |
308 | hTriggerClass->GetXaxis()->SetBinLabel( 5,"kKEMC1"); | |
309 | hTriggerClass->GetXaxis()->SetBinLabel( 6,"kCINT5"); | |
310 | hTriggerClass->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB"); | |
311 | hTriggerClass->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB"); | |
312 | hTriggerClass->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB"); | |
313 | hTriggerClass->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB"); | |
314 | hTriggerClass->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8"); | |
315 | hTriggerClass->GetXaxis()->SetBinLabel(12,"kMUS7"); | |
316 | hTriggerClass->GetXaxis()->SetBinLabel(13,"kPHI1"); | |
317 | hTriggerClass->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb"); | |
318 | hTriggerClass->GetXaxis()->SetBinLabel(15,"kEMCEJE"); | |
319 | hTriggerClass->GetXaxis()->SetBinLabel(16,"kEMCEGA"); | |
320 | hTriggerClass->GetXaxis()->SetBinLabel(17,"kCentral"); | |
321 | hTriggerClass->GetXaxis()->SetBinLabel(18,"kSemiCentral"); | |
322 | hTriggerClass->GetXaxis()->SetBinLabel(19,"kDG5"); | |
323 | hTriggerClass->GetXaxis()->SetBinLabel(20,"kZED"); | |
324 | hTriggerClass->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI"); | |
325 | hTriggerClass->GetXaxis()->SetBinLabel(22,"kINT8"); | |
326 | hTriggerClass->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8"); | |
327 | hTriggerClass->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8"); | |
328 | hTriggerClass->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8"); | |
329 | hTriggerClass->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8"); | |
330 | hTriggerClass->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0"); | |
331 | hTriggerClass->GetXaxis()->SetBinLabel(28,"kUserDefined"); | |
332 | hTriggerClass->GetXaxis()->SetBinLabel(29,"kTRD"); | |
333 | hTriggerClass->GetXaxis()->SetBinLabel(30,"kFastOnly"); | |
334 | hTriggerClass->GetXaxis()->SetBinLabel(31,"kAnyINT"); | |
335 | hTriggerClass->GetXaxis()->SetBinLabel(32,"kAny"); | |
336 | hTriggerClass->GetXaxis()->SetBinLabel(33,"V0AND"); | |
337 | hTriggerClass->GetXaxis()->SetBinLabel(34,"NOT kFastOnly"); | |
338 | hTriggerClass->GetXaxis()->SetBinLabel(35,"failed Physics Selection"); | |
339 | fHistograms->Add(hTriggerClass); | |
340 | } | |
341 | if(!preCut){ | |
342 | hTriggerClassSelected= new TH1F(Form("OfflineTriggerSelected %s",GetCutNumber().Data()),"OfflineTriggerSelected",34,-0.5,33.5); | |
343 | hTriggerClassSelected->GetXaxis()->SetBinLabel( 1,"kMB"); | |
344 | hTriggerClassSelected->GetXaxis()->SetBinLabel( 2,"kINT7"); | |
345 | hTriggerClassSelected->GetXaxis()->SetBinLabel( 3,"kMUON"); | |
346 | hTriggerClassSelected->GetXaxis()->SetBinLabel( 4,"kHighMult"); | |
347 | hTriggerClassSelected->GetXaxis()->SetBinLabel( 5,"kKEMC1"); | |
348 | hTriggerClassSelected->GetXaxis()->SetBinLabel( 6,"kCINT5"); | |
349 | hTriggerClassSelected->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB"); | |
350 | hTriggerClassSelected->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB"); | |
351 | hTriggerClassSelected->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB"); | |
352 | hTriggerClassSelected->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB"); | |
353 | hTriggerClassSelected->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8"); | |
354 | hTriggerClassSelected->GetXaxis()->SetBinLabel(12,"kMUS7"); | |
355 | hTriggerClassSelected->GetXaxis()->SetBinLabel(13,"kPHI1"); | |
356 | hTriggerClassSelected->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb"); | |
357 | hTriggerClassSelected->GetXaxis()->SetBinLabel(15,"kEMCEJE"); | |
358 | hTriggerClassSelected->GetXaxis()->SetBinLabel(16,"kEMCEGA"); | |
359 | hTriggerClassSelected->GetXaxis()->SetBinLabel(17,"kCentral"); | |
360 | hTriggerClassSelected->GetXaxis()->SetBinLabel(18,"kSemiCentral"); | |
361 | hTriggerClassSelected->GetXaxis()->SetBinLabel(19,"kDG5"); | |
362 | hTriggerClassSelected->GetXaxis()->SetBinLabel(20,"kZED"); | |
363 | hTriggerClassSelected->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI"); | |
364 | hTriggerClassSelected->GetXaxis()->SetBinLabel(22,"kINT8"); | |
365 | hTriggerClassSelected->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8"); | |
366 | hTriggerClassSelected->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8"); | |
367 | hTriggerClassSelected->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8"); | |
368 | hTriggerClassSelected->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8"); | |
369 | hTriggerClassSelected->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0"); | |
370 | hTriggerClassSelected->GetXaxis()->SetBinLabel(28,"kUserDefined"); | |
371 | hTriggerClassSelected->GetXaxis()->SetBinLabel(29,"kTRD"); | |
372 | hTriggerClassSelected->GetXaxis()->SetBinLabel(30,"kFastOnly"); | |
373 | hTriggerClassSelected->GetXaxis()->SetBinLabel(31,"kAnyINT"); | |
374 | hTriggerClassSelected->GetXaxis()->SetBinLabel(32,"kAny"); | |
375 | hTriggerClassSelected->GetXaxis()->SetBinLabel(33,"V0AND"); | |
376 | hTriggerClassSelected->GetXaxis()->SetBinLabel(34,"NOT kFastOnly"); | |
377 | fHistograms->Add(hTriggerClassSelected); | |
378 | ||
379 | } | |
380 | TH1::AddDirectory(kTRUE); | |
381 | } | |
382 | ||
383 | ///________________________________________________________________________ | |
384 | Bool_t AliConvEventCuts::EventIsSelected(AliVEvent *fInputEvent, AliVEvent *fMCEvent){ | |
385 | // Process Event Selection | |
386 | ||
387 | Int_t cutindex=0; | |
388 | if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex); | |
389 | cutindex++; | |
390 | ||
391 | // Check for MC event | |
dc729816 | 392 | Bool_t isMC = kFALSE; |
344100c4 | 393 | if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){ |
394 | // Check if MC event is correctly loaded | |
395 | AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
396 | if (!mcHandler){ | |
397 | fEventQuality = 2; | |
398 | return kFALSE; | |
399 | } | |
400 | if (!mcHandler->InitOk() ){ | |
401 | fEventQuality = 2; | |
402 | return kFALSE; | |
403 | } | |
404 | if (!mcHandler->TreeK() ){ | |
405 | fEventQuality = 2; | |
406 | return kFALSE; | |
407 | } | |
408 | if (!mcHandler->TreeTR() ) { | |
409 | fEventQuality = 2; | |
410 | return kFALSE; | |
411 | } | |
dc729816 | 412 | isMC = kTRUE; |
344100c4 | 413 | } |
414 | ||
dc729816 | 415 | |
416 | ||
344100c4 | 417 | // Event Trigger |
418 | // cout << "before event trigger" << endl; | |
dc729816 | 419 | if(!IsTriggerSelected(fInputEvent, isMC )){ |
344100c4 | 420 | if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex); |
421 | fEventQuality = 3; | |
422 | return kFALSE; | |
423 | } | |
424 | cutindex++; | |
425 | ||
426 | if(fInputEvent->IsA()==AliESDEvent::Class()){ | |
427 | AliTriggerAnalysis fTriggerAnalysis;// = new AliTriggerAnalysis; | |
428 | fHasV0AND = fTriggerAnalysis.IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0AND); | |
429 | if(fHasV0AND&&hTriggerClass)hTriggerClass->Fill(32); | |
430 | } | |
431 | // cout << "event number " << ((AliESDEvent*)fInputEvent)->GetEventNumberInFile() << " entered"<< endl; | |
432 | ||
433 | ||
434 | // Number of Contributors Cut | |
435 | if(GetNumberOfContributorsVtx(fInputEvent)<=0) { | |
436 | if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex); | |
437 | fEventQuality = 5; | |
438 | return kFALSE; | |
439 | } | |
440 | cutindex++; | |
441 | ||
442 | // Z Vertex Position Cut | |
443 | if(!VertexZCut(fInputEvent)){ | |
444 | if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex); | |
445 | fEventQuality = 4; | |
446 | return kFALSE; | |
447 | } | |
448 | cutindex++; | |
449 | ||
450 | // Pile Up Rejection | |
451 | ||
452 | if(fRemovePileUp){ | |
453 | if(fInputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){ | |
454 | if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex); | |
455 | fEventQuality = 6; | |
456 | return kFALSE; | |
457 | } | |
458 | } | |
459 | cutindex++; | |
460 | ||
461 | // Centrality Selection | |
462 | if(!IsCentralitySelected(fInputEvent,fMCEvent)){ | |
463 | if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex); | |
464 | fEventQuality = 1; | |
465 | return kFALSE; | |
466 | } | |
467 | cutindex++; | |
468 | ||
469 | // Fill Event Histograms | |
470 | if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex); | |
471 | if(hVertexZ)hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ()); | |
472 | if(hCentrality)hCentrality->Fill(GetCentrality(fInputEvent)); | |
473 | if(hCentralityVsNumberOfPrimaryTracks) | |
474 | hCentralityVsNumberOfPrimaryTracks->Fill(GetCentrality(fInputEvent), | |
475 | ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager() | |
d9e819f6 | 476 | ->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks()); |
344100c4 | 477 | fEventQuality = 0; |
478 | return kTRUE; | |
479 | } | |
480 | ||
481 | ///________________________________________________________________________ | |
482 | Bool_t AliConvEventCuts::UpdateCutString() { | |
483 | ///Update the cut string (if it has been created yet) | |
484 | ||
485 | if(fCutString && fCutString->GetString().Length() == kNCuts) { | |
486 | fCutString->SetString(GetCutNumber()); | |
487 | } else { | |
488 | return kFALSE; | |
489 | } | |
490 | return kTRUE; | |
491 | } | |
492 | ||
493 | ///________________________________________________________________________ | |
494 | void AliConvEventCuts::LoadReweightingHistosMCFromFile() { | |
495 | ||
496 | AliInfo("Entering loading of histograms for weighting"); | |
497 | TFile *f = TFile::Open(fPathTrFReweighting.Data()); | |
498 | if(!f){ | |
499 | AliError(Form("file for weighting %s not found",fPathTrFReweighting.Data())); | |
500 | return; | |
501 | } | |
502 | if (fNameHistoReweightingPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){ | |
503 | cout << "I have to find: " << fNameHistoReweightingPi0.Data() << endl; | |
504 | TH1D *hReweightMCHistPi0temp = (TH1D*)f->Get(fNameHistoReweightingPi0.Data()); | |
505 | hReweightMCHistPi0 = new TH1D(*hReweightMCHistPi0temp); | |
506 | if (hReweightMCHistPi0) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingPi0.Data(),fPathTrFReweighting.Data() )); | |
507 | else AliWarning(Form("%s not found in %s", fNameHistoReweightingPi0.Data() ,fPathTrFReweighting.Data())); | |
508 | hReweightMCHistPi0->SetDirectory(0); | |
509 | } | |
510 | if (fNameFitDataPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){ | |
511 | cout << "I have to find: " << fNameFitDataPi0.Data() << endl; | |
512 | TF1 *fFitDataPi0temp = (TF1*)f->Get(fNameFitDataPi0.Data()); | |
513 | fFitDataPi0 = new TF1(*fFitDataPi0temp); | |
514 | if (fFitDataPi0) AliInfo(Form("%s has been loaded from %s", fNameFitDataPi0.Data(),fPathTrFReweighting.Data() )); | |
515 | else AliWarning(Form("%s not found in %s",fPathTrFReweighting.Data(), fNameFitDataPi0.Data() )); | |
516 | } | |
517 | ||
518 | if (fNameHistoReweightingEta.CompareTo("") != 0 && fDoReweightHistoMCEta){ | |
519 | cout << "I have to find: " << fNameHistoReweightingEta.Data() << endl; | |
520 | TH1D *hReweightMCHistEtatemp = (TH1D*)f->Get(fNameHistoReweightingEta.Data()); | |
521 | hReweightMCHistEta = new TH1D(*hReweightMCHistEtatemp); | |
522 | if (hReweightMCHistEta) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() )); | |
523 | else AliWarning(Form("%s not found in %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() )); | |
524 | hReweightMCHistEta->SetDirectory(0); | |
525 | } | |
526 | ||
527 | if (fNameFitDataEta.CompareTo("") != 0 && fDoReweightHistoMCEta){ | |
528 | cout << "I have to find: " << fNameFitDataEta.Data() << endl; | |
529 | TF1 *fFitDataEtatemp = (TF1*)f->Get(fNameFitDataEta.Data()); | |
530 | fFitDataEta = new TF1(*fFitDataEtatemp); | |
531 | if (fFitDataEta) AliInfo(Form("%s has been loaded from %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() )); | |
532 | else AliWarning(Form("%s not found in %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() )); | |
533 | ||
534 | } | |
535 | if (fNameHistoReweightingK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){ | |
536 | cout << "I have to find: " << fNameHistoReweightingK0s.Data() << endl; | |
537 | TH1D *hReweightMCHistK0stemp = (TH1D*)f->Get(fNameHistoReweightingK0s.Data()); | |
538 | hReweightMCHistK0s = new TH1D(*hReweightMCHistK0stemp); | |
539 | if (hReweightMCHistK0s) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() )); | |
540 | else AliWarning(Form("%s not found in %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() )); | |
541 | hReweightMCHistK0s->SetDirectory(0); | |
542 | } | |
543 | ||
544 | if (fNameFitDataK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){ | |
545 | cout << "I have to find: " << fNameFitDataK0s.Data() << endl; | |
546 | TF1 *fFitDataK0stemp = (TF1*)f->Get(fNameFitDataK0s.Data()); | |
547 | fFitDataK0s = new TF1(*fFitDataK0stemp); | |
548 | if (fFitDataK0s) AliInfo(Form("%s has been loaded from %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() )); | |
549 | else AliWarning(Form("%s not found in %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() )); | |
550 | } | |
551 | f->Close(); | |
552 | delete f; | |
553 | } | |
554 | ||
555 | ||
556 | ///________________________________________________________________________ | |
557 | Bool_t AliConvEventCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) { | |
558 | // Initialize Cuts from a given Cut string | |
559 | if(fDoReweightHistoMCPi0 || fDoReweightHistoMCEta || fDoReweightHistoMCK0s) { | |
560 | AliInfo("Weighting was enabled"); | |
561 | LoadReweightingHistosMCFromFile(); | |
562 | } | |
563 | ||
564 | AliInfo(Form("Set Event Cut Number: %s",analysisCutSelection.Data())); | |
565 | if(analysisCutSelection.Length()!=kNCuts) { | |
566 | AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts)); | |
567 | return kFALSE; | |
568 | } | |
569 | if(!analysisCutSelection.IsDigit()){ | |
570 | AliError("Cut selection contains characters"); | |
571 | return kFALSE; | |
572 | } | |
573 | ||
d9e819f6 | 574 | if (fV0ReaderName.CompareTo("") == 0){ |
575 | fV0ReaderName = "V0ReaderV1"; | |
576 | } | |
344100c4 | 577 | const char *cutSelection = analysisCutSelection.Data(); |
578 | #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0' | |
579 | for(Int_t ii=0;ii<kNCuts;ii++){ | |
580 | ASSIGNARRAY(ii); | |
581 | } | |
582 | ||
583 | // Set Individual Cuts | |
584 | for(Int_t ii=0;ii<kNCuts;ii++){ | |
585 | if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE; | |
586 | } | |
587 | ||
588 | PrintCutsWithValues(); | |
589 | ||
590 | return kTRUE; | |
591 | } | |
592 | ||
593 | ///________________________________________________________________________ | |
594 | Bool_t AliConvEventCuts::SetCut(cutIds cutID, const Int_t value) { | |
595 | ///Set individual cut ID | |
596 | ||
597 | switch (cutID) { | |
598 | case kremovePileUp: | |
599 | if( SetRemovePileUp(value)) { | |
600 | fCuts[kremovePileUp] = value; | |
601 | UpdateCutString(); | |
602 | return kTRUE; | |
603 | } else return kFALSE; | |
604 | case kSelectSpecialTriggerAlias: | |
605 | if( SetSelectSpecialTrigger(value)) { | |
606 | fCuts[kSelectSpecialTriggerAlias] = value; | |
607 | UpdateCutString(); | |
608 | return kTRUE; | |
609 | } else return kFALSE; | |
610 | case kSelectSubTriggerClass: | |
611 | if( SetSelectSubTriggerClass(value)) { | |
612 | fCuts[kSelectSubTriggerClass] = value; | |
613 | UpdateCutString(); | |
614 | return kTRUE; | |
615 | } else return kFALSE; | |
616 | case kisHeavyIon: | |
617 | if( SetIsHeavyIon(value)) { | |
618 | fCuts[kisHeavyIon] = value; | |
619 | UpdateCutString(); | |
620 | return kTRUE; | |
621 | } else return kFALSE; | |
622 | case kCentralityMin: | |
623 | if( SetCentralityMin(value)) { | |
624 | fCuts[kCentralityMin] = value; | |
625 | UpdateCutString(); | |
626 | return kTRUE; | |
627 | } else return kFALSE; | |
628 | case kCentralityMax: | |
629 | if( SetCentralityMax(value)) { | |
630 | fCuts[kCentralityMax] = value; | |
631 | UpdateCutString(); | |
632 | return kTRUE; | |
633 | } else return kFALSE; | |
634 | case kExtraSignals: | |
635 | if( SetRejectExtraSignalsCut(value)) { | |
636 | fCuts[kExtraSignals] = value; | |
637 | UpdateCutString(); | |
638 | return kTRUE; | |
639 | } else return kFALSE; | |
640 | case kNCuts: | |
641 | AliError("Cut id out of range"); | |
642 | return kFALSE; | |
643 | } | |
644 | ||
645 | AliError("Cut id %d not recognized"); | |
646 | return kFALSE; | |
647 | } | |
648 | ||
649 | ///________________________________________________________________________ | |
650 | void AliConvEventCuts::PrintCuts() { | |
651 | // Print out current Cut Selection | |
652 | for(Int_t ic = 0; ic < kNCuts; ic++) { | |
653 | printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]); | |
654 | } | |
655 | } | |
656 | ||
657 | void AliConvEventCuts::PrintCutsWithValues() { | |
658 | // Print out current Cut Selection with value | |
659 | printf("\nEvent cutnumber \n"); | |
660 | for(Int_t ic = 0; ic < kNCuts; ic++) { | |
661 | printf("%d",fCuts[ic]); | |
662 | } | |
663 | printf("\n\n"); | |
664 | ||
665 | if (fIsHeavyIon == 0) { | |
666 | printf("Running in pp mode \n"); | |
667 | if (fSpecialTrigger == 0){ | |
668 | printf("\t only events triggered by V0OR will be analysed \n"); | |
669 | } else if (fSpecialTrigger == 1){ | |
670 | printf("\t only events triggered by V0AND will be analysed \n"); | |
671 | } else if (fSpecialTrigger == 2){ | |
672 | printf("\t only events where SDD was present will be analysed \n"); | |
673 | } else if (fSpecialTrigger == 3){ | |
674 | printf("\t only events where SDD was present will be analysed and triggered by VOAND\n"); | |
675 | } else if (fSpecialTrigger > 3){ | |
676 | printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data()); | |
677 | } | |
678 | } else if (fIsHeavyIon == 1){ | |
679 | printf("Running in PbPb mode \n"); | |
680 | if (fDetectorCentrality == 0){ | |
681 | printf("\t centrality selection based on V0M \n"); | |
682 | } else if (fDetectorCentrality == 1){ | |
683 | printf("\t centrality selection based on Cl1 \n"); | |
684 | } | |
685 | if (fModCentralityClass == 0){ | |
686 | printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10); | |
687 | } else if ( fModCentralityClass == 1){ | |
688 | printf("\t %d - %d \n", fCentralityMin*5, fCentralityMax*5); | |
689 | } else if ( fModCentralityClass == 2){ | |
690 | printf("\t %d - %d \n", fCentralityMin*5+45, fCentralityMax*5+45); | |
691 | } else if (fModCentralityClass == 3){ | |
692 | printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*10, fCentralityMax*10); | |
693 | } else if ( fModCentralityClass == 4){ | |
694 | printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*5, fCentralityMax*5); | |
695 | } else if ( fModCentralityClass == 5){ | |
696 | printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*5+45, fCentralityMax*5+45); | |
697 | } | |
698 | if (fSpecialTrigger == 0){ | |
699 | printf("\t only events triggered by kMB, kCentral, kSemiCentral will be analysed \n"); | |
700 | } else if (fSpecialTrigger > 4){ | |
701 | printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data()); | |
702 | } | |
703 | } else if (fIsHeavyIon == 2){ | |
704 | printf("Running in pPb mode \n"); | |
705 | if (fDetectorCentrality == 0){ | |
706 | printf("\t centrality selection based on V0A \n"); | |
707 | } else if (fDetectorCentrality == 1){ | |
708 | printf("\t centrality selection based on Cl1 \n"); | |
709 | } | |
710 | if (fModCentralityClass == 0){ | |
711 | printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10); | |
712 | } | |
713 | if (fSpecialTrigger == 0){ | |
714 | printf("\t only events triggered by kINT7 will be analysed \n"); | |
715 | } else if (fSpecialTrigger > 4){ | |
716 | printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data()); | |
717 | } | |
718 | } | |
719 | printf("MC event cuts: \n"); | |
720 | if (fRejectExtraSignals == 0) printf("\t no rejection was applied \n"); | |
721 | else if (fRejectExtraSignals == 1) printf("\t only MB header will be inspected \n"); | |
722 | else if (fRejectExtraSignals > 1) printf("\t special header have been selected \n"); | |
723 | } | |
724 | ||
725 | ///________________________________________________________________________ | |
726 | Bool_t AliConvEventCuts::SetIsHeavyIon(Int_t isHeavyIon) | |
727 | { // Set Cut | |
728 | switch(isHeavyIon){ | |
729 | case 0: | |
730 | fIsHeavyIon=0; | |
731 | break; | |
732 | case 1: | |
733 | fIsHeavyIon=1; | |
734 | fDetectorCentrality=0; | |
735 | break; | |
736 | case 2: | |
737 | fIsHeavyIon=1; | |
738 | fDetectorCentrality=1; | |
739 | break; | |
740 | case 3: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity | |
741 | fIsHeavyIon=1; | |
742 | fDetectorCentrality=0; | |
743 | fModCentralityClass=1; | |
744 | break; | |
745 | case 4: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity | |
746 | fIsHeavyIon=1; | |
747 | fDetectorCentrality=0; | |
748 | fModCentralityClass=2; | |
749 | break; | |
750 | case 5: //strict cut on v0 tracks for MC | |
751 | fIsHeavyIon=1; | |
752 | fDetectorCentrality=0; | |
753 | fModCentralityClass=3; | |
754 | break; | |
755 | case 6: //allows to select centrality 0-45% in steps of 5% for track mult | |
756 | //strict cut on v0 tracks for MC | |
757 | fIsHeavyIon=1; | |
758 | fDetectorCentrality=0; | |
759 | fModCentralityClass=4; | |
760 | break; | |
761 | case 7: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity | |
762 | //strict cut on v0 tracks for MC | |
763 | fIsHeavyIon=1; | |
764 | fDetectorCentrality=0; | |
765 | fModCentralityClass=5; | |
766 | break; | |
767 | case 8: | |
768 | fIsHeavyIon=2; | |
769 | fDetectorCentrality=0; | |
770 | break; | |
771 | case 9: | |
772 | fIsHeavyIon=2; | |
773 | fDetectorCentrality=1; | |
774 | break; | |
775 | default: | |
776 | AliError(Form("SetHeavyIon not defined %d",isHeavyIon)); | |
777 | return kFALSE; | |
778 | } | |
779 | return kTRUE; | |
780 | } | |
781 | ||
782 | //___________________________________________________________________ | |
783 | Bool_t AliConvEventCuts::SetCentralityMin(Int_t minCentrality) | |
784 | { | |
785 | // Set Cut | |
786 | if(minCentrality<0||minCentrality>9){ | |
787 | AliError(Form("minCentrality not defined %d",minCentrality)); | |
788 | return kFALSE; | |
789 | } | |
790 | ||
791 | fCentralityMin=minCentrality; | |
792 | return kTRUE; | |
793 | } | |
794 | ||
795 | //___________________________________________________________________ | |
796 | Bool_t AliConvEventCuts::SetCentralityMax(Int_t maxCentrality) | |
797 | { | |
798 | // Set Cut | |
799 | if(maxCentrality<0||maxCentrality>9){ | |
800 | AliError(Form("maxCentrality not defined %d",maxCentrality)); | |
801 | return kFALSE; | |
802 | } | |
803 | fCentralityMax=maxCentrality; | |
804 | return kTRUE; | |
805 | } | |
806 | ||
807 | ///________________________________________________________________________ | |
808 | Bool_t AliConvEventCuts::SetSelectSpecialTrigger(Int_t selectSpecialTrigger) | |
809 | {// Set Cut | |
810 | ||
811 | switch(selectSpecialTrigger){ | |
812 | case 0: | |
813 | fSpecialTrigger=0; // dont care | |
814 | break; | |
815 | case 1: | |
816 | fSpecialTrigger=1; // V0AND | |
817 | break; | |
818 | case 2: | |
819 | fSpecialTrigger=2; // with SDD requested | |
820 | break; | |
821 | case 3: | |
822 | fSpecialTrigger=3; // V0AND plus with SDD requested | |
823 | break; | |
824 | // allows to run MB & 6 other different trigger classes in parallel with the same photon cut | |
825 | case 4: | |
826 | fSpecialTrigger=4; // trigger alias kTRD | |
827 | fOfflineTriggerMask=AliVEvent::kTRD; | |
828 | fTriggerSelectedManually = kTRUE; | |
829 | fSpecialTriggerName="AliVEvent::kTRD"; | |
830 | break; | |
831 | case 5: | |
832 | fSpecialTrigger=5; // trigger alias kEMC | |
833 | fOfflineTriggerMask=AliVEvent::kEMC7 | AliVEvent::kEMC8 | AliVEvent::kEMC1 ; | |
834 | fTriggerSelectedManually = kTRUE; | |
dc729816 | 835 | fTriggersEMCALSelected= 0; |
836 | SETBIT(fTriggersEMCALSelected, kL0); | |
344100c4 | 837 | fSpecialTriggerName="AliVEvent::kEMC7/kEMC8/kEMC1"; |
838 | break; | |
839 | case 6: | |
840 | fSpecialTrigger=6; // trigger alias kPHI | |
841 | fOfflineTriggerMask=AliVEvent::kPHI7 | AliVEvent::kPHI1 | AliVEvent::kPHI8 | AliVEvent::kPHOSPb; | |
842 | fTriggerSelectedManually = kTRUE; | |
843 | fSpecialTriggerName="AliVEvent::kPHI7/kPHI1/kPHI8/kPHOSPb"; | |
844 | break; | |
845 | case 7: | |
846 | fSpecialTrigger=7; // trigger alias kHighMult | |
847 | fOfflineTriggerMask=AliVEvent::kHighMult; | |
848 | fTriggerSelectedManually = kTRUE; | |
849 | fSpecialTriggerName="AliVEvent::kHighMult"; | |
850 | break; | |
851 | case 8: | |
852 | fSpecialTrigger=8; // trigger alias kEMCEGA | |
853 | fOfflineTriggerMask=AliVEvent::kEMCEGA; | |
854 | fTriggerSelectedManually = kTRUE; | |
dc729816 | 855 | fTriggersEMCALSelected= 0; |
856 | SETBIT(fTriggersEMCALSelected, kG2); | |
344100c4 | 857 | fSpecialTriggerName="AliVEvent::kEMCEGA"; |
858 | break; | |
859 | case 9: | |
860 | fSpecialTrigger=9; // trigger alias kEMCEJE | |
861 | fOfflineTriggerMask=AliVEvent::kEMCEJE; | |
862 | fTriggerSelectedManually = kTRUE; | |
dc729816 | 863 | fTriggersEMCALSelected= 0; |
864 | SETBIT(fTriggersEMCALSelected, kJ2); | |
344100c4 | 865 | fSpecialTriggerName="AliVEvent::kEMCEJE"; |
866 | break; | |
867 | default: | |
868 | AliError("Warning: Special Trigger Not known"); | |
869 | return 0; | |
870 | } | |
871 | return 1; | |
872 | } | |
873 | ||
874 | ///________________________________________________________________________ | |
875 | Bool_t AliConvEventCuts::SetSelectSubTriggerClass(Int_t selectSpecialSubTriggerClass) | |
876 | {// Set Cut | |
877 | ||
878 | if (fSpecialTrigger == 1){ //V0AND with different detectors | |
879 | switch(selectSpecialSubTriggerClass){ | |
880 | case 0: //with VZERO | |
881 | fSpecialTrigger=1; | |
882 | fSpecialSubTrigger=0; | |
883 | // AliInfo("Info: Nothing to be done"); | |
884 | break; | |
885 | case 1: //with TZERO | |
886 | fSpecialTrigger=0; | |
887 | fSpecialSubTrigger=0; | |
888 | fOfflineTriggerMask=AliVEvent::kINT8; | |
889 | fTriggerSelectedManually = kTRUE; | |
890 | fSpecialTriggerName="AliVEvent::kINT8"; | |
891 | break; | |
892 | default: | |
893 | AliError("Warning: Special Subtrigger Class Not known"); | |
894 | return 0; | |
895 | } | |
896 | ||
897 | } else if (fSpecialTrigger == 4){ // Subdivision of TRD trigger classes | |
898 | switch(selectSpecialSubTriggerClass){ | |
899 | case 0: // all together | |
900 | fSpecialSubTrigger=0; | |
901 | fSpecialSubTriggerName=""; | |
902 | // AliInfo("Info: Nothing to be done"); | |
903 | break; | |
904 | case 1: // 7WUHSH - V0AND with single electron in TRD & EMCAL | |
905 | fSpecialSubTrigger=1; | |
906 | fNSpecialSubTriggerOptions=1; | |
907 | fSpecialSubTriggerName="7WUHEE"; | |
908 | break; | |
909 | case 2: // 8WUHSH - T0AND with single electron in TRD & EMCAL | |
910 | fSpecialSubTrigger=1; | |
911 | fNSpecialSubTriggerOptions=1; | |
912 | fSpecialSubTriggerName="8WUHEE"; | |
913 | break; | |
914 | case 3: // 7WUHSE - V0AND with single high pt electron in TRD | |
915 | fSpecialSubTrigger=1; | |
916 | fNSpecialSubTriggerOptions=1; | |
917 | fSpecialSubTriggerName="7WUHSE"; | |
918 | break; | |
919 | case 4: // 8WUHSE - T0AND with single high pt electron in TRD | |
920 | fSpecialSubTrigger=1; | |
921 | fNSpecialSubTriggerOptions=1; | |
922 | fSpecialSubTriggerName="8WUHSE"; | |
923 | break; | |
924 | case 5: // 7WUHJE - V0AND with jet in TRD | |
925 | fSpecialSubTrigger=1; | |
926 | fNSpecialSubTriggerOptions=1; | |
927 | fSpecialSubTriggerName="7WUHJT"; | |
928 | break; | |
929 | case 6: // 8WUHJE - T0AND with jet in TRD | |
930 | fSpecialSubTrigger=1; | |
931 | fNSpecialSubTriggerOptions=1; | |
932 | fSpecialSubTriggerName="8WUHJT"; | |
933 | break; | |
934 | case 7: // 7WUHQU - V0AND with dielectron pair in TRD | |
935 | fSpecialSubTrigger=1; | |
936 | fNSpecialSubTriggerOptions=1; | |
937 | fSpecialSubTriggerName="7WUHQU"; | |
938 | break; | |
939 | case 8: // 8WUHQU - T0AND with dielectron pair in TRD | |
940 | fSpecialSubTrigger=1; | |
941 | fNSpecialSubTriggerOptions=1; | |
942 | fSpecialSubTriggerName="8WUHQU"; | |
943 | break; | |
944 | default: | |
945 | AliError("Warning: Special Subtrigger Class Not known"); | |
946 | return 0; | |
947 | } | |
948 | } else if (fSpecialTrigger == 5){ // Subdivision of kEMC trigger classes | |
949 | switch(selectSpecialSubTriggerClass){ | |
950 | case 0: // all together | |
951 | fSpecialSubTrigger=0; | |
952 | fSpecialSubTriggerName=""; | |
953 | // AliInfo("Info: Nothing to be done"); | |
954 | break; | |
955 | case 1: // CEMC1 - V0OR and EMCAL fired | |
956 | fOfflineTriggerMask=AliVEvent::kEMC1; | |
957 | fSpecialTriggerName="AliVEvent::kEMC1"; | |
958 | fSpecialSubTrigger=1; | |
959 | fNSpecialSubTriggerOptions=1; | |
960 | fSpecialSubTriggerName="CEMC1"; | |
961 | break; | |
962 | case 2: // CEMC7 - V0AND and EMCAL fired | |
963 | fSpecialSubTrigger=1; | |
964 | fOfflineTriggerMask=AliVEvent::kEMC7; | |
965 | fSpecialTriggerName="AliVEvent::kEMC7"; | |
966 | fNSpecialSubTriggerOptions=1; | |
967 | fSpecialSubTriggerName="CEMC7"; | |
968 | break; | |
969 | case 3: // CEMC8 - T0OR and EMCAL fired | |
970 | fOfflineTriggerMask=AliVEvent::kEMC8; | |
971 | fSpecialTriggerName="AliVEvent::kEMC8"; | |
972 | fSpecialSubTrigger=1; | |
973 | fNSpecialSubTriggerOptions=1; | |
974 | fSpecialSubTriggerName="CEMC8"; | |
975 | break; | |
976 | default: | |
977 | AliError("Warning: Special Subtrigger Class Not known"); | |
978 | return 0; | |
979 | } | |
980 | } else if (fSpecialTrigger == 6){ // Subdivision of kPHI trigger classes | |
981 | switch(selectSpecialSubTriggerClass){ | |
982 | case 0: // all together | |
983 | fSpecialSubTrigger=0; | |
984 | fSpecialSubTriggerName=""; | |
985 | // AliInfo("Info: Nothing to be done"); | |
986 | break; | |
987 | case 1: // CEMC1 - V0OR and EMCAL fired | |
988 | fOfflineTriggerMask=AliVEvent::kPHI1; | |
989 | fSpecialTriggerName="AliVEvent::kPHI1"; | |
990 | fSpecialSubTrigger=1; | |
991 | fNSpecialSubTriggerOptions=1; | |
992 | fSpecialSubTriggerName="CPHI1"; | |
993 | break; | |
994 | case 2: // CEMC7 - V0AND and EMCAL fired | |
995 | fSpecialSubTrigger=1; | |
996 | fOfflineTriggerMask=AliVEvent::kPHI7; | |
997 | fSpecialTriggerName="AliVEvent::kPHI7"; | |
998 | fNSpecialSubTriggerOptions=1; | |
999 | fSpecialSubTriggerName="CPHI7"; | |
1000 | break; | |
1001 | case 3: // CEMC8 - T0OR and EMCAL fired | |
1002 | fOfflineTriggerMask=AliVEvent::kPHI8; | |
1003 | fSpecialTriggerName="AliVEvent::kPHI8"; | |
1004 | fSpecialSubTrigger=1; | |
1005 | fNSpecialSubTriggerOptions=1; | |
1006 | fSpecialSubTriggerName="CPHI8"; | |
1007 | break; | |
1008 | default: | |
1009 | AliError("Warning: Special Subtrigger Class Not known"); | |
1010 | return 0; | |
1011 | } | |
1012 | } else if (fSpecialTrigger == 7){ // Subdivision of kHighMult trigger classes | |
1013 | switch(selectSpecialSubTriggerClass){ | |
1014 | case 0: // all together | |
1015 | fSpecialSubTrigger=0; | |
1016 | fSpecialSubTriggerName=""; | |
1017 | // AliInfo("Info: Nothing to be done"); | |
1018 | break; | |
1019 | case 1: // CSHM1 - V0OR and high mult fired | |
1020 | fSpecialSubTrigger=1; | |
1021 | fNSpecialSubTriggerOptions=1; | |
1022 | fSpecialSubTriggerName="CSHM1"; | |
1023 | break; | |
1024 | case 2: // CSHM7 - V0AND and high mult fired | |
1025 | fSpecialSubTrigger=1; | |
1026 | fNSpecialSubTriggerOptions=1; | |
1027 | fSpecialSubTriggerName="CSHM7"; | |
1028 | break; | |
1029 | case 3: // CSHM8 - T0OR and high mult fired | |
1030 | fSpecialSubTrigger=1; | |
1031 | fNSpecialSubTriggerOptions=1; | |
1032 | fSpecialSubTriggerName="CSHM8"; | |
1033 | break; | |
1034 | default: | |
1035 | AliError("Warning: Special Subtrigger Class Not known"); | |
1036 | return 0; | |
1037 | } | |
1038 | } else if (fSpecialTrigger == 8){ // Subdivision of kEMCEGA trigger classes | |
1039 | switch(selectSpecialSubTriggerClass){ | |
1040 | case 0: // all together | |
1041 | fSpecialSubTrigger=0; | |
1042 | fSpecialSubTriggerName=""; | |
1043 | // AliInfo("Info: Nothing to be done"); | |
1044 | break; | |
1045 | case 1: // 7EGA - CINT7 EGA | |
1046 | fSpecialSubTrigger=1; | |
1047 | fNSpecialSubTriggerOptions=1; | |
1048 | fSpecialSubTriggerName="7EGA"; | |
dc729816 | 1049 | fTriggersEMCALSelected= 0; |
1050 | SETBIT(fTriggersEMCALSelected, kG2); | |
344100c4 | 1051 | break; |
1052 | case 2: // 8EGA - CINT8 EGA | |
1053 | fSpecialSubTrigger=1; | |
1054 | fNSpecialSubTriggerOptions=1; | |
1055 | fSpecialSubTriggerName="8EGA"; | |
dc729816 | 1056 | fTriggersEMCALSelected= 0; |
1057 | SETBIT(fTriggersEMCALSelected, kG2); | |
344100c4 | 1058 | break; |
1059 | case 3: // 7EG1 - CINT7 EG1 | |
1060 | fSpecialSubTrigger=1; | |
1061 | fNSpecialSubTriggerOptions=1; | |
1062 | fSpecialSubTriggerName="7EG1"; | |
dc729816 | 1063 | fTriggersEMCALSelected= 0; |
1064 | SETBIT(fTriggersEMCALSelected, kG1); | |
344100c4 | 1065 | break; |
1066 | case 4: // 8EG1 - CINT8 EG1 | |
1067 | fSpecialSubTrigger=1; | |
1068 | fNSpecialSubTriggerOptions=1; | |
1069 | fSpecialSubTriggerName="8EG1"; | |
dc729816 | 1070 | fTriggersEMCALSelected= 0; |
1071 | SETBIT(fTriggersEMCALSelected, kG1); | |
344100c4 | 1072 | break; |
1073 | case 5: // 7EG2 - CINT7 EG2 | |
1074 | fSpecialSubTrigger=1; | |
1075 | fNSpecialSubTriggerOptions=1; | |
1076 | fSpecialSubTriggerName="7EG2"; | |
dc729816 | 1077 | fTriggersEMCALSelected= 0; |
1078 | SETBIT(fTriggersEMCALSelected, kG2); | |
344100c4 | 1079 | break; |
1080 | case 6: // 8EG2 - CINT8 EG2 | |
1081 | fSpecialSubTrigger=1; | |
1082 | fNSpecialSubTriggerOptions=1; | |
1083 | fSpecialSubTriggerName="8EG2"; | |
dc729816 | 1084 | fTriggersEMCALSelected= 0; |
1085 | SETBIT(fTriggersEMCALSelected, kG2); | |
344100c4 | 1086 | break; |
1087 | default: | |
1088 | AliError("Warning: Special Subtrigger Class Not known"); | |
1089 | return 0; | |
1090 | } | |
1091 | } else if (fSpecialTrigger == 9){ // Subdivision of kEMCEGA trigger classes | |
1092 | switch(selectSpecialSubTriggerClass){ | |
1093 | case 0: // all together | |
1094 | fSpecialSubTrigger=0; | |
1095 | fSpecialSubTriggerName=""; | |
1096 | // AliInfo("Info: Nothing to be done"); | |
1097 | break; | |
1098 | case 1: // 7EJE - CINT7 EJE | |
1099 | fSpecialSubTrigger=1; | |
1100 | fNSpecialSubTriggerOptions=1; | |
1101 | fSpecialSubTriggerName="7EJE"; | |
dc729816 | 1102 | fTriggersEMCALSelected= 0; |
1103 | SETBIT(fTriggersEMCALSelected, kJ2); | |
344100c4 | 1104 | break; |
1105 | case 2: // 8EJE - CINT8 EJE | |
1106 | fSpecialSubTrigger=1; | |
1107 | fNSpecialSubTriggerOptions=1; | |
1108 | fSpecialSubTriggerName="8EJE"; | |
dc729816 | 1109 | fTriggersEMCALSelected= 0; |
1110 | SETBIT(fTriggersEMCALSelected, kJ2); | |
344100c4 | 1111 | break; |
1112 | case 3: // 7EJ1 - CINT7 EJ1 | |
1113 | fSpecialSubTrigger=1; | |
1114 | fNSpecialSubTriggerOptions=1; | |
1115 | fSpecialSubTriggerName="7EJ1"; | |
dc729816 | 1116 | fTriggersEMCALSelected= 0; |
1117 | SETBIT(fTriggersEMCALSelected, kJ1); | |
344100c4 | 1118 | break; |
1119 | case 4: // 8EJ1 - CINT8 EJ1 | |
1120 | fSpecialSubTrigger=1; | |
1121 | fNSpecialSubTriggerOptions=1; | |
1122 | fSpecialSubTriggerName="8EJ1"; | |
dc729816 | 1123 | fTriggersEMCALSelected= 0; |
1124 | SETBIT(fTriggersEMCALSelected, kJ1); | |
344100c4 | 1125 | break; |
1126 | case 5: // 7EJ2 - CINT7 EJ2 | |
1127 | fSpecialSubTrigger=1; | |
1128 | fNSpecialSubTriggerOptions=1; | |
1129 | fSpecialSubTriggerName="7EJ2"; | |
dc729816 | 1130 | fTriggersEMCALSelected= 0; |
1131 | SETBIT(fTriggersEMCALSelected, kJ2); | |
344100c4 | 1132 | break; |
1133 | case 6: // 8EJ2 - CINT8 EJ2 | |
1134 | fSpecialSubTrigger=1; | |
1135 | fNSpecialSubTriggerOptions=1; | |
1136 | fSpecialSubTriggerName="8EJ2"; | |
dc729816 | 1137 | fTriggersEMCALSelected= 0; |
1138 | SETBIT(fTriggersEMCALSelected, kJ2); | |
344100c4 | 1139 | break; |
1140 | default: | |
1141 | AliError("Warning: Special Subtrigger Class Not known"); | |
1142 | return 0; | |
1143 | } | |
1144 | } | |
1145 | return 1; | |
1146 | } | |
1147 | ||
1148 | ///________________________________________________________________________ | |
1149 | Bool_t AliConvEventCuts::SetMultiplicityMethod(Int_t multiplicityMethod) | |
1150 | { | |
1151 | // Set Cut | |
1152 | fMultiplicityMethod=multiplicityMethod; | |
1153 | ||
1154 | // 0 Photon Multiplicity | |
1155 | // 1 TPC Track multiplicity | |
1156 | // 2 V0 Mult | |
1157 | // 3 SPD Mult | |
1158 | ||
1159 | return kTRUE; | |
1160 | } | |
1161 | ||
1162 | ///________________________________________________________________________ | |
1163 | Bool_t AliConvEventCuts::SetRemovePileUp(Int_t removePileUp) | |
1164 | {// Set Cut | |
1165 | switch(removePileUp){ | |
1166 | case 0: | |
1167 | fRemovePileUp=kFALSE; | |
1168 | break; | |
1169 | case 1: | |
1170 | fRemovePileUp=kTRUE; | |
1171 | break; | |
1172 | default: | |
1173 | AliError("RemovePileUpCut not defined"); | |
1174 | return kFALSE; | |
1175 | } | |
1176 | return kTRUE; | |
1177 | } | |
1178 | ||
1179 | ///________________________________________________________________________ | |
1180 | Bool_t AliConvEventCuts::SetRejectExtraSignalsCut(Int_t extraSignal) { | |
1181 | ||
1182 | switch(extraSignal){ | |
1183 | case 0: | |
1184 | fRejectExtraSignals = 0; | |
1185 | break; // No Rejection | |
1186 | case 1: | |
1187 | fRejectExtraSignals = 1; | |
1188 | break; // MinBias Header | |
1189 | case 2: | |
1190 | fRejectExtraSignals = 2; | |
1191 | break; // User String Array | |
1192 | case 3: | |
1193 | fRejectExtraSignals = 3; | |
1194 | break; // Rejection for Gamma Correction only | |
1195 | default: | |
1196 | AliError(Form("Extra Signal Rejection not defined %d",extraSignal)); | |
1197 | return kFALSE; | |
1198 | } | |
1199 | return kTRUE; | |
1200 | } | |
1201 | ||
1202 | //------------------------------------------------------------- | |
1203 | Double_t AliConvEventCuts::GetCentrality(AliVEvent *event) | |
1204 | { // Get Event Centrality | |
1205 | ||
1206 | AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event); | |
1207 | if(esdEvent){ | |
1208 | AliCentrality *fESDCentrality=(AliCentrality*)esdEvent->GetCentrality(); | |
1209 | if(fDetectorCentrality==0){ | |
1210 | if (fIsHeavyIon==2){ | |
1211 | return fESDCentrality->GetCentralityPercentile("V0A"); // default for pPb | |
1212 | } else{ | |
1213 | return fESDCentrality->GetCentralityPercentile("V0M"); // default | |
1214 | } | |
1215 | } | |
1216 | if(fDetectorCentrality==1){ | |
1217 | return fESDCentrality->GetCentralityPercentile("CL1"); | |
1218 | } | |
1219 | } | |
1220 | ||
1221 | AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event); | |
1222 | if(aodEvent){ | |
1223 | if(aodEvent->GetHeader()){return aodEvent->GetHeader()->GetCentrality();} | |
1224 | } | |
1225 | ||
1226 | return -1; | |
1227 | } | |
1228 | ||
1229 | //_____________________________________________________________________________________ | |
1230 | Bool_t AliConvEventCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCEvent) | |
1231 | { // Centrality Selection | |
1232 | if(!fIsHeavyIon)return kTRUE; | |
1233 | ||
1234 | if(fCentralityMin == fCentralityMax ) return kTRUE;//0-100% | |
1235 | else if(fCentralityMax==0) fCentralityMax=10; //CentralityRange = fCentralityMin-100% | |
1236 | ||
1237 | Double_t centrality=GetCentrality(event); | |
1238 | if(centrality<0)return kFALSE; | |
1239 | ||
1240 | Int_t centralityC=0; | |
1241 | if (fModCentralityClass == 0){ | |
1242 | centralityC= Int_t(centrality/10); | |
1243 | if(centralityC >= fCentralityMin && centralityC < fCentralityMax) | |
1244 | return kTRUE; | |
1245 | else return kFALSE; | |
1246 | } | |
1247 | else if (fModCentralityClass ==1){ | |
1248 | centralityC= Int_t(centrality); | |
1249 | if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){ | |
1250 | return kTRUE; | |
1251 | } else return kFALSE; | |
1252 | } | |
1253 | else if (fModCentralityClass ==2){ | |
1254 | centralityC= Int_t(centrality); | |
1255 | if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45)) | |
1256 | return kTRUE; | |
1257 | else return kFALSE; | |
1258 | } | |
1259 | ||
d9e819f6 | 1260 | Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks(); |
344100c4 | 1261 | Int_t PrimaryTracks10[10][2] = |
1262 | { | |
1263 | {9999,9999}, // 0 | |
1264 | {1210, 928}, // 10 | |
1265 | { 817, 658}, // 20 | |
1266 | { 536, 435}, // 30 | |
1267 | { 337, 276}, // 40 | |
1268 | { 197, 162}, // 50 | |
1269 | { 106, 100}, // 60 | |
1270 | { 51, 44}, // 70 | |
1271 | { 21, 18}, // 80 | |
1272 | { 0, 0} // 90 | |
1273 | }; | |
1274 | Int_t PrimaryTracks5a[10][2] = | |
1275 | { | |
1276 | {9999,9999}, // 0 | |
1277 | {1485,1168}, // 5 | |
1278 | {1210, 928}, // 10 | |
1279 | { 995, 795}, // 15 | |
1280 | { 817, 658}, // 20 | |
1281 | { 666, 538}, // 25 | |
1282 | { 536, 435}, // 30 | |
1283 | { 428, 350}, // 35 | |
1284 | { 337, 276}, // 40 | |
1285 | { 260, 214} // 45 | |
1286 | }; | |
1287 | Int_t PrimaryTracks5b[10][2] = | |
1288 | { | |
1289 | { 260, 214}, // 45 | |
1290 | { 197, 162}, // 50 | |
1291 | { 147, 125}, // 55 | |
1292 | { 106, 100}, // 60 | |
1293 | { 75, 63}, // 65 | |
1294 | { 51, 44}, // 70 | |
1295 | { 34, 29}, // 75 | |
1296 | { 21, 18}, // 80 | |
1297 | { 13, 11}, // 85 | |
1298 | { 0, 0} // 90 | |
1299 | }; | |
1300 | Int_t column = 0; | |
1301 | if(event->IsA()==AliESDEvent::Class()) column = 0; | |
1302 | if(event->IsA()==AliAODEvent::Class()) column = 1; | |
1303 | ||
1304 | if (fModCentralityClass == 3){ | |
1305 | if(fMCEvent){ | |
1306 | if(nprimaryTracks > PrimaryTracks10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks10[fCentralityMin][column]) | |
1307 | return kTRUE; | |
1308 | else return kFALSE; | |
1309 | } | |
1310 | else{ | |
1311 | centralityC= Int_t(centrality/10); | |
1312 | if(centralityC >= fCentralityMin && centralityC < fCentralityMax) | |
1313 | return kTRUE; | |
1314 | else return kFALSE; | |
1315 | } | |
1316 | } | |
1317 | else if (fModCentralityClass ==4){ | |
1318 | if(fMCEvent){ | |
1319 | if(nprimaryTracks > PrimaryTracks5a[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5a[fCentralityMin][column]) | |
1320 | return kTRUE; | |
1321 | else return kFALSE; | |
1322 | } | |
1323 | else{ | |
1324 | centralityC= Int_t(centrality); | |
1325 | if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){ | |
1326 | return kTRUE; | |
1327 | } else return kFALSE; | |
1328 | } | |
1329 | } | |
1330 | else if (fModCentralityClass ==5){ | |
1331 | if(fMCEvent){ | |
1332 | if(nprimaryTracks > PrimaryTracks5b[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5b[fCentralityMin][column]) | |
1333 | return kTRUE; | |
1334 | else return kFALSE; | |
1335 | } | |
1336 | else{ | |
1337 | centralityC= Int_t(centrality); | |
1338 | if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45)) | |
1339 | return kTRUE; | |
1340 | else return kFALSE; | |
1341 | } | |
1342 | } | |
1343 | ||
1344 | return kFALSE; | |
1345 | } | |
1346 | ||
1347 | ///________________________________________________________________________ | |
1348 | Bool_t AliConvEventCuts::VertexZCut(AliVEvent *event){ | |
1349 | // Cut on z position of primary vertex | |
1350 | Double_t fVertexZ=event->GetPrimaryVertex()->GetZ(); | |
1351 | Double_t fVertexZSPD = 0; | |
1352 | AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event); | |
1353 | if(fESDEvent){ | |
1354 | fVertexZSPD = fESDEvent->GetPrimaryVertexSPD()->GetZ(); | |
1355 | } | |
1356 | AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event); | |
1357 | if(fAODEvent){ | |
1358 | fVertexZSPD = fAODEvent->GetPrimaryVertexSPD()->GetZ(); | |
1359 | } | |
1360 | ||
1361 | if(abs(fVertexZ)>fMaxVertexZ)return kFALSE; | |
1362 | ||
1363 | TString periodName = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager() | |
d9e819f6 | 1364 | ->GetTask(fV0ReaderName.Data()))->GetPeriodName(); |
344100c4 | 1365 | if (periodName.CompareTo("LHC11h")==0){ |
1366 | if (abs(fVertexZ-fVertexZSPD) > 0.1) return kFALSE; | |
1367 | } | |
1368 | if (fIsHeavyIon == 2){ | |
1369 | if(fUtils->IsFirstEventInChunk(event)) return kFALSE; | |
1370 | if(!fUtils->IsVertexSelected2013pA(event)) return kFALSE; | |
1371 | if(fUtils->IsPileUpEvent(event)) return kFALSE; | |
1372 | } | |
1373 | ||
1374 | return kTRUE; | |
1375 | } | |
1376 | ||
1377 | ///________________________________________________________________________ | |
1378 | Int_t AliConvEventCuts::GetNumberOfContributorsVtx(AliVEvent *event){ | |
1379 | // returns number of contributors to the vertex | |
1380 | ||
1381 | AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event); | |
1382 | if(fESDEvent){ | |
1383 | if (fESDEvent->GetPrimaryVertex() != NULL){ | |
1384 | if(fESDEvent->GetPrimaryVertex()->GetNContributors()>0) { | |
1385 | // cout << "accepted global" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertex()->GetNContributors() << endl; | |
1386 | return fESDEvent->GetPrimaryVertex()->GetNContributors(); | |
1387 | } | |
1388 | } | |
1389 | ||
1390 | if(fESDEvent->GetPrimaryVertexSPD() !=NULL){ | |
1391 | if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) { | |
1392 | // cout << "accepted SPD" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertexSPD()->GetNContributors() << endl; | |
1393 | return fESDEvent->GetPrimaryVertexSPD()->GetNContributors(); | |
1394 | } else { | |
1395 | AliWarning(Form("Number of contributors from bad vertex type:: %s",fESDEvent->GetPrimaryVertex()->GetName())); | |
1396 | // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl; | |
1397 | return 0; | |
1398 | } | |
1399 | } | |
1400 | } | |
1401 | ||
1402 | AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event); | |
1403 | if(fAODEvent){ | |
1404 | if (fAODEvent->GetPrimaryVertex() != NULL){ | |
1405 | if(fAODEvent->GetPrimaryVertex()->GetNContributors()>0) { | |
1406 | return fAODEvent->GetPrimaryVertex()->GetNContributors(); | |
1407 | } | |
1408 | } | |
1409 | if(fAODEvent->GetPrimaryVertexSPD() !=NULL){ | |
1410 | if(fAODEvent->GetPrimaryVertexSPD()->GetNContributors()>0) { | |
1411 | return fAODEvent->GetPrimaryVertexSPD()->GetNContributors(); | |
1412 | } else { | |
1413 | AliWarning(Form("Number of contributors from bad vertex type:: %s",fAODEvent->GetPrimaryVertex()->GetName())); | |
1414 | return 0; | |
1415 | } | |
1416 | } | |
1417 | } | |
1418 | // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl; | |
1419 | return 0; | |
1420 | } | |
1421 | ||
1422 | ||
1423 | ///________________________________________________________________________ | |
dc729816 | 1424 | Bool_t AliConvEventCuts::IsTriggerSelected(AliVEvent *fInputEvent, Bool_t isMC) |
344100c4 | 1425 | { |
1426 | ||
1427 | AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); | |
cfd87ccd | 1428 | |
344100c4 | 1429 | |
1430 | UInt_t isSelected = AliVEvent::kAny; | |
d9e819f6 | 1431 | TString periodName = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPeriodName(); |
344100c4 | 1432 | // cout << periodName.Data() << endl; |
1433 | ||
1434 | if (fInputHandler==NULL) return kFALSE; | |
1435 | if( fInputHandler->GetEventSelection() || fInputEvent->IsA()==AliAODEvent::Class()) { | |
1436 | ||
1437 | TString firedTrigClass = fInputEvent->GetFiredTriggerClasses(); | |
1438 | if (!fTriggerSelectedManually){ | |
1439 | if (fPreSelCut) fOfflineTriggerMask = AliVEvent::kAny; | |
1440 | else { | |
1441 | if (fIsHeavyIon == 1) fOfflineTriggerMask = AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral; | |
1442 | else if (fIsHeavyIon == 2) fOfflineTriggerMask = AliVEvent::kINT7; | |
1443 | else if (periodName.CompareTo("LHC11c") == 0 || periodName.CompareTo("LHC11d") == 0 || periodName.CompareTo("LHC11e") == 0 || periodName.CompareTo("LHC11f") == 0 || periodName.CompareTo("LHC11g") == 0 || periodName.CompareTo("LHC12a") == 0 || periodName.CompareTo("LHC12b") == 0 || periodName.CompareTo("LHC12c") == 0 || periodName.CompareTo("LHC12d") == 0 || periodName.CompareTo("LHC12f") == 0 || periodName.CompareTo("LHC12g") == 0 || periodName.CompareTo("LHC12h") == 0 || periodName.CompareTo("LHC12i") == 0 ||periodName.CompareTo("LHC13g") == 0 ) { | |
1444 | fOfflineTriggerMask = AliVEvent::kINT7; | |
1445 | // cout << "will take kINT7 as trigger mask" << endl; | |
1446 | } | |
1447 | else fOfflineTriggerMask = AliVEvent::kMB; | |
1448 | } | |
1449 | } | |
1450 | // Get the actual offline trigger mask for the event and AND it with the | |
1451 | // requested mask. If no mask requested select by default the event. | |
1452 | // if (fPreSelCut) cout << "Trigger selected from outside: "<< fTriggerSelectedManually <<"\t Offline Trigger mask for Precut: " << fOfflineTriggerMask << endl; | |
1453 | // else cout << "Trigger selected from outside: "<< fTriggerSelectedManually <<"\t Offline Trigger mask: " << fOfflineTriggerMask << endl; | |
1454 | ||
cfd87ccd | 1455 | if (isMC) fOfflineTriggerMask = AliVEvent::kAny; |
1456 | ||
344100c4 | 1457 | if (fOfflineTriggerMask){ |
1458 | isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected(); | |
dc729816 | 1459 | |
344100c4 | 1460 | if (isSelected && !fPreSelCut){ |
dc729816 | 1461 | // cout << "Special trigger: "<< fSpecialTrigger << " initialized " << fEMCALTrigInitialized << endl; |
1462 | if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9){ // EMCAL triggers | |
1463 | if (!fEMCALTrigInitialized ) InitializeEMCALTrigger(fInputEvent); | |
1464 | fTriggersEMCAL= GetTriggerList(); | |
1465 | } | |
1466 | if (fSpecialSubTrigger>0 && !isMC){ | |
344100c4 | 1467 | if (!firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 0; |
cfd87ccd | 1468 | } else if (isMC){ |
dc729816 | 1469 | if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9){ // EMCAL triggers |
1470 | isSelected = 0; | |
cfd87ccd | 1471 | // if (fTriggersEMCAL > 0)cout << "Special Trigger " << fSpecialTrigger << " triggers: " << fTriggersEMCAL << " selected triggers: " << fTriggersEMCALSelected << " run number: " <<fInputEvent->GetRunNumber()<<endl; |
dc729816 | 1472 | if (fTriggersEMCAL&fTriggersEMCALSelected){ |
1473 | // cout << "accepted ++++++++++++++++++++" << endl; | |
1474 | isSelected = 1; | |
1475 | } | |
1476 | } | |
1477 | } | |
344100c4 | 1478 | } |
1479 | } | |
1480 | } | |
1481 | fIsSDDFired = !(fInputHandler->IsEventSelected() & AliVEvent::kFastOnly); | |
1482 | ||
1483 | // Fill Histogram | |
1484 | if(hTriggerClass){ | |
1485 | if (fIsSDDFired) hTriggerClass->Fill(33); | |
1486 | if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(0); | |
1487 | if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClass->Fill(1); | |
1488 | if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClass->Fill(2); | |
1489 | if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClass->Fill(3); | |
1490 | if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClass->Fill(4); | |
1491 | if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5); | |
1492 | if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6); | |
1493 | // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6); | |
1494 | if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClass->Fill(7); | |
1495 | // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClass->Fill(7); | |
1496 | if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClass->Fill(8); | |
1497 | // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClass->Fill(8); | |
1498 | if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClass->Fill(9); | |
1499 | // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClass->Fill(9); | |
1500 | if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClass->Fill(10); | |
1501 | // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClass->Fill(10); | |
1502 | if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClass->Fill(11); | |
1503 | if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClass->Fill(12); | |
1504 | if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClass->Fill(13); | |
1505 | // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClass->Fill(13); | |
1506 | // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClass->Fill(13); | |
1507 | if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClass->Fill(14); | |
1508 | if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClass->Fill(15); | |
1509 | if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(16); | |
1510 | if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(17); | |
1511 | if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClass->Fill(18); | |
1512 | if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClass->Fill(19); | |
1513 | if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClass->Fill(20); | |
1514 | // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClass->Fill(20); | |
1515 | if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClass->Fill(21); | |
1516 | if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClass->Fill(22); | |
1517 | if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClass->Fill(23); | |
1518 | if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClass->Fill(24); | |
1519 | if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClass->Fill(25); | |
1520 | if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClass->Fill(26); | |
1521 | if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClass->Fill(27); | |
1522 | if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClass->Fill(28); | |
1523 | if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClass->Fill(29); | |
1524 | if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClass->Fill(30); | |
1525 | if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(31); | |
1526 | if (!fInputHandler->IsEventSelected()) hTriggerClass->Fill(34); | |
1527 | } | |
1528 | ||
1529 | if(hTriggerClassSelected && isSelected){ | |
1530 | if (!fIsSDDFired) hTriggerClassSelected->Fill(33); | |
1531 | if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassSelected->Fill(0); | |
1532 | if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassSelected->Fill(1); | |
1533 | if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClassSelected->Fill(2); | |
1534 | if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClassSelected->Fill(3); | |
1535 | if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassSelected->Fill(4); | |
1536 | if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClassSelected->Fill(5); | |
1537 | if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClassSelected->Fill(6); | |
1538 | // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClassSelected->Fill(6); | |
1539 | if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClassSelected->Fill(7); | |
1540 | // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClassSelected->Fill(7); | |
1541 | if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClassSelected->Fill(8); | |
1542 | // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClassSelected->Fill(8); | |
1543 | if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClassSelected->Fill(9); | |
1544 | // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClassSelected->Fill(9); | |
1545 | if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassSelected->Fill(10); | |
1546 | // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClassSelected->Fill(10); | |
1547 | if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClassSelected->Fill(11); | |
1548 | if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClassSelected->Fill(12); | |
1549 | if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClassSelected->Fill(13); | |
1550 | // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClassSelected->Fill(13); | |
1551 | // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClassSelected->Fill(13); | |
1552 | if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClassSelected->Fill(14); | |
1553 | if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClassSelected->Fill(15); | |
1554 | if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClassSelected->Fill(16); | |
1555 | if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClassSelected->Fill(17); | |
1556 | if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClassSelected->Fill(18); | |
1557 | if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClassSelected->Fill(19); | |
1558 | if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClassSelected->Fill(20); | |
1559 | // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClassSelected->Fill(20); | |
1560 | if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClassSelected->Fill(21); | |
1561 | if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClassSelected->Fill(22); | |
1562 | if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClassSelected->Fill(23); | |
1563 | if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClassSelected->Fill(24); | |
1564 | if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClassSelected->Fill(25); | |
1565 | if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClassSelected->Fill(26); | |
1566 | if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClassSelected->Fill(27); | |
1567 | if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClassSelected->Fill(28); | |
1568 | if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClassSelected->Fill(29); | |
1569 | if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClassSelected->Fill(30); | |
1570 | if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClassSelected->Fill(31); | |
1571 | } | |
1572 | ||
1573 | if(!isSelected)return kFALSE; | |
1574 | return kTRUE; | |
1575 | ||
1576 | } | |
1577 | ||
1578 | ///________________________________________________________________________ | |
1579 | TString AliConvEventCuts::GetCutNumber(){ | |
1580 | // returns TString with current cut number | |
1581 | TString a(kNCuts); | |
1582 | for(Int_t ii=0;ii<kNCuts;ii++){ | |
1583 | a.Append(Form("%d",fCuts[ii])); | |
1584 | } | |
1585 | return a; | |
1586 | } | |
1587 | ||
1588 | ///________________________________________________________________________ | |
1589 | void AliConvEventCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *MCEvent){ | |
1590 | ||
d9e819f6 | 1591 | TString periodName = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPeriodName(); |
344100c4 | 1592 | |
1593 | ||
1594 | if(fNotRejectedStart){ | |
1595 | delete[] fNotRejectedStart; | |
1596 | fNotRejectedStart = NULL; | |
1597 | } | |
1598 | if(fNotRejectedEnd){ | |
1599 | delete[] fNotRejectedEnd; | |
1600 | fNotRejectedEnd = NULL; | |
1601 | } | |
1602 | if(fGeneratorNames){ | |
1603 | delete[] fGeneratorNames; | |
1604 | fGeneratorNames = NULL; | |
1605 | } | |
1606 | ||
1607 | if(rejection == 0) return; // No Rejection | |
1608 | ||
1609 | AliGenCocktailEventHeader *cHeader = 0x0; | |
1610 | AliAODMCHeader *cHeaderAOD = 0x0; | |
1611 | Bool_t headerFound = kFALSE; | |
1612 | AliStack *fMCStack = 0x0; | |
1613 | TClonesArray *fMCStackAOD = 0x0; | |
1614 | if(MCEvent->IsA()==AliMCEvent::Class()){ | |
1615 | cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(MCEvent)->GenEventHeader()); | |
1616 | if(cHeader) headerFound = kTRUE; | |
1617 | if(dynamic_cast<AliMCEvent*>(MCEvent))fMCStack = dynamic_cast<AliStack*>(dynamic_cast<AliMCEvent*>(MCEvent)->Stack()); | |
1618 | } | |
1619 | if(MCEvent->IsA()==AliAODEvent::Class()){ // MCEvent is a AODEvent in case of AOD | |
1620 | cHeaderAOD = dynamic_cast<AliAODMCHeader*>(MCEvent->FindListObject(AliAODMCHeader::StdBranchName())); | |
1621 | fMCStackAOD = dynamic_cast<TClonesArray*>(MCEvent->FindListObject(AliAODMCParticle::StdBranchName())); | |
1622 | ||
1623 | ||
1624 | if(cHeaderAOD) headerFound = kTRUE; | |
1625 | } | |
1626 | ||
1627 | if(headerFound){ | |
1628 | TList *genHeaders = 0x0; | |
1629 | if(cHeader) genHeaders = cHeader->GetHeaders(); | |
1630 | if(cHeaderAOD){ | |
1631 | genHeaders = cHeaderAOD->GetCocktailHeaders(); | |
1632 | if(genHeaders->GetEntries()==1){ | |
1633 | SetRejectExtraSignalsCut(0); | |
1634 | return; | |
1635 | } | |
1636 | } | |
1637 | AliGenEventHeader* gh = 0; | |
1638 | fnHeaders = 0; | |
1639 | Int_t firstindexA = 0; | |
1640 | Int_t lastindexA = -1; | |
1641 | if(rejection == 1 || rejection == 3) fnHeaders = 1; // MinBiasHeader | |
1642 | if(rejection == 2){ // TList of Headers Names | |
1643 | for(Int_t i = 0; i<genHeaders->GetEntries();i++){ | |
1644 | gh = (AliGenEventHeader*)genHeaders->At(i); | |
1645 | TString GeneratorName = gh->GetName(); | |
1646 | lastindexA = lastindexA + gh->NProduced(); | |
1647 | // cout << i << "\t" << GeneratorName.Data() << endl; | |
1648 | for(Int_t j = 0; j<HeaderList->GetEntries();j++){ | |
1649 | TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString(); | |
b5d519c0 | 1650 | // cout << GeneratorInList.Data() << endl; |
344100c4 | 1651 | if(GeneratorName.CompareTo(GeneratorInList) == 0){ |
b5d519c0 | 1652 | // cout << "accepted" << endl; |
344100c4 | 1653 | if (GeneratorInList.CompareTo("PARAM") == 0 || GeneratorInList.CompareTo("BOX") == 0 ){ |
1654 | if(fMCStack){ | |
1655 | if (fMCStack->Particle(firstindexA)->GetPdgCode() == fAddedSignalPDGCode ) { | |
1656 | if (periodName.CompareTo("LHC14a1b")==0 || periodName.CompareTo("LHC14a1c")==0 ){ | |
1657 | if (gh->NProduced() > 10 && fMCStack->Particle(firstindexA+10)->GetPdgCode() == fAddedSignalPDGCode ){ | |
1658 | // cout << "cond 1: "<< fnHeaders << endl; | |
1659 | fnHeaders++; | |
1660 | continue; | |
1661 | } | |
1662 | continue; | |
1663 | } else { | |
1664 | // cout << "cond 2: " << fnHeaders << endl; | |
1665 | fnHeaders++; | |
1666 | continue; | |
1667 | } | |
1668 | } | |
1669 | } | |
1670 | if ( fMCStackAOD){ | |
1671 | AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(fMCStackAOD->At(firstindexA)); | |
1672 | if ( aodMCParticle->GetPdgCode() == fAddedSignalPDGCode ){ | |
1673 | if (periodName.CompareTo("LHC14a1b")==0 || periodName.CompareTo("LHC14a1c")==0 ){ | |
1674 | if (gh->NProduced() > 10){ | |
1675 | AliAODMCParticle *aodMCParticle2 = static_cast<AliAODMCParticle*>(fMCStackAOD->At(firstindexA+10)); | |
1676 | if ( aodMCParticle2->GetPdgCode() == fAddedSignalPDGCode ){ | |
1677 | // cout << "cond 1: " << fnHeaders << endl; | |
1678 | fnHeaders++; | |
1679 | continue; | |
1680 | } | |
1681 | } | |
1682 | continue; | |
1683 | } else { | |
1684 | // cout << "cond 2: " << fnHeaders << endl; | |
1685 | fnHeaders++; | |
1686 | continue; | |
1687 | } | |
1688 | } | |
1689 | } | |
1690 | continue; | |
1691 | } | |
1692 | // cout << "cond 3: "<< fnHeaders << endl; | |
1693 | fnHeaders++; | |
1694 | continue; | |
1695 | } | |
1696 | } | |
1697 | firstindexA = firstindexA + gh->NProduced(); | |
1698 | } | |
1699 | } | |
1700 | // cout << "number of headers: " <<fnHeaders << endl; | |
1701 | ||
1702 | fNotRejectedStart = new Int_t[fnHeaders]; | |
1703 | fNotRejectedEnd = new Int_t[fnHeaders]; | |
1704 | fGeneratorNames = new TString[fnHeaders]; | |
1705 | ||
1706 | if(rejection == 1 || rejection == 3){ | |
1707 | fNotRejectedStart[0] = 0; | |
1708 | fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced()-1; | |
1709 | fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName(); | |
1710 | return; | |
1711 | } | |
1712 | ||
1713 | Int_t firstindex = 0; | |
1714 | Int_t lastindex = -1; | |
1715 | Int_t number = 0; | |
1716 | ||
1717 | for(Int_t i = 0; i<genHeaders->GetEntries();i++){ | |
1718 | gh = (AliGenEventHeader*)genHeaders->At(i); | |
1719 | TString GeneratorName = gh->GetName(); | |
1720 | lastindex = lastindex + gh->NProduced(); | |
1721 | for(Int_t j = 0; j<HeaderList->GetEntries();j++){ | |
1722 | TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString(); | |
1723 | // cout << i << "\t" << GeneratorName.Data() << endl; | |
1724 | if(GeneratorName.CompareTo(GeneratorInList) == 0){ | |
1725 | if (GeneratorInList.CompareTo("PARAM") == 0 || GeneratorInList.CompareTo("BOX") == 0 ){ | |
1726 | if(fMCStack){ | |
1727 | if (fMCStack->Particle(firstindex)->GetPdgCode() == fAddedSignalPDGCode ) { | |
1728 | if (periodName.CompareTo("LHC14a1b")==0 || periodName.CompareTo("LHC14a1c")==0 ){ | |
1729 | // cout << "produced " << gh->NProduced() << " with box generator" << endl; | |
1730 | if (gh->NProduced() > 10 && fMCStack->Particle(firstindex+10)->GetPdgCode() == fAddedSignalPDGCode){ | |
1731 | // cout << "one of them was a pi0 or eta" << endl; | |
1732 | fNotRejectedStart[number] = firstindex; | |
1733 | fNotRejectedEnd[number] = lastindex; | |
1734 | fGeneratorNames[number] = GeneratorName; | |
1735 | number++; | |
1736 | // cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl; | |
1737 | continue; | |
1738 | } | |
1739 | } else { | |
1740 | fNotRejectedStart[number] = firstindex; | |
1741 | fNotRejectedEnd[number] = lastindex; | |
1742 | fGeneratorNames[number] = GeneratorName; | |
1743 | number++; | |
1744 | continue; | |
1745 | } | |
1746 | } | |
1747 | } | |
1748 | if ( fMCStackAOD){ | |
1749 | AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(fMCStackAOD->At(firstindex)); | |
1750 | if ( aodMCParticle->GetPdgCode() == fAddedSignalPDGCode ){ | |
1751 | if (periodName.CompareTo("LHC14a1b")==0 || periodName.CompareTo("LHC14a1c")==0 ){ | |
1752 | if (gh->NProduced() > 10) { | |
1753 | AliAODMCParticle *aodMCParticle2 = static_cast<AliAODMCParticle*>(fMCStackAOD->At(firstindex+10)); | |
1754 | if ( aodMCParticle2->GetPdgCode() == fAddedSignalPDGCode ){ | |
1755 | fNotRejectedEnd[number] = lastindex; | |
1756 | fNotRejectedStart[number] = firstindex; | |
1757 | fGeneratorNames[number] = GeneratorName; | |
1758 | number++; | |
1759 | } | |
1760 | continue; | |
1761 | } | |
1762 | } else { | |
1763 | fNotRejectedStart[number] = firstindex; | |
1764 | fNotRejectedEnd[number] = lastindex; | |
1765 | fGeneratorNames[number] = GeneratorName; | |
1766 | number++; | |
1767 | continue; | |
1768 | } | |
1769 | } | |
1770 | } | |
1771 | continue; | |
1772 | } else { | |
1773 | fNotRejectedStart[number] = firstindex; | |
1774 | fNotRejectedEnd[number] = lastindex; | |
1775 | fGeneratorNames[number] = GeneratorName; | |
1776 | // cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl; | |
1777 | number++; | |
1778 | continue; | |
1779 | } | |
1780 | ||
1781 | } | |
1782 | } | |
1783 | firstindex = firstindex + gh->NProduced(); | |
1784 | } | |
1785 | // for (Int_t i = 0; i < number; i++){ | |
1786 | // cout << i << "\t" <<fGeneratorNames[i] << "\t" << fNotRejectedStart[i] << "\t" <<fNotRejectedEnd[i] << endl; | |
1787 | // } | |
1788 | ||
1789 | } else { // No Cocktail Header Found | |
1790 | fNotRejectedStart = new Int_t[1]; | |
1791 | fNotRejectedEnd = new Int_t[1]; | |
1792 | ||
1793 | fnHeaders = 1; | |
1794 | fNotRejectedStart[0] = 0; | |
1795 | fNotRejectedEnd[0] = static_cast<AliMCEvent*>(MCEvent)->Stack()->GetNprimary()-1; | |
1796 | fGeneratorNames = new TString[1]; | |
1797 | fGeneratorNames[0] = "NoCocktailGeneratorFound"; | |
1798 | ||
1799 | AliGenPythiaEventHeader *mcHeaderPythia = dynamic_cast<AliGenPythiaEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader()); | |
1800 | if (mcHeaderPythia) fGeneratorNames[0] = "NoCocktailGeneratorFound_Pythia"; | |
1801 | AliGenDPMjetEventHeader *mcHeaderPhojet = dynamic_cast<AliGenDPMjetEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader()); | |
1802 | if (mcHeaderPhojet) fGeneratorNames[0] = "NoCocktailGeneratorFound_Phojet"; | |
1803 | AliGenHijingEventHeader *mcHeaderHijing = dynamic_cast<AliGenHijingEventHeader*>(static_cast<AliMCEvent*>(MCEvent)->GenEventHeader()); | |
1804 | if (mcHeaderHijing) fGeneratorNames[0] = "NoCocktailGeneratorFound_Hijing"; | |
1805 | ||
1806 | SetRejectExtraSignalsCut(0); | |
1807 | } | |
1808 | ||
1809 | } | |
1810 | ||
1811 | //_________________________________________________________________________ | |
1812 | Int_t AliConvEventCuts::IsParticleFromBGEvent(Int_t index, AliStack *MCStack, AliVEvent *InputEvent){ | |
1813 | ||
1814 | // Not Accepted == kFALSE == 0 | |
1815 | // Accepted == kTRUE == 1 | |
1816 | // FirstHeader == kTRUE == 3 | |
1817 | if(index < 0) return 0; // No Particle | |
1818 | ||
1819 | // if (index == 100){ | |
1820 | // cout << "possible headers" << endl; | |
1821 | // for(Int_t i = 0;i<fnHeaders;i++){ | |
1822 | // cout << i << "\t" <<fGeneratorNames[i] << "\t" << fNotRejectedStart[i] << "\t" <<fNotRejectedEnd[i] << endl; | |
1823 | // } | |
1824 | // } | |
1825 | Int_t accepted = 0; | |
1826 | if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){ | |
1827 | if( index >= MCStack->GetNprimary()){ // Secondary Particle | |
1828 | if( ((TParticle*)MCStack->Particle(index))->GetMother(0) < 0) return 1; // Secondary Particle without Mother?? | |
1829 | return IsParticleFromBGEvent(((TParticle*)MCStack->Particle(index))->GetMother(0),MCStack,InputEvent); | |
1830 | } | |
1831 | for(Int_t i = 0;i<fnHeaders;i++){ | |
1832 | if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){ | |
1833 | accepted = 1; | |
1834 | if(i == 0) accepted = 2; // MB Header | |
1835 | } | |
1836 | } | |
1837 | } | |
1838 | else if(InputEvent->IsA()==AliAODEvent::Class()){ | |
1839 | TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName())); | |
1840 | if (AODMCTrackArray){ | |
1841 | AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index)); | |
1842 | if(!aodMCParticle) return 1; // Photon Without a Mother ? --> Accepted | |
1843 | if(!aodMCParticle->IsPrimary()){ | |
1844 | if( aodMCParticle->GetMother() < 0) return 1;// Secondary Particle without Mother?? | |
1845 | return IsParticleFromBGEvent(aodMCParticle->GetMother(),MCStack,InputEvent); | |
1846 | } | |
1847 | index = abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index))->GetLabel()); | |
1848 | for(Int_t i = 0;i<fnHeaders;i++){ | |
1849 | if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){ | |
1850 | accepted = 1; | |
1851 | if(i == 0) accepted = 2; // MB Header | |
1852 | } | |
1853 | } | |
1854 | } | |
1855 | } | |
1856 | ||
1857 | return accepted; | |
1858 | } | |
1859 | ||
1860 | //_________________________________________________________________________ | |
1861 | Int_t AliConvEventCuts::IsEventAcceptedByCut(AliConvEventCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Int_t isHeavyIon){ | |
1862 | ||
dc729816 | 1863 | Bool_t isMC = kFALSE; |
1864 | if (MCEvent){isMC = kTRUE;} | |
1865 | ||
1866 | if ( !IsTriggerSelected(InputEvent, isMC) ) | |
344100c4 | 1867 | return 3; |
1868 | ||
1869 | if(isHeavyIon != 0 && !(IsCentralitySelected(InputEvent,MCEvent))) | |
1870 | return 1; // Check Centrality --> Not Accepted => eventQuality = 1 | |
1871 | ||
1872 | if(isHeavyIon == 0 && GetIsFromPileup()){ | |
1873 | if(InputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){ | |
1874 | return 6; // Check Pileup --> Not Accepted => eventQuality = 6 | |
1875 | } | |
1876 | } | |
1877 | ||
1878 | Bool_t hasV0And = ReaderCuts->HasV0AND(); | |
1879 | Bool_t isSDDFired = ReaderCuts->IsSDDFired(); | |
1880 | if( (IsSpecialTrigger() == 2 || IsSpecialTrigger() == 3) && !isSDDFired && !MCEvent) | |
1881 | return 7; // With SDD requested but no fired | |
1882 | ||
1883 | if( (IsSpecialTrigger() == 1 || IsSpecialTrigger() == 3) && !hasV0And) | |
1884 | return 8; // V0AND requested but no fired | |
1885 | ||
1886 | if(hCentrality)hCentrality->Fill(GetCentrality(InputEvent)); | |
1887 | if(hCentralityVsNumberOfPrimaryTracks) | |
1888 | hCentralityVsNumberOfPrimaryTracks->Fill(GetCentrality(InputEvent), | |
1889 | ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager() | |
d9e819f6 | 1890 | ->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks()); |
344100c4 | 1891 | |
1892 | return 0; | |
1893 | } | |
1894 | ||
1895 | //_________________________________________________________________________ | |
1896 | Float_t AliConvEventCuts::GetWeightForMeson(TString period, Int_t index, AliStack *MCStack, AliVEvent *InputEvent){ | |
1897 | if (!(period.CompareTo("LHC12f1a") == 0 || period.CompareTo("LHC12f1b") == 0 || period.CompareTo("LHC12i3") == 0 || period.CompareTo("LHC11a10a") == 0 || period.CompareTo("LHC11a10b") == 0 || period.CompareTo("LHC11a10b_bis") == 0 || period.CompareTo("LHC11a10a_bis") == 0 || period.CompareTo("LHC11a10b_plus") == 0 || period.Contains("LHC13d2")|| period.Contains("LHC14a1") || | |
1898 | period.CompareTo("LHC13e7") == 0 || period.Contains("LHC13b2_efix") || period.CompareTo("LHC14b2") == 0 )) return 1.; | |
1899 | ||
1900 | Int_t kCaseGen = 0; | |
1901 | for (Int_t i = 0; i < fnHeaders; i++){ | |
1902 | if (index >= fNotRejectedStart[i] && index < fNotRejectedEnd[i]+1){ | |
1903 | if (fGeneratorNames[i].CompareTo("Pythia") == 0){ | |
1904 | kCaseGen = 1; | |
1905 | } else if (fGeneratorNames[i].CompareTo("DPMJET") == 0){ | |
1906 | kCaseGen = 2; | |
1907 | } else if (fGeneratorNames[i].CompareTo("HIJING") == 0 || | |
1908 | fGeneratorNames[i].CompareTo("Hijing") == 0 || | |
1909 | fGeneratorNames[i].Contains("hijing")){ | |
1910 | kCaseGen = 3; | |
1911 | } else if (fGeneratorNames[i].CompareTo("BOX") == 0){ | |
1912 | kCaseGen = 4; | |
1913 | } else if (fGeneratorNames[i].CompareTo("PARAM") == 0){ | |
1914 | kCaseGen = 5; | |
1915 | } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound") == 0){ | |
1916 | kCaseGen = 6; | |
1917 | } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Pythia") == 0){ | |
1918 | kCaseGen = 1; | |
1919 | } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Phojet") == 0){ | |
1920 | kCaseGen = 2; | |
1921 | } else if (fGeneratorNames[i].CompareTo("NoCocktailGeneratorFound_Hijing") == 0){ | |
1922 | kCaseGen = 3; | |
1923 | } | |
1924 | if (period.Contains("LHC13d2") || period.CompareTo("LHC13e7") == 0 || period.Contains("LHC13b2_efix") || period.Contains("LHC14a1") || period.CompareTo("LHC14b2") == 0 ){ | |
1925 | kCaseGen = 3; | |
1926 | } | |
1927 | } | |
1928 | } | |
1929 | if (kCaseGen == 0) return 1; | |
1930 | ||
1931 | ||
1932 | Double_t mesonPt = 0; | |
1933 | Double_t mesonMass = 0; | |
1934 | Int_t PDGCode = 0; | |
1935 | if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){ | |
1936 | mesonPt = ((TParticle*)MCStack->Particle(index))->Pt(); | |
1937 | mesonMass = ((TParticle*)MCStack->Particle(index))->GetCalcMass(); | |
1938 | PDGCode = ((TParticle*)MCStack->Particle(index))->GetPdgCode(); | |
1939 | } | |
1940 | else if(InputEvent->IsA()==AliAODEvent::Class()){ | |
1941 | TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName())); | |
1942 | if (AODMCTrackArray){ | |
1943 | AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index)); | |
1944 | mesonPt = aodMCParticle->Pt(); | |
1945 | mesonMass = aodMCParticle->GetCalcMass(); | |
1946 | PDGCode = aodMCParticle->GetPdgCode(); | |
1947 | } else { | |
1948 | return 1; | |
1949 | } | |
1950 | } | |
1951 | ||
1952 | Float_t functionResultMC = 1.; | |
1953 | if (kCaseGen == 1){ // Pythia 6 | |
1954 | Float_t dNdyMC = 2.1462; | |
1955 | Float_t nMC = 7.06055; | |
1956 | Float_t tMC = 0.12533; | |
1957 | if ( PDGCode == 111){ | |
1958 | dNdyMC = 2.1462; | |
1959 | nMC = 7.06055; | |
1960 | tMC = 0.12533; | |
1961 | } else if ( PDGCode == 221){ | |
1962 | dNdyMC = 0.2357; | |
1963 | nMC = 5.9105; | |
1964 | tMC = 0.1525; | |
1965 | } | |
1966 | functionResultMC = dNdyMC / ( 2 * TMath::Pi())*(nMC-1.)*(nMC-2.) / (nMC*tMC*(nMC*tMC+mesonMass*(nMC-2.))) * TMath::Power(1.+(TMath::Sqrt(mesonPt*mesonPt+mesonMass*mesonMass)-mesonMass)/(nMC*tMC), -nMC); | |
1967 | } else if (kCaseGen == 2){ // Phojet | |
1968 | Float_t dNdyMC = 2.35978; | |
1969 | Float_t nMC = 6.81795; | |
1970 | Float_t tMC = 0.11492; | |
1971 | if ( PDGCode == 111){ | |
1972 | dNdyMC = 2.35978; | |
1973 | nMC = 6.81795; | |
1974 | tMC = 0.11492; | |
1975 | } else if ( PDGCode == 221){ | |
1976 | dNdyMC = 0.3690; | |
1977 | nMC = 5.55809; | |
1978 | tMC = 0.13387; | |
1979 | } | |
1980 | functionResultMC = dNdyMC / ( 2 * TMath::Pi())*(nMC-1.)*(nMC-2.) / (nMC*tMC*(nMC*tMC+mesonMass*(nMC-2.))) * TMath::Power(1.+(TMath::Sqrt(mesonPt*mesonPt+mesonMass*mesonMass)-mesonMass)/(nMC*tMC), -nMC); | |
1981 | } else if (kCaseGen == 4){ // BOX generators pp | |
1982 | // functionResultMC = 1./sqrt(1.-mesonMass*mesonMass/((mesonMass*mesonMass+mesonPt*mesonPt)*cosh(mesonY)*cosh(mesonY))); | |
1983 | Float_t a = 0.23437; | |
1984 | Float_t b = 5.6661; | |
1985 | Float_t c = -1430.5863; | |
1986 | Float_t d = -0.6966624; | |
1987 | Float_t e = 252.3742; | |
1988 | if ( PDGCode == 111){ | |
1989 | a = 0.23437; | |
1990 | b = 5.6661; | |
1991 | c = -1430.5863; | |
1992 | d = -0.6966624; | |
1993 | e = 252.3742; | |
1994 | } else if ( PDGCode == 221){ | |
1995 | a = 0.10399; | |
1996 | b = 4.35311; | |
1997 | c = -12.17723; | |
1998 | d = -0.01172; | |
1999 | e =1.85140; | |
2000 | } | |
2001 | functionResultMC = a*TMath::Power(mesonPt,-1.*(b+c/(TMath::Power(mesonPt,d)+e)))*1./mesonPt *1./1.6 *1./(2.* TMath::Pi()); | |
2002 | // cout << functionResultMC << endl; | |
2003 | } else if (kCaseGen == 3 ){ // HIJING | |
2004 | if ( PDGCode == 111 && fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0){ | |
2005 | functionResultMC = hReweightMCHistPi0->Interpolate(mesonPt); | |
2006 | } | |
2007 | if ( PDGCode == 221 && fDoReweightHistoMCEta && hReweightMCHistEta!= 0x0){ | |
2008 | functionResultMC = hReweightMCHistEta->Interpolate(mesonPt); | |
2009 | } | |
2010 | if ( PDGCode == 310 && fDoReweightHistoMCK0s && hReweightMCHistK0s!= 0x0){ | |
2011 | functionResultMC = hReweightMCHistK0s->Interpolate(mesonPt); | |
2012 | } | |
2013 | } | |
2014 | ||
2015 | Float_t functionResultData = 1; | |
2016 | if (kCaseGen == 1 || kCaseGen == 2 || kCaseGen == 4 ){ | |
2017 | Float_t dNdyData = 2.2328; | |
2018 | Float_t nData = 7.1473; | |
2019 | Float_t tData = 0.1346; | |
2020 | if ( PDGCode == 111){ | |
2021 | dNdyData = 2.2328; | |
2022 | nData = 7.1473; | |
2023 | tData = 0.1346; | |
2024 | } else if ( PDGCode == 221){ | |
2025 | dNdyData = 0.38992; //be careful this fit is not optimal, eta in data still has problems | |
2026 | nData = 5.72778; | |
2027 | tData = 0.13835; | |
2028 | } | |
2029 | functionResultData = dNdyData / ( 2 * TMath::Pi())*(nData-1.)*(nData-2.) / (nData*tData*(nData*tData+mesonMass*(nData-2.))) * TMath::Power(1.+(TMath::Sqrt(mesonPt*mesonPt+mesonMass*mesonMass)-mesonMass)/(nData*tData), -nData); | |
2030 | // cout << functionResultData << endl; | |
2031 | } else { | |
2032 | if ( PDGCode == 111 && fDoReweightHistoMCPi0 && fFitDataPi0!= 0x0){ | |
2033 | functionResultData = fFitDataPi0->Eval(mesonPt); | |
2034 | } | |
2035 | if ( PDGCode == 221 && fDoReweightHistoMCEta && fFitDataEta!= 0x0){ | |
2036 | functionResultData = fFitDataEta->Eval(mesonPt); | |
2037 | } | |
2038 | if ( PDGCode == 310 && fDoReweightHistoMCK0s && fFitDataK0s!= 0x0){ | |
2039 | functionResultData = fFitDataK0s->Eval(mesonPt); | |
2040 | } | |
2041 | ||
2042 | } | |
2043 | ||
2044 | Double_t weight = 1; | |
2045 | if (PDGCode == 111 || PDGCode == 221){ | |
2046 | if (functionResultData != 0. && functionResultMC != 0. && isfinite(functionResultData) && isfinite(functionResultMC)){ | |
2047 | weight = functionResultData/functionResultMC; | |
2048 | if ( kCaseGen == 3){ | |
2049 | if (PDGCode == 111){ | |
2050 | if (!(fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0 && PDGCode == 111)){ | |
2051 | weight = 1.; | |
2052 | } | |
2053 | } | |
2054 | if (PDGCode == 221){ | |
2055 | if (!(fDoReweightHistoMCEta && hReweightMCHistEta!= 0x0 && PDGCode == 221)){ | |
2056 | weight = 1.; | |
2057 | } | |
2058 | } | |
2059 | } | |
2060 | if (!isfinite(functionResultData)) weight = 1.; | |
2061 | if (!isfinite(weight)) weight = 1.; | |
2062 | } | |
2063 | } else if (PDGCode == 310 && functionResultMC != 0 && isfinite(functionResultMC)){ | |
2064 | weight = functionResultMC; | |
2065 | } | |
2066 | ||
2067 | // if (fModCentralityClass == 0 && fCentralityMin == 4 && fCentralityMax == 6 && PDGCode == 111){ | |
2068 | // cout << period.Data() << "\t" << kCaseGen << "\t" <<fModCentralityClass<< "\t" <<fCentralityMin<< "\t" <<fCentralityMax << "\t" << mesonPt << "\t" <<mesonMass<< "\t"<<functionResultData << "\t"<< functionResultMC << "\t" << weight <<endl; | |
2069 | // } | |
2070 | return weight; | |
2071 | } | |
2072 | ||
2073 | ||
2074 | ///________________________________________________________________________ | |
2075 | void AliConvEventCuts::GetCorrectEtaShiftFromPeriod(TString periodName){ | |
2076 | ||
2077 | if(periodName.CompareTo("LHC12g") == 0 || //pilot run 2012 | |
2078 | periodName.CompareTo("LHC13b") == 0 || //mainly minimum bias | |
2079 | periodName.CompareTo("LHC13c") == 0 || //mainly minimum bias | |
2080 | periodName.CompareTo("LHC13d") == 0 || //mainly triggered | |
2081 | periodName.CompareTo("LHC13e") == 0 || //mainly triggered | |
2082 | periodName.CompareTo("LHC13c3") == 0 || //MC Starlight, anchor LHC13d+e | |
2083 | periodName.CompareTo("LHC13c2") == 0 || //MC Starlight, coherent J/Psi, UPC muon anchor LHC13d+e | |
2084 | periodName.CompareTo("LHC13b4") == 0 || //MC Pythia 6 (Jet-Jet), anchor LHC13b | |
2085 | periodName.CompareTo("LHC13b2_fix_1") == 0 || //MC DPMJET, anchr LHC13b+c | |
2086 | periodName.CompareTo("LHC13b2_efix_p1") == 0 || //MC DPMJET, anchr LHC13b+c | |
2087 | periodName.CompareTo("LHC13b2_efix_p2") == 0 || //MC DPMJET, anchr LHC13b+c | |
2088 | periodName.CompareTo("LHC13b2_efix_p3") == 0 || //MC DPMJET, anchr LHC13b+c | |
2089 | periodName.CompareTo("LHC13b2_efix_p4") == 0 || //MC DPMJET, anchr LHC13b+c | |
2090 | periodName.CompareTo("LHC13e7") == 0 || //MC DPMJET, anchr LHC13b+c | |
2091 | periodName.CompareTo("LHC13b3") == 0 || //MC HIJING, weighted to number of events per run, anchor LHC13b | |
2092 | periodName.CompareTo("LHC13b2") == 0 || // MC DPMJET, wrong energy, anchor LHC13b | |
2093 | periodName.CompareTo("LHC13b2_plus") == 0 || // MC DPMJET, weighted to number event per run, anchor LHC13b | |
2094 | periodName.CompareTo("LHC13c1_bis") == 0 || // MC AMPT fast generation, pT hardbin, anchor ? | |
2095 | periodName.CompareTo("LHC13c1") == 0 || // MC AMPT fast generation, anchor ? | |
2096 | periodName.CompareTo("LHC13b1") == 0 || // MC DPMJET, fragments, with fixed label 0, anchor LHC12g | |
2097 | periodName.CompareTo("LHC12g4b_fix") == 0 || // MC DPMJET, with fixed label 0, anchor LHC12g | |
2098 | periodName.CompareTo("LHC12g1_fix") == 0 || // MC ?, with fixed label 0, anchor LHC12g | |
2099 | periodName.CompareTo("LHC12g4c") == 0 || // MC DPMJET, shifted vertex runs, anchor LHC12g | |
2100 | periodName.CompareTo("LHC12h6") == 0 || // MC muon cocktail, anchor LHC12g | |
2101 | periodName.CompareTo("LHC12g4b") == 0 || // MC DPMJET 3rd iteration, anchor LHC12g | |
2102 | periodName.CompareTo("LHC12g4a") == 0 || // MC DPMJET improved, anchor LHC12g | |
2103 | periodName.CompareTo("LHC12g4") == 0 || // MC DPMJET, anchor LHC12g | |
2104 | periodName.CompareTo("LHC12g5") == 0 || // MC PHOJET, anchor LHC12g | |
2105 | periodName.CompareTo("LHC12g2") == 0 || // MC Starlight background, anchor LHC12g | |
2106 | periodName.CompareTo("LHC12g1") == 0 ) // MC ?, anchor LHC12g | |
2107 | { | |
2108 | printf(" Gamma Conversion Cuts %s :: pPb Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),-0.465); | |
2109 | SetEtaShift(-0.465); | |
2110 | } | |
2111 | else if(periodName.CompareTo("LHC13f") == 0 || | |
2112 | periodName.CompareTo("LHC13c6b") == 0 ||// MC Jpsi -> mumu, anchor LHC13f | |
2113 | periodName.CompareTo("LHC13c5") == 0 || //MC Starlight, gamma gamma UPC muon, anchor LHC13f | |
2114 | periodName.CompareTo("LHC13c4") == 0 )//MC Starlight, coherent JPsi, UPC muon, anchor LHC13f | |
2115 | { | |
2116 | printf(" Gamma Conversion Cuts %s :: Pbp Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),0.465); | |
2117 | SetEtaShift(+0.465); | |
2118 | } | |
2119 | else printf(" Gamma Conversion Cuts %s :: Automatic Eta Shift requested but Period is not known -> No Shift \n\n",(GetCutNumber()).Data()); | |
2120 | } | |
2121 | ||
dc729816 | 2122 | //________________________________________________________________________ |
2123 | AliEmcalTriggerPatchInfo* AliConvEventCuts::GetMainTriggerPatch() | |
2124 | { | |
2125 | //get main trigger match; if not known yet, look for it and cache | |
2126 | ||
2127 | if (fMainTriggerPatchEMCAL) | |
2128 | return fMainTriggerPatchEMCAL; | |
2129 | ||
2130 | if (!fTriggerPatchInfo) { | |
2131 | AliError(Form("%s: fTriggerPatchInfo not available",GetName())); | |
2132 | return 0; | |
2133 | } | |
2134 | ||
2135 | //number of patches in event | |
2136 | Int_t nPatch = fTriggerPatchInfo->GetEntries(); | |
2137 | ||
2138 | //extract main trigger patch | |
2139 | AliEmcalTriggerPatchInfo *patch; | |
2140 | for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) { | |
2141 | patch = (AliEmcalTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch ); | |
2142 | if (patch->IsMainTrigger()) { | |
2143 | fMainTriggerPatchEMCAL = patch; | |
2144 | break; | |
2145 | } | |
2146 | } | |
2147 | ||
2148 | return fMainTriggerPatchEMCAL; | |
2149 | } | |
2150 | ||
2151 | ||
2152 | //________________________________________________________________________ | |
2153 | void AliConvEventCuts::InitializeEMCALTrigger(AliVEvent *fInputEvent) | |
2154 | { | |
2155 | // cout << "entered EMCAL trigger initialization" << endl; | |
2156 | ||
2157 | // Init the analysis. | |
2158 | if (fCaloTriggersName.IsNull()){ | |
2159 | if (fInputEvent->IsA()==AliESDEvent::Class()){ | |
2160 | fCaloTriggersName = "EMCALTrigger"; | |
2161 | } else { | |
2162 | fCaloTriggersName = "emcalTrigger"; | |
2163 | } | |
2164 | } | |
2165 | ||
2166 | if (!fCaloTriggersName.IsNull() && !fCaloTriggers) { | |
2167 | fCaloTriggers = dynamic_cast<AliVCaloTrigger*>(fInputEvent->FindListObject(fCaloTriggersName)); | |
2168 | if (!fCaloTriggers) { | |
2169 | AliError(Form("%s: Could not retrieve calo triggers %s!", GetName(), fCaloTriggersName.Data())); | |
2170 | return; | |
2171 | } | |
2172 | } | |
2173 | ||
2174 | if (fCaloTriggerPatchInfoName.IsNull()){ | |
2175 | if (fInputEvent->IsA()==AliESDEvent::Class()){ | |
2176 | fCaloTriggerPatchInfoName = "EmcalTriggers"; | |
2177 | } else { | |
2178 | fCaloTriggerPatchInfoName = "EmcalTriggers"; | |
2179 | } | |
2180 | } | |
2181 | ||
2182 | if (!fCaloTriggerPatchInfoName.IsNull() && !fTriggerPatchInfo) { | |
2183 | fTriggerPatchInfo = GetArrayFromEvent(fInputEvent, fCaloTriggerPatchInfoName.Data(), "AliEmcalTriggerPatchInfo"); | |
2184 | if (!fTriggerPatchInfo) { | |
2185 | AliError(Form("%s: Could not retrieve calo trigger patch info %s!", GetName(), fCaloTriggerPatchInfoName.Data())); | |
2186 | return; | |
2187 | } | |
2188 | ||
2189 | } | |
2190 | ||
2191 | fEMCALTrigInitialized = kTRUE; | |
2192 | } | |
2193 | ||
2194 | //________________________________________________________________________ | |
2195 | ULong_t AliConvEventCuts::GetTriggerList(){ | |
2196 | if (!fTriggerPatchInfo) | |
2197 | return 0; | |
2198 | //number of patches in event | |
2199 | Int_t nPatch = fTriggerPatchInfo->GetEntries(); | |
2200 | ||
2201 | //loop over patches to define trigger type of event | |
2202 | Int_t nG1 = 0; | |
2203 | Int_t nG2 = 0; | |
2204 | Int_t nJ1 = 0; | |
2205 | Int_t nJ2 = 0; | |
2206 | Int_t nL0 = 0; | |
2207 | AliEmcalTriggerPatchInfo *patch; | |
cfd87ccd | 2208 | // if (nPatch> 0) {cout << "NEW Triggers in this event*********************************" << endl;} |
dc729816 | 2209 | for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) { |
2210 | patch = (AliEmcalTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch ); | |
cfd87ccd | 2211 | // cout << "Patch energy: "<<patch->GetPatchE() << "\t ADC counts: " << patch->GetADCAmp() << endl; |
2212 | // cout << "Phi: " << patch->GetPhiMin() << " - " << patch->GetPhiMax() << " delta phi: " <<abs(patch->GetPhiMin()-patch->GetPhiMax())<< endl; | |
2213 | // cout << "Eta: " << patch->GetEtaMin() << " - " << patch->GetEtaMax() << " delta eta: " <<abs(patch->GetEtaMin()-patch->GetEtaMax())<< endl; | |
2214 | if (patch->IsGammaHigh()){ | |
2215 | // cout << "fired L1GA high" << endl; | |
2216 | nG1++; | |
2217 | } | |
2218 | if (patch->IsGammaLow()){ | |
2219 | // cout << "fired L1GA low" << endl; | |
2220 | nG2++; | |
2221 | } | |
2222 | if (patch->IsJetHigh()){ | |
2223 | // cout << "fired L1JE high" << endl; | |
2224 | nJ1++; | |
2225 | } | |
2226 | if (patch->IsJetLow()){ | |
2227 | // cout << "fired L1JE low" << endl; | |
2228 | nJ2++; | |
2229 | } | |
2230 | if (patch->IsLevel0()){ | |
2231 | // cout << "fired L0" << endl; | |
2232 | nL0++; | |
2233 | } | |
2234 | // cout << patch->GetPatchE() << "\t" << patch->GetADCAmp() << "\t" << patch->IsGammaHigh() << "\t" << patch->IsGammaLow() | |
2235 | // << "\t" << patch->IsJetHigh() << "\t" << patch->IsJetLow() << "\t" << patch->IsLevel0() | |
2236 | // << "\t" << patch->GetPhiMin() << "\t" << patch->GetPhiMax() << "\t" << abs(patch->GetPhiMin()-patch->GetPhiMax()) | |
2237 | // << "\t" << patch->GetEtaMin() << "\t" << patch->GetEtaMax() << "\t" << abs(patch->GetEtaMin()-patch->GetEtaMax()) << endl; | |
dc729816 | 2238 | } |
2239 | ||
cfd87ccd | 2240 | if (nPatch > 0){ |
2241 | AliDebug(2, "Patch summary: "); | |
2242 | AliDebug(2, Form("Number of patches: %d", nPatch)); | |
2243 | AliDebug(2, Form("Level0: [%d]" ,nL0)); | |
2244 | AliDebug(2, Form("Jet: low[%d], high[%d]" ,nJ2, nJ1)); | |
2245 | AliDebug(2, Form("Gamma: low[%d], high[%d]" ,nG2, nG1)); | |
2246 | } | |
2247 | ||
dc729816 | 2248 | // if (nPatch > 0){ |
2249 | // cout << Form("Number of patches: %d", nPatch) << endl; | |
2250 | // cout << Form("Level0: [%d]" ,nL0) << endl; | |
2251 | // cout << Form("Jet: low[%d], high[%d]" ,nJ2, nJ1) << endl; | |
2252 | // cout << Form("Gamma: low[%d], high[%d]" ,nG2, nG1) << endl; | |
2253 | // } | |
2254 | ||
2255 | ULong_t triggers(0); | |
2256 | if (nG1>0) | |
cfd87ccd | 2257 | SETBIT(triggers, kG1); |
dc729816 | 2258 | if (nG2>0) |
cfd87ccd | 2259 | SETBIT(triggers, kG2); |
dc729816 | 2260 | if (nJ1>0) |
cfd87ccd | 2261 | SETBIT(triggers, kJ1); |
dc729816 | 2262 | if (nJ2>0) |
cfd87ccd | 2263 | SETBIT(triggers, kJ2); |
dc729816 | 2264 | if (nL0>0) |
cfd87ccd | 2265 | SETBIT(triggers, kL0); |
dc729816 | 2266 | return triggers; |
2267 | } | |
2268 | ||
2269 | //________________________________________________________________________ | |
2270 | Bool_t AliConvEventCuts::HasTriggerType(TriggerTypeEMCAL t){ | |
2271 | // Check if event has a given trigger type | |
2272 | if(t == kND){ | |
2273 | return fTriggersEMCAL == 0; | |
2274 | } | |
2275 | return TESTBIT(fTriggersEMCAL, int(t)); | |
2276 | } | |
2277 | ||
2278 | ||
2279 | //________________________________________________________________________ | |
2280 | TClonesArray *AliConvEventCuts::GetArrayFromEvent(AliVEvent* fInputEvent, const char *name, const char *clname) | |
2281 | { | |
2282 | // Get array from event. | |
2283 | ||
2284 | TClonesArray *arr = 0; | |
2285 | TString sname(name); | |
2286 | if (!sname.IsNull()) { | |
2287 | arr = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(sname)); | |
2288 | if (!arr) { | |
2289 | AliWarning(Form("%s: Could not retrieve array with name %s!", GetName(), name)); | |
2290 | return 0; | |
2291 | } | |
2292 | } else { | |
2293 | return 0; | |
2294 | } | |
2295 | ||
2296 | if (!clname) | |
2297 | return arr; | |
2298 | ||
2299 | TString objname(arr->GetClass()->GetName()); | |
2300 | TClass cls(objname); | |
2301 | if (!cls.InheritsFrom(clname)) { | |
2302 | AliWarning(Form("%s: Objects of type %s in %s are not inherited from %s!", | |
2303 | GetName(), cls.GetName(), name, clname)); | |
2304 | return 0; | |
2305 | } | |
2306 | return arr; | |
2307 | } |