AliPhysics  a1733f5 (a1733f5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliConvEventCuts.cxx
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Authors: Friederike Bock, Daniel Muehlheim *
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 
17 //---------------------------------------------
18 // Class handling all kinds of selection cuts for
19 // Gamma Conversion analysis
20 //---------------------------------------------
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 "TObjString.h"
35 #include "AliMCEvent.h"
36 #include "AliAODEvent.h"
37 #include "AliESDEvent.h"
38 #include "AliCentrality.h"
39 #include "AliMultSelection.h"
40 #include "TList.h"
41 #include "TFile.h"
42 #include "AliLog.h"
43 #include "AliGenCocktailEventHeader.h"
44 #include "AliGenDPMjetEventHeader.h"
45 #include "AliGenPythiaEventHeader.h"
46 #include "AliGenHijingEventHeader.h"
47 #include "AliTriggerAnalysis.h"
48 #include "AliV0ReaderV1.h"
49 #include "AliVCaloCells.h"
50 #include "AliAODMCParticle.h"
51 #include "AliAODMCHeader.h"
52 #include "AliEMCALTriggerPatchInfo.h"
53 
54 class iostream;
55 
56 using namespace std;
57 
59 ClassImp(AliConvEventCuts)
61 
62 
63 const char* AliConvEventCuts::fgkCutNames[AliConvEventCuts::kNCuts] = {
64  "HeavyIon", //0
65  "CentralityMin", //1
66  "CentralityMax", //2
67  "SelectSpecialTrigger", //3
68  "SelectSpecialSubTriggerClass", //4
69  "RemovePileUp", //5
70  "RejectExtraSignals", //6
71  "VertexCut", //7
72 };
73 
74 
75 //________________________________________________________________________
76 AliConvEventCuts::AliConvEventCuts(const char *name,const char *title) :
77  AliAnalysisCuts(name,title),
78  fHistograms(NULL),
79  fHeaderList(NULL),
80  fDoLightOutput(kFALSE),
81  fEventQuality(-1),
82  fIsHeavyIon(0),
83  fDetectorCentrality(0),
84  fModCentralityClass(0),
85  fEnableVertexCut(kTRUE),
86  fMaxVertexZ(10),
87  fCentralityMin(0),
88  fCentralityMax(0),
89  fMultiplicityMethod(0),
90  fSpecialTrigger(0),
91  fSpecialSubTrigger(0),
92  fRemovePileUp(kFALSE),
93  fPastFutureRejectionLow(0),
94  fPastFutureRejectionHigh(0),
95  fDoPileUpRejectV0MTPCout(0),
96  fFPileUpRejectV0MTPCout(0),
97  fRejectExtraSignals(0),
98  fOfflineTriggerMask(0),
99  fHasV0AND(kTRUE),
100  fIsSDDFired(kTRUE),
101  fRandom(0),
102  fnHeaders(0),
103  fNotRejectedStart(NULL),
104  fNotRejectedEnd(NULL),
105  fGeneratorNames(NULL),
106  fPeriodEnum(kNoPeriod),
107  fEnergyEnum(kUnset),
108  fCutString(NULL),
109  fCutStringRead(""),
110  fUtils(NULL),
111  fEtaShift(0.0),
112  fDoEtaShift(kFALSE),
113  fDoCentralityFlat(0),
114  fPathWeightsFlatCent(""),
115  fNameHistoNotFlatCentrality(""),
116  fDoReweightHistoMCPi0(kFALSE),
117  fDoReweightHistoMCEta(kFALSE),
118  fDoReweightHistoMCK0s(kFALSE),
119  fPathTrFReweighting(""),
120  fNameHistoReweightingPi0(""),
121  fNameHistoReweightingEta(""),
122  fNameHistoReweightingK0s(""),
123  fNameFitDataPi0(""),
124  fNameFitDataEta(""),
125  fNameFitDataK0s(""),
126  fHistoEventCuts(NULL),
127  fHistoPastFutureBits(NULL),
128  hCentrality(NULL),
129  hCentralityNotFlat(NULL),
130  //hCentralityVsNumberOfPrimaryTracks(NULL),
131  hVertexZ(NULL),
132  hNPileupVertices(NULL),
133  hPileupVertexToPrimZ(NULL),
134  hPileupVertexToPrimZSPDPileup(NULL),
135  hPileupVertexToPrimZTrackletvsHits(NULL),
136  hEventPlaneAngle(NULL),
137  fEventPlaneAngle(0),
138  hTriggerClass(NULL),
139  hTriggerClassSelected(NULL),
140  hTriggerClassesCorrelated(NULL),
141  hReweightMCHistPi0(NULL),
142  hReweightMCHistEta(NULL),
143  hReweightMCHistK0s(NULL),
144  fFitDataPi0(NULL),
145  fFitDataEta(NULL),
146  fFitDataK0s(NULL),
147  fAddedSignalPDGCode(0),
148  fPreSelCut(kFALSE),
149  fTriggerSelectedManually(kFALSE),
150  fSpecialTriggerName(""),
151  fSpecialSubTriggerName(""),
152  fNSpecialSubTriggerOptions(0),
153  hSPDClusterTrackletBackgroundBefore(NULL),
154  hSPDClusterTrackletBackground(NULL),
155  fV0ReaderName(""),
156  fCaloTriggers(NULL),
157  fTriggerPatchInfo(NULL),
158  fMainTriggerPatchEMCAL(NULL),
159  fCaloTriggersName(""),
160  fCaloTriggerPatchInfoName(""),
161  fTriggersEMCAL(0),
162  fTriggersEMCALSelected(-1),
163  fEMCALTrigInitialized(kFALSE),
164  fSecProdBoundary(1.0),
165  fMaxPtJetMC(0),
166  fMaxFacPtHard(2.5),
167  fMaxFacPtHardSingleParticle(1.5),
168  fMimicTrigger(kFALSE),
169  fRejectTriggerOverlap(kFALSE),
170  fDoMultiplicityWeighting(kFALSE),
171  fPathReweightingMult(""),
172  fNameHistoReweightingMultData(""),
173  fNameHistoReweightingMultMC(""),
174  hReweightMultData(NULL),
175  hReweightMultMC(NULL),
176  fDebugLevel(0)
177 {
178  for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
179  fCutString=new TObjString((GetCutNumber()).Data());
180 
181  fUtils = new AliAnalysisUtils();
182  //if you do not want to apply the cut on the distance between the SPD and TRK vertex:
183  //fUtils->SetCutOnZVertexSPD(kFALSE);
184 
185 
186 }
187 
188 //________________________________________________________________________
190  AliAnalysisCuts(ref),
191  fHistograms(NULL),
192  fHeaderList(ref.fHeaderList),
193  fDoLightOutput(ref.fDoLightOutput),
194  fEventQuality(ref.fEventQuality),
195  fIsHeavyIon(ref.fIsHeavyIon),
196  fDetectorCentrality(ref.fDetectorCentrality),
197  fModCentralityClass(ref.fModCentralityClass),
198  fEnableVertexCut(ref.fEnableVertexCut),
199  fMaxVertexZ(ref.fMaxVertexZ),
200  fCentralityMin(ref.fCentralityMin),
201  fCentralityMax(ref.fCentralityMax),
202  fMultiplicityMethod(ref.fMultiplicityMethod),
203  fSpecialTrigger(ref.fSpecialTrigger),
204  fSpecialSubTrigger(ref.fSpecialSubTrigger),
205  fRemovePileUp(ref.fRemovePileUp),
206  fPastFutureRejectionLow(ref.fPastFutureRejectionLow),
207  fPastFutureRejectionHigh(ref.fPastFutureRejectionHigh),
208  fDoPileUpRejectV0MTPCout(ref.fDoPileUpRejectV0MTPCout),
209  fFPileUpRejectV0MTPCout(ref.fFPileUpRejectV0MTPCout),
210  fRejectExtraSignals(ref.fRejectExtraSignals),
211  fOfflineTriggerMask(ref.fOfflineTriggerMask),
212  fHasV0AND(ref.fHasV0AND),
213  fIsSDDFired(ref.fIsSDDFired),
214  fRandom(ref.fRandom),
215  fnHeaders(ref.fnHeaders),
216  fNotRejectedStart(NULL),
217  fNotRejectedEnd(NULL),
218  fGeneratorNames(ref.fGeneratorNames),
219  fPeriodEnum(ref.fPeriodEnum),
220  fEnergyEnum(kUnset),
221  fCutString(NULL),
222  fCutStringRead(""),
223  fUtils(NULL),
224  fEtaShift(ref.fEtaShift),
225  fDoEtaShift(ref.fDoEtaShift),
226  fDoCentralityFlat(ref.fDoCentralityFlat),
227  fPathWeightsFlatCent(ref.fPathWeightsFlatCent),
228  fNameHistoNotFlatCentrality(ref.fNameHistoNotFlatCentrality),
229  fDoReweightHistoMCPi0(ref.fDoReweightHistoMCPi0),
230  fDoReweightHistoMCEta(ref.fDoReweightHistoMCEta),
231  fDoReweightHistoMCK0s(ref.fDoReweightHistoMCK0s),
232  fPathTrFReweighting(ref.fPathTrFReweighting),
233  fNameHistoReweightingPi0(ref.fNameHistoReweightingPi0),
234  fNameHistoReweightingEta(ref.fNameHistoReweightingEta),
235  fNameHistoReweightingK0s(ref.fNameHistoReweightingK0s),
236  fNameFitDataPi0(ref.fNameFitDataPi0),
237  fNameFitDataEta(ref.fNameFitDataEta),
238  fNameFitDataK0s(ref.fNameFitDataK0s),
239  fHistoEventCuts(NULL),
240  fHistoPastFutureBits(NULL),
241  hCentrality(ref.hCentrality),
242  hCentralityNotFlat(ref.hCentralityNotFlat),
243  //hCentralityVsNumberOfPrimaryTracks(ref.hCentralityVsNumberOfPrimaryTracks),
244  hVertexZ(ref.hVertexZ),
245  hNPileupVertices(ref.hNPileupVertices),
246  hPileupVertexToPrimZ(ref.hPileupVertexToPrimZ),
247  hPileupVertexToPrimZSPDPileup(ref.hPileupVertexToPrimZSPDPileup),
248  hPileupVertexToPrimZTrackletvsHits(ref.hPileupVertexToPrimZTrackletvsHits),
249  hEventPlaneAngle(ref.hEventPlaneAngle),
250  fEventPlaneAngle(ref.fEventPlaneAngle),
251  hTriggerClass(NULL),
252  hTriggerClassSelected(NULL),
253  hTriggerClassesCorrelated(NULL),
254  hReweightMCHistPi0(ref.hReweightMCHistPi0),
255  hReweightMCHistEta(ref.hReweightMCHistEta),
256  hReweightMCHistK0s(ref.hReweightMCHistK0s),
257  fFitDataPi0(ref.fFitDataPi0),
258  fFitDataEta(ref.fFitDataEta),
259  fFitDataK0s(ref.fFitDataK0s),
260  fAddedSignalPDGCode(ref.fAddedSignalPDGCode),
261  fPreSelCut(ref.fPreSelCut),
262  fTriggerSelectedManually(ref.fTriggerSelectedManually),
263  fSpecialTriggerName(ref.fSpecialTriggerName),
264  fSpecialSubTriggerName(ref.fSpecialSubTriggerName),
265  fNSpecialSubTriggerOptions(ref.fNSpecialSubTriggerOptions),
266  hSPDClusterTrackletBackgroundBefore(NULL),
267  hSPDClusterTrackletBackground(NULL),
268  fV0ReaderName(ref.fV0ReaderName),
269  fCaloTriggers(NULL),
270  fTriggerPatchInfo(NULL),
271  fMainTriggerPatchEMCAL(NULL),
272  fCaloTriggersName(ref.fCaloTriggersName),
273  fCaloTriggerPatchInfoName(ref.fCaloTriggerPatchInfoName),
274  fTriggersEMCAL(ref.fTriggersEMCAL),
275  fTriggersEMCALSelected(ref.fTriggersEMCALSelected),
276  fEMCALTrigInitialized(kFALSE),
277  fSecProdBoundary(ref.fSecProdBoundary),
278  fMaxPtJetMC(ref.fMaxPtJetMC),
279  fMaxFacPtHard(ref.fMaxFacPtHard),
280  fMaxFacPtHardSingleParticle(ref.fMaxFacPtHardSingleParticle),
281  fMimicTrigger(ref.fMimicTrigger),
282  fRejectTriggerOverlap(ref.fRejectTriggerOverlap),
283  fDoMultiplicityWeighting(ref.fDoMultiplicityWeighting),
284  fPathReweightingMult(ref.fPathReweightingMult),
285  fNameHistoReweightingMultData(ref.fNameHistoReweightingMultData),
286  fNameHistoReweightingMultMC(ref.fNameHistoReweightingMultMC),
287  hReweightMultData(ref.hReweightMultData),
288  hReweightMultMC(ref.hReweightMultMC),
290 {
291  // Copy Constructor
292  for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
293  fCutString=new TObjString((GetCutNumber()).Data());
294  fUtils = new AliAnalysisUtils();
295  // dont copy histograms (if you like histograms, call InitCutHistograms())
296 
297 }
298 
299 
300 //________________________________________________________________________
302  // Destructor
303  //Deleting fHistograms leads to seg fault it it's added to output collection of a task
304  // if(fHistograms)
305  // delete fHistograms;
306  // fHistograms = NULL;
307  if(fCutString != NULL){
308  delete fCutString;
309  fCutString = NULL;
310  }
311  if(fNotRejectedStart){
312  delete[] fNotRejectedStart;
313  fNotRejectedStart = NULL;
314  }
315  if(fNotRejectedEnd){
316  delete[] fNotRejectedEnd;
317  fNotRejectedEnd = NULL;
318  }
319  if(fGeneratorNames){
320  delete[] fGeneratorNames;
321  fGeneratorNames = NULL;
322  }
323  if(fUtils){
324  delete fUtils;
325  fUtils = NULL;
326  }
327 
328 }
329 
330 //________________________________________________________________________
332 
333  // Initialize Cut Histograms for QA (only initialized and filled if function is called)
334  TH1::AddDirectory(kFALSE);
335 
336  if(fHistograms != NULL){
337  delete fHistograms;
338  fHistograms=NULL;
339  }
340  if(fHistograms==NULL){
341  fHistograms=new TList();
342  fHistograms->SetOwner(kTRUE);
343  if(name=="")fHistograms->SetName(Form("ConvEventCuts_%s",GetCutNumber().Data()));
344  else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
345  }
346 
347  if (hReweightMCHistPi0){
348  hReweightMCHistPi0->SetName("MCInputForWeightingPi0");
350  }
351  if (hReweightMCHistEta){
352  hReweightMCHistEta->SetName("MCInputForWeightingEta");
354  }
355  if (hReweightMCHistK0s){
356  hReweightMCHistK0s->SetName("MCInputForWeightingK0s");
358  }
359 
360  if (hReweightMultData){
361  hReweightMultData->SetName(Form("hReweightMultData_%s",GetCutNumber().Data()));
363  }
364  if (hReweightMultMC){
365  hReweightMultMC->SetName(Form("hReweightMultMC_%s",GetCutNumber().Data()));
367  }
368 
369  if(!fDoLightOutput){
370  hSPDClusterTrackletBackgroundBefore = new TH2F(Form("SPD tracklets vs SPD clusters %s before Pileup Cut",GetCutNumber().Data()),"SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
372 
373  hSPDClusterTrackletBackground = new TH2F(Form("SPD tracklets vs SPD clusters %s",GetCutNumber().Data()),"SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
375  }
376 
377  if(fIsHeavyIon > 0){
378  hCentrality=new TH1F(Form("Centrality %s",GetCutNumber().Data()),"Centrality",400,0,100);
379  fHistograms->Add(hCentrality);
380  }
381 
382  //hCentralityVsNumberOfPrimaryTracks=new TH2F(Form("Centrality vs Primary Tracks %s",GetCutNumber().Data()),"Centrality vs Primary Tracks ",400,0,100,4000,0,4000);
383  //fHistograms->Add(hCentralityVsNumberOfPrimaryTracks); commented on 3.3.2015 because it's in the main Task
384 
385  hVertexZ = new TH1F(Form("VertexZ %s",GetCutNumber().Data()),"VertexZ",1000,-50,50);
386  fHistograms->Add(hVertexZ);
387 
388  hNPileupVertices = new TH1F(Form("NPileupVertices %s",GetCutNumber().Data()),"NPileupVertices",30,-0.5,29.5);
390 
391  hPileupVertexToPrimZ = new TH1F(Form("PileupVertexDistance %s",GetCutNumber().Data()),"PileupVertexDistance",600,-15,15);
393  hPileupVertexToPrimZSPDPileup = new TH1F(Form("PileupVertexDistance_SPDPileup %s",GetCutNumber().Data()),"PileupVertexDistance_SPDPileup",600,-15,15);
395  hPileupVertexToPrimZTrackletvsHits = new TH1F(Form("PileupVertexDistance_TrackletvsHits %s",GetCutNumber().Data()),"PileupVertexDistance_TrackletvsHits",600,-15,15);
397 
398  if(fIsHeavyIon == 1){
399  hEventPlaneAngle = new TH1F(Form("EventPlaneAngle %s",GetCutNumber().Data()),"EventPlaneAngle",60, 0, TMath::Pi());
401  }
402  fHistoPastFutureBits=new TH1F(Form("PastFutureBits %s",GetCutNumber().Data()),"Past Future Bits",180,-90*25,90*25);
404 
405  // Event Cuts and Info
406  if(preCut){
407  fHistoEventCuts=new TH1F(Form("ESD_EventCuts %s",GetCutNumber().Data()),"Event Cuts",8,-0.5,7.5);
408  fHistoEventCuts->GetXaxis()->SetBinLabel(1,"in");
409  fHistoEventCuts->GetXaxis()->SetBinLabel(2,"OfflineTrigger");
410  fHistoEventCuts->GetXaxis()->SetBinLabel(3,"nvtxcontr");
411  fHistoEventCuts->GetXaxis()->SetBinLabel(4,"VertexZ");
412  fHistoEventCuts->GetXaxis()->SetBinLabel(5,"pileup");
413  fHistoEventCuts->GetXaxis()->SetBinLabel(6,"centrsel");
414  fHistoEventCuts->GetXaxis()->SetBinLabel(7,"OOB-pileup");
415  fHistoEventCuts->GetXaxis()->SetBinLabel(8,"out");
417 
418  hTriggerClass= new TH1F(Form("OfflineTrigger %s",GetCutNumber().Data()),"OfflineTrigger",36,-0.5,35.5);
419  hTriggerClass->GetXaxis()->SetBinLabel( 1,"kMB");
420  hTriggerClass->GetXaxis()->SetBinLabel( 2,"kINT7");
421  hTriggerClass->GetXaxis()->SetBinLabel( 3,"kMUON");
422  hTriggerClass->GetXaxis()->SetBinLabel( 4,"kHighMult");
423  hTriggerClass->GetXaxis()->SetBinLabel( 5,"kEMC1");
424  hTriggerClass->GetXaxis()->SetBinLabel( 6,"kCINT5");
425  hTriggerClass->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
426  hTriggerClass->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
427  hTriggerClass->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
428  hTriggerClass->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
429  hTriggerClass->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
430  hTriggerClass->GetXaxis()->SetBinLabel(12,"kMUS7");
431  hTriggerClass->GetXaxis()->SetBinLabel(13,"kPHI1");
432  hTriggerClass->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
433  hTriggerClass->GetXaxis()->SetBinLabel(15,"kEMCEJE");
434  hTriggerClass->GetXaxis()->SetBinLabel(16,"kEMCEGA");
435  hTriggerClass->GetXaxis()->SetBinLabel(17,"kCentral");
436  hTriggerClass->GetXaxis()->SetBinLabel(18,"kSemiCentral");
437  hTriggerClass->GetXaxis()->SetBinLabel(19,"kDG5");
438  hTriggerClass->GetXaxis()->SetBinLabel(20,"kZED");
439  hTriggerClass->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
440  hTriggerClass->GetXaxis()->SetBinLabel(22,"kINT8");
441  hTriggerClass->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
442  hTriggerClass->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
443  hTriggerClass->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
444  hTriggerClass->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
445  hTriggerClass->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
446  hTriggerClass->GetXaxis()->SetBinLabel(28,"kUserDefined");
447  hTriggerClass->GetXaxis()->SetBinLabel(29,"kTRD");
448  hTriggerClass->GetXaxis()->SetBinLabel(30,"kFastOnly");
449  hTriggerClass->GetXaxis()->SetBinLabel(31,"kAnyINT");
450  hTriggerClass->GetXaxis()->SetBinLabel(32,"kAny");
451  hTriggerClass->GetXaxis()->SetBinLabel(33,"V0AND");
452  hTriggerClass->GetXaxis()->SetBinLabel(34,"NOT kFastOnly");
453  hTriggerClass->GetXaxis()->SetBinLabel(35,"failed Physics Selection");
454  hTriggerClass->GetXaxis()->SetBinLabel(36,"mimickedTrigger");
456  }
457  if(!preCut){
458  hTriggerClassSelected= new TH1F(Form("OfflineTriggerSelected %s",GetCutNumber().Data()),"OfflineTriggerSelected",35,-0.5,34.5);
459  hTriggerClassSelected->GetXaxis()->SetBinLabel( 1,"kMB");
460  hTriggerClassSelected->GetXaxis()->SetBinLabel( 2,"kINT7");
461  hTriggerClassSelected->GetXaxis()->SetBinLabel( 3,"kMUON");
462  hTriggerClassSelected->GetXaxis()->SetBinLabel( 4,"kHighMult");
463  hTriggerClassSelected->GetXaxis()->SetBinLabel( 5,"kEMC1");
464  hTriggerClassSelected->GetXaxis()->SetBinLabel( 6,"kCINT5");
465  hTriggerClassSelected->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
466  hTriggerClassSelected->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
467  hTriggerClassSelected->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
468  hTriggerClassSelected->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
469  hTriggerClassSelected->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
470  hTriggerClassSelected->GetXaxis()->SetBinLabel(12,"kMUS7");
471  hTriggerClassSelected->GetXaxis()->SetBinLabel(13,"kPHI1");
472  hTriggerClassSelected->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
473  hTriggerClassSelected->GetXaxis()->SetBinLabel(15,"kEMCEJE");
474  hTriggerClassSelected->GetXaxis()->SetBinLabel(16,"kEMCEGA");
475  hTriggerClassSelected->GetXaxis()->SetBinLabel(17,"kCentral");
476  hTriggerClassSelected->GetXaxis()->SetBinLabel(18,"kSemiCentral");
477  hTriggerClassSelected->GetXaxis()->SetBinLabel(19,"kDG5");
478  hTriggerClassSelected->GetXaxis()->SetBinLabel(20,"kZED");
479  hTriggerClassSelected->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
480  hTriggerClassSelected->GetXaxis()->SetBinLabel(22,"kINT8");
481  hTriggerClassSelected->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
482  hTriggerClassSelected->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
483  hTriggerClassSelected->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
484  hTriggerClassSelected->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
485  hTriggerClassSelected->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
486  hTriggerClassSelected->GetXaxis()->SetBinLabel(28,"kUserDefined");
487  hTriggerClassSelected->GetXaxis()->SetBinLabel(29,"kTRD");
488  hTriggerClassSelected->GetXaxis()->SetBinLabel(30,"kFastOnly");
489  hTriggerClassSelected->GetXaxis()->SetBinLabel(31,"kAnyINT");
490  hTriggerClassSelected->GetXaxis()->SetBinLabel(32,"kAny");
491  hTriggerClassSelected->GetXaxis()->SetBinLabel(33,"V0AND");
492  hTriggerClassSelected->GetXaxis()->SetBinLabel(34,"NOT kFastOnly");
493  hTriggerClassSelected->GetXaxis()->SetBinLabel(35,"mimickedTrigger");
495 
496  if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9){
497  hTriggerClassesCorrelated= new TH1F(Form("TriggerCorrelations %s",GetCutNumber().Data()),"Triggers Correlated with EMCal triggers",10,-0.5,9.5);
498  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 1,"kMB");
499  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 2,"kINT7");
500  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 3,"kEMC1");
501  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 4,"kEMC7");
502  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 5,"kEMCEJE");
503  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 6,"kEMCEJ1");
504  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 7,"kEMCEJ2");
505  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 8,"kEMCEGA");
506  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 9,"kEMCEG1");
507  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 10,"kEMCEG2");
509  }
510 
511  }
512  TH1::AddDirectory(kTRUE);
513 }
514 
516 Bool_t AliConvEventCuts::EventIsSelected(AliVEvent *event, AliMCEvent *mcEvent){
517  // Process Event Selection
518 
519  Int_t cutindex=0;
520  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
521  cutindex++;
522 
523  // Check for MC event
524  Bool_t isMC = kFALSE;
525  if(mcEvent && event->IsA()==AliESDEvent::Class()){
526  // Check if MC event is correctly loaded
527  AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
528  if (!mcHandler){
529  fEventQuality = 2;
530  return kFALSE;
531  }
532  if (!mcHandler->InitOk() ){
533  fEventQuality = 2;
534  return kFALSE;
535  }
536  if (!mcHandler->TreeK() ){
537  fEventQuality = 2;
538  return kFALSE;
539  }
540  if (!mcHandler->TreeTR() ) {
541  fEventQuality = 2;
542  return kFALSE;
543  }
544  isMC = kTRUE;
545  }
546 
547 
548 
549  // Event Trigger
550  // cout << "before event trigger" << endl;
551  if(!IsTriggerSelected(event, isMC )){
552  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
553  fEventQuality = 3;
554  return kFALSE;
555  }
556  cutindex++;
557 
558  if(event->IsA()==AliESDEvent::Class()){
559  AliTriggerAnalysis fTriggerAnalysis;// = new AliTriggerAnalysis;
560  fHasV0AND = fTriggerAnalysis.IsOfflineTriggerFired((AliESDEvent*)event, AliTriggerAnalysis::kV0AND);
561  if(fHasV0AND&&hTriggerClass)hTriggerClass->Fill(32);
562  }
563  // cout << "event number " << ((AliESDEvent*)event)->GetEventNumberInFile() << " entered"<< endl;
564 
565 
566  // Number of Contributors Cut
567  if (fEnableVertexCut){
568  if(GetNumberOfContributorsVtx(event)<=0) {
569  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
570  fEventQuality = 5;
571  return kFALSE;
572  }
573  }
574  cutindex++;
575 
576  // Z Vertex Position Cut
577  if (fEnableVertexCut){
578  if(!VertexZCut(event)){
579  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
580  fEventQuality = 4;
581  return kFALSE;
582  }
583  }
584  cutindex++;
585 
586  // SPD clusters vs tracklets to check for pileup/background
587  Int_t nClustersLayer0 = event->GetNumberOfITSClusters(0);
588  Int_t nClustersLayer1 = event->GetNumberOfITSClusters(1);
589  Int_t nTracklets = event->GetMultiplicity()->GetNumberOfTracklets();
590  if(hSPDClusterTrackletBackgroundBefore) hSPDClusterTrackletBackgroundBefore->Fill(nTracklets, (nClustersLayer0 + nClustersLayer1));
591 
592 
593  Double_t distZMax = 0;
594  if(event->IsA()==AliESDEvent::Class()){
595  Int_t nPileVert = ((AliESDEvent*)event)->GetNumberOfPileupVerticesSPD();
596  if (hNPileupVertices) hNPileupVertices->Fill(nPileVert);
597  if (nPileVert > 0){
598  for(Int_t i=0; i<nPileVert;i++){
599  const AliESDVertex* pv = ((AliESDEvent*)event)->GetPileupVertexSPD(i);
600  Int_t nc2 = pv->GetNContributors();
601  if(nc2>=3){
602  Double_t z1 = ((AliESDEvent*)event)->GetPrimaryVertexSPD()->GetZ();
603  Double_t z2 = pv->GetZ();
604  Double_t distZ = z2-z1;
605  if (TMath::Abs(distZMax) < TMath::Abs(distZ) ){
606  distZMax = distZ;
607  }
608  }
609  }
610  if (hPileupVertexToPrimZ) hPileupVertexToPrimZ->Fill(distZMax);
611  }
612  }
613 
614  // Pile Up Rejection
615  if (fIsHeavyIon == 2){
616  if(GetUseNewMultiplicityFramework()){// for Run2 pPb
617  if(fUtils->IsPileUpMV(event)){
618  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
619  fEventQuality = 6;
620  return kFALSE;
621  }
622  } else{
623  if(fUtils->IsFirstEventInChunk(event)){
624  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
625  fEventQuality = 6;
626  return kFALSE;
627  }
628  if(fRemovePileUp){
629  if(fUtils->IsPileUpEvent(event)){
630  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
632  fEventQuality = 6;
633  return kFALSE;
634  }
635  if (fUtils->IsSPDClusterVsTrackletBG(event)){
636  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
638  fEventQuality = 11;
639  return kFALSE;
640  }
641  }
642  }
643  } else if(fRemovePileUp){
644  if(event->IsPileupFromSPD(3,0.8,3.,2.,5.) ){
645  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
647  fEventQuality = 6;
648  return kFALSE;
649  }
650  if (fUtils->IsSPDClusterVsTrackletBG(event)){
651  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
653  fEventQuality = 11;
654  return kFALSE;
655  }
656  }
657  cutindex++;
658 
659  // Centrality Selection
660  if(!IsCentralitySelected(event,mcEvent)){
661  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
662  fEventQuality = 1;
663  return kFALSE;
664  }
665  cutindex++;
666 
668  if(fHistoEventCuts) fHistoEventCuts->Fill(cutindex);
669  fEventQuality = 12;
670  return kFALSE;
671  }
672  cutindex++;
673  // Fill Event Histograms
674  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
675  if(hCentrality)hCentrality->Fill(GetCentrality(event));
676  if(hVertexZ)hVertexZ->Fill(event->GetPrimaryVertex()->GetZ());
677  // if(hCentralityVsNumberOfPrimaryTracks)
678  // hCentralityVsNumberOfPrimaryTracks->Fill(GetCentrality(event),
679  // ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()
680  // ->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks());
681 
682  if(fIsHeavyIon == 1){
683  AliEventplane *EventPlane = event->GetEventplane();
684  fEventPlaneAngle = EventPlane->GetEventplane("V0",event,2);
685  if(hEventPlaneAngle)hEventPlaneAngle->Fill(TMath::Abs(fEventPlaneAngle));
686  }
687  if(hSPDClusterTrackletBackground) hSPDClusterTrackletBackground->Fill(nTracklets, (nClustersLayer0 + nClustersLayer1));
688 
689  fEventQuality = 0;
690  return kTRUE;
691 }
692 
696 
697  if(fCutString && fCutString->GetString().Length() == kNCuts) {
698  fCutString->SetString(GetCutNumber());
699  } else {
700  return kFALSE;
701  }
702  return kTRUE;
703 }
704 
707 
708  AliInfo("Entering loading of weights for centrality flattening");
709  TFile *w = TFile::Open(fPathWeightsFlatCent.Data());
710  if(!w){
711  AliError(Form("file for centrality flattening %s not found",fPathWeightsFlatCent.Data()));
712  return;
713  }
714 
715  if (fNameHistoNotFlatCentrality.CompareTo("") != 0 && (fDoCentralityFlat > 0)){
716  cout << "I have to find: " << fNameHistoNotFlatCentrality.Data() << endl;
717  TH1D *hCentralityNotFlattemp = (TH1D*)w->Get(fNameHistoNotFlatCentrality.Data());
718  hCentralityNotFlat = new TH1D(*hCentralityNotFlattemp);
719  if (hCentralityNotFlat) AliInfo(Form("%s has been loaded from %s", fNameHistoNotFlatCentrality.Data(),fPathWeightsFlatCent.Data() ));
720  else AliWarning(Form("%s not found in %s", fNameHistoNotFlatCentrality.Data() ,fPathWeightsFlatCent.Data()));
721  hCentralityNotFlat->SetDirectory(0);
722  }
723 
724  w->Close();
725  delete w;
726 }
727 
730 
731  AliInfo("Entering loading of weights for multiplicity weighting");
732  TFile *w = TFile::Open(fPathReweightingMult.Data());
733  if(!w){
734  AliError(Form("file for multiplicity reweighting %s not found",fPathReweightingMult.Data()));
735  return;
736  }
737 
738  if (fNameHistoReweightingMultData.CompareTo("") != 0 && (fDoMultiplicityWeighting > 0)){
739  cout << "I have to find: " << fNameHistoReweightingMultData.Data() << endl;
740  TH1D *hReweightMultDatatemp = (TH1D*)w->Get(fNameHistoReweightingMultData.Data());
741  if (hReweightMultDatatemp == NULL) AliError(Form("%s was not contained in %s", fNameHistoReweightingMultData.Data(),fPathReweightingMult.Data() ));
742  hReweightMultData = new TH1D(*hReweightMultDatatemp);
743  if (hReweightMultData) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingMultData.Data(),fPathReweightingMult.Data() ));
744  else AliWarning(Form("%s not found in %s", fNameHistoReweightingMultData.Data() ,fPathReweightingMult.Data()));
745  hReweightMultData->SetDirectory(0);
746  }
747  if (fNameHistoReweightingMultMC.CompareTo("") != 0 && (fDoMultiplicityWeighting > 0)){
748  cout << "I have to find: " << fNameHistoReweightingMultMC.Data() << endl;
749  TH1D *hReweightMultMCtemp = (TH1D*)w->Get(fNameHistoReweightingMultMC.Data());
750  if (hReweightMultMCtemp == NULL) AliError(Form("%s was not contained in %s", fNameHistoReweightingMultMC.Data(),fPathReweightingMult.Data() ));
751  hReweightMultMC = new TH1D(*hReweightMultMCtemp);
752  if (hReweightMultData) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingMultMC.Data(),fPathReweightingMult.Data() ));
753  else AliWarning(Form("%s not found in %s", fNameHistoReweightingMultMC.Data() ,fPathReweightingMult.Data()));
754  hReweightMultMC->SetDirectory(0);
755  }
756 
757  w->Close();
758  delete w;
759 }
760 
761 
764 
765  AliInfo("Entering loading of histograms for weighting");
766  TFile *f = TFile::Open(fPathTrFReweighting.Data());
767  if(!f){
768  AliError(Form("file for weighting %s not found",fPathTrFReweighting.Data()));
769  return;
770  }
771  if (fNameHistoReweightingPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){
772  cout << "I have to find: " << fNameHistoReweightingPi0.Data() << endl;
773  TH1D *hReweightMCHistPi0temp = (TH1D*)f->Get(fNameHistoReweightingPi0.Data());
774  hReweightMCHistPi0 = new TH1D(*hReweightMCHistPi0temp);
775  if (hReweightMCHistPi0) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingPi0.Data(),fPathTrFReweighting.Data() ));
776  else AliWarning(Form("%s not found in %s", fNameHistoReweightingPi0.Data() ,fPathTrFReweighting.Data()));
777  hReweightMCHistPi0->SetDirectory(0);
778  }
779  if (fNameFitDataPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){
780  cout << "I have to find: " << fNameFitDataPi0.Data() << endl;
781  TF1 *fFitDataPi0temp = (TF1*)f->Get(fNameFitDataPi0.Data());
782  fFitDataPi0 = new TF1(*fFitDataPi0temp);
783  if (fFitDataPi0) AliInfo(Form("%s has been loaded from %s", fNameFitDataPi0.Data(),fPathTrFReweighting.Data() ));
784  else AliWarning(Form("%s not found in %s",fPathTrFReweighting.Data(), fNameFitDataPi0.Data() ));
785  }
786 
787  if (fNameHistoReweightingEta.CompareTo("") != 0 && fDoReweightHistoMCEta){
788  cout << "I have to find: " << fNameHistoReweightingEta.Data() << endl;
789  TH1D *hReweightMCHistEtatemp = (TH1D*)f->Get(fNameHistoReweightingEta.Data());
790  hReweightMCHistEta = new TH1D(*hReweightMCHistEtatemp);
791  if (hReweightMCHistEta) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() ));
792  else AliWarning(Form("%s not found in %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() ));
793  hReweightMCHistEta->SetDirectory(0);
794  }
795 
796  if (fNameFitDataEta.CompareTo("") != 0 && fDoReweightHistoMCEta){
797  cout << "I have to find: " << fNameFitDataEta.Data() << endl;
798  TF1 *fFitDataEtatemp = (TF1*)f->Get(fNameFitDataEta.Data());
799  fFitDataEta = new TF1(*fFitDataEtatemp);
800  if (fFitDataEta) AliInfo(Form("%s has been loaded from %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() ));
801  else AliWarning(Form("%s not found in %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() ));
802 
803  }
804  if (fNameHistoReweightingK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){
805  cout << "I have to find: " << fNameHistoReweightingK0s.Data() << endl;
806  TH1D *hReweightMCHistK0stemp = (TH1D*)f->Get(fNameHistoReweightingK0s.Data());
807  hReweightMCHistK0s = new TH1D(*hReweightMCHistK0stemp);
808  if (hReweightMCHistK0s) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() ));
809  else AliWarning(Form("%s not found in %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() ));
810  hReweightMCHistK0s->SetDirectory(0);
811  }
812 
813  if (fNameFitDataK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){
814  cout << "I have to find: " << fNameFitDataK0s.Data() << endl;
815  TF1 *fFitDataK0stemp = (TF1*)f->Get(fNameFitDataK0s.Data());
816  fFitDataK0s = new TF1(*fFitDataK0stemp);
817  if (fFitDataK0s) AliInfo(Form("%s has been loaded from %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() ));
818  else AliWarning(Form("%s not found in %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() ));
819  }
820  f->Close();
821  delete f;
822 }
823 
824 
827  fCutStringRead = Form("%s",analysisCutSelection.Data());
828 
829  // Initialize Cuts from a given Cut string
830  if(fDoCentralityFlat > 0){
831  AliInfo("Centrality flattening was enabled");
833  }
834 
836  AliInfo("Multiplicity weighting was enabled");
838  }
840  AliInfo("Particle Weighting was enabled");
842  }
843 
844 
845  AliInfo(Form("Set Event Cut Number: %s",analysisCutSelection.Data()));
846  if(analysisCutSelection.Length()!=kNCuts) {
847  AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
848  return kFALSE;
849  }
850  if(!analysisCutSelection.IsAlnum()){
851  AliError("Cut selection is not alphanumeric");
852  return kFALSE;
853  }
854 
855  if (fV0ReaderName.CompareTo("") == 0){
856  fV0ReaderName = "V0ReaderV1";
857  }
858  TString analysisCutSelectionLowerCase = Form("%s",analysisCutSelection.Data());
859  analysisCutSelectionLowerCase.ToLower();
860  const char *cutSelection = analysisCutSelectionLowerCase.Data();
861  #define ASSIGNARRAY(i) fCuts[i] = ((int)cutSelection[i]>=(int)'a') ? cutSelection[i]-'a'+10 : cutSelection[i]-'0'
862  for(Int_t ii=0;ii<kNCuts;ii++){
863  ASSIGNARRAY(ii);
864  }
865 
866  // Set Individual Cuts
867  for(Int_t ii=0;ii<kNCuts;ii++){
868  if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
869  }
870 
872 
873  return kTRUE;
874 }
875 
879 // "HeavyIon", //0
880 // "CentralityMin", //1
881 // "CentralityMax", //2
882 // "SelectSpecialTrigger", //3
883 // "SelectSpecialSubTriggerClass", //4
884 // "RemovePileUp", //5
885 // "RejectExtraSignals", //6
886 // "VertexCut", //7
887 
888  switch (cutID) {
889  case kisHeavyIon:
890  if( SetIsHeavyIon(value)) {
891  fCuts[kisHeavyIon] = value;
892  UpdateCutString();
893  return kTRUE;
894  } else return kFALSE;
895  case kCentralityMin:
896  if( SetCentralityMin(value)) {
897  fCuts[kCentralityMin] = value;
898  UpdateCutString();
899  return kTRUE;
900  } else return kFALSE;
901  case kCentralityMax:
902  if( SetCentralityMax(value)) {
903  fCuts[kCentralityMax] = value;
904  UpdateCutString();
905  return kTRUE;
906  } else return kFALSE;
908  if( SetSelectSpecialTrigger(value)) {
910  UpdateCutString();
911  return kTRUE;
912  } else return kFALSE;
914  if( SetSelectSubTriggerClass(value)) {
915  fCuts[kSelectSubTriggerClass] = value;
916  UpdateCutString();
917  return kTRUE;
918  } else return kFALSE;
919  case kremovePileUp:
920  if( SetRemovePileUp(value)) {
921  fCuts[kremovePileUp] = value;
922  UpdateCutString();
923  return kTRUE;
924  } else return kFALSE;
925  case kExtraSignals:
926  if( SetRejectExtraSignalsCut(value)) {
927  fCuts[kExtraSignals] = value;
928  UpdateCutString();
929  return kTRUE;
930  } else return kFALSE;
931  case kVertex:
932  if( SetVertexCut(value)) {
933  fCuts[kVertex] = value;
934  UpdateCutString();
935  return kTRUE;
936  } else return kFALSE;
937 
938  case kNCuts:
939  AliError("Cut id out of range");
940  return kFALSE;
941  }
942 
943  AliError("Cut id %d not recognized");
944  return kFALSE;
945 }
946 
949  // Print out current Cut Selection
950  for(Int_t ic = 0; ic < kNCuts; ic++) {
951  printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
952  }
953 }
954 
956  // Print out current Cut Selection with value
957  printf("\nEvent cutnumber \n");
958  for(Int_t ic = 0; ic < kNCuts; ic++) {
959  printf("%d",fCuts[ic]);
960  }
961  printf("\n\n");
962  if (fIsHeavyIon == 0) {
963  printf("Running in pp mode \n");
964  if (fSpecialTrigger == 0){
965  if (fSpecialSubTrigger == 0){
966  printf("\t only events triggered by V0OR will be analysed \n");
967  } else if (fSpecialSubTrigger == 1){
968  printf("\t only events where SDD was present will be analysed \n");
969  }
970  } else if (fSpecialTrigger == 1){
971  if (fSpecialSubTrigger == 0){
972  printf("\t only events triggered by V0AND will be analysed \n");
973  } else if(fSpecialSubTrigger == 1){
974  printf("\t only events where SDD was present will be analysed and triggered by VOAND\n");
975  }
976  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps");
977  } else if (fSpecialTrigger > 1){
978  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
979  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
980  }
981  if ( !(fCentralityMin == 0 && fCentralityMax == 0) && !(fCentralityMax < fCentralityMin) ){
982  printf("\t Multiplicity cut %d - %d \n", fCentralityMin, fCentralityMax);
983  }
984  } else if (fIsHeavyIon == 1){
985  printf("Running in PbPb mode \n");
986  if (fDetectorCentrality == 0){
987  printf("\t centrality selection based on V0M \n");
988  } else if (fDetectorCentrality == 1){
989  printf("\t centrality selection based on Cl1 \n");
990  }
991  if (fModCentralityClass == 0){
992  printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10);
993  } else if ( fModCentralityClass == 1){
994  printf("\t %d - %d \n", fCentralityMin*5, fCentralityMax*5);
995  } else if ( fModCentralityClass == 2){
996  printf("\t %d - %d \n", fCentralityMin*5+45, fCentralityMax*5+45);
997  } else if (fModCentralityClass == 3){
998  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*10, fCentralityMax*10);
999  } else if ( fModCentralityClass == 4){
1000  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*5, fCentralityMax*5);
1001  } else if ( fModCentralityClass == 5){
1002  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*5+45, fCentralityMax*5+45);
1003  }
1004  if (fSpecialTrigger == 0){
1005  printf("\t only events triggered by kMB, kCentral, kSemiCentral will be analysed \n");
1006  } else if (fSpecialTrigger > 1){
1007  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
1008  printf("\n\t SpecialTrigger is: %s\n", fSpecialTriggerName.Data());
1009  printf("\t SpecialSubTrigger is: %s\n", fSpecialSubTriggerName.Data());
1010  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
1011  }
1012  } else if (fIsHeavyIon == 2){
1013  printf("Running in pPb mode \n");
1014  if (fDetectorCentrality == 0){
1015  printf("\t centrality selection based on V0A \n");
1016  } else if (fDetectorCentrality == 1){
1017  printf("\t centrality selection based on Cl1 \n");
1018  }
1019  if (fModCentralityClass == 0){
1020  printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10);
1021  }
1022  if (fSpecialTrigger == 0){
1023  printf("\t only events triggered by kINT7 will be analysed \n");
1024  } else if (fSpecialTrigger > 1){
1025  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
1026  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
1027  }
1028  }
1029  if (fEnableVertexCut) printf("\t Vertex cut with |Z_{vtx}| <%2.2f \n",fMaxVertexZ);
1030  else printf("\t No vertex cut \n");
1031 
1032  if (fRemovePileUp ==1 ) {
1033  printf("\t Doing pile up removal \n");
1034  if (fDoPileUpRejectV0MTPCout ==1 ){
1035  printf("\t Doing extra pile up removal V0M vs TPCout \n");
1036  }
1037  }
1038 
1039  printf("MC event cuts: \n");
1040  if (fRejectExtraSignals == 0) printf("\t no rejection was applied \n");
1041  else if (fRejectExtraSignals == 1) printf("\t only MB header will be inspected \n");
1042  else if (fRejectExtraSignals > 1) printf("\t special header have been selected \n");
1043  printf("\t maximum factor between jet and pt hard = %2.2f \n", fMaxFacPtHard);
1044 }
1045 
1048 { // Set Cut
1049  switch(isHeavyIon){
1050  case 0:
1051  fIsHeavyIon=0;
1052  break;
1053  case 1:
1054  fIsHeavyIon=1;
1056  break;
1057  case 2:
1058  fIsHeavyIon=1;
1060  break;
1061  case 3: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
1062  fIsHeavyIon=1;
1065  break;
1066  case 4: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1067  fIsHeavyIon=1;
1070  break;
1071  case 5: //strict cut on v0 tracks for MC
1072  fIsHeavyIon=1;
1075  break;
1076  case 6: //allows to select centrality 0-45% in steps of 5% for track mult
1077  //strict cut on v0 tracks for MC
1078  fIsHeavyIon=1;
1081  break;
1082  case 7: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1083  //strict cut on v0 tracks for MC
1084  fIsHeavyIon=1;
1087  break;
1088  case 8:
1089  fIsHeavyIon=2;
1091  break;
1092  case 9:
1093  fIsHeavyIon=2;
1095  break;
1096  default:
1097  AliError(Form("SetHeavyIon not defined %d",isHeavyIon));
1098  return kFALSE;
1099  }
1100  return kTRUE;
1101 }
1102 
1103 //___________________________________________________________________
1105 {
1106  // Set Cut
1107  if(minCentrality<0||minCentrality>9){
1108  AliError(Form("minCentrality not defined %d",minCentrality));
1109  return kFALSE;
1110  }
1111 
1112  fCentralityMin=minCentrality;
1113  return kTRUE;
1114 }
1115 
1116 //___________________________________________________________________
1118 {
1119  // Set Cut
1120  if(maxCentrality<0||maxCentrality>9){
1121  AliError(Form("maxCentrality not defined %d",maxCentrality));
1122  return kFALSE;
1123  }
1124  fCentralityMax=maxCentrality;
1125  return kTRUE;
1126 }
1127 
1130 {
1131  // Set Cut
1132  switch(selectSpecialTrigger){
1133  case 0:
1134  fSpecialTrigger=0; // V0OR
1135  break;
1136  case 1:
1137  fSpecialTrigger=1; // V0AND
1138  break;
1139 // case 2:
1140 // fSpecialTrigger=2; //
1141 // break;
1142  case 3:
1143  fSpecialTrigger=3; //specific centrality trigger selection
1144  fSpecialTriggerName="AliVEvent::kCentral/kSemiCentral/kMB";
1145  break;
1146  case 4:
1147  fSpecialTrigger=4; // trigger alias kTRD
1148  fOfflineTriggerMask=AliVEvent::kTRD;
1149  fTriggerSelectedManually = kTRUE;
1150  fSpecialTriggerName="AliVEvent::kTRD";
1151  break;
1152  case 5:
1153  fSpecialTrigger=5; // trigger alias kEMC
1154  fOfflineTriggerMask=AliVEvent::kEMC7 | AliVEvent::kEMC8 | AliVEvent::kEMC1 ;
1155  fTriggerSelectedManually = kTRUE;
1157  SETBIT(fTriggersEMCALSelected, kL0);
1158  fSpecialTriggerName="AliVEvent::kEMC7/kEMC8/kEMC1";
1159  break;
1160  case 6:
1161  fSpecialTrigger=6; // trigger alias kPHI
1162  fOfflineTriggerMask=AliVEvent::kPHI7 | AliVEvent::kPHI1 | AliVEvent::kPHI8 | AliVEvent::kPHOSPb;
1163  fTriggerSelectedManually = kTRUE;
1164  fSpecialTriggerName="AliVEvent::kPHI7/kPHI1/kPHI8/kPHOSPb";
1165  break;
1166  case 7:
1167  fSpecialTrigger=7; // trigger alias kHighMult
1168  fOfflineTriggerMask=AliVEvent::kHighMult;
1169  fTriggerSelectedManually = kTRUE;
1170  fSpecialTriggerName="AliVEvent::kHighMult";
1171  break;
1172  case 8:
1173  fSpecialTrigger=8; // trigger alias kEMCEGA
1174  fOfflineTriggerMask=AliVEvent::kEMCEGA;
1175  fTriggerSelectedManually = kTRUE;
1177  SETBIT(fTriggersEMCALSelected, kG2);
1178  fSpecialTriggerName="AliVEvent::kEMCEGA";
1179  break;
1180  case 9:
1181  fSpecialTrigger=9; // trigger alias kEMCEJE
1182  fOfflineTriggerMask=AliVEvent::kEMCEJE;
1183  fTriggerSelectedManually = kTRUE;
1185  SETBIT(fTriggersEMCALSelected, kJ2);
1186  fSpecialTriggerName="AliVEvent::kEMCEJE";
1187  break;
1188  default:
1189  AliError("Warning: Special Trigger Not known");
1190  return 0;
1191  }
1192  return 1;
1193 }
1194 
1197 {
1198  // Set Cut
1199  if (fSpecialTrigger == 0){ //OR
1200  switch(selectSpecialSubTriggerClass){
1201  case 0://with VZERO
1202  fSpecialTrigger=0;
1204 // AliInfo("Info: Nothing to be done");
1205  break;
1206  case 3: //V0OR with SDD requested (will only work with LHC11a dataset)
1208 // cout << "V0OR with SDD requested" << endl;
1209  break;
1210  default:
1211  AliError("Warning: Special Subtrigger Class Not known");
1212  return 0;
1213  }
1214  } else if (fSpecialTrigger == 1){ //AND with different detectors
1215  switch(selectSpecialSubTriggerClass){
1216  case 0: //with VZERO general implementation of V0AND (periods LHC11c onwards)
1217  fSpecialTrigger=0;
1219  fOfflineTriggerMask=AliVEvent::kINT7;
1220  fTriggerSelectedManually = kTRUE;
1221  fSpecialTriggerName="AliVEvent::kINT7";
1222  break;
1223  case 1: //with TZERO
1224  fSpecialTrigger=0;
1226  fOfflineTriggerMask=AliVEvent::kINT8;
1227  fTriggerSelectedManually = kTRUE;
1228  fSpecialTriggerName="AliVEvent::kINT8";
1229  break;
1230  case 2: //with VZERO (will only work with LHC11a dataset)
1231  fSpecialTrigger=1;
1233 // AliInfo("Info: Nothing to be done");
1234  break;
1235  case 3: //V0AND with SDD requested (will only work with LHC11a dataset)
1236  fSpecialTrigger=1;
1238  break;
1239  default:
1240  AliError("Warning: Special Subtrigger Class Not known");
1241  return 0;
1242  }
1243  } else if (fSpecialTrigger == 3){ // Selecting kCentral and kSemiCentral from trigger classes, not aliases
1244  switch(selectSpecialSubTriggerClass){
1245  case 0: // all together
1248 // AliInfo("Info: Nothing to be done");
1249  break;
1250  case 1: // kCentral - no vertex restriction
1253  fSpecialSubTriggerName="CVHN";
1254 // cout << "kCentralOpen" << endl;
1255  break;
1256  case 2: // kCentral - T00 +- 10 cm
1259  fSpecialSubTriggerName="CCENT";
1260 // cout << "kCentralVertex" << endl;
1261  break;
1262  case 3: // kCentral - both
1265  fSpecialSubTriggerName="CVHN|CCENT|CSEMI|CVLN";
1266 // cout << "kCentral both" << endl;
1267  break;
1268  case 4: // kSemiCentral - no vertex restriction
1271  fSpecialSubTriggerName="CVLN";
1272 // cout << "kSemiCentralOpen" << endl;
1273  break;
1274  case 5: // kSemiCentral - T00 +- 10 cm
1277  fSpecialSubTriggerName="CSEMI";
1278 // cout << "kSemiCentralVertex" << endl;
1279  break;
1280  case 6: // kSemiCentral - both
1283  fSpecialSubTriggerName="CSEMI%CVLN";
1284 // cout << "kSemiCentral both" << endl;
1285  break;
1286  case 7: // kMB
1289  fSpecialSubTriggerName="CPBI1_|CPBI1-";
1290 // cout << "kMB 1" << endl;
1291  break;
1292  case 8: // kMB
1295  fSpecialSubTriggerName="CPBI2_|CPBI2-";
1296 // cout << "kMB 2" << endl;
1297  break;
1298  case 9: // kMB
1301  fSpecialSubTriggerName="CPBI2_@CPBI2-@CPBI2_@CPBI2-";
1302 // cout << "kMB both" << endl;
1303  break;
1304  default:
1305  AliError("Warning: Special Subtrigger Class Not known");
1306  return 0;
1307  }
1308  } else if (fSpecialTrigger == 4){ // Subdivision of TRD trigger classes
1309  switch(selectSpecialSubTriggerClass){
1310  case 0: // all together
1313 // AliInfo("Info: Nothing to be done");
1314  break;
1315  case 1: // 7WUHSH - V0AND with single electron in TRD & EMCAL
1318  fSpecialSubTriggerName="7WUHEE";
1319  break;
1320  case 2: // 8WUHSH - T0AND with single electron in TRD & EMCAL
1323  fSpecialSubTriggerName="8WUHEE";
1324  break;
1325  case 3: // 7WUHSE - V0AND with single high pt electron in TRD
1328  fSpecialSubTriggerName="7WUHSE";
1329  break;
1330  case 4: // 8WUHSE - T0AND with single high pt electron in TRD
1333  fSpecialSubTriggerName="8WUHSE";
1334  break;
1335  case 5: // 7WUHJE - V0AND with jet in TRD
1338  fSpecialSubTriggerName="7WUHJT";
1339  break;
1340  case 6: // 8WUHJE - T0AND with jet in TRD
1343  fSpecialSubTriggerName="8WUHJT";
1344  break;
1345  case 7: // 7WUHQU - V0AND with dielectron pair in TRD
1348  fSpecialSubTriggerName="7WUHQU";
1349  break;
1350  case 8: // 8WUHQU - T0AND with dielectron pair in TRD
1353  fSpecialSubTriggerName="8WUHQU";
1354  break;
1355  default:
1356  AliError("Warning: Special Subtrigger Class Not known");
1357  return 0;
1358  }
1359  } else if (fSpecialTrigger == 5){ // Subdivision of kEMC trigger classes
1360  switch(selectSpecialSubTriggerClass){
1361  case 0: // all together
1364 // AliInfo("Info: Nothing to be done");
1365  break;
1366  case 1: // CEMC1 - V0OR and EMCAL fired
1367  fOfflineTriggerMask=AliVEvent::kEMC1;
1368  fSpecialTriggerName="AliVEvent::kEMC1";
1371  fSpecialSubTriggerName="CEMC1";
1372  break;
1373  case 2: // CEMC7 - V0AND and EMCAL fired
1375  fOfflineTriggerMask=AliVEvent::kEMC7;
1376  fSpecialTriggerName="AliVEvent::kEMC7";
1378  fSpecialSubTriggerName="CEMC7";
1379  break;
1380  case 3: // CEMC8 - T0OR and EMCAL fired
1381  fOfflineTriggerMask=AliVEvent::kEMC8;
1382  fSpecialTriggerName="AliVEvent::kEMC8";
1385  fSpecialSubTriggerName="CEMC8";
1386  break;
1387  case 4: // CDMC1 - V0OR and DCAL fired
1388  fOfflineTriggerMask=AliVEvent::kEMC1;
1389  fSpecialTriggerName="AliVEvent::kEMC1";
1392  fSpecialSubTriggerName="CDMC1";
1393  break;
1394  case 5: // CDMC7 - V0AND and DCAL fired
1396  fOfflineTriggerMask=AliVEvent::kEMC7;
1397  fSpecialTriggerName="AliVEvent::kEMC7";
1399  fSpecialSubTriggerName="CDMC7";
1400  break;
1401  case 6: // CDMC8 - T0OR and DCAL fired
1402  fOfflineTriggerMask=AliVEvent::kEMC8;
1403  fSpecialTriggerName="AliVEvent::kEMC8";
1406  fSpecialSubTriggerName="CDMC8";
1407  break;
1408  default:
1409  AliError("Warning: Special Subtrigger Class Not known");
1410  return 0;
1411  }
1412  }else if (fSpecialTrigger == 6){ // Subdivision of kPHI trigger classes
1413  switch(selectSpecialSubTriggerClass){
1414  case 0: // all together
1417 // AliInfo("Info: Nothing to be done");
1418  break;
1419  case 1: // CEMC1 - V0OR and EMCAL fired
1420  fOfflineTriggerMask=AliVEvent::kPHI1;
1421  fSpecialTriggerName="AliVEvent::kPHI1";
1424  fSpecialSubTriggerName="CPHI1";
1425  break;
1426  case 2: // CEMC7 - V0AND and EMCAL fired
1428  fOfflineTriggerMask=AliVEvent::kPHI7;
1429  fSpecialTriggerName="AliVEvent::kPHI7";
1431  fSpecialSubTriggerName="CPHI7";
1432  break;
1433  case 3: // CEMC8 - T0OR and EMCAL fired
1434  fOfflineTriggerMask=AliVEvent::kPHI8;
1435  fSpecialTriggerName="AliVEvent::kPHI8";
1438  fSpecialSubTriggerName="CPHI8";
1439  break;
1440  default:
1441  AliError("Warning: Special Subtrigger Class Not known");
1442  return 0;
1443  }
1444  } else if (fSpecialTrigger == 7){ // Subdivision of kHighMult trigger classes
1445  switch(selectSpecialSubTriggerClass){
1446  case 0: // all together
1449 // AliInfo("Info: Nothing to be done");
1450  break;
1451  case 1: // CSHM1 - V0OR and high mult fired
1454  fSpecialSubTriggerName="CSHM1";
1455  break;
1456  case 2: // CSHM7 - V0AND and high mult fired
1459  fSpecialSubTriggerName="CSHM7";
1460  break;
1461  case 3: // CSHM8 - T0OR and high mult fired
1464  fSpecialSubTriggerName="CSHM8";
1465  break;
1466  case 4: // V0 high mult trigger
1468  fOfflineTriggerMask=AliVEvent::kAny;
1469  fSpecialTriggerName="V0Mult";
1471  fSpecialSubTriggerName="CVHMV0M-B-";
1472  break;
1473  case 5: // SPD high mult trigger
1475  fOfflineTriggerMask=AliVEvent::kAny;
1476  fSpecialTriggerName="SPMult";
1478  fSpecialSubTriggerName="CVHMSH2-B-";
1479  break;
1480  case 6: // V0 high mult trigger with pileup condition on
1482  fOfflineTriggerMask=AliVEvent::kAny;
1483  fSpecialTriggerName="V0Mult";
1485  fSpecialSubTriggerName="CVHMV0M-B-SPD2";
1486  break;
1487 
1488  default:
1489  AliError("Warning: Special Subtrigger Class Not known");
1490  return 0;
1491  }
1492  }else if (fSpecialTrigger == 8){ // Subdivision of kEMCEGA trigger classes
1493  switch(selectSpecialSubTriggerClass){
1494  case 0: // all together
1497 // AliInfo("Info: Nothing to be done");
1498  break;
1499  case 1: // 7EGA - CINT7 EGA
1502  fSpecialSubTriggerName="7EGA";
1504  SETBIT(fTriggersEMCALSelected, kG2);
1505  break;
1506  case 2: // 8EGA - CINT8 EGA
1509  fSpecialSubTriggerName="8EGA";
1511  SETBIT(fTriggersEMCALSelected, kG2);
1512  break;
1513  case 3: // 7EG1 - CINT7 EG1
1516  fSpecialSubTriggerName="7EG1";
1518  SETBIT(fTriggersEMCALSelected, kG1);
1519  break;
1520  case 4: // 8EG1 - CINT8 EG1
1523  fSpecialSubTriggerName="8EG1";
1525  SETBIT(fTriggersEMCALSelected, kG1);
1526  break;
1527  case 5: // 7EG2 - CINT7 EG2
1530  fSpecialSubTriggerName="7EG2";
1532  SETBIT(fTriggersEMCALSelected, kG2);
1533  break;
1534  case 6: // 8EG2 - CINT8 EG2
1537  fSpecialSubTriggerName="8EG2";
1539  SETBIT(fTriggersEMCALSelected, kG2);
1540  break;
1541  case 7: // 7DGA - CINT7 DGA
1544  fSpecialSubTriggerName="7DGA";
1546  SETBIT(fTriggersEMCALSelected, kG2);
1547  break;
1548  case 8: // 8DGA - CINT8 DGA
1551  fSpecialSubTriggerName="8DGA";
1553  SETBIT(fTriggersEMCALSelected, kG2);
1554  break;
1555  case 9: // 7DG1 - CINT7 DG1
1558  fSpecialSubTriggerName="7DG1";
1560  SETBIT(fTriggersEMCALSelected, kG1);
1561  break;
1562  case 10: // 8DG1 - CINT8 DG1
1565  fSpecialSubTriggerName="8DG1";
1567  SETBIT(fTriggersEMCALSelected, kG1);
1568  break;
1569  case 11: // 7DG2 - CINT7 DG2
1572  fSpecialSubTriggerName="7DG2";
1574  SETBIT(fTriggersEMCALSelected, kG2);
1575  break;
1576  case 12: // 8DG2 - CINT8 DG2
1579  fSpecialSubTriggerName="8DG2";
1581  SETBIT(fTriggersEMCALSelected, kG2);
1582  break;
1583 
1584  default:
1585  AliError("Warning: Special Subtrigger Class Not known");
1586  return 0;
1587  }
1588  } else if (fSpecialTrigger == 9){ // Subdivision of kEMCEGA trigger classes
1589  switch(selectSpecialSubTriggerClass){
1590  case 0: // all together
1593 // AliInfo("Info: Nothing to be done");
1594  break;
1595  case 1: // 7EJE - CINT7 EJE
1598  fSpecialSubTriggerName="7EJE";
1600  SETBIT(fTriggersEMCALSelected, kJ2);
1601  break;
1602  case 2: // 8EJE - CINT8 EJE
1605  fSpecialSubTriggerName="8EJE";
1607  SETBIT(fTriggersEMCALSelected, kJ2);
1608  break;
1609  case 3: // 7EJ1 - CINT7 EJ1
1612  fSpecialSubTriggerName="7EJ1";
1614  SETBIT(fTriggersEMCALSelected, kJ1);
1615  break;
1616  case 4: // 8EJ1 - CINT8 EJ1
1619  fSpecialSubTriggerName="8EJ1";
1621  SETBIT(fTriggersEMCALSelected, kJ1);
1622  break;
1623  case 5: // 7EJ2 - CINT7 EJ2
1626  fSpecialSubTriggerName="7EJ2";
1628  SETBIT(fTriggersEMCALSelected, kJ2);
1629  break;
1630  case 6: // 8EJ2 - CINT8 EJ2
1633  fSpecialSubTriggerName="8EJ2";
1635  SETBIT(fTriggersEMCALSelected, kJ2);
1636  break;
1637  case 7: // 7DJ1 - CINT7 DJ1
1640  fSpecialSubTriggerName="7DJ1";
1642  SETBIT(fTriggersEMCALSelected, kJ1);
1643  break;
1644  case 8: // 8DJ1 - CINT8 DJ1
1647  fSpecialSubTriggerName="8DJ1";
1649  SETBIT(fTriggersEMCALSelected, kJ1);
1650  break;
1651  case 9: // 7DJ2 - CINT7 DJ2
1654  fSpecialSubTriggerName="7DJ2";
1656  SETBIT(fTriggersEMCALSelected, kJ2);
1657  break;
1658  case 10: // 8DJ2 - CINT8 DJ2
1661  fSpecialSubTriggerName="8DJ2";
1663  SETBIT(fTriggersEMCALSelected, kJ2);
1664  break;
1665 
1666  default:
1667  AliError("Warning: Special Subtrigger Class Not known");
1668  return 0;
1669  }
1670  }
1671  return 1;
1672 }
1673 
1674 //________________________________________________________________________
1676 {
1677  // Set Cut
1678  fMultiplicityMethod=multiplicityMethod;
1679 
1680  // 0 Photon Multiplicity
1681  // 1 TPC Track multiplicity
1682  // 2 V0 Mult
1683  // 3 SPD Mult
1684 
1685  return kTRUE;
1686 }
1687 
1688 //________________________________________________________________________
1690 {// Set Cut
1691  switch(removePileUp){
1692  case 0:
1693  fRemovePileUp = kFALSE;
1694  break;
1695  case 1:
1696  fRemovePileUp = kTRUE;
1697  break;
1698  case 2:
1699  fRemovePileUp = kTRUE;
1702  break;
1703  case 3:
1704  fRemovePileUp = kTRUE;
1707  break;
1708  case 4:
1709  fRemovePileUp = kTRUE;
1712  break;
1713  case 5:
1714  fRemovePileUp = kTRUE;
1717  break;
1718  case 6:
1719  fRemovePileUp = kTRUE;
1720  fDoPileUpRejectV0MTPCout = kTRUE;
1721  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
1722  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
1723  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
1724  if (fIsHeavyIon==1){
1725  if(fPeriodEnum == kLHC15o){
1726  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
1727  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
1728  break;
1729  }else{
1730  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
1731  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
1732  break;
1733  }
1734  } else if(fIsHeavyIon == 2){
1735  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
1736  fFPileUpRejectV0MTPCout->SetParameter(1,2.0);
1737  break;
1738  }else{
1739  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
1740  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
1741  break;
1742  }
1743  break;
1744  case 7:
1745  fRemovePileUp = kTRUE;
1746  fDoPileUpRejectV0MTPCout = kTRUE;
1747  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
1748  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
1749  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
1750  if (fIsHeavyIon==1){
1751  if(fPeriodEnum == kLHC15o){
1752  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
1753  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
1754  break;
1755  }else{
1756  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
1757  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
1758  break;
1759  }
1760  } else if(fIsHeavyIon == 2){
1761  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
1762  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
1763  break;
1764  }else{
1765  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
1766  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
1767  break;
1768  }
1769  break;
1770  case 8:
1771  fRemovePileUp = kTRUE;
1772  fDoPileUpRejectV0MTPCout = kTRUE;
1773  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
1774  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
1775  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
1776  if (fIsHeavyIon==1){
1777  if(fPeriodEnum == kLHC15o){
1778  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
1779  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
1780  break;
1781  }else{
1782  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
1783  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
1784  break;
1785  }
1786  } else if(fIsHeavyIon == 2){
1787  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
1788  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
1789  break;
1790  }else{
1791  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
1792  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
1793  break;
1794  }
1795  break;
1796  case 9:
1797  fRemovePileUp = kTRUE;
1800  fDoPileUpRejectV0MTPCout = kTRUE;
1801  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
1802  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
1803  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
1804  if (fIsHeavyIon==1){
1805  if(fPeriodEnum == kLHC15o){
1806  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
1807  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
1808  break;
1809  }else{
1810  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
1811  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
1812  break;
1813  }
1814  } else if(fIsHeavyIon == 2){
1815  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
1816  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
1817  break;
1818  }else{
1819  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
1820  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
1821  break;
1822  }
1823  break;
1824  default:
1825  AliError("RemovePileUpCut not defined");
1826  return kFALSE;
1827  }
1828  return kTRUE;
1829 }
1830 
1831 //________________________________________________________________________
1833 
1834  switch(extraSignal){
1835  case 0:
1836  fRejectExtraSignals = 0;
1837  break; // No Rejection
1838  case 1:
1839  fRejectExtraSignals = 1;
1840  break; // MinBias Header
1841  case 2:
1842  fRejectExtraSignals = 2;
1843  break; // User String Array
1844  case 3:
1845  fRejectExtraSignals = 3;
1846  break; // Rejection for Gamma Correction only
1847  default:
1848  AliError(Form("Extra Signal Rejection not defined %d",extraSignal));
1849  return kFALSE;
1850  }
1851  return kTRUE;
1852 }
1853 
1854 //________________________________________________________________________
1856 
1857  switch(vertexCut){
1858  case 0: // no Vertex required // NOT fully working yet
1859  fEnableVertexCut = kFALSE;
1860  fMaxVertexZ = 1000;
1861  break;
1862  case 1: // vertex within +-15 cm
1863  fEnableVertexCut = kTRUE;
1864  fMaxVertexZ = 15;
1865  break;
1866  case 2: // vertex within +-12.5 cm
1867  fEnableVertexCut = kTRUE;
1868  fMaxVertexZ = 12.5;
1869  break;
1870  case 3: // vertex within +-10 cm
1871  fEnableVertexCut = kTRUE;
1872  fMaxVertexZ = 10.0;
1873  break;
1874  case 4: // vertex within +-7.5 cm
1875  fEnableVertexCut = kTRUE;
1876  fMaxVertexZ = 7.5;
1877  break;
1878  case 5: // vertex within +-5 cm
1879  fEnableVertexCut = kTRUE;
1880  fMaxVertexZ = 5.;
1881  break;
1882  default:
1883  AliError(Form("Vertex Cut not defined %d",vertexCut));
1884  return kFALSE;
1885  }
1886  return kTRUE;
1887 }
1888 
1889 //-------------------------------------------------------------
1891  if (fPeriodEnum == kLHC15n || // pp 5TeV
1892  fPeriodEnum == kLHC15o || // PbPb 5TeV
1893  fPeriodEnum == kLHC15k1a1 || fPeriodEnum == kLHC15k1a2 || fPeriodEnum == kLHC15k1a3 || fPeriodEnum == kLHC16j7 || // MC PbPb 5TeV LowIR
1894  fPeriodEnum == kLHC16h4 || // MC PbPb 5TeV added signals
1895  fPeriodEnum == kLHC16g1 || fPeriodEnum == kLHC16g1a || fPeriodEnum == kLHC16g1b || fPeriodEnum == kLHC16g1c || // MC PbPb 5TeV general purpose
1897  fPeriodEnum == kLHC16h2a || fPeriodEnum == kLHC16h2b || fPeriodEnum == kLHC16h2c || // MC PbPb 5TeV jet-jet
1899  fPeriodEnum == kLHC15g3a3 || fPeriodEnum == kLHC15g3c3 || // MC pp 13TeV
1900  fPeriodEnum == kLHC16q || fPeriodEnum == kLHC16t || // pPb 5TeV LHC16qt
1901  fPeriodEnum == kLHC16r || fPeriodEnum == kLHC16s || // pPb 8TeV LHC16rs
1905  fPeriodEnum == kLHC17g8a_fast || fPeriodEnum == kLHC17g8a_cent_woSDD || // MC pPb 5TeV LHC16qt
1906  fPeriodEnum == kLHC17g8b || fPeriodEnum == kLHC17g8c || // MC pPb 8TeV LHC16sr
1907  fPeriodEnum == kLHC17n || // Xe-Xe LHC17n
1908  fPeriodEnum == kLHC17j7 // MC Xe-Xe LHC17n
1909  ){
1910  return kTRUE;
1911  } else {
1912  return kFALSE;
1913  }
1914 }
1915 
1916 //-------------------------------------------------------------
1918 { // Get Event Centrality
1919 
1920  AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
1921  if(esdEvent){
1923  AliMultSelection *MultSelection = (AliMultSelection*)event->FindListObject("MultSelection");
1924  if(!MultSelection){
1925  AliWarning ("AliMultSelection object not found !");
1926  return -1;
1927  }else{
1928  if(fDetectorCentrality==0){
1929  if(fIsHeavyIon==2) return MultSelection->GetMultiplicityPercentile("V0A");// default for pPb
1930  else return MultSelection->GetMultiplicityPercentile("V0M");// default
1931  }else if(fDetectorCentrality==1) return MultSelection->GetMultiplicityPercentile("CL1",kTRUE);
1932  }
1933  }else{
1934  AliCentrality *fESDCentrality = (AliCentrality*)esdEvent->GetCentrality();
1935  if(fDetectorCentrality==0){
1936  if(fIsHeavyIon==2) return fESDCentrality->GetCentralityPercentile("V0A"); // default for pPb
1937  else return fESDCentrality->GetCentralityPercentile("V0M"); // default
1938  }else if(fDetectorCentrality==1) return fESDCentrality->GetCentralityPercentile("CL1");
1939  }
1940  }
1941 
1942  AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
1943  if(aodEvent){
1945  AliMultSelection *MultSelection = (AliMultSelection*)aodEvent->FindListObject("MultSelection");
1946  if(!MultSelection){
1947  AliWarning ("AliMultSelection object not found !");
1948  return -1;
1949  } else{
1950  if(fDetectorCentrality==0){
1951  if(fIsHeavyIon==2) return MultSelection->GetMultiplicityPercentile("V0A");// default for pPb
1952  else return MultSelection->GetMultiplicityPercentile("V0M",kTRUE);
1953  }else if(fDetectorCentrality==1) return MultSelection->GetMultiplicityPercentile("CL1",kTRUE);
1954  }
1955  }else{
1956  if(aodEvent->GetHeader()){return ((AliVAODHeader*)aodEvent->GetHeader())->GetCentrality();}
1957  }
1958  }
1959 
1960  return -1;
1961 }
1962 
1963 //_____________________________________________________________________________________
1964 Bool_t AliConvEventCuts::IsCentralitySelected(AliVEvent *event, AliMCEvent *mcEvent)
1965 {
1966  // Centrality Selection
1967  if(!fIsHeavyIon){
1968  if ((fCentralityMin == 0 && fCentralityMax == 0) || (fCentralityMin > fCentralityMax) ){
1969  return kTRUE;
1970  } else {
1971  Int_t primaryTracksPP[9] = { 0, 2, 5, 10, 15,
1972  30, 50, 100, 1000
1973  };
1974  Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks();
1975  if ( nprimaryTracks >= primaryTracksPP[fCentralityMin] && nprimaryTracks < primaryTracksPP[fCentralityMax]){
1976  return kTRUE;
1977  } else {
1978  return kFALSE;
1979  }
1980  return kFALSE;
1981  }
1982  }
1983  if(fCentralityMin == fCentralityMax ) return kTRUE;//0-100%
1984  else if ( fCentralityMax==0) fCentralityMax=10; //CentralityRange = fCentralityMin-10*multfactor
1986  if(centrality<0 && !mcEvent)return kFALSE;
1987 
1988  Int_t centralityC=0;
1989  if (fModCentralityClass == 0){
1990  centralityC= Int_t(centrality/10);
1991  if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
1992  return kTRUE;
1993  else return kFALSE;
1994  }
1995  else if (fModCentralityClass ==1){
1996  centralityC= Int_t(centrality);
1997  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
1998  return kTRUE;
1999  } else return kFALSE;
2000  }
2001  else if (fModCentralityClass ==2){
2002  centralityC= Int_t(centrality);
2003  if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
2004  return kTRUE;
2005  else return kFALSE;
2006  }
2007 
2008  Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks();
2009  Int_t PrimaryTracks10[11][2] =
2010  {
2011  {9999,9999}, // 0 //1550 changed to 9999 on 9 Dec
2012  {1210, 928}, // 10
2013  { 817, 658}, // 20
2014  { 536, 435}, // 30
2015  { 337, 276}, // 40
2016  { 197, 162}, // 50
2017  { 106, 100}, // 60
2018  { 51, 44}, // 70
2019  { 21, 18}, // 80
2020  { 0, 0}, // 90
2021  { 0, 0}// 100 // only max accessible
2022  };
2023  Int_t PrimaryTracksLHC11h10[11][2] =
2024  {
2025  {9999,9999}, // 0 //1550 changed to 9999 on 9 Dec
2026  { 985, 928}, // 10
2027  { 661, 658}, // 20
2028  { 434, 435}, // 30
2029  { 275, 276}, // 40
2030  { 173, 162}, // 50
2031  { 100, 100}, // 60
2032  { 42, 44}, // 70
2033  { 19, 18}, // 80
2034  { 0, 0}, // 90
2035  { 0, 0}// 100 // only max accessible
2036  };
2037  Int_t PrimaryTracksLHC15o10[11][2] =
2038  { // values calculated from ESD analysis so far
2039  {2700, 2700}, // 0-10% cent class max # of tracks: max value of the data distribution
2040  {1498, 1498}, // 0-10% cent class min # of tracks
2041  {1012, 1012}, // 10-20
2042  { 669, 669}, // 20-30
2043  { 423, 423}, // 30-40
2044  { 251, 251}, // 40-50
2045  { 136, 136}, // 50-60
2046  { 67, 67}, // 60-70
2047  { 28, 28}, // 70-80
2048  { 0, 0}, // 80-90% cent class min # of tracks
2049  { 0, 0} // not used
2050  };
2051  Int_t PrimaryTracks5a[11][2] =
2052  {
2053  {9999,9999}, // 0 ///1550 changed to 9999 on 9 Dec
2054  {1485,1168}, // 5
2055  {1210, 928}, // 10
2056  { 995, 795}, // 15
2057  { 817, 658}, // 20
2058  { 666, 538}, // 25
2059  { 536, 435}, // 30
2060  { 428, 350}, // 35
2061  { 337, 276}, // 40
2062  { 260, 214}, // 45
2063  { 0, 162}// 50 only max accessible
2064  };
2065  Int_t PrimaryTracksLHC11h5a[11][2] =
2066  {
2067  {9999,9999}, // 0 ///1550 changed to 9999 on 9 Dec
2068  {1166,1168}, // 5
2069  { 953, 928}, // 10
2070  { 805, 795}, // 15
2071  { 655, 658}, // 20
2072  { 535, 538}, // 25
2073  { 435, 435}, // 30
2074  { 349, 350}, // 35
2075  { 275, 276}, // 40
2076  { 214, 214}, // 45
2077  { 165, 162}// 50 only max accessible
2078  };
2079  Int_t PrimaryTracksLHC15o5a[11][2] =
2080  {
2081  { 2700, 2700}, // 0-5% cent class max # of tracks: max value of the data distribution
2082  { 1827, 1827}, // 0-5% cent class min # of tracks
2083  { 1498, 1498}, // 5-10
2084  { 1234, 1234}, // 10-15
2085  { 1012, 1012}, // 15-20
2086  { 827, 827}, // 20-25
2087  { 669, 669}, // 25-30
2088  { 536, 536}, // 30-35
2089  { 423, 423}, // 35-40
2090  { 329, 329}, // 40-45 cent class min # of tracks (cut digit 9)
2091  { 0, 0} // not used
2092  };
2093  Int_t PrimaryTracks5b[11][2] =
2094  {
2095  { 260, 214}, // 45
2096  { 197, 162}, // 50
2097  { 147, 125}, // 55
2098  { 106, 100}, // 60
2099  { 75, 63}, // 65
2100  { 51, 44}, // 70
2101  { 34, 29}, // 75
2102  { 21, 18}, // 80
2103  { 13, 11}, // 85
2104  { 0, 0}, // 90
2105  { 0, 0}// 100 only max accessible
2106  };
2107  Int_t PrimaryTracksLHC11h5b[11][2] =
2108  {
2109  { 214, 214}, // 45
2110  { 165, 162}, // 50
2111  { 127, 125}, // 55
2112  { 93, 100}, // 60
2113  { 64, 63}, // 65
2114  { 44, 44}, // 70
2115  { 30, 29}, // 75
2116  { 18, 18}, // 80
2117  { 11, 11}, // 85
2118  { 0, 0}, // 90
2119  { 0, 0}// 100 only max accessible
2120  };
2121  Int_t PrimaryTracksLHC15o5b[11][2] =
2122  {
2123  { 329, 329}, // 45-50% cent class max # of tracks
2124  { 251, 251}, // 45-50% cent class min # of tracks
2125  { 188, 188}, // 50-55
2126  { 136, 136}, // 55-60
2127  { 97, 97}, // 60-65
2128  { 67, 67}, // 65-70
2129  { 44, 44}, // 70-75
2130  { 28, 28}, // 75-80
2131  { 17, 17}, // 80-85
2132  { 0, 0}, // 85-90 cent class minimum # of tracks
2133  { 0, 0} // not used
2134  };
2135  Int_t PrimaryTracksLHC17n10[11][2] =
2136  {
2137  {9999,9999}, // 0 // 1500 max in hist but set to real max
2138  { 800, 800}, // 10 // guess
2139  { 628, 628}, // 20
2140  { 350, 350}, // 30 // guess
2141  { 268, 268}, // 40
2142  { 200, 200}, // 50 // guess
2143  { 100, 100}, // 60 // guess
2144  { 51, 44}, // 70 // guess
2145  { 21, 18}, // 80 // guess
2146  { 0, 0}, // 90 // guess
2147  { 0, 0} // 100 // only max accessible
2148  };
2149 
2150  Int_t column = 0;
2151  if(event->IsA()==AliESDEvent::Class()) column = 0;
2152  if(event->IsA()==AliAODEvent::Class()) column = 1;
2153 
2154  if (fModCentralityClass == 3){
2155  if(mcEvent){
2156  // setting specific arry for LHC11h for MC track mult
2158  if(nprimaryTracks > PrimaryTracksLHC11h10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h10[fCentralityMin][column])
2159  return kTRUE;
2160  else return kFALSE;
2161  // setting specific arry for LHC17n for MC track mult
2162  } else if(fPeriodEnum == kLHC17j7 ){
2163  if(nprimaryTracks > PrimaryTracksLHC17n10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC17n10[fCentralityMin][column])
2164  return kTRUE;
2165  else return kFALSE;
2166  // setting specific arry for LHC15o for MC track mult
2168  if(nprimaryTracks > PrimaryTracksLHC15o10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC15o10[fCentralityMin][column])
2169  return kTRUE;
2170  else return kFALSE;
2171  // setting specific arry for LHC10h for MC track mult
2172  } else {
2173  if(nprimaryTracks > PrimaryTracks10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks10[fCentralityMin][column])
2174  return kTRUE;
2175  else return kFALSE;
2176  }
2177  }
2178  else{
2179  centralityC= Int_t(centrality/10);
2180  if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2181  return kTRUE;
2182  else return kFALSE;
2183  }
2184  }
2185  else if (fModCentralityClass ==4){
2186  if(mcEvent){
2187  // setting specific arry for LHC11h for MC track mult
2189  if(nprimaryTracks > PrimaryTracksLHC11h5a[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h5a[fCentralityMin][column])
2190  return kTRUE;
2191  else return kFALSE;
2192  // setting specific arry for LHC15o for MC track mult
2194  if(nprimaryTracks > PrimaryTracksLHC15o5a[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC15o5a[fCentralityMin][column])
2195  return kTRUE;
2196  else return kFALSE;
2197  // setting specific arry for LHC10h for MC track mult
2198  } else {
2199  if(nprimaryTracks > PrimaryTracks5a[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5a[fCentralityMin][column])
2200  return kTRUE;
2201  else return kFALSE;
2202  }
2203  }
2204  else{
2205  centralityC= Int_t(centrality);
2206  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2207  return kTRUE;
2208  } else return kFALSE;
2209  }
2210  }
2211  else if (fModCentralityClass ==5){
2212  if(mcEvent){
2213  // setting specific arry for LHC11h for MC track mult
2215  if(nprimaryTracks > PrimaryTracksLHC11h5b[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h5b[fCentralityMin][column])
2216  return kTRUE;
2217  else return kFALSE;
2218  // setting specific arry for LHC15o for MC track mult
2220  if(nprimaryTracks > PrimaryTracksLHC15o5b[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC15o5b[fCentralityMin][column])
2221  return kTRUE;
2222  else return kFALSE;
2223  // setting specific arry for LHC10h for MC track mult
2224  } else {
2225  if(nprimaryTracks > PrimaryTracks5b[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5b[fCentralityMin][column])
2226  return kTRUE;
2227  else return kFALSE;
2228  }
2229  }
2230  else{
2231  centralityC= Int_t(centrality);
2232  if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
2233  return kTRUE;
2234  else return kFALSE;
2235  }
2236  }
2237 
2238  return kFALSE;
2239 }
2240 
2241 //________________________________________________________________________
2243  // Cut on z position of primary vertex
2244  Double_t fVertexZ=event->GetPrimaryVertex()->GetZ();
2245  Double_t fVertexZSPD = 0;
2246  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2247  if(fESDEvent){
2248  fVertexZSPD = fESDEvent->GetPrimaryVertexSPD()->GetZ();
2249  }
2250  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2251  if(fAODEvent){
2252  fVertexZSPD = fAODEvent->GetPrimaryVertexSPD()->GetZ();
2253  }
2254 
2255  if(TMath::Abs(fVertexZ)>fMaxVertexZ)return kFALSE;
2256 
2257 
2258  if (fPeriodEnum == kLHC11h){
2259  if (TMath::Abs(fVertexZ-fVertexZSPD) > 0.1) return kFALSE;
2260  }
2261  if (fIsHeavyIon == 2){
2262  if(!fUtils->IsVertexSelected2013pA(event)) return kFALSE;
2263  }
2264 
2265  return kTRUE;
2266 }
2267 
2268 //________________________________________________________________________
2270 {
2272  return kFALSE;
2273  TBits fIR1 = event->GetHeader()->GetIRInt1InteractionMap(); // IR1 contains V0 information (VIR)
2274  TBits fIR2 = event->GetHeader()->GetIRInt2InteractionMap(); // IR2 contains T0 information
2275  UShort_t bunchCrossings = event->GetBunchCrossNumber();
2277  for(Int_t i = 0; i<180;i++){
2278  if(fIR1.TestBitNumber(i))
2279  fHistoPastFutureBits->Fill((i*25)-90*25);
2280  }
2281  }
2282 
2283  Bool_t isOutOfBunchPileup = 0;
2284  Int_t pf1 = fPastFutureRejectionLow +bunchCrossings%4;
2285  Int_t pf2 = fPastFutureRejectionHigh+bunchCrossings%4;
2286  if(pf1 < -89) pf1 = -89;
2287  if(pf2 > 89) pf2 = 89;
2288  Int_t pf2maxForT0 = pf2;
2289  Int_t ir1skip = 0;
2290  for (Int_t i=pf1;i<=pf2;i++) {
2291  if (i==0) continue;
2292  if (i<=pf2maxForT0) isOutOfBunchPileup|=fIR2.TestBitNumber(90+i); // T0-based clean-up
2293  if (i>0 && i<=ir1skip) continue; // skip next 2 for old IR definitions
2294  isOutOfBunchPileup|=fIR1.TestBitNumber(90+i); // V0-based clean-up
2295  }
2296  return isOutOfBunchPileup;
2297 }
2298 //________________________________________________________________________
2299 
2301 {
2302  Bool_t isPileUpV0MTPCout=0;
2303 
2304  Double_t multV0M;
2305  Double_t valFunc;
2306  if (fIsHeavyIon==2){
2307  multV0M = event->GetVZEROData()->GetMTotV0A();
2308  }else{
2309  multV0M = event->GetVZEROData()->GetMTotV0A() + event->GetVZEROData()->GetMTotV0C() ;
2310  }
2311 
2312  if ( fFPileUpRejectV0MTPCout != 0x0 ){
2313  valFunc= fFPileUpRejectV0MTPCout->Eval(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfTPCoutTracks());
2314  if (multV0M < valFunc ) isPileUpV0MTPCout=1;
2315  }
2316 
2317  return isPileUpV0MTPCout;
2318 
2319 }
2320 //________________________________________________________________________
2322  // returns number of contributors to the vertex
2323 
2324  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2325  if(fESDEvent){
2326  if (fESDEvent->GetPrimaryVertex() != NULL){
2327  if(fESDEvent->GetPrimaryVertex()->GetNContributors()>0) {
2328  // cout << "accepted global" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertex()->GetNContributors() << endl;
2329  return fESDEvent->GetPrimaryVertex()->GetNContributors();
2330  }
2331  }
2332 
2333  if(fESDEvent->GetPrimaryVertexSPD() !=NULL){
2334  if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2335  // cout << "accepted SPD" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertexSPD()->GetNContributors() << endl;
2336  return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
2337  }else {
2338  AliWarning(Form("Number of contributors from bad vertex type:: %s",fESDEvent->GetPrimaryVertex()->GetName()));
2339  // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
2340  return 0;
2341  }
2342  }
2343  }
2344 
2345  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2346  if(fAODEvent){
2347  if (fAODEvent->GetPrimaryVertex() != NULL){
2348  if(fAODEvent->GetPrimaryVertex()->GetNContributors()>0) {
2349  return fAODEvent->GetPrimaryVertex()->GetNContributors();
2350  }
2351  }
2352  if(fAODEvent->GetPrimaryVertexSPD() !=NULL){
2353  if(fAODEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2354  return fAODEvent->GetPrimaryVertexSPD()->GetNContributors();
2355  } else {
2356  AliWarning(Form("Number of contributors from bad vertex type:: %s",fAODEvent->GetPrimaryVertex()->GetName()));
2357  return 0;
2358  }
2359  }
2360  }
2361  // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
2362  return 0;
2363 }
2364 
2365 //________________________________________________________________________
2366 // Analysing Jet-Jet MC's
2367 //________________________________________________________________________
2369  AliGenCocktailEventHeader *cHeader = 0x0;
2370  Bool_t headerFound = kFALSE;
2371  weight = -1;
2372  fMaxPtJetMC = 0;
2373 
2374  if ( fPeriodEnum != kLHC17g8a_fast && fPeriodEnum != kLHC17g8a_cent_woSDD && // LHC16qt pPb 5TeV JetJet MC's
2375  fPeriodEnum != kLHC17g8b && fPeriodEnum != kLHC17g8c && // LHC16sr pPb 8TeV JetJet MC's
2376  fPeriodEnum != kLHC16P1JJ && fPeriodEnum != kLHC16P1JJLowB && // LHC16X Jet Jet MC's
2377  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
2378  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
2379  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
2380  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
2381  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
2382  fPeriodEnum != kLHC16c2 && fPeriodEnum != kLHC16c2_plus // LHC12 JetJet MC
2383  ){
2384 
2385  weight = 1;
2386  return kTRUE;
2387  }
2388 
2389  if(mcEvent){
2390  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
2391  if(cHeader) headerFound = kTRUE;
2392  }else{
2393  //no mcEvent available -> not running on MC
2394  weight = 1;
2395  return kTRUE;
2396  }
2397 
2398  if(headerFound){
2399  TList *genHeaders = 0x0;
2400  if(cHeader) genHeaders = cHeader->GetHeaders();
2401  AliGenEventHeader* gh = 0;
2402  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
2403  gh = (AliGenEventHeader*)genHeaders->At(i);
2404  TString GeneratorName = gh->GetName();
2405  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0 || GeneratorName.Contains("Pythia8Jets")){
2406  Bool_t eventAccepted = kTRUE;
2407  TParticle * jet = 0;
2408  Int_t nTriggerJets = dynamic_cast<AliGenPythiaEventHeader*>(gh)->NTriggerJets();
2409  Float_t ptHard = dynamic_cast<AliGenPythiaEventHeader*>(gh)->GetPtHard();
2410  Float_t tmpjet[]={0,0,0,0};
2411  for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){
2412  dynamic_cast<AliGenPythiaEventHeader*>(gh)->TriggerJet(ijet, tmpjet);
2413  jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
2414  //Compare jet pT and pt Hard
2415  if(jet->Pt() > fMaxFacPtHard * ptHard){
2416  eventAccepted= kFALSE;
2417  }
2418  if (jet->Pt() > fMaxPtJetMC) fMaxPtJetMC = jet->Pt();
2419  }
2420  if (jet) delete jet;
2421  if (mcEvent){
2422  for(Long_t i = 0; i < mcEvent->GetNumberOfPrimaries(); i++) {
2423  TParticle* particle = (TParticle *)mcEvent->Particle(i);
2424  if (!particle) continue;
2425  if (TMath::Abs(particle->GetPdgCode()) == 111 || TMath::Abs(particle->GetPdgCode()) == 221){
2426  if (particle->Pt() > fMaxFacPtHardSingleParticle*ptHard){
2427  eventAccepted= kFALSE;
2428  }
2429  }
2430 
2431  }
2432  }
2433 
2434  if ( fPeriodEnum == kLHC16P1JJLowB) {
2435  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2436  21, 28, 36, 45, 57,
2437  70, 85, 99, 115, 132,
2438  150, 169, 190, 212, 235,
2439  1000000};
2440  Double_t weightsBins[20] = { 43.7553, 13.5848, 6.788, 2.67826, 0.975255,
2441  0.39069, 0.127342, 0.0465597, 0.0206539, 0.00750243,
2442  0.00319118, 0.00122291, 0.000641232, 0.000321437, 0.000168273,
2443  9.17033e-05, 5.34755e-05, 3.01354e-05, 1.74518e-05, 2.8004e-05};
2444  Int_t bin = 0;
2445  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2446  if (bin < 20) weight = weightsBins[bin];
2447 
2448  } else if ( fPeriodEnum == kLHC16P1JJ ){
2449  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2450  21, 28, 36, 45, 57,
2451  70, 85, 99, 115, 132,
2452  150, 169, 190, 212, 235,
2453  1000000};
2454  Double_t weightsBins[20] = { 43.8654, 13.6215, 6.79856, 2.67526, 0.978794,
2455  0.390797, 0.127769, 0.0465714, 0.0206173, 0.00750282,
2456  0.00318773, 0.00122533, 0.000644385, 0.000321225, 0.00016846,
2457  9.18305e-05, 5.33507e-05, 3.00677e-05, 1.74608e-05, 2.80823e-05};
2458 
2459  Int_t bin = 0;
2460  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2461  if (bin < 20) weight = weightsBins[bin];
2462 
2463  } else if ( fPeriodEnum == kLHC16h3 ){
2464  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2465  21, 28, 36, 45, 57,
2466  70, 85, 99, 115, 132,
2467  150, 169, 190, 212, 235,
2468  1000000};
2469  Double_t weightsBins[20] = { 16.0869, 4.61169, 2.14976, 0.782544, 0.264854,
2470  9.7619E-02, 2.92747E-02, 9.89515E-03, 4.05152E-03, 1.35393E-03,
2471  5.29864E-04, 1.88317E-04, 9.23E-05, 4.29E-05, 2.09E-05,
2472  1.06E-05, 5.76E-06, 3.00E-06, 1.62E-06, 2.10E-06 };
2473  Int_t bin = 0;
2474  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2475  if (bin < 20) weight = weightsBins[bin];
2476 
2477 
2478  } else if ( fPeriodEnum == kLHC15a3b || fPeriodEnum == kLHC15g1b ){
2479  Double_t ptHardBinRanges[13] = { 5, 7, 9, 12, 16,
2480  21, 28, 36, 45, 57,
2481  70, 85, 1000};
2482  Double_t weightsBins[12] = { 7.858393e-03, 4.718691e-03, 4.077575e-03, 2.814527e-03, 1.669625e-03,
2483  1.007535e-03, 4.536554e-04, 2.111041e-04, 1.094840e-04, 4.404973e-05,
2484  1.933238e-05, 1.562895e-05};
2485  Int_t bin = 0;
2486  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2487  if (bin < 12) weight = weightsBins[bin];
2488 
2489  } else if ( fPeriodEnum == kLHC15g1a ){
2490  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
2491  84, 117, 152, 191, 1000000,
2492  5, 7, 9, 12, 16,
2493  21, 28, 36, 45, 57 };
2494  Double_t weightsBins[19] = { 4.43629 , 0.49523, 0.0394921, 0.00383174, 0.000446559,
2495  6.37374e-05, 1.03134e-05, 2.27012e-06, 7.59281e-07, 0,
2496  2.62906, 1.12884, 0.656873, 0.262822, 0.0876732,
2497  0.0307759, 0.0087083, 0.0027664, 0.00106203};
2498 
2499  Int_t bin = 0;
2500  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
2501  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
2502  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2503  if (bin < 19) weight = weightsBins[bin];
2504 
2505  } else if ( fPeriodEnum == kLHC15a3a || fPeriodEnum == kLHC15a3a_plus ) {
2506  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
2507  84, 117, 152, 191, 1000000,
2508  5, 7, 9, 12, 16,
2509  21, 28, 36, 45, 57 };
2510  // LHC15a3a
2511  Double_t weightsBins[19] = { 4.43897 , 0.495766, 0.039486, 0.00383011, 0.000447104,
2512  6.37277e-05, 1.03166e-05, 2.26971e-06, 7.59023e-07, 0,
2513  2.63331, 1.12815, 0.657034, 0.262756, 0.0877227,
2514  0.0307638, 0.00870635, 0.00276658, 0.00106229};
2515  Int_t bin = 0;
2516  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
2517  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
2518  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2519  if (bin < 19) weight = weightsBins[bin];
2520 
2521  } else if ( fPeriodEnum == kLHC16c2 || fPeriodEnum == kLHC16c2_plus ){
2522  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2523  21, 28, 36, 45, 57,
2524  70, 85, 99, 115, 132,
2525  150, 169, 190, 212, 235,
2526  1000000};
2527  Double_t weightsBins[20] = { 28.3084, 8.43277, 4.07753, 1.54359, 0.543318,
2528  0.208394, 0.0652349, 0.0186904, 0.00834528, 0.00301414,
2529  0.00125939, 0.000474403, 0.000244052, 0.00011924, 6.09838e-05,
2530  3.24148e-05, 1.84314e-05, 1.00926e-05, 5.68632e-06, 8.38092e-06};
2531  Int_t bin = 0;
2532  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2533  if (bin < 20) weight = weightsBins[bin];
2534 
2535  } else if ( fPeriodEnum == kLHC16c3a ){
2536  Double_t ptHardBinRanges[6] = { 7, 9, 12, 16, 21, 1000};
2537  Double_t weightsBins[5] = { 0.00672445, 0.00799158, 0.00678934, 0.00463908, 0.00600068}; //preliminary estimates
2538  Int_t bin = 0;
2539  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2540  if (bin < 5) weight = weightsBins[bin];
2541 
2542  } else if (fPeriodEnum == kLHC16c3b ){
2543  Double_t ptHardBinRanges[7] = { 14, 19, 26, 35, 48, 66, 1000};
2544  Double_t weightsBins[6] = { 0.00608281, 0.00393646, 0.00200138, 0.000986267, 0.000389051, 0.0001863}; //preliminary estimates
2545  Int_t bin = 0;
2546  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2547  if (bin < 6) weight = weightsBins[bin];
2548 
2549  } else if (fPeriodEnum == kLHC16c3c ){
2550  Double_t ptHardBinRanges[8] = { 0, 5, 11, 21, 36, 57, 84, 1000};
2551  Double_t weightsBins[7] = { 0.00151999, 0.000100346, 1.27688e-05, 1.82388e-06, 3.08506e-07, 6.00308e-08, 1.88414e-08}; //preliminary estimates
2552  Int_t bin = 0;
2553  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2554  if (bin < 7) weight = weightsBins[bin];
2555 
2556  } else if ( fPeriodEnum == kLHC13b4_fix || fPeriodEnum == kLHC13b4_plus ){
2557  Double_t ptHardBinRanges[11] = { 5, 11, 21, 36, 57,
2558  84, 117, 152, 191, 234,
2559  1000};
2560  Double_t weightsBins[10] = { 2.24185e-6 , 2.48463e-7, 2.23171e-8, 2.43667e-9, 3.29934e-10,
2561  5.34592e-11, 1.00937e-11, 2.6493e-12, 8.53912e-13, 5.43077e-13};
2562  Int_t bin = 0;
2563  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2564  if (bin < 10) weight = weightsBins[bin];
2565 
2566  } else if ( fPeriodEnum == kLHC17g8b ){ // preliminary weights obtained from local running
2567  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16, 21, 28, 36, 45, 57, 70, 85, 99, 115, 132, 150, 169, 190, 212, 235, 10000};
2568  Double_t weightsBins[20] = {2.648510E+01, 7.963350E+00, 3.926460E+00, 1.535630E+00, 5.125940E-01, 1.982910E-01, 6.705810E-02, 2.214220E-02, 9.872830E-03, 3.460430E-03, 1.426840E-03, 5.212990E-04, 2.534030E-04, 1.157210E-04, 6.609650E-05, 3.424850E-05, 1.833500E-05, 1.022650E-05, 5.878600E-06, 8.550350E-06};
2569  Int_t bin = 0;
2570  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2571  if (bin < 20) weight = weightsBins[bin];
2572  } else if ( fPeriodEnum == kLHC17g8c ){ // preliminary weights obtained from local running
2573  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16, 21, 28, 36, 45, 57, 70, 85, 99, 115, 132, 150, 169, 190, 212, 235, 10000};
2574  Double_t weightsBins[20] = {2.638850E+01, 8.160880E+00, 3.937510E+00, 1.485000E+00, 5.382460E-01, 2.034610E-01, 6.293600E-02, 2.206170E-02, 9.319700E-03, 3.354230E-03, 1.392300E-03, 5.023470E-04, 2.645860E-04, 1.299660E-04, 6.415310E-05, 3.469890E-05, 1.816550E-05, 1.047480E-05, 5.728760E-06, 8.547820E-06};
2575  Int_t bin = 0;
2576  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2577  if (bin < 20) weight = weightsBins[bin];
2578 
2579  } else {
2580  weight = 1;
2581  }
2582 
2583  if (weight == -1) return kFALSE;
2584  else return eventAccepted;
2585 
2586  }
2587  }
2588  } else {
2589  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
2590  TString eventHeaderName = eventHeader->ClassName();
2591  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0 || eventHeaderName.Contains("Pythia8Jets")){
2592  Bool_t eventAccepted = kTRUE;
2593  TParticle * jet = 0;
2594  Int_t nTriggerJets = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->NTriggerJets();
2595  Float_t ptHard = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->GetPtHard();
2596  Float_t tmpjet[]={0,0,0,0};
2597  for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){
2598  dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->TriggerJet(ijet, tmpjet);
2599  jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
2600  //Compare jet pT and pt Hard
2601  if(jet->Pt() > fMaxFacPtHard * ptHard){
2602  eventAccepted= kFALSE;
2603  }
2604  if (jet->Pt() > fMaxPtJetMC) fMaxPtJetMC = jet->Pt();
2605  }
2606  if (mcEvent){
2607  for(Long_t i = 0; i < mcEvent->GetNumberOfPrimaries(); i++) {
2608  TParticle* particle = (TParticle *)mcEvent->Particle(i);
2609  if (!particle) continue;
2610  if (TMath::Abs(particle->GetPdgCode()) == 111 || TMath::Abs(particle->GetPdgCode()) == 221){
2611  if (particle->Pt() > fMaxFacPtHardSingleParticle*ptHard){
2612  eventAccepted= kFALSE;
2613  }
2614  }
2615 
2616  }
2617  }
2618 
2619  if ( fPeriodEnum == kLHC16P1JJLowB) {
2620  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2621  21, 28, 36, 45, 57,
2622  70, 85, 99, 115, 132,
2623  150, 169, 190, 212, 235,
2624  1000000};
2625  Double_t weightsBins[20] = { 43.7553, 13.5848, 6.788, 2.67826, 0.975255,
2626  0.39069, 0.127342, 0.0465597, 0.0206539, 0.00750243,
2627  0.00319118, 0.00122291, 0.000641232, 0.000321437, 0.000168273,
2628  9.17033e-05, 5.34755e-05, 3.01354e-05, 1.74518e-05, 2.8004e-05};
2629  Int_t bin = 0;
2630  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2631  if (bin < 20) weight = weightsBins[bin];
2632 
2633  } else if ( fPeriodEnum == kLHC16P1JJ ){
2634  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2635  21, 28, 36, 45, 57,
2636  70, 85, 99, 115, 132,
2637  150, 169, 190, 212, 235,
2638  1000000};
2639  Double_t weightsBins[20] = { 43.8654, 13.6215, 6.79856, 2.67526, 0.978794,
2640  0.390797, 0.127769, 0.0465714, 0.0206173, 0.00750282,
2641  0.00318773, 0.00122533, 0.000644385, 0.000321225, 0.00016846,
2642  9.18305e-05, 5.33507e-05, 3.00677e-05, 1.74608e-05, 2.80823e-05};
2643 
2644  Int_t bin = 0;
2645  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2646  if (bin < 20) weight = weightsBins[bin];
2647 
2648  } else if ( fPeriodEnum == kLHC16h3 ){
2649  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2650  21, 28, 36, 45, 57,
2651  70, 85, 99, 115, 132,
2652  150, 169, 190, 212, 235,
2653  1000000};
2654  Double_t weightsBins[20] = { 16.0869, 4.61169, 2.14976, 0.782544, 0.264854,
2655  9.7619E-02, 2.92747E-02, 9.89515E-03, 4.05152E-03, 1.35393E-03,
2656  5.29864E-04, 1.88317E-04, 9.23E-05, 4.29E-05, 2.09E-05,
2657  1.06E-05, 5.76E-06, 3.00E-06, 1.62E-06, 2.10E-06 };
2658  Int_t bin = 0;
2659  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2660  if (bin < 20) weight = weightsBins[bin];
2661 
2662 
2663  } else if ( fPeriodEnum == kLHC15a3b || fPeriodEnum == kLHC15g1b ){
2664  Double_t ptHardBinRanges[13] = { 5, 7, 9, 12, 16,
2665  21, 28, 36, 45, 57,
2666  70, 85, 1000};
2667  Double_t weightsBins[12] = { 7.858393e-03, 4.718691e-03, 4.077575e-03, 2.814527e-03, 1.669625e-03,
2668  1.007535e-03, 4.536554e-04, 2.111041e-04, 1.094840e-04, 4.404973e-05,
2669  1.933238e-05, 1.562895e-05};
2670  Int_t bin = 0;
2671  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2672  if (bin < 12) weight = weightsBins[bin];
2673 
2674  } else if ( fPeriodEnum == kLHC15g1a ){
2675  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
2676  84, 117, 152, 191, 1000000,
2677  5, 7, 9, 12, 16,
2678  21, 28, 36, 45, 57 };
2679  Double_t weightsBins[19] = { 4.43629 , 0.49523, 0.0394921, 0.00383174, 0.000446559,
2680  6.37374e-05, 1.03134e-05, 2.27012e-06, 7.59281e-07, 0,
2681  2.62906, 1.12884, 0.656873, 0.262822, 0.0876732,
2682  0.0307759, 0.0087083, 0.0027664, 0.00106203};
2683 
2684  Int_t bin = 0;
2685  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
2686  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
2687  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2688  if (bin < 19) weight = weightsBins[bin];
2689 
2690  } else if ( fPeriodEnum == kLHC15a3a || fPeriodEnum == kLHC15a3a_plus ) {
2691  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
2692  84, 117, 152, 191, 1000000,
2693  5, 7, 9, 12, 16,
2694  21, 28, 36, 45, 57 };
2695  // LHC15a3a
2696  Double_t weightsBins[19] = { 4.43897 , 0.495766, 0.039486, 0.00383011, 0.000447104,
2697  6.37277e-05, 1.03166e-05, 2.26971e-06, 7.59023e-07, 0,
2698  2.63331, 1.12815, 0.657034, 0.262756, 0.0877227,
2699  0.0307638, 0.00870635, 0.00276658, 0.00106229};
2700  Int_t bin = 0;
2701  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
2702  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
2703  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2704  if (bin < 19) weight = weightsBins[bin];
2705 
2706  } else if ( fPeriodEnum == kLHC16c2 || fPeriodEnum == kLHC16c2_plus ){
2707  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2708  21, 28, 36, 45, 57,
2709  70, 85, 99, 115, 132,
2710  150, 169, 190, 212, 235,
2711  1000000};
2712  Double_t weightsBins[20] = { 28.3084, 8.43277, 4.07753, 1.54359, 0.543318,
2713  0.208394, 0.0652349, 0.0186904, 0.00834528, 0.00301414,
2714  0.00125939, 0.000474403, 0.000244052, 0.00011924, 6.09838e-05,
2715  3.24148e-05, 1.84314e-05, 1.00926e-05, 5.68632e-06, 8.38092e-06};
2716  Int_t bin = 0;
2717  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2718  if (bin < 20) weight = weightsBins[bin];
2719 
2720  } else if ( fPeriodEnum == kLHC16c3a ){
2721  Double_t ptHardBinRanges[6] = { 7, 9, 12, 16, 21, 1000};
2722  Double_t weightsBins[5] = { 0.00672445, 0.00799158, 0.00678934, 0.00463908, 0.00600068}; //preliminary estimates
2723  Int_t bin = 0;
2724  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2725  if (bin < 5) weight = weightsBins[bin];
2726 
2727  } else if (fPeriodEnum == kLHC16c3b ){
2728  Double_t ptHardBinRanges[7] = { 14, 19, 26, 35, 48, 66, 1000};
2729  Double_t weightsBins[6] = { 0.00608281, 0.00393646, 0.00200138, 0.000986267, 0.000389051, 0.0001863}; //preliminary estimates
2730  Int_t bin = 0;
2731  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2732  if (bin < 6) weight = weightsBins[bin];
2733 
2734  } else if (fPeriodEnum == kLHC16c3c ){
2735  Double_t ptHardBinRanges[8] = { 0, 5, 11, 21, 36, 57, 84, 1000};
2736  Double_t weightsBins[7] = { 0.00151999, 0.000100346, 1.27688e-05, 1.82388e-06, 3.08506e-07, 6.00308e-08, 1.88414e-08}; //preliminary estimates
2737  Int_t bin = 0;
2738  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2739  if (bin < 7) weight = weightsBins[bin];
2740 
2741  } else if ( fPeriodEnum == kLHC13b4_fix || fPeriodEnum == kLHC13b4_plus ){
2742  Double_t ptHardBinRanges[11] = { 5, 11, 21, 36, 57,
2743  84, 117, 152, 191, 234,
2744  1000};
2745  Double_t weightsBins[10] = { 2.24185e-6 , 2.48463e-7, 2.23171e-8, 2.43667e-9, 3.29934e-10,
2746  5.34592e-11, 1.00937e-11, 2.6493e-12, 8.53912e-13, 5.43077e-13};
2747  Int_t bin = 0;
2748  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2749  if (bin < 10) weight = weightsBins[bin];
2750  } else {
2751  weight = 1;
2752  }
2753 
2754  if (weight == -1) return kFALSE;
2755  else return eventAccepted;
2756 
2757  } else {
2758  return kFALSE;
2759  }
2760  }
2761 
2762  return kFALSE;
2763 }
2764 
2765 //________________________________________________________________________
2766 // Analysing Jet-Jet MC's
2767 //________________________________________________________________________
2768 void AliConvEventCuts::GetXSectionAndNTrials(AliMCEvent *mcEvent, Float_t &XSection, Float_t &NTrials){
2769 
2770  AliGenCocktailEventHeader *cHeader = 0x0;
2771  Bool_t headerFound = kFALSE;
2772 
2773  if ( fPeriodEnum != kLHC17g8a_fast && fPeriodEnum != kLHC17g8a_cent_woSDD && // LHC16qt pPb 5TeV JetJet MC's
2774  fPeriodEnum != kLHC17g8b && fPeriodEnum != kLHC17g8c && // LHC16sr pPb 8TeV JetJet MC's
2775  fPeriodEnum != kLHC16P1JJ && fPeriodEnum != kLHC16P1JJLowB && // LHC16X Jet Jet MC's
2776  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
2777  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
2778  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
2779  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
2780  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
2781  fPeriodEnum != kLHC16c2 && fPeriodEnum != kLHC16c2_plus // LHC12 JetJet MC
2782  ){
2783  NTrials = -1;
2784  XSection = -1;
2785  return;
2786  }
2787 
2788  if(mcEvent){
2789  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
2790  if(cHeader) headerFound = kTRUE;
2791  }else{
2792  //no mcEvent available -> not running on MC
2793  NTrials = -1;
2794  XSection = -1;
2795  return;
2796  }
2797 
2798  if(headerFound){
2799  TList *genHeaders = 0x0;
2800  if(cHeader) genHeaders = cHeader->GetHeaders();
2801  AliGenEventHeader* gh = 0;
2802  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
2803  gh = (AliGenEventHeader*)genHeaders->At(i);
2804  TString GeneratorName = gh->GetName();
2805  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0 || GeneratorName.Contains("Pythia8Jets")){
2806  AliGenPythiaEventHeader* gPythia = dynamic_cast<AliGenPythiaEventHeader*>(gh);
2807  NTrials = gPythia->Trials();
2808  XSection = gPythia->GetXsection();
2809  return;
2810  }
2811  }
2812  } else {
2813  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
2814  if(eventHeader){
2815  TString eventHeaderName = eventHeader->ClassName();
2816  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0 || eventHeaderName.Contains("Pythia8Jets")){
2817  AliGenPythiaEventHeader* gPythia = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader);
2818  NTrials = gPythia->Trials();
2819  XSection = gPythia->GetXsection();
2820  return;
2821  }
2822  }
2823  }
2824 
2825  NTrials = -1;
2826  XSection = -1;
2827  return;
2828 }
2829 
2830 
2831 //________________________________________________________________________
2832 // Analysing Jet-Jet MC's
2833 //________________________________________________________________________
2835  AliGenCocktailEventHeader *cHeader = 0x0;
2836  Bool_t headerFound = kFALSE;
2837 
2838  if ( fPeriodEnum != kLHC17g8a_fast && fPeriodEnum != kLHC17g8a_cent_woSDD && // LHC16qt pPb 5TeV JetJet MC's
2839  fPeriodEnum != kLHC17g8b && fPeriodEnum != kLHC17g8c && // LHC16sr pPb 8TeV JetJet MC's
2840  fPeriodEnum != kLHC16P1JJ && fPeriodEnum != kLHC16P1JJLowB && // LHC16X Jet Jet MC's
2841  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
2842  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
2843  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
2844  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
2845  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
2846  fPeriodEnum != kLHC16c2 && fPeriodEnum != kLHC16c2_plus // LHC12 JetJet MC
2847  ) return -1;
2848 
2849  if(mcEvent){
2850  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
2851  if(cHeader) headerFound = kTRUE;
2852  }else{
2853  //no mcEvent available -> not running on MC
2854  return -1;
2855  }
2856 
2857  if(headerFound){
2858  TList *genHeaders = 0x0;
2859  if(cHeader) genHeaders = cHeader->GetHeaders();
2860  AliGenEventHeader* gh = 0;
2861  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
2862  gh = (AliGenEventHeader*)genHeaders->At(i);
2863  TString GeneratorName = gh->GetName();
2864  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0 || GeneratorName.Contains("Pythia8Jets")){
2865  return dynamic_cast<AliGenPythiaEventHeader*>(gh)->GetPtHard();
2866  }
2867  }
2868  } else {
2869  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
2870  if(eventHeader){
2871  TString eventHeaderName = eventHeader->ClassName();
2872  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0 || eventHeaderName.Contains("Pythia8Jets")){
2873  return dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->GetPtHard();
2874  }
2875  }
2876  }
2877 
2878  return -1;
2879 }
2880 
2881 
2882 //________________________________________________________________________
2884  // abort if mimicing not enabled
2885 
2886  if (!fMimicTrigger) return kTRUE;
2887 
2888  Int_t runRangesEMCalL0 [35] = { 144871, 145288, 146375, 146382, // LHC11a
2889  146502, 148522, // LHC11a
2890  150209, 153056, 153911, 153915, // LHC11b,c,d
2891  158135, 158136, 158178, 158182, 160683,
2892  160764, 161139, 161256, 161379, 161457,
2893  161525, 161556, 161558, 161609, 161630,
2894  161724, // LHC11d,e
2895  173731, 177144, 177147, 177653, 177724, 178327,
2896  195180, // LHC13b-f
2897  197469, 197692 // LHC13g
2898  };
2899 
2900  Double_t thresholdEMCalL0[34] = { 2.11, 3.43, 1.71, 2.05, // LHC11a 7 TeV
2901  3.43, // LHC11a 2.76TeV
2902  1.94, 3.39, 4.01, 5.25, 5.5, // LHC11b, LHC11c, LHC11d
2903  2.05, 5.50, 2.05, 5.50, 2.05, 1.71, 5.50, 1.71, 5.50, 1.71, 5.50, 1.71, 5.50, 1.71, 5.50, 1.71,
2904  2.01, 1.75, 1.52, 2.01, 1.52, 1.85,
2905  3.2,
2906  /*2.01*/1.8
2907  };
2908  Double_t spreadEMCalL0[34] = { 0., 0., 0, 0, // LHC11a 7TeV
2909  /*0.7*/0.65, // LHC11a 2.76TeV
2910  0., 0., 0., 0., 0., // LHC11b, LHC11c, LHC11d
2911  0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
2912  0., 0., 0., 0., 0.2, 0.2,/*0.,0.,*/
2913  0.1,
2914  /*0.1*/0.12
2915  };
2916 
2917  Int_t runRangesEMCalL1[4] = { 179796, // LHC12c-i
2918  195180, // LHC13b-f
2919  197469, 197692 // LHC13g
2920  };
2921 
2922  Double_t thresholdEMCalL1[3] = { 9.5/*8.398*/, 11.5, /*6.*/5.5};
2923  Double_t spreadEMCalL1[3] = { 1.0/*0.*/, 0.5, /*0.4*/0.6};
2924 
2925  Int_t runRangesEMCalL1G2[3] = { 195180, // LHC13b-f
2926  197469, 197692 // LHC13g
2927  };
2928 
2929  Double_t thresholdEMCalL1G2[2] = { 7.2, /*3.9*/3.75};
2930  Double_t spreadEMCalL1G2[2] = { 0.3, /*0.2*/0.25};
2931 
2932  Int_t runnumber = event->GetRunNumber();
2933 
2934  if (fSpecialTrigger == 5 ){
2935  if (runnumber < runRangesEMCalL0[0]) return kTRUE;
2936  Int_t binRun = 0;
2937  while (!(runnumber >= runRangesEMCalL0[binRun] && runnumber < runRangesEMCalL0[binRun+1] ) && binRun < 34 ){
2938 // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL0[binRun] << "\t" << runRangesEMCalL0[binRun+1] << endl;
2939  binRun++;
2940  }
2941  if (binRun==34) return kFALSE;
2942  Double_t threshold = thresholdEMCalL0[binRun];
2943 
2944  if (isMC && spreadEMCalL0[binRun] != 0.){
2945  TF1* triggerSmearing = new TF1("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
2946  triggerSmearing->SetParameter(0, 1/(spreadEMCalL0[binRun]*TMath::Sqrt(TMath::Pi()*2)));
2947  triggerSmearing->SetParameter(1, thresholdEMCalL0[binRun]);
2948  triggerSmearing->SetParameter(2, spreadEMCalL0[binRun]);
2949  threshold = triggerSmearing->GetRandom();
2950  delete triggerSmearing;
2951  }
2952 
2953 // cout << runnumber << "\t"<< binRun << "\t"<< threshold << endl;
2954 
2955  Int_t nclus = 0;
2956  nclus = event->GetNumberOfCaloClusters();
2957 
2958  if(nclus == 0) return kFALSE;
2959 
2960  // Loop over EMCal clusters
2961  Bool_t eventIsAccepted = kFALSE;
2962  for(Int_t i = 0; i < nclus; i++){
2963  AliVCluster* clus = NULL;
2964  clus = event->GetCaloCluster(i);
2965  if (!clus) continue;
2966  if (!clus->IsEMCAL()) continue;
2967  if (clus->GetM02()<0.1) continue;
2968  if (clus->GetNCells()<2) continue;
2969  if (clus->E() > threshold ){
2970 // cout << "found L0" << endl;
2971  eventIsAccepted = kTRUE;
2972  }
2973  }
2974  return eventIsAccepted;
2975 
2976  } else if (fSpecialTrigger == 6 ) {
2977 
2978  return kTRUE;
2979  } else if (fSpecialTrigger == 8 ) {
2980  if (fSpecialSubTriggerName.CompareTo("7EGA")==0 || fSpecialSubTriggerName.CompareTo("8EGA")==0 || fSpecialSubTriggerName.CompareTo("7EG1")==0 ||fSpecialSubTriggerName.CompareTo("8EG1")==0 ){
2981  if (runnumber < runRangesEMCalL1[0]) return kTRUE;
2982  Int_t binRun = 0;
2983  while (!(runnumber >= runRangesEMCalL1[binRun] && runnumber < runRangesEMCalL1[binRun+1] ) && binRun < 3 ){
2984  // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL0[binRun] << "\t" << runRangesEMCalL0[binRun+1] << endl;
2985  binRun++;
2986  }
2987  if (binRun==3) return kFALSE;
2988  Double_t threshold = thresholdEMCalL1[binRun];
2989 
2990  if (isMC && spreadEMCalL1[binRun] != 0.){
2991  TF1* triggerSmearing = new TF1("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
2992  triggerSmearing->SetParameter(0, 1/(spreadEMCalL1[binRun]*TMath::Sqrt(TMath::Pi()*2)));
2993  triggerSmearing->SetParameter(1, thresholdEMCalL1[binRun]);
2994  triggerSmearing->SetParameter(2, spreadEMCalL1[binRun]);
2995  threshold = triggerSmearing->GetRandom();
2996  delete triggerSmearing;
2997  }
2998 
2999 // cout << runnumber << "\t"<< binRun << "\t L1 \t"<< threshold << endl;
3000 
3001  Int_t nclus = 0;
3002  nclus = event->GetNumberOfCaloClusters();
3003 
3004  if(nclus == 0) return kFALSE;
3005 
3006  // Loop over EMCal clusters
3007  Bool_t eventIsAccepted = kFALSE;
3008  for(Int_t i = 0; i < nclus; i++){
3009  AliVCluster* clus = NULL;
3010  clus = event->GetCaloCluster(i);
3011  if (!clus) continue;
3012  if (!clus->IsEMCAL()) continue;
3013  if (clus->GetM02()<0.1) continue;
3014  if (clus->GetNCells()<2) continue;
3015  if (clus->E() > threshold ){
3016 // cout << "found L1G1" << endl;
3017  eventIsAccepted = kTRUE;
3018  }
3019  }
3020  return eventIsAccepted;
3021  } else if ( fSpecialSubTriggerName.CompareTo("7EG2")==0 ||fSpecialSubTriggerName.CompareTo("8EG2")==0 ){
3022  if (runnumber < runRangesEMCalL1G2[0]) return kTRUE;
3023  Int_t binRun = 0;
3024  while (!(runnumber >= runRangesEMCalL1G2[binRun] && runnumber < runRangesEMCalL1G2[binRun+1] ) && binRun < 2 ){
3025  // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL0[binRun] << "\t" << runRangesEMCalL0[binRun+1] << endl;
3026  binRun++;
3027  }
3028  if (binRun==2) return kFALSE;
3029  Double_t threshold = thresholdEMCalL1G2[binRun];
3030  if (isMC && spreadEMCalL1G2[binRun] != 0.){
3031  TF1* triggerSmearing = new TF1("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
3032  triggerSmearing->SetParameter(0, 1/(spreadEMCalL1G2[binRun]*TMath::Sqrt(TMath::Pi()*2)));
3033  triggerSmearing->SetParameter(1, thresholdEMCalL1G2[binRun]);
3034  triggerSmearing->SetParameter(2, spreadEMCalL1G2[binRun]);
3035  threshold = triggerSmearing->GetRandom();
3036  delete triggerSmearing;
3037  }
3038 // cout << runnumber << "\t"<< binRun << "\t L2 \t"<< threshold << endl;
3039 
3040  Int_t nclus = 0;
3041  nclus = event->GetNumberOfCaloClusters();
3042 
3043  if(nclus == 0) return kFALSE;
3044 
3045  // Loop over EMCal clusters
3046  Bool_t eventIsAccepted = kFALSE;
3047  for(Int_t i = 0; i < nclus; i++){
3048  AliVCluster* clus = NULL;
3049  clus = event->GetCaloCluster(i);
3050  if (!clus) continue;
3051  if (!clus->IsEMCAL()) continue;
3052  if (clus->GetM02()<0.1) continue;
3053  if (clus->GetNCells()<2) continue;
3054  if (clus->E() > threshold ){
3055 // cout << "found L1G2" << endl;
3056  eventIsAccepted = kTRUE;
3057  }
3058  }
3059  return eventIsAccepted;
3060  }
3061  return kTRUE;
3062  } else if (fSpecialTrigger == 9 ) {
3063  return kTRUE;
3064  } else {
3065  return kTRUE;
3066  }
3067 
3068  return kTRUE;
3069 }
3070 
3071 
3072 //________________________________________________________________________
3074 {
3075 
3076  AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
3077 
3078 
3079  UInt_t isSelected = AliVEvent::kAny;
3080 
3081  if (fInputHandler==NULL) return kFALSE;
3082  if( fInputHandler->GetEventSelection() || event->IsA()==AliAODEvent::Class()) {
3083 
3084  TString firedTrigClass = event->GetFiredTriggerClasses();
3085  // if no trigger has been selected manually, select kAny in case of presel (also important for AOD filtering!)
3086  // in other cases select standards depending on system
3088  if (fPreSelCut) fOfflineTriggerMask = AliVEvent::kAny;
3089  else {
3090  if (fIsHeavyIon == 1){
3091  fOfflineTriggerMask = AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral;
3092  } else if (fIsHeavyIon == 2){
3093  fOfflineTriggerMask = AliVEvent::kINT7;
3094  } else {
3095  fOfflineTriggerMask = AliVEvent::kMB;
3096  }
3097  }
3098  }
3099 
3100  // in case of MC switch to kAny if no MB/INT7/INT8 has been selected
3101  if(isMC){
3102  if( fIsHeavyIon == 0){
3103  if( fOfflineTriggerMask != AliVEvent::kMB && fOfflineTriggerMask != AliVEvent::kINT7 && fOfflineTriggerMask != AliVEvent::kINT8 ){
3104  fOfflineTriggerMask = AliVEvent::kAny;
3105  }
3106  }else{
3107  fOfflineTriggerMask = AliVEvent::kAny;
3108  }
3109  }
3110 
3111  if (fOfflineTriggerMask){
3112  isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
3113  if (isSelected && !fPreSelCut){
3114 // cout << firedTrigClass.Data() << endl;
3115 // cout << "Special trigger: "<< fSpecialTrigger << " initialized " << fEMCALTrigInitialized << endl;
3116 // if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9){ // EMCAL triggers
3117 // if (!fEMCALTrigInitialized ) InitializeEMCALTrigger(event);
3118 // fTriggersEMCAL= GetTriggerList();
3119 // }
3120  if (fSpecialSubTrigger>0 && !isMC){
3121  if (!firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 0;
3122  if (fRejectTriggerOverlap){
3123  // trigger rejection EMC1,7,8
3124  if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CEMC7") == 0){
3125  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3126  } else if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CEMC1") == 0){
3127  if (fInputHandler->IsEventSelected() & AliVEvent::kMB) isSelected = 0;
3128  } else if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CEMC8") == 0){
3129  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3130  }
3131  // trigger rejection EGA
3132  if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EGA") == 0){
3133  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3134  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3135  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EGA") == 0){
3136  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3137  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3138  }
3139  // trigger rejection EG1 & EG2
3140  if (fPeriodEnum == kLHC13g){
3141  // EG1 is the trigger with the highest threshold
3142  if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EG1") == 0){
3143 // cout << firedTrigClass.Data() << endl;
3144  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3145 // cout << "INT7? " << isSelected << endl;
3146  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3147 // cout << "CEM7? " << isSelected << endl;
3148  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
3149 // cout << "7EG2? " << isSelected << endl;
3150  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EG1") == 0){
3151  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3152  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3153  if (firedTrigClass.Contains("8EG2")) isSelected = 0;
3154  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EG2") == 0){
3155 // cout << firedTrigClass.Data() << endl;
3156  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3157 // cout << "INT7? " << isSelected << endl;
3158  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3159 // cout << "CEM7? " << isSelected << endl;
3160  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EG2") == 0){
3161  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3162  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3163  }
3164  } else {
3165  // EG2 is the trigger with the highest threshold
3166  if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EG2") == 0){
3167  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3168  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3169  if (firedTrigClass.Contains("7EG1")) isSelected = 0;
3170  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EG2") == 0){
3171  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3172  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3173  if (firedTrigClass.Contains("8EG1")) isSelected = 0;
3174  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EG1") == 0){
3175  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3176  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3177  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EG1") == 0){
3178  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3179  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3180  }
3181  }
3182  }
3183  if (isSelected != 0 ){
3184 // cout << "I am here" << " :" << fSpecialSubTriggerName.Data() <<endl;
3185  if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9 ){
3187  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassesCorrelated->Fill(0);
3188  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassesCorrelated->Fill(1);
3189  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassesCorrelated->Fill(2);
3190  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassesCorrelated->Fill(3);
3191  if (firedTrigClass.Contains("7EJE") || firedTrigClass.Contains("8EJE")) hTriggerClassesCorrelated->Fill(4);
3192  if (firedTrigClass.Contains("7EJ1") || firedTrigClass.Contains("8EJ1")) hTriggerClassesCorrelated->Fill(5);
3193  if (firedTrigClass.Contains("7EJ2") || firedTrigClass.Contains("8EJ2")) hTriggerClassesCorrelated->Fill(6);
3194  if (firedTrigClass.Contains("7EGA") || firedTrigClass.Contains("8EGA")) hTriggerClassesCorrelated->Fill(7);
3195  if (firedTrigClass.Contains("7EG1") || firedTrigClass.Contains("8EG1")) hTriggerClassesCorrelated->Fill(8);
3196  if (firedTrigClass.Contains("7EG2") || firedTrigClass.Contains("8EG2")) hTriggerClassesCorrelated->Fill(9);
3197  }
3198  }
3199  }
3200 
3201  } else if (isMC){
3202  if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9){ // EMCAL triggers
3203 // isSelected = 0;
3204 // if (fTriggersEMCAL > 0)cout << "Special Trigger " << fSpecialTrigger << " triggers: " << fTriggersEMCAL << " selected triggers: " << fTriggersEMCALSelected << " run number: " <<event->GetRunNumber()<<endl;
3205 // if (fTriggersEMCAL&fTriggersEMCALSelected){
3206 // cout << "accepted ++++++++++++++++++++" << endl;
3207  isSelected = 1;
3208 // }
3209  }
3210  }
3211  //if for specific centrality trigger selection
3212  if(fSpecialSubTrigger == 1){
3213  if(fSpecialSubTriggerName.Contains("|") && GetCentrality(event) <= 10.){
3214  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("|");
3215  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
3216  TObjString *NameClass = (TObjString*)ClassesList->At(i);
3217  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
3218  }
3219  } else if(fSpecialSubTriggerName.Contains("%")){
3220  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("%");
3221  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
3222  TObjString *NameClass = (TObjString*)ClassesList->At(i);
3223  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
3224  }
3225  } else if(fSpecialSubTriggerName.Contains("@")){
3226  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("@");
3227  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
3228  TObjString *NameClass = (TObjString*)ClassesList->At(i);
3229  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
3230  }
3231  } else if(fSpecialSubTriggerName.Contains("&")){ //logic AND of two classes
3232  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("&");
3233  TString CheckClass = "";
3234  for (Int_t i=0; i<ClassesList->GetEntriesFast(); i++){
3235  TObjString *NameClass = (TObjString*)ClassesList->At(i);
3236  if (firedTrigClass.Contains(NameClass->GetString())) CheckClass+="1";
3237  else CheckClass+="0";
3238  }
3239  if(CheckClass.Contains("0")) isSelected = 0;
3240  }
3241  else if(firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 1;
3242  }
3243  }
3244  }
3245  }
3246  fIsSDDFired = !(fInputHandler->IsEventSelected() & AliVEvent::kFastOnly);
3247 
3248  Bool_t mimickedTrigger = kTRUE;
3249  if (fMimicTrigger) mimickedTrigger = MimicTrigger(event, isMC);
3250 // cout << "mimicked decision \t" << mimickedTrigger << "expect decision? "<< fMimicTrigger<< endl;
3251 
3252  // Fill Histogram
3253  if(hTriggerClass){
3254  if (fIsSDDFired) hTriggerClass->Fill(33);
3255  if (mimickedTrigger){
3256  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(0);
3257  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClass->Fill(1);
3258  if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClass->Fill(2);
3259  if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClass->Fill(3);
3260  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClass->Fill(4);
3261  if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5);
3262  if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6);
3263  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6);
3264  if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClass->Fill(7);
3265  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClass->Fill(7);
3266  if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClass->Fill(8);
3267  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClass->Fill(8);
3268  if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClass->Fill(9);
3269  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClass->Fill(9);
3270  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClass->Fill(10);
3271  // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClass->Fill(10);
3272  if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClass->Fill(11);
3273  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClass->Fill(12);
3274  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClass->Fill(13);
3275  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClass->Fill(13);
3276  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClass->Fill(13);
3277  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClass->Fill(14);
3278  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClass->Fill(15);
3279  if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(16);
3280  if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(17);
3281  if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClass->Fill(18);
3282  if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClass->Fill(19);
3283  if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClass->Fill(20);
3284  // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClass->Fill(20);
3285  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClass->Fill(21);
3286  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClass->Fill(22);
3287  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClass->Fill(23);
3288  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClass->Fill(24);
3289  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClass->Fill(25);
3290  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClass->Fill(26);
3291  if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClass->Fill(27);
3292  if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClass->Fill(28);
3293  if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClass->Fill(29);
3294  if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClass->Fill(30);
3295  if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(31);
3296  if (!fInputHandler->IsEventSelected()) hTriggerClass->Fill(34);
3297  }
3298  if (mimickedTrigger && fMimicTrigger) hTriggerClass->Fill(35);
3299  }
3300 
3301  if(hTriggerClassSelected && isSelected){
3302  if (mimickedTrigger){
3303  if (!fIsSDDFired) hTriggerClassSelected->Fill(33);
3304  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassSelected->Fill(0);
3305  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassSelected->Fill(1);
3306  if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClassSelected->Fill(2);
3307  if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClassSelected->Fill(3);
3308  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassSelected->Fill(4);
3309  if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClassSelected->Fill(5);
3310  if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClassSelected->Fill(6);
3311  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClassSelected->Fill(6);
3312  if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClassSelected->Fill(7);
3313  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClassSelected->Fill(7);
3314  if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClassSelected->Fill(8);
3315  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClassSelected->Fill(8);
3316  if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClassSelected->Fill(9);
3317  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClassSelected->Fill(9);
3318  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassSelected->Fill(10);
3319  // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClassSelected->Fill(10);
3320  if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClassSelected->Fill(11);
3321  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClassSelected->Fill(12);
3322  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClassSelected->Fill(13);
3323  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClassSelected->Fill(13);
3324  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClassSelected->Fill(13);
3325  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClassSelected->Fill(14);
3326  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClassSelected->Fill(15);
3327  if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClassSelected->Fill(16);
3328  if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClassSelected->Fill(17);
3329  if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClassSelected->Fill(18);
3330  if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClassSelected->Fill(19);
3331  if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClassSelected->Fill(20);
3332  // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClassSelected->Fill(20);
3333  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClassSelected->Fill(21);
3334  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClassSelected->Fill(22);
3335  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClassSelected->Fill(23);
3336  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClassSelected->Fill(24);
3337  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClassSelected->Fill(25);
3338  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClassSelected->Fill(26);
3339  if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClassSelected->Fill(27);
3340  if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClassSelected->Fill(28);
3341  if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClassSelected->Fill(29);
3342  if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClassSelected->Fill(30);
3343  if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClassSelected->Fill(31);
3344  }
3345  if (mimickedTrigger && fMimicTrigger) hTriggerClassSelected->Fill(34);
3346  }
3347 
3348  if(!isSelected)return kFALSE;
3349  if (fMimicTrigger)
3350  if (!mimickedTrigger ) return kFALSE;
3351  return kTRUE;
3352 
3353 }
3354 
3355 //________________________________________________________________________
3357  // returns TString with current cut number
3358  return fCutStringRead;
3359 }
3360 
3361 //________________________________________________________________________
3362 void AliConvEventCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *event){
3363 
3364  if(fNotRejectedStart){
3365  delete[] fNotRejectedStart;
3366  fNotRejectedStart = NULL;
3367  }
3368  if(fNotRejectedEnd){
3369  delete[] fNotRejectedEnd;
3370  fNotRejectedEnd = NULL;
3371  }
3372  if(fGeneratorNames){
3373  delete[] fGeneratorNames;
3374  fGeneratorNames = NULL;
3375  }
3376 
3377  if(rejection == 0) return; // No Rejection
3378 
3379  AliGenCocktailEventHeader *cHeader = 0x0;
3380  AliAODMCHeader *cHeaderAOD = 0x0;
3381  Bool_t headerFound = kFALSE;
3382  AliMCEvent *fMCEvent = 0x0;
3383  TClonesArray *fMCEventAOD = 0x0;
3384  if(event->IsA()==AliMCEvent::Class()){
3385  if(dynamic_cast<AliMCEvent*>(event)){
3386  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(event)->GenEventHeader());
3387  fMCEvent = dynamic_cast<AliMCEvent*>(event);
3388  if(cHeader) headerFound = kTRUE;
3389  }
3390  }
3391  if(event->IsA()==AliAODEvent::Class()){ // event is a AODEvent in case of AOD
3392  cHeaderAOD = dynamic_cast<AliAODMCHeader*>(event->FindListObject(AliAODMCHeader::StdBranchName()));
3393  fMCEventAOD = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
3394  if(cHeaderAOD) headerFound = kTRUE;
3395  }
3396 
3397  if (fDebugLevel > 0 ) cout << "event starts here" << endl;
3398  if(headerFound){
3399  TList *genHeaders = 0x0;
3400  if(cHeader) genHeaders = cHeader->GetHeaders();
3401  if(cHeaderAOD){
3402  genHeaders = cHeaderAOD->GetCocktailHeaders();
3403  if(genHeaders->GetEntries()==1){
3405  return;
3406  }
3407  }
3408  AliGenEventHeader* gh = 0;
3409  fnHeaders = 0;
3410  Int_t firstindexA = 0;
3411  Int_t lastindexA = -1;
3412  if(rejection == 1 || rejection == 3) fnHeaders = 1; // MinBiasHeader
3413  if(rejection == 2){ // TList of Headers Names
3414  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3415  gh = (AliGenEventHeader*)genHeaders->At(i);
3416  TString GeneratorName = gh->GetName();
3417  lastindexA = lastindexA + gh->NProduced();
3418 // if (fDebugLevel > 0 ) cout << i << "\t" << GeneratorName.Data() << endl;
3419  for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3420  TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3421 // if (fDebugLevel > 0 ) cout << GeneratorInList.Data() << endl;
3422  if(GeneratorName.CompareTo(GeneratorInList) == 0){
3423 // if (fDebugLevel > 0 ) cout << "accepted" << endl;
3424  if (GeneratorInList.CompareTo("PARAM") == 0 || GeneratorInList.CompareTo("BOX") == 0 ){
3425  if(fMCEvent){
3426  if (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c ){
3427  if (fMCEvent->Particle(firstindexA)->GetPdgCode() == fAddedSignalPDGCode ) {
3428  if (gh->NProduced() > 10 && fMCEvent->Particle(firstindexA+10)->GetPdgCode() == fAddedSignalPDGCode ){
3429 // if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
3430  fnHeaders++;
3431  continue;
3432  }
3433  continue;
3434  }
3435  } else {
3436 // if (fDebugLevel > 0 ) cout << "cond 2: " << fnHeaders << endl;
3437  fnHeaders++;
3438  continue;
3439  }
3440  }
3441  if ( fMCEventAOD){
3442  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindexA));
3443  if (aodMCParticle && (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c) ){
3444  if ( aodMCParticle->GetPdgCode() == fAddedSignalPDGCode ){
3445  if (gh->NProduced() > 10){
3446  AliAODMCParticle *aodMCParticle2 = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindexA+10));
3447  if ( aodMCParticle2->GetPdgCode() == fAddedSignalPDGCode ){
3448 // if (fDebugLevel > 0 ) cout << "cond 1: " << fnHeaders << endl;
3449  fnHeaders++;
3450  continue;
3451  }
3452  }
3453  continue;
3454  }
3455  } else {
3456 // if (fDebugLevel > 0 ) cout << "cond 2: " << fnHeaders << endl;
3457  fnHeaders++;
3458  continue;
3459  }
3460  }
3461  continue;
3462  }
3463 // if (fDebugLevel > 0 ) cout << "cond 3: "<< fnHeaders << endl;
3464  fnHeaders++;
3465  continue;
3466  }
3467  }
3468  firstindexA = firstindexA + gh->NProduced();
3469  }
3470  }
3471  if (fDebugLevel > 0 ) cout << "number of headers: " <<fnHeaders << endl;
3472 
3476 
3477  if(rejection == 1 || rejection == 3){
3478  fNotRejectedStart[0] = 0;
3479  fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced()-1;
3480  fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName();
3481  if (fDebugLevel > 0 ) cout << 0 << "\t" <<fGeneratorNames[0] << "\t" << fNotRejectedStart[0] << "\t" <<fNotRejectedEnd[0] << endl;
3482  return;
3483  }
3484 
3485  Int_t firstindex = 0;
3486  Int_t lastindex = -1;
3487  Int_t number = 0;
3488 
3489  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3490  gh = (AliGenEventHeader*)genHeaders->At(i);
3491  TString GeneratorName = gh->GetName();
3492  lastindex = lastindex + gh->NProduced();
3493  if (fDebugLevel > 0 ) cout << i << "\t" << GeneratorName.Data() << endl;
3494  for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3495  TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3496  if(GeneratorName.CompareTo(GeneratorInList) == 0){
3497  if (GeneratorInList.CompareTo("PARAM") == 0 || GeneratorInList.CompareTo("BOX") == 0 ){
3498  if(fMCEvent){
3499  if (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c ){
3500  if (fMCEvent->Particle(firstindex)->GetPdgCode() == fAddedSignalPDGCode ) {
3501 // if (fDebugLevel > 0 ) cout << "produced " << gh->NProduced() << " with box generator" << endl;
3502  if (gh->NProduced() > 10 && fMCEvent->Particle(firstindex+10)->GetPdgCode() == fAddedSignalPDGCode){
3503 // if (fDebugLevel > 0 ) cout << "one of them was a pi0 or eta" << endl;
3504  fNotRejectedStart[number] = firstindex;
3505  fNotRejectedEnd[number] = lastindex;
3506  fGeneratorNames[number] = GeneratorName;
3507  number++;
3508 // if (fDebugLevel > 0 ) cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
3509  continue;
3510  }
3511  }
3512  } else {
3513  fNotRejectedStart[number] = firstindex;
3514  fNotRejectedEnd[number] = lastindex;
3515  fGeneratorNames[number] = GeneratorName;
3516  number++;
3517  continue;
3518  }
3519  }
3520  if ( fMCEventAOD){
3521  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindex));
3522  if (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c ){
3523  if ( aodMCParticle->GetPdgCode() == fAddedSignalPDGCode ){
3524  if (gh->NProduced() > 10) {
3525  AliAODMCParticle *aodMCParticle2 = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindex+10));
3526  if ( aodMCParticle2->GetPdgCode() == fAddedSignalPDGCode ){
3527  fNotRejectedEnd[number] = lastindex;
3528  fNotRejectedStart[number] = firstindex;
3529  fGeneratorNames[number] = GeneratorName;
3530  number++;
3531  }
3532  continue;
3533  }
3534  }
3535  } else {
3536  fNotRejectedStart[number] = firstindex;
3537  fNotRejectedEnd[number] = lastindex;
3538  fGeneratorNames[number] = GeneratorName;
3539  number++;
3540  continue;
3541  }
3542  }
3543  continue;
3544  } else {
3545  fNotRejectedStart[number] = firstindex;
3546  fNotRejectedEnd[number] = lastindex;
3547  fGeneratorNames[number] = GeneratorName;
3548 // if (fDebugLevel > 0 ) cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
3549  number++;
3550  continue;
3551  }
3552 
3553  }
3554  }
3555  firstindex = firstindex + gh->NProduced();
3556  }
3557  if (fDebugLevel > 0 ) {
3558  for (Int_t i = 0; i < number; i++){
3559  cout << i << "\t" <<fGeneratorNames[i] << "\t" << fNotRejectedStart[i] << "\t" <<fNotRejectedEnd[i] << endl;
3560  }
3561  }
3562  } else { // No Cocktail Header Found
3563  fNotRejectedStart = new Int_t[1];
3564  fNotRejectedEnd = new Int_t[1];
3565 
3566  fnHeaders = 1;
3567  fNotRejectedStart[0] = 0;
3568  fNotRejectedEnd[0] = static_cast<AliMCEvent*>(event)->GetNumberOfPrimaries()-1;
3569  if (rejection > 1){
3570  fNotRejectedStart[0] = -1;
3571  fNotRejectedEnd[0] = -1;
3572  }
3573 
3574  fGeneratorNames = new TString[1];
3575  fGeneratorNames[0] = "NoCocktailGeneratorFound";
3576 // SetRejectExtraSignalsCut(0);
3577  }
3578 
3579 }
3580 
3581 //_________________________________________________________________________
3582 Int_t AliConvEventCuts::IsParticleFromBGEvent(Int_t index, AliMCEvent *mcEvent, AliVEvent *InputEvent, Int_t debug ){
3583 
3584  // if (debug > 2 ) cout << index << endl;
3585  if(index < 0) return 0; // No Particle
3586 
3587  Int_t accepted = 0;
3588  if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){
3589  if(!mcEvent) return 0; // no mcEvent available, return 0
3590  if(index >= mcEvent->GetNumberOfPrimaries()){ // initial particle is secondary particle
3591  if( ((TParticle*)mcEvent->Particle(index))->GetMother(0) < 0) return 0; // material particle, return 0
3592  return IsParticleFromBGEvent(((TParticle*)mcEvent->Particle(index))->GetMother(0),mcEvent,InputEvent, debug);
3593  }
3594  for(Int_t i = 0;i<fnHeaders;i++){
3595  // if (debug > 2 ) cout << "header " << fGeneratorNames[i].Data() << ":"<< fNotRejectedStart[i] << "\t" << fNotRejectedEnd[i] << endl;
3596  if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
3597  if (debug > 1 ) cout << "accepted:" << index << "\t header " << fGeneratorNames[i].Data() << ": "<< fNotRejectedStart[i] << "\t" << fNotRejectedEnd[i] << endl;
3598  accepted = 1;
3599  if(i == 0) accepted = 2; // MB Header
3600  }
3601  }
3602  if (debug > 1 && !accepted) cout << "rejected:" << index << endl;
3603  }
3604  else if(InputEvent->IsA()==AliAODEvent::Class()){
3605  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3606  if (AODMCTrackArray){
3607  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
3608  if(!aodMCParticle) return 0; // no particle
3609  if(!aodMCParticle->IsPrimary()){
3610  if( aodMCParticle->GetMother() < 0) return 0;// material particle, return 0
3611  return IsParticleFromBGEvent(aodMCParticle->GetMother(),mcEvent,InputEvent, debug);
3612  }
3613  index = TMath::Abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index))->GetLabel());
3614  for(Int_t i = 0;i<fnHeaders;i++){
3615  if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
3616  accepted = 1;
3617  if(i == 0) accepted = 2; // MB Header
3618  }
3619  }
3620  }
3621  }
3622 
3623  return accepted;
3624 }
3625 
3626 //_________________________________________________________________________
3627 Int_t AliConvEventCuts::IsEventAcceptedByCut(AliConvEventCuts *ReaderCuts, AliVEvent *event, AliMCEvent *mcEvent, Int_t isHeavyIon, Bool_t isEMCALAnalysis){
3628 
3629  Bool_t isMC = kFALSE;
3630  if (mcEvent){isMC = kTRUE;}
3631 
3632  if ( !IsTriggerSelected(event, isMC) )
3633  return 3;
3634 
3635  if( !(IsCentralitySelected(event,mcEvent)))
3636  return 1; // Check Centrality --> Not Accepted => eventQuality = 1
3637 
3638  Bool_t hasV0And = ReaderCuts->HasV0AND();
3639  Bool_t isSDDFired = ReaderCuts->IsSDDFired();
3640 
3641  if( ( (IsSpecialTrigger() == 0 && IsSpecialSubTrigger() == 1) || (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 1) ) && !isSDDFired && !mcEvent)
3642  //if V0OR with SDD requested or V0AND with SDD request but the SDD has not fired
3643  return 7; // V0 with SDD requested but no fired
3644 
3645  if( ( (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 0) || (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 1) ) && !hasV0And)
3646  //if V0AND (only) or V0AND with SDD requested but V0AND requested but no fired
3647  return 8; // V0AND requested but no fired
3648 
3649 
3650  if( (IsSpecialTrigger() == 2 || IsSpecialTrigger() == 3) && !isSDDFired && !mcEvent)
3651  return 7; // With SDD requested but no fired
3652 
3653  if( (IsSpecialTrigger() == 1 || IsSpecialTrigger() == 3) && !hasV0And)
3654  return 8; // V0AND requested but no fired
3655 
3656  // Special EMCAL checks due to hardware issues in LHC11a
3657  if (isEMCALAnalysis || IsSpecialTrigger() == 5 || IsSpecialTrigger() == 8 || IsSpecialTrigger() == 9 ){
3658  Int_t runnumber = event->GetRunNumber();
3659  if ((runnumber>=144871) && (runnumber<=146860)) {
3660 
3661  AliVCaloCells *cells = event->GetEMCALCells();
3662  const Short_t nCells = cells->GetNumberOfCells();
3663 
3664  if (event->IsA()==AliESDEvent::Class()) AliAnalysisManager::GetAnalysisManager()->LoadBranch("EMCALCells.");
3665 
3666  AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
3667  if (!fInputHandler) return 3;
3668 
3669  // count cells above threshold
3670  Int_t nCellCount[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
3671  for(Int_t iCell=0; iCell<nCells; ++iCell) {
3672  Short_t cellId = cells->GetCellNumber(iCell);
3673  Double_t cellE = cells->GetCellAmplitude(cellId);
3674  Int_t sm = cellId / (24*48);
3675  if (cellE>0.1) ++nCellCount[sm];
3676  }
3677 
3678  Bool_t fIsLedEvent = kFALSE;
3679  if (nCellCount[4] > 100) {
3680  fIsLedEvent = kTRUE;
3681  } else {
3682  if ((runnumber>=146858) && (runnumber<=146860)) {
3683  if ((fInputHandler->IsEventSelected() & AliVEvent::kMB) && (nCellCount[3]>=21))
3684  fIsLedEvent = kTRUE;
3685  else if ((fInputHandler->IsEventSelected() & AliVEvent::kEMC1) && (nCellCount[3]>=35))
3686  fIsLedEvent = kTRUE;
3687  }
3688  }
3689  if (fIsLedEvent) {
3690  return 9;
3691  }
3692  }
3693  }
3694 
3695  // SPD clusters vs tracklets to check for pileup/background
3696  Int_t nClustersLayer0 = event->GetNumberOfITSClusters(0);
3697  Int_t nClustersLayer1 = event->GetNumberOfITSClusters(1);
3698  Int_t nTracklets = event->GetMultiplicity()->GetNumberOfTracklets();
3699  if(hSPDClusterTrackletBackgroundBefore) hSPDClusterTrackletBackgroundBefore->Fill(nTracklets, (nClustersLayer0 + nClustersLayer1));
3700 
3701 
3702  Double_t distZMax = 0;
3703  if(event->IsA()==AliESDEvent::Class()){
3704  Int_t nPileVert = ((AliESDEvent*)event)->GetNumberOfPileupVerticesSPD();
3705  if (hNPileupVertices) hNPileupVertices->Fill(nPileVert);
3706  if (nPileVert > 0){
3707  for(Int_t i=0; i<nPileVert;i++){
3708  const AliESDVertex* pv= ((AliESDEvent*)event)->GetPileupVertexSPD(i);
3709  Int_t nc2 = pv->GetNContributors();
3710  if(nc2>=3){
3711  Double_t z1 = ((AliESDEvent*)event)->GetPrimaryVertexSPD()->GetZ();
3712  Double_t z2 = pv->GetZ();
3713  Double_t distZ = z2-z1;
3714  if (TMath::Abs(distZMax) < TMath::Abs(distZ) ){
3715  distZMax = distZ;
3716  }
3717  }
3718  }
3719  if (hPileupVertexToPrimZ) hPileupVertexToPrimZ->Fill(distZMax);
3720  }
3721  }
3722  if(GetPastFutureLowBC()!=0 && GetPastFutureHighBC()!=0 ){
3723  if(IsOutOfBunchPileupPastFuture(event))
3724  return 12;
3725  }
3726 
3727  if( isHeavyIon != 2 && GetIsFromPileup()){
3728  if(event->IsPileupFromSPD(3,0.8,3.,2.,5.) ){
3730  return 6; // Check Pileup --> Not Accepted => eventQuality = 6
3731  }
3732  if (fUtils->IsSPDClusterVsTrackletBG(event)){
3734  return 11; // Check Pileup --> Not Accepted => eventQuality = 11
3735  }
3736  }
3737  if(isHeavyIon == 2 && GetIsFromPileup()){
3738  if(fUtils->IsPileUpEvent(event) ){
3740  return 6; // Check Pileup --> Not Accepted => eventQuality = 6
3741  }
3742  if (fUtils->IsSPDClusterVsTrackletBG(event)){
3744  return 11; // Check Pileup --> Not Accepted => eventQuality = 11
3745  }
3746  }
3747 
3749  if( IsPileUpV0MTPCout(event) ){
3750  return 13;
3751  }
3752  }
3753 
3754  if(hCentrality)hCentrality->Fill(GetCentrality(event));
3755 
3756  if(hVertexZ)hVertexZ->Fill(event->GetPrimaryVertex()->GetZ());
3757 // if(hCentralityVsNumberOfPrimaryTracks)
3758 // hCentralityVsNumberOfPrimaryTracks->Fill(GetCentrality(event),
3759 // ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()
3760 // ->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks());
3761 
3762  if(fIsHeavyIon == 1){
3763  AliEventplane *EventPlane = event->GetEventplane();
3764  fEventPlaneAngle = EventPlane->GetEventplane("V0",event,2);
3765  if(hEventPlaneAngle)hEventPlaneAngle->Fill(TMath::Abs(fEventPlaneAngle));
3766  }
3767  if(hSPDClusterTrackletBackground) hSPDClusterTrackletBackground->Fill(nTracklets, (nClustersLayer0 + nClustersLayer1));
3768 
3769  return 0;
3770 }
3771 
3772 
3773 //_________________________________________________________________________
3775 
3776  AliInfo("Inside the GetWeightForCentralityFlattening function");
3777  Double_t centrality = 0.;
3778  //obtain centrality for ESD or AOD
3779  if(!event || event->IsA()==AliESDEvent::Class()){
3780  AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
3781  if(esdEvent){
3782  AliCentrality *fESDCentrality=(AliCentrality*)esdEvent->GetCentrality();
3783  if(fDetectorCentrality==0 && fIsHeavyIon==1){
3784  centrality = fESDCentrality->GetCentralityPercentile("V0M"); // default for PbPb
3785  }
3786  }
3787  } else if(event->IsA()==AliAODEvent::Class()){
3788  AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
3789  if(aodEvent){
3790  if(aodEvent->GetHeader()){
3791  centrality = ((AliVAODHeader*)aodEvent->GetHeader())->GetCentrality();
3792  }
3793  }
3794  }
3795 
3796  //Get the maximum vlaue from the reference distribution and interpolated value
3797  Float_t GetValueForWeight = 1.;
3798  Float_t maximum = 1.;
3799  Double_t weightCentrality = 1.;
3800  Bool_t CorrCentrLoop = kFALSE;
3801 
3802  //depending on the value of the flag, flattening in different cent. range
3803  if ( fDoCentralityFlat == 1 && (centrality >= 0. && centrality <= 10.) ){
3804  GetValueForWeight = hCentralityNotFlat->Interpolate(centrality);
3805  maximum = hCentralityNotFlat->GetMaximum();
3806  CorrCentrLoop = kTRUE;
3807  } else if ( fDoCentralityFlat == 2 && (centrality >=10. && centrality <= 20.) ){
3808  GetValueForWeight = hCentralityNotFlat->Interpolate(centrality);
3809  maximum = hCentralityNotFlat->GetMaximum();
3810  CorrCentrLoop = kTRUE;
3811  } else if ( fDoCentralityFlat == 8 ){
3812  GetValueForWeight = hCentralityNotFlat->Interpolate(centrality);
3813  maximum = hCentralityNotFlat->GetMaximum();
3814  CorrCentrLoop = kTRUE;
3815  } else {
3816  CorrCentrLoop = kFALSE;
3817  }
3818 
3819  if (CorrCentrLoop && GetValueForWeight != 0. && maximum !=0. && isfinite(GetValueForWeight) && isfinite(maximum) ){
3820  weightCentrality = maximum/GetValueForWeight;
3821  if (!isfinite(GetValueForWeight)) weightCentrality = 1.;
3822  if (!isfinite(weightCentrality)) weightCentrality = 1.;
3823  }
3824 
3825  return weightCentrality;
3826 }
3827 
3828 //_________________________________________________________________________
3830 
3831  Double_t weightMult = 1.;
3832 
3833  Float_t valueMultData = -1.;
3834  Float_t valueMultMC = -1.;
3835 
3836  if (hReweightMultData == NULL || hReweightMultMC == NULL ) return weightMult;
3837 
3838  valueMultData = hReweightMultData->Interpolate(mult);
3839  valueMultMC = hReweightMultMC->Interpolate(mult);
3840 
3841  Float_t relativeErrorMC = hReweightMultMC->GetBinError(hReweightMultMC->FindBin(mult))/hReweightMultMC->GetBinContent(hReweightMultMC->FindBin(mult));
3842  Float_t relativeErrorData = hReweightMultData->GetBinError(hReweightMultData->FindBin(mult))/hReweightMultData->GetBinContent(hReweightMultData->FindBin(mult));
3843 
3844  if (relativeErrorData < 0.2 && relativeErrorMC < 0.2 ){
3845  if (isfinite(valueMultData) && isfinite(valueMultMC) ){
3846  weightMult = valueMultData/valueMultMC;
3847  }
3848  }
3849 
3850  return weightMult;
3851 }
3852 
3853 
3854 
3855 //_________________________________________________________________________
3856 Float_t AliConvEventCuts::GetWeightForMeson(Int_t index, AliMCEvent *mcEvent, AliVEvent *event){
3857  if (!( fPeriodEnum == kLHC13d2 || fPeriodEnum == kLHC13d2b || // LHC10h MCs
3858  fPeriodEnum == kLHC14a1a || fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c || // LHC11h MCs
3859  fPeriodEnum == kLHC13e7 || fPeriodEnum == kLHC13b2_efix || fPeriodEnum == kLHC14b2 || // LHC13bc MCs
3860  fPeriodEnum == kLHC14e2a || fPeriodEnum == kLHC14e2b || fPeriodEnum == kLHC14e2c || // LHC12[a-i] pass 1 MCs
3861  fPeriodEnum == kLHC12f1a || fPeriodEnum == kLHC12f1b || fPeriodEnum == kLHC12i3 // LHC11a MCs
3862  ) ) return 1.;
3863  Int_t kCaseGen = 0;
3864 
3865  if(index < 0) return 0; // No Particle
3866 
3867  if (IsParticleFromBGEvent(index, mcEvent, event)){
3870  kCaseGen = 1;
3871  }
3872  }
3873  if (kCaseGen == 0) return 1;
3874 
3875  Double_t mesonPt = 0;
3876  //Double_t mesonMass = 0;
3877  Int_t PDGCode = 0;
3878  if(!event || event->IsA()==AliESDEvent::Class()){
3879  mesonPt = ((TParticle*)mcEvent->Particle(index))->Pt();
3880  //mesonMass = ((TParticle*)mcEvent->Particle(index))->GetCalcMass();
3881  PDGCode = ((TParticle*)mcEvent->Particle(index))->GetPdgCode();
3882  } else if(event->IsA()==AliAODEvent::Class()){
3883  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
3884  if (AODMCTrackArray){
3885  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
3886  mesonPt = aodMCParticle->Pt();
3887  //mesonMass = aodMCParticle->GetCalcMass();
3888  PDGCode = aodMCParticle->GetPdgCode();
3889  } else {
3890  return 1;
3891  }
3892  }
3893 
3894  Float_t functionResultMC = 1.;
3895  if ( PDGCode == 111 && fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0){
3896  functionResultMC = hReweightMCHistPi0->Interpolate(mesonPt);
3897  }
3898  if ( PDGCode == 221 && fDoReweightHistoMCEta && hReweightMCHistEta!= 0x0){
3899  functionResultMC = hReweightMCHistEta->Interpolate(mesonPt);
3900  }
3901  if ( PDGCode == 310 && fDoReweightHistoMCK0s && hReweightMCHistK0s!= 0x0){
3902  functionResultMC = hReweightMCHistK0s->Interpolate(mesonPt);
3903  }
3904 
3905  Float_t functionResultData = 1;
3906  if ( PDGCode == 111 && fDoReweightHistoMCPi0 && fFitDataPi0!= 0x0){
3907  functionResultData = fFitDataPi0->Eval(mesonPt);
3908  }
3909  if ( PDGCode == 221 && fDoReweightHistoMCEta && fFitDataEta!= 0x0){
3910  functionResultData = fFitDataEta->Eval(mesonPt);
3911  }
3912  if ( PDGCode == 310 && fDoReweightHistoMCK0s && fFitDataK0s!= 0x0){
3913  functionResultData = fFitDataK0s->Eval(mesonPt);
3914  }
3915 
3916  Double_t weight = 1;
3917  if (PDGCode == 111 || PDGCode == 221){
3918  if (functionResultData != 0. && functionResultMC != 0. && isfinite(functionResultData) && isfinite(functionResultMC)){
3919  weight = functionResultData/functionResultMC;
3920  if ( kCaseGen == 3){
3921  if (PDGCode == 111){
3922  if (!(fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0 && PDGCode == 111)){
3923  weight = 1.;
3924  }
3925  }
3926  if (PDGCode == 221){
3927  if (!(fDoReweightHistoMCEta && hReweightMCHistEta!= 0x0 && PDGCode == 221)){
3928  weight = 1.;
3929  }
3930  }
3931  }
3932  if (!isfinite(functionResultData)) weight = 1.;
3933  if (!isfinite(weight)) weight = 1.;
3934  }
3935  } else if (PDGCode == 310 && functionResultMC != 0 && isfinite(functionResultMC)){
3936  weight = functionResultMC;
3937  }
3938  return weight;
3939 }
3940 
3941 
3944 
3945  if( fPeriodEnum == kLHC13bc || // mainly minimum bias
3946  fPeriodEnum == kLHC13de || // mainly triggered
3947  fPeriodEnum == kLHC13b4_fix || fPeriodEnum == kLHC13b4_plus || // MC Pythia 6 (Jet-Jet), anchor LHC13b-e
3948  fPeriodEnum == kLHC13b2_efix || //MC DPMJET, anchr LHC13b+c
3949  fPeriodEnum == kLHC13e7 || //MC HIJING, anchr LHC13b+c
3950  fPeriodEnum == kLHC14b2 //MC HIJING, anchr LHC13b+c
3951  ){
3952  printf(" Gamma Conversion Cuts %s :: pPb Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),-0.465);
3953  SetEtaShift(-0.465);
3954  } else if( fPeriodEnum == kLHC13f ) {
3955  printf(" Gamma Conversion Cuts %s :: Pbp Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),0.465);
3956  SetEtaShift(+0.465);
3957  }
3958  else printf(" Gamma Conversion Cuts %s :: Automatic Eta Shift requested but Period is not known -> No Shift \n\n",(GetCutNumber()).Data());
3959 }
3960 
3961 //________________________________________________________________________
3962 AliEMCALTriggerPatchInfo* AliConvEventCuts::GetMainTriggerPatch()
3963 {
3964  //get main trigger match; if not known yet, look for it and cache
3965 
3967  return fMainTriggerPatchEMCAL;
3968 
3969  if (!fTriggerPatchInfo) {
3970  AliError(Form("%s: fTriggerPatchInfo not available",GetName()));
3971  return 0;
3972  }
3973 
3974  //number of patches in event
3975  Int_t nPatch = fTriggerPatchInfo->GetEntries();
3976 
3977  //extract main trigger patch
3978  AliEMCALTriggerPatchInfo *patch;
3979  for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
3980  patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
3981  if (patch->IsMainTrigger()) {
3982  fMainTriggerPatchEMCAL = patch;
3983  break;
3984  }
3985  }
3986 
3987  return fMainTriggerPatchEMCAL;
3988 }
3989 
3990 
3991 //________________________________________________________________________
3993 {
3994 // cout << "entered EMCAL trigger initialization" << endl;
3995 
3996  // Init the analysis.
3997  if (fCaloTriggersName.IsNull()){
3998  if (event->IsA()==AliESDEvent::Class()){
3999  fCaloTriggersName = "EMCALTrigger";
4000  } else {
4001  fCaloTriggersName = "emcalTrigger";
4002  }
4003  }
4004 
4005  if (!fCaloTriggersName.IsNull() && !fCaloTriggers) {
4006  fCaloTriggers = dynamic_cast<AliVCaloTrigger*>(event->FindListObject(fCaloTriggersName));
4007  if (!fCaloTriggers) {
4008  AliError(Form("%s: Could not retrieve calo triggers %s!", GetName(), fCaloTriggersName.Data()));
4009  return;
4010  }
4011  }
4012 
4013  if (fCaloTriggerPatchInfoName.IsNull()){
4014  if (event->IsA()==AliESDEvent::Class()){
4015  fCaloTriggerPatchInfoName = "EmcalTriggers";
4016  } else {
4017  fCaloTriggerPatchInfoName = "EmcalTriggers";
4018  }
4019  }
4020 
4021  if (!fCaloTriggerPatchInfoName.IsNull() && !fTriggerPatchInfo) {
4022  fTriggerPatchInfo = GetArrayFromEvent(event, fCaloTriggerPatchInfoName.Data(), "AliEMCALTriggerPatchInfo");
4023  if (!fTriggerPatchInfo) {
4024  AliError(Form("%s: Could not retrieve calo trigger patch info %s!", GetName(), fCaloTriggerPatchInfoName.Data()));
4025  return;
4026  }
4027 
4028  }
4029 
4030  fEMCALTrigInitialized = kTRUE;
4031 }
4032 
4033 //________________________________________________________________________
4035  if (!fTriggerPatchInfo)
4036  return 0;
4037  //number of patches in event
4038  Int_t nPatch = fTriggerPatchInfo->GetEntries();
4039 
4040  //loop over patches to define trigger type of event
4041  Int_t nG1 = 0;
4042  Int_t nG2 = 0;
4043  Int_t nJ1 = 0;
4044  Int_t nJ2 = 0;
4045  Int_t nL0 = 0;
4046  AliEMCALTriggerPatchInfo *patch;
4047 // if (nPatch> 0) {cout << "NEW Triggers in this event*********************************" << endl;}
4048  for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
4049  patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
4050 // cout << "Patch energy: "<<patch->GetPatchE() << "\t ADC counts: " << patch->GetADCAmp() << endl;
4051 // cout << "Phi: " << patch->GetPhiMin() << " - " << patch->GetPhiMax() << " delta phi: " <<TMath::Abs(patch->GetPhiMin()-patch->GetPhiMax())<< endl;
4052 // cout << "Eta: " << patch->GetEtaMin() << " - " << patch->GetEtaMax() << " delta eta: " <<TMath::Abs(patch->GetEtaMin()-patch->GetEtaMax())<< endl;
4053  if (patch->IsGammaHigh()){
4054 // cout << "fired L1GA high" << endl;
4055  nG1++;
4056  }
4057  if (patch->IsGammaLow()){
4058 // cout << "fired L1GA low" << endl;
4059  nG2++;
4060  }
4061  if (patch->IsJetHigh()){
4062 // cout << "fired L1JE high" << endl;
4063  nJ1++;
4064  }
4065  if (patch->IsJetLow()){
4066 // cout << "fired L1JE low" << endl;
4067  nJ2++;
4068  }
4069  if (patch->IsLevel0()){
4070 // cout << "fired L0" << endl;
4071  nL0++;
4072  }
4073 // cout << patch->GetPatchE() << "\t" << patch->GetADCAmp() << "\t" << patch->IsGammaHigh() << "\t" << patch->IsGammaLow()
4074 // << "\t" << patch->IsJetHigh() << "\t" << patch->IsJetLow() << "\t" << patch->IsLevel0()
4075 // << "\t" << patch->GetPhiMin() << "\t" << patch->GetPhiMax() << "\t" << TMath::Abs(patch->GetPhiMin()-patch->GetPhiMax())
4076 // << "\t" << patch->GetEtaMin() << "\t" << patch->GetEtaMax() << "\t" << TMath::Abs(patch->GetEtaMin()-patch->GetEtaMax()) << endl;
4077  }
4078 
4079  if (nPatch > 0){
4080  AliDebug(2, "Patch summary: ");
4081  AliDebug(2, Form("Number of patches: %d", nPatch));
4082  AliDebug(2, Form("Level0: [%d]" ,nL0));
4083  AliDebug(2, Form("Jet: low[%d], high[%d]" ,nJ2, nJ1));
4084  AliDebug(2, Form("Gamma: low[%d], high[%d]" ,nG2, nG1));
4085  }
4086 
4087 // if (nPatch > 0){
4088 // cout << Form("Number of patches: %d", nPatch) << endl;
4089 // cout << Form("Level0: [%d]" ,nL0) << endl;
4090 // cout << Form("Jet: low[%d], high[%d]" ,nJ2, nJ1) << endl;
4091 // cout << Form("Gamma: low[%d], high[%d]" ,nG2, nG1) << endl;
4092 // }
4093 
4094  ULong_t triggers(0);
4095  if (nG1>0)
4096  SETBIT(triggers, kG1);
4097  if (nG2>0)
4098  SETBIT(triggers, kG2);
4099  if (nJ1>0)
4100  SETBIT(triggers, kJ1);
4101  if (nJ2>0)
4102  SETBIT(triggers, kJ2);
4103  if (nL0>0)
4104  SETBIT(triggers, kL0);
4105  return triggers;
4106 }
4107 
4108 //________________________________________________________________________
4110  // Check if event has a given trigger type
4111  if(t == kND){
4112  return fTriggersEMCAL == 0;
4113  }
4114  return TESTBIT(fTriggersEMCAL, int(t));
4115 }
4116 
4117 
4118 //________________________________________________________________________
4119 TClonesArray *AliConvEventCuts::GetArrayFromEvent(AliVEvent* event, const char *name, const char *clname)
4120 {
4121  // Get array from event.
4122 
4123  TClonesArray *arr = 0;
4124  TString sname(name);
4125  if (!sname.IsNull()) {
4126  arr = dynamic_cast<TClonesArray*>(event->FindListObject(sname));
4127  if (!arr) {
4128  AliWarning(Form("%s: Could not retrieve array with name %s!", GetName(), name));
4129  return 0;
4130  }
4131  } else {
4132  return 0;
4133  }
4134 
4135  if (!clname)
4136  return arr;
4137 
4138  TString objname(arr->GetClass()->GetName());
4139  TClass cls(objname);
4140  if (!cls.InheritsFrom(clname)) {
4141  AliWarning(Form("%s: Objects of type %s in %s are not inherited from %s!",
4142  GetName(), cls.GetName(), name, clname));
4143  return 0;
4144  }
4145  return arr;
4146 }
4147 
4148 //_________________________________________________________________________
4149 Bool_t AliConvEventCuts::IsConversionPrimaryESD( AliMCEvent *mcEvent, Long_t eventpos, Double_t prodVtxX, Double_t prodVtxY, Double_t prodVtxZ){
4150 
4151  if (eventpos < 0) return kFALSE;
4152  TParticle* particle = (TParticle *)mcEvent->Particle(eventpos);
4153  if (!particle) return kFALSE;
4154  if (TMath::Abs(particle->GetPdgCode()) == 11 ){
4155  if (particle->GetMother(0) != -1){
4156  TParticle* particleMother = (TParticle *)mcEvent->Particle(particle->GetMother(0));
4157  if (particleMother){
4158  if (TMath::Abs(particleMother->GetPdgCode()) == 22)
4159  particle = particleMother;
4160  }
4161  }
4162  }
4163  if (particle->GetMother(0) != -1){
4164  Double_t deltaX = particle->Vx() - prodVtxX;
4165  Double_t deltaY = particle->Vy() - prodVtxY;
4166  Double_t deltaZ = particle->Vz() - prodVtxZ;
4167 
4168  //Double_t realRadius2D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY);
4169  Double_t realRadius3D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
4170 
4171 
4172  Bool_t dalitzCand = kFALSE;
4173 
4174  TParticle* firstmother = (TParticle *)mcEvent->Particle(particle->GetMother(0));
4175  if (!firstmother) return kFALSE;
4176  Int_t pdgCodeFirstMother = firstmother->GetPdgCode();
4177  Bool_t intDecay = kFALSE;
4178  if ( pdgCodeFirstMother == 111 || pdgCodeFirstMother == 221 ) intDecay = kTRUE;
4179  if ( intDecay && TMath::Abs(particle->GetPdgCode()) == 11 ){
4180  dalitzCand = kTRUE;
4181 // cout << "dalitz candidate found" << endl;
4182  }
4183 
4184  Long_t source = particle->GetMother(0);
4185  Bool_t foundExcludedPart = kFALSE;
4186  Bool_t foundShower = kFALSE;
4187  Int_t pdgCodeMotherPrev = 0;
4188  Int_t pdgCodeMotherPPrevMother = 0;
4189  Int_t depth = 0;
4190  if (dalitzCand || realRadius3D < fSecProdBoundary ){
4191 // if (particle->GetPdgCode() == 22){
4192 // cout << endl << endl << "new particle: " << eventpos <<endl;
4193 // cout << particle->GetPdgCode() << "\t" << particle->R() << "\t" << realRadius2D << "\t" << realRadius3D << endl;
4194 // }
4195  while (depth < 20){
4196  TParticle* mother = (TParticle *)mcEvent->Particle(source);
4197  source = mother->GetMother(0);
4198 // if (particle->GetPdgCode() == 22)cout << "eventposition: "<< source << endl;
4199  Int_t pdgCodeMother = mother->GetPdgCode();
4200 // if (particle->GetPdgCode() == 22)cout << "Previous mothers: " << pdgCodeMother << "\t"<< pdgCodeMotherPrev<< "\t" << pdgCodeMotherPPrevMother << endl;
4201  if (pdgCodeMother == pdgCodeMotherPrev && pdgCodeMother == pdgCodeMotherPPrevMother) depth = 20;
4202  if (TMath::Abs(pdgCodeMother) == 11 && TMath::Abs(pdgCodeMotherPrev) == 22 && TMath::Abs(pdgCodeMotherPPrevMother) == 11 ){
4203  foundShower = kTRUE;
4204  depth =20;
4205  }
4206  if (TMath::Abs(pdgCodeMother) == 22 && TMath::Abs(pdgCodeMotherPrev) == 11 && TMath::Abs(pdgCodeMotherPPrevMother) == 22 ){
4207  foundShower = kTRUE;
4208  depth =20;
4209  }
4210 
4211  // particles to be excluded:
4212  // K0s - 310
4213  // K0l - 130
4214  // K+/- - 321
4215  // Lambda - 3122
4216  // Sigma0 - 3212
4217  // Sigma+/- - 3222, 3112
4218  // Cascades - 3322, 3312
4219  if (TMath::Abs(pdgCodeMother) == 310 || TMath::Abs(pdgCodeMother) == 130 || TMath::Abs(pdgCodeMother) == 321 ||
4220  TMath::Abs(pdgCodeMother) == 3122 || TMath::Abs(pdgCodeMother) == 3212 || TMath::Abs(pdgCodeMother) == 3222 ||
4221  TMath::Abs(pdgCodeMother) == 3112 || TMath::Abs(pdgCodeMother) == 3322 || TMath::Abs(pdgCodeMother) == 3312
4222  ) {
4223  foundExcludedPart = kTRUE;
4224  }
4225 // if (particle->GetPdgCode() == 22)cout << mother->GetPdgCode() << "\t" << source << "\t" << foundExcludedPart<< endl;
4226  pdgCodeMotherPPrevMother = pdgCodeMotherPrev;
4227  pdgCodeMotherPrev = pdgCodeMother;
4228  if (source == -1) depth = 20;
4229 
4230 // if (particle->GetPdgCode() == 22)cout << depth << endl;
4231  depth++;
4232  }
4233  }
4234  if (foundExcludedPart){
4235 // if (particle->GetPdgCode() == 22)cout << "This is definitely a secondary, manually excluded" << endl;
4236  return kFALSE;
4237  } else if (dalitzCand && realRadius3D < fSecProdBoundary ){
4238 // if (particle->GetPdgCode() == 22)cout << "This was a decay via a virtual photon" << endl;
4239  return kTRUE;
4240  } else if (foundShower){
4241 // if (particle->GetPdgCode() == 22)cout << "This is a shower" << endl;
4242  return kFALSE;
4243  } else if (realRadius3D >= fSecProdBoundary){
4244 // cout << "This is a secondary, to large production radius" << endl;
4245  return kFALSE;
4246  }
4247  }
4248 
4249  return kTRUE;
4250 }
4251 
4252 //_________________________________________________________________________
4253 Bool_t AliConvEventCuts::IsConversionPrimaryAOD(AliVEvent *event, AliAODMCParticle* AODMCParticle, Double_t prodVtxX, Double_t prodVtxY, Double_t prodVtxZ){
4254 
4255  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
4256  if (AODMCTrackArray == NULL) return kFALSE;
4257  AliAODMCParticle* currentParticle = AODMCParticle;
4258  if (TMath::Abs(currentParticle->GetPdgCode()) == 11 ){
4259  if (currentParticle->GetMother() != -1){
4260  AliAODMCParticle* particleMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(currentParticle->GetMother()));
4261  if (particleMother){
4262  if (TMath::Abs(particleMother->GetPdgCode()) == 22)
4263  currentParticle = particleMother;
4264  }
4265  }
4266  }
4267  if (currentParticle->GetMother() > -1){
4268  Double_t deltaX = currentParticle->Xv() - prodVtxX;
4269  Double_t deltaY = currentParticle->Yv() - prodVtxY;
4270  Double_t deltaZ = currentParticle->Zv() - prodVtxZ;
4271 
4272  //Double_t realRadius2D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY);
4273  Double_t realRadius3D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
4274 
4275  Bool_t dalitzCand = kFALSE;
4276 
4277  AliAODMCParticle* firstmother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(currentParticle->GetMother()));
4278  if (!firstmother) return kFALSE;
4279  Int_t pdgCodeFirstMother = firstmother->GetPdgCode();
4280  Bool_t intDecay = kFALSE;
4281  if ( pdgCodeFirstMother == 111 || pdgCodeFirstMother == 221 ) intDecay = kTRUE;
4282  if ( intDecay && TMath::Abs(currentParticle->GetPdgCode()) == 11 ){
4283  dalitzCand = kTRUE;
4284 // cout << "dalitz candidate found" << endl;
4285  }
4286 
4287  Long_t source = currentParticle->GetMother();
4288  Bool_t foundExcludedPart = kFALSE;
4289  Bool_t foundShower = kFALSE;
4290  Int_t pdgCodeMotherPrev = 0;
4291  Int_t pdgCodeMotherPPrevMother = 0;
4292  Int_t depth = 0;
4293  if (dalitzCand || realRadius3D < fSecProdBoundary ){
4294 // if (currentParticle->GetPdgCode() == 22){
4295 // cout << endl << endl << "new particle: " << eventpos <<endl;
4296 // cout << currentParticle->GetPdgCode() << "\t" << currentParticle->R() << "\t" << realRadius2D << "\t" << realRadius3D << endl;
4297 // }
4298  while (depth < 20){
4299  AliAODMCParticle* mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(source));
4300  source = mother->GetMother();
4301 // if (currentParticle->GetPdgCode() == 22)cout << "eventposition: "<< source << endl;
4302  Int_t pdgCodeMother = mother->GetPdgCode();
4303 // if (currentParticle->GetPdgCode() == 22)cout << "Previous mothers: " << pdgCodeMother << "\t"<< pdgCodeMotherPrev<< "\t" << pdgCodeMotherPPrevMother << endl;
4304  if (pdgCodeMother == pdgCodeMotherPrev && pdgCodeMother == pdgCodeMotherPPrevMother) depth = 20;
4305  if (TMath::Abs(pdgCodeMother) == 11 && TMath::Abs(pdgCodeMotherPrev) == 22 && TMath::Abs(pdgCodeMotherPPrevMother) == 11 ){
4306  foundShower = kTRUE;
4307  depth =20;
4308  }
4309  if (TMath::Abs(pdgCodeMother) == 22 && TMath::Abs(pdgCodeMotherPrev) == 11 && TMath::Abs(pdgCodeMotherPPrevMother) == 22 ){
4310  foundShower = kTRUE;
4311  depth =20;
4312  }
4313 
4314  // particles to be excluded:
4315  // K0s - 310
4316  // K0l - 130
4317  // K+/- - 321
4318  // Lambda - 3122
4319  // Sigma0 - 3212
4320  // Sigma+/- - 3222, 3112
4321  // Cascades - 3322, 3312
4322  if (TMath::Abs(pdgCodeMother) == 310 || TMath::Abs(pdgCodeMother) == 130 || TMath::Abs(pdgCodeMother) == 321 ||
4323  TMath::Abs(pdgCodeMother) == 3122 || TMath::Abs(pdgCodeMother) == 3212 || TMath::Abs(pdgCodeMother) == 3222 ||
4324  TMath::Abs(pdgCodeMother) == 3112 || TMath::Abs(pdgCodeMother) == 3322 || TMath::Abs(pdgCodeMother) == 3312)
4325  {
4326  foundExcludedPart = kTRUE;
4327  }
4328 // if (currentParticle->GetPdgCode() == 22)cout << mother->GetPdgCode() << "\t" << source << "\t" << foundExcludedPart<< endl;
4329  pdgCodeMotherPPrevMother = pdgCodeMotherPrev;
4330  pdgCodeMotherPrev = pdgCodeMother;
4331  if (source == -1) depth = 20;
4332 
4333 // if (currentParticle->GetPdgCode() == 22)cout << depth << endl;
4334  depth++;
4335  }
4336  }
4337  if (foundExcludedPart){
4338 // if (currentParticle->GetPdgCode() == 22)cout << "This is definitely a secondary, manually excluded" << endl;
4339  return kFALSE;
4340  } else if (dalitzCand && realRadius3D < fSecProdBoundary ){
4341 // if (currentParticle->GetPdgCode() == 22)cout << "This was a decay via a virtual photon" << endl;
4342  return kTRUE;
4343  } else if (foundShower){
4344 // if (currentParticle->GetPdgCode() == 22)cout << "This is a shower" << endl;
4345  return kFALSE;
4346  } else if (realRadius3D >= fSecProdBoundary){
4347 // cout << "This is a secondary, too large production radius" << endl;
4348  return kFALSE;
4349  }
4350  }
4351 
4352  return kTRUE;
4353 }
4354 
4355 
4356 //________________________________________________________________________
4357 Int_t AliConvEventCuts::SecondaryClassificationPhoton( TParticle *particle, AliMCEvent* mcEvent, Bool_t isConversion ){
4358  if (particle != NULL && mcEvent != NULL){
4359  Int_t pdgSecondary = 0;
4360  if (!isConversion){
4361  //Bool_t hasMother = kFALSE;
4362  //Bool_t hasGrandMother = kFALSE;
4363  Long_t motherID = particle->GetMother(0);
4364  Long_t grandMotherID = -1;
4365  // is the photon a direct photons, without a mother?
4366  if (motherID > -1){
4367  //hasMother = kTRUE;
4368  grandMotherID = mcEvent->Particle(motherID)->GetMother(0);
4369  // is the meson a primary?
4370  if (grandMotherID > -1){
4371  //hasGrandMother = kTRUE;
4372  pdgSecondary = mcEvent->Particle(grandMotherID)->GetPdgCode();
4373  }
4374  }
4375  } else {
4376  //Bool_t hasMother = kFALSE;
4377  //Bool_t hasGrandMother = kFALSE;
4378  //Bool_t hasGreatGrandMother = kFALSE;
4379  Long_t motherID = particle->GetMother(0);
4380  Long_t grandMotherID = -1;
4381  Long_t greatGrandMotherID = -1;
4382  // is the electron a direct electron, without a mother?
4383  if (motherID > -1){
4384  //hasMother = kTRUE;
4385  grandMotherID = mcEvent->Particle(motherID)->GetMother(0);
4386  // is the photon a direct photons, without a mother?
4387  if (grandMotherID > -1){
4388  //hasGrandMother = kTRUE;
4389  greatGrandMotherID = mcEvent->Particle(grandMotherID)->GetMother(0);
4390  // is the meson a primary?
4391  if (greatGrandMotherID > -1){
4392  //hasGreatGrandMother = kTRUE;
4393  pdgSecondary = mcEvent->Particle(greatGrandMotherID)->GetPdgCode();
4394  }
4395  }
4396  }
4397  }
4398  // is the secondary photon from a lambda
4399  if (TMath::Abs(pdgSecondary) == 3122 )
4400  return 3;
4401  // is the secondary photon from a K0s
4402  else if ( TMath::Abs(pdgSecondary) == 310 )
4403  return 2;
4404  // is the secondary photon from a K0l
4405  else if ( TMath::Abs(pdgSecondary) == 130 )
4406  return 5;
4407  // is the secondary photon from a eta
4408  else if ( TMath::Abs(pdgSecondary) == 221 )
4409  return 4;
4410  // is the secondary photon from something else
4411  else if ( TMath::Abs(pdgSecondary) != 0 )
4412  return 1;
4413 
4414  }
4415 
4416  return 0;
4417 }
4418 
4419 //________________________________________________________________________
4420 Int_t AliConvEventCuts::SecondaryClassificationPhotonAOD( AliAODMCParticle *particle, TClonesArray *aodmcArray, Bool_t isConversion ){
4421  if (particle != NULL && aodmcArray != NULL){
4422  Int_t pdgSecondary = 0;
4423  if (!isConversion){
4424  //Bool_t hasMother = kFALSE;
4425  //Bool_t hasGrandMother = kFALSE;
4426  Long_t motherID = particle->GetMother();
4427  Long_t grandMotherID = -1;
4428  // is the photon a direct photons, without a mother?
4429  if (motherID > -1){
4430  //hasMother = kTRUE;
4431  grandMotherID = ((AliAODMCParticle*)aodmcArray->At(motherID))->GetMother();
4432  // is the meson a primary?
4433  if (grandMotherID > -1){
4434  //hasGrandMother = kTRUE;
4435  pdgSecondary = ((AliAODMCParticle*)aodmcArray->At(grandMotherID))->GetPdgCode();
4436  }
4437  }
4438  } else {
4439  //Bool_t hasMother = kFALSE;
4440  //Bool_t hasGrandMother = kFALSE;
4441  //Bool_t hasGreatGrandMother = kFALSE;
4442  Long_t motherID = particle->GetMother();
4443  Long_t grandMotherID = -1;
4444  Long_t greatGrandMotherID = -1;
4445  // is the electron a direct electron, without a mother?
4446  if (motherID > -1){
4447  //hasMother = kTRUE;
4448  grandMotherID = ((AliAODMCParticle*)aodmcArray->At(motherID))->GetMother();
4449  // is the photon a direct photons, without a mother?
4450  if (grandMotherID > -1){
4451  //hasGrandMother = kTRUE;
4452  greatGrandMotherID = ((AliAODMCParticle*)aodmcArray->At(grandMotherID))->GetMother();
4453  // is the meson a primary?
4454  if (greatGrandMotherID > -1){
4455  //hasGreatGrandMother = kTRUE;
4456  pdgSecondary = ((AliAODMCParticle*)aodmcArray->At(greatGrandMotherID))->GetPdgCode();
4457  }
4458  }
4459  }
4460  }
4461  // is the secondary photon from a lambda
4462  if (TMath::Abs(pdgSecondary) == 3122 )
4463  return 3;
4464  // is the secondary photon from a K0s
4465  else if ( TMath::Abs(pdgSecondary) == 310 )
4466  return 2;
4467  // is the secondary photon from a K0l
4468  else if ( TMath::Abs(pdgSecondary) == 130 )
4469  return 5;
4470  // is the secondary photon from a eta
4471  else if ( TMath::Abs(pdgSecondary) == 221 )
4472  return 4;
4473  // is the secondary photon from something else
4474  else if ( TMath::Abs(pdgSecondary) != 0 )
4475  return 1;
4476 
4477  }
4478 
4479  return 0;
4480 }
4481 
4483 
4484  if (periodName.CompareTo("") == 0){
4485  periodName = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPeriodName();
4486  }
4487  if (periodName.CompareTo("") == 0) {
4489  fEnergyEnum = kUnset;
4490  AliError("No correct period could be set, periodName string empty");
4491  return;
4492  }
4493 
4494  // Data
4495  if (periodName.CompareTo("LHC10b") == 0 || periodName.CompareTo("LHC10c") == 0 || periodName.CompareTo("LHC10d") == 0 || periodName.CompareTo("LHC10e") == 0 ||
4496  periodName.CompareTo("LHC10f") == 0 || periodName.CompareTo("LHC10g") == 0 || periodName.CompareTo("LHC10bg") == 0
4497  ){
4499  fEnergyEnum = k7TeV;
4500  } else if (periodName.CompareTo("LHC10h") == 0) {
4501  fPeriodEnum = kLHC10h;
4503  } else if (periodName.CompareTo("LHC11a") == 0) {
4504  fPeriodEnum = kLHC11a;
4506  } else if (periodName.CompareTo("LHC11b") == 0) {
4507  fPeriodEnum = kLHC11b;
4508  fEnergyEnum = k7TeV;
4509  } else if (periodName.CompareTo("LHC11c") == 0 || periodName.CompareTo("LHC11d") == 0 || periodName.CompareTo("LHC11e") == 0 || periodName.CompareTo("LHC11f") == 0 ||
4510  periodName.CompareTo("LHC11g") == 0
4511  ) {
4513  fEnergyEnum = k7TeV;
4514  } else if (periodName.CompareTo("LHC11h") == 0) {
4515  fPeriodEnum = kLHC11h;
4517  } else if (periodName.CompareTo("LHC12a") == 0 || periodName.CompareTo("LHC12b") == 0 || periodName.CompareTo("LHC12c") == 0 || periodName.CompareTo("LHC12d") == 0 ||
4518  periodName.CompareTo("LHC12e") == 0 || periodName.CompareTo("LHC12f") == 0 || periodName.CompareTo("LHC12g") == 0 || periodName.CompareTo("LHC12h") == 0 ||
4519  periodName.CompareTo("LHC12i") == 0 || periodName.CompareTo("LHC12ai") == 0
4520  ) {
4521  fPeriodEnum = kLHC12;
4522  fEnergyEnum = k8TeV;
4523  } else if (periodName.CompareTo("LHC13b") == 0 || periodName.CompareTo("LHC13c") == 0 || periodName.CompareTo("LHC13bc") == 0){
4526  } else if (periodName.CompareTo("LHC13d") == 0 || periodName.CompareTo("LHC13e") == 0 || periodName.CompareTo("LHC13de") == 0){
4529  } else if (periodName.CompareTo("LHC13f") == 0 ){
4530  fPeriodEnum = kLHC13f;
4532  } else if (periodName.CompareTo("LHC13g") == 0 ){
4533  fPeriodEnum = kLHC13g;
4535  } else if ( periodName.CompareTo("LHC15f") == 0 || periodName.CompareTo("LHC15g") == 0 || periodName.CompareTo("LHC15h") == 0 || periodName.CompareTo("LHC15i") == 0 ||
4536  periodName.CompareTo("LHC15j") == 0 || periodName.CompareTo("LHC15k") == 0 || periodName.CompareTo("LHC15l") == 0 || periodName.CompareTo("LHC15m") == 0 ||
4537  periodName.CompareTo("LHC15fm") == 0
4538  ) {
4540  fEnergyEnum = k13TeV;
4541  } else if (periodName.CompareTo("LHC15n") == 0 ){
4542  fPeriodEnum = kLHC15n;
4543  fEnergyEnum = k5TeV;
4544  } else if (periodName.CompareTo("LHC15o") == 0 ){
4545  fPeriodEnum = kLHC15o;
4547  } else if ( periodName.CompareTo("LHC16d") == 0 || periodName.CompareTo("LHC16e") == 0 || periodName.CompareTo("LHC16g") == 0 || periodName.CompareTo("LHC16h") == 0 ||
4548  periodName.CompareTo("LHC16i") == 0 || periodName.CompareTo("LHC16j") == 0 || periodName.CompareTo("LHC16k") == 0 || periodName.CompareTo("LHC16l") == 0 ||
4549  periodName.CompareTo("LHC16m") == 0 || periodName.CompareTo("LHC16n") == 0 || periodName.CompareTo("LHC16o") == 0 || periodName.CompareTo("LHC16p") == 0){
4551  fEnergyEnum = k13TeV;
4552  } else if (periodName.CompareTo("LHC16f") == 0 ){
4555  } else if (periodName.CompareTo("LHC16q") == 0 ){
4556  fPeriodEnum = kLHC16q;
4558  } else if (periodName.CompareTo("LHC16r") == 0 ){
4559  fPeriodEnum = kLHC16r;
4561  } else if (periodName.CompareTo("LHC16s") == 0 ){
4562  fPeriodEnum = kLHC16s;
4564  } else if (periodName.CompareTo("LHC16t") == 0 ){
4565  fPeriodEnum = kLHC16t;
4567  } else if ( periodName.CompareTo("LHC17c") == 0 || periodName.CompareTo("LHC17d") == 0 || periodName.CompareTo("LHC17e") == 0 || periodName.CompareTo("LHC17f") == 0 ||
4568  periodName.CompareTo("LHC17h") == 0 || periodName.CompareTo("LHC17i") == 0 || periodName.CompareTo("LHC17j") == 0 || periodName.CompareTo("LHC17k") == 0 ||
4569  periodName.CompareTo("LHC17l") == 0 || periodName.CompareTo("LHC17m") == 0 || periodName.CompareTo("LHC17o") == 0 ){
4571  fEnergyEnum = k13TeV;
4572  } else if ( periodName.CompareTo("LHC17g") == 0 ){
4575  } else if ( periodName.CompareTo("LHC17n") == 0 ){
4576  fPeriodEnum = kLHC17n;
4578 
4579  // LHC10x anchored MCs
4580  } else if (periodName.CompareTo("LHC10d1") == 0){
4582  fEnergyEnum = k7TeV;
4583  } else if (periodName.CompareTo("LHC10d2") == 0){
4585  fEnergyEnum = k7TeV;
4586  } else if (periodName.CompareTo("LHC10d4a") == 0){
4588  fEnergyEnum = k7TeV;
4589  } else if (periodName.CompareTo("LHC10d4") == 0){
4591  fEnergyEnum = k7TeV;
4592  } else if (periodName.CompareTo("LHC10e12") == 0){
4594  fEnergyEnum = k900GeV;
4595  } else if (periodName.CompareTo("LHC10e13") == 0){
4597  fEnergyEnum = k900GeV;
4598  } else if (periodName.CompareTo("LHC10e20") == 0){
4600  fEnergyEnum = k7TeV;
4601  } else if (periodName.CompareTo("LHC10e21") == 0){
4603  fEnergyEnum = k7TeV;
4604  } else if (periodName.CompareTo("LHC10f6a") == 0){
4606  fEnergyEnum = k7TeV;
4607  } else if (periodName.CompareTo("LHC10f6") == 0){
4609  fEnergyEnum = k7TeV;
4610  } else if (periodName.Contains("LHC14j4")){
4612  fEnergyEnum = k7TeV;
4613  } else if (periodName.CompareTo("LHC13d2") == 0){
4616  } else if (periodName.CompareTo("LHC13d2b") == 0){
4619  } else if (periodName.CompareTo("LHC12a11a") == 0){
4622  } else if (periodName.CompareTo("LHC12a11b") == 0){
4625  } else if (periodName.CompareTo("LHC12a11c") == 0){
4628  } else if (periodName.CompareTo("LHC12a11d") == 0){
4631  } else if (periodName.CompareTo("LHC12a11e") == 0){
4634  } else if (periodName.CompareTo("LHC12a11f") == 0){
4637  // LHC11x anchored MCs
4638  } else if (periodName.CompareTo("LHC12a15c") == 0){
4641  } else if (periodName.Contains("LHC12f1a") ){
4644  } else if (periodName.Contains("LHC12f1b") ){
4647  } else if (periodName.Contains("LHC12i3") ){
4650  } else if (periodName.CompareTo("LHC15g1a") == 0){
4653  } else if (periodName.CompareTo("LHC15g1b") == 0){
4656  } else if (periodName.CompareTo("LHC13e4") == 0){
4658  fEnergyEnum = k7TeV;
4659  } else if (periodName.CompareTo("LHC13e5") == 0){
4661  fEnergyEnum = k7TeV;
4662  } else if (periodName.CompareTo("LHC14k1a") == 0){
4664  fEnergyEnum = k7TeV;
4665  } else if (periodName.CompareTo("LHC14k1b") == 0){
4667  fEnergyEnum = k7TeV;
4668  } else if (periodName.CompareTo("LHC12a15f") == 0){
4670  fEnergyEnum = k7TeV;
4671  } else if (periodName.CompareTo("LHC12a15g") == 0){
4673  fEnergyEnum = k7TeV;
4674  } else if (periodName.CompareTo("LHC12f2a") == 0){
4676  fEnergyEnum = k7TeV;
4677  } else if (periodName.CompareTo("LHC14a1a") == 0){
4680  } else if (periodName.CompareTo("LHC14a1b") == 0){
4683  } else if (periodName.CompareTo("LHC14a1c") == 0){
4686  // LHC12x anchored MCs
4687  } else if (periodName.CompareTo("LHC14e2a") == 0){
4689  fEnergyEnum = k8TeV;
4690  } else if (periodName.CompareTo("LHC14e2b") == 0){
4692  fEnergyEnum = k8TeV;
4693  } else if (periodName.CompareTo("LHC14e2c") == 0){
4695  fEnergyEnum = k8TeV;
4696  } else if (periodName.Contains("LHC15h1")){
4698  fEnergyEnum = k8TeV;
4699  } else if (periodName.Contains("LHC15h2")){
4701  fEnergyEnum = k8TeV;
4702  } else if (periodName.CompareTo("LHC16c2") == 0){
4704  fEnergyEnum = k8TeV;
4705  } else if (periodName.CompareTo("LHC16c2_plus") == 0){
4707  fEnergyEnum = k8TeV;
4708  // LHC13x anchored MCs
4709  } else if (periodName.Contains("LHC13b2_efix")){
4712  } else if (periodName.CompareTo("LHC13e7") == 0){
4715  } else if (periodName.CompareTo("LHC14b2") == 0){
4718  } else if (periodName.CompareTo("LHC13b4_fix") == 0){
4721  } else if (periodName.CompareTo("LHC13b4_plus") == 0){
4724  } else if (periodName.CompareTo("LHC16c3a") == 0){
4727  } else if (periodName.CompareTo("LHC16c3b") == 0){
4730  } else if (periodName.CompareTo("LHC16c3c") == 0){
4733  } else if (periodName.CompareTo("LHC15g2") == 0){
4736  } else if (periodName.CompareTo("LHC15a3a") == 0){
4739  } else if (periodName.CompareTo("LHC15a3a_plus") == 0){
4742  } else if (periodName.CompareTo("LHC15a3b") == 0){
4745  } else if (periodName.CompareTo("LHC15d3a") == 0){
4748  } else if (periodName.CompareTo("LHC15d3b") == 0){
4751  // LHC15x anchored MCs
4752  } else if (periodName.CompareTo("LHC15g3a3") == 0){
4754  fEnergyEnum = k13TeV;
4755  } else if (periodName.CompareTo("LHC15g3a") == 0){
4757  fEnergyEnum = k13TeV;
4758  } else if (periodName.CompareTo("LHC15g3c2") == 0){
4760  fEnergyEnum = k13TeV;
4761  } else if (periodName.CompareTo("LHC15g3c3") == 0){
4763  fEnergyEnum = k13TeV;
4764  } else if (periodName.CompareTo("LHC15g3") == 0){
4766  fEnergyEnum = k13TeV;
4767  } else if (periodName.CompareTo("LHC16a2a") == 0){
4769  fEnergyEnum = k13TeV;
4770  } else if (periodName.CompareTo("LHC16a2b") == 0){
4772  fEnergyEnum = k13TeV;
4773  } else if (periodName.CompareTo("LHC16a2c") == 0){
4775  fEnergyEnum = k13TeV;
4776  } else if (periodName.CompareTo("LHC15l1a2") == 0){
4778  fEnergyEnum = k5TeV;
4779  } else if (periodName.CompareTo("LHC15l1b2") == 0){
4781  fEnergyEnum = k5TeV;
4782  } else if (periodName.CompareTo("LHC16h3") == 0){
4784  fEnergyEnum = k5TeV;
4785  } else if (periodName.CompareTo("LHC16h8a") == 0){
4787  fEnergyEnum = k5TeV;
4788  } else if (periodName.CompareTo("LHC16h8b") == 0){
4790  fEnergyEnum = k5TeV;
4791  } else if (periodName.CompareTo("LHC16k5a") == 0){
4793  fEnergyEnum = k5TeV;
4794  } else if (periodName.CompareTo("LHC16k5b") == 0){
4796  fEnergyEnum = k5TeV;
4797  } else if (periodName.CompareTo("LHC16k3a") == 0){
4799  fEnergyEnum = k5TeV;
4800  } else if (periodName.CompareTo("LHC16k3a2") == 0){
4802  fEnergyEnum = k5TeV;
4803  } else if (periodName.CompareTo("LHC17e2") == 0){
4805  fEnergyEnum = k5TeV;
4806  } else if (periodName.Contains("LHC15k1a1")){
4809  } else if (periodName.Contains("LHC15k1a2")){
4812  } else if (periodName.Contains("LHC15k1a3")){
4815  } else if (periodName.Contains("LHC16j7")){
4818  } else if (periodName.Contains("LHC16h4")){
4821  } else if (periodName.Contains("LHC16g1")){
4824  } else if (periodName.Contains("LHC16g1a")){
4827  } else if (periodName.Contains("LHC16g1b")){
4830  } else if (periodName.Contains("LHC16g1c")){
4833  } else if (periodName.Contains("LHC16g2")){
4836  } else if (periodName.Contains("LHC16g3")){
4839  } else if (periodName.Contains("LHC16h2a")){
4842  } else if (periodName.Contains("LHC16h2b")){
4845  } else if (periodName.Contains("LHC16h2c")){
4848  } else if (periodName.CompareTo("LHC16k3b") == 0){
4851  } else if (periodName.CompareTo("LHC16k3b2") == 0){
4854 
4855  // LHC16x anchored MCs
4856  // 13TeV LHC16* anchors full field Pythia 8 MB
4857  } else if ( periodName.CompareTo("LHC16P1Pyt8") == 0 || periodName.CompareTo("LHC17f6") == 0 || periodName.CompareTo("LHC17d17") == 0 || periodName.CompareTo("LHC17f5") == 0 ||
4858  periodName.CompareTo("LHC17d3") == 0 || periodName.CompareTo("LHC17e5") == 0 || periodName.CompareTo("LHC17d20a1") == 0 || periodName.CompareTo("LHC17d20a1_extra") == 0 ||
4859  periodName.CompareTo("LHC17d20a2") == 0 || periodName.CompareTo("LHC17d20a2_extra") == 0 || periodName.CompareTo("LHC17d16") == 0 || periodName.CompareTo("LHC17d18") == 0 ||
4860  periodName.CompareTo("LHC17f9") == 0 || periodName.CompareTo("LHC17f9_test") == 0){
4862  fEnergyEnum = k13TeV;
4863  // 13TeV LHC16* anchors low field Pythia 8 MB
4864  } else if ( periodName.CompareTo("LHC16P1Pyt8LowB") == 0 || periodName.CompareTo("LHC17d1") == 0 ){
4867  // 13TeV LHC16* anchors full field EPOS MB
4868  } else if ( periodName.CompareTo("LHC16P1EPOS") == 0 || periodName.CompareTo("LHC17d20b1") == 0 || periodName.CompareTo("LHC17d20b2") == 0 ){
4870  fEnergyEnum = k13TeV;
4871  // 13TeV LHC16* anchors full field JJ Pythia 8 MB
4872  } else if ( periodName.CompareTo("LHC16P1JJ") == 0 || periodName.CompareTo("LHC17f8a") == 0 || periodName.CompareTo("LHC17f8c") == 0 || periodName.CompareTo("LHC17f8d") == 0 ||
4873  periodName.CompareTo("LHC17f8e") == 0 ){
4875  fEnergyEnum = k13TeV;
4876  // 13TeV LHC16* anchors low field JJ Pythia 8 MB
4877  } else if ( periodName.CompareTo("LHC16P1JJLowB") == 0 || periodName.CompareTo("LHC17f8b") == 0 ){
4880 
4881  // LHC16qt anchored MCs
4882  } else if (periodName.CompareTo("LHC17f2a") == 0){
4885  } else if (periodName.CompareTo("LHC17f2a_fast") == 0){
4888  } else if (periodName.CompareTo("LHC17f2a_cent") == 0){
4891  } else if (periodName.CompareTo("LHC17f2a_cent_woSDD") == 0){
4894  } else if (periodName.CompareTo("LHC17f2a_fast_fix") == 0){
4897  } else if (periodName.CompareTo("LHC17f2a_cent_fix") == 0){
4900  } else if (periodName.CompareTo("LHC17f2a_cent_woSDD_fix") == 0){
4903  } else if (periodName.CompareTo("LHC17f2b") == 0){
4906  } else if (periodName.CompareTo("LHC17f2b_fast") == 0){
4909  } else if (periodName.CompareTo("LHC17f2b_cent") == 0){
4912  } else if (periodName.CompareTo("LHC17f2b_cent_woSDD") == 0){
4915  } else if (periodName.CompareTo("LHC17g8a_fast") == 0){
4916