AliPhysics  ebc57ae (ebc57ae)
 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 
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(fUtils->IsFirstEventInChunk(event)){
617  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
618  fEventQuality = 6;
619  return kFALSE;
620  }
621  if(fRemovePileUp){
622  if(fUtils->IsPileUpEvent(event)){
623  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
625  fEventQuality = 6;
626  return kFALSE;
627  }
628  if (fUtils->IsSPDClusterVsTrackletBG(event)){
629  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
631  fEventQuality = 11;
632  return kFALSE;
633  }
634  }
635  } else if(fRemovePileUp){
636  if(event->IsPileupFromSPD(3,0.8,3.,2.,5.) ){
637  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
639  fEventQuality = 6;
640  return kFALSE;
641  }
642  if (fUtils->IsSPDClusterVsTrackletBG(event)){
643  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
645  fEventQuality = 11;
646  return kFALSE;
647  }
648  }
649  cutindex++;
650 
651  // Centrality Selection
652  if(!IsCentralitySelected(event,mcEvent)){
653  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
654  fEventQuality = 1;
655  return kFALSE;
656  }
657  cutindex++;
658 
660  if(fHistoEventCuts) fHistoEventCuts->Fill(cutindex);
661  fEventQuality = 12;
662  return kFALSE;
663  }
664  cutindex++;
665  // Fill Event Histograms
666  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
667  if(hCentrality)hCentrality->Fill(GetCentrality(event));
668  if(hVertexZ)hVertexZ->Fill(event->GetPrimaryVertex()->GetZ());
669  // if(hCentralityVsNumberOfPrimaryTracks)
670  // hCentralityVsNumberOfPrimaryTracks->Fill(GetCentrality(event),
671  // ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()
672  // ->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks());
673 
674  if(fIsHeavyIon == 1){
675  AliEventplane *EventPlane = event->GetEventplane();
676  fEventPlaneAngle = EventPlane->GetEventplane("V0",event,2);
677  if(hEventPlaneAngle)hEventPlaneAngle->Fill(TMath::Abs(fEventPlaneAngle));
678  }
679  if(hSPDClusterTrackletBackground) hSPDClusterTrackletBackground->Fill(nTracklets, (nClustersLayer0 + nClustersLayer1));
680 
681  fEventQuality = 0;
682  return kTRUE;
683 }
684 
688 
689  if(fCutString && fCutString->GetString().Length() == kNCuts) {
690  fCutString->SetString(GetCutNumber());
691  } else {
692  return kFALSE;
693  }
694  return kTRUE;
695 }
696 
699 
700  AliInfo("Entering loading of weights for centrality flattening");
701  TFile *w = TFile::Open(fPathWeightsFlatCent.Data());
702  if(!w){
703  AliError(Form("file for centrality flattening %s not found",fPathWeightsFlatCent.Data()));
704  return;
705  }
706 
707  if (fNameHistoNotFlatCentrality.CompareTo("") != 0 && (fDoCentralityFlat > 0)){
708  cout << "I have to find: " << fNameHistoNotFlatCentrality.Data() << endl;
709  TH1D *hCentralityNotFlattemp = (TH1D*)w->Get(fNameHistoNotFlatCentrality.Data());
710  hCentralityNotFlat = new TH1D(*hCentralityNotFlattemp);
711  if (hCentralityNotFlat) AliInfo(Form("%s has been loaded from %s", fNameHistoNotFlatCentrality.Data(),fPathWeightsFlatCent.Data() ));
712  else AliWarning(Form("%s not found in %s", fNameHistoNotFlatCentrality.Data() ,fPathWeightsFlatCent.Data()));
713  hCentralityNotFlat->SetDirectory(0);
714  }
715 
716  w->Close();
717  delete w;
718 }
719 
722 
723  AliInfo("Entering loading of weights for multiplicity weighting");
724  TFile *w = TFile::Open(fPathReweightingMult.Data());
725  if(!w){
726  AliError(Form("file for multiplicity reweighting %s not found",fPathReweightingMult.Data()));
727  return;
728  }
729 
730  if (fNameHistoReweightingMultData.CompareTo("") != 0 && (fDoMultiplicityWeighting > 0)){
731  cout << "I have to find: " << fNameHistoReweightingMultData.Data() << endl;
732  TH1D *hReweightMultDatatemp = (TH1D*)w->Get(fNameHistoReweightingMultData.Data());
733  if (hReweightMultDatatemp == NULL) AliError(Form("%s was not contained in %s", fNameHistoReweightingMultData.Data(),fPathReweightingMult.Data() ));
734  hReweightMultData = new TH1D(*hReweightMultDatatemp);
735  if (hReweightMultData) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingMultData.Data(),fPathReweightingMult.Data() ));
736  else AliWarning(Form("%s not found in %s", fNameHistoReweightingMultData.Data() ,fPathReweightingMult.Data()));
737  hReweightMultData->SetDirectory(0);
738  }
739  if (fNameHistoReweightingMultMC.CompareTo("") != 0 && (fDoMultiplicityWeighting > 0)){
740  cout << "I have to find: " << fNameHistoReweightingMultMC.Data() << endl;
741  TH1D *hReweightMultMCtemp = (TH1D*)w->Get(fNameHistoReweightingMultMC.Data());
742  if (hReweightMultMCtemp == NULL) AliError(Form("%s was not contained in %s", fNameHistoReweightingMultMC.Data(),fPathReweightingMult.Data() ));
743  hReweightMultMC = new TH1D(*hReweightMultMCtemp);
744  if (hReweightMultData) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingMultMC.Data(),fPathReweightingMult.Data() ));
745  else AliWarning(Form("%s not found in %s", fNameHistoReweightingMultMC.Data() ,fPathReweightingMult.Data()));
746  hReweightMultMC->SetDirectory(0);
747  }
748 
749  w->Close();
750  delete w;
751 }
752 
753 
756 
757  AliInfo("Entering loading of histograms for weighting");
758  TFile *f = TFile::Open(fPathTrFReweighting.Data());
759  if(!f){
760  AliError(Form("file for weighting %s not found",fPathTrFReweighting.Data()));
761  return;
762  }
763  if (fNameHistoReweightingPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){
764  cout << "I have to find: " << fNameHistoReweightingPi0.Data() << endl;
765  TH1D *hReweightMCHistPi0temp = (TH1D*)f->Get(fNameHistoReweightingPi0.Data());
766  hReweightMCHistPi0 = new TH1D(*hReweightMCHistPi0temp);
767  if (hReweightMCHistPi0) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingPi0.Data(),fPathTrFReweighting.Data() ));
768  else AliWarning(Form("%s not found in %s", fNameHistoReweightingPi0.Data() ,fPathTrFReweighting.Data()));
769  hReweightMCHistPi0->SetDirectory(0);
770  }
771  if (fNameFitDataPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){
772  cout << "I have to find: " << fNameFitDataPi0.Data() << endl;
773  TF1 *fFitDataPi0temp = (TF1*)f->Get(fNameFitDataPi0.Data());
774  fFitDataPi0 = new TF1(*fFitDataPi0temp);
775  if (fFitDataPi0) AliInfo(Form("%s has been loaded from %s", fNameFitDataPi0.Data(),fPathTrFReweighting.Data() ));
776  else AliWarning(Form("%s not found in %s",fPathTrFReweighting.Data(), fNameFitDataPi0.Data() ));
777  }
778 
779  if (fNameHistoReweightingEta.CompareTo("") != 0 && fDoReweightHistoMCEta){
780  cout << "I have to find: " << fNameHistoReweightingEta.Data() << endl;
781  TH1D *hReweightMCHistEtatemp = (TH1D*)f->Get(fNameHistoReweightingEta.Data());
782  hReweightMCHistEta = new TH1D(*hReweightMCHistEtatemp);
783  if (hReweightMCHistEta) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() ));
784  else AliWarning(Form("%s not found in %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() ));
785  hReweightMCHistEta->SetDirectory(0);
786  }
787 
788  if (fNameFitDataEta.CompareTo("") != 0 && fDoReweightHistoMCEta){
789  cout << "I have to find: " << fNameFitDataEta.Data() << endl;
790  TF1 *fFitDataEtatemp = (TF1*)f->Get(fNameFitDataEta.Data());
791  fFitDataEta = new TF1(*fFitDataEtatemp);
792  if (fFitDataEta) AliInfo(Form("%s has been loaded from %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() ));
793  else AliWarning(Form("%s not found in %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() ));
794 
795  }
796  if (fNameHistoReweightingK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){
797  cout << "I have to find: " << fNameHistoReweightingK0s.Data() << endl;
798  TH1D *hReweightMCHistK0stemp = (TH1D*)f->Get(fNameHistoReweightingK0s.Data());
799  hReweightMCHistK0s = new TH1D(*hReweightMCHistK0stemp);
800  if (hReweightMCHistK0s) AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() ));
801  else AliWarning(Form("%s not found in %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() ));
802  hReweightMCHistK0s->SetDirectory(0);
803  }
804 
805  if (fNameFitDataK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){
806  cout << "I have to find: " << fNameFitDataK0s.Data() << endl;
807  TF1 *fFitDataK0stemp = (TF1*)f->Get(fNameFitDataK0s.Data());
808  fFitDataK0s = new TF1(*fFitDataK0stemp);
809  if (fFitDataK0s) AliInfo(Form("%s has been loaded from %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() ));
810  else AliWarning(Form("%s not found in %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() ));
811  }
812  f->Close();
813  delete f;
814 }
815 
816 
819  fCutStringRead = Form("%s",analysisCutSelection.Data());
820 
821  // Initialize Cuts from a given Cut string
822  if(fDoCentralityFlat > 0){
823  AliInfo("Centrality flattening was enabled");
825  }
826 
828  AliInfo("Multiplicity weighting was enabled");
830  }
832  AliInfo("Particle Weighting was enabled");
834  }
835 
836 
837  AliInfo(Form("Set Event Cut Number: %s",analysisCutSelection.Data()));
838  if(analysisCutSelection.Length()!=kNCuts) {
839  AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
840  return kFALSE;
841  }
842  if(!analysisCutSelection.IsAlnum()){
843  AliError("Cut selection is not alphanumeric");
844  return kFALSE;
845  }
846 
847  if (fV0ReaderName.CompareTo("") == 0){
848  fV0ReaderName = "V0ReaderV1";
849  }
850  TString analysisCutSelectionLowerCase = Form("%s",analysisCutSelection.Data());
851  analysisCutSelectionLowerCase.ToLower();
852  const char *cutSelection = analysisCutSelectionLowerCase.Data();
853  #define ASSIGNARRAY(i) fCuts[i] = ((int)cutSelection[i]>=(int)'a') ? cutSelection[i]-'a'+10 : cutSelection[i]-'0'
854  for(Int_t ii=0;ii<kNCuts;ii++){
855  ASSIGNARRAY(ii);
856  }
857 
858  // Set Individual Cuts
859  for(Int_t ii=0;ii<kNCuts;ii++){
860  if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
861  }
862 
864 
865  return kTRUE;
866 }
867 
871 // "HeavyIon", //0
872 // "CentralityMin", //1
873 // "CentralityMax", //2
874 // "SelectSpecialTrigger", //3
875 // "SelectSpecialSubTriggerClass", //4
876 // "RemovePileUp", //5
877 // "RejectExtraSignals", //6
878 // "VertexCut", //7
879 
880  switch (cutID) {
881  case kisHeavyIon:
882  if( SetIsHeavyIon(value)) {
883  fCuts[kisHeavyIon] = value;
884  UpdateCutString();
885  return kTRUE;
886  } else return kFALSE;
887  case kCentralityMin:
888  if( SetCentralityMin(value)) {
889  fCuts[kCentralityMin] = value;
890  UpdateCutString();
891  return kTRUE;
892  } else return kFALSE;
893  case kCentralityMax:
894  if( SetCentralityMax(value)) {
895  fCuts[kCentralityMax] = value;
896  UpdateCutString();
897  return kTRUE;
898  } else return kFALSE;
900  if( SetSelectSpecialTrigger(value)) {
902  UpdateCutString();
903  return kTRUE;
904  } else return kFALSE;
906  if( SetSelectSubTriggerClass(value)) {
907  fCuts[kSelectSubTriggerClass] = value;
908  UpdateCutString();
909  return kTRUE;
910  } else return kFALSE;
911  case kremovePileUp:
912  if( SetRemovePileUp(value)) {
913  fCuts[kremovePileUp] = value;
914  UpdateCutString();
915  return kTRUE;
916  } else return kFALSE;
917  case kExtraSignals:
918  if( SetRejectExtraSignalsCut(value)) {
919  fCuts[kExtraSignals] = value;
920  UpdateCutString();
921  return kTRUE;
922  } else return kFALSE;
923  case kVertex:
924  if( SetVertexCut(value)) {
925  fCuts[kVertex] = value;
926  UpdateCutString();
927  return kTRUE;
928  } else return kFALSE;
929 
930  case kNCuts:
931  AliError("Cut id out of range");
932  return kFALSE;
933  }
934 
935  AliError("Cut id %d not recognized");
936  return kFALSE;
937 }
938 
941  // Print out current Cut Selection
942  for(Int_t ic = 0; ic < kNCuts; ic++) {
943  printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
944  }
945 }
946 
948  // Print out current Cut Selection with value
949  printf("\nEvent cutnumber \n");
950  for(Int_t ic = 0; ic < kNCuts; ic++) {
951  printf("%d",fCuts[ic]);
952  }
953  printf("\n\n");
954  if (fIsHeavyIon == 0) {
955  printf("Running in pp mode \n");
956  if (fSpecialTrigger == 0){
957  if (fSpecialSubTrigger == 0){
958  printf("\t only events triggered by V0OR will be analysed \n");
959  } else if (fSpecialSubTrigger == 1){
960  printf("\t only events where SDD was present will be analysed \n");
961  }
962  } else if (fSpecialTrigger == 1){
963  if (fSpecialSubTrigger == 0){
964  printf("\t only events triggered by V0AND will be analysed \n");
965  } else if(fSpecialSubTrigger == 1){
966  printf("\t only events where SDD was present will be analysed and triggered by VOAND\n");
967  }
968  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps");
969  } else if (fSpecialTrigger > 1){
970  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
971  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
972  }
973  if ( !(fCentralityMin == 0 && fCentralityMax == 0) && !(fCentralityMax < fCentralityMin) ){
974  printf("\t Multiplicity cut %d - %d \n", fCentralityMin, fCentralityMax);
975  }
976  } else if (fIsHeavyIon == 1){
977  printf("Running in PbPb mode \n");
978  if (fDetectorCentrality == 0){
979  printf("\t centrality selection based on V0M \n");
980  } else if (fDetectorCentrality == 1){
981  printf("\t centrality selection based on Cl1 \n");
982  }
983  if (fModCentralityClass == 0){
984  printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10);
985  } else if ( fModCentralityClass == 1){
986  printf("\t %d - %d \n", fCentralityMin*5, fCentralityMax*5);
987  } else if ( fModCentralityClass == 2){
988  printf("\t %d - %d \n", fCentralityMin*5+45, fCentralityMax*5+45);
989  } else if (fModCentralityClass == 3){
990  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*10, fCentralityMax*10);
991  } else if ( fModCentralityClass == 4){
992  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*5, fCentralityMax*5);
993  } else if ( fModCentralityClass == 5){
994  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*5+45, fCentralityMax*5+45);
995  }
996  if (fSpecialTrigger == 0){
997  printf("\t only events triggered by kMB, kCentral, kSemiCentral will be analysed \n");
998  } else if (fSpecialTrigger > 1){
999  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
1000  printf("\n\t SpecialTrigger is: %s\n", fSpecialTriggerName.Data());
1001  printf("\t SpecialSubTrigger is: %s\n", fSpecialSubTriggerName.Data());
1002  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
1003  }
1004  } else if (fIsHeavyIon == 2){
1005  printf("Running in pPb mode \n");
1006  if (fDetectorCentrality == 0){
1007  printf("\t centrality selection based on V0A \n");
1008  } else if (fDetectorCentrality == 1){
1009  printf("\t centrality selection based on Cl1 \n");
1010  }
1011  if (fModCentralityClass == 0){
1012  printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10);
1013  }
1014  if (fSpecialTrigger == 0){
1015  printf("\t only events triggered by kINT7 will be analysed \n");
1016  } else if (fSpecialTrigger > 1){
1017  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
1018  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
1019  }
1020  }
1021  if (fEnableVertexCut) printf("\t Vertex cut with |Z_{vtx}| <%2.2f \n",fMaxVertexZ);
1022  else printf("\t No vertex cut \n");
1023 
1024  if (fRemovePileUp ==1 ) {
1025  printf("\t Doing pile up removal \n");
1026  if (fDoPileUpRejectV0MTPCout ==1 ){
1027  printf("\t Doing extra pile up removal V0M vs TPCout \n");
1028  }
1029  }
1030 
1031  printf("MC event cuts: \n");
1032  if (fRejectExtraSignals == 0) printf("\t no rejection was applied \n");
1033  else if (fRejectExtraSignals == 1) printf("\t only MB header will be inspected \n");
1034  else if (fRejectExtraSignals > 1) printf("\t special header have been selected \n");
1035  printf("\t maximum factor between jet and pt hard = %2.2f \n", fMaxFacPtHard);
1036 }
1037 
1040 { // Set Cut
1041  switch(isHeavyIon){
1042  case 0:
1043  fIsHeavyIon=0;
1044  break;
1045  case 1:
1046  fIsHeavyIon=1;
1048  break;
1049  case 2:
1050  fIsHeavyIon=1;
1052  break;
1053  case 3: //allows to select centrality 0-45% in steps of 5% for V0 Multiplicity
1054  fIsHeavyIon=1;
1057  break;
1058  case 4: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1059  fIsHeavyIon=1;
1062  break;
1063  case 5: //strict cut on v0 tracks for MC
1064  fIsHeavyIon=1;
1067  break;
1068  case 6: //allows to select centrality 0-45% in steps of 5% for track mult
1069  //strict cut on v0 tracks for MC
1070  fIsHeavyIon=1;
1073  break;
1074  case 7: //allows to select centrality 45-90% in steps of 5% for V0 Multiplicity
1075  //strict cut on v0 tracks for MC
1076  fIsHeavyIon=1;
1079  break;
1080  case 8:
1081  fIsHeavyIon=2;
1083  break;
1084  case 9:
1085  fIsHeavyIon=2;
1087  break;
1088  default:
1089  AliError(Form("SetHeavyIon not defined %d",isHeavyIon));
1090  return kFALSE;
1091  }
1092  return kTRUE;
1093 }
1094 
1095 //___________________________________________________________________
1097 {
1098  // Set Cut
1099  if(minCentrality<0||minCentrality>9){
1100  AliError(Form("minCentrality not defined %d",minCentrality));
1101  return kFALSE;
1102  }
1103 
1104  fCentralityMin=minCentrality;
1105  return kTRUE;
1106 }
1107 
1108 //___________________________________________________________________
1110 {
1111  // Set Cut
1112  if(maxCentrality<0||maxCentrality>9){
1113  AliError(Form("maxCentrality not defined %d",maxCentrality));
1114  return kFALSE;
1115  }
1116  fCentralityMax=maxCentrality;
1117  return kTRUE;
1118 }
1119 
1122 {
1123  // Set Cut
1124  switch(selectSpecialTrigger){
1125  case 0:
1126  fSpecialTrigger=0; // V0OR
1127  break;
1128  case 1:
1129  fSpecialTrigger=1; // V0AND
1130  break;
1131 // case 2:
1132 // fSpecialTrigger=2; //
1133 // break;
1134  case 3:
1135  fSpecialTrigger=3; //specific centrality trigger selection
1136  fSpecialTriggerName="AliVEvent::kCentral/kSemiCentral/kMB";
1137  break;
1138  case 4:
1139  fSpecialTrigger=4; // trigger alias kTRD
1140  fOfflineTriggerMask=AliVEvent::kTRD;
1141  fTriggerSelectedManually = kTRUE;
1142  fSpecialTriggerName="AliVEvent::kTRD";
1143  break;
1144  case 5:
1145  fSpecialTrigger=5; // trigger alias kEMC
1146  fOfflineTriggerMask=AliVEvent::kEMC7 | AliVEvent::kEMC8 | AliVEvent::kEMC1 ;
1147  fTriggerSelectedManually = kTRUE;
1149  SETBIT(fTriggersEMCALSelected, kL0);
1150  fSpecialTriggerName="AliVEvent::kEMC7/kEMC8/kEMC1";
1151  break;
1152  case 6:
1153  fSpecialTrigger=6; // trigger alias kPHI
1154  fOfflineTriggerMask=AliVEvent::kPHI7 | AliVEvent::kPHI1 | AliVEvent::kPHI8 | AliVEvent::kPHOSPb;
1155  fTriggerSelectedManually = kTRUE;
1156  fSpecialTriggerName="AliVEvent::kPHI7/kPHI1/kPHI8/kPHOSPb";
1157  break;
1158  case 7:
1159  fSpecialTrigger=7; // trigger alias kHighMult
1160  fOfflineTriggerMask=AliVEvent::kHighMult;
1161  fTriggerSelectedManually = kTRUE;
1162  fSpecialTriggerName="AliVEvent::kHighMult";
1163  break;
1164  case 8:
1165  fSpecialTrigger=8; // trigger alias kEMCEGA
1166  fOfflineTriggerMask=AliVEvent::kEMCEGA;
1167  fTriggerSelectedManually = kTRUE;
1169  SETBIT(fTriggersEMCALSelected, kG2);
1170  fSpecialTriggerName="AliVEvent::kEMCEGA";
1171  break;
1172  case 9:
1173  fSpecialTrigger=9; // trigger alias kEMCEJE
1174  fOfflineTriggerMask=AliVEvent::kEMCEJE;
1175  fTriggerSelectedManually = kTRUE;
1177  SETBIT(fTriggersEMCALSelected, kJ2);
1178  fSpecialTriggerName="AliVEvent::kEMCEJE";
1179  break;
1180  default:
1181  AliError("Warning: Special Trigger Not known");
1182  return 0;
1183  }
1184  return 1;
1185 }
1186 
1189 {
1190  // Set Cut
1191  if (fSpecialTrigger == 0){ //OR
1192  switch(selectSpecialSubTriggerClass){
1193  case 0://with VZERO
1194  fSpecialTrigger=0;
1196 // AliInfo("Info: Nothing to be done");
1197  break;
1198  case 3: //V0OR with SDD requested (will only work with LHC11a dataset)
1200 // cout << "V0OR with SDD requested" << endl;
1201  break;
1202  default:
1203  AliError("Warning: Special Subtrigger Class Not known");
1204  return 0;
1205  }
1206  } else if (fSpecialTrigger == 1){ //AND with different detectors
1207  switch(selectSpecialSubTriggerClass){
1208  case 0: //with VZERO general implementation of V0AND (periods LHC11c onwards)
1209  fSpecialTrigger=0;
1211  fOfflineTriggerMask=AliVEvent::kINT7;
1212  fTriggerSelectedManually = kTRUE;
1213  fSpecialTriggerName="AliVEvent::kINT7";
1214  break;
1215  case 1: //with TZERO
1216  fSpecialTrigger=0;
1218  fOfflineTriggerMask=AliVEvent::kINT8;
1219  fTriggerSelectedManually = kTRUE;
1220  fSpecialTriggerName="AliVEvent::kINT8";
1221  break;
1222  case 2: //with VZERO (will only work with LHC11a dataset)
1223  fSpecialTrigger=1;
1225 // AliInfo("Info: Nothing to be done");
1226  break;
1227  case 3: //V0AND with SDD requested (will only work with LHC11a dataset)
1228  fSpecialTrigger=1;
1230  break;
1231  default:
1232  AliError("Warning: Special Subtrigger Class Not known");
1233  return 0;
1234  }
1235  } else if (fSpecialTrigger == 3){ // Selecting kCentral and kSemiCentral from trigger classes, not aliases
1236  switch(selectSpecialSubTriggerClass){
1237  case 0: // all together
1240 // AliInfo("Info: Nothing to be done");
1241  break;
1242  case 1: // kCentral - no vertex restriction
1245  fSpecialSubTriggerName="CVHN";
1246 // cout << "kCentralOpen" << endl;
1247  break;
1248  case 2: // kCentral - T00 +- 10 cm
1251  fSpecialSubTriggerName="CCENT";
1252 // cout << "kCentralVertex" << endl;
1253  break;
1254  case 3: // kCentral - both
1257  fSpecialSubTriggerName="CVHN|CCENT|CSEMI|CVLN";
1258 // cout << "kCentral both" << endl;
1259  break;
1260  case 4: // kSemiCentral - no vertex restriction
1263  fSpecialSubTriggerName="CVLN";
1264 // cout << "kSemiCentralOpen" << endl;
1265  break;
1266  case 5: // kSemiCentral - T00 +- 10 cm
1269  fSpecialSubTriggerName="CSEMI";
1270 // cout << "kSemiCentralVertex" << endl;
1271  break;
1272  case 6: // kSemiCentral - both
1275  fSpecialSubTriggerName="CSEMI%CVLN";
1276 // cout << "kSemiCentral both" << endl;
1277  break;
1278  case 7: // kMB
1281  fSpecialSubTriggerName="CPBI1_|CPBI1-";
1282 // cout << "kMB 1" << endl;
1283  break;
1284  case 8: // kMB
1287  fSpecialSubTriggerName="CPBI2_|CPBI2-";
1288 // cout << "kMB 2" << endl;
1289  break;
1290  case 9: // kMB
1293  fSpecialSubTriggerName="CPBI2_@CPBI2-@CPBI2_@CPBI2-";
1294 // cout << "kMB both" << endl;
1295  break;
1296  default:
1297  AliError("Warning: Special Subtrigger Class Not known");
1298  return 0;
1299  }
1300  } else if (fSpecialTrigger == 4){ // Subdivision of TRD trigger classes
1301  switch(selectSpecialSubTriggerClass){
1302  case 0: // all together
1305 // AliInfo("Info: Nothing to be done");
1306  break;
1307  case 1: // 7WUHSH - V0AND with single electron in TRD & EMCAL
1310  fSpecialSubTriggerName="7WUHEE";
1311  break;
1312  case 2: // 8WUHSH - T0AND with single electron in TRD & EMCAL
1315  fSpecialSubTriggerName="8WUHEE";
1316  break;
1317  case 3: // 7WUHSE - V0AND with single high pt electron in TRD
1320  fSpecialSubTriggerName="7WUHSE";
1321  break;
1322  case 4: // 8WUHSE - T0AND with single high pt electron in TRD
1325  fSpecialSubTriggerName="8WUHSE";
1326  break;
1327  case 5: // 7WUHJE - V0AND with jet in TRD
1330  fSpecialSubTriggerName="7WUHJT";
1331  break;
1332  case 6: // 8WUHJE - T0AND with jet in TRD
1335  fSpecialSubTriggerName="8WUHJT";
1336  break;
1337  case 7: // 7WUHQU - V0AND with dielectron pair in TRD
1340  fSpecialSubTriggerName="7WUHQU";
1341  break;
1342  case 8: // 8WUHQU - T0AND with dielectron pair in TRD
1345  fSpecialSubTriggerName="8WUHQU";
1346  break;
1347  default:
1348  AliError("Warning: Special Subtrigger Class Not known");
1349  return 0;
1350  }
1351  } else if (fSpecialTrigger == 5){ // Subdivision of kEMC trigger classes
1352  switch(selectSpecialSubTriggerClass){
1353  case 0: // all together
1356 // AliInfo("Info: Nothing to be done");
1357  break;
1358  case 1: // CEMC1 - V0OR and EMCAL fired
1359  fOfflineTriggerMask=AliVEvent::kEMC1;
1360  fSpecialTriggerName="AliVEvent::kEMC1";
1363  fSpecialSubTriggerName="CEMC1";
1364  break;
1365  case 2: // CEMC7 - V0AND and EMCAL fired
1367  fOfflineTriggerMask=AliVEvent::kEMC7;
1368  fSpecialTriggerName="AliVEvent::kEMC7";
1370  fSpecialSubTriggerName="CEMC7";
1371  break;
1372  case 3: // CEMC8 - T0OR and EMCAL fired
1373  fOfflineTriggerMask=AliVEvent::kEMC8;
1374  fSpecialTriggerName="AliVEvent::kEMC8";
1377  fSpecialSubTriggerName="CEMC8";
1378  break;
1379  case 4: // CDMC1 - V0OR and DCAL fired
1380  fOfflineTriggerMask=AliVEvent::kEMC1;
1381  fSpecialTriggerName="AliVEvent::kEMC1";
1384  fSpecialSubTriggerName="CDMC1";
1385  break;
1386  case 5: // CDMC7 - V0AND and DCAL fired
1388  fOfflineTriggerMask=AliVEvent::kEMC7;
1389  fSpecialTriggerName="AliVEvent::kEMC7";
1391  fSpecialSubTriggerName="CDMC7";
1392  break;
1393  case 6: // CDMC8 - T0OR and DCAL fired
1394  fOfflineTriggerMask=AliVEvent::kEMC8;
1395  fSpecialTriggerName="AliVEvent::kEMC8";
1398  fSpecialSubTriggerName="CDMC8";
1399  break;
1400  default:
1401  AliError("Warning: Special Subtrigger Class Not known");
1402  return 0;
1403  }
1404  }else if (fSpecialTrigger == 6){ // Subdivision of kPHI trigger classes
1405  switch(selectSpecialSubTriggerClass){
1406  case 0: // all together
1409 // AliInfo("Info: Nothing to be done");
1410  break;
1411  case 1: // CEMC1 - V0OR and EMCAL fired
1412  fOfflineTriggerMask=AliVEvent::kPHI1;
1413  fSpecialTriggerName="AliVEvent::kPHI1";
1416  fSpecialSubTriggerName="CPHI1";
1417  break;
1418  case 2: // CEMC7 - V0AND and EMCAL fired
1420  fOfflineTriggerMask=AliVEvent::kPHI7;
1421  fSpecialTriggerName="AliVEvent::kPHI7";
1423  fSpecialSubTriggerName="CPHI7";
1424  break;
1425  case 3: // CEMC8 - T0OR and EMCAL fired
1426  fOfflineTriggerMask=AliVEvent::kPHI8;
1427  fSpecialTriggerName="AliVEvent::kPHI8";
1430  fSpecialSubTriggerName="CPHI8";
1431  break;
1432  default:
1433  AliError("Warning: Special Subtrigger Class Not known");
1434  return 0;
1435  }
1436  } else if (fSpecialTrigger == 7){ // Subdivision of kHighMult trigger classes
1437  switch(selectSpecialSubTriggerClass){
1438  case 0: // all together
1441 // AliInfo("Info: Nothing to be done");
1442  break;
1443  case 1: // CSHM1 - V0OR and high mult fired
1446  fSpecialSubTriggerName="CSHM1";
1447  break;
1448  case 2: // CSHM7 - V0AND and high mult fired
1451  fSpecialSubTriggerName="CSHM7";
1452  break;
1453  case 3: // CSHM8 - T0OR and high mult fired
1456  fSpecialSubTriggerName="CSHM8";
1457  break;
1458  case 4: // V0 high mult trigger
1460  fOfflineTriggerMask=AliVEvent::kAny;
1461  fSpecialTriggerName="V0Mult";
1463  fSpecialSubTriggerName="CVHMV0M-B-";
1464  break;
1465  case 5: // SPD high mult trigger
1467  fOfflineTriggerMask=AliVEvent::kAny;
1468  fSpecialTriggerName="SPMult";
1470  fSpecialSubTriggerName="CVHMSH2-B-";
1471  break;
1472 
1473  default:
1474  AliError("Warning: Special Subtrigger Class Not known");
1475  return 0;
1476  }
1477  }else if (fSpecialTrigger == 8){ // Subdivision of kEMCEGA trigger classes
1478  switch(selectSpecialSubTriggerClass){
1479  case 0: // all together
1482 // AliInfo("Info: Nothing to be done");
1483  break;
1484  case 1: // 7EGA - CINT7 EGA
1487  fSpecialSubTriggerName="7EGA";
1489  SETBIT(fTriggersEMCALSelected, kG2);
1490  break;
1491  case 2: // 8EGA - CINT8 EGA
1494  fSpecialSubTriggerName="8EGA";
1496  SETBIT(fTriggersEMCALSelected, kG2);
1497  break;
1498  case 3: // 7EG1 - CINT7 EG1
1501  fSpecialSubTriggerName="7EG1";
1503  SETBIT(fTriggersEMCALSelected, kG1);
1504  break;
1505  case 4: // 8EG1 - CINT8 EG1
1508  fSpecialSubTriggerName="8EG1";
1510  SETBIT(fTriggersEMCALSelected, kG1);
1511  break;
1512  case 5: // 7EG2 - CINT7 EG2
1515  fSpecialSubTriggerName="7EG2";
1517  SETBIT(fTriggersEMCALSelected, kG2);
1518  break;
1519  case 6: // 8EG2 - CINT8 EG2
1522  fSpecialSubTriggerName="8EG2";
1524  SETBIT(fTriggersEMCALSelected, kG2);
1525  break;
1526  case 7: // 7DGA - CINT7 DGA
1529  fSpecialSubTriggerName="7DGA";
1531  SETBIT(fTriggersEMCALSelected, kG2);
1532  break;
1533  case 8: // 8DGA - CINT8 DGA
1536  fSpecialSubTriggerName="8DGA";
1538  SETBIT(fTriggersEMCALSelected, kG2);
1539  break;
1540  case 9: // 7DG1 - CINT7 DG1
1543  fSpecialSubTriggerName="7DG1";
1545  SETBIT(fTriggersEMCALSelected, kG1);
1546  break;
1547  case 10: // 8DG1 - CINT8 DG1
1550  fSpecialSubTriggerName="8DG1";
1552  SETBIT(fTriggersEMCALSelected, kG1);
1553  break;
1554  case 11: // 7DG2 - CINT7 DG2
1557  fSpecialSubTriggerName="7DG2";
1559  SETBIT(fTriggersEMCALSelected, kG2);
1560  break;
1561  case 12: // 8DG2 - CINT8 DG2
1564  fSpecialSubTriggerName="8DG2";
1566  SETBIT(fTriggersEMCALSelected, kG2);
1567  break;
1568 
1569  default:
1570  AliError("Warning: Special Subtrigger Class Not known");
1571  return 0;
1572  }
1573  } else if (fSpecialTrigger == 9){ // Subdivision of kEMCEGA trigger classes
1574  switch(selectSpecialSubTriggerClass){
1575  case 0: // all together
1578 // AliInfo("Info: Nothing to be done");
1579  break;
1580  case 1: // 7EJE - CINT7 EJE
1583  fSpecialSubTriggerName="7EJE";
1585  SETBIT(fTriggersEMCALSelected, kJ2);
1586  break;
1587  case 2: // 8EJE - CINT8 EJE
1590  fSpecialSubTriggerName="8EJE";
1592  SETBIT(fTriggersEMCALSelected, kJ2);
1593  break;
1594  case 3: // 7EJ1 - CINT7 EJ1
1597  fSpecialSubTriggerName="7EJ1";
1599  SETBIT(fTriggersEMCALSelected, kJ1);
1600  break;
1601  case 4: // 8EJ1 - CINT8 EJ1
1604  fSpecialSubTriggerName="8EJ1";
1606  SETBIT(fTriggersEMCALSelected, kJ1);
1607  break;
1608  case 5: // 7EJ2 - CINT7 EJ2
1611  fSpecialSubTriggerName="7EJ2";
1613  SETBIT(fTriggersEMCALSelected, kJ2);
1614  break;
1615  case 6: // 8EJ2 - CINT8 EJ2
1618  fSpecialSubTriggerName="8EJ2";
1620  SETBIT(fTriggersEMCALSelected, kJ2);
1621  break;
1622  case 7: // 7DJ1 - CINT7 DJ1
1625  fSpecialSubTriggerName="7DJ1";
1627  SETBIT(fTriggersEMCALSelected, kJ1);
1628  break;
1629  case 8: // 8DJ1 - CINT8 DJ1
1632  fSpecialSubTriggerName="8DJ1";
1634  SETBIT(fTriggersEMCALSelected, kJ1);
1635  break;
1636  case 9: // 7DJ2 - CINT7 DJ2
1639  fSpecialSubTriggerName="7DJ2";
1641  SETBIT(fTriggersEMCALSelected, kJ2);
1642  break;
1643  case 10: // 8DJ2 - CINT8 DJ2
1646  fSpecialSubTriggerName="8DJ2";
1648  SETBIT(fTriggersEMCALSelected, kJ2);
1649  break;
1650 
1651  default:
1652  AliError("Warning: Special Subtrigger Class Not known");
1653  return 0;
1654  }
1655  }
1656  return 1;
1657 }
1658 
1659 //________________________________________________________________________
1661 {
1662  // Set Cut
1663  fMultiplicityMethod=multiplicityMethod;
1664 
1665  // 0 Photon Multiplicity
1666  // 1 TPC Track multiplicity
1667  // 2 V0 Mult
1668  // 3 SPD Mult
1669 
1670  return kTRUE;
1671 }
1672 
1673 //________________________________________________________________________
1675 {// Set Cut
1676  switch(removePileUp){
1677  case 0:
1678  fRemovePileUp = kFALSE;
1679  break;
1680  case 1:
1681  fRemovePileUp = kTRUE;
1682  break;
1683  case 2:
1684  fRemovePileUp = kTRUE;
1687  break;
1688  case 3:
1689  fRemovePileUp = kTRUE;
1692  break;
1693  case 4:
1694  fRemovePileUp = kTRUE;
1697  break;
1698  case 5:
1699  fRemovePileUp = kTRUE;
1702  break;
1703  case 6:
1704  fRemovePileUp = kTRUE;
1705  fDoPileUpRejectV0MTPCout = kTRUE;
1706  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
1707  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
1708  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
1709  if (fIsHeavyIon==1){
1710  if(fPeriodEnum == kLHC15o){
1711  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
1712  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
1713  break;
1714  }else{
1715  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
1716  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
1717  break;
1718  }
1719  } else if(fIsHeavyIon == 2){
1720  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
1721  fFPileUpRejectV0MTPCout->SetParameter(1,2.0);
1722  break;
1723  }else{
1724  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
1725  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
1726  break;
1727  }
1728  break;
1729  case 7:
1730  fRemovePileUp = kTRUE;
1731  fDoPileUpRejectV0MTPCout = kTRUE;
1732  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
1733  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
1734  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
1735  if (fIsHeavyIon==1){
1736  if(fPeriodEnum == kLHC15o){
1737  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
1738  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
1739  break;
1740  }else{
1741  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
1742  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
1743  break;
1744  }
1745  } else if(fIsHeavyIon == 2){
1746  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
1747  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
1748  break;
1749  }else{
1750  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
1751  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
1752  break;
1753  }
1754  break;
1755  case 8:
1756  fRemovePileUp = kTRUE;
1757  fDoPileUpRejectV0MTPCout = kTRUE;
1758  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
1759  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
1760  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
1761  if (fIsHeavyIon==1){
1762  if(fPeriodEnum == kLHC15o){
1763  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
1764  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
1765  break;
1766  }else{
1767  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
1768  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
1769  break;
1770  }
1771  } else if(fIsHeavyIon == 2){
1772  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
1773  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
1774  break;
1775  }else{
1776  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
1777  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
1778  break;
1779  }
1780  break;
1781  case 9:
1782  fRemovePileUp = kTRUE;
1785  fDoPileUpRejectV0MTPCout = kTRUE;
1786  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
1787  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
1788  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
1789  if (fIsHeavyIon==1){
1790  if(fPeriodEnum == kLHC15o){
1791  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
1792  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
1793  break;
1794  }else{
1795  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
1796  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
1797  break;
1798  }
1799  } else if(fIsHeavyIon == 2){
1800  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
1801  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
1802  break;
1803  }else{
1804  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
1805  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
1806  break;
1807  }
1808  break;
1809  default:
1810  AliError("RemovePileUpCut not defined");
1811  return kFALSE;
1812  }
1813  return kTRUE;
1814 }
1815 
1816 //________________________________________________________________________
1818 
1819  switch(extraSignal){
1820  case 0:
1821  fRejectExtraSignals = 0;
1822  break; // No Rejection
1823  case 1:
1824  fRejectExtraSignals = 1;
1825  break; // MinBias Header
1826  case 2:
1827  fRejectExtraSignals = 2;
1828  break; // User String Array
1829  case 3:
1830  fRejectExtraSignals = 3;
1831  break; // Rejection for Gamma Correction only
1832  default:
1833  AliError(Form("Extra Signal Rejection not defined %d",extraSignal));
1834  return kFALSE;
1835  }
1836  return kTRUE;
1837 }
1838 
1839 //________________________________________________________________________
1841 
1842  switch(vertexCut){
1843  case 0: // no Vertex required // NOT fully working yet
1844  fEnableVertexCut = kFALSE;
1845  fMaxVertexZ = 1000;
1846  break;
1847  case 1: // vertex within +-15 cm
1848  fEnableVertexCut = kTRUE;
1849  fMaxVertexZ = 15;
1850  break;
1851  case 2: // vertex within +-12.5 cm
1852  fEnableVertexCut = kTRUE;
1853  fMaxVertexZ = 12.5;
1854  break;
1855  case 3: // vertex within +-10 cm
1856  fEnableVertexCut = kTRUE;
1857  fMaxVertexZ = 10.0;
1858  break;
1859  case 4: // vertex within +-7.5 cm
1860  fEnableVertexCut = kTRUE;
1861  fMaxVertexZ = 7.5;
1862  break;
1863  case 5: // vertex within +-5 cm
1864  fEnableVertexCut = kTRUE;
1865  fMaxVertexZ = 5.;
1866  break;
1867  default:
1868  AliError(Form("Vertex Cut not defined %d",vertexCut));
1869  return kFALSE;
1870  }
1871  return kTRUE;
1872 }
1873 
1874 //-------------------------------------------------------------
1876  if (fPeriodEnum == kLHC15o || // PbPb 5TeV
1877  fPeriodEnum == kLHC15k1a1 || fPeriodEnum == kLHC15k1a2 || fPeriodEnum == kLHC15k1a3 || fPeriodEnum == kLHC16j7 || // MC PbPb 5TeV LowIR
1878  fPeriodEnum == kLHC16h4 || // MC PbPb 5TeV added signals
1879  fPeriodEnum == kLHC16g1 || fPeriodEnum == kLHC16g1a || fPeriodEnum == kLHC16g1b || fPeriodEnum == kLHC16g1c || // MC PbPb 5TeV general purpose
1881  fPeriodEnum == kLHC16h2a || fPeriodEnum == kLHC16h2b || fPeriodEnum == kLHC16h2c || // MC PbPb 5TeV jet-jet
1882  fPeriodEnum == kLHC15fm || // pp 13TeV
1883  fPeriodEnum == kLHC15g3a3 || fPeriodEnum == kLHC15g3c3 || // MC pp 13TeV
1884  fPeriodEnum == kLHC16q || fPeriodEnum == kLHC16t || // pPb 5TeV LHC16qt
1887  ){
1888  return kTRUE;
1889  } else {
1890  return kFALSE;
1891  }
1892 }
1893 
1894 //-------------------------------------------------------------
1896 { // Get Event Centrality
1897 
1898  AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
1899  if(esdEvent){
1901  AliMultSelection *MultSelection = (AliMultSelection*)event->FindListObject("MultSelection");
1902  if(!MultSelection){
1903  AliWarning ("AliMultSelection object not found !");
1904  return -1;
1905  }else{
1906  if(fDetectorCentrality==0){
1907  if(fIsHeavyIon==2) return MultSelection->GetMultiplicityPercentile("V0A");// default for pPb
1908  else return MultSelection->GetMultiplicityPercentile("V0M");// default
1909  }else if(fDetectorCentrality==1) return MultSelection->GetMultiplicityPercentile("CL1",kTRUE);
1910  }
1911  }else{
1912  AliCentrality *fESDCentrality = (AliCentrality*)esdEvent->GetCentrality();
1913  if(fDetectorCentrality==0){
1914  if(fIsHeavyIon==2) return fESDCentrality->GetCentralityPercentile("V0A"); // default for pPb
1915  else return fESDCentrality->GetCentralityPercentile("V0M"); // default
1916  }else if(fDetectorCentrality==1) return fESDCentrality->GetCentralityPercentile("CL1");
1917  }
1918  }
1919 
1920  AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
1921  if(aodEvent){
1923  AliMultSelection *MultSelection = (AliMultSelection*)aodEvent->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",kTRUE);
1931  }else if(fDetectorCentrality==1) return MultSelection->GetMultiplicityPercentile("CL1",kTRUE);
1932  }
1933  }else{
1934  if(aodEvent->GetHeader()){return ((AliVAODHeader*)aodEvent->GetHeader())->GetCentrality();}
1935  }
1936  }
1937 
1938  return -1;
1939 }
1940 
1941 //_____________________________________________________________________________________
1942 Bool_t AliConvEventCuts::IsCentralitySelected(AliVEvent *event, AliMCEvent *mcEvent)
1943 { // Centrality Selection
1944  if(!fIsHeavyIon){
1945  if ((fCentralityMin == 0 && fCentralityMax == 0) || (fCentralityMin > fCentralityMax) ){
1946  return kTRUE;
1947  } else {
1948  Int_t primaryTracksPP[9] = { 0, 2, 5, 10, 15,
1949  30, 50, 100, 1000
1950  };
1951  Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks();
1952  if ( nprimaryTracks >= primaryTracksPP[fCentralityMin] && nprimaryTracks < primaryTracksPP[fCentralityMax]){
1953  return kTRUE;
1954  } else {
1955  return kFALSE;
1956  }
1957  return kFALSE;
1958  }
1959  }
1960  if(fCentralityMin == fCentralityMax ) return kTRUE;//0-100%
1961  else if ( fCentralityMax==0) fCentralityMax=10; //CentralityRange = fCentralityMin-10*multfactor
1963  if(centrality<0)return kFALSE;
1964 
1965  Int_t centralityC=0;
1966  if (fModCentralityClass == 0){
1967  centralityC= Int_t(centrality/10);
1968  if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
1969  return kTRUE;
1970  else return kFALSE;
1971  }
1972  else if (fModCentralityClass ==1){
1973  centralityC= Int_t(centrality);
1974  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
1975  return kTRUE;
1976  } else return kFALSE;
1977  }
1978  else if (fModCentralityClass ==2){
1979  centralityC= Int_t(centrality);
1980  if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
1981  return kTRUE;
1982  else return kFALSE;
1983  }
1984 
1985  Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks();
1986  Int_t PrimaryTracks10[11][2] =
1987  {
1988  {9999,9999}, // 0 //1550 changed to 9999 on 9 Dec
1989  {1210, 928}, // 10
1990  { 817, 658}, // 20
1991  { 536, 435}, // 30
1992  { 337, 276}, // 40
1993  { 197, 162}, // 50
1994  { 106, 100}, // 60
1995  { 51, 44}, // 70
1996  { 21, 18}, // 80
1997  { 0, 0}, // 90
1998  { 0, 0}// 100 // only max accessible
1999  };
2000  Int_t PrimaryTracksLHC11h10[11][2] =
2001  {
2002  {9999,9999}, // 0 //1550 changed to 9999 on 9 Dec
2003  { 985, 928}, // 10
2004  { 661, 658}, // 20
2005  { 434, 435}, // 30
2006  { 275, 276}, // 40
2007  { 173, 162}, // 50
2008  { 100, 100}, // 60
2009  { 42, 44}, // 70
2010  { 19, 18}, // 80
2011  { 0, 0}, // 90
2012  { 0, 0}// 100 // only max accessible
2013  };
2014  Int_t PrimaryTracks5a[11][2] =
2015  {
2016  {9999,9999}, // 0 ///1550 changed to 9999 on 9 Dec
2017  {1485,1168}, // 5
2018  {1210, 928}, // 10
2019  { 995, 795}, // 15
2020  { 817, 658}, // 20
2021  { 666, 538}, // 25
2022  { 536, 435}, // 30
2023  { 428, 350}, // 35
2024  { 337, 276}, // 40
2025  { 260, 214}, // 45
2026  { 0, 162}// 50 only max accessible
2027  };
2028  Int_t PrimaryTracksLHC11h5a[11][2] =
2029  {
2030  {9999,9999}, // 0 ///1550 changed to 9999 on 9 Dec
2031  {1166,1168}, // 5
2032  { 953, 928}, // 10
2033  { 805, 795}, // 15
2034  { 655, 658}, // 20
2035  { 535, 538}, // 25
2036  { 435, 435}, // 30
2037  { 349, 350}, // 35
2038  { 275, 276}, // 40
2039  { 214, 214}, // 45
2040  { 165, 162}// 50 only max accessible
2041  };
2042  Int_t PrimaryTracks5b[11][2] =
2043  {
2044  { 260, 214}, // 45
2045  { 197, 162}, // 50
2046  { 147, 125}, // 55
2047  { 106, 100}, // 60
2048  { 75, 63}, // 65
2049  { 51, 44}, // 70
2050  { 34, 29}, // 75
2051  { 21, 18}, // 80
2052  { 13, 11}, // 85
2053  { 0, 0}, // 90
2054  { 0, 0}// 100 only max accessible
2055  };
2056  Int_t PrimaryTracksLHC11h5b[11][2] =
2057  {
2058  { 214, 214}, // 45
2059  { 165, 162}, // 50
2060  { 127, 125}, // 55
2061  { 93, 100}, // 60
2062  { 64, 63}, // 65
2063  { 44, 44}, // 70
2064  { 30, 29}, // 75
2065  { 18, 18}, // 80
2066  { 11, 11}, // 85
2067  { 0, 0}, // 90
2068  { 0, 0}// 100 only max accessible
2069  };
2070  Int_t column = 0;
2071  if(event->IsA()==AliESDEvent::Class()) column = 0;
2072  if(event->IsA()==AliAODEvent::Class()) column = 1;
2073 
2074  if (fModCentralityClass == 3){
2075  if(mcEvent){
2077  if(nprimaryTracks > PrimaryTracksLHC11h10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h10[fCentralityMin][column])
2078  return kTRUE;
2079  else return kFALSE;
2080  } else {
2081  if(nprimaryTracks > PrimaryTracks10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks10[fCentralityMin][column])
2082  return kTRUE;
2083  else return kFALSE;
2084  }
2085  }
2086  else{
2087  centralityC= Int_t(centrality/10);
2088  if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2089  return kTRUE;
2090  else return kFALSE;
2091  }
2092  }
2093  else if (fModCentralityClass ==4){
2094  if(mcEvent){
2096  if(nprimaryTracks > PrimaryTracksLHC11h5a[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h5a[fCentralityMin][column])
2097  return kTRUE;
2098  else return kFALSE;
2099  } else {
2100  if(nprimaryTracks > PrimaryTracks5a[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5a[fCentralityMin][column])
2101  return kTRUE;
2102  else return kFALSE;
2103  }
2104  }
2105  else{
2106  centralityC= Int_t(centrality);
2107  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2108  return kTRUE;
2109  } else return kFALSE;
2110  }
2111  }
2112  else if (fModCentralityClass ==5){
2113  if(mcEvent){
2115  if(nprimaryTracks > PrimaryTracksLHC11h5b[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h5b[fCentralityMin][column])
2116  return kTRUE;
2117  else return kFALSE;
2118  } else {
2119  if(nprimaryTracks > PrimaryTracks5b[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks5b[fCentralityMin][column])
2120  return kTRUE;
2121  else return kFALSE;
2122  }
2123  }
2124  else{
2125  centralityC= Int_t(centrality);
2126  if(centralityC >= ((fCentralityMin*5)+45) && centralityC < ((fCentralityMax*5)+45))
2127  return kTRUE;
2128  else return kFALSE;
2129  }
2130  }
2131 
2132  return kFALSE;
2133 }
2134 
2135 //________________________________________________________________________
2137  // Cut on z position of primary vertex
2138  Double_t fVertexZ=event->GetPrimaryVertex()->GetZ();
2139  Double_t fVertexZSPD = 0;
2140  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2141  if(fESDEvent){
2142  fVertexZSPD = fESDEvent->GetPrimaryVertexSPD()->GetZ();
2143  }
2144  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2145  if(fAODEvent){
2146  fVertexZSPD = fAODEvent->GetPrimaryVertexSPD()->GetZ();
2147  }
2148 
2149  if(TMath::Abs(fVertexZ)>fMaxVertexZ)return kFALSE;
2150 
2151 
2152  if (fPeriodEnum == kLHC11h){
2153  if (TMath::Abs(fVertexZ-fVertexZSPD) > 0.1) return kFALSE;
2154  }
2155  if (fIsHeavyIon == 2){
2156  if(!fUtils->IsVertexSelected2013pA(event)) return kFALSE;
2157  }
2158 
2159  return kTRUE;
2160 }
2161 
2162 //________________________________________________________________________
2164 {
2165  TBits fIR1 = event->GetHeader()->GetIRInt1InteractionMap(); // IR1 contains V0 information (VIR)
2166  TBits fIR2 = event->GetHeader()->GetIRInt2InteractionMap(); // IR2 contains T0 information
2167  UShort_t bunchCrossings = event->GetBunchCrossNumber();
2168 
2170  for(Int_t i = 0; i<180;i++){
2171  if(fIR1.TestBitNumber(i))
2172  fHistoPastFutureBits->Fill((i*25)-90*25);
2173  }
2174  }
2175 
2176  Bool_t isOutOfBunchPileup = 0;
2177  Int_t pf1 = fPastFutureRejectionLow +bunchCrossings%4;
2178  Int_t pf2 = fPastFutureRejectionHigh+bunchCrossings%4;
2179  if(pf1 < -89) pf1 = -89;
2180  if(pf2 > 89) pf2 = 89;
2181  Int_t pf2maxForT0 = pf2;
2182  Int_t ir1skip = 0;
2183  for (Int_t i=pf1;i<=pf2;i++) {
2184  if (i==0) continue;
2185  if (i<=pf2maxForT0) isOutOfBunchPileup|=fIR2.TestBitNumber(90+i); // T0-based clean-up
2186  if (i>0 && i<=ir1skip) continue; // skip next 2 for old IR definitions
2187  isOutOfBunchPileup|=fIR1.TestBitNumber(90+i); // V0-based clean-up
2188  }
2189  return isOutOfBunchPileup;
2190 }
2191 //________________________________________________________________________
2192 
2194 {
2195  Bool_t isPileUpV0MTPCout=0;
2196 
2197  Double_t multV0M;
2198  Double_t valFunc;
2199  if (fIsHeavyIon==2){
2200  multV0M = event->GetVZEROData()->GetMTotV0A();
2201  }else{
2202  multV0M = event->GetVZEROData()->GetMTotV0A() + event->GetVZEROData()->GetMTotV0C() ;
2203  }
2204 
2205  if ( fFPileUpRejectV0MTPCout != 0x0 ){
2206  valFunc= fFPileUpRejectV0MTPCout->Eval(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfTPCoutTracks());
2207  if (multV0M < valFunc ) isPileUpV0MTPCout=1;
2208  }
2209 
2210  return isPileUpV0MTPCout;
2211 
2212 }
2213 //________________________________________________________________________
2215  // returns number of contributors to the vertex
2216 
2217  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2218  if(fESDEvent){
2219  if (fESDEvent->GetPrimaryVertex() != NULL){
2220  if(fESDEvent->GetPrimaryVertex()->GetNContributors()>0) {
2221  // cout << "accepted global" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertex()->GetNContributors() << endl;
2222  return fESDEvent->GetPrimaryVertex()->GetNContributors();
2223  }
2224  }
2225 
2226  if(fESDEvent->GetPrimaryVertexSPD() !=NULL){
2227  if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2228  // cout << "accepted SPD" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertexSPD()->GetNContributors() << endl;
2229  return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
2230  }else {
2231  AliWarning(Form("Number of contributors from bad vertex type:: %s",fESDEvent->GetPrimaryVertex()->GetName()));
2232  // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
2233  return 0;
2234  }
2235  }
2236  }
2237 
2238  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2239  if(fAODEvent){
2240  if (fAODEvent->GetPrimaryVertex() != NULL){
2241  if(fAODEvent->GetPrimaryVertex()->GetNContributors()>0) {
2242  return fAODEvent->GetPrimaryVertex()->GetNContributors();
2243  }
2244  }
2245  if(fAODEvent->GetPrimaryVertexSPD() !=NULL){
2246  if(fAODEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2247  return fAODEvent->GetPrimaryVertexSPD()->GetNContributors();
2248  } else {
2249  AliWarning(Form("Number of contributors from bad vertex type:: %s",fAODEvent->GetPrimaryVertex()->GetName()));
2250  return 0;
2251  }
2252  }
2253  }
2254  // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
2255  return 0;
2256 }
2257 
2258 //________________________________________________________________________
2259 // Analysing Jet-Jet MC's
2260 //________________________________________________________________________
2262  AliGenCocktailEventHeader *cHeader = 0x0;
2263  Bool_t headerFound = kFALSE;
2264  weight = -1;
2265  fMaxPtJetMC = 0;
2266 
2267  if ( fPeriodEnum != kLHC17f8a && fPeriodEnum != kLHC17f8b && fPeriodEnum != kLHC17f8c && // LHC16X Jet Jet MC's
2269  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
2270  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
2271  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
2272  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
2273  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
2274  fPeriodEnum != kLHC16c2 && fPeriodEnum != kLHC16c2_plus // LHC12 JetJet MC
2275  ){
2276 
2277  weight = 1;
2278  return kTRUE;
2279  }
2280 
2281  if(mcEvent){
2282  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
2283  if(cHeader) headerFound = kTRUE;
2284  }else{
2285  //no mcEvent available -> not running on MC
2286  weight = 1;
2287  return kTRUE;
2288  }
2289 
2290  if(headerFound){
2291  TList *genHeaders = 0x0;
2292  if(cHeader) genHeaders = cHeader->GetHeaders();
2293  AliGenEventHeader* gh = 0;
2294  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
2295  gh = (AliGenEventHeader*)genHeaders->At(i);
2296  TString GeneratorName = gh->GetName();
2297  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0){
2298  Bool_t eventAccepted = kTRUE;
2299  TParticle * jet = 0;
2300  Int_t nTriggerJets = dynamic_cast<AliGenPythiaEventHeader*>(gh)->NTriggerJets();
2301  Float_t ptHard = dynamic_cast<AliGenPythiaEventHeader*>(gh)->GetPtHard();
2302  Float_t tmpjet[]={0,0,0,0};
2303  for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){
2304  dynamic_cast<AliGenPythiaEventHeader*>(gh)->TriggerJet(ijet, tmpjet);
2305  jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
2306  //Compare jet pT and pt Hard
2307  if(jet->Pt() > fMaxFacPtHard * ptHard){
2308  eventAccepted= kFALSE;
2309  }
2310  if (jet->Pt() > fMaxPtJetMC) fMaxPtJetMC = jet->Pt();
2311  }
2312  if (jet) delete jet;
2313  if (mcEvent){
2314  for(Long_t i = 0; i < mcEvent->GetNumberOfPrimaries(); i++) {
2315  TParticle* particle = (TParticle *)mcEvent->Particle(i);
2316  if (!particle) continue;
2317  if (TMath::Abs(particle->GetPdgCode()) == 111 || TMath::Abs(particle->GetPdgCode()) == 221){
2318  if (particle->Pt() > fMaxFacPtHardSingleParticle*ptHard){
2319  eventAccepted= kFALSE;
2320  }
2321  }
2322 
2323  }
2324  }
2325 
2326  if ( fPeriodEnum == kLHC17f8b) {
2327  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2328  21, 28, 36, 45, 57,
2329  70, 85, 99, 115, 132,
2330  150, 169, 190, 212, 235,
2331  1000000};
2332  Double_t weightsBins[20] = { 43.7553, 13.5848, 6.788, 2.67826, 0.975255,
2333  0.39069, 0.127342, 0.0465597, 0.0206539, 0.00750243,
2334  0.00319118, 0.00122291, 0.000641232, 0.000321437, 0.000168273,
2335  9.17033e-05, 5.34755e-05, 3.01354e-05, 1.74518e-05, 2.8004e-05};
2336 
2337  Int_t bin = 0;
2338  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2339  if (bin < 20) weight = weightsBins[bin];
2340 
2341  } else if ( fPeriodEnum == kLHC17f8c ){
2342  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2343  21, 28, 36, 45, 57,
2344  70, 85, 99, 115, 132,
2345  150, 169, 190, 212, 235,
2346  1000000};
2347  Double_t weightsBins[20] = { 43.8654, 13.6215, 6.79856, 2.67526, 0.978794,
2348  0.390797, 0.127769, 0.0465714, 0.0206173, 0.00750282,
2349  0.00318773, 0.00122533, 0.000644385, 0.000321225, 0.00016846,
2350  9.18305e-05, 5.33507e-05, 3.00677e-05, 1.74608e-05, 2.80823e-05};
2351 
2352  Int_t bin = 0;
2353  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2354  if (bin < 20) weight = weightsBins[bin];
2355 
2356  } else if ( fPeriodEnum == kLHC16h3 ){
2357  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2358  21, 28, 36, 45, 57,
2359  70, 85, 99, 115, 132,
2360  150, 169, 190, 212, 235,
2361  1000000};
2362  Double_t weightsBins[20] = { 0.957702, 0.41837, 0.406279, 0.266936, 0.135179,
2363  6.4687e-02, 2.27254e-02, 8.30769e-03, 3.56008e-03, 1.22934e-03,
2364  4.91352e-04, 1.77601e-04, 8.79608e-05, 4.13652e-05, 2.02997e-05,
2365  1.03682e-06, 5.64732e-06, 2.96158e-06, 1.5999e-06, 2.08374e-06};
2366 
2367  Int_t bin = 0;
2368  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2369  if (bin < 20) weight = weightsBins[bin];
2370 
2371 
2372  } else if ( fPeriodEnum == kLHC15a3b || fPeriodEnum == kLHC15g1b ){
2373  Double_t ptHardBinRanges[13] = { 5, 7, 9, 12, 16,
2374  21, 28, 36, 45, 57,
2375  70, 85, 1000};
2376  Double_t weightsBins[12] = { 7.858393e-03, 4.718691e-03, 4.077575e-03, 2.814527e-03, 1.669625e-03,
2377  1.007535e-03, 4.536554e-04, 2.111041e-04, 1.094840e-04, 4.404973e-05,
2378  1.933238e-05, 1.562895e-05};
2379  Int_t bin = 0;
2380  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2381  if (bin < 12) weight = weightsBins[bin];
2382 
2383  } else if ( fPeriodEnum == kLHC15g1a ){
2384  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
2385  84, 117, 152, 191, 1000000,
2386  5, 7, 9, 12, 16,
2387  21, 28, 36, 45, 57 };
2388  // Double_t weightsBins[19] = { 4.407782 , 4.946649e-01, 3.890474e-02, 3.826300e-03, 4.429376e-04,
2389  // 6.306745e-05, 1.031527e-05, 2.267429e-06, 7.552074e-07, 0,
2390  // 2.4635e+00, 1.1483e+00, 6.5069e-01, 2.7130e-01, 8.1947e-02,
2391  // 3.1536e-02, 9.3139e-03, 2.9779e-03, 1.1252e-03};
2392  // LHC15g1a
2393  Double_t weightsBins[19] = { 4.43629 , 0.49523, 0.0394921, 0.00383174, 0.000446559,
2394  6.37374e-05, 1.03134e-05, 2.27012e-06, 7.59281e-07, 0,
2395  2.62906, 1.12884, 0.656873, 0.262822, 0.0876732,
2396  0.0307759, 0.0087083, 0.0027664, 0.00106203};
2397 
2398  Int_t bin = 0;
2399  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
2400  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
2401  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2402  if (bin < 19) weight = weightsBins[bin];
2403 
2404  } else if ( fPeriodEnum == kLHC15a3a || fPeriodEnum == kLHC15a3a_plus ) {
2405  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
2406  84, 117, 152, 191, 1000000,
2407  5, 7, 9, 12, 16,
2408  21, 28, 36, 45, 57 };
2409  // LHC15a3a
2410  Double_t weightsBins[19] = { 4.43897 , 0.495766, 0.039486, 0.00383011, 0.000447104,
2411  6.37277e-05, 1.03166e-05, 2.26971e-06, 7.59023e-07, 0,
2412  2.63331, 1.12815, 0.657034, 0.262756, 0.0877227,
2413  0.0307638, 0.00870635, 0.00276658, 0.00106229};
2414  Int_t bin = 0;
2415  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
2416  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
2417  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2418  if (bin < 19) weight = weightsBins[bin];
2419 
2420  } else if ( fPeriodEnum == kLHC16c2 || fPeriodEnum == kLHC16c2_plus ){
2421  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2422  21, 28, 36, 45, 57,
2423  70, 85, 99, 115, 132,
2424  150, 169, 190, 212, 235,
2425  1000000};
2426  Double_t weightsBins[20] = { 28.3084, 8.43277, 4.07753, 1.54359, 0.543318,
2427  0.208394, 0.0652349, 0.0186904, 0.00834528, 0.00301414,
2428  0.00125939, 0.000474403, 0.000244052, 0.00011924, 6.09838e-05,
2429  3.24148e-05, 1.84314e-05, 1.00926e-05, 5.68632e-06, 8.38092e-06};
2430  Int_t bin = 0;
2431  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2432  if (bin < 20) weight = weightsBins[bin];
2433 
2434  } else if ( fPeriodEnum == kLHC16c3a ){
2435  Double_t ptHardBinRanges[6] = { 7, 9, 12, 16, 21, 1000};
2436  Double_t weightsBins[5] = { 0.00672445, 0.00799158, 0.00678934, 0.00463908, 0.00600068}; //preliminary estimates
2437  Int_t bin = 0;
2438  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2439  if (bin < 5) weight = weightsBins[bin];
2440 
2441  } else if (fPeriodEnum == kLHC16c3b ){
2442  Double_t ptHardBinRanges[7] = { 14, 19, 26, 35, 48, 66, 1000};
2443  Double_t weightsBins[6] = { 0.00608281, 0.00393646, 0.00200138, 0.000986267, 0.000389051, 0.0001863}; //preliminary estimates
2444  Int_t bin = 0;
2445  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2446  if (bin < 6) weight = weightsBins[bin];
2447 
2448  } else if (fPeriodEnum == kLHC16c3c ){
2449  Double_t ptHardBinRanges[8] = { 0, 5, 11, 21, 36, 57, 84, 1000};
2450  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
2451  Int_t bin = 0;
2452  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2453  if (bin < 7) weight = weightsBins[bin];
2454 
2455  } else if ( fPeriodEnum == kLHC13b4_fix || fPeriodEnum == kLHC13b4_plus ){
2456  Double_t ptHardBinRanges[11] = { 5, 11, 21, 36, 57,
2457  84, 117, 152, 191, 234,
2458  1000};
2459  Double_t weightsBins[10] = { 2.24185e-6 , 2.48463e-7, 2.23171e-8, 2.43667e-9, 3.29934e-10,
2460  5.34592e-11, 1.00937e-11, 2.6493e-12, 8.53912e-13, 5.43077e-13};
2461  Int_t bin = 0;
2462  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2463  if (bin < 10) weight = weightsBins[bin];
2464 
2465  } else {
2466  weight = 1;
2467  }
2468 
2469  if (weight == -1) return kFALSE;
2470  else return eventAccepted;
2471 
2472  }
2473  }
2474  } else {
2475  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
2476  TString eventHeaderName = eventHeader->ClassName();
2477  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0){
2478  Bool_t eventAccepted = kTRUE;
2479  TParticle * jet = 0;
2480  Int_t nTriggerJets = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->NTriggerJets();
2481  Float_t ptHard = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->GetPtHard();
2482  Float_t tmpjet[]={0,0,0,0};
2483  for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){
2484  dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->TriggerJet(ijet, tmpjet);
2485  jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
2486  //Compare jet pT and pt Hard
2487  if(jet->Pt() > fMaxFacPtHard * ptHard){
2488  eventAccepted= kFALSE;
2489  }
2490  if (jet->Pt() > fMaxPtJetMC) fMaxPtJetMC = jet->Pt();
2491  }
2492  if (mcEvent){
2493  for(Long_t i = 0; i < mcEvent->GetNumberOfPrimaries(); i++) {
2494  TParticle* particle = (TParticle *)mcEvent->Particle(i);
2495  if (!particle) continue;
2496  if (TMath::Abs(particle->GetPdgCode()) == 111 || TMath::Abs(particle->GetPdgCode()) == 221){
2497  if (particle->Pt() > fMaxFacPtHardSingleParticle*ptHard){
2498  eventAccepted= kFALSE;
2499  }
2500  }
2501 
2502  }
2503  }
2504 
2505  if ( fPeriodEnum == kLHC16h3 ){
2506  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2507  21, 28, 36, 45, 57,
2508  70, 85, 99, 115, 132,
2509  150, 169, 190, 212, 235,
2510  1000000};
2511  Double_t weightsBins[20] = { 0.957702, 0.41837, 0.406279, 0.266936, 0.135179,
2512  6.4687e-02, 2.27254e-02, 8.30769e-03, 3.56008e-03, 1.22934e-03,
2513  4.91352e-04, 1.77601e-04, 8.79608e-05, 4.13652e-05, 2.02997e-05,
2514  1.03682e-06, 5.64732e-06, 2.96158e-06, 1.5999e-06, 2.08374e-06};
2515 
2516  Int_t bin = 0;
2517  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2518  if (bin < 20) weight = weightsBins[bin];
2519 
2520  } else if ( fPeriodEnum == kLHC15a3b || fPeriodEnum == kLHC15g1b ){
2521  Double_t ptHardBinRanges[13] = { 5, 7, 9, 12, 16,
2522  21, 28, 36, 45, 57,
2523  70, 85, 1000};
2524  Double_t weightsBins[12] = { 7.858393e-03, 4.718691e-03, 4.077575e-03, 2.814527e-03, 1.669625e-03,
2525  1.007535e-03, 4.536554e-04, 2.111041e-04, 1.094840e-04, 4.404973e-05,
2526  1.933238e-05, 1.562895e-05};
2527  Int_t bin = 0;
2528  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2529  if (bin < 12) weight = weightsBins[bin];
2530 
2531  } else if ( fPeriodEnum == kLHC15g1a ){
2532  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
2533  84, 117, 152, 191, 1000000,
2534  5, 7, 9, 12, 16,
2535  21, 28, 36, 45, 57 };
2536 // Double_t weightsBins[19] = { 4.407782 , 4.946649e-01, 3.890474e-02, 3.826300e-03, 4.429376e-04,
2537 // 6.306745e-05, 1.031527e-05, 2.267429e-06, 7.552074e-07, 0,
2538 // 2.4635e+00, 1.1483e+00, 6.5069e-01, 2.7130e-01, 8.1947e-02,
2539 // 3.1536e-02, 9.3139e-03, 2.9779e-03, 1.1252e-03};
2540  // LHC15g1a
2541  Double_t weightsBins[19] = { 4.43629 , 0.49523, 0.0394921, 0.00383174, 0.000446559,
2542  6.37374e-05, 1.03134e-05, 2.27012e-06, 7.59281e-07, 0,
2543  2.62906, 1.12884, 0.656873, 0.262822, 0.0876732,
2544  0.0307759, 0.0087083, 0.0027664, 0.00106203};
2545 
2546  Int_t bin = 0;
2547  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
2548  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
2549  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2550  if (bin < 19) weight = weightsBins[bin];
2551 
2552  } else if (fPeriodEnum == kLHC15a3a || fPeriodEnum == kLHC15a3a_plus ) {
2553  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
2554  84, 117, 152, 191, 1000000,
2555  5, 7, 9, 12, 16,
2556  21, 28, 36, 45, 57 };
2557  // LHC15a3a
2558  Double_t weightsBins[19] = { 4.43897 , 0.495766, 0.039486, 0.00383011, 0.000447104,
2559  6.37277e-05, 1.03166e-05, 2.26971e-06, 7.59023e-07, 0,
2560  2.63331, 1.12815, 0.657034, 0.262756, 0.0877227,
2561  0.0307638, 0.00870635, 0.00276658, 0.00106229};
2562  Int_t bin = 0;
2563  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
2564  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
2565  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2566  if (bin < 19) weight = weightsBins[bin];
2567 
2568  } else if ( fPeriodEnum == kLHC16c2 || fPeriodEnum == kLHC16c2_plus ){
2569  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2570  21, 28, 36, 45, 57,
2571  70, 85, 99, 115, 132,
2572  150, 169, 190, 212, 235,
2573  1000000};
2574  Double_t weightsBins[20] = { 28.3084, 8.43277, 4.07753, 1.54359, 0.543318,
2575  0.208394, 0.0652349, 0.0186904, 0.00834528, 0.00301414,
2576  0.00125939, 0.000474403, 0.000244052, 0.00011924, 6.09838e-05,
2577  3.24148e-05, 1.84314e-05, 1.00926e-05, 5.68632e-06, 8.38092e-06};
2578  Int_t bin = 0;
2579  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2580  if (bin < 20) weight = weightsBins[bin];
2581 
2582  } else if ( fPeriodEnum == kLHC16c3a ){
2583  Double_t ptHardBinRanges[6] = { 7, 9, 12, 16, 21, 1000};
2584  Double_t weightsBins[5] = { 0.00672445, 0.00799158, 0.00678934, 0.00463908, 0.00600068}; //preliminary estimates
2585  Int_t bin = 0;
2586  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2587  if (bin < 5) weight = weightsBins[bin];
2588 
2589  } else if ( fPeriodEnum == kLHC16c3b ){
2590  Double_t ptHardBinRanges[7] = { 14, 19, 26, 35, 48, 66, 1000};
2591  Double_t weightsBins[6] = { 0.00608281, 0.00393646, 0.00200138, 0.000986267, 0.000389051, 0.0001863}; //preliminary estimates
2592  Int_t bin = 0;
2593  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2594  if (bin < 6) weight = weightsBins[bin];
2595 
2596  } else if ( fPeriodEnum == kLHC16c3c ){
2597  Double_t ptHardBinRanges[8] = { 0, 5, 11, 21, 36, 57, 84, 1000};
2598  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
2599  Int_t bin = 0;
2600  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2601  if (bin < 7) weight = weightsBins[bin];
2602 
2603  } else if ( fPeriodEnum == kLHC13b4_plus || fPeriodEnum == kLHC13b4_fix ){
2604  Double_t ptHardBinRanges[11] = { 5, 11, 21, 36, 57,
2605  84, 117, 152, 191, 234,
2606  1000};
2607  Double_t weightsBins[10] = { 2.24185e-6 , 2.48463e-7, 2.23171e-8, 2.43667e-9, 3.29934e-10,
2608  5.34592e-11, 1.00937e-11, 2.6493e-12, 8.53912e-13, 5.43077e-13};
2609  Int_t bin = 0;
2610  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2611  if (bin < 10) weight = weightsBins[bin];
2612  } else {
2613  weight = 1;
2614  }
2615 
2616  if (weight == -1) return kFALSE;
2617  else return eventAccepted;
2618 
2619  } else {
2620  return kFALSE;
2621  }
2622  }
2623 
2624  return kFALSE;
2625 }
2626 
2627 //________________________________________________________________________
2628 // Analysing Jet-Jet MC's
2629 //________________________________________________________________________
2630 void AliConvEventCuts::GetXSectionAndNTrials(AliMCEvent *mcEvent, Float_t &XSection, Float_t &NTrials){
2631 
2632  AliGenCocktailEventHeader *cHeader = 0x0;
2633  Bool_t headerFound = kFALSE;
2634 
2635  if ( fPeriodEnum != kLHC17f8a && fPeriodEnum != kLHC17f8b && fPeriodEnum != kLHC17f8c && // LHC16X Jet Jet MC's
2637  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
2638  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
2639  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
2640  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
2641  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
2642  fPeriodEnum != kLHC16c2 && fPeriodEnum != kLHC16c2_plus // LHC12 JetJet MC
2643  ){
2644  NTrials = -1;
2645  XSection = -1;
2646  return;
2647  }
2648 
2649  if(mcEvent){
2650  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
2651  if(cHeader) headerFound = kTRUE;
2652  }else{
2653  //no mcEvent available -> not running on MC
2654  NTrials = -1;
2655  XSection = -1;
2656  return;
2657  }
2658 
2659  if(headerFound){
2660  TList *genHeaders = 0x0;
2661  if(cHeader) genHeaders = cHeader->GetHeaders();
2662  AliGenEventHeader* gh = 0;
2663  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
2664  gh = (AliGenEventHeader*)genHeaders->At(i);
2665  TString GeneratorName = gh->GetName();
2666  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0){
2667  AliGenPythiaEventHeader* gPythia = dynamic_cast<AliGenPythiaEventHeader*>(gh);
2668  NTrials = gPythia->Trials();
2669  XSection = gPythia->GetXsection();
2670  return;
2671  }
2672  }
2673  } else {
2674  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
2675  if(eventHeader){
2676  TString eventHeaderName = eventHeader->ClassName();
2677  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0){
2678  AliGenPythiaEventHeader* gPythia = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader);
2679  NTrials = gPythia->Trials();
2680  XSection = gPythia->GetXsection();
2681  return;
2682  }
2683  }
2684  }
2685 
2686  NTrials = -1;
2687  XSection = -1;
2688  return;
2689 }
2690 
2691 
2692 //________________________________________________________________________
2693 // Analysing Jet-Jet MC's
2694 //________________________________________________________________________
2696  AliGenCocktailEventHeader *cHeader = 0x0;
2697  Bool_t headerFound = kFALSE;
2698 
2699  if ( fPeriodEnum != kLHC17f8a && fPeriodEnum != kLHC17f8b && fPeriodEnum != kLHC17f8c && // LHC16X Jet Jet MC's
2701  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
2702  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
2703  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
2704  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
2705  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
2706  fPeriodEnum != kLHC16c2 && fPeriodEnum != kLHC16c2_plus // LHC12 JetJet MC
2707  ) return -1;
2708 
2709  if(mcEvent){
2710  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
2711  if(cHeader) headerFound = kTRUE;
2712  }else{
2713  //no mcEvent available -> not running on MC
2714  return -1;
2715  }
2716 
2717  if(headerFound){
2718  TList *genHeaders = 0x0;
2719  if(cHeader) genHeaders = cHeader->GetHeaders();
2720  AliGenEventHeader* gh = 0;
2721  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
2722  gh = (AliGenEventHeader*)genHeaders->At(i);
2723  TString GeneratorName = gh->GetName();
2724  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0){
2725  return dynamic_cast<AliGenPythiaEventHeader*>(gh)->GetPtHard();
2726  }
2727  }
2728  } else {
2729  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
2730  if(eventHeader){
2731  TString eventHeaderName = eventHeader->ClassName();
2732  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0){
2733  return dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->GetPtHard();
2734  }
2735  }
2736  }
2737 
2738  return -1;
2739 }
2740 
2741 
2742 //________________________________________________________________________
2744  // abort if mimicing not enabled
2745 
2746  if (!fMimicTrigger) return kTRUE;
2747 
2748  Int_t runRangesEMCalL0 [35] = { 144871, 145288, 146375, 146382, // LHC11a
2749  146502, 148522, // LHC11a
2750  150209, 153056, 153911, 153915, // LHC11b,c,d
2751  158135, 158136, 158178, 158182, 160683,
2752  160764, 161139, 161256, 161379, 161457,
2753  161525, 161556, 161558, 161609, 161630,
2754  161724, // LHC11d,e
2755  173731, 177144, 177147, 177653, 177724, 178327,
2756  195180, // LHC13b-f
2757  197469, 197692 // LHC13g
2758  };
2759 
2760  Double_t thresholdEMCalL0[34] = { 2.11, 3.43, 1.71, 2.05, // LHC11a 7 TeV
2761  3.43, // LHC11a 2.76TeV
2762  1.94, 3.39, 4.01, 5.25, 5.5, // LHC11b, LHC11c, LHC11d
2763  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,
2764  2.01, 1.75, 1.52, 2.01, 1.52, 1.85,
2765  3.2,
2766  /*2.01*/1.8
2767  };
2768  Double_t spreadEMCalL0[34] = { 0., 0., 0, 0, // LHC11a 7TeV
2769  /*0.7*/0.65, // LHC11a 2.76TeV
2770  0., 0., 0., 0., 0., // LHC11b, LHC11c, LHC11d
2771  0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
2772  0., 0., 0., 0., 0.2, 0.2,/*0.,0.,*/
2773  0.1,
2774  /*0.1*/0.12
2775  };
2776 
2777  Int_t runRangesEMCalL1[4] = { 179796, // LHC12c-i
2778  195180, // LHC13b-f
2779  197469, 197692 // LHC13g
2780  };
2781 
2782  Double_t thresholdEMCalL1[3] = { 9.5/*8.398*/, 11.5, /*6.*/5.5};
2783  Double_t spreadEMCalL1[3] = { 1.0/*0.*/, 0.5, /*0.4*/0.6};
2784 
2785  Int_t runRangesEMCalL1G2[3] = { 195180, // LHC13b-f
2786  197469, 197692 // LHC13g
2787  };
2788 
2789  Double_t thresholdEMCalL1G2[2] = { 7.2, /*3.9*/3.75};
2790  Double_t spreadEMCalL1G2[2] = { 0.3, /*0.2*/0.25};
2791 
2792  Int_t runnumber = event->GetRunNumber();
2793 
2794  if (fSpecialTrigger == 5 ){
2795  if (runnumber < runRangesEMCalL0[0]) return kTRUE;
2796  Int_t binRun = 0;
2797  while (!(runnumber >= runRangesEMCalL0[binRun] && runnumber < runRangesEMCalL0[binRun+1] ) && binRun < 34 ){
2798 // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL0[binRun] << "\t" << runRangesEMCalL0[binRun+1] << endl;
2799  binRun++;
2800  }
2801  if (binRun==34) return kFALSE;
2802  Double_t threshold = thresholdEMCalL0[binRun];
2803 
2804  if (isMC && spreadEMCalL0[binRun] != 0.){
2805  TF1* triggerSmearing = new TF1("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
2806  triggerSmearing->SetParameter(0, 1/(spreadEMCalL0[binRun]*TMath::Sqrt(TMath::Pi()*2)));
2807  triggerSmearing->SetParameter(1, thresholdEMCalL0[binRun]);
2808  triggerSmearing->SetParameter(2, spreadEMCalL0[binRun]);
2809  threshold = triggerSmearing->GetRandom();
2810  delete triggerSmearing;
2811  }
2812 
2813 // cout << runnumber << "\t"<< binRun << "\t"<< threshold << endl;
2814 
2815  Int_t nclus = 0;
2816  nclus = event->GetNumberOfCaloClusters();
2817 
2818  if(nclus == 0) return kFALSE;
2819 
2820  // Loop over EMCal clusters
2821  Bool_t eventIsAccepted = kFALSE;
2822  for(Int_t i = 0; i < nclus; i++){
2823  AliVCluster* clus = NULL;
2824  clus = event->GetCaloCluster(i);
2825  if (!clus) continue;
2826  if (!clus->IsEMCAL()) continue;
2827  if (clus->GetM02()<0.1) continue;
2828  if (clus->GetNCells()<2) continue;
2829  if (clus->E() > threshold ){
2830 // cout << "found L0" << endl;
2831  eventIsAccepted = kTRUE;
2832  }
2833  }
2834  return eventIsAccepted;
2835 
2836  } else if (fSpecialTrigger == 6 ) {
2837 
2838  return kTRUE;
2839  } else if (fSpecialTrigger == 8 ) {
2840  if (fSpecialSubTriggerName.CompareTo("7EGA")==0 || fSpecialSubTriggerName.CompareTo("8EGA")==0 || fSpecialSubTriggerName.CompareTo("7EG1")==0 ||fSpecialSubTriggerName.CompareTo("8EG1")==0 ){
2841  if (runnumber < runRangesEMCalL1[0]) return kTRUE;
2842  Int_t binRun = 0;
2843  while (!(runnumber >= runRangesEMCalL1[binRun] && runnumber < runRangesEMCalL1[binRun+1] ) && binRun < 3 ){
2844  // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL0[binRun] << "\t" << runRangesEMCalL0[binRun+1] << endl;
2845  binRun++;
2846  }
2847  if (binRun==3) return kFALSE;
2848  Double_t threshold = thresholdEMCalL1[binRun];
2849 
2850  if (isMC && spreadEMCalL1[binRun] != 0.){
2851  TF1* triggerSmearing = new TF1("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
2852  triggerSmearing->SetParameter(0, 1/(spreadEMCalL1[binRun]*TMath::Sqrt(TMath::Pi()*2)));
2853  triggerSmearing->SetParameter(1, thresholdEMCalL1[binRun]);
2854  triggerSmearing->SetParameter(2, spreadEMCalL1[binRun]);
2855  threshold = triggerSmearing->GetRandom();
2856  delete triggerSmearing;
2857  }
2858 
2859 // cout << runnumber << "\t"<< binRun << "\t L1 \t"<< threshold << endl;
2860 
2861  Int_t nclus = 0;
2862  nclus = event->GetNumberOfCaloClusters();
2863 
2864  if(nclus == 0) return kFALSE;
2865 
2866  // Loop over EMCal clusters
2867  Bool_t eventIsAccepted = kFALSE;
2868  for(Int_t i = 0; i < nclus; i++){
2869  AliVCluster* clus = NULL;
2870  clus = event->GetCaloCluster(i);
2871  if (!clus) continue;
2872  if (!clus->IsEMCAL()) continue;
2873  if (clus->GetM02()<0.1) continue;
2874  if (clus->GetNCells()<2) continue;
2875  if (clus->E() > threshold ){
2876 // cout << "found L1G1" << endl;
2877  eventIsAccepted = kTRUE;
2878  }
2879  }
2880  return eventIsAccepted;
2881  } else if ( fSpecialSubTriggerName.CompareTo("7EG2")==0 ||fSpecialSubTriggerName.CompareTo("8EG2")==0 ){
2882  if (runnumber < runRangesEMCalL1G2[0]) return kTRUE;
2883  Int_t binRun = 0;
2884  while (!(runnumber >= runRangesEMCalL1G2[binRun] && runnumber < runRangesEMCalL1G2[binRun+1] ) && binRun < 2 ){
2885  // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL0[binRun] << "\t" << runRangesEMCalL0[binRun+1] << endl;
2886  binRun++;
2887  }
2888  if (binRun==2) return kFALSE;
2889  Double_t threshold = thresholdEMCalL1G2[binRun];
2890  if (isMC && spreadEMCalL1G2[binRun] != 0.){
2891  TF1* triggerSmearing = new TF1("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
2892  triggerSmearing->SetParameter(0, 1/(spreadEMCalL1G2[binRun]*TMath::Sqrt(TMath::Pi()*2)));
2893  triggerSmearing->SetParameter(1, thresholdEMCalL1G2[binRun]);
2894  triggerSmearing->SetParameter(2, spreadEMCalL1G2[binRun]);
2895  threshold = triggerSmearing->GetRandom();
2896  delete triggerSmearing;
2897  }
2898 // cout << runnumber << "\t"<< binRun << "\t L2 \t"<< threshold << endl;
2899 
2900  Int_t nclus = 0;
2901  nclus = event->GetNumberOfCaloClusters();
2902 
2903  if(nclus == 0) return kFALSE;
2904 
2905  // Loop over EMCal clusters
2906  Bool_t eventIsAccepted = kFALSE;
2907  for(Int_t i = 0; i < nclus; i++){
2908  AliVCluster* clus = NULL;
2909  clus = event->GetCaloCluster(i);
2910  if (!clus) continue;
2911  if (!clus->IsEMCAL()) continue;
2912  if (clus->GetM02()<0.1) continue;
2913  if (clus->GetNCells()<2) continue;
2914  if (clus->E() > threshold ){
2915 // cout << "found L1G2" << endl;
2916  eventIsAccepted = kTRUE;
2917  }
2918  }
2919  return eventIsAccepted;
2920  }
2921  return kTRUE;
2922  } else if (fSpecialTrigger == 9 ) {
2923  return kTRUE;
2924  } else {
2925  return kTRUE;
2926  }
2927 
2928  return kTRUE;
2929 }
2930 
2931 
2932 //________________________________________________________________________
2934 {
2935 
2936  AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
2937 
2938 
2939  UInt_t isSelected = AliVEvent::kAny;
2940 
2941  if (fInputHandler==NULL) return kFALSE;
2942  if( fInputHandler->GetEventSelection() || event->IsA()==AliAODEvent::Class()) {
2943 
2944  TString firedTrigClass = event->GetFiredTriggerClasses();
2945  // if no trigger has been selected manually, select kAny in case of presel (also important for AOD filtering!)
2946  // in other cases select standards depending on system
2948  if (fPreSelCut) fOfflineTriggerMask = AliVEvent::kAny;
2949  else {
2950  if (fIsHeavyIon == 1){
2951  fOfflineTriggerMask = AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral;
2952  } else if (fIsHeavyIon == 2){
2953  fOfflineTriggerMask = AliVEvent::kINT7;
2954  } else {
2955  fOfflineTriggerMask = AliVEvent::kMB;
2956  }
2957  }
2958  }
2959 
2960  // in case of MC switch to kAny if no MB/INT7/INT8 has been selected
2961  if(isMC){
2962  if( fIsHeavyIon == 0){
2963  if( fOfflineTriggerMask != AliVEvent::kMB && fOfflineTriggerMask != AliVEvent::kINT7 && fOfflineTriggerMask != AliVEvent::kINT8 ){
2964  fOfflineTriggerMask = AliVEvent::kAny;
2965  }
2966  }else{
2967  fOfflineTriggerMask = AliVEvent::kAny;
2968  }
2969  }
2970 
2971  if (fOfflineTriggerMask){
2972  isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
2973  if (isSelected && !fPreSelCut){
2974 // cout << firedTrigClass.Data() << endl;
2975 // cout << "Special trigger: "<< fSpecialTrigger << " initialized " << fEMCALTrigInitialized << endl;
2976 // if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9){ // EMCAL triggers
2977 // if (!fEMCALTrigInitialized ) InitializeEMCALTrigger(event);
2978 // fTriggersEMCAL= GetTriggerList();
2979 // }
2980  if (fSpecialSubTrigger>0 && !isMC){
2981  if (!firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 0;
2982  if (fRejectTriggerOverlap){
2983  // trigger rejection EMC1,7,8
2984  if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CEMC7") == 0){
2985  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
2986  } else if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CEMC1") == 0){
2987  if (fInputHandler->IsEventSelected() & AliVEvent::kMB) isSelected = 0;
2988  } else if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CEMC8") == 0){
2989  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
2990  }
2991  // trigger rejection EGA
2992  if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EGA") == 0){
2993  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
2994  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
2995  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EGA") == 0){
2996  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
2997  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
2998  }
2999  // trigger rejection EG1 & EG2
3000  if (fPeriodEnum == kLHC13g){
3001  // EG1 is the trigger with the highest threshold
3002  if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EG1") == 0){
3003 // cout << firedTrigClass.Data() << endl;
3004  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3005 // cout << "INT7? " << isSelected << endl;
3006  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3007 // cout << "CEM7? " << isSelected << endl;
3008  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
3009 // cout << "7EG2? " << isSelected << endl;
3010  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EG1") == 0){
3011  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3012  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3013  if (firedTrigClass.Contains("8EG2")) isSelected = 0;
3014  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EG2") == 0){
3015 // cout << firedTrigClass.Data() << endl;
3016  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3017 // cout << "INT7? " << isSelected << endl;
3018  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3019 // cout << "CEM7? " << isSelected << endl;
3020  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EG2") == 0){
3021  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3022  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3023  }
3024  } else {
3025  // EG2 is the trigger with the highest threshold
3026  if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EG2") == 0){
3027  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3028  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3029  if (firedTrigClass.Contains("7EG1")) isSelected = 0;
3030  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EG2") == 0){
3031  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3032  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3033  if (firedTrigClass.Contains("8EG1")) isSelected = 0;
3034  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EG1") == 0){
3035  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3036  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3037  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EG1") == 0){
3038  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3039  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3040  }
3041  }
3042  }
3043  if (isSelected != 0 ){
3044 // cout << "I am here" << " :" << fSpecialSubTriggerName.Data() <<endl;
3045  if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9 ){
3047  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassesCorrelated->Fill(0);
3048  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassesCorrelated->Fill(1);
3049  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassesCorrelated->Fill(2);
3050  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassesCorrelated->Fill(3);
3051  if (firedTrigClass.Contains("7EJE") || firedTrigClass.Contains("8EJE")) hTriggerClassesCorrelated->Fill(4);
3052  if (firedTrigClass.Contains("7EJ1") || firedTrigClass.Contains("8EJ1")) hTriggerClassesCorrelated->Fill(5);
3053  if (firedTrigClass.Contains("7EJ2") || firedTrigClass.Contains("8EJ2")) hTriggerClassesCorrelated->Fill(6);
3054  if (firedTrigClass.Contains("7EGA") || firedTrigClass.Contains("8EGA")) hTriggerClassesCorrelated->Fill(7);
3055  if (firedTrigClass.Contains("7EG1") || firedTrigClass.Contains("8EG1")) hTriggerClassesCorrelated->Fill(8);
3056  if (firedTrigClass.Contains("7EG2") || firedTrigClass.Contains("8EG2")) hTriggerClassesCorrelated->Fill(9);
3057  }
3058  }
3059  }
3060 
3061  } else if (isMC){
3062  if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9){ // EMCAL triggers
3063 // isSelected = 0;
3064 // if (fTriggersEMCAL > 0)cout << "Special Trigger " << fSpecialTrigger << " triggers: " << fTriggersEMCAL << " selected triggers: " << fTriggersEMCALSelected << " run number: " <<event->GetRunNumber()<<endl;
3065 // if (fTriggersEMCAL&fTriggersEMCALSelected){
3066 // cout << "accepted ++++++++++++++++++++" << endl;
3067  isSelected = 1;
3068 // }
3069  }
3070  }
3071  //if for specific centrality trigger selection
3072  if(fSpecialSubTrigger == 1){
3073  if(fSpecialSubTriggerName.Contains("|") && GetCentrality(event) <= 10.){
3074  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("|");
3075  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
3076  TObjString *NameClass = (TObjString*)ClassesList->At(i);
3077  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
3078  }
3079  } else if(fSpecialSubTriggerName.Contains("%")){
3080  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("%");
3081  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
3082  TObjString *NameClass = (TObjString*)ClassesList->At(i);
3083  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
3084  }
3085  } else if(fSpecialSubTriggerName.Contains("@")){
3086  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("@");
3087  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
3088  TObjString *NameClass = (TObjString*)ClassesList->At(i);
3089  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
3090  }
3091  } else if(fSpecialSubTriggerName.Contains("&")){ //logic AND of two classes
3092  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("&");
3093  TString CheckClass = "";
3094  for (Int_t i=0; i<ClassesList->GetEntriesFast(); i++){
3095  TObjString *NameClass = (TObjString*)ClassesList->At(i);
3096  if (firedTrigClass.Contains(NameClass->GetString())) CheckClass+="1";
3097  else CheckClass+="0";
3098  }
3099  if(CheckClass.Contains("0")) isSelected = 0;
3100  }
3101  else if(firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 1;
3102  }
3103  }
3104  }
3105  }
3106  fIsSDDFired = !(fInputHandler->IsEventSelected() & AliVEvent::kFastOnly);
3107 
3108  Bool_t mimickedTrigger = kTRUE;
3109  if (fMimicTrigger) mimickedTrigger = MimicTrigger(event, isMC);
3110 // cout << "mimicked decision \t" << mimickedTrigger << "expect decision? "<< fMimicTrigger<< endl;
3111 
3112  // Fill Histogram
3113  if(hTriggerClass){
3114  if (fIsSDDFired) hTriggerClass->Fill(33);
3115  if (mimickedTrigger){
3116  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(0);
3117  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClass->Fill(1);
3118  if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClass->Fill(2);
3119  if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClass->Fill(3);
3120  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClass->Fill(4);
3121  if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5);
3122  if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6);
3123  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6);
3124  if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClass->Fill(7);
3125  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClass->Fill(7);
3126  if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClass->Fill(8);
3127  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClass->Fill(8);
3128  if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClass->Fill(9);
3129  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClass->Fill(9);
3130  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClass->Fill(10);
3131  // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClass->Fill(10);
3132  if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClass->Fill(11);
3133  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClass->Fill(12);
3134  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClass->Fill(13);
3135  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClass->Fill(13);
3136  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClass->Fill(13);
3137  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClass->Fill(14);
3138  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClass->Fill(15);
3139  if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(16);
3140  if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(17);
3141  if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClass->Fill(18);
3142  if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClass->Fill(19);
3143  if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClass->Fill(20);
3144  // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClass->Fill(20);
3145  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClass->Fill(21);
3146  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClass->Fill(22);
3147  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClass->Fill(23);
3148  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClass->Fill(24);
3149  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClass->Fill(25);
3150  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClass->Fill(26);
3151  if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClass->Fill(27);
3152  if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClass->Fill(28);
3153  if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClass->Fill(29);
3154  if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClass->Fill(30);
3155  if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(31);
3156  if (!fInputHandler->IsEventSelected()) hTriggerClass->Fill(34);
3157  }
3158  if (mimickedTrigger && fMimicTrigger) hTriggerClass->Fill(35);
3159  }
3160 
3161  if(hTriggerClassSelected && isSelected){
3162  if (mimickedTrigger){
3163  if (!fIsSDDFired) hTriggerClassSelected->Fill(33);
3164  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassSelected->Fill(0);
3165  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassSelected->Fill(1);
3166  if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClassSelected->Fill(2);
3167  if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClassSelected->Fill(3);
3168  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassSelected->Fill(4);
3169  if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClassSelected->Fill(5);
3170  if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClassSelected->Fill(6);
3171  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClassSelected->Fill(6);
3172  if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClassSelected->Fill(7);
3173  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClassSelected->Fill(7);
3174  if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClassSelected->Fill(8);
3175  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClassSelected->Fill(8);
3176  if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClassSelected->Fill(9);
3177  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClassSelected->Fill(9);
3178  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassSelected->Fill(10);
3179  // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClassSelected->Fill(10);
3180  if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClassSelected->Fill(11);
3181  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClassSelected->Fill(12);
3182  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClassSelected->Fill(13);
3183  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClassSelected->Fill(13);
3184  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClassSelected->Fill(13);
3185  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClassSelected->Fill(14);
3186  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClassSelected->Fill(15);
3187  if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClassSelected->Fill(16);
3188  if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClassSelected->Fill(17);
3189  if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClassSelected->Fill(18);
3190  if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClassSelected->Fill(19);
3191  if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClassSelected->Fill(20);
3192  // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClassSelected->Fill(20);
3193  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClassSelected->Fill(21);
3194  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClassSelected->Fill(22);
3195  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClassSelected->Fill(23);
3196  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClassSelected->Fill(24);
3197  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClassSelected->Fill(25);
3198  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClassSelected->Fill(26);
3199  if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClassSelected->Fill(27);
3200  if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClassSelected->Fill(28);
3201  if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClassSelected->Fill(29);
3202  if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClassSelected->Fill(30);
3203  if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClassSelected->Fill(31);
3204  }
3205  if (mimickedTrigger && fMimicTrigger) hTriggerClassSelected->Fill(34);
3206  }
3207 
3208  if(!isSelected)return kFALSE;
3209  if (fMimicTrigger)
3210  if (!mimickedTrigger ) return kFALSE;
3211  return kTRUE;
3212 
3213 }
3214 
3215 //________________________________________________________________________
3217  // returns TString with current cut number
3218  return fCutStringRead;
3219 }
3220 
3221 //________________________________________________________________________
3222 void AliConvEventCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *event){
3223 
3224  if(fNotRejectedStart){
3225  delete[] fNotRejectedStart;
3226  fNotRejectedStart = NULL;
3227  }
3228  if(fNotRejectedEnd){
3229  delete[] fNotRejectedEnd;
3230  fNotRejectedEnd = NULL;
3231  }
3232  if(fGeneratorNames){
3233  delete[] fGeneratorNames;
3234  fGeneratorNames = NULL;
3235  }
3236 
3237  if(rejection == 0) return; // No Rejection
3238 
3239  AliGenCocktailEventHeader *cHeader = 0x0;
3240  AliAODMCHeader *cHeaderAOD = 0x0;
3241  Bool_t headerFound = kFALSE;
3242  AliMCEvent *fMCEvent = 0x0;
3243  TClonesArray *fMCEventAOD = 0x0;
3244  if(event->IsA()==AliMCEvent::Class()){
3245  if(dynamic_cast<AliMCEvent*>(event)){
3246  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(event)->GenEventHeader());
3247  fMCEvent = dynamic_cast<AliMCEvent*>(event);
3248  if(cHeader) headerFound = kTRUE;
3249  }
3250  }
3251  if(event->IsA()==AliAODEvent::Class()){ // event is a AODEvent in case of AOD
3252  cHeaderAOD = dynamic_cast<AliAODMCHeader*>(event->FindListObject(AliAODMCHeader::StdBranchName()));
3253  fMCEventAOD = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
3254  if(cHeaderAOD) headerFound = kTRUE;
3255  }
3256 
3257  if (fDebugLevel > 0 ) cout << "event starts here" << endl;
3258  if(headerFound){
3259  TList *genHeaders = 0x0;
3260  if(cHeader) genHeaders = cHeader->GetHeaders();
3261  if(cHeaderAOD){
3262  genHeaders = cHeaderAOD->GetCocktailHeaders();
3263  if(genHeaders->GetEntries()==1){
3265  return;
3266  }
3267  }
3268  AliGenEventHeader* gh = 0;
3269  fnHeaders = 0;
3270  Int_t firstindexA = 0;
3271  Int_t lastindexA = -1;
3272  if(rejection == 1 || rejection == 3) fnHeaders = 1; // MinBiasHeader
3273  if(rejection == 2){ // TList of Headers Names
3274  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3275  gh = (AliGenEventHeader*)genHeaders->At(i);
3276  TString GeneratorName = gh->GetName();
3277  lastindexA = lastindexA + gh->NProduced();
3278  if (fDebugLevel > 0 ) cout << i << "\t" << GeneratorName.Data() << endl;
3279  for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3280  TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3281  if (fDebugLevel > 0 ) cout << GeneratorInList.Data() << endl;
3282  if(GeneratorName.CompareTo(GeneratorInList) == 0){
3283  if (fDebugLevel > 0 ) cout << "accepted" << endl;
3284  if (GeneratorInList.CompareTo("PARAM") == 0 || GeneratorInList.CompareTo("BOX") == 0 ){
3285  if(fMCEvent){
3286  if (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c ){
3287  if (fMCEvent->Particle(firstindexA)->GetPdgCode() == fAddedSignalPDGCode ) {
3288  if (gh->NProduced() > 10 && fMCEvent->Particle(firstindexA+10)->GetPdgCode() == fAddedSignalPDGCode ){
3289  if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
3290  fnHeaders++;
3291  continue;
3292  }
3293  continue;
3294  }
3295  } else {
3296  if (fDebugLevel > 0 ) cout << "cond 2: " << fnHeaders << endl;
3297  fnHeaders++;
3298  continue;
3299 
3300  }
3301  }
3302  if ( fMCEventAOD){
3303  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindexA));
3304  if (aodMCParticle && (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c) ){
3305  if ( aodMCParticle->GetPdgCode() == fAddedSignalPDGCode ){
3306  if (gh->NProduced() > 10){
3307  AliAODMCParticle *aodMCParticle2 = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindexA+10));
3308  if ( aodMCParticle2->GetPdgCode() == fAddedSignalPDGCode ){
3309  if (fDebugLevel > 0 ) cout << "cond 1: " << fnHeaders << endl;
3310  fnHeaders++;
3311  continue;
3312  }
3313  }
3314  continue;
3315  }
3316  } else {
3317  if (fDebugLevel > 0 ) cout << "cond 2: " << fnHeaders << endl;
3318  fnHeaders++;
3319  continue;
3320  }
3321  }
3322  continue;
3323  }
3324  if (fDebugLevel > 0 ) cout << "cond 3: "<< fnHeaders << endl;
3325  fnHeaders++;
3326  continue;
3327  }
3328  }
3329  firstindexA = firstindexA + gh->NProduced();
3330  }
3331  }
3332  if (fDebugLevel > 0 ) cout << "number of headers: " <<fnHeaders << endl;
3333 
3337 
3338  if(rejection == 1 || rejection == 3){
3339  fNotRejectedStart[0] = 0;
3340  fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced()-1;
3341  fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName();
3342  if (fDebugLevel > 0 ) cout << 0 << "\t" <<fGeneratorNames[0] << "\t" << fNotRejectedStart[0] << "\t" <<fNotRejectedEnd[0] << endl;
3343  return;
3344  }
3345 
3346  Int_t firstindex = 0;
3347  Int_t lastindex = -1;
3348  Int_t number = 0;
3349 
3350  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3351  gh = (AliGenEventHeader*)genHeaders->At(i);
3352  TString GeneratorName = gh->GetName();
3353  lastindex = lastindex + gh->NProduced();
3354  for(Int_t j = 0; j<HeaderList->GetEntries();j++){
3355  TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
3356  if (fDebugLevel > 0 ) cout << i << "\t" << GeneratorName.Data() << endl;
3357  if(GeneratorName.CompareTo(GeneratorInList) == 0){
3358  if (GeneratorInList.CompareTo("PARAM") == 0 || GeneratorInList.CompareTo("BOX") == 0 ){
3359  if(fMCEvent){
3360  if (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c ){
3361  if (fMCEvent->Particle(firstindex)->GetPdgCode() == fAddedSignalPDGCode ) {
3362  if (fDebugLevel > 0 ) cout << "produced " << gh->NProduced() << " with box generator" << endl;
3363  if (gh->NProduced() > 10 && fMCEvent->Particle(firstindex+10)->GetPdgCode() == fAddedSignalPDGCode){
3364  if (fDebugLevel > 0 ) cout << "one of them was a pi0 or eta" << endl;
3365  fNotRejectedStart[number] = firstindex;
3366  fNotRejectedEnd[number] = lastindex;
3367  fGeneratorNames[number] = GeneratorName;
3368  number++;
3369  if (fDebugLevel > 0 ) cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
3370  continue;
3371  }
3372  }
3373  } else {
3374  fNotRejectedStart[number] = firstindex;
3375  fNotRejectedEnd[number] = lastindex;
3376  fGeneratorNames[number] = GeneratorName;
3377  number++;
3378  continue;
3379  }
3380  }
3381  if ( fMCEventAOD){
3382  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindex));
3383  if (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c ){
3384  if ( aodMCParticle->GetPdgCode() == fAddedSignalPDGCode ){
3385  if (gh->NProduced() > 10) {
3386  AliAODMCParticle *aodMCParticle2 = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindex+10));
3387  if ( aodMCParticle2->GetPdgCode() == fAddedSignalPDGCode ){
3388  fNotRejectedEnd[number] = lastindex;
3389  fNotRejectedStart[number] = firstindex;
3390  fGeneratorNames[number] = GeneratorName;
3391  number++;
3392  }
3393  continue;
3394  }
3395  }
3396  } else {
3397  fNotRejectedStart[number] = firstindex;
3398  fNotRejectedEnd[number] = lastindex;
3399  fGeneratorNames[number] = GeneratorName;
3400  number++;
3401  continue;
3402  }
3403  }
3404  continue;
3405  } else {
3406  fNotRejectedStart[number] = firstindex;
3407  fNotRejectedEnd[number] = lastindex;
3408  fGeneratorNames[number] = GeneratorName;
3409  if (fDebugLevel > 0 ) cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
3410  number++;
3411  continue;
3412  }
3413 
3414  }
3415  }
3416  firstindex = firstindex + gh->NProduced();
3417  }
3418  if (fDebugLevel > 0 ) {
3419  for (Int_t i = 0; i < number; i++){
3420  cout << i << "\t" <<fGeneratorNames[i] << "\t" << fNotRejectedStart[i] << "\t" <<fNotRejectedEnd[i] << endl;
3421  }
3422  }
3423  } else { // No Cocktail Header Found
3424  fNotRejectedStart = new Int_t[1];
3425  fNotRejectedEnd = new Int_t[1];
3426 
3427  fnHeaders = 1;
3428  fNotRejectedStart[0] = 0;
3429  fNotRejectedEnd[0] = static_cast<AliMCEvent*>(event)->GetNumberOfPrimaries()-1;
3430  if (rejection > 1){
3431  fNotRejectedStart[0] = -1;
3432  fNotRejectedEnd[0] = -1;
3433  }
3434 
3435  fGeneratorNames = new TString[1];
3436  fGeneratorNames[0] = "NoCocktailGeneratorFound";
3437 // SetRejectExtraSignalsCut(0);
3438  }
3439 
3440 }
3441 
3442 //_________________________________________________________________________
3443 Int_t AliConvEventCuts::IsParticleFromBGEvent(Int_t index, AliMCEvent *mcEvent, AliVEvent *InputEvent){
3444 
3445  if (fDebugLevel > 2 ) cout << index << endl;
3446  if(index < 0) return 0; // No Particle
3447 
3448  Int_t accepted = 0;
3449  if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){
3450  if(!mcEvent) return 0; // no mcEvent available, return 0
3451  if(index >= mcEvent->GetNumberOfPrimaries()){ // initial particle is secondary particle
3452  if( ((TParticle*)mcEvent->Particle(index))->GetMother(0) < 0) return 0; // material particle, return 0
3453  return IsParticleFromBGEvent(((TParticle*)mcEvent->Particle(index))->GetMother(0),mcEvent,InputEvent);
3454  }
3455  for(Int_t i = 0;i<fnHeaders;i++){
3456  if (fDebugLevel > 2 ) cout << "header " << i << ":"<< fNotRejectedStart[i] << "\t" << fNotRejectedEnd[i] << endl;
3457  if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
3458  if (fDebugLevel > 1 ) cout << "accepted:" << index << "\t header " << i << ": "<< fNotRejectedStart[i] << "\t" << fNotRejectedEnd[i] << endl;
3459  accepted = 1;
3460  if(i == 0) accepted = 2; // MB Header
3461  }
3462  }
3463  }
3464  else if(InputEvent->IsA()==AliAODEvent::Class()){
3465  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3466  if (AODMCTrackArray){
3467  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
3468  if(!aodMCParticle) return 0; // no particle
3469  if(!aodMCParticle->IsPrimary()){
3470  if( aodMCParticle->GetMother() < 0) return 0;// material particle, return 0
3471  return IsParticleFromBGEvent(aodMCParticle->GetMother(),mcEvent,InputEvent);
3472  }
3473  index = TMath::Abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index))->GetLabel());
3474  for(Int_t i = 0;i<fnHeaders;i++){
3475  if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
3476  accepted = 1;
3477  if(i == 0) accepted = 2; // MB Header
3478  }
3479  }
3480  }
3481  }
3482 
3483  return accepted;
3484 }
3485 
3486 //_________________________________________________________________________
3487 Int_t AliConvEventCuts::IsEventAcceptedByCut(AliConvEventCuts *ReaderCuts, AliVEvent *event, AliMCEvent *mcEvent, Int_t isHeavyIon, Bool_t isEMCALAnalysis){
3488 
3489  Bool_t isMC = kFALSE;
3490  if (mcEvent){isMC = kTRUE;}
3491 
3492  if ( !IsTriggerSelected(event, isMC) )
3493  return 3;
3494 
3495  if( !(IsCentralitySelected(event,mcEvent)))
3496  return 1; // Check Centrality --> Not Accepted => eventQuality = 1
3497 
3498  Bool_t hasV0And = ReaderCuts->HasV0AND();
3499  Bool_t isSDDFired = ReaderCuts->IsSDDFired();
3500 
3501  if( ( (IsSpecialTrigger() == 0 && IsSpecialSubTrigger() == 1) || (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 1) ) && !isSDDFired && !mcEvent)
3502  //if V0OR with SDD requested or V0AND with SDD request but the SDD has not fired
3503  return 7; // V0 with SDD requested but no fired
3504 
3505  if( ( (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 0) || (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 1) ) && !hasV0And)
3506  //if V0AND (only) or V0AND with SDD requested but V0AND requested but no fired
3507  return 8; // V0AND requested but no fired
3508 
3509 
3510  if( (IsSpecialTrigger() == 2 || IsSpecialTrigger() == 3) && !isSDDFired && !mcEvent)
3511  return 7; // With SDD requested but no fired
3512 
3513  if( (IsSpecialTrigger() == 1 || IsSpecialTrigger() == 3) && !hasV0And)
3514  return 8; // V0AND requested but no fired
3515 
3516  // Special EMCAL checks due to hardware issues in LHC11a
3517  if (isEMCALAnalysis || IsSpecialTrigger() == 5 || IsSpecialTrigger() == 8 || IsSpecialTrigger() == 9 ){
3518  Int_t runnumber = event->GetRunNumber();
3519  if ((runnumber>=144871) && (runnumber<=146860)) {
3520 
3521  AliVCaloCells *cells = event->GetEMCALCells();
3522  const Short_t nCells = cells->GetNumberOfCells();
3523 
3524  if (event->IsA()==AliESDEvent::Class()) AliAnalysisManager::GetAnalysisManager()->LoadBranch("EMCALCells.");
3525 
3526  AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
3527  if (!fInputHandler) return 3;
3528 
3529  // count cells above threshold
3530  Int_t nCellCount[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
3531  for(Int_t iCell=0; iCell<nCells; ++iCell) {
3532  Short_t cellId = cells->GetCellNumber(iCell);
3533  Double_t cellE = cells->GetCellAmplitude(cellId);
3534  Int_t sm = cellId / (24*48);
3535  if (cellE>0.1) ++nCellCount[sm];
3536  }
3537 
3538  Bool_t fIsLedEvent = kFALSE;
3539  if (nCellCount[4] > 100) {
3540  fIsLedEvent = kTRUE;
3541  } else {
3542  if ((runnumber>=146858) && (runnumber<=146860)) {
3543  if ((fInputHandler->IsEventSelected() & AliVEvent::kMB) && (nCellCount[3]>=21))
3544  fIsLedEvent = kTRUE;
3545  else if ((fInputHandler->IsEventSelected() & AliVEvent::kEMC1) && (nCellCount[3]>=35))
3546  fIsLedEvent = kTRUE;
3547  }
3548  }
3549  if (fIsLedEvent) {
3550  return 9;
3551  }
3552  }
3553  }
3554 
3555  // SPD clusters vs tracklets to check for pileup/background
3556  Int_t nClustersLayer0 = event->GetNumberOfITSClusters(0);
3557  Int_t nClustersLayer1 = event->GetNumberOfITSClusters(1);
3558  Int_t nTracklets = event->GetMultiplicity()->GetNumberOfTracklets();
3559  if(hSPDClusterTrackletBackgroundBefore) hSPDClusterTrackletBackgroundBefore->Fill(nTracklets, (nClustersLayer0 + nClustersLayer1));
3560 
3561 
3562  Double_t distZMax = 0;
3563  if(event->IsA()==AliESDEvent::Class()){
3564  Int_t nPileVert = ((AliESDEvent*)event)->GetNumberOfPileupVerticesSPD();
3565  if (hNPileupVertices) hNPileupVertices->Fill(nPileVert);
3566  if (nPileVert > 0){
3567  for(Int_t i=0; i<nPileVert;i++){
3568  const AliESDVertex* pv= ((AliESDEvent*)event)->GetPileupVertexSPD(i);
3569  Int_t nc2 = pv->GetNContributors();
3570  if(nc2>=3){
3571  Double_t z1 = ((AliESDEvent*)event)->GetPrimaryVertexSPD()->GetZ();
3572  Double_t z2 = pv->GetZ();
3573  Double_t distZ = z2-z1;
3574  if (TMath::Abs(distZMax) < TMath::Abs(distZ) ){
3575  distZMax = distZ;
3576  }
3577  }
3578  }
3579  if (hPileupVertexToPrimZ) hPileupVertexToPrimZ->Fill(distZMax);
3580  }
3581  }
3582  if(GetPastFutureLowBC()!=0 && GetPastFutureHighBC()!=0 ){
3583  if(IsOutOfBunchPileupPastFuture(event))
3584  return 12;
3585  }
3586 
3587  if( isHeavyIon != 2 && GetIsFromPileup()){
3588  if(event->IsPileupFromSPD(3,0.8,3.,2.,5.) ){
3590  return 6; // Check Pileup --> Not Accepted => eventQuality = 6
3591  }
3592  if (fUtils->IsSPDClusterVsTrackletBG(event)){
3594  return 11; // Check Pileup --> Not Accepted => eventQuality = 11
3595  }
3596  }
3597  if(isHeavyIon == 2 && GetIsFromPileup()){
3598  if(fUtils->IsPileUpEvent(event) ){
3600  return 6; // Check Pileup --> Not Accepted => eventQuality = 6
3601  }
3602  if (fUtils->IsSPDClusterVsTrackletBG(event)){
3604  return 11; // Check Pileup --> Not Accepted => eventQuality = 11
3605  }
3606  }
3607 
3609  if( IsPileUpV0MTPCout(event) ){
3610  return 13;
3611  }
3612  }
3613 
3614  if(hCentrality)hCentrality->Fill(GetCentrality(event));
3615 
3616  if(hVertexZ)hVertexZ->Fill(event->GetPrimaryVertex()->GetZ());
3617 // if(hCentralityVsNumberOfPrimaryTracks)
3618 // hCentralityVsNumberOfPrimaryTracks->Fill(GetCentrality(event),
3619 // ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()
3620 // ->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks());
3621 
3622  if(fIsHeavyIon == 1){
3623  AliEventplane *EventPlane = event->GetEventplane();
3624  fEventPlaneAngle = EventPlane->GetEventplane("V0",event,2);
3625  if(hEventPlaneAngle)hEventPlaneAngle->Fill(TMath::Abs(fEventPlaneAngle));
3626  }
3627  if(hSPDClusterTrackletBackground) hSPDClusterTrackletBackground->Fill(nTracklets, (nClustersLayer0 + nClustersLayer1));
3628 
3629  return 0;
3630 }
3631 
3632 
3633 //_________________________________________________________________________
3635 
3636  AliInfo("Inside the GetWeightForCentralityFlattening function");
3637  Double_t centrality = 0.;
3638  //obtain centrality for ESD or AOD
3639  if(!event || event->IsA()==AliESDEvent::Class()){
3640  AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
3641  if(esdEvent){
3642  AliCentrality *fESDCentrality=(AliCentrality*)esdEvent->GetCentrality();
3643  if(fDetectorCentrality==0 && fIsHeavyIon==1){
3644  centrality = fESDCentrality->GetCentralityPercentile("V0M"); // default for PbPb
3645  }
3646  }
3647  } else if(event->IsA()==AliAODEvent::Class()){
3648  AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
3649  if(aodEvent){
3650  if(aodEvent->GetHeader()){
3651  centrality = ((AliVAODHeader*)aodEvent->GetHeader())->GetCentrality();
3652  }
3653  }
3654  }
3655 
3656  //Get the maximum vlaue from the reference distribution and interpolated value
3657  Float_t GetValueForWeight = 1.;
3658  Float_t maximum = 1.;
3659  Double_t weightCentrality = 1.;
3660  Bool_t CorrCentrLoop = kFALSE;
3661 
3662  //depending on the value of the flag, flattening in different cent. range
3663  if ( fDoCentralityFlat == 1 && (centrality >= 0. && centrality <= 10.) ){
3664  GetValueForWeight = hCentralityNotFlat->Interpolate(centrality);
3665  maximum = hCentralityNotFlat->GetMaximum();
3666  CorrCentrLoop = kTRUE;
3667  } else if ( fDoCentralityFlat == 2 && (centrality >=10. && centrality <= 20.) ){
3668  GetValueForWeight = hCentralityNotFlat->Interpolate(centrality);
3669  maximum = hCentralityNotFlat->GetMaximum();
3670  CorrCentrLoop = kTRUE;
3671  } else if ( fDoCentralityFlat == 8 ){
3672  GetValueForWeight = hCentralityNotFlat->Interpolate(centrality);
3673  maximum = hCentralityNotFlat->GetMaximum();
3674  CorrCentrLoop = kTRUE;
3675  } else {
3676  CorrCentrLoop = kFALSE;
3677  }
3678 
3679  if (CorrCentrLoop && GetValueForWeight != 0. && maximum !=0. && isfinite(GetValueForWeight) && isfinite(maximum) ){
3680  weightCentrality = maximum/GetValueForWeight;
3681  if (!isfinite(GetValueForWeight)) weightCentrality = 1.;
3682  if (!isfinite(weightCentrality)) weightCentrality = 1.;
3683  }
3684 
3685  return weightCentrality;
3686 }
3687 
3688 //_________________________________________________________________________
3690 
3691  Double_t weightMult = 1.;
3692 
3693  Float_t valueMultData = -1.;
3694  Float_t valueMultMC = -1.;
3695 
3696  if (hReweightMultData == NULL || hReweightMultMC == NULL ) return weightMult;
3697 
3698  valueMultData = hReweightMultData->Interpolate(mult);
3699  valueMultMC = hReweightMultMC->Interpolate(mult);
3700 
3701  Float_t relativeErrorMC = hReweightMultMC->GetBinError(hReweightMultMC->FindBin(mult))/hReweightMultMC->GetBinContent(hReweightMultMC->FindBin(mult));
3702  Float_t relativeErrorData = hReweightMultData->GetBinError(hReweightMultData->FindBin(mult))/hReweightMultData->GetBinContent(hReweightMultData->FindBin(mult));
3703 
3704  if (relativeErrorData < 0.2 && relativeErrorMC < 0.2 ){
3705  if (isfinite(valueMultData) && isfinite(valueMultMC) ){
3706  weightMult = valueMultData/valueMultMC;
3707  }
3708  }
3709 
3710  return weightMult;
3711 }
3712 
3713 
3714 
3715 //_________________________________________________________________________
3716 Float_t AliConvEventCuts::GetWeightForMeson(Int_t index, AliMCEvent *mcEvent, AliVEvent *event){
3717  if (!( fPeriodEnum == kLHC13d2 || fPeriodEnum == kLHC13d2b || // LHC10h MCs
3718  fPeriodEnum == kLHC14a1a || fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c || // LHC11h MCs
3719  fPeriodEnum == kLHC13e7 || fPeriodEnum == kLHC13b2_efix || fPeriodEnum == kLHC14b2 || // LHC13bc MCs
3720  fPeriodEnum == kLHC14e2a || fPeriodEnum == kLHC14e2b || fPeriodEnum == kLHC14e2c || // LHC12[a-i] pass 1 MCs
3721  fPeriodEnum == kLHC12f1a || fPeriodEnum == kLHC12f1b || fPeriodEnum == kLHC12i3 // LHC11a MCs
3722  ) ) return 1.;
3723  Int_t kCaseGen = 0;
3724 
3725  if(index < 0) return 0; // No Particle
3726 
3727  if (IsParticleFromBGEvent(index, mcEvent, event)){
3730  kCaseGen = 1;
3731  }
3732  }
3733  if (kCaseGen == 0) return 1;
3734 
3735  Double_t mesonPt = 0;
3736  Double_t mesonMass = 0;
3737  Int_t PDGCode = 0;
3738  if(!event || event->IsA()==AliESDEvent::Class()){
3739  mesonPt = ((TParticle*)mcEvent->Particle(index))->Pt();
3740  mesonMass = ((TParticle*)mcEvent->Particle(index))->GetCalcMass();
3741  PDGCode = ((TParticle*)mcEvent->Particle(index))->GetPdgCode();
3742  } else if(event->IsA()==AliAODEvent::Class()){
3743  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
3744  if (AODMCTrackArray){
3745  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
3746  mesonPt = aodMCParticle->Pt();
3747  mesonMass = aodMCParticle->GetCalcMass();
3748  PDGCode = aodMCParticle->GetPdgCode();
3749  } else {
3750  return 1;
3751  }
3752  }
3753 
3754  Float_t functionResultMC = 1.;
3755  if ( PDGCode == 111 && fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0){
3756  functionResultMC = hReweightMCHistPi0->Interpolate(mesonPt);
3757  }
3758  if ( PDGCode == 221 && fDoReweightHistoMCEta && hReweightMCHistEta!= 0x0){
3759  functionResultMC = hReweightMCHistEta->Interpolate(mesonPt);
3760  }
3761  if ( PDGCode == 310 && fDoReweightHistoMCK0s && hReweightMCHistK0s!= 0x0){
3762  functionResultMC = hReweightMCHistK0s->Interpolate(mesonPt);
3763  }
3764 
3765  Float_t functionResultData = 1;
3766  if ( PDGCode == 111 && fDoReweightHistoMCPi0 && fFitDataPi0!= 0x0){
3767  functionResultData = fFitDataPi0->Eval(mesonPt);
3768  }
3769  if ( PDGCode == 221 && fDoReweightHistoMCEta && fFitDataEta!= 0x0){
3770  functionResultData = fFitDataEta->Eval(mesonPt);
3771  }
3772  if ( PDGCode == 310 && fDoReweightHistoMCK0s && fFitDataK0s!= 0x0){
3773  functionResultData = fFitDataK0s->Eval(mesonPt);
3774  }
3775 
3776  Double_t weight = 1;
3777  if (PDGCode == 111 || PDGCode == 221){
3778  if (functionResultData != 0. && functionResultMC != 0. && isfinite(functionResultData) && isfinite(functionResultMC)){
3779  weight = functionResultData/functionResultMC;
3780  if ( kCaseGen == 3){
3781  if (PDGCode == 111){
3782  if (!(fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0 && PDGCode == 111)){
3783  weight = 1.;
3784  }
3785  }
3786  if (PDGCode == 221){
3787  if (!(fDoReweightHistoMCEta && hReweightMCHistEta!= 0x0 && PDGCode == 221)){
3788  weight = 1.;
3789  }
3790  }
3791  }
3792  if (!isfinite(functionResultData)) weight = 1.;
3793  if (!isfinite(weight)) weight = 1.;
3794  }
3795  } else if (PDGCode == 310 && functionResultMC != 0 && isfinite(functionResultMC)){
3796  weight = functionResultMC;
3797  }
3798  return weight;
3799 }
3800 
3801 
3804 
3805  if( fPeriodEnum == kLHC13bc || // mainly minimum bias
3806  fPeriodEnum == kLHC13de || // mainly triggered
3807  fPeriodEnum == kLHC13b4_fix || fPeriodEnum == kLHC13b4_plus || // MC Pythia 6 (Jet-Jet), anchor LHC13b-e
3808  fPeriodEnum == kLHC13b2_efix || //MC DPMJET, anchr LHC13b+c
3809  fPeriodEnum == kLHC13e7 || //MC HIJING, anchr LHC13b+c
3810  fPeriodEnum == kLHC14b2 //MC HIJING, anchr LHC13b+c
3811  ){
3812  printf(" Gamma Conversion Cuts %s :: pPb Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),-0.465);
3813  SetEtaShift(-0.465);
3814  } else if( fPeriodEnum == kLHC13f ) {
3815  printf(" Gamma Conversion Cuts %s :: Pbp Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),0.465);
3816  SetEtaShift(+0.465);
3817  }
3818  else printf(" Gamma Conversion Cuts %s :: Automatic Eta Shift requested but Period is not known -> No Shift \n\n",(GetCutNumber()).Data());
3819 }
3820 
3821 //________________________________________________________________________
3822 AliEMCALTriggerPatchInfo* AliConvEventCuts::GetMainTriggerPatch()
3823 {
3824  //get main trigger match; if not known yet, look for it and cache
3825 
3827  return fMainTriggerPatchEMCAL;
3828 
3829  if (!fTriggerPatchInfo) {
3830  AliError(Form("%s: fTriggerPatchInfo not available",GetName()));
3831  return 0;
3832  }
3833 
3834  //number of patches in event
3835  Int_t nPatch = fTriggerPatchInfo->GetEntries();
3836 
3837  //extract main trigger patch
3838  AliEMCALTriggerPatchInfo *patch;
3839  for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
3840  patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
3841  if (patch->IsMainTrigger()) {
3842  fMainTriggerPatchEMCAL = patch;
3843  break;
3844  }
3845  }
3846 
3847  return fMainTriggerPatchEMCAL;
3848 }
3849 
3850 
3851 //________________________________________________________________________
3853 {
3854 // cout << "entered EMCAL trigger initialization" << endl;
3855 
3856  // Init the analysis.
3857  if (fCaloTriggersName.IsNull()){
3858  if (event->IsA()==AliESDEvent::Class()){
3859  fCaloTriggersName = "EMCALTrigger";
3860  } else {
3861  fCaloTriggersName = "emcalTrigger";
3862  }
3863  }
3864 
3865  if (!fCaloTriggersName.IsNull() && !fCaloTriggers) {
3866  fCaloTriggers = dynamic_cast<AliVCaloTrigger*>(event->FindListObject(fCaloTriggersName));
3867  if (!fCaloTriggers) {
3868  AliError(Form("%s: Could not retrieve calo triggers %s!", GetName(), fCaloTriggersName.Data()));
3869  return;
3870  }
3871  }
3872 
3873  if (fCaloTriggerPatchInfoName.IsNull()){
3874  if (event->IsA()==AliESDEvent::Class()){
3875  fCaloTriggerPatchInfoName = "EmcalTriggers";
3876  } else {
3877  fCaloTriggerPatchInfoName = "EmcalTriggers";
3878  }
3879  }
3880 
3881  if (!fCaloTriggerPatchInfoName.IsNull() && !fTriggerPatchInfo) {
3882  fTriggerPatchInfo = GetArrayFromEvent(event, fCaloTriggerPatchInfoName.Data(), "AliEMCALTriggerPatchInfo");
3883  if (!fTriggerPatchInfo) {
3884  AliError(Form("%s: Could not retrieve calo trigger patch info %s!", GetName(), fCaloTriggerPatchInfoName.Data()));
3885  return;
3886  }
3887 
3888  }
3889 
3890  fEMCALTrigInitialized = kTRUE;
3891 }
3892 
3893 //________________________________________________________________________
3895  if (!fTriggerPatchInfo)
3896  return 0;
3897  //number of patches in event
3898  Int_t nPatch = fTriggerPatchInfo->GetEntries();
3899 
3900  //loop over patches to define trigger type of event
3901  Int_t nG1 = 0;
3902  Int_t nG2 = 0;
3903  Int_t nJ1 = 0;
3904  Int_t nJ2 = 0;
3905  Int_t nL0 = 0;
3906  AliEMCALTriggerPatchInfo *patch;
3907 // if (nPatch> 0) {cout << "NEW Triggers in this event*********************************" << endl;}
3908  for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
3909  patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
3910 // cout << "Patch energy: "<<patch->GetPatchE() << "\t ADC counts: " << patch->GetADCAmp() << endl;
3911 // cout << "Phi: " << patch->GetPhiMin() << " - " << patch->GetPhiMax() << " delta phi: " <<TMath::Abs(patch->GetPhiMin()-patch->GetPhiMax())<< endl;
3912 // cout << "Eta: " << patch->GetEtaMin() << " - " << patch->GetEtaMax() << " delta eta: " <<TMath::Abs(patch->GetEtaMin()-patch->GetEtaMax())<< endl;
3913  if (patch->IsGammaHigh()){
3914 // cout << "fired L1GA high" << endl;
3915  nG1++;
3916  }
3917  if (patch->IsGammaLow()){
3918 // cout << "fired L1GA low" << endl;
3919  nG2++;
3920  }
3921  if (patch->IsJetHigh()){
3922 // cout << "fired L1JE high" << endl;
3923  nJ1++;
3924  }
3925  if (patch->IsJetLow()){
3926 // cout << "fired L1JE low" << endl;
3927  nJ2++;
3928  }
3929  if (patch->IsLevel0()){
3930 // cout << "fired L0" << endl;
3931  nL0++;
3932  }
3933 // cout << patch->GetPatchE() << "\t" << patch->GetADCAmp() << "\t" << patch->IsGammaHigh() << "\t" << patch->IsGammaLow()
3934 // << "\t" << patch->IsJetHigh() << "\t" << patch->IsJetLow() << "\t" << patch->IsLevel0()
3935 // << "\t" << patch->GetPhiMin() << "\t" << patch->GetPhiMax() << "\t" << TMath::Abs(patch->GetPhiMin()-patch->GetPhiMax())
3936 // << "\t" << patch->GetEtaMin() << "\t" << patch->GetEtaMax() << "\t" << TMath::Abs(patch->GetEtaMin()-patch->GetEtaMax()) << endl;
3937  }
3938 
3939  if (nPatch > 0){
3940  AliDebug(2, "Patch summary: ");
3941  AliDebug(2, Form("Number of patches: %d", nPatch));
3942  AliDebug(2, Form("Level0: [%d]" ,nL0));
3943  AliDebug(2, Form("Jet: low[%d], high[%d]" ,nJ2, nJ1));
3944  AliDebug(2, Form("Gamma: low[%d], high[%d]" ,nG2, nG1));
3945  }
3946 
3947 // if (nPatch > 0){
3948 // cout << Form("Number of patches: %d", nPatch) << endl;
3949 // cout << Form("Level0: [%d]" ,nL0) << endl;
3950 // cout << Form("Jet: low[%d], high[%d]" ,nJ2, nJ1) << endl;
3951 // cout << Form("Gamma: low[%d], high[%d]" ,nG2, nG1) << endl;
3952 // }
3953 
3954  ULong_t triggers(0);
3955  if (nG1>0)
3956  SETBIT(triggers, kG1);
3957  if (nG2>0)
3958  SETBIT(triggers, kG2);
3959  if (nJ1>0)
3960  SETBIT(triggers, kJ1);
3961  if (nJ2>0)
3962  SETBIT(triggers, kJ2);
3963  if (nL0>0)
3964  SETBIT(triggers, kL0);
3965  return triggers;
3966 }
3967 
3968 //________________________________________________________________________
3970  // Check if event has a given trigger type
3971  if(t == kND){
3972  return fTriggersEMCAL == 0;
3973  }
3974  return TESTBIT(fTriggersEMCAL, int(t));
3975 }
3976 
3977 
3978 //________________________________________________________________________
3979 TClonesArray *AliConvEventCuts::GetArrayFromEvent(AliVEvent* event, const char *name, const char *clname)
3980 {
3981  // Get array from event.
3982 
3983  TClonesArray *arr = 0;
3984  TString sname(name);
3985  if (!sname.IsNull()) {
3986  arr = dynamic_cast<TClonesArray*>(event->FindListObject(sname));
3987  if (!arr) {
3988  AliWarning(Form("%s: Could not retrieve array with name %s!", GetName(), name));
3989  return 0;
3990  }
3991  } else {
3992  return 0;
3993  }
3994 
3995  if (!clname)
3996  return arr;
3997 
3998  TString objname(arr->GetClass()->GetName());
3999  TClass cls(objname);
4000  if (!cls.InheritsFrom(clname)) {
4001  AliWarning(Form("%s: Objects of type %s in %s are not inherited from %s!",
4002  GetName(), cls.GetName(), name, clname));
4003  return 0;
4004  }
4005  return arr;
4006 }
4007 
4008 //_________________________________________________________________________
4009 Bool_t AliConvEventCuts::IsConversionPrimaryESD( AliMCEvent *mcEvent, Long_t eventpos, Double_t prodVtxX, Double_t prodVtxY, Double_t prodVtxZ){
4010 
4011  if (eventpos < 0) return kFALSE;
4012  TParticle* particle = (TParticle *)mcEvent->Particle(eventpos);
4013  if (!particle) return kFALSE;
4014  if (TMath::Abs(particle->GetPdgCode()) == 11 ){
4015  if (particle->GetMother(0) != -1){
4016  TParticle* particleMother = (TParticle *)mcEvent->Particle(particle->GetMother(0));
4017  if (particleMother){
4018  if (TMath::Abs(particleMother->GetPdgCode()) == 22)
4019  particle = particleMother;
4020  }
4021  }
4022  }
4023  if (particle->GetMother(0) != -1){
4024  Double_t deltaX = particle->Vx() - prodVtxX;
4025  Double_t deltaY = particle->Vy() - prodVtxY;
4026  Double_t deltaZ = particle->Vz() - prodVtxZ;
4027 
4028  //Double_t realRadius2D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY);
4029  Double_t realRadius3D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
4030 
4031 
4032  Bool_t dalitzCand = kFALSE;
4033 
4034  TParticle* firstmother = (TParticle *)mcEvent->Particle(particle->GetMother(0));
4035  if (!firstmother) return kFALSE;
4036  Int_t pdgCodeFirstMother = firstmother->GetPdgCode();
4037  Bool_t intDecay = kFALSE;
4038  if ( pdgCodeFirstMother == 111 || pdgCodeFirstMother == 221 ) intDecay = kTRUE;
4039  if ( intDecay && TMath::Abs(particle->GetPdgCode()) == 11 ){
4040  dalitzCand = kTRUE;
4041 // cout << "dalitz candidate found" << endl;
4042  }
4043 
4044  Long_t source = particle->GetMother(0);
4045  Bool_t foundExcludedPart = kFALSE;
4046  Bool_t foundShower = kFALSE;
4047  Int_t pdgCodeMotherPrev = 0;
4048  Int_t pdgCodeMotherPPrevMother = 0;
4049  Int_t depth = 0;
4050  if (dalitzCand || realRadius3D < fSecProdBoundary ){
4051 // if (particle->GetPdgCode() == 22){
4052 // cout << endl << endl << "new particle: " << eventpos <<endl;
4053 // cout << particle->GetPdgCode() << "\t" << particle->R() << "\t" << realRadius2D << "\t" << realRadius3D << endl;
4054 // }
4055  while (depth < 20){
4056  TParticle* mother = (TParticle *)mcEvent->Particle(source);
4057  source = mother->GetMother(0);
4058 // if (particle->GetPdgCode() == 22)cout << "eventposition: "<< source << endl;
4059  Int_t pdgCodeMother = mother->GetPdgCode();
4060 // if (particle->GetPdgCode() == 22)cout << "Previous mothers: " << pdgCodeMother << "\t"<< pdgCodeMotherPrev<< "\t" << pdgCodeMotherPPrevMother << endl;
4061  if (pdgCodeMother == pdgCodeMotherPrev && pdgCodeMother == pdgCodeMotherPPrevMother) depth = 20;
4062  if (TMath::Abs(pdgCodeMother) == 11 && TMath::Abs(pdgCodeMotherPrev) == 22 && TMath::Abs(pdgCodeMotherPPrevMother) == 11 ){
4063  foundShower = kTRUE;
4064  depth =20;
4065  }
4066  if (TMath::Abs(pdgCodeMother) == 22 && TMath::Abs(pdgCodeMotherPrev) == 11 && TMath::Abs(pdgCodeMotherPPrevMother) == 22 ){
4067  foundShower = kTRUE;
4068  depth =20;
4069  }
4070 
4071  // particles to be excluded:
4072  // K0s - 310
4073  // K0l - 130
4074  // K+/- - 321
4075  // Lambda - 3122
4076  // Sigma0 - 3212
4077  // Sigma+/- - 3222, 3112
4078  // Cascades - 3322, 3312
4079  if (TMath::Abs(pdgCodeMother) == 310 || TMath::Abs(pdgCodeMother) == 130 || TMath::Abs(pdgCodeMother) == 321 ||
4080  TMath::Abs(pdgCodeMother) == 3122 || TMath::Abs(pdgCodeMother) == 3212 || TMath::Abs(pdgCodeMother) == 3222 ||
4081  TMath::Abs(pdgCodeMother) == 3112 || TMath::Abs(pdgCodeMother) == 3322 || TMath::Abs(pdgCodeMother) == 3312
4082  ) {
4083  foundExcludedPart = kTRUE;
4084  }
4085 // if (particle->GetPdgCode() == 22)cout << mother->GetPdgCode() << "\t" << source << "\t" << foundExcludedPart<< endl;
4086  pdgCodeMotherPPrevMother = pdgCodeMotherPrev;
4087  pdgCodeMotherPrev = pdgCodeMother;
4088  if (source == -1) depth = 20;
4089 
4090 // if (particle->GetPdgCode() == 22)cout << depth << endl;
4091  depth++;
4092  }
4093  }
4094  if (foundExcludedPart){
4095 // if (particle->GetPdgCode() == 22)cout << "This is definitely a secondary, manually excluded" << endl;
4096  return kFALSE;
4097  } else if (dalitzCand && realRadius3D < fSecProdBoundary ){
4098 // if (particle->GetPdgCode() == 22)cout << "This was a decay via a virtual photon" << endl;
4099  return kTRUE;
4100  } else if (foundShower){
4101 // if (particle->GetPdgCode() == 22)cout << "This is a shower" << endl;
4102  return kFALSE;
4103  } else if (realRadius3D >= fSecProdBoundary){
4104 // cout << "This is a secondary, to large production radius" << endl;
4105  return kFALSE;
4106  }
4107  }
4108 
4109  return kTRUE;
4110 }
4111 
4112 //_________________________________________________________________________
4113 Bool_t AliConvEventCuts::IsConversionPrimaryAOD(AliVEvent *event, AliAODMCParticle* AODMCParticle, Double_t prodVtxX, Double_t prodVtxY, Double_t prodVtxZ){
4114 
4115  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
4116  if (AODMCTrackArray == NULL) return kFALSE;
4117  AliAODMCParticle* currentParticle = AODMCParticle;
4118  if (TMath::Abs(currentParticle->GetPdgCode()) == 11 ){
4119  if (currentParticle->GetMother() != -1){
4120  AliAODMCParticle* particleMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(currentParticle->GetMother()));
4121  if (particleMother){
4122  if (TMath::Abs(particleMother->GetPdgCode()) == 22)
4123  currentParticle = particleMother;
4124  }
4125  }
4126  }
4127  if (currentParticle->GetMother() > -1){
4128  Double_t deltaX = currentParticle->Xv() - prodVtxX;
4129  Double_t deltaY = currentParticle->Yv() - prodVtxY;
4130  Double_t deltaZ = currentParticle->Zv() - prodVtxZ;
4131 
4132  //Double_t realRadius2D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY);
4133  Double_t realRadius3D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
4134 
4135  Bool_t dalitzCand = kFALSE;
4136 
4137  AliAODMCParticle* firstmother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(currentParticle->GetMother()));
4138  if (!firstmother) return kFALSE;
4139  Int_t pdgCodeFirstMother = firstmother->GetPdgCode();
4140  Bool_t intDecay = kFALSE;
4141  if ( pdgCodeFirstMother == 111 || pdgCodeFirstMother == 221 ) intDecay = kTRUE;
4142  if ( intDecay && TMath::Abs(currentParticle->GetPdgCode()) == 11 ){
4143  dalitzCand = kTRUE;
4144 // cout << "dalitz candidate found" << endl;
4145  }
4146 
4147  Long_t source = currentParticle->GetMother();
4148  Bool_t foundExcludedPart = kFALSE;
4149  Bool_t foundShower = kFALSE;
4150  Int_t pdgCodeMotherPrev = 0;
4151  Int_t pdgCodeMotherPPrevMother = 0;
4152  Int_t depth = 0;
4153  if (dalitzCand || realRadius3D < fSecProdBoundary ){
4154 // if (currentParticle->GetPdgCode() == 22){
4155 // cout << endl << endl << "new particle: " << eventpos <<endl;
4156 // cout << currentParticle->GetPdgCode() << "\t" << currentParticle->R() << "\t" << realRadius2D << "\t" << realRadius3D << endl;
4157 // }
4158  while (depth < 20){
4159  AliAODMCParticle* mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(source));
4160  source = mother->GetMother();
4161 // if (currentParticle->GetPdgCode() == 22)cout << "eventposition: "<< source << endl;
4162  Int_t pdgCodeMother = mother->GetPdgCode();
4163 // if (currentParticle->GetPdgCode() == 22)cout << "Previous mothers: " << pdgCodeMother << "\t"<< pdgCodeMotherPrev<< "\t" << pdgCodeMotherPPrevMother << endl;
4164  if (pdgCodeMother == pdgCodeMotherPrev && pdgCodeMother == pdgCodeMotherPPrevMother) depth = 20;
4165  if (TMath::Abs(pdgCodeMother) == 11 && TMath::Abs(pdgCodeMotherPrev) == 22 && TMath::Abs(pdgCodeMotherPPrevMother) == 11 ){
4166  foundShower = kTRUE;
4167  depth =20;
4168  }
4169  if (TMath::Abs(pdgCodeMother) == 22 && TMath::Abs(pdgCodeMotherPrev) == 11 && TMath::Abs(pdgCodeMotherPPrevMother) == 22 ){
4170  foundShower = kTRUE;
4171  depth =20;
4172  }
4173 
4174  // particles to be excluded:
4175  // K0s - 310
4176  // K0l - 130
4177  // K+/- - 321
4178  // Lambda - 3122
4179  // Sigma0 - 3212
4180  // Sigma+/- - 3222, 3112
4181  // Cascades - 3322, 3312
4182  if (TMath::Abs(pdgCodeMother) == 310 || TMath::Abs(pdgCodeMother) == 130 || TMath::Abs(pdgCodeMother) == 321 ||
4183  TMath::Abs(pdgCodeMother) == 3122 || TMath::Abs(pdgCodeMother) == 3212 || TMath::Abs(pdgCodeMother) == 3222 ||
4184  TMath::Abs(pdgCodeMother) == 3112 || TMath::Abs(pdgCodeMother) == 3322 || TMath::Abs(pdgCodeMother) == 3312)
4185  {
4186  foundExcludedPart = kTRUE;
4187  }
4188 // if (currentParticle->GetPdgCode() == 22)cout << mother->GetPdgCode() << "\t" << source << "\t" << foundExcludedPart<< endl;
4189  pdgCodeMotherPPrevMother = pdgCodeMotherPrev;
4190  pdgCodeMotherPrev = pdgCodeMother;
4191  if (source == -1) depth = 20;
4192 
4193 // if (currentParticle->GetPdgCode() == 22)cout << depth << endl;
4194  depth++;
4195  }
4196  }
4197  if (foundExcludedPart){
4198 // if (currentParticle->GetPdgCode() == 22)cout << "This is definitely a secondary, manually excluded" << endl;
4199  return kFALSE;
4200  } else if (dalitzCand && realRadius3D < fSecProdBoundary ){
4201 // if (currentParticle->GetPdgCode() == 22)cout << "This was a decay via a virtual photon" << endl;
4202  return kTRUE;
4203  } else if (foundShower){
4204 // if (currentParticle->GetPdgCode() == 22)cout << "This is a shower" << endl;
4205  return kFALSE;
4206  } else if (realRadius3D >= fSecProdBoundary){
4207 // cout << "This is a secondary, too large production radius" << endl;
4208  return kFALSE;
4209  }
4210  }
4211 
4212  return kTRUE;
4213 }
4214 
4215 
4216 //________________________________________________________________________
4217 Int_t AliConvEventCuts::SecondaryClassificationPhoton( TParticle *particle, AliMCEvent* mcEvent, Bool_t isConversion ){
4218  if (particle != NULL && mcEvent != NULL){
4219  Int_t pdgSecondary = 0;
4220  if (!isConversion){
4221  Bool_t hasMother = kFALSE;
4222  Bool_t hasGrandMother = kFALSE;
4223  Long_t motherID = particle->GetMother(0);
4224  Long_t grandMotherID = -1;
4225  // is the photon a direct photons, without a mother?
4226  if (motherID > -1){
4227  hasMother = kTRUE;
4228  grandMotherID = mcEvent->Particle(motherID)->GetMother(0);
4229  // is the meson a primary?
4230  if (grandMotherID > -1){
4231  hasGrandMother = kTRUE;
4232  pdgSecondary = mcEvent->Particle(grandMotherID)->GetPdgCode();
4233  }
4234  }
4235  } else {
4236  Bool_t hasMother = kFALSE;
4237  Bool_t hasGrandMother = kFALSE;
4238  Bool_t hasGreatGrandMother = kFALSE;
4239  Long_t motherID = particle->GetMother(0);
4240  Long_t grandMotherID = -1;
4241  Long_t greatGrandMotherID = -1;
4242  // is the electron a direct electron, without a mother?
4243  if (motherID > -1){
4244  hasMother = kTRUE;
4245  grandMotherID = mcEvent->Particle(motherID)->GetMother(0);
4246  // is the photon a direct photons, without a mother?
4247  if (grandMotherID > -1){
4248  hasGrandMother = kTRUE;
4249  greatGrandMotherID = mcEvent->Particle(grandMotherID)->GetMother(0);
4250  // is the meson a primary?
4251  if (greatGrandMotherID > -1){
4252  hasGreatGrandMother = kTRUE;
4253  pdgSecondary = mcEvent->Particle(greatGrandMotherID)->GetPdgCode();
4254  }
4255  }
4256  }
4257  }
4258  // is the secondary photon from a lambda
4259  if (TMath::Abs(pdgSecondary) == 3122 )
4260  return 3;
4261  // is the secondary photon from a K0s
4262  else if ( TMath::Abs(pdgSecondary) == 310 )
4263  return 2;
4264  // is the secondary photon from a K0l
4265  else if ( TMath::Abs(pdgSecondary) == 130 )
4266  return 5;
4267  // is the secondary photon from a eta
4268  else if ( TMath::Abs(pdgSecondary) == 221 )
4269  return 4;
4270  // is the secondary photon from something else
4271  else if ( TMath::Abs(pdgSecondary) != 0 )
4272  return 1;
4273 
4274  }
4275 
4276  return 0;
4277 }
4278 
4279 //________________________________________________________________________
4280 Int_t AliConvEventCuts::SecondaryClassificationPhotonAOD( AliAODMCParticle *particle, TClonesArray *aodmcArray, Bool_t isConversion ){
4281  if (particle != NULL && aodmcArray != NULL){
4282  Int_t pdgSecondary = 0;
4283  if (!isConversion){
4284  Bool_t hasMother = kFALSE;
4285  Bool_t hasGrandMother = kFALSE;
4286  Long_t motherID = particle->GetMother();
4287  Long_t grandMotherID = -1;
4288  // is the photon a direct photons, without a mother?
4289  if (motherID > -1){
4290  hasMother = kTRUE;
4291  grandMotherID = ((AliAODMCParticle*)aodmcArray->At(motherID))->GetMother();
4292  // is the meson a primary?
4293  if (grandMotherID > -1){
4294  hasGrandMother = kTRUE;
4295  pdgSecondary = ((AliAODMCParticle*)aodmcArray->At(grandMotherID))->GetPdgCode();
4296  }
4297  }
4298  } else {
4299  Bool_t hasMother = kFALSE;
4300  Bool_t hasGrandMother = kFALSE;
4301  Bool_t hasGreatGrandMother = kFALSE;
4302  Long_t motherID = particle->GetMother();
4303  Long_t grandMotherID = -1;
4304  Long_t greatGrandMotherID = -1;
4305  // is the electron a direct electron, without a mother?
4306  if (motherID > -1){
4307  hasMother = kTRUE;
4308  grandMotherID = ((AliAODMCParticle*)aodmcArray->At(motherID))->GetMother();
4309  // is the photon a direct photons, without a mother?
4310  if (grandMotherID > -1){
4311  hasGrandMother = kTRUE;
4312  greatGrandMotherID = ((AliAODMCParticle*)aodmcArray->At(grandMotherID))->GetMother();
4313  // is the meson a primary?
4314  if (greatGrandMotherID > -1){
4315  hasGreatGrandMother = kTRUE;
4316  pdgSecondary = ((AliAODMCParticle*)aodmcArray->At(greatGrandMotherID))->GetPdgCode();
4317  }
4318  }
4319  }
4320  }
4321  // is the secondary photon from a lambda
4322  if (TMath::Abs(pdgSecondary) == 3122 )
4323  return 3;
4324  // is the secondary photon from a K0s
4325  else if ( TMath::Abs(pdgSecondary) == 310 )
4326  return 2;
4327  // is the secondary photon from a K0l
4328  else if ( TMath::Abs(pdgSecondary) == 130 )
4329  return 5;
4330  // is the secondary photon from a eta
4331  else if ( TMath::Abs(pdgSecondary) == 221 )
4332  return 4;
4333  // is the secondary photon from something else
4334  else if ( TMath::Abs(pdgSecondary) != 0 )
4335  return 1;
4336 
4337  }
4338 
4339  return 0;
4340 }
4341 
4343 
4344  if (periodName.CompareTo("") == 0){
4345  periodName = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPeriodName();
4346  }
4347 
4348  if (periodName.CompareTo("") == 0) {
4350  fEnergyEnum = kUnset;
4351  AliError("No correct period could be set, periodName string empty");
4352  return;
4353  }
4354 
4355  // Data
4356  if (periodName.CompareTo("LHC10b") == 0 || periodName.CompareTo("LHC10c") == 0 || periodName.CompareTo("LHC10d") == 0 || periodName.CompareTo("LHC10e") == 0 ||
4357  periodName.CompareTo("LHC10f") == 0 || periodName.CompareTo("LHC10g") == 0 || periodName.CompareTo("LHC10bg") == 0
4358  ){
4360  fEnergyEnum = k7TeV;
4361  } else if (periodName.CompareTo("LHC10h") == 0) {
4362  fPeriodEnum = kLHC10h;
4364  } else if (periodName.CompareTo("LHC11a") == 0) {
4365  fPeriodEnum = kLHC11a;
4367  } else if (periodName.CompareTo("LHC11b") == 0) {
4368  fPeriodEnum = kLHC11b;
4369  fEnergyEnum = k7TeV;
4370  } else if (periodName.CompareTo("LHC11c") == 0 || periodName.CompareTo("LHC11d") == 0 || periodName.CompareTo("LHC11e") == 0 || periodName.CompareTo("LHC11f") == 0 ||
4371  periodName.CompareTo("LHC11g") == 0
4372  ) {
4374  fEnergyEnum = k7TeV;
4375  } else if (periodName.CompareTo("LHC11h") == 0) {
4376  fPeriodEnum = kLHC11h;
4378  } else if (periodName.CompareTo("LHC12a") == 0 || periodName.CompareTo("LHC12b") == 0 || periodName.CompareTo("LHC12c") == 0 || periodName.CompareTo("LHC12d") == 0 ||
4379  periodName.CompareTo("LHC12e") == 0 || periodName.CompareTo("LHC12f") == 0 || periodName.CompareTo("LHC12g") == 0 || periodName.CompareTo("LHC12h") == 0 ||
4380  periodName.CompareTo("LHC12i") == 0 || periodName.CompareTo("LHC12ai") == 0
4381  ) {
4382  fPeriodEnum = kLHC12;
4383  fEnergyEnum = k8TeV;
4384  } else if (periodName.CompareTo("LHC13b") == 0 || periodName.CompareTo("LHC13c") == 0 || periodName.CompareTo("LHC13bc") == 0){
4387  } else if (periodName.CompareTo("LHC13d") == 0 || periodName.CompareTo("LHC13e") == 0 || periodName.CompareTo("LHC13de") == 0){
4390  } else if (periodName.CompareTo("LHC13f") == 0 ){
4391  fPeriodEnum = kLHC13f;
4393  } else if (periodName.CompareTo("LHC13g") == 0 ){
4394  fPeriodEnum = kLHC13g;
4396  } else if ( periodName.CompareTo("LHC15f") == 0 || periodName.CompareTo("LHC15g") == 0 || periodName.CompareTo("LHC15h") == 0 || periodName.CompareTo("LHC15i") == 0 ||
4397  periodName.CompareTo("LHC15j") == 0 || periodName.CompareTo("LHC15k") == 0 || periodName.CompareTo("LHC15l") == 0 || periodName.CompareTo("LHC15m") == 0 ||
4398  periodName.CompareTo("LHC15fm") == 0
4399  ) {
4401  fEnergyEnum = k13TeV;
4402  } else if (periodName.CompareTo("LHC15n") == 0 ){
4403  fPeriodEnum = kLHC15n;
4404  fEnergyEnum = k5TeV;
4405  } else if (periodName.CompareTo("LHC15o") == 0 ){
4406  fPeriodEnum = kLHC15o;
4408  } else if (periodName.CompareTo("LHC16k") == 0 || periodName.CompareTo("LHC16l") == 0 ){
4410  fEnergyEnum = k13TeV;
4411  } else if (periodName.CompareTo("LHC16d") == 0 ){
4412  fPeriodEnum = kLHC16d;
4413  fEnergyEnum = k13TeV;
4414  } else if (periodName.CompareTo("LHC16e") == 0 ){
4415  fPeriodEnum = kLHC16e;
4416  fEnergyEnum = k13TeV;
4417  } else if (periodName.CompareTo("LHC16f") == 0 ){
4418  fPeriodEnum = kLHC16f;
4419  fEnergyEnum = k13TeV;
4420  } else if (periodName.CompareTo("LHC16g") == 0 ){
4421  fPeriodEnum = kLHC16g;
4422  fEnergyEnum = k13TeV;
4423  } else if (periodName.CompareTo("LHC16h") == 0 ){
4424  fPeriodEnum = kLHC16h;
4425  fEnergyEnum = k13TeV;
4426  } else if (periodName.CompareTo("LHC16i") == 0 ){
4427  fPeriodEnum = kLHC16i;
4428  fEnergyEnum = k13TeV;
4429  } else if (periodName.CompareTo("LHC16j") == 0 ){
4430  fPeriodEnum = kLHC16j;
4431  fEnergyEnum = k13TeV;
4432  } else if (periodName.CompareTo("LHC16o") == 0 ){
4433  fPeriodEnum = kLHC16o;
4434  fEnergyEnum = k13TeV;
4435  } else if (periodName.CompareTo("LHC16p") == 0 ){
4436  fPeriodEnum = kLHC16p;
4437  fEnergyEnum = k13TeV;
4438  } else if (periodName.CompareTo("LHC16q") == 0 ){
4439  fPeriodEnum = kLHC16q;
4441  } else if (periodName.CompareTo("LHC16r") == 0 ){
4442  fPeriodEnum = kLHC16r;
4444  } else if (periodName.CompareTo("LHC16s") == 0 ){
4445  fPeriodEnum = kLHC16s;
4447  } else if (periodName.CompareTo("LHC16t") == 0 ){
4448  fPeriodEnum = kLHC16t;
4450 
4451  // LHC10x anchored MCs
4452  } else if (periodName.CompareTo("LHC10d1") == 0){
4454  fEnergyEnum = k7TeV;
4455  } else if (periodName.CompareTo("LHC10d2") == 0){
4457  fEnergyEnum = k7TeV;
4458  } else if (periodName.CompareTo("LHC10d4a") == 0){
4460  fEnergyEnum = k7TeV;
4461  } else if (periodName.CompareTo("LHC10d4") == 0){
4463  fEnergyEnum = k7TeV;
4464  } else if (periodName.CompareTo("LHC10e12") == 0){
4466  fEnergyEnum = k900GeV;
4467  } else if (periodName.CompareTo("LHC10e13") == 0){
4469  fEnergyEnum = k900GeV;
4470  } else if (periodName.CompareTo("LHC10e20") == 0){
4472  fEnergyEnum = k7TeV;
4473  } else if (periodName.CompareTo("LHC10e21") == 0){
4475  fEnergyEnum = k7TeV;
4476  } else if (periodName.CompareTo("LHC10f6a") == 0){
4478  fEnergyEnum = k7TeV;
4479  } else if (periodName.CompareTo("LHC10f6") == 0){
4481  fEnergyEnum = k7TeV;
4482  } else if (periodName.Contains("LHC14j4")){
4484  fEnergyEnum = k7TeV;
4485  } else if (periodName.CompareTo("LHC13d2") == 0){
4488  } else if (periodName.CompareTo("LHC13d2b") == 0){
4491  } else if (periodName.CompareTo("LHC12a11a") == 0){
4494  } else if (periodName.CompareTo("LHC12a11b") == 0){
4497  } else if (periodName.CompareTo("LHC12a11c") == 0){
4500  } else if (periodName.CompareTo("LHC12a11d") == 0){
4503  } else if (periodName.CompareTo("LHC12a11e") == 0){
4506  } else if (periodName.CompareTo("LHC12a11f") == 0){
4509  // LHC11x anchored MCs
4510  } else if (periodName.CompareTo("LHC12a15c") == 0){
4513  } else if (periodName.Contains("LHC12f1a") ){
4516  } else if (periodName.Contains("LHC12f1b") ){
4519  } else if (periodName.Contains("LHC12i3") ){
4522  } else if (periodName.CompareTo("LHC15g1a") == 0){
4525  } else if (periodName.CompareTo("LHC15g1b") == 0){
4528  } else if (periodName.CompareTo("LHC13e4") == 0){
4530  fEnergyEnum = k7TeV;
4531  } else if (periodName.CompareTo("LHC13e5") == 0){
4533  fEnergyEnum = k7TeV;
4534  } else if (periodName.CompareTo("LHC14k1a") == 0){
4536  fEnergyEnum = k7TeV;
4537  } else if (periodName.CompareTo("LHC14k1b") == 0){
4539  fEnergyEnum = k7TeV;
4540  } else if (periodName.CompareTo("LHC12a15f") == 0){
4542  fEnergyEnum = k7TeV;
4543  } else if (periodName.CompareTo("LHC12a15g") == 0){
4545  fEnergyEnum = k7TeV;
4546  } else if (periodName.CompareTo("LHC12f2a") == 0){
4548  fEnergyEnum = k7TeV;
4549  } else if (periodName.CompareTo("LHC14a1a") == 0){
4552  } else if (periodName.CompareTo("LHC14a1b") == 0){
4555  } else if (periodName.CompareTo("LHC14a1c") == 0){
4558  // LHC12x anchored MCs
4559  } else if (periodName.CompareTo("LHC14e2a") == 0){
4561  fEnergyEnum = k8TeV;
4562  } else if (periodName.CompareTo("LHC14e2b") == 0){
4564  fEnergyEnum = k8TeV;
4565  } else if (periodName.CompareTo("LHC14e2c") == 0){
4567  fEnergyEnum = k8TeV;
4568  } else if (periodName.Contains("LHC15h1")){
4570  fEnergyEnum = k8TeV;
4571  } else if (periodName.Contains("LHC15h2")){
4573  fEnergyEnum = k8TeV;
4574  } else if (periodName.CompareTo("LHC16c2") == 0){
4576  fEnergyEnum = k8TeV;
4577  } else if (periodName.CompareTo("LHC16c2_plus") == 0){
4579  fEnergyEnum = k8TeV;
4580  // LHC13x anchored MCs
4581  } else if (periodName.Contains("LHC13b2_efix")){
4584  } else if (periodName.CompareTo("LHC13e7") == 0){
4587  } else if (periodName.CompareTo("LHC14b2") == 0){
4590  } else if (periodName.CompareTo("LHC13b4_fix") == 0){
4593  } else if (periodName.CompareTo("LHC13b4_plus") == 0){
4596  } else if (periodName.CompareTo("LHC16c3a") == 0){
4599  } else if (periodName.CompareTo("LHC16c3b") == 0){
4602  } else if (periodName.CompareTo("LHC16c3c") == 0){
4605  } else if (periodName.CompareTo("LHC15g2") == 0){
4608  } else if (periodName.CompareTo("LHC15a3a") == 0){
4611  } else if (periodName.CompareTo("LHC15a3a_plus") == 0){
4614  } else if (periodName.CompareTo("LHC15a3b") == 0){
4617  } else if (periodName.CompareTo("LHC15d3a") == 0){
4620  } else if (periodName.CompareTo("LHC15d3b") == 0){
4623  // LHC15x anchored MCs
4624  } else if (periodName.CompareTo("LHC15g3a3") == 0){
4626  fEnergyEnum = k13TeV;
4627  } else if (periodName.CompareTo("LHC15g3a") == 0){
4629  fEnergyEnum = k13TeV;
4630  } else if (periodName.CompareTo("LHC15g3c2") == 0){
4632  fEnergyEnum = k13TeV;
4633  } else if (periodName.CompareTo("LHC15g3c3") == 0){
4635  fEnergyEnum = k13TeV;
4636  } else if (periodName.CompareTo("LHC15g3") == 0){
4638  fEnergyEnum = k13TeV;
4639  } else if (periodName.CompareTo("LHC16a2a") == 0){
4641  fEnergyEnum = k13TeV;
4642  } else if (periodName.CompareTo("LHC16a2b") == 0){
4644  fEnergyEnum = k13TeV;
4645  } else if (periodName.CompareTo("LHC16a2c") == 0){
4647  fEnergyEnum = k13TeV;
4648  } else if (periodName.CompareTo("LHC15l1a2") == 0){
4650  fEnergyEnum = k5TeV;
4651  } else if (periodName.CompareTo("LHC15l1b2") == 0){
4653  fEnergyEnum = k5TeV;
4654  } else if (periodName.CompareTo("LHC16h3") == 0){
4656  fEnergyEnum = k5TeV;
4657  } else if (periodName.CompareTo("LHC16h8a") == 0){
4659  fEnergyEnum = k5TeV;
4660  } else if (periodName.CompareTo("LHC16h8b") == 0){
4662  fEnergyEnum = k5TeV;
4663  } else if (periodName.CompareTo("LHC16k5a") == 0){
4665  fEnergyEnum = k5TeV;
4666  } else if (periodName.CompareTo("LHC16k5b") == 0){
4668  fEnergyEnum = k5TeV;
4669  } else if (periodName.CompareTo("LHC16k3a") == 0){
4671  fEnergyEnum = k5TeV;
4672  } else if (periodName.CompareTo("LHC16k3a2") == 0){
4674  fEnergyEnum = k5TeV;
4675  } else if (periodName.CompareTo("LHC17e2") == 0){
4677  fEnergyEnum = k5TeV;
4678  } else if (periodName.Contains("LHC15k1a1")){
4681  } else if (periodName.Contains("LHC15k1a2")){
4684  } else if (periodName.Contains("LHC15k1a3")){
4687  } else if (periodName.Contains("LHC16j7")){
4690  } else if (periodName.Contains("LHC16h4")){
4693  } else if (periodName.Contains("LHC16g1")){
4696  } else if (periodName.Contains("LHC16g1a")){
4699  } else if (periodName.Contains("LHC16g1b")){
4702  } else if (periodName.Contains("LHC16g1c")){
4705  } else if (periodName.Contains("LHC16g2")){
4708  } else if (periodName.Contains("LHC16g3")){
4711  } else if (periodName.Contains("LHC16h2a")){
4714  } else if (periodName.Contains("LHC16h2b")){
4717  } else if (periodName.Contains("LHC16h2c")){
4720  } else if (periodName.CompareTo("LHC16k3b") == 0){
4723  } else if (periodName.CompareTo("LHC16k3b2") == 0){
4726  // LHC16x anchored MCs
4727  } else if (periodName.CompareTo("LHC16j2a1") == 0){
4729  fEnergyEnum = k13TeV;
4730  } else if (periodName.CompareTo("LHC16j2b1") == 0){
4732  fEnergyEnum = k13TeV;
4733  } else if (periodName.CompareTo("LHC16j2a2") == 0){
4735  fEnergyEnum = k13TeV;
4736  } else if (periodName.CompareTo("LHC16j2b2") == 0){
4738  fEnergyEnum = k13TeV;
4739 
4740  } else if (periodName.CompareTo("LHC17f6") == 0){
4742  fEnergyEnum = k13TeV;
4743  } else if (periodName.CompareTo("LHC17f9") == 0){
4745  fEnergyEnum = k13TeV;
4746  } else if (periodName.CompareTo("LHC17d1") == 0){
4748  fEnergyEnum = k13TeV;
4749  } else if (periodName.CompareTo("LHC17d17") == 0){
4751  fEnergyEnum = k13TeV;
4752  } else if (periodName.CompareTo("LHC17f5") == 0){
4754  fEnergyEnum = k13TeV;
4755  } else if (periodName.CompareTo("LHC17d3") == 0){
4757  fEnergyEnum = k13TeV;
4758  } else if (periodName.CompareTo("LHC17e5") == 0){
4760  fEnergyEnum = k13TeV;
4761  } else if (periodName.CompareTo("LHC17d20a1") == 0){
4763  fEnergyEnum = k13TeV;
4764  } else if (periodName.CompareTo("LHC17d20a1_extra") == 0){
4766  fEnergyEnum = k13TeV;
4767  } else if (periodName.CompareTo("LHC17d20a2") == 0){
4769  fEnergyEnum = k13TeV;
4770  } else if (periodName.CompareTo("LHC17d20a2_extra") == 0){
4772  fEnergyEnum = k13TeV;
4773  } else if (periodName.CompareTo("LHC17d16") == 0){
4775  fEnergyEnum = k13TeV;
4776  } else if (periodName.CompareTo("LHC17d18") == 0){
4778  fEnergyEnum = k13TeV;
4779  } else if (periodName.CompareTo("LHC17f8a") == 0){
4781  fEnergyEnum = k13TeV;
4782  } else if (periodName.CompareTo("LHC17f8b") == 0){
4784  fEnergyEnum = k13TeV;
4785  } else if (periodName.CompareTo("LHC17f8c") == 0){
4787  fEnergyEnum = k13TeV;
4788  } else if (periodName.CompareTo("LHC17f8d") == 0){
4790  fEnergyEnum = k13TeV;
4791  } else if (periodName.CompareTo("LHC17f8e") == 0){
4793  fEnergyEnum = k13TeV;
4794  // LHC16qt anchored MCs
4795  } else if (periodName.CompareTo("LHC17a2a") == 0){
4798  } else if (periodName.CompareTo("LHC17a2a_fast") == 0){
4801  } else if (periodName.CompareTo("LHC17a2a_cent") == 0){
4804  } else if (periodName.CompareTo("LHC17a2a_cent_woSDD") == 0){
4807  } else if (periodName.CompareTo("LHC17a2b") == 0){
4810  } else if (periodName.CompareTo("LHC17a2b_fast") == 0){
4813  } else if (periodName.CompareTo("LHC17a2b_cent") == 0){
4816  } else if (periodName.CompareTo("LHC17a2b_cent_woSDD") == 0){
4819  } else if (periodName.CompareTo("LHC17f2a") == 0){
4822  } else if (periodName.CompareTo("LHC17f2a_fast") == 0){
4825  } else if (periodName.CompareTo("LHC17f2a_cent") == 0){
4828  } else if (periodName.CompareTo("LHC17f2a_cent_woSDD") == 0){
4831  } else if (periodName.CompareTo("LHC17f2b") == 0){
4834  } else if (periodName.CompareTo("LHC17f2b_fast") == 0){
4837  } else if (periodName.CompareTo("LHC17f2b_cent") == 0){
4840  } else if (periodName.CompareTo("LHC17f2b_cent_woSDD") == 0){
4843  // LHC16r anchored MCs
4844  } else if (periodName.CompareTo("LHC17a3a") == 0){
4847  } else if (periodName.CompareTo("LHC17a3a_fast") == 0){
4850  } else if (periodName.CompareTo("LHC17a3a_cent") == 0){
4853  } else if (periodName.CompareTo("LHC17a3a_cent_woSDD") == 0){
4856  } else if (periodName.CompareTo("LHC17a3b") == 0){
4859  } else if (periodName.CompareTo("LHC17a3b_fast") == 0){
4862  } else if (periodName.CompareTo("LHC17a3b_cent") == 0){
4865  } else if (periodName.CompareTo("LHC17a3b_cent_woSDD") == 0){
4868  } else if (periodName.CompareTo("LHC17f3a") == 0){
4871  } else if (periodName.CompareTo("LHC17f3a_fast") == 0){
4874  } else if (periodName.CompareTo("LHC17f3a_cent") == 0){
4877  } else if (periodName.CompareTo("LHC17f3a_cent_woSDD") == 0){
4880  } else if (periodName.CompareTo("LHC17f3b") == 0){
4883  } else if (periodName.CompareTo("LHC17f3b_fast") == 0){
4886  } else if (periodName.CompareTo("LHC17f3b_cent") == 0){
4889  } else if (periodName.CompareTo("LHC17f3b_cent_woSDD") == 0){
4892  // LHC16s anchored MCs
4893  } else if (periodName.CompareT