AliPhysics  608b256 (608b256)
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 * A. Marin with help of Evgeny: Addition of double Gap events (Feb2019) *
6 * Version 1.0 *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16 
18 //---------------------------------------------
19 // Class handling all kinds of selection cuts for
20 // Gamma Conversion analysis
21 //---------------------------------------------
23 
24 #include "AliConvEventCuts.h"
25 
26 #include <memory>
27 #include "AliAODTrack.h"
28 #include "AliESDtrack.h"
29 #include "AliAnalysisManager.h"
30 #include "AliInputEventHandler.h"
31 #include "AliMCEventHandler.h"
32 #include "AliAODHandler.h"
33 #include "TH1.h"
34 #include "TH2.h"
35 #include "TF1.h"
36 #include "TObjString.h"
37 #include "AliMCEvent.h"
38 #include "AliAODEvent.h"
39 #include "AliESDEvent.h"
40 #include "AliCentrality.h"
41 #include "AliMultSelection.h"
42 #include "TList.h"
43 #include "TFile.h"
44 #include "AliLog.h"
45 #include "AliGenCocktailEventHeader.h"
46 #include "AliGenDPMjetEventHeader.h"
47 #include "AliGenPythiaEventHeader.h"
48 #include "AliGenHijingEventHeader.h"
49 #include "AliTriggerAnalysis.h"
50 #include "AliV0ReaderV1.h"
51 #include "AliVCaloCells.h"
52 #include "AliAODMCParticle.h"
53 #include "AliAODMCHeader.h"
54 #include "AliEMCALTriggerPatchInfo.h"
55 
56 class iostream;
57 
58 using namespace std;
59 
61 ClassImp(AliConvEventCuts)
63 
64 
65 const char* AliConvEventCuts::fgkCutNames[AliConvEventCuts::kNCuts] = {
66  "HeavyIon", //0
67  "CentralityMin", //1
68  "CentralityMax", //2
69  "SelectSpecialTrigger", //3
70  "SelectSpecialSubTriggerClass", //4
71  "RemovePileUp", //5
72  "RejectExtraSignals", //6
73  "VertexCut", //7
74 };
75 
76 
77 //________________________________________________________________________
78 AliConvEventCuts::AliConvEventCuts(const char *name,const char *title) :
79  AliAnalysisCuts(name,title),
80  fHistograms(NULL),
81  fHeaderList(NULL),
82  fDoLightOutput(kFALSE),
83  fEventQuality(-1),
84  fIsHeavyIon(0),
85  fDetectorCentrality(0),
86  fModCentralityClass(0),
87  fEnableVertexCut(kTRUE),
88  fMaxVertexZ(10),
89  fCentralityMin(0),
90  fCentralityMax(0),
91  fMultiplicityMethod(0),
92  fSpecialTrigger(0),
93  fSpecialSubTrigger(0),
94  fRemovePileUp(kFALSE),
95  fRemovePileUpSPD(kFALSE),
96  fUseSphericity(0),
97  fUseSphericityTrue(kFALSE),
98  fPastFutureRejectionLow(0),
99  fPastFutureRejectionHigh(0),
100  fDoPileUpRejectV0MTPCout(0),
101  fFPileUpRejectV0MTPCout(0),
102  fRejectExtraSignals(0),
103  fOfflineTriggerMask(0),
104  fHasV0AND(kTRUE),
105  fIsSDDFired(kTRUE),
106  fRandom(0),
107  fnHeaders(0),
108  fNotRejectedStart(NULL),
109  fNotRejectedEnd(NULL),
110  fGeneratorNames(NULL),
111  fPeriodEnum(kNoPeriod),
112  fEnergyEnum(kUnset),
113  fCutString(NULL),
114  fCutStringRead(""),
115  fUtils(NULL),
116  fEtaShift(0.0),
117  fDoEtaShift(kFALSE),
118  fDoCentralityFlat(0),
119  fPathWeightsFlatCent(""),
120  fNameHistoNotFlatCentrality(""),
121  fDoReweightHistoMCPi0(kFALSE),
122  fDoReweightHistoMCEta(kFALSE),
123  fDoReweightHistoMCK0s(kFALSE),
124  fPathTrFReweighting(""),
125  fNameHistoReweightingPi0(""),
126  fNameHistoReweightingEta(""),
127  fNameHistoReweightingK0s(""),
128  fNameFitDataPi0(""),
129  fNameFitDataEta(""),
130  fNameFitDataK0s(""),
131  fDoReweightHistoMCGamma(kFALSE),
132  fPathTrFGammaReweighting(""),
133  fNameHistoReweightingGamma(""),
134  fNameDataHistoReweightingGamma(""),
135  fHistoEventCuts(NULL),
136  fHistoPastFutureBits(NULL),
137  hCentrality(NULL),
138  hCentralityNotFlat(NULL),
139  //hCentralityVsNumberOfPrimaryTracks(NULL),
140  hVertexZ(NULL),
141  hNPileupVertices(NULL),
142  hPileupVertexToPrimZ(NULL),
143  hPileupVertexToPrimZSPDPileup(NULL),
144  hPileupVertexToPrimZTrackletvsHits(NULL),
145  hEventPlaneAngle(NULL),
146  fEventPlaneAngle(0),
147  hTriggerClass(NULL),
148  hTriggerClassSelected(NULL),
149  hTriggerClassesCorrelated(NULL),
150  hReweightMCHistPi0(NULL),
151  hReweightMCHistEta(NULL),
152  hReweightMCHistK0s(NULL),
153  fFitDataPi0(NULL),
154  fFitDataEta(NULL),
155  fFitDataK0s(NULL),
156  hReweightMCHistGamma(NULL),
157  hReweightDataHistGamma(NULL),
158  fAddedSignalPDGCode(0),
159  fPreSelCut(kFALSE),
160  fTriggerSelectedManually(kFALSE),
161  fSpecialTriggerName(""),
162  fSpecialSubTriggerName(""),
163  fSpecialSubTriggerNameAdditional(""),
164  fNSpecialSubTriggerOptions(0),
165  hSPDClusterTrackletBackgroundBefore(NULL),
166  hSPDClusterTrackletBackground(NULL),
167  fV0ReaderName(""),
168  fCorrTaskSetting(""),
169  fCaloTriggers(NULL),
170  fTriggerPatchInfo(NULL),
171  fMainTriggerPatchEMCAL(NULL),
172  fCaloTriggersName(""),
173  fCaloTriggerPatchInfoName(""),
174  fTriggersEMCAL(0),
175  fTriggersEMCALSelected(-1),
176  fEMCALTrigInitialized(kFALSE),
177  fSecProdBoundary(1.0),
178  fMaxPtJetMC(0),
179  fMinFacPtHard(-1),
180  fMaxFacPtHard(2.5),
181  fMaxFacPtHardSingleParticle(1.5),
182  fMimicTrigger(kFALSE),
183  fRejectTriggerOverlap(kFALSE),
184  fDoMultiplicityWeighting(kFALSE),
185  fPathReweightingMult(""),
186  fNameHistoReweightingMultData(""),
187  fNameHistoReweightingMultMC(""),
188  hReweightMultData(NULL),
189  hReweightMultMC(NULL),
190  fDebugLevel(0)
191 {
192  for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
193  fCutString=new TObjString((GetCutNumber()).Data());
194 
195  fUtils = new AliAnalysisUtils();
196  //if you do not want to apply the cut on the distance between the SPD and TRK vertex:
197  //fUtils->SetCutOnZVertexSPD(kFALSE);
198 
199 
200 }
201 
202 //________________________________________________________________________
204  AliAnalysisCuts(ref),
205  fHistograms(NULL),
229  fHasV0AND(ref.fHasV0AND),
231  fRandom(ref.fRandom),
232  fnHeaders(ref.fnHeaders),
233  fNotRejectedStart(NULL),
234  fNotRejectedEnd(NULL),
238  fCutString(NULL),
239  fCutStringRead(""),
240  fUtils(NULL),
241  fEtaShift(ref.fEtaShift),
260  fHistoEventCuts(NULL),
261  fHistoPastFutureBits(NULL),
264  //hCentralityVsNumberOfPrimaryTracks(ref.hCentralityVsNumberOfPrimaryTracks),
265  hVertexZ(ref.hVertexZ),
272  hTriggerClass(NULL),
273  hTriggerClassSelected(NULL),
284  fPreSelCut(ref.fPreSelCut),
294  fCaloTriggers(NULL),
295  fTriggerPatchInfo(NULL),
301  fEMCALTrigInitialized(kFALSE),
316 {
317  // Copy Constructor
318  for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
319  fCutString=new TObjString((GetCutNumber()).Data());
320  fUtils = new AliAnalysisUtils();
321  // dont copy histograms (if you like histograms, call InitCutHistograms())
322 
323 }
324 
325 
326 //________________________________________________________________________
328  // Destructor
329  //Deleting fHistograms leads to seg fault it it's added to output collection of a task
330  // if(fHistograms)
331  // delete fHistograms;
332  // fHistograms = NULL;
333  if(fCutString != NULL){
334  delete fCutString;
335  fCutString = NULL;
336  }
337  if(fNotRejectedStart){
338  delete[] fNotRejectedStart;
339  fNotRejectedStart = NULL;
340  }
341  if(fNotRejectedEnd){
342  delete[] fNotRejectedEnd;
343  fNotRejectedEnd = NULL;
344  }
345  if(fGeneratorNames){
346  delete[] fGeneratorNames;
347  fGeneratorNames = NULL;
348  }
349  if(fUtils){
350  delete fUtils;
351  fUtils = NULL;
352  }
353 
354 }
355 
356 //________________________________________________________________________
358 
359  // Initialize Cut Histograms for QA (only initialized and filled if function is called)
360  TH1::AddDirectory(kFALSE);
361 
362  if(fHistograms != NULL){
363  delete fHistograms;
364  fHistograms=NULL;
365  }
366  if(fHistograms==NULL){
367  fHistograms=new TList();
368  fHistograms->SetOwner(kTRUE);
369  if(name=="")fHistograms->SetName(Form("ConvEventCuts_%s",GetCutNumber().Data()));
370  else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
371  }
372 
373  if (hReweightMCHistPi0){
374  hReweightMCHistPi0->SetName("MCInputForWeightingPi0");
376  }
377  if (hReweightMCHistEta){
378  hReweightMCHistEta->SetName("MCInputForWeightingEta");
380  }
381  if (hReweightMCHistK0s){
382  hReweightMCHistK0s->SetName("MCInputForWeightingK0s");
384  }
385 
387  hReweightMCHistGamma->SetName("MCInputForWeightingGamma");
389  }
390 
391 
392  if (hReweightMultData){
393  hReweightMultData->SetName(Form("hReweightMultData_%s",GetCutNumber().Data()));
395  }
396  if (hReweightMultMC){
397  hReweightMultMC->SetName(Form("hReweightMultMC_%s",GetCutNumber().Data()));
399  }
400 
401  if(!fDoLightOutput){
402  if (fIsHeavyIon == 1){
403  hSPDClusterTrackletBackgroundBefore = new TH2F(Form("SPD tracklets vs SPD clusters %s before Pileup Cut",GetCutNumber().Data()),"SPD tracklets vs SPD clusters", 200, 0, 6000, 200, 0, 20000);
405  hSPDClusterTrackletBackground = new TH2F(Form("SPD tracklets vs SPD clusters %s",GetCutNumber().Data()),"SPD tracklets vs SPD clusters", 200, 0, 6000, 200, 0, 20000);
407  } else{
408  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);
410  hSPDClusterTrackletBackground = new TH2F(Form("SPD tracklets vs SPD clusters %s",GetCutNumber().Data()),"SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
412  }
413  }
414 
415  if(fIsHeavyIon > 0){
416  hCentrality=new TH1F(Form("Centrality %s",GetCutNumber().Data()),"Centrality",420,0,105);
417  fHistograms->Add(hCentrality);
418  }
419 
420  //hCentralityVsNumberOfPrimaryTracks=new TH2F(Form("Centrality vs Primary Tracks %s",GetCutNumber().Data()),"Centrality vs Primary Tracks ",400,0,100,4000,0,4000);
421  //fHistograms->Add(hCentralityVsNumberOfPrimaryTracks); commented on 3.3.2015 because it's in the main Task
422 
423  hVertexZ = new TH1F(Form("VertexZ %s",GetCutNumber().Data()),"VertexZ",1000,-50,50);
424  fHistograms->Add(hVertexZ);
425 
426  hNPileupVertices = new TH1F(Form("NPileupVertices %s",GetCutNumber().Data()),"NPileupVertices",30,-0.5,29.5);
428 
429  hPileupVertexToPrimZ = new TH1F(Form("PileupVertexDistance %s",GetCutNumber().Data()),"PileupVertexDistance",600,-15,15);
431  hPileupVertexToPrimZSPDPileup = new TH1F(Form("PileupVertexDistance_SPDPileup %s",GetCutNumber().Data()),"PileupVertexDistance_SPDPileup",600,-15,15);
433  hPileupVertexToPrimZTrackletvsHits = new TH1F(Form("PileupVertexDistance_TrackletvsHits %s",GetCutNumber().Data()),"PileupVertexDistance_TrackletvsHits",600,-15,15);
435 
436  if(fIsHeavyIon == 1){
437  hEventPlaneAngle = new TH1F(Form("EventPlaneAngle %s",GetCutNumber().Data()),"EventPlaneAngle",60, 0, TMath::Pi());
439  }
440  fHistoPastFutureBits=new TH1F(Form("PastFutureBits %s",GetCutNumber().Data()),"Past Future Bits",180,-90*25,90*25);
442 
443  // Event Cuts and Info
444  if(preCut){
445  fHistoEventCuts=new TH1F(Form("ESD_EventCuts %s",GetCutNumber().Data()),"Event Cuts",8,-0.5,7.5);
446  fHistoEventCuts->GetXaxis()->SetBinLabel(1,"in");
447  fHistoEventCuts->GetXaxis()->SetBinLabel(2,"OfflineTrigger");
448  fHistoEventCuts->GetXaxis()->SetBinLabel(3,"nvtxcontr");
449  fHistoEventCuts->GetXaxis()->SetBinLabel(4,"VertexZ");
450  fHistoEventCuts->GetXaxis()->SetBinLabel(5,"pileup");
451  fHistoEventCuts->GetXaxis()->SetBinLabel(6,"centrsel");
452  fHistoEventCuts->GetXaxis()->SetBinLabel(7,"OOB-pileup");
453  fHistoEventCuts->GetXaxis()->SetBinLabel(8,"out");
455 
456  hTriggerClass= new TH1F(Form("OfflineTrigger %s",GetCutNumber().Data()),"OfflineTrigger",37,-0.5,36.5);
457  hTriggerClass->GetXaxis()->SetBinLabel( 1,"kMB");
458  hTriggerClass->GetXaxis()->SetBinLabel( 2,"kINT7");
459  hTriggerClass->GetXaxis()->SetBinLabel( 3,"kMUON");
460  hTriggerClass->GetXaxis()->SetBinLabel( 4,"kHighMult");
461  hTriggerClass->GetXaxis()->SetBinLabel( 5,"kEMC1");
462  hTriggerClass->GetXaxis()->SetBinLabel( 6,"kCINT5");
463  hTriggerClass->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
464  hTriggerClass->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
465  hTriggerClass->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
466  hTriggerClass->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
467  hTriggerClass->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
468  hTriggerClass->GetXaxis()->SetBinLabel(12,"kMUS7");
469  hTriggerClass->GetXaxis()->SetBinLabel(13,"kPHI1");
470  hTriggerClass->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
471  hTriggerClass->GetXaxis()->SetBinLabel(15,"kEMCEJE");
472  hTriggerClass->GetXaxis()->SetBinLabel(16,"kEMCEGA");
473  hTriggerClass->GetXaxis()->SetBinLabel(17,"kCentral");
474  hTriggerClass->GetXaxis()->SetBinLabel(18,"kSemiCentral");
475  hTriggerClass->GetXaxis()->SetBinLabel(19,"kDG5");
476  hTriggerClass->GetXaxis()->SetBinLabel(20,"kZED");
477  hTriggerClass->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
478  hTriggerClass->GetXaxis()->SetBinLabel(22,"kINT8");
479  hTriggerClass->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
480  hTriggerClass->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
481  hTriggerClass->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
482  hTriggerClass->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
483  hTriggerClass->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
484  hTriggerClass->GetXaxis()->SetBinLabel(28,"kUserDefined");
485  hTriggerClass->GetXaxis()->SetBinLabel(29,"kTRD");
486  hTriggerClass->GetXaxis()->SetBinLabel(30,"kFastOnly");
487  hTriggerClass->GetXaxis()->SetBinLabel(31,"kAnyINT");
488  hTriggerClass->GetXaxis()->SetBinLabel(32,"kAny");
489  hTriggerClass->GetXaxis()->SetBinLabel(33,"V0AND");
490  hTriggerClass->GetXaxis()->SetBinLabel(34,"NOT kFastOnly");
491  hTriggerClass->GetXaxis()->SetBinLabel(35,"kCaloOnly");
492  hTriggerClass->GetXaxis()->SetBinLabel(36,"failed Physics Selection");
493  hTriggerClass->GetXaxis()->SetBinLabel(37,"mimickedTrigger");
495  }
496  if(!preCut){
497  hTriggerClassSelected= new TH1F(Form("OfflineTriggerSelected %s",GetCutNumber().Data()),"OfflineTriggerSelected",35,-0.5,34.5);
498  hTriggerClassSelected->GetXaxis()->SetBinLabel( 1,"kMB");
499  hTriggerClassSelected->GetXaxis()->SetBinLabel( 2,"kINT7");
500  hTriggerClassSelected->GetXaxis()->SetBinLabel( 3,"kMUON");
501  hTriggerClassSelected->GetXaxis()->SetBinLabel( 4,"kHighMult");
502  hTriggerClassSelected->GetXaxis()->SetBinLabel( 5,"kEMC1");
503  hTriggerClassSelected->GetXaxis()->SetBinLabel( 6,"kCINT5");
504  hTriggerClassSelected->GetXaxis()->SetBinLabel( 7,"kCMUS5/kMUSPB");
505  hTriggerClassSelected->GetXaxis()->SetBinLabel( 8,"kMUSH7/kMUSHPB");
506  hTriggerClassSelected->GetXaxis()->SetBinLabel( 9,"kMUL7/kMuonLikePB");
507  hTriggerClassSelected->GetXaxis()->SetBinLabel(10,"kMUU7/kMuonUnlikePB");
508  hTriggerClassSelected->GetXaxis()->SetBinLabel(11,"kEMC7/kEMC8");
509  hTriggerClassSelected->GetXaxis()->SetBinLabel(12,"kMUS7");
510  hTriggerClassSelected->GetXaxis()->SetBinLabel(13,"kPHI1");
511  hTriggerClassSelected->GetXaxis()->SetBinLabel(14,"kPHI7/kPHI8/kPHOSPb");
512  hTriggerClassSelected->GetXaxis()->SetBinLabel(15,"kEMCEJE");
513  hTriggerClassSelected->GetXaxis()->SetBinLabel(16,"kEMCEGA");
514  hTriggerClassSelected->GetXaxis()->SetBinLabel(17,"kCentral");
515  hTriggerClassSelected->GetXaxis()->SetBinLabel(18,"kSemiCentral");
516  hTriggerClassSelected->GetXaxis()->SetBinLabel(19,"kDG5");
517  hTriggerClassSelected->GetXaxis()->SetBinLabel(20,"kZED");
518  hTriggerClassSelected->GetXaxis()->SetBinLabel(21,"kSPI7/kSPI");
519  hTriggerClassSelected->GetXaxis()->SetBinLabel(22,"kINT8");
520  hTriggerClassSelected->GetXaxis()->SetBinLabel(23,"kMuonSingleLowPt8");
521  hTriggerClassSelected->GetXaxis()->SetBinLabel(24,"kMuonSingleHighPt8");
522  hTriggerClassSelected->GetXaxis()->SetBinLabel(25,"kMuonLikeLowPt8");
523  hTriggerClassSelected->GetXaxis()->SetBinLabel(26,"kMuonUnlikeLowPt8");
524  hTriggerClassSelected->GetXaxis()->SetBinLabel(27,"kMuonUnlikeLowPt0");
525  hTriggerClassSelected->GetXaxis()->SetBinLabel(28,"kUserDefined");
526  hTriggerClassSelected->GetXaxis()->SetBinLabel(29,"kTRD");
527  hTriggerClassSelected->GetXaxis()->SetBinLabel(30,"kFastOnly");
528  hTriggerClassSelected->GetXaxis()->SetBinLabel(31,"kAnyINT");
529  hTriggerClassSelected->GetXaxis()->SetBinLabel(32,"kAny");
530  hTriggerClassSelected->GetXaxis()->SetBinLabel(33,"V0AND");
531  hTriggerClassSelected->GetXaxis()->SetBinLabel(34,"NOT kFastOnly");
532  hTriggerClassSelected->GetXaxis()->SetBinLabel(35,"mimickedTrigger");
534 
535  if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9 || fSpecialTrigger == 10){
536  hTriggerClassesCorrelated= new TH1F(Form("TriggerCorrelations %s",GetCutNumber().Data()),"Triggers Correlated with EMCal triggers",17,-0.5,16.5);
537  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 1,"kMB");
538  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 2,"kINT7");
539  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 3,"kEMC1");
540  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 4,"kEMC7");
541  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 5,"kEMCEJE");
542  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 6,"kEMCEJ1");
543  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 7,"kEMCEJ2");
544  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 8,"kEMCEGA");
545  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 9,"kEMCEG1");
546  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 10,"kEMCEG2");
547  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 11,"kDMC7");
548  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 12,"kDMCDJE");
549  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 13,"kDMCDJ1");
550  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 14,"kDMCDJ2");
551  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 15,"kDMCDGA");
552  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 16,"kDMCDG1");
553  hTriggerClassesCorrelated->GetXaxis()->SetBinLabel( 17,"kDMCDG2");
555  }
556 
557  }
558  TH1::AddDirectory(kTRUE);
559 }
560 
562 Bool_t AliConvEventCuts::EventIsSelected(AliVEvent *event, AliMCEvent *mcEvent){
563  // Process Event Selection
564 
565  Int_t cutindex=0;
566  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
567  cutindex++;
568 
569  // Check for MC event
570  Bool_t isMC = kFALSE;
571  if(mcEvent && event->IsA()==AliESDEvent::Class()){
572  // Check if MC event is correctly loaded
573  AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
574  if (!mcHandler){
575  fEventQuality = 2;
576  return kFALSE;
577  }
578  if (!mcHandler->InitOk() ){
579  fEventQuality = 2;
580  return kFALSE;
581  }
582  if (!mcHandler->TreeK() ){
583  fEventQuality = 2;
584  return kFALSE;
585  }
586  // TrackRefs.root is currently not used by anyone
587  // and was excluded from future MC productions
588  // if (!mcHandler->TreeTR() ) {
589  // fEventQuality = 2;
590  // return kFALSE;
591  // }
592  isMC = kTRUE;
593  }
594 
595 
596 
597  // Event Trigger
598  // cout << "before event trigger" << endl;
599  if(!IsTriggerSelected(event, isMC )){
600  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
601  fEventQuality = 3;
602  return kFALSE;
603  }
604  cutindex++;
605 
606  if(event->IsA()==AliESDEvent::Class()){
607  AliTriggerAnalysis fTriggerAnalysis;// = new AliTriggerAnalysis;
608  fHasV0AND = fTriggerAnalysis.IsOfflineTriggerFired((AliESDEvent*)event, AliTriggerAnalysis::kV0AND);
609  if(fHasV0AND&&hTriggerClass)hTriggerClass->Fill(32);
610  }
611  // cout << "event number " << ((AliESDEvent*)event)->GetEventNumberInFile() << " entered"<< endl;
612 
613 
614  // Number of Contributors Cut
615  if (fEnableVertexCut){
616  if(GetNumberOfContributorsVtx(event)<=0) {
617  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
618  fEventQuality = 5;
619  return kFALSE;
620  }
621  }
622  cutindex++;
623 
624  // Z Vertex Position Cut
625  if (fEnableVertexCut){
626  if(!VertexZCut(event)){
627  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
628  fEventQuality = 4;
629  return kFALSE;
630  }
631  }
632  cutindex++;
633 
634  // SPD clusters vs tracklets to check for pileup/background
635  Int_t nClustersLayer0 = event->GetNumberOfITSClusters(0);
636  Int_t nClustersLayer1 = event->GetNumberOfITSClusters(1);
637  Int_t nTracklets = event->GetMultiplicity()->GetNumberOfTracklets();
638  if(hSPDClusterTrackletBackgroundBefore) hSPDClusterTrackletBackgroundBefore->Fill(nTracklets, (nClustersLayer0 + nClustersLayer1));
639 
640 
641  Double_t distZMax = 0;
642  if(event->IsA()==AliESDEvent::Class()){
643  Int_t nPileVert = ((AliESDEvent*)event)->GetNumberOfPileupVerticesSPD();
644  if (hNPileupVertices) hNPileupVertices->Fill(nPileVert);
645  if (nPileVert > 0){
646  for(Int_t i=0; i<nPileVert;i++){
647  const AliESDVertex* pv = ((AliESDEvent*)event)->GetPileupVertexSPD(i);
648  Int_t nc2 = pv->GetNContributors();
649  if(nc2>=3){
650  Double_t z1 = ((AliESDEvent*)event)->GetPrimaryVertexSPD()->GetZ();
651  Double_t z2 = pv->GetZ();
652  Double_t distZ = z2-z1;
653  if (TMath::Abs(distZMax) < TMath::Abs(distZ) ){
654  distZMax = distZ;
655  }
656  }
657  }
658  if (hPileupVertexToPrimZ) hPileupVertexToPrimZ->Fill(distZMax);
659  }
660  }
661 
662  // Pile Up Rejection
663  if (fIsHeavyIon == 2){
664  if(GetUseNewMultiplicityFramework()){// for Run2 pPb
665  if(fUtils->IsPileUpMV(event)){
666  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
667  fEventQuality = 6;
668  return kFALSE;
669  }
670  } else{
671  if(fUtils->IsFirstEventInChunk(event)){
672  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
673  fEventQuality = 6;
674  return kFALSE;
675  }
676  if(fRemovePileUpSPD){
677  if(fUtils->IsPileUpEvent(event)){
678  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
680  fEventQuality = 6;
681  return kFALSE;
682  }
683  if (fUtils->IsSPDClusterVsTrackletBG(event)){
684  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
686  fEventQuality = 11;
687  return kFALSE;
688  }
689  }
690  }
691  } else if(fRemovePileUpSPD){
692  if(event->IsPileupFromSPD(3,0.8,3.,2.,5.) ){
693  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
695  fEventQuality = 6;
696  return kFALSE;
697  }
698  if (fUtils->IsSPDClusterVsTrackletBG(event)){
699  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
701  fEventQuality = 11;
702  return kFALSE;
703  }
704  }
705  cutindex++;
706 
707  // Centrality Selection
708  if(!IsCentralitySelected(event,mcEvent)){
709  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
710  fEventQuality = 1;
711  return kFALSE;
712  }
713  cutindex++;
714 
716  if(fHistoEventCuts) fHistoEventCuts->Fill(cutindex);
717  fEventQuality = 12;
718  return kFALSE;
719  }
720  cutindex++;
721  // Fill Event Histograms
722  if(fHistoEventCuts)fHistoEventCuts->Fill(cutindex);
723  if(hCentrality)hCentrality->Fill(GetCentrality(event));
724  if(hVertexZ)hVertexZ->Fill(event->GetPrimaryVertex()->GetZ());
725  // if(hCentralityVsNumberOfPrimaryTracks)
726  // hCentralityVsNumberOfPrimaryTracks->Fill(GetCentrality(event),
727  // ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()
728  // ->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks());
729 
730  if(fIsHeavyIon == 1){
731  AliEventplane *EventPlane = event->GetEventplane();
732  fEventPlaneAngle = EventPlane->GetEventplane("V0",event,2);
733  if(hEventPlaneAngle)hEventPlaneAngle->Fill(TMath::Abs(fEventPlaneAngle));
734  }
735  if(hSPDClusterTrackletBackground) hSPDClusterTrackletBackground->Fill(nTracklets, (nClustersLayer0 + nClustersLayer1));
736 
737  fEventQuality = 0;
738  return kTRUE;
739 }
740 
744 
745  if(fCutString && fCutString->GetString().Length() == kNCuts) {
746  fCutString->SetString(GetCutNumber());
747  } else {
748  return kFALSE;
749  }
750  return kTRUE;
751 }
752 
755 
756  AliInfo("Entering loading of weights for centrality flattening");
757  TFile *w = TFile::Open(fPathWeightsFlatCent.Data());
758  if(!w){
759  AliError(Form("file for centrality flattening %s not found",fPathWeightsFlatCent.Data()));
760  return;
761  }
762 
763  if (fNameHistoNotFlatCentrality.CompareTo("") != 0 && (fDoCentralityFlat > 0)){
764  cout << "I have to find: " << fNameHistoNotFlatCentrality.Data() << endl;
765  TH1D *hCentralityNotFlattemp = (TH1D*)w->Get(fNameHistoNotFlatCentrality.Data());
766  hCentralityNotFlat = new TH1D(*hCentralityNotFlattemp);
767  if (hCentralityNotFlat) AliInfo(Form("%s has been loaded from %s", fNameHistoNotFlatCentrality.Data(),fPathWeightsFlatCent.Data() ));
768  else AliWarning(Form("%s not found in %s", fNameHistoNotFlatCentrality.Data() ,fPathWeightsFlatCent.Data()));
769  hCentralityNotFlat->SetDirectory(0);
770  }
771 
772  w->Close();
773  delete w;
774 }
775 
778 
779  AliInfo("Entering loading of weights for multiplicity weighting");
780  TFile *w = TFile::Open(fPathReweightingMult.Data());
781  if(!w){
782  AliError(Form("file for multiplicity reweighting %s not found",fPathReweightingMult.Data()));
783  return;
784  }
785 
786  if (fNameHistoReweightingMultData.CompareTo("") != 0 && (fDoMultiplicityWeighting > 0)){
787  cout << "I have to find: " << fNameHistoReweightingMultData.Data() << endl;
788  TH1D *hReweightMultDatatemp = (TH1D*)w->Get(fNameHistoReweightingMultData.Data());
789  if(hReweightMultDatatemp){
790  hReweightMultData = new TH1D(*hReweightMultDatatemp);
791  hReweightMultData->SetDirectory(0);
792  AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingMultData.Data(),fPathReweightingMult.Data() ));
793  } else AliError(Form("%s was not contained in %s", fNameHistoReweightingMultData.Data(),fPathReweightingMult.Data() ));
794  }
795  if (fNameHistoReweightingMultMC.CompareTo("") != 0 && (fDoMultiplicityWeighting > 0)){
796  cout << "I have to find: " << fNameHistoReweightingMultMC.Data() << endl;
797  TH1D *hReweightMultMCtemp = (TH1D*)w->Get(fNameHistoReweightingMultMC.Data());
798  if(hReweightMultMCtemp){
799  hReweightMultMC = new TH1D(*hReweightMultMCtemp);
800  hReweightMultMC->SetDirectory(0);
801  AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingMultMC.Data(),fPathReweightingMult.Data() ));
802  } else AliError(Form("%s was not contained in %s", fNameHistoReweightingMultMC.Data(),fPathReweightingMult.Data() ));
803  }
804 
805  w->Close();
806  delete w;
807 }
808 
809 
812 
813  AliInfo("Entering loading of histograms for weighting");
814  TFile *f = TFile::Open(fPathTrFReweighting.Data());
815  if(!f){
816  AliError(Form("file for weighting %s not found",fPathTrFReweighting.Data()));
817  return;
818  }
819  if (fNameHistoReweightingPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){
820  cout << "I have to find: " << fNameHistoReweightingPi0.Data() << endl;
821  TH1D *hReweightMCHistPi0temp = (TH1D*)f->Get(fNameHistoReweightingPi0.Data());
822  if(hReweightMCHistPi0temp){
823  hReweightMCHistPi0 = new TH1D(*hReweightMCHistPi0temp);
824  hReweightMCHistPi0->SetDirectory(0);
825  AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingPi0.Data(),fPathTrFReweighting.Data() ));
826  } else AliWarning(Form("%s not found in %s", fNameHistoReweightingPi0.Data() ,fPathTrFReweighting.Data()));
827  }
828  if (fNameFitDataPi0.CompareTo("") != 0 && fDoReweightHistoMCPi0 ){
829  cout << "I have to find: " << fNameFitDataPi0.Data() << endl;
830  TF1 *fFitDataPi0temp = (TF1*)f->Get(fNameFitDataPi0.Data());
831  if(fFitDataPi0temp){
832  fFitDataPi0 = new TF1(*fFitDataPi0temp);
833  AliInfo(Form("%s has been loaded from %s", fNameFitDataPi0.Data(),fPathTrFReweighting.Data() ));
834  } else AliWarning(Form("%s not found in %s",fPathTrFReweighting.Data(), fNameFitDataPi0.Data() ));
835  }
836 
837  if (fNameHistoReweightingEta.CompareTo("") != 0 && fDoReweightHistoMCEta){
838  cout << "I have to find: " << fNameHistoReweightingEta.Data() << endl;
839  TH1D *hReweightMCHistEtatemp = (TH1D*)f->Get(fNameHistoReweightingEta.Data());
840  if(hReweightMCHistEtatemp){
841  hReweightMCHistEta = new TH1D(*hReweightMCHistEtatemp);
842  hReweightMCHistEta->SetDirectory(0);
843  AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() ));
844  } else AliWarning(Form("%s not found in %s", fNameHistoReweightingEta.Data(),fPathTrFReweighting.Data() ));
845  }
846 
847  if (fNameFitDataEta.CompareTo("") != 0 && fDoReweightHistoMCEta){
848  cout << "I have to find: " << fNameFitDataEta.Data() << endl;
849  TF1 *fFitDataEtatemp = (TF1*)f->Get(fNameFitDataEta.Data());
850  if(fFitDataEtatemp){
851  fFitDataEta = new TF1(*fFitDataEtatemp);
852  AliInfo(Form("%s has been loaded from %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() ));
853  } else AliWarning(Form("%s not found in %s", fNameFitDataEta.Data(),fPathTrFReweighting.Data() ));
854 
855  }
856  if (fNameHistoReweightingK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){
857  cout << "I have to find: " << fNameHistoReweightingK0s.Data() << endl;
858  TH1D *hReweightMCHistK0stemp = (TH1D*)f->Get(fNameHistoReweightingK0s.Data());
859  if(hReweightMCHistK0stemp){
860  hReweightMCHistK0s = new TH1D(*hReweightMCHistK0stemp);
861  hReweightMCHistK0s->SetDirectory(0);
862  AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() ));
863  } else AliWarning(Form("%s not found in %s", fNameHistoReweightingK0s.Data(),fPathTrFReweighting.Data() ));
864  }
865 
866  if (fNameFitDataK0s.CompareTo("") != 0 && fDoReweightHistoMCK0s){
867  cout << "I have to find: " << fNameFitDataK0s.Data() << endl;
868  TF1 *fFitDataK0stemp = (TF1*)f->Get(fNameFitDataK0s.Data());
869  if(fFitDataK0stemp){
870  fFitDataK0s = new TF1(*fFitDataK0stemp);
871  AliInfo(Form("%s has been loaded from %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() ));
872  } else AliWarning(Form("%s not found in %s", fNameFitDataK0s.Data(),fPathTrFReweighting.Data() ));
873  }
874  f->Close();
875  delete f;
876 }
877 
880 
881  AliInfo("Entering loading of histograms for gamma pT weighting");
882  TFile *f = TFile::Open(fPathTrFGammaReweighting.Data());
883  if(!f){
884  AliError(Form("file for gamma pT weighting %s not found",fPathTrFGammaReweighting.Data()));
885  return;
886  }
887  if (fNameHistoReweightingGamma.CompareTo("") != 0 && fDoReweightHistoMCGamma ){
888  cout << "I have to find: " << fNameHistoReweightingGamma.Data() << endl;
889  TH1D *hReweightMCHistGammatemp = (TH1D*)f->Get(fNameHistoReweightingGamma.Data());
890  if(hReweightMCHistGammatemp){
891  hReweightMCHistGamma = new TH1D(*hReweightMCHistGammatemp);
892  hReweightMCHistGamma->SetDirectory(0);
893  AliInfo(Form("%s has been loaded from %s", fNameHistoReweightingGamma.Data(),fPathTrFGammaReweighting.Data() ));
894  } else AliWarning(Form("%s not found in %s", fNameHistoReweightingGamma.Data() ,fPathTrFGammaReweighting.Data()));
895  }
896  if (fNameDataHistoReweightingGamma.CompareTo("") != 0 && fDoReweightHistoMCGamma ){
897  cout << "I have to find: " << fNameDataHistoReweightingGamma.Data() << endl;
898  TH1D *hReweightDataHistGammatemp = (TH1D*)f->Get(fNameDataHistoReweightingGamma.Data());
899  if(hReweightDataHistGammatemp){
900  hReweightDataHistGamma = new TH1D(*hReweightDataHistGammatemp);
901  hReweightDataHistGamma->SetDirectory(0);
902  AliInfo(Form("%s has been loaded from %s", fNameDataHistoReweightingGamma.Data(),fPathTrFGammaReweighting.Data() ));
903  } else AliWarning(Form("%s not found in %s",fPathTrFGammaReweighting.Data(), fNameDataHistoReweightingGamma.Data() ));
904  }
905 
906 
907  f->Close();
908  delete f;
909 }
910 
911 
914  fCutStringRead = Form("%s",analysisCutSelection.Data());
915 
916  // Initialize Cuts from a given Cut string
917  if(fDoCentralityFlat > 0){
918  AliInfo("Centrality flattening was enabled");
920  }
921 
923  AliInfo("Multiplicity weighting was enabled");
925  }
926 
928  AliInfo("Particle Weighting was enabled");
930  }
931 
933  AliInfo("Gamma pT Weighting was enabled");
935  }
936 
937 
938  AliInfo(Form("Set Event Cut Number: %s",analysisCutSelection.Data()));
939  if(analysisCutSelection.Length()!=kNCuts) {
940  AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
941  return kFALSE;
942  }
943  if(!analysisCutSelection.IsAlnum()){
944  AliError("Cut selection is not alphanumeric");
945  return kFALSE;
946  }
947 
948  if (fV0ReaderName.CompareTo("") == 0){
949  fV0ReaderName = "V0ReaderV1";
950  }
951  TString analysisCutSelectionLowerCase = Form("%s",analysisCutSelection.Data());
952  analysisCutSelectionLowerCase.ToLower();
953  const char *cutSelection = analysisCutSelectionLowerCase.Data();
954  #define ASSIGNARRAY(i) fCuts[i] = ((int)cutSelection[i]>=(int)'a') ? cutSelection[i]-'a'+10 : cutSelection[i]-'0'
955  for(Int_t ii=0;ii<kNCuts;ii++){
956  ASSIGNARRAY(ii);
957  }
958 
959  // Set Individual Cuts
960  for(Int_t ii=0;ii<kNCuts;ii++){
961  if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
962  }
963 
965 
966  return kTRUE;
967 }
968 
972 // "HeavyIon", //0
973 // "CentralityMin", //1
974 // "CentralityMax", //2
975 // "SelectSpecialTrigger", //3
976 // "SelectSpecialSubTriggerClass", //4
977 // "RemovePileUp", //5
978 // "RejectExtraSignals", //6
979 // "VertexCut", //7
980 
981  switch (cutID) {
982  case kisHeavyIon:
983  if( SetIsHeavyIon(value)) {
984  fCuts[kisHeavyIon] = value;
985  UpdateCutString();
986  return kTRUE;
987  } else return kFALSE;
988  case kCentralityMin:
989  if( SetCentralityMin(value)) {
990  fCuts[kCentralityMin] = value;
991  UpdateCutString();
992  return kTRUE;
993  } else return kFALSE;
994  case kCentralityMax:
995  if( SetCentralityMax(value)) {
996  fCuts[kCentralityMax] = value;
997  UpdateCutString();
998  return kTRUE;
999  } else return kFALSE;
1001  if( SetSelectSpecialTrigger(value)) {
1003  UpdateCutString();
1004  return kTRUE;
1005  } else return kFALSE;
1007  if( SetSelectSubTriggerClass(value)) {
1008  fCuts[kSelectSubTriggerClass] = value;
1009  UpdateCutString();
1010  return kTRUE;
1011  } else return kFALSE;
1012  case kremovePileUp:
1013  if( SetRemovePileUp(value)) {
1014  fCuts[kremovePileUp] = value;
1015  UpdateCutString();
1016  return kTRUE;
1017  } else return kFALSE;
1018  case kExtraSignals:
1019  if( SetRejectExtraSignalsCut(value)) {
1020  fCuts[kExtraSignals] = value;
1021  UpdateCutString();
1022  return kTRUE;
1023  } else return kFALSE;
1024  case kVertex:
1025  if( SetVertexCut(value)) {
1026  fCuts[kVertex] = value;
1027  UpdateCutString();
1028  return kTRUE;
1029  } else return kFALSE;
1030 
1031  case kNCuts:
1032  AliError("Cut id out of range");
1033  return kFALSE;
1034  }
1035 
1036  AliError("Cut id %d not recognized");
1037  return kFALSE;
1038 }
1039 
1042  // Print out current Cut Selection
1043  for(Int_t ic = 0; ic < kNCuts; ic++) {
1044  printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
1045  }
1046 }
1047 
1049  // Print out current Cut Selection with value
1050  printf("\nEvent cutnumber \n");
1051  for(Int_t ic = 0; ic < kNCuts; ic++) {
1052  printf("%d",fCuts[ic]);
1053  }
1054  printf("\n\n");
1055  printf("EnergyVar-enum: '%i', PeriodVar-enum: '%i' \n", fEnergyEnum, fPeriodEnum );
1056  if (fIsHeavyIon == 0) {
1057  printf("Running in pp mode \n");
1058  if (fSpecialTrigger == 0){
1059  if(fSpecialTriggerName.Contains("INT7")){
1060  printf("\t only events triggered by V0AND will be analysed \n");
1061  }else if(fSpecialTriggerName.Contains("INT8")){
1062  printf("\t only events triggered by T0AND will be analysed \n");
1063  }else if(!fSpecialTriggerName.IsNull()){
1064  printf("\t only events triggered by %s will be analysed \n", fSpecialTriggerName.Data());
1065  }else{
1066  if (fSpecialSubTrigger == 0){
1067  printf("\t only events triggered by V0OR will be analysed \n");
1068  } else if (fSpecialSubTrigger == 1){
1069  printf("\t only events where SDD was present will be analysed \n");
1070  }
1071  }
1072  } else if (fSpecialTrigger == 1){
1073  if (fSpecialSubTrigger == 0){
1074  printf("\t only events triggered by V0AND will be analysed \n");
1075  } else if(fSpecialSubTrigger == 1){
1076  printf("\t only events where SDD was present will be analysed and triggered by VOAND\n");
1077  }
1078  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps");
1079  } else if (fSpecialTrigger > 1){
1080  printf("\t only events triggered by %s %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data(), fSpecialSubTriggerNameAdditional.Data());
1081  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
1082  }
1083  if ( !(fCentralityMin == 0 && fCentralityMax == 0) && !(fCentralityMax < fCentralityMin) ){
1084  printf("\t Multiplicity cut %d - %d \n", fCentralityMin, fCentralityMax);
1085  }
1086  } else if (fIsHeavyIon == 1){
1087  printf("Running in PbPb mode \n");
1088  if (fDetectorCentrality == 0){
1089  printf("\t centrality selection based on V0M \n");
1090  } else if (fDetectorCentrality == 1){
1091  printf("\t centrality selection based on Cl1 \n");
1092  } else if (fDetectorCentrality == 2){
1093  printf("\t centrality selection based on ZNA \n");
1094  }
1095  if (fModCentralityClass == 0){
1096  printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10);
1097  } else if ( fModCentralityClass == 1){
1098  printf("\t %d - %d \n", fCentralityMin*5, fCentralityMax*5);
1099  } else if ( fModCentralityClass == 2){
1100  printf("\t %d - %d \n", fCentralityMin, fCentralityMax);
1101  } else if (fModCentralityClass == 3){
1102  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*10, fCentralityMax*10);
1103  } else if ( fModCentralityClass == 4){
1104  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*5, fCentralityMax*5);
1105  } else if (fModCentralityClass == 5){
1106  printf("\t %d - %d, with overlapping Track mult in MC as data \n", fCentralityMin*10, fCentralityMax*10);
1107  } else if ( fModCentralityClass == 6){
1108  printf("\t %d - %d, with overlapping Track mult in MC as data \n", fCentralityMin*5, fCentralityMax*5);
1109  }
1110  if (fSpecialTrigger == 0){
1111  printf("\t only events triggered by kMB, kCentral, kSemiCentral will be analysed \n");
1112  } else if (fSpecialTrigger > 1){
1113  printf("\t only events triggered by %s %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data(),fSpecialSubTriggerNameAdditional.Data());
1114  printf("\n\t SpecialTrigger is: %s\n", fSpecialTriggerName.Data());
1115  printf("\t SpecialSubTrigger is: %s\n", fSpecialSubTriggerName.Data());
1117  printf("\t SpecialSubTrigger2 is: %s\n", fSpecialSubTriggerNameAdditional.Data());
1118  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
1119  }
1120  } else if (fIsHeavyIon == 2){
1121  printf("Running in pPb mode \n");
1122  if (fDetectorCentrality == 0){
1123  printf("\t centrality selection based on V0A \n");
1124  } else if (fDetectorCentrality == 1){
1125  printf("\t centrality selection based on Cl1 \n");
1126  } else if (fDetectorCentrality == 2){
1127  printf("\t centrality selection based on ZNA \n");
1128  }
1129  if (fModCentralityClass == 0){
1130  printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10);
1131  } else if ( fModCentralityClass == 1){
1132  printf("\t %d - %d \n", fCentralityMin*5, fCentralityMax*5);
1133  } else if ( fModCentralityClass == 2){
1134  printf("\t %d - %d \n", fCentralityMin, fCentralityMax);
1135  }
1136  if (fSpecialTrigger == 0){
1137  printf("\t only events triggered by kINT7 will be analysed \n");
1138  } else if (fSpecialTrigger > 1){
1139  printf("\t only events triggered by %s %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data(),fSpecialSubTriggerNameAdditional.Data());
1140  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
1141  }
1142  }
1143  if (fEnableVertexCut) printf("\t Vertex cut with |Z_{vtx}| <%2.2f \n",fMaxVertexZ);
1144  else printf("\t No vertex cut \n");
1145 
1146  if (fRemovePileUp ==1 ) {
1147  printf("\t Doing pile up removal \n");
1148  if (fRemovePileUpSPD ==1 ){
1149  printf("\t Doing pile up removal using SPD \n");
1150  }
1151  if (fDoPileUpRejectV0MTPCout ==1 ){
1152  printf("\t Doing extra pile up removal V0M vs TPCout \n");
1153  }
1155  printf("\t Doing extra past-future pile up removal\n");
1156  }
1157  }
1158 
1159  printf("MC event cuts: \n");
1160  if (fRejectExtraSignals == 0) printf("\t no rejection was applied \n");
1161  else if (fRejectExtraSignals == 1) printf("\t only MB header will be inspected \n");
1162  else if (fRejectExtraSignals == 4) printf("\t special handling for Jets embedded in MB events \n");
1163  else if (fRejectExtraSignals > 1) printf("\t special header have been selected \n");
1164  printf("\t minimum factor between jet and pt hard = %2.2f \n", fMinFacPtHard);
1165  printf("\t maximum factor between jet and pt hard = %2.2f \n", fMaxFacPtHard);
1166  printf("\t maximum factor between pi0 or eta pt and pt hard = %2.2f \n", fMaxFacPtHardSingleParticle);
1167 }
1168 
1171 { // Set Cut
1172  switch(isHeavyIon){
1173  case 0: // pp
1174  fIsHeavyIon=0;
1175  break;
1176  case 1: // V0M PbPb & XeXe
1177  // steps of 10%
1178  fIsHeavyIon=1;
1180  break;
1181  case 2: // CL1 PbPb & XeXe
1182  // steps of 10%
1183  fIsHeavyIon=1;
1185  break;
1186  case 3: // V0M PbPb & XeXe
1187  // steps of 5%
1188  // 0 -0%, 1-5%, 2-10%, 3-15%, 4-20%, 5-25%, 6-30%, 7-35%, 8-40%, 9-45%, a-50%, b-55%, c-60%, d-65%, e-70%, f-75%, g-80%, h-85%, i-90%, j-95%, k-100%
1189  fIsHeavyIon=1;
1192  break;
1193  case 4: // V0M PbPb & XeXe & primary track mult for MC different track array
1194  // steps of 10%
1195  fIsHeavyIon=1;
1198  break;
1199  case 5: // V0M PbPb & XeXe & primary track mult for MC
1200  // steps of 10%
1201  fIsHeavyIon=1;
1204  break;
1205  case 6: // V0M PbPb & XeXe & primary track mult for MC
1206  // steps of 5%
1207  // 0 -0%, 1-5%, 2-10%, 3-15%, 4-20%, 5-25%, 6-30%, 7-35%, 8-40%, 9-45%, a-50%, b-55%, c-60%, d-65%, e-70%, f-75%, g-80%, h-85%, i-90%, j-95%, k-100%
1208  fIsHeavyIon=1;
1211  break;
1212  case 7: // V0M PbPb & XeXe & primary track mult for MC different track array
1213  // steps of 5%
1214  // 0 -0%, 1-5%, 2-10%, 3-15%, 4-20%, 5-25%, 6-30%, 7-35%, 8-40%, 9-45%, a-50%, b-55%, c-60%, d-65%, e-70%, f-75%, g-80%, h-85%, i-90%, j-95%, k-100%
1215  fIsHeavyIon=1;
1218  break;
1219  case 8: // pPb V0A
1220  // steps of 10%
1221  fIsHeavyIon=2;
1223  break;
1224  case 9: // pPb CL1
1225  // steps of 10%
1226  fIsHeavyIon=2;
1228  break;
1229  case 10: // a: pPb V0A
1230  // steps of 5%
1231  // 0 -0%, 1-5%, 2-10%, 3-15%, 4-20%, 5-25%, 6-30%, 7-35%, 8-40%, 9-45%, a-50%, b-55%, c-60%, d-65%, e-70%, f-75%, g-80%, h-85%, i-90%, j-95%, k-100%
1232  fIsHeavyIon=2;
1235  break;
1236  case 11: // b: pPb CL1
1237  // steps of 5%
1238  // 0 -0%, 1-5%, 2-10%, 3-15%, 4-20%, 5-25%, 6-30%, 7-35%, 8-40%, 9-45%, a-50%, b-55%, c-60%, d-65%, e-70%, f-75%, g-80%, h-85%, i-90%, j-95%, k-100%
1239  fIsHeavyIon=2;
1242  break;
1243  case 12: // c: pPb V0A
1244  // steps of 1%
1245  // 0 -0%, 1-1%, 2-2%, 3-3%, 4-4%, 5-5%, 6-6%, 7-7%, 8-8%, 9-9%, a-10%, b-11%, c-12%, d-13%, e-14%, f-15%, g-16%, h-17%, i-18%, j-19%, k-20%
1246  fIsHeavyIon=2;
1249  break;
1250  case 13: // d: pPb CL1
1251  // steps of 1%
1252  // 0 -0%, 1-1%, 2-2%, 3-3%, 4-4%, 5-5%, 6-6%, 7-7%, 8-8%, 9-9%, a-10%, b-11%, c-12%, d-13%, e-14%, f-15%, g-16%, h-17%, i-18%, j-19%, k-20%
1253  fIsHeavyIon=2;
1256  break;
1257  case 14: // e: pPb ZNA
1258  // steps of 10%
1259  fIsHeavyIon=2;
1261  break;
1262  case 15: // f: pPb ZNA
1263  // steps of 5%
1264  // 0 -0%, 1-5%, 2-10%, 3-15%, 4-20%, 5-25%, 6-30%, 7-35%, 8-40%, 9-45%, a-50%, b-55%, c-60%, d-65%, e-70%, f-75%, g-80%, h-85%, i-90%, j-95%, k-100%
1265  fIsHeavyIon=2;
1268  break;
1269  case 16: // g: pPb CL1
1270  // steps of 1%
1271  // 0 -0%, 1-1%, 2-2%, 3-3%, 4-4%, 5-5%, 6-6%, 7-7%, 8-8%, 9-9%, a-10%, b-11%, c-12%, d-13%, e-14%, f-15%, g-16%, h-17%, i-18%, j-19%, k-20%
1272  fIsHeavyIon=2;
1275  break;
1276  case 17: // h: pp -> Sphericity < 0.5
1277  fIsHeavyIon=0;
1278  fUseSphericity=1;
1279  break;
1280  case 18: // i: pp -> Sphericity > 0.5
1281  fIsHeavyIon=0;
1282  fUseSphericity=2;
1283  break;
1284  case 19: // j: pp -> 0 < Sphericity > 1.0
1285  fIsHeavyIon=0;
1286  fUseSphericity=3;
1287  break;
1288  case 20: // k: pp -> 0 < Sphericity < 1.0 + mult cut < 20
1289  fIsHeavyIon=0;
1290  fUseSphericity=4;
1291  break;
1292  case 21: // l: pp ->0 < Sphericity < 1.0 + mult cut > 20
1293  fIsHeavyIon=0;
1294  fUseSphericity=5;
1295  break;
1296  case 22: // m: pp -> Sphericity < 0.5 + mult cut < 20
1297  fIsHeavyIon=0;
1298  fUseSphericity=6;
1299  break;
1300  case 23: // n: pp -> Sphericity < 0.5 + mult cut > 20
1301  fIsHeavyIon=0;
1302  fUseSphericity=7;
1303  break;
1304  case 24: // o: pp -> Sphericity > 0.5 + mult cut < 20
1305  fIsHeavyIon=0;
1306  fUseSphericity=8;
1307  break;
1308  case 25: // p: pp -> Sphericity > 0.5 + mult cut > 20
1309  fIsHeavyIon=0;
1310  fUseSphericity=9;
1311  break;
1312  case 26: // q: pp -> Sphericity < 0.3
1313  fIsHeavyIon=0;
1314  fUseSphericity=10;
1315  break;
1316  case 27: // r: pp -> Sphericity > 0.7
1317  fIsHeavyIon=0;
1318  fUseSphericity=11;
1319  break;
1320  case 28: // s: pp -> Sphericity < 0.5 + Sphericity axis in EMCal coverage
1321  fIsHeavyIon=0;
1322  fUseSphericity=12;
1323  break;
1324  case 29: // t: pp -> Sphericity < 0.5 + Sphericity axis not in EMCal coverage
1325  fIsHeavyIon=0;
1326  fUseSphericity=13;
1327  break;
1328 
1329  default:
1330  AliError(Form("SetHeavyIon not defined %d",isHeavyIon));
1331  return kFALSE;
1332  }
1333  return kTRUE;
1334 }
1335 
1336 //___________________________________________________________________
1338 {
1339  // Set Cut
1340  if(minCentrality<0||minCentrality>20){
1341  AliError(Form("minCentrality not defined %d",minCentrality));
1342  return kFALSE;
1343  }
1344 
1345  fCentralityMin=minCentrality;
1346  return kTRUE;
1347 }
1348 
1349 //___________________________________________________________________
1351 {
1352  // Set Cut
1353  if(maxCentrality<0||maxCentrality>20){
1354  AliError(Form("maxCentrality not defined %d",maxCentrality));
1355  return kFALSE;
1356  }
1357  fCentralityMax=maxCentrality;
1358  return kTRUE;
1359 }
1360 
1363 {
1364  // Set Cut
1365  switch(selectSpecialTrigger){
1366  case 0:
1367  fSpecialTrigger=0; // V0OR
1368  break;
1369  case 1:
1370  fSpecialTrigger=1; // V0AND
1371  break;
1372 // case 2:
1373 // fSpecialTrigger=2; //
1374 // break;
1375  case 3:
1376  fSpecialTrigger=3; //specific centrality trigger selection
1377  fSpecialTriggerName="AliVEvent::kCentral/kSemiCentral/kMB";
1378  break;
1379  case 4:
1380  fSpecialTrigger=4; // trigger alias kTRD
1381  fOfflineTriggerMask=AliVEvent::kTRD;
1382  fTriggerSelectedManually = kTRUE;
1383  fSpecialTriggerName="AliVEvent::kTRD";
1384  break;
1385  case 5:
1386  fSpecialTrigger=5; // trigger alias kEMC
1387  fOfflineTriggerMask=AliVEvent::kEMC7 | AliVEvent::kEMC8 | AliVEvent::kEMC1 ;
1388  fTriggerSelectedManually = kTRUE;
1390  SETBIT(fTriggersEMCALSelected, kL0);
1391  fSpecialTriggerName="AliVEvent::kEMC7/kEMC8/kEMC1";
1392  break;
1393  case 6:
1394  fSpecialTrigger=6; // trigger alias kPHI
1395  fOfflineTriggerMask=AliVEvent::kPHI7 | AliVEvent::kPHI1 | AliVEvent::kPHI8 | AliVEvent::kPHOSPb;
1396  fTriggerSelectedManually = kTRUE;
1397  fSpecialTriggerName="AliVEvent::kPHI7/kPHI1/kPHI8/kPHOSPb";
1398  break;
1399  case 7:
1400  fSpecialTrigger=7; // trigger alias kHighMult
1401  fOfflineTriggerMask=AliVEvent::kHighMult;
1402  fTriggerSelectedManually = kTRUE;
1403  fSpecialTriggerName="AliVEvent::kHighMult";
1404  break;
1405  case 8:
1406  fSpecialTrigger=8; // trigger alias kEMCEGA
1407  fOfflineTriggerMask=AliVEvent::kEMCEGA;
1408  fTriggerSelectedManually = kTRUE;
1410  SETBIT(fTriggersEMCALSelected, kG2);
1411  fSpecialTriggerName="AliVEvent::kEMCEGA";
1412  break;
1413  case 9:
1414  fSpecialTrigger=9; // trigger alias kEMCEJE
1415  fOfflineTriggerMask=AliVEvent::kEMCEJE;
1416  fTriggerSelectedManually = kTRUE;
1418  SETBIT(fTriggersEMCALSelected, kJ2);
1419  fSpecialTriggerName="AliVEvent::kEMCEJE";
1420  break;
1421  case 10: //CALO and CALOFAST
1422  fSpecialTrigger=10; // trigger alias kEMC
1423  fOfflineTriggerMask=AliVEvent::kCaloOnly;
1424  fTriggerSelectedManually = kTRUE;
1426  fSpecialTriggerName="AliVEvent::kCaloOnly";
1427  break;
1428  case 11: // Double gap (DG) events
1429  fSpecialTrigger=11; // DG events
1430  fOfflineTriggerMask=0; // kAny cannot be used for DG events
1431  fTriggerSelectedManually = kTRUE;
1433  break;
1434  default:
1435  AliError("Warning: Special Trigger Not known");
1436  return 0;
1437  }
1438  return 1;
1439 }
1440 
1443 {
1444  // Set Cut
1445  if (fSpecialTrigger == 0){ //OR
1446  switch(selectSpecialSubTriggerClass){
1447  case 0://with VZERO
1448  fSpecialTrigger=0;
1450  // AliInfo("Info: Nothing to be done");
1451  break;
1452  case 3: //V0OR with SDD requested (will only work with LHC11a dataset)
1454  // cout << "V0OR with SDD requested" << endl;
1455  break;
1456  default:
1457  AliError("Warning: Special Subtrigger Class Not known");
1458  return 0;
1459  }
1460  } else if (fSpecialTrigger == 1){ //AND with different detectors
1461  switch(selectSpecialSubTriggerClass){
1462  case 0: //with VZERO general implementation of V0AND (periods LHC11c onwards)
1463  fSpecialTrigger=0;
1465  fOfflineTriggerMask=AliVEvent::kINT7;
1466  fTriggerSelectedManually = kTRUE;
1467  fSpecialTriggerName="AliVEvent::kINT7";
1468  break;
1469  case 1: //with TZERO
1470  fSpecialTrigger=0;
1472  fOfflineTriggerMask=AliVEvent::kINT8;
1473  fTriggerSelectedManually = kTRUE;
1474  fSpecialTriggerName="AliVEvent::kINT8";
1475  break;
1476  case 2: //with VZERO (will only work with LHC11a dataset)
1477  fSpecialTrigger=1;
1479  // AliInfo("Info: Nothing to be done");
1480  break;
1481  case 3: //V0AND with SDD requested (will only work with LHC11a dataset)
1482  fSpecialTrigger=1;
1484  break;
1485  default:
1486  AliError("Warning: Special Subtrigger Class Not known");
1487  return 0;
1488  }
1489  } else if (fSpecialTrigger == 3){ // Selecting kCentral and kSemiCentral from trigger classes, not aliases
1490  switch(selectSpecialSubTriggerClass){
1491  case 0: // all together
1494  // AliInfo("Info: Nothing to be done");
1495  break;
1496  case 1: // kCentral - no vertex restriction
1499  fSpecialSubTriggerName="CVHN";
1500  // cout << "kCentralOpen" << endl;
1501  break;
1502  case 2: // kCentral - T00 +- 10 cm
1505  fSpecialSubTriggerName="CCENT";
1506  // cout << "kCentralVertex" << endl;
1507  break;
1508  case 3: // kCentral - both
1511  fSpecialSubTriggerName="CVHN|CCENT|CSEMI|CVLN";
1512  // cout << "kCentral both" << endl;
1513  break;
1514  case 4: // kSemiCentral - no vertex restriction
1517  fSpecialSubTriggerName="CVLN";
1518  // cout << "kSemiCentralOpen" << endl;
1519  break;
1520  case 5: // kSemiCentral - T00 +- 10 cm
1523  fSpecialSubTriggerName="CSEMI";
1524  // cout << "kSemiCentralVertex" << endl;
1525  break;
1526  case 6: // kSemiCentral - both
1529  fSpecialSubTriggerName="CSEMI%CVLN";
1530  // cout << "kSemiCentral both" << endl;
1531  break;
1532  case 7: // kMB
1535  fSpecialSubTriggerName="CPBI1_|CPBI1-";
1536  // cout << "kMB 1" << endl;
1537  break;
1538  case 8: // kMB
1541  fSpecialSubTriggerName="CPBI2_|CPBI2-";
1542  // cout << "kMB 2" << endl;
1543  break;
1544  case 9: // kMB
1547  fSpecialSubTriggerName="CPBI2_@CPBI2-@CPBI2_@CPBI2-";
1548  // cout << "kMB both" << endl;
1549  break;
1550  case 10: // 0V0M
1551  fOfflineTriggerMask=AliVEvent::kINT7;
1552  fTriggerSelectedManually = kTRUE;
1555  fSpecialSubTriggerName="C0V0M";
1556  break;
1557  case 11: // 0V0L
1558  fOfflineTriggerMask=AliVEvent::kINT7;
1559  fTriggerSelectedManually = kTRUE;
1562  fSpecialSubTriggerName="C0V0L";
1563  break;
1564  case 12: // 0VHM
1565  fOfflineTriggerMask=AliVEvent::kINT7;
1566  fTriggerSelectedManually = kTRUE;
1569  fSpecialSubTriggerName="C0VHM";
1570  break;
1571  case 13: // VOL7
1572  fOfflineTriggerMask=AliVEvent::kINT7;
1573  fTriggerSelectedManually = kTRUE;
1576  fSpecialSubTriggerName="CV0L7";
1577  break;
1578  case 14: // 0STC
1579  fOfflineTriggerMask=AliVEvent::kINT7;
1580  fTriggerSelectedManually = kTRUE;
1583  fSpecialSubTriggerName="C0STC";
1584  break;
1585  default:
1586  AliError("Warning: Special Subtrigger Class Not known");
1587  return 0;
1588  }
1589  } else if (fSpecialTrigger == 4){ // Subdivision of TRD trigger classes
1590  switch(selectSpecialSubTriggerClass){
1591  case 0: // all together
1594  // AliInfo("Info: Nothing to be done");
1595  break;
1596  case 1: // 7WUHSH - V0AND with single electron in TRD & EMCAL
1599  fSpecialSubTriggerName="7WUHEE";
1600  break;
1601  case 2: // 8WUHSH - T0AND with single electron in TRD & EMCAL
1604  fSpecialSubTriggerName="8WUHEE";
1605  break;
1606  case 3: // 7WUHSE - V0AND with single high pt electron in TRD
1609  fSpecialSubTriggerName="7WUHSE";
1610  break;
1611  case 4: // 8WUHSE - T0AND with single high pt electron in TRD
1614  fSpecialSubTriggerName="8WUHSE";
1615  break;
1616  case 5: // 7WUHJE - V0AND with jet in TRD
1619  fSpecialSubTriggerName="7WUHJT";
1620  break;
1621  case 6: // 8WUHJE - T0AND with jet in TRD
1624  fSpecialSubTriggerName="8WUHJT";
1625  break;
1626  case 7: // 7WUHQU - V0AND with dielectron pair in TRD
1629  fSpecialSubTriggerName="7WUHQU";
1630  break;
1631  case 8: // 8WUHQU - T0AND with dielectron pair in TRD
1634  fSpecialSubTriggerName="8WUHQU";
1635  break;
1636  default:
1637  AliError("Warning: Special Subtrigger Class Not known");
1638  return 0;
1639  }
1640  } else if (fSpecialTrigger == 5){ // Subdivision of kEMC trigger classes
1641  switch(selectSpecialSubTriggerClass){
1642  case 0: // all together
1645  // AliInfo("Info: Nothing to be done");
1646  break;
1647  case 1: // CEMC1 - V0OR and EMCAL fired
1648  fOfflineTriggerMask=AliVEvent::kEMC1;
1649  fSpecialTriggerName="AliVEvent::kEMC1";
1652  fSpecialSubTriggerName="CEMC1";
1653  break;
1654  case 2: // CEMC7 - V0AND and EMCAL fired
1656  fOfflineTriggerMask=AliVEvent::kEMC7;
1657  fSpecialTriggerName="AliVEvent::kEMC7";
1659  fSpecialSubTriggerName="CEMC7";
1660  break;
1661  case 3: // CEMC8 - T0OR and EMCAL fired
1662  fOfflineTriggerMask=AliVEvent::kEMC8;
1663  fSpecialTriggerName="AliVEvent::kEMC8";
1666  fSpecialSubTriggerName="CEMC8";
1667  break;
1668  case 4: // CDMC1 - V0OR and DCAL fired
1669  fOfflineTriggerMask=AliVEvent::kEMC1;
1670  fSpecialTriggerName="AliVEvent::kEMC1";
1673  fSpecialSubTriggerName="CDMC1";
1674  break;
1675  case 5: // CDMC7 - V0AND and DCAL fired
1677  fOfflineTriggerMask=AliVEvent::kEMC7;
1678  fSpecialTriggerName="AliVEvent::kEMC7";
1680  fSpecialSubTriggerName="CDMC7";
1681  break;
1682  case 6: // CDMC8 - T0OR and DCAL fired
1683  fOfflineTriggerMask=AliVEvent::kEMC8;
1684  fSpecialTriggerName="AliVEvent::kEMC8";
1687  fSpecialSubTriggerName="CDMC8";
1688  break;
1689  case 7: // MC7 - V0AND and EMCAL OR DCAL fired
1691  fOfflineTriggerMask=AliVEvent::kEMC7;
1692  fSpecialTriggerName="AliVEvent::kEMC7";
1694  fSpecialSubTriggerName="CEMC7";
1696  break;
1697  case 8: // MC8 - T0OR and EMCAL OR DCAL fired
1698  fOfflineTriggerMask=AliVEvent::kEMC8;
1699  fSpecialTriggerName="AliVEvent::kEMC8";
1702  fSpecialSubTriggerName="CEMC8";
1704  break;
1705  default:
1706  AliError("Warning: Special Subtrigger Class Not known");
1707  return 0;
1708  }
1709  }else if (fSpecialTrigger == 6){ // Subdivision of kPHI trigger classes
1710  switch(selectSpecialSubTriggerClass){
1711  case 0: // all together
1714  // AliInfo("Info: Nothing to be done");
1715  break;
1716  case 1: // CEMC1 - V0OR and EMCAL fired
1717  fOfflineTriggerMask=AliVEvent::kPHI1;
1718  fSpecialTriggerName="AliVEvent::kPHI1";
1721  fSpecialSubTriggerName="CPHI1";
1722  break;
1723  case 2: // CEMC7 - V0AND and EMCAL fired
1725  fOfflineTriggerMask=AliVEvent::kPHI7;
1726  fSpecialTriggerName="AliVEvent::kPHI7";
1728  fSpecialSubTriggerName="CPHI7";
1729  break;
1730  case 3: // CEMC8 - T0OR and EMCAL fired
1731  fOfflineTriggerMask=AliVEvent::kPHI8;
1732  fSpecialTriggerName="AliVEvent::kPHI8";
1735  fSpecialSubTriggerName="CPHI8";
1736  break;
1737  default:
1738  AliError("Warning: Special Subtrigger Class Not known");
1739  return 0;
1740  }
1741  }else if (fSpecialTrigger == 7){ // Subdivision of kHighMult trigger classes
1742  switch(selectSpecialSubTriggerClass){
1743  case 0: // all together
1746  // AliInfo("Info: Nothing to be done");
1747  break;
1748  case 1: // CSHM1 - V0OR and high mult fired
1751  fSpecialSubTriggerName="CSHM1";
1752  break;
1753  case 2: // CSHM7 - V0AND and high mult fired
1756  fSpecialSubTriggerName="CSHM7";
1757  break;
1758  case 3: // CSHM8 - T0OR and high mult fired
1761  fSpecialSubTriggerName="CSHM8";
1762  break;
1763  case 4: // V0 high mult trigger
1765  fOfflineTriggerMask=AliVEvent::kAny;
1766  fSpecialTriggerName="V0Mult";
1768  fSpecialSubTriggerName="CVHMV0M-B-";
1769  break;
1770  case 5: // SPD high mult trigger
1772  fOfflineTriggerMask=AliVEvent::kAny;
1773  fSpecialTriggerName="SPMult";
1775  fSpecialSubTriggerName="CVHMSH2-B-";
1776  break;
1777  case 6: // V0 high mult trigger with pileup condition on
1779  fOfflineTriggerMask=AliVEvent::kAny;
1780  fSpecialTriggerName="V0Mult";
1782  fSpecialSubTriggerName="CVHMV0M-B-SPD2";
1783  break;
1784 
1785  default:
1786  AliError("Warning: Special Subtrigger Class Not known");
1787  return 0;
1788  }
1789  }else if (fSpecialTrigger == 8){ // Subdivision of kEMCEGA trigger classes
1790  switch(selectSpecialSubTriggerClass){
1791  case 0: // all together
1794  // AliInfo("Info: Nothing to be done");
1795  break;
1796  case 1: // 7EGA - CINT7 EGA
1799  fSpecialSubTriggerName="7EGA";
1801  SETBIT(fTriggersEMCALSelected, kG2);
1802  break;
1803  case 2: // 8EGA - CINT8 EGA
1806  fSpecialSubTriggerName="8EGA";
1808  SETBIT(fTriggersEMCALSelected, kG2);
1809  break;
1810  case 3: // 7EG1 - CINT7 EG1
1813  fSpecialSubTriggerName="7EG1";
1815  SETBIT(fTriggersEMCALSelected, kG1);
1816  break;
1817  case 4: // 8EG1 - CINT8 EG1
1820  fSpecialSubTriggerName="8EG1";
1822  SETBIT(fTriggersEMCALSelected, kG1);
1823  break;
1824  case 5: // 7EG2 - CINT7 EG2
1827  fSpecialSubTriggerName="7EG2";
1829  SETBIT(fTriggersEMCALSelected, kG2);
1830  break;
1831  case 6: // 8EG2 - CINT8 EG2
1834  fSpecialSubTriggerName="8EG2";
1836  SETBIT(fTriggersEMCALSelected, kG2);
1837  break;
1838  case 7: // 7DGA - CINT7 DGA
1841  fSpecialSubTriggerName="7DGA";
1843  SETBIT(fTriggersEMCALSelected, kG2);
1844  break;
1845  case 8: // 8DGA - CINT8 DGA
1848  fSpecialSubTriggerName="8DGA";
1850  SETBIT(fTriggersEMCALSelected, kG2);
1851  break;
1852  case 9: // 7DG1 - CINT7 DG1
1855  fSpecialSubTriggerName="7DG1";
1857  SETBIT(fTriggersEMCALSelected, kG1);
1858  break;
1859  case 10: // 8DG1 - CINT8 DG1
1862  fSpecialSubTriggerName="8DG1";
1864  SETBIT(fTriggersEMCALSelected, kG1);
1865  break;
1866  case 11: // 7DG2 - CINT7 DG2
1869  fSpecialSubTriggerName="7DG2";
1871  SETBIT(fTriggersEMCALSelected, kG2);
1872  break;
1873  case 12: // 8DG2 - CINT8 DG2
1876  fSpecialSubTriggerName="8DG2";
1878  SETBIT(fTriggersEMCALSelected, kG2);
1879  break;
1880  case 13: // Gamma Low EMC and DMC
1883  fSpecialSubTriggerName="7EG1";
1886  SETBIT(fTriggersEMCALSelected, kG1);
1887  break;
1888  case 14: // Gamma Low EMC and DMC
1891  fSpecialSubTriggerName="7EG2";
1894  SETBIT(fTriggersEMCALSelected, kG1);
1895  break;
1896 
1897  default:
1898  AliError("Warning: Special Subtrigger Class Not known");
1899  return 0;
1900  }
1901  } else if (fSpecialTrigger == 9){ // Subdivision of kEMCEJE trigger classes
1902  switch(selectSpecialSubTriggerClass){
1903  case 0: // all together
1906  // AliInfo("Info: Nothing to be done");
1907  break;
1908  case 1: // 7EJE - CINT7 EJE
1911  fSpecialSubTriggerName="7EJE";
1913  SETBIT(fTriggersEMCALSelected, kJ2);
1914  break;
1915  case 2: // 8EJE - CINT8 EJE
1918  fSpecialSubTriggerName="8EJE";
1920  SETBIT(fTriggersEMCALSelected, kJ2);
1921  break;
1922  case 3: // 7EJ1 - CINT7 EJ1
1925  fSpecialSubTriggerName="7EJ1";
1927  SETBIT(fTriggersEMCALSelected, kJ1);
1928  break;
1929  case 4: // 8EJ1 - CINT8 EJ1
1932  fSpecialSubTriggerName="8EJ1";
1934  SETBIT(fTriggersEMCALSelected, kJ1);
1935  break;
1936  case 5: // 7EJ2 - CINT7 EJ2
1939  fSpecialSubTriggerName="7EJ2";
1941  SETBIT(fTriggersEMCALSelected, kJ2);
1942  break;
1943  case 6: // 8EJ2 - CINT8 EJ2
1946  fSpecialSubTriggerName="8EJ2";
1948  SETBIT(fTriggersEMCALSelected, kJ2);
1949  break;
1950  case 7: // 7DJ1 - CINT7 DJ1
1953  fSpecialSubTriggerName="7DJ1";
1955  SETBIT(fTriggersEMCALSelected, kJ1);
1956  break;
1957  case 8: // 8DJ1 - CINT8 DJ1
1960  fSpecialSubTriggerName="8DJ1";
1962  SETBIT(fTriggersEMCALSelected, kJ1);
1963  break;
1964  case 9: // 7DJ2 - CINT7 DJ2
1967  fSpecialSubTriggerName="7DJ2";
1969  SETBIT(fTriggersEMCALSelected, kJ2);
1970  break;
1971  case 10: // 8DJ2 - CINT8 DJ2
1974  fSpecialSubTriggerName="8DJ2";
1976  SETBIT(fTriggersEMCALSelected, kJ2);
1977  break;
1978  case 11: // high Jet trigger EMC+DMC
1981  fSpecialSubTriggerName="7EJ1";
1984  SETBIT(fTriggersEMCALSelected, kJ1);
1985  break;
1986  case 12: // low Jet trigger EMC+DMC
1989  fSpecialSubTriggerName="7EJ2";
1992  SETBIT(fTriggersEMCALSelected, kJ2);
1993  break;
1994  default:
1995  AliError("Warning: Special Subtrigger Class Not known");
1996  return 0;
1997  }
1998  } else if (fSpecialTrigger == 10){ // Subdivision of kEMC trigger classes
1999  switch(selectSpecialSubTriggerClass){
2000  case 0: // all together
2003  fSpecialSubTriggerName="CINT7";
2004  fSpecialTriggerName="AliVEvent::kCaloOnly/INT7";
2005  break;
2006  case 1: // CEMC7 - V0AND and EMCAL fired
2009  fSpecialSubTriggerName="CEMC7-";
2010  fSpecialTriggerName="AliVEvent::kCaloOnly/EMC7";
2011  break;
2012  case 2: // CEMC7EG2 - V0AND and EMCAL fired
2015  fSpecialSubTriggerName="7EG2";
2016  fSpecialTriggerName="AliVEvent::kCaloOnly/7EG2";
2017  break;
2018  case 3: // CEMC7EG1 - V0AND and EMCAL fired
2021  fSpecialSubTriggerName="7EG1";
2022  fSpecialTriggerName="AliVEvent::kCaloOnly/7EG1";
2023  break;
2024  case 4: // CEMC7EJ2 - V0AND and EMCAL fired
2027  fSpecialSubTriggerName="7EJ2";
2028  fSpecialTriggerName="AliVEvent::kCaloOnly/7EJ2";
2029  break;
2030  case 5: // CEMC7EJ1 - V0AND and EMCAL fired
2033  fSpecialSubTriggerName="7EJ1";
2034  fSpecialTriggerName="AliVEvent::kCaloOnly/7EJ1";
2035  break;
2036  case 6: // CDMC7 - V0AND and DCAL fired
2039  fSpecialSubTriggerName="CDMC7-";
2040  fSpecialTriggerName="AliVEvent::kCaloOnly/DMC7";
2041  break;
2042  case 7: // CDMC7DG2 - V0AND and DCAL fired
2045  fSpecialSubTriggerName="7DG2";
2046  fSpecialTriggerName="AliVEvent::kCaloOnly/7DG2";
2047  break;
2048  case 8: // CDMC7DG1 - V0AND and DCAL fired
2051  fSpecialSubTriggerName="7DG1";
2052  fSpecialTriggerName="AliVEvent::kCaloOnly/7DG1";
2053  break;
2054  case 9: // CDMC7DJ2 - V0AND and DCAL fired
2057  fSpecialSubTriggerName="7DJ2";
2058  fSpecialTriggerName="AliVEvent::kCaloOnly/7DJ2";
2059  break;
2060  case 10: // DEMC7DJ1 - V0AND and DCAL fired - a
2063  fSpecialSubTriggerName="7DJ1";
2064  fSpecialTriggerName="AliVEvent::kCaloOnly/7DJ1";
2065  break;
2066  case 11: // CEMC8 - V0AND and EMCAL fired - b
2069  fSpecialSubTriggerName="CEMC8-";
2070  fSpecialTriggerName="AliVEvent::kCaloOnly/EMC8";
2071  break;
2072  case 12: // CEMC8EG2 - V0AND and EMCAL fired - c
2075  fSpecialSubTriggerName="8EG2";
2076  fSpecialTriggerName="AliVEvent::kCaloOnly/8EG2";
2077  break;
2078  case 13: // CEMC8EG1 - V0AND and EMCAL fired - d
2081  fSpecialSubTriggerName="8EG1";
2082  fSpecialTriggerName="AliVEvent::kCaloOnly/8EG1";
2083  break;
2084  case 14: // CEMC8EJ2 - V0AND and EMCAL fired - e
2087  fSpecialSubTriggerName="8EJ2";
2088  fSpecialTriggerName="AliVEvent::kCaloOnly/8EJ2";
2089  break;
2090  case 15: // CEMC8EJ1 - V0AND and EMCAL fired - f
2093  fSpecialSubTriggerName="8EJ1";
2094  fSpecialTriggerName="AliVEvent::kCaloOnly/8EJ1";
2095  break;
2096  case 16: // CDMC8 - V0AND and DCAL fired - g
2099  fSpecialSubTriggerName="CDMC8-";
2100  fSpecialTriggerName="AliVEvent::kCaloOnly/DMC8";
2101  break;
2102  case 17: // CDMC8DG2 - V0AND and DCAL fired - h
2105  fSpecialSubTriggerName="8DG2";
2106  fSpecialTriggerName="AliVEvent::kCaloOnly/8DG2";
2107  break;
2108  case 18: // CDMC8DG1 - V0AND and DCAL fired - i
2111  fSpecialSubTriggerName="8DG1";
2112  fSpecialTriggerName="AliVEvent::kCaloOnly/8DG1";
2113  break;
2114  case 19: // CDMC8DJ2 - V0AND and DCAL fired - j
2117  fSpecialSubTriggerName="8DJ2";
2118  fSpecialTriggerName="AliVEvent::kCaloOnly/8DJ2";
2119  break;
2120  case 20: // DEMC8DJ1 - V0AND and DCAL fired - k
2123  fSpecialSubTriggerName="8DJ1";
2124  fSpecialTriggerName="AliVEvent::kCaloOnly/8DJ1";
2125  break;
2126  case 21: // Gamma Low EMC and DMC
2129  fSpecialTriggerName="AliVEvent::kCaloOnly/7EG1";
2130  fSpecialSubTriggerName="7EG1";
2132  break;
2133  case 22: // Gamma Low EMC and DMC
2136  fSpecialTriggerName="AliVEvent::kCaloOnly/7EG2";
2137  fSpecialSubTriggerName="7EG2";
2139  break;
2140  case 23: // high Jet trigger EMC+DMC
2143  fSpecialTriggerName="AliVEvent::kCaloOnly/7EJ1";
2144  fSpecialSubTriggerName="7EJ1";
2146  break;
2147  case 24: // low Jet trigger EMC+DMC
2150  fSpecialTriggerName="AliVEvent::kCaloOnly/7EJ2";
2151  fSpecialSubTriggerName="7EJ2";
2153  break;
2154  default:
2155  AliError("Warning: Special Subtrigger Class Not known");
2156  return 0;
2157  }
2158  } else if (fSpecialTrigger == 11){ // selection of double gap events
2159  switch(selectSpecialSubTriggerClass){
2160  case 0: //CCUP25-B-SPD1-CENTNOTRD
2163  fSpecialSubTriggerName="CCUP25-B-SPD1-CENTNOTRD";
2164  break;
2165  default:
2166  AliError("Warning: Special Subtrigger Class Not known");
2167  return 0;
2168  }
2169  }
2170  return 1;
2171 }
2172 
2173 //________________________________________________________________________
2175 {
2176  // Set Cut
2177  fMultiplicityMethod=multiplicityMethod;
2178 
2179  // 0 Photon Multiplicity
2180  // 1 TPC Track multiplicity
2181  // 2 V0 Mult
2182  // 3 SPD Mult
2183 
2184  return kTRUE;
2185 }
2186 
2187 //________________________________________________________________________
2189 {// Set Cut
2190  switch(removePileUp){
2191  case 0:
2192  fRemovePileUp = kFALSE;
2193  break;
2194  case 1:
2195  fRemovePileUp = kTRUE;
2196  fRemovePileUpSPD = kTRUE;
2197  break;
2198  case 2:
2199  fRemovePileUp = kTRUE;
2200  fRemovePileUpSPD = kTRUE;
2203  break;
2204  case 3:
2205  fRemovePileUp = kTRUE;
2206  fRemovePileUpSPD = kTRUE;
2209  break;
2210  case 4:
2211  fRemovePileUp = kTRUE;
2212  fRemovePileUpSPD = kTRUE;
2215  break;
2216  case 5:
2217  fRemovePileUp = kTRUE;
2218  fRemovePileUpSPD = kTRUE;
2221  break;
2222  case 6:
2223  fRemovePileUp = kTRUE;
2224  fRemovePileUpSPD = kTRUE;
2225  fDoPileUpRejectV0MTPCout = kTRUE;
2226  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2227  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
2228  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
2229  if (fIsHeavyIon==1){
2230  if(fPeriodEnum == kLHC15o){
2231  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2232  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2233  break;
2234  }else{
2235  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
2236  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
2237  break;
2238  }
2239  } else if(fIsHeavyIon == 2){
2240  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
2241  fFPileUpRejectV0MTPCout->SetParameter(1,2.0);
2242  break;
2243  }else{
2244  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
2245  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
2246  break;
2247  }
2248  break;
2249  case 7:
2250  fRemovePileUp = kTRUE;
2251  fRemovePileUpSPD = kTRUE;
2252  fDoPileUpRejectV0MTPCout = kTRUE;
2253  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2254  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
2255  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
2256  if (fIsHeavyIon==1){
2257  if(fPeriodEnum == kLHC15o){
2258  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2259  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2260  break;
2261  }else{
2262  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2263  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
2264  break;
2265  }
2266  } else if(fIsHeavyIon == 2){
2267  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
2268  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
2269  break;
2270  }else{
2271  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
2272  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
2273  break;
2274  }
2275  break;
2276  case 8:
2277  fRemovePileUp = kTRUE;
2278  fRemovePileUpSPD = kTRUE;
2279  fDoPileUpRejectV0MTPCout = kTRUE;
2280  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2281  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
2282  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
2283  if (fIsHeavyIon==1){
2284  if(fPeriodEnum == kLHC15o){
2285  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2286  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2287  break;
2288  }else{
2289  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
2290  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
2291  break;
2292  }
2293  } else if(fIsHeavyIon == 2){
2294  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
2295  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
2296  break;
2297  }else{
2298  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
2299  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
2300  break;
2301  }
2302  break;
2303  case 9:
2304  fRemovePileUp = kTRUE;
2305  fRemovePileUpSPD = kTRUE;
2308  fDoPileUpRejectV0MTPCout = kTRUE;
2309  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2310  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
2311  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
2312  if (fIsHeavyIon==1){
2313  if(fPeriodEnum == kLHC15o){
2314  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2315  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2316  break;
2317  }else{
2318  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
2319  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
2320  break;
2321  }
2322  } else if(fIsHeavyIon == 2){
2323  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
2324  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
2325  break;
2326  }else{
2327  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
2328  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
2329  break;
2330  }
2331  break;
2332  case 10: // for Pb-Pb
2333  fRemovePileUp = kTRUE;
2334  fRemovePileUpSPD = kTRUE;
2335  fUtils->SetASPDCvsTCut(200.);
2336  fUtils->SetBSPDCvsTCut(7.);
2337  fDoPileUpRejectV0MTPCout = kTRUE;
2338  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2339  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2340  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2341  break;
2342  case 11: // for Pb-Pb
2343  fRemovePileUp = kTRUE;
2344  fRemovePileUpSPD = kFALSE;
2345  fDoPileUpRejectV0MTPCout = kTRUE;
2346  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2347  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2348  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2349  break;
2350  default:
2351  AliError("RemovePileUpCut not defined");
2352  return kFALSE;
2353  }
2354  return kTRUE;
2355 }
2356 
2357 //________________________________________________________________________
2359 
2360  switch(extraSignal){
2361  case 0:
2362  fRejectExtraSignals = 0;
2363  break; // No Rejection
2364  case 1:
2365  fRejectExtraSignals = 1;
2366  break; // MinBias Header
2367  case 2:
2368  fRejectExtraSignals = 2;
2369  break; // User String Array
2370  case 3:
2371  fRejectExtraSignals = 3;
2372  break; // Rejection for Gamma Correction only
2373  case 4:
2374  fRejectExtraSignals = 4;
2375  break; // Special handling of Jet weights for Jets embedded in MB events
2376  default:
2377  AliError(Form("Extra Signal Rejection not defined %d",extraSignal));
2378  return kFALSE;
2379  }
2380  return kTRUE;
2381 }
2382 
2383 //________________________________________________________________________
2385 
2386  switch(vertexCut){
2387  case 0: // no Vertex required // NOT fully working yet
2388  fEnableVertexCut = kFALSE;
2389  fMaxVertexZ = 1000;
2390  break;
2391  case 1: // vertex within +-15 cm
2392  fEnableVertexCut = kTRUE;
2393  fMaxVertexZ = 15;
2394  break;
2395  case 2: // vertex within +-12.5 cm
2396  fEnableVertexCut = kTRUE;
2397  fMaxVertexZ = 12.5;
2398  break;
2399  case 3: // vertex within +-10 cm
2400  fEnableVertexCut = kTRUE;
2401  fMaxVertexZ = 10.0;
2402  break;
2403  case 4: // vertex within +-7.5 cm
2404  fEnableVertexCut = kTRUE;
2405  fMaxVertexZ = 7.5;
2406  break;
2407  case 5: // vertex within +-5 cm
2408  fEnableVertexCut = kTRUE;
2409  fMaxVertexZ = 5.;
2410  break;
2411  default:
2412  AliError(Form("Vertex Cut not defined %d",vertexCut));
2413  return kFALSE;
2414  }
2415  return kTRUE;
2416 }
2417 
2418 //-------------------------------------------------------------
2420  if (fPeriodEnum == kLHC15n || // pp 5TeV
2421  fPeriodEnum == kLHC15o || // PbPb 5TeV
2422  fPeriodEnum == kLHC15k1a1 || fPeriodEnum == kLHC15k1a2 || fPeriodEnum == kLHC15k1a3 || fPeriodEnum == kLHC16j7 || // MC PbPb 5TeV LowIR
2423  fPeriodEnum == kLHC18e1 || fPeriodEnum == kLHC18e1a || fPeriodEnum == kLHC18e1b || fPeriodEnum == kLHC18e1c || // MC PbPb 5TeV general purpose
2424  fPeriodEnum == kLHC16g2 || // MC PbPb 5TeV EPOS-LHC
2425  fPeriodEnum == kLHC16g3 || // MC PbPb 5TeV DPMJET
2426  fPeriodEnum == kLHC16h4 || // MC PbPb 5TeV GA added pi0 and eta
2427  fPeriodEnum == kLHC16i1a || fPeriodEnum == kLHC16i1b || fPeriodEnum == kLHC16i1c || // MC PbPb 5TeV LF added (multi-)strange
2428  fPeriodEnum == kLHC16i2a || fPeriodEnum == kLHC16i2b || fPeriodEnum == kLHC16i2c || // MC PbPb 5TeV HF added hadronic decays
2429  fPeriodEnum == kLHC16i3a || fPeriodEnum == kLHC16i3b || fPeriodEnum == kLHC16i3c || // MC PbPb 5TeV HF added electron decays
2430  fPeriodEnum == kLHC16h2a || fPeriodEnum == kLHC16h2b || fPeriodEnum == kLHC16h2c || // MC PbPb 5TeV jet-jet
2432  fPeriodEnum == kLHC15g3a3 || fPeriodEnum == kLHC15g3c3 || // MC pp 13TeV
2433  fPeriodEnum == kLHC16qt || // pPb 5TeV LHC16qt
2434  fPeriodEnum == kLHC16r || fPeriodEnum == kLHC16s || // pPb 8TeV LHC16rs
2435  fPeriodEnum == kLHC17f2a || fPeriodEnum == kLHC17f2b || fPeriodEnum == kLHC17g8a || fPeriodEnum == kLHC18f3 || // MC pPb 5TeV LHC16qt
2437  fPeriodEnum == kLHC17f3 || fPeriodEnum == kLHC17f4 || // MC pPb 8TeV LHC16sr
2438  fPeriodEnum == kLHC17n || // Xe-Xe LHC17n
2439  fPeriodEnum == kLHC17j7 || // MC Xe-Xe LHC17n
2440  fPeriodEnum == kLHC17pq || // pp 5TeV LHC17pq
2441  fPeriodEnum == kLHC17l3b || fPeriodEnum == kLHC18j2 || // MC pp 5TeV LHC17pq
2442  fPeriodEnum == kLHC17l4b || // MC pp 5TeV LHC17pq
2443  fPeriodEnum == kLHC18b8 // MC Jet Jet pp 5TeV LHC17pq
2444  ){
2445  return kTRUE;
2446  } else {
2447  return kFALSE;
2448  }
2449 }
2450 
2451 //-------------------------------------------------------------
2453 { // Get Event Centrality
2454 
2455  AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
2456  Int_t runnumber = event->GetRunNumber();
2457  if(esdEvent){
2459  AliMultSelection *MultSelection = (AliMultSelection*)event->FindListObject("MultSelection");
2460  if(!MultSelection){
2461  AliWarning ("AliMultSelection object not found !");
2462  return -1;
2463  }else{
2464  if(fDetectorCentrality==0){
2465  if(fIsHeavyIon==2){
2466  if (runnumber > 266329 && runnumber < 267139)
2467  return MultSelection->GetMultiplicityPercentile("V0C");// default for Pbp
2468  else
2469  return MultSelection->GetMultiplicityPercentile("V0A");// default for pPb
2470  } else {
2471  return MultSelection->GetMultiplicityPercentile("V0M");// default
2472  }
2473  } else if(fDetectorCentrality==1){
2474  return MultSelection->GetMultiplicityPercentile("CL1",kTRUE);
2475  } else if(fDetectorCentrality==2){
2476  if (runnumber > 266329 && runnumber < 267139)
2477  return MultSelection->GetMultiplicityPercentile("ZNC",kTRUE);
2478  else
2479  return MultSelection->GetMultiplicityPercentile("ZNA",kTRUE);
2480  }
2481  }
2482  }else{
2483  AliCentrality *fESDCentrality = (AliCentrality*)esdEvent->GetCentrality();
2484  if(fDetectorCentrality==0){
2485  if(fIsHeavyIon==2){
2486  if (runnumber > 196432 && runnumber < 197389)
2487  return fESDCentrality->GetCentralityPercentile("V0C"); // default for Pbp
2488  else
2489  return fESDCentrality->GetCentralityPercentile("V0A"); // default for pPb
2490  } else {
2491  return fESDCentrality->GetCentralityPercentile("V0M"); // default
2492  }
2493  } else if(fDetectorCentrality==1){
2494  return fESDCentrality->GetCentralityPercentile("CL1");
2495  } else if(fDetectorCentrality==2){
2496  if (runnumber > 196432 && runnumber < 197389)
2497  return fESDCentrality->GetCentralityPercentile("ZNC");
2498  else
2499  return fESDCentrality->GetCentralityPercentile("ZNA");
2500  }
2501  }
2502  }
2503 
2504  AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
2505  if(aodEvent){
2507  AliMultSelection *MultSelection = (AliMultSelection*)aodEvent->FindListObject("MultSelection");
2508  if(!MultSelection){
2509  AliWarning ("AliMultSelection object not found !");
2510  return -1;
2511  } else{
2512  if(fDetectorCentrality==0){
2513  if(fIsHeavyIon==2) return MultSelection->GetMultiplicityPercentile("V0A");// default for pPb
2514  else return MultSelection->GetMultiplicityPercentile("V0M",kTRUE);
2515  }else if(fDetectorCentrality==1) return MultSelection->GetMultiplicityPercentile("CL1",kTRUE);
2516  else if(fDetectorCentrality==2) return MultSelection->GetMultiplicityPercentile("ZNA",kTRUE);
2517  }
2518  }else{
2519  if(aodEvent->GetHeader()){return ((AliVAODHeader*)aodEvent->GetHeader())->GetCentrality();}
2520  }
2521  }
2522 
2523  return -1;
2524 }
2525 
2526 //_____________________________________________________________________________________
2527 Bool_t AliConvEventCuts::IsCentralitySelected(AliVEvent *event, AliMCEvent *mcEvent)
2528 {
2529  // Centrality Selection
2530  if(!fIsHeavyIon){
2531  if ((fCentralityMin == 0 && fCentralityMax == 0) || (fCentralityMin > fCentralityMax) ){
2532  return kTRUE;
2533  } else {
2534  Int_t primaryTracksPP[9] = { 0, 2, 5, 10, 15,
2535  30, 50, 100, 1000
2536  };
2537  Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks();
2538  if ( nprimaryTracks >= primaryTracksPP[fCentralityMin] && nprimaryTracks < primaryTracksPP[fCentralityMax]){
2539  return kTRUE;
2540  } else {
2541  return kFALSE;
2542  }
2543  return kFALSE;
2544  }
2545  }
2546  if(fCentralityMin == fCentralityMax ) return kTRUE;//0-100%
2547  else if ( fCentralityMax==0) fCentralityMax=10; //CentralityRange = fCentralityMin-10*multfactor
2549  if(centrality<0 && !mcEvent)return kFALSE;
2550  Double_t addMarginZNA = (fDetectorCentrality==2 && fCentralityMax==10) ? 2.0 : 0.0; // For ZNA multiplicity goes up to 101%
2551 
2552  Int_t centralityC=0;
2553  if (fModCentralityClass == 0){
2554  centralityC= Int_t(centrality);
2555  if(centralityC >= (fCentralityMin*10) && centralityC < (fCentralityMax*10 + addMarginZNA))
2556  return kTRUE;
2557  else return kFALSE;
2558  }
2559  else if (fModCentralityClass == 1){
2560  centralityC= Int_t(centrality);
2561  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2562  return kTRUE;
2563  } else return kFALSE;
2564  }
2565  else if (fModCentralityClass == 2){
2566  centralityC= Int_t(centrality);
2567  if(centralityC >= fCentralityMin && centralityC < fCentralityMax){
2568  return kTRUE;
2569  } else return kFALSE;
2570  }
2571  Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks();
2572  Int_t PrimaryTracks10[11][2] =
2573  {
2574  {9999,9999}, // 0 //1550 changed to 9999 on 9 Dec
2575  {1210, 928}, // 10
2576  { 817, 658}, // 20
2577  { 536, 435}, // 30
2578  { 337, 276}, // 40
2579  { 197, 162}, // 50
2580  { 106, 100}, // 60
2581  { 51, 44}, // 70
2582  { 21, 18}, // 80
2583  { 0, 0}, // 90
2584  { 0, 0}// 100 // only max accessible
2585  };
2586  Int_t PrimaryTracksLHC11h10[11][2] =
2587  {
2588  {9999,9999}, // 0 //1550 changed to 9999 on 9 Dec
2589  { 985, 928}, // 10
2590  { 661, 658}, // 20
2591  { 434, 435}, // 30
2592  { 275, 276}, // 40
2593  { 173, 162}, // 50
2594  { 100, 100}, // 60
2595  { 42, 44}, // 70
2596  { 19, 18}, // 80
2597  { 0, 0}, // 90
2598  { 0, 0}// 100 // only max accessible
2599  };
2600  Int_t PrimaryTracksLHC15o10[11][2] =
2601  {
2602  {2500, 2700}, // 0-10% cent class max # of tracks: max value of the data distribution
2603  {1498, 1498}, // 0-10% cent class min # of tracks
2604  {1012, 1012}, // 10-20
2605  { 669, 669}, // 20-30
2606  { 423, 423}, // 30-40
2607  { 251, 251}, // 40-50
2608  { 136, 136}, // 50-60
2609  { 67, 67}, // 60-70
2610  { 28, 28}, // 70-80
2611  { 0, 0}, // 80-90% cent class min # of tracks
2612  { 0, 0} // not used
2613  };
2614  Int_t PrimaryTracksLHC10h5[21][2] =
2615  {
2616  {9999,9999}, // 0 ///1550 changed to 9999 on 9 Dec
2617  {1485,1168}, // 5
2618  {1210, 928}, // 10
2619  { 995, 795}, // 15
2620  { 817, 658}, // 20
2621  { 666, 538}, // 25
2622  { 536, 435}, // 30
2623  { 428, 350}, // 35
2624  { 337, 276}, // 40
2625  { 260, 214}, // 45
2626  { 197, 162}, // 50
2627  { 147, 125}, // 55
2628  { 106, 100}, // 60
2629  { 75, 63}, // 65
2630  { 51, 44}, // 70
2631  { 34, 29}, // 75
2632  { 21, 18}, // 80
2633  { 13, 11}, // 85
2634  { 6, 6}, // 90
2635  { 3, 3}, // 95
2636  { 0, 0} // 100 only max accessible
2637  };
2638  Int_t PrimaryTracksLHC11h5[21][2] =
2639  {
2640  {9999,9999}, // 0 ///1550 changed to 9999 on 9 Dec
2641  {1166,1168}, // 5
2642  { 953, 928}, // 10
2643  { 805, 795}, // 15
2644  { 655, 658}, // 20
2645  { 535, 538}, // 25
2646  { 435, 435}, // 30
2647  { 349, 350}, // 35
2648  { 275, 276}, // 40
2649  { 214, 214}, // 45
2650  { 165, 162}, // 50
2651  { 127, 125}, // 55
2652  { 93, 100}, // 60
2653  { 64, 63}, // 65
2654  { 44, 44}, // 70
2655  { 30, 29}, // 75
2656  { 18, 18}, // 80
2657  { 11, 11}, // 85
2658  { 6, 6}, // 90
2659  { 3, 3}, // 95
2660  { 0, 0} // 100 only max accessible
2661  };
2662  Int_t PrimaryTracksLHC15o5[21][2] =
2663  {
2664  { 2500, 2700}, // 0-5% cent class max # of tracks: max value of the data distribution
2665  { 1827, 1827}, // 0-5% cent class min # of tracks
2666  { 1498, 1498}, // 5-10
2667  { 1234, 1234}, // 10-15
2668  { 1012, 1012}, // 15-20
2669  { 827, 827}, // 20-25
2670  { 669, 669}, // 25-30
2671  { 536, 536}, // 30-35
2672  { 423, 423}, // 35-40
2673  { 329, 329}, // 40-45
2674  { 251, 251}, // 45-50
2675  { 188, 188}, // 50-55
2676  { 136, 136}, // 55-60
2677  { 97, 97}, // 60-65
2678  { 67, 67}, // 65-70
2679  { 44, 44}, // 70-75
2680  { 28, 28}, // 75-80
2681  { 17, 17}, // 80-85
2682  { 10, 10}, // 85-90
2683  { 5, 5}, // 90-95 cent class minimum # of tracks
2684  { 0, 0} // 95-100
2685  };
2686  Int_t PrimaryTracksLHC17n10[11][2] =
2687  {
2688  {9999,9999}, // 0 // 1500 max in hist but set to real max
2689  { 800, 800}, // 10 // guess
2690  { 628, 628}, // 20
2691  { 350, 350}, // 30 // guess
2692  { 268, 268}, // 40
2693  { 200, 200}, // 50 // guess
2694  { 100, 100}, // 60 // guess
2695  { 51, 44}, // 70 // guess
2696  { 21, 18}, // 80 // guess
2697  { 0, 0}, // 90 // guess
2698  { 0, 0} // 100 // only max accessible
2699  };
2700 
2701  Int_t column = 0;
2702  if(event->IsA()==AliESDEvent::Class()) column = 0;
2703  if(event->IsA()==AliAODEvent::Class()) column = 1;
2704 
2705  if (fModCentralityClass == 3){
2706  if(mcEvent){
2707  // setting specific arry for LHC11h for MC track mult
2709  if(nprimaryTracks > PrimaryTracksLHC11h10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h10[fCentralityMin][column])
2710  return kTRUE;
2711  else return kFALSE;
2712  // setting specific arry for LHC17n for MC track mult
2713  } else if(fPeriodEnum == kLHC17j7 ){
2714  if(nprimaryTracks > PrimaryTracksLHC17n10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC17n10[fCentralityMin][column])
2715  return kTRUE;
2716  else return kFALSE;
2717  // settings for LHC15o MCs
2719  centralityC= Int_t(centrality/10);
2720  if(centralityC >= fCentralityMin && centralityC < fCentralityMax){
2721  if(fCentralityMin==0 && nprimaryTracks >= PrimaryTracksLHC15o10[0][column]) return kFALSE;
2722  else return kTRUE;
2723  } else return kFALSE;
2724  // setting specific arry for LHC10h for MC track mult
2725  } else {
2726  if(nprimaryTracks > PrimaryTracks10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks10[fCentralityMin][column])
2727  return kTRUE;
2728  else return kFALSE;
2729  }
2730  }
2731  else{
2732  centralityC= Int_t(centrality/10);
2733  if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2734  return kTRUE;
2735  else return kFALSE;
2736  }
2737  }
2738  else if (fModCentralityClass ==4){
2739  if(mcEvent){
2740  // setting specific arry for LHC11h for MC track mult
2742  if(nprimaryTracks > PrimaryTracksLHC11h5[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h5[fCentralityMin][column])
2743  return kTRUE;
2744  else return kFALSE;
2745  // settings for LHC15o MCs
2747  centralityC = Int_t(centrality);
2748  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2749  if(fCentralityMin==0 && nprimaryTracks >= PrimaryTracksLHC15o5[0][column]) return kFALSE;
2750  else return kTRUE;
2751  } else return kFALSE;
2752  // setting specific arry for LHC10h for MC track mult
2753  } else {
2754  if(nprimaryTracks > PrimaryTracksLHC10h5[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC10h5[fCentralityMin][column])
2755  return kTRUE;
2756  else return kFALSE;
2757  }
2758  }
2759  else{
2760  centralityC= Int_t(centrality);
2761  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2762  return kTRUE;
2763  } else return kFALSE;
2764  }
2765  }
2766 
2767  Int_t PrimaryTracksLHC11h10AltMin[11][2] =
2768  {
2769  {1550,1550}, // 0 - 0
2770  { 800, 800}, // 10 - 1
2771  { 600, 600}, // 20 - 2
2772  { 400, 400}, // 30 - 3
2773  { 240, 240}, // 40 - 4
2774  { 130, 130}, // 50 - 5
2775  { 90, 90}, // 60 - 6
2776  { 35, 35}, // 70 - 7
2777  { 15, 15}, // 80 - 8
2778  { 5, 5}, // 90 - 9
2779  { 0, 0} // 100 // only max accessible
2780  };
2781  Int_t PrimaryTracksLHC11h10AltMax[11][2] =
2782  {
2783  {1550,1550}, // 0 //1550 changed to 9999 on 9 Dec
2784  {1000,1000}, // 10
2785  { 700, 700}, // 20
2786  { 480, 480}, // 30
2787  { 300, 300}, // 40
2788  { 200, 200}, // 50
2789  { 120, 120}, // 60
2790  { 50, 50}, // 70
2791  { 22, 22}, // 80
2792  { 10, 10}, // 90
2793  { 0, 0} // 100 // only max accessible
2794  };
2795  Int_t PrimaryTracksLHC11h5AltMin[21][2] =
2796  {
2797  {1550,1550}, // 0
2798  {1000,1000}, // 5
2799  { 800, 800}, // 10
2800  { 700, 700}, // 15
2801  { 600, 600}, // 20
2802  { 500, 500}, // 25
2803  { 400, 400}, // 30
2804  { 300, 300}, // 35
2805  { 240, 240}, // 40
2806  { 180, 180}, // 45
2807  { 130, 130}, // 50
2808  { 127, 125}, // 55
2809  { 90, 90}, // 60
2810  { 55, 55}, // 65
2811  { 35, 35}, // 70
2812  { 25, 25}, // 75
2813  { 15, 15}, // 80
2814  { 11, 11}, // 85
2815  { 5, 5}, // 90
2816  { 0, 0}, // 95
2817  { 0, 0} // 100 only max accessible
2818  };
2819  Int_t PrimaryTracksLHC11h5AltMax[21][2] =
2820  {
2821  {1550,1550}, // 0
2822  {1250,1250}, // 5
2823  {1000,1000}, // 10
2824  { 805, 795}, // 15
2825  { 700, 700}, // 20
2826  { 585, 585}, // 25
2827  { 480, 480}, // 30
2828  { 380, 380}, // 35
2829  { 300, 300}, // 40
2830  { 235, 235}, // 45
2831  { 200, 200}, // 50
2832  { 140, 140}, // 55
2833  { 120, 120}, // 60
2834  { 70, 70}, // 65
2835  { 50, 50}, // 70
2836  { 35, 25}, // 75
2837  { 22, 22}, // 80
2838  { 15, 15}, // 85
2839  { 10, 10}, // 90
2840  { 5, 5}, // 95
2841  { 0, 0} // 100 only max accessible
2842  };
2843 
2844  if (fModCentralityClass == 5){
2845  if(mcEvent){
2846  // setting specific arry for LHC11h for MC track mult
2848  if(nprimaryTracks > PrimaryTracksLHC11h10AltMin[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h10AltMax[fCentralityMin][column])
2849  return kTRUE;
2850  else return kFALSE;
2851  // default return
2852  } else {
2853  return kFALSE;
2854  }
2855  } else {
2856  centralityC= Int_t(centrality/10);
2857  if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2858  return kTRUE;
2859  else return kFALSE;
2860  }
2861  }
2862  else if (fModCentralityClass ==6){
2863  if(mcEvent){
2864  // setting specific arry for LHC11h for MC track mult
2866  if(nprimaryTracks > PrimaryTracksLHC11h5AltMin[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h5AltMax[fCentralityMin][column])
2867  return kTRUE;
2868  else return kFALSE;
2869  } else {
2870  return kFALSE;
2871  }
2872  } else{
2873  centralityC= Int_t(centrality);
2874  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2875  return kTRUE;
2876  } else return kFALSE;
2877  }
2878  }
2879 
2880  return kFALSE;
2881 }
2882 
2883 //________________________________________________________________________
2885  // Cut on z position of primary vertex
2886  Double_t fVertexZ=event->GetPrimaryVertex()->GetZ();
2887  Double_t fVertexZSPD = 0;
2888  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2889  if(fESDEvent){
2890  fVertexZSPD = fESDEvent->GetPrimaryVertexSPD()->GetZ();
2891  }
2892  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2893  if(fAODEvent){
2894  fVertexZSPD = fAODEvent->GetPrimaryVertexSPD()->GetZ();
2895  }
2896 
2897  if(TMath::Abs(fVertexZ)>fMaxVertexZ)return kFALSE;
2898 
2899 
2900  if (fPeriodEnum == kLHC11h){
2901  if (TMath::Abs(fVertexZ-fVertexZSPD) > 0.1) return kFALSE;
2902  }
2903  if (fIsHeavyIon == 2){
2904  if(!fUtils->IsVertexSelected2013pA(event)) return kFALSE;
2905  }
2906 
2907  return kTRUE;
2908 }
2909 
2910 //________________________________________________________________________
2912 {
2914  return kFALSE;
2915  TBits fIR1 = event->GetHeader()->GetIRInt1InteractionMap(); // IR1 contains V0 information (VIR)
2916  TBits fIR2 = event->GetHeader()->GetIRInt2InteractionMap(); // IR2 contains T0 information
2917  UShort_t bunchCrossings = event->GetBunchCrossNumber();
2919  for(Int_t i = 0; i<180;i++){
2920  if(fIR1.TestBitNumber(i))
2921  fHistoPastFutureBits->Fill((i*25)-90*25);
2922  }
2923  }
2924 
2925  Bool_t isOutOfBunchPileup = 0;
2926  Int_t pf1 = fPastFutureRejectionLow +bunchCrossings%4;
2927  Int_t pf2 = fPastFutureRejectionHigh+bunchCrossings%4;
2928  if(pf1 < -89) pf1 = -89;
2929  if(pf2 > 89) pf2 = 89;
2930  Int_t pf2maxForT0 = pf2;
2931  Int_t ir1skip = 0;
2932  for (Int_t i=pf1;i<=pf2;i++) {
2933  if (i==0) continue;
2934  if (i<=pf2maxForT0) isOutOfBunchPileup|=fIR2.TestBitNumber(90+i); // T0-based clean-up
2935  if (i>0 && i<=ir1skip) continue; // skip next 2 for old IR definitions
2936  isOutOfBunchPileup|=fIR1.TestBitNumber(90+i); // V0-based clean-up
2937  }
2938  return isOutOfBunchPileup;
2939 }
2940 //________________________________________________________________________
2941 
2943 {
2944  Bool_t isPileUpV0MTPCout=0;
2945 
2946  Double_t multV0M;
2947  Double_t valFunc;
2948  if (fIsHeavyIon==2){
2949  multV0M = event->GetVZEROData()->GetMTotV0A();
2950  }else{
2951  multV0M = event->GetVZEROData()->GetMTotV0A() + event->GetVZEROData()->GetMTotV0C() ;
2952  }
2953 
2954  if ( fFPileUpRejectV0MTPCout != 0x0 ){
2955  valFunc= fFPileUpRejectV0MTPCout->Eval(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfTPCoutTracks());
2956  if (multV0M < valFunc ) isPileUpV0MTPCout=1;
2957  }
2958 
2959  return isPileUpV0MTPCout;
2960 
2961 }
2962 //________________________________________________________________________
2964  // returns number of contributors to the vertex
2965 
2966  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2967  if(fESDEvent){
2968  if (fESDEvent->GetPrimaryVertex() != NULL){
2969  if(fESDEvent->GetPrimaryVertex()->GetNContributors()>0) {
2970  // cout << "accepted global" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertex()->GetNContributors() << endl;
2971  return fESDEvent->GetPrimaryVertex()->GetNContributors();
2972  }
2973  }
2974 
2975  if(fESDEvent->GetPrimaryVertexSPD() !=NULL){
2976  if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2977  // cout << "accepted SPD" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertexSPD()->GetNContributors() << endl;
2978  return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
2979  }else {
2980  AliWarning(Form("Number of contributors from bad vertex type:: %s",fESDEvent->GetPrimaryVertex()->GetName()));
2981  // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
2982  return 0;
2983  }
2984  }
2985  }
2986 
2987  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2988  if(fAODEvent){
2989  if (fAODEvent->GetPrimaryVertex() != NULL){
2990  if(fAODEvent->GetPrimaryVertex()->GetNContributors()>0) {
2991  return fAODEvent->GetPrimaryVertex()->GetNContributors();
2992  }
2993  }
2994  if(fAODEvent->GetPrimaryVertexSPD() !=NULL){
2995  if(fAODEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2996  return fAODEvent->GetPrimaryVertexSPD()->GetNContributors();
2997  } else {
2998  AliWarning(Form("Number of contributors from bad vertex type:: %s",fAODEvent->GetPrimaryVertex()->GetName()));
2999  return 0;
3000  }
3001  }
3002  }
3003  // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
3004  return 0;
3005 }
3006 
3007 //________________________________________________________________________
3008 // Analysing Jet-Jet MC's
3009 //________________________________________________________________________
3010 Bool_t AliConvEventCuts::IsJetJetMCEventAccepted(AliMCEvent *mcEvent, Double_t& weight, AliVEvent* event ){
3011  AliGenCocktailEventHeader *cHeader = 0x0;
3012  Bool_t headerFound = kFALSE;
3013  weight = -1;
3014  fMaxPtJetMC = 0;
3015 
3016  if ( fPeriodEnum != kLHC18b8 && // LHC17pq pp 5TeV JetJet MC's
3017  fPeriodEnum != kLHC17i3a1 && // LHC16ijklop GammaJet MC EMCal triggered
3018  fPeriodEnum != kLHC17i3c1 && // LHC16ijklop JetJet MC EMCal triggered
3019  fPeriodEnum != kLHC17g8a && // LHC16qt pPb 5TeV JetJet MC's
3020  fPeriodEnum != kLHC16rP1JJ && fPeriodEnum != kLHC16sP1JJ && // LHC16sr pPb 8TeV JetJet MC's
3021  fPeriodEnum != kLHC16P1JJ && fPeriodEnum != kLHC16P1JJLowB && // LHC16X Jet Jet MC's
3022  fPeriodEnum != kLHC17P1JJ && fPeriodEnum != kLHC17P1JJLowB && // LHC17X Jet Jet MC's
3023  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
3024  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
3025  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
3026  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
3027  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
3028  fPeriodEnum != kLHC12P2JJ && // LHC12 JetJet MC
3029  fPeriodEnum != kLHC14k1a && fPeriodEnum != kLHC14k1b // LHC11 JetJet MC
3030  ){
3031 
3032  weight = 1;
3033  return kTRUE;
3034  }
3035 
3036  if(mcEvent){
3037  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
3038  if(cHeader) headerFound = kTRUE;
3039  }else{
3040  //no mcEvent available -> not running on MC
3041  weight = 1;
3042  return kTRUE;
3043  }
3044 
3045  if(headerFound){
3046  TList *genHeaders = 0x0;
3047  if(cHeader) genHeaders = cHeader->GetHeaders();
3048  AliGenEventHeader* gh = 0;
3049  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3050  gh = (AliGenEventHeader*)genHeaders->At(i);
3051  TString GeneratorName = gh->GetName();
3052  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0 || GeneratorName.Contains("Pythia8Jets")){
3053  Bool_t eventAccepted = kTRUE;
3054  Int_t nTriggerJets = dynamic_cast<AliGenPythiaEventHeader*>(gh)->NTriggerJets();
3055  Float_t ptHard = dynamic_cast<AliGenPythiaEventHeader*>(gh)->GetPtHard();
3056  Float_t tmpjet[]={0,0,0,0};
3057  for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){
3058  dynamic_cast<AliGenPythiaEventHeader*>(gh)->TriggerJet(ijet, tmpjet);
3059  TParticle jet(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
3060  //Compare jet pT and pt Hard
3061  if(jet.Pt() > fMaxFacPtHard * ptHard)
3062  eventAccepted= kFALSE;
3063  //set highest jet pT
3064  if (jet.Pt() > fMaxPtJetMC) fMaxPtJetMC = jet.Pt();
3065  }
3066  // if minimum jet pT compared to pT hard is required, reject event based on it
3067  if(fMaxPtJetMC < fMinFacPtHard * ptHard)
3068  eventAccepted= kFALSE;
3069 
3070  if (mcEvent){
3071  for(Long_t i = 0; i < mcEvent->GetNumberOfPrimaries(); i++) {
3072  AliMCParticle* particle = (AliMCParticle*) mcEvent->GetTrack(i);
3073  if (!particle) continue;
3074  // if (TMath::Abs(particle->GetPdgCode()) == 111 || TMath::Abs(particle->GetPdgCode()) == 221){
3075  if (particle->Pt() > fMaxFacPtHardSingleParticle*ptHard && TMath::Abs(particle->PdgCode()) > 21){
3076  eventAccepted= kFALSE;
3077  }
3078  // }
3079  }
3080  }
3081 
3083  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3084  21, 28, 36, 45, 57,
3085  70, 85, 99, 115, 132,
3086  150, 169, 190, 212, 235,
3087  1000000};
3088  Double_t weightsBins[20] = { 43.7553, 13.5848, 6.788, 2.67826, 0.975255,
3089  0.39069, 0.127342, 0.0465597, 0.0206539, 0.00750243,
3090  0.00319118, 0.00122291, 0.000641232, 0.000321437, 0.000168273,
3091  9.17033e-05, 5.34755e-05, 3.01354e-05, 1.74518e-05, 2.8004e-05};
3092  Int_t bin = 0;
3093  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3094  if (bin < 20) weight = weightsBins[bin];
3095 
3096  } else if ( fPeriodEnum == kLHC16P1JJ || fPeriodEnum == kLHC17P1JJ ){
3097  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3098  21, 28, 36, 45, 57,
3099  70, 85, 99, 115, 132,
3100  150, 169, 190, 212, 235,
3101  1000000};
3102  Double_t weightsBins[20] = { 43.8654, 13.6215, 6.79856, 2.67526, 0.978794,
3103  0.390797, 0.127769, 0.0465714, 0.0206173, 0.00750282,
3104  0.00318773, 0.00122533, 0.000644385, 0.000321225, 0.00016846,
3105  9.18305e-05, 5.33507e-05, 3.00677e-05, 1.74608e-05, 2.80823e-05};
3106 
3107  Int_t bin = 0;
3108  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3109  if (bin < 20) weight = weightsBins[bin];
3110 
3111  } else if ( fPeriodEnum == kLHC16h3 ){
3112  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3113  21, 28, 36, 45, 57,
3114  70, 85, 99, 115, 132,
3115  150, 169, 190, 212, 235,
3116  1000000};
3117  Double_t weightsBins[20] = { 16.0869, 4.61169, 2.14976, 0.782544, 0.264854,
3118  9.7619E-02, 2.92747E-02, 9.89515E-03, 4.05152E-03, 1.35393E-03,
3119  5.29864E-04, 1.88317E-04, 9.23E-05, 4.29E-05, 2.09E-05,
3120  1.06E-05, 5.76E-06, 3.00E-06, 1.62E-06, 2.10E-06 };
3121  Int_t bin = 0;
3122  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3123  if (bin < 20) weight = weightsBins[bin];
3124 
3125 
3126  } else if ( fPeriodEnum == kLHC14k1a ){
3127  Double_t ptHardBinRanges[7] = { 5, 7, 9, 12, 16,
3128  21, 1000000};
3129  Double_t weightsBins[6] = { 2.327372e-02, 1.783327e-02, 1.678043e-02, 1.167544e-02, 7.066289e-03, 8.714857e-03};
3130  Int_t bin = 0;
3131  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3132  if (bin < 6) weight = weightsBins[bin];
3133  } else if ( fPeriodEnum == kLHC14k1b ){
3134  Double_t ptHardBinRanges[8] = { 10, 14, 19, 26, 35,
3135  48, 66, 1000000};
3136  Double_t weightsBins[7] = { 6.174824e-04 , 6.557521e-04 , 6.472503e-04 , 4.857432e-04 , 3.402152e-04 , 1.873434e-04 , 1.376054e-04 };
3137  Int_t bin = 0;
3138  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3139  if (bin < 7) weight = weightsBins[bin];
3140  } else if ( fPeriodEnum == kLHC15a3b || fPeriodEnum == kLHC15g1b ){
3141  Double_t ptHardBinRanges[13] = { 5, 7, 9, 12, 16,
3142  21, 28, 36, 45, 57,
3143  70, 85, 1000};
3144  Double_t weightsBins[12] = { 7.858393e-03, 4.718691e-03, 4.077575e-03, 2.814527e-03, 1.669625e-03,
3145  1.007535e-03, 4.536554e-04, 2.111041e-04, 1.094840e-04, 4.404973e-05,
3146  1.933238e-05, 1.562895e-05};
3147  Int_t bin = 0;
3148  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3149  if (bin < 12) weight = weightsBins[bin];
3150 
3151  } else if ( fPeriodEnum == kLHC15g1a ){
3152  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
3153  84, 117, 152, 191, 1000000,
3154  5, 7, 9, 12, 16,
3155  21, 28, 36, 45, 57 };
3156  Double_t weightsBins[19] = { 4.43629 , 0.49523, 0.0394921, 0.00383174, 0.000446559,
3157  6.37374e-05, 1.03134e-05, 2.27012e-06, 7.59281e-07, 0,
3158  2.62906, 1.12884, 0.656873, 0.262822, 0.0876732,
3159  0.0307759, 0.0087083, 0.0027664, 0.00106203};
3160 
3161  Int_t bin = 0;
3162  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
3163  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
3164  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3165  if (bin < 19) weight = weightsBins[bin];
3166 
3167  } else if ( fPeriodEnum == kLHC15a3a || fPeriodEnum == kLHC15a3a_plus ) {
3168  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
3169  84, 117, 152, 191, 1000000,
3170  5, 7, 9, 12, 16,
3171  21, 28, 36, 45, 57 };
3172  // LHC15a3a
3173  Double_t weightsBins[19] = { 4.43897 , 0.495766, 0.039486, 0.00383011, 0.000447104,
3174  6.37277e-05, 1.03166e-05, 2.26971e-06, 7.59023e-07, 0,
3175  2.63331, 1.12815, 0.657034, 0.262756, 0.0877227,
3176  0.0307638, 0.00870635, 0.00276658, 0.00106229};
3177  Int_t bin = 0;
3178  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
3179  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
3180  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3181  if (bin < 19) weight = weightsBins[bin];
3182 
3183  } else if ( fPeriodEnum == kLHC12P2JJ ){
3184  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3185  21, 28, 36, 45, 57,
3186  70, 85, 99, 115, 132,
3187  150, 169, 190, 212, 235,
3188  1000000};
3189  Double_t weightsBins[20] = { 28.3084, 8.43277, 4.07753, 1.54359, 0.543318,
3190  0.208394, 0.0652349, 0.0186904, 0.00834528, 0.00301414,
3191  0.00125939, 0.000474403, 0.000244052, 0.00011924, 6.09838e-05,
3192  3.24148e-05, 1.84314e-05, 1.00926e-05, 5.68632e-06, 8.38092e-06};
3193  Int_t bin = 0;
3194  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3195  if (bin < 20) weight = weightsBins[bin];
3196 
3197  } else if ( fPeriodEnum == kLHC16c3a ){ // ALIROOT-5901
3198  Double_t ptHardBinRanges[6] = { 7, 9, 12, 16, 21, 1000};
3199  Double_t weightsBins[5] = { 6.731200e-03, 7.995602e-03, 6.778717e-03, 4.643571e-03, 6.014497e-03}; //preliminary estimates
3200  Int_t bin = 0;
3201  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3202  if (bin < 5) weight = weightsBins[bin];
3203 
3204  } else if (fPeriodEnum == kLHC16c3b ){ // ALIROOT-5901
3205  Double_t ptHardBinRanges[7] = { 14, 19, 26, 35, 48, 66, 1000};
3206  Double_t weightsBins[6] = { 6.071458e-03, 3.941701e-03, 2.001984e-03, 9.862765e-04, 3.893911e-04, 1.865924e-04}; //preliminary estimates
3207  Int_t bin = 0;
3208  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3209  if (bin < 6) weight = weightsBins[bin];
3210 
3211  } else if (fPeriodEnum == kLHC16c3c ){ // ALIROOT-5901
3212  Double_t ptHardBinRanges[8] = { 0, 5, 11, 21, 36, 57, 84, 1000};
3213  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
3214  Int_t bin = 0;
3215  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3216  if (bin < 7) weight = weightsBins[bin];
3217 
3218  } else if ( fPeriodEnum == kLHC13b4_fix || fPeriodEnum == kLHC13b4_plus ){
3219  Double_t ptHardBinRanges[11] = { 5, 11, 21, 36, 57,
3220  84, 117, 152, 191, 234,
3221  1000};
3222  Double_t weightsBins[10] = { 2.24185e-6 , 2.48463e-7, 2.23171e-8, 2.43667e-9, 3.29934e-10,
3223  5.34592e-11, 1.00937e-11, 2.6493e-12, 8.53912e-13, 5.43077e-13};
3224  Int_t bin = 0;
3225  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3226  if (bin < 10) weight = weightsBins[bin];
3227  } else if ( fPeriodEnum == kLHC17g8a ){ // preliminary weights obtained from local running
3228  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16, 21, 28, 36, 45, 57, 70, 85, 99, 115, 132, 150, 169, 190, 212, 235, 10000};
3229  Double_t weightsBins[20] = {1.565930E+01, 4.598350E+00, 2.081240E+00, 7.744650E-01, 2.644240E-01, 1.002330E-01, 2.979190E-02, 9.696490E-03, 3.950930E-03, 1.333040E-03, 5.210630E-04, 1.927180E-04, 9.235930E-05, 4.346820E-05, 2.120660E-05, 1.073260E-05, 5.701210E-06, 3.047490E-06, 1.664780E-06, 2.123400E-06};
3230  Int_t bin = 0;
3231  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3232  if (bin < 20) weight = weightsBins[bin];
3233  } else if ( fPeriodEnum == kLHC16rP1JJ ){ // preliminary weights obtained from local running
3234  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16, 21, 28, 36, 45, 57, 70, 85, 99, 115, 132, 150, 169, 190, 212, 235, 10000};
3235  Double_t weightsBins[20] = {2.723740E+01, 8.127540E+00, 3.934400E+00, 1.492720E+00, 5.268010E-01, 2.033790E-01, 6.361520E-02, 2.256080E-02, 9.638840E-03, 3.372890E-03, 1.381980E-03, 5.121390E-04, 2.613120E-04, 1.260940E-04, 6.393150E-05, 3.386080E-05, 1.926040E-05, 1.046950E-05, 5.895950E-06, 8.658420E-06};
3236  Int_t bin = 0;
3237  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3238  if (bin < 20) weight = weightsBins[bin];
3239  } else if ( fPeriodEnum == kLHC16sP1JJ ){ // preliminary weights obtained from local running
3240  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16, 21, 28, 36, 45, 57, 70, 85, 99, 115, 132, 150, 169, 190, 212, 235, 10000};
3241  Double_t weightsBins[20] = {2.716550E+01, 8.121430E+00, 3.932100E+00, 1.492830E+00, 5.272190E-01, 2.023090E-01, 6.371860E-02, 2.245360E-02, 9.590340E-03, 3.369300E-03, 1.384470E-03, 5.119390E-04, 2.606910E-04, 1.259110E-04, 6.408650E-05, 3.396290E-05, 1.917340E-05, 1.044610E-05, 5.882680E-06, 8.672390E-06};
3242  Int_t bin = 0;
3243  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3244  if (bin < 20) weight = weightsBins[bin];
3245  } else if ( fPeriodEnum == kLHC17i3a1 ){ // weights obtained from ga_pp_mc_aod train 912
3246  Double_t ptHardBinRanges[7] = { 5, 11, 21, 36, 57, 84, 10000};
3247  Double_t weightsBins[6] = { 0.0002181, 3.13684e-05, 5.01515e-06, 9.50662e-07, 2.08186e-07, 7.96555e-08};
3248  Int_t bin = 0;
3249  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3250  if (bin < 6) weight = weightsBins[bin];
3251  } else if ( fPeriodEnum == kLHC17i3c1 ){ // preliminary weights obtained from local running
3252  Double_t ptHardBinRanges[9] = { 8, 10, 14, 19, 26, 35, 48, 66, 10000};
3253  Double_t weightsBins[8] = { 0.000813592, 0.00172074, 0.00187963, 0.00184331, 0.00142672, 0.0010083, 0.000599846, 0.000499877};
3254  Int_t bin = 0;
3255  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3256  if (bin < 8) weight = weightsBins[bin];
3257  } else {
3258  weight = 1;
3259  }
3260 
3261  if (weight == -1) return kFALSE;
3262  else return eventAccepted;
3263 
3264  }
3265  }
3266  } else {
3267  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
3268  TString eventHeaderName = eventHeader->ClassName();
3269  Bool_t eventAccepted = kFALSE;
3270  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0 || eventHeaderName.Contains("Pythia8Jets")){
3271  eventAccepted = kTRUE;
3272  }else { //special case for pythia8jets embedded in EPOSLHC for AODs
3273  if(event->IsA()==AliAODEvent::Class()){
3274  AliAODMCHeader *mch = NULL;
3275  AliAODEvent * aod = dynamic_cast<AliAODEvent*> (event);
3276  if(aod){
3277  mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader"));
3278  if ( mch ){
3279  Int_t nGenerators = mch->GetNCocktailHeaders();
3280  if ( nGenerators > 0 ){
3281  for(Int_t igen = 0; igen < nGenerators; igen++)
3282  {
3283  AliGenEventHeader * eventHeaderGen = mch->GetCocktailHeader(igen) ;
3284  TString name = eventHeaderGen->GetName();
3285  if (name.CompareTo("AliGenPythiaEventHeader") == 0 || name.Contains("Pythia8Jets")){
3286  eventAccepted = kTRUE;
3287  eventHeader = eventHeaderGen;
3288  }
3289  }
3290  }
3291  }
3292  }
3293  }
3294  }
3295  if(eventAccepted){
3296  Int_t nTriggerJets = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->NTriggerJets();
3297  Float_t ptHard = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->GetPtHard();
3298  Float_t tmpjet[]={0,0,0,0};
3299  for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){
3300  dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->TriggerJet(ijet, tmpjet);
3301  TParticle jet(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
3302  //Compare jet pT and pt Hard
3303  if(jet.Pt() > fMaxFacPtHard * ptHard){
3304  eventAccepted= kFALSE;
3305  }
3306  //set highest jet pT
3307  if (jet.Pt() > fMaxPtJetMC) fMaxPtJetMC = jet.Pt();
3308  }
3309  // if minimum jet pT compared to pT hard is required, reject event based on it
3310  if(fMaxPtJetMC < fMinFacPtHard * ptHard){
3311  eventAccepted= kFALSE;
3312  }
3313 
3314  if (mcEvent){
3315  for(Long_t i = 0; i < mcEvent->GetNumberOfPrimaries(); i++) {
3316  // TParticle* particle = (TParticle *)mcEvent->Particle(i);
3317  AliMCParticle* particle = (AliMCParticle*) mcEvent->GetTrack(i);
3318  if (!particle) continue;
3319  // if (TMath::Abs(particle->GetPdgCode()) == 111 || TMath::Abs(particle->GetPdgCode()) == 221){
3320  if (particle->Pt() > fMaxFacPtHardSingleParticle*ptHard && TMath::Abs(particle->PdgCode()) > 21){
3321  eventAccepted= kFALSE;
3322  }
3323  // }
3324  }
3325  }
3326 
3328  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3329  21, 28, 36, 45, 57,
3330  70, 85, 99, 115, 132,
3331  150, 169, 190, 212, 235,
3332  1000000};
3333  Double_t weightsBins[20] = { 43.7553, 13.5848, 6.788, 2.67826, 0.975255,
3334  0.39069, 0.127342, 0.0465597, 0.0206539, 0.00750243,
3335  0.00319118, 0.00122291, 0.000641232, 0.000321437, 0.000168273,
3336  9.17033e-05, 5.34755e-05, 3.01354e-05, 1.74518e-05, 2.8004e-05};
3337  Int_t bin = 0;
3338  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3339  if (bin < 20) weight = weightsBins[bin];
3340 
3341  } else if ( fPeriodEnum == kLHC16P1JJ || fPeriodEnum == kLHC17P1JJ){
3342  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3343  21, 28, 36, 45, 57,
3344  70, 85, 99, 115, 132,
3345  150, 169, 190, 212, 235,
3346  1000000};
3347  Double_t weightsBins[20] = { 43.8654, 13.6215, 6.79856, 2.67526, 0.978794,
3348  0.390797, 0.127769, 0.0465714, 0.0206173, 0.00750282,
3349  0.00318773, 0.00122533, 0.000644385, 0.000321225, 0.00016846,
3350  9.18305e-05, 5.33507e-05, 3.00677e-05, 1.74608e-05, 2.80823e-05};
3351 
3352  Int_t bin = 0;
3353  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3354  if (bin < 20) weight = weightsBins[bin];
3355 
3356  } else if ( fPeriodEnum == kLHC16h3 ){
3357  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3358  21, 28, 36, 45, 57,
3359  70, 85, 99, 115, 132,
3360  150, 169, 190, 212, 235,
3361  1000000};
3362  Double_t weightsBins[20] = { 16.0869, 4.61169, 2.14976, 0.782544, 0.264854,
3363  9.7619E-02, 2.92747E-02, 9.89515E-03, 4.05152E-03, 1.35393E-03,
3364  5.29864E-04, 1.88317E-04, 9.23E-05, 4.29E-05, 2.09E-05,
3365  1.06E-05, 5.76E-06, 3.00E-06, 1.62E-06, 2.10E-06 };
3366  Int_t bin = 0;
3367  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3368  if (bin < 20) weight = weightsBins[bin];
3369 
3370 
3371  } else if ( fPeriodEnum == kLHC15a3b || fPeriodEnum == kLHC15g1b ){
3372  Double_t ptHardBinRanges[13] = { 5, 7, 9, 12, 16,
3373  21, 28, 36, 45, 57,
3374  70, 85, 1000};
3375  Double_t weightsBins[12] = { 7.858393e-03, 4.718691e-03, 4.077575e-03, 2.814527e-03, 1.669625e-03,
3376  1.007535e-03, 4.536554e-04, 2.111041e-04, 1.094840e-04, 4.404973e-05,
3377  1.933238e-05, 1.562895e-05};
3378  Int_t bin = 0;
3379  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3380  if (bin < 12) weight = weightsBins[bin];
3381 
3382  } else if ( fPeriodEnum == kLHC15g1a ){
3383  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
3384  84, 117, 152, 191, 1000000,
3385  5, 7, 9, 12, 16,
3386  21, 28, 36, 45, 57 };
3387  Double_t weightsBins[19] = { 4.43629 , 0.49523, 0.0394921, 0.00383174, 0.000446559,
3388  6.37374e-05, 1.03134e-05, 2.27012e-06, 7.59281e-07, 0,
3389  2.62906, 1.12884, 0.656873, 0.262822, 0.0876732,
3390  0.0307759, 0.0087083, 0.0027664, 0.00106203};
3391 
3392  Int_t bin = 0;
3393  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
3394  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
3395  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3396  if (bin < 19) weight = weightsBins[bin];
3397 
3398  } else if ( fPeriodEnum == kLHC15a3a || fPeriodEnum == kLHC15a3a_plus ) {
3399  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
3400  84, 117, 152, 191, 1000000,
3401  5, 7, 9, 12, 16,
3402  21, 28, 36, 45, 57 };
3403  // LHC15a3a
3404  Double_t weightsBins[19] = { 4.43897 , 0.495766, 0.039486, 0.00383011, 0.000447104,
3405  6.37277e-05, 1.03166e-05, 2.26971e-06, 7.59023e-07, 0,
3406  2.63331, 1.12815, 0.657034, 0.262756, 0.0877227,
3407  0.0307638, 0.00870635, 0.00276658, 0.00106229};
3408  Int_t bin = 0;
3409  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
3410  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
3411  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3412  if (bin < 19) weight = weightsBins[bin];
3413 
3414  } else if ( fPeriodEnum == kLHC12P2JJ ){
3415  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3416  21, 28, 36, 45, 57,
3417  70, 85, 99, 115, 132,
3418  150, 169, 190, 212, 235,
3419  1000000};
3420  Double_t weightsBins[20] = { 28.3084, 8.43277, 4.07753, 1.54359, 0.543318,
3421  0.208394, 0.0652349, 0.0186904, 0.00834528, 0.00301414,
3422  0.00125939, 0.000474403, 0.000244052, 0.00011924, 6.09838e-05,
3423  3.24148e-05, 1.84314e-05, 1.00926e-05, 5.68632e-06, 8.38092e-06};
3424  Int_t bin = 0;
3425  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3426  if (bin < 20) weight = weightsBins[bin];
3427 
3428  } else if ( fPeriodEnum == kLHC16c3a ){ //ALIROOT-5901
3429  Double_t ptHardBinRanges[6] = { 7, 9, 12, 16, 21, 1000};
3430  Double_t weightsBins[5] = { 6.731200e-03, 7.995602e-03, 6.778717e-03, 4.643571e-03, 6.014497e-03}; //preliminary estimates
3431  Int_t bin = 0;
3432  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3433  if (bin < 5) weight = weightsBins[bin];
3434 
3435  } else if (fPeriodEnum == kLHC16c3b ){ //ALIROOT-5901
3436  Double_t ptHardBinRanges[7] = { 14, 19, 26, 35, 48, 66, 1000};
3437  Double_t weightsBins[6] = { 6.071458e-03, 3.941701e-03, 2.001984e-03, 9.862765e-04, 3.893911e-04, 1.865924e-04}; //preliminary estimates
3438  Int_t bin = 0;
3439  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3440  if (bin < 6) weight = weightsBins[bin];
3441 
3442  } else if (fPeriodEnum == kLHC16c3c ){ //ALIROOT-5901
3443  Double_t ptHardBinRanges[8] = { 0, 5, 11, 21, 36, 57, 84, 1000};
3444  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
3445  Int_t bin = 0;
3446  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3447  if (bin < 7) weight = weightsBins[bin];
3448  } else if ( fPeriodEnum == kLHC14k1a ){
3449  Double_t ptHardBinRanges[7] = { 5, 7, 9, 12, 16,
3450  21, 1000000};
3451  Double_t weightsBins[6] = { 2.327372e-02, 1.783327e-02, 1.678043e-02, 1.167544e-02, 7.066289e-03, 8.714857e-03};
3452  Int_t bin = 0;
3453  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3454  if (bin < 6) weight = weightsBins[bin];
3455  } else if ( fPeriodEnum == kLHC14k1b ){
3456  Double_t ptHardBinRanges[8] = { 10, 14, 19, 26, 35,
3457  48, 66, 1000000};
3458  Double_t weightsBins[7] = { 6.174824e-04 , 6.557521e-04 , 6.472503e-04 , 4.857432e-04 , 3.402152e-04 , 1.873434e-04 , 1.376054e-04 };
3459  Int_t bin = 0;
3460  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3461  if (bin < 7) weight = weightsBins[bin];
3462  } else if ( fPeriodEnum == kLHC13b4_fix || fPeriodEnum == kLHC13b4_plus ){
3463  Double_t ptHardBinRanges[11] = { 5, 11, 21, 36, 57,
3464  84, 117, 152, 191, 234,
3465  1000};
3466  Double_t weightsBins[10] = { 2.24185e-6 , 2.48463e-7, 2.23171e-8, 2.43667e-9, 3.29934e-10,
3467  5.34592e-11, 1.00937e-11, 2.6493e-12, 8.53912e-13, 5.43077e-13};
3468  Int_t bin = 0;
3469  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3470  if (bin < 10) weight = weightsBins[bin];
3471  } else if ( fPeriodEnum == kLHC17g8a ){ // preliminary weights obtained from local running
3472  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16, 21, 28, 36, 45, 57, 70, 85, 99, 115, 132, 150, 169, 190, 212, 235, 10000};
3473  Double_t weightsBins[20] = {1.565930E+01, 4.598350E+00, 2.081240E+00, 7.744650E-01, 2.644240E-01, 1.002330E-01, 2.979190E-02, 9.696490E-03, 3.950930E-03, 1.333040E-03, 5.210630E-04, 1.927180E-04, 9.235930E-05, 4.346820E-05, 2.120660E-05, 1.073260E-05, 5.701210E-06, 3.047490E-06, 1.664780E-06, 2.123400E-06};
3474  Int_t bin = 0;
3475  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3476  if (bin < 20) weight = weightsBins[bin];
3477  } else if ( fPeriodEnum == kLHC16rP1JJ ){ // preliminary weights obtained from local running
3478  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16, 21, 28, 36, 45, 57, 70, 85, 99, 115, 132, 150, 169, 190, 212, 235, 10000};
3479  Double_t weightsBins[20] = {2.723740E+01, 8.127540E+00, 3.934400E+00, 1.492720E+00, 5.268010E-01, 2.033790E-01, 6.361520E-02, 2.256080E-02, 9.638840E-03, 3.372890E-03, 1.381980E-03, 5.121390E-04, 2.613120E-04, 1.260940E-04, 6.393150E-05, 3.386080E-05, 1.926040E-05, 1.046950E-05, 5.895950E-06, 8.658420E-06};
3480  Int_t bin = 0;
3481  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3482  if (bin < 20) weight = weightsBins[bin];
3483  } else if ( fPeriodEnum == kLHC16sP1JJ ){ // preliminary weights obtained from local running
3484  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16, 21, 28, 36, 45, 57, 70, 85, 99, 115, 132, 150, 169, 190, 212, 235, 10000};
3485  Double_t weightsBins[20] = {2.716550E+01, 8.121430E+00, 3.932100E+00, 1.492830E+00, 5.272190E-01, 2.023090E-01, 6.371860E-02, 2.245360E-02, 9.590340E-03, 3.369300E-03, 1.384470E-03, 5.119390E-04, 2.606910E-04, 1.259110E-04, 6.408650E-05, 3.396290E-05, 1.917340E-05, 1.044610E-05, 5.882680E-06, 8.672390E-06};
3486  Int_t bin = 0;
3487  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3488  if (bin < 20) weight = weightsBins[bin];
3489  } else if ( fPeriodEnum == kLHC17i3a1 ){ // weights obtained from ga_pp_mc_aod train 912
3490  Double_t ptHardBinRanges[7] = { 5, 11, 21, 36, 57, 84, 10000};
3491  Double_t weightsBins[6] = { 0.0002181, 3.13684e-05, 5.01515e-06, 9.50662e-07, 2.08186e-07, 7.96555e-08};
3492  Int_t bin = 0;
3493  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3494  if (bin < 6) weight = weightsBins[bin];
3495  } else if ( fPeriodEnum == kLHC17i3c1 ){ // preliminary weights obtained from local running
3496  Double_t ptHardBinRanges[9] = { 8, 10, 14, 19, 26, 35, 48, 66, 10000};
3497  Double_t weightsBins[8] = { 0.000813592, 0.00172074, 0.00187963, 0.00184331, 0.00142672, 0.0010083, 0.000599846, 0.000499877};
3498  Int_t bin = 0;
3499  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3500  if (bin < 8) weight = weightsBins[bin];
3501  } else if ( fPeriodEnum == kLHC18b8 ){
3502  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16, 21, 28, 36, 45, 57, 70, 85, 99, 115, 132, 150, 169, 190, 212, 235, 10000};
3503  Double_t weightsBins[20] = { 16.1083, 4.60917, 2.15196, 0.782021, 0.26541,
3504  0.0978374, 0.0294286, 0.00989457, 0.0040615, 0.00135787,
3505  0.000531766, 0.000188772, 9.23331e-05, 4.30245e-05, 2.10196e-05,
3506  1.06695e-05, 5.78742e-06, 3.02897e-06, 1.62702e-06, 2.12118e-06 };
3507 
3508  Int_t bin = 0;
3509  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3510  if (bin < 20) weight = weightsBins[bin];
3511  } else {
3512  weight = 1;
3513  }
3514 
3515  if (weight == -1) return kFALSE;
3516  else return eventAccepted;
3517 
3518  } else {
3519  return kFALSE;
3520  }
3521  }
3522 
3523  return kFALSE;
3524 }
3525 
3526 //________________________________________________________________________
3527 // Analysing Jet-Jet MC's
3528 //________________________________________________________________________
3529 void AliConvEventCuts::GetXSectionAndNTrials(AliMCEvent *mcEvent, Float_t &XSection, Float_t &NTrials, AliVEvent* event){
3530 
3531  AliGenCocktailEventHeader *cHeader = 0x0;
3532  Bool_t headerFound = kFALSE;
3533  if ( fPeriodEnum != kLHC18b8 && // LHC17pq pp 5TeV JetJet MC's
3534  fPeriodEnum != kLHC17i3a1 && // LHC16ijklop GammaJet MC EMCal triggered
3535  fPeriodEnum != kLHC17i3c1 && // LHC16ijklop JetJet MC EMCal triggered
3536  fPeriodEnum != kLHC17g8a && // LHC16qt pPb 5TeV JetJet MC's
3537  fPeriodEnum != kLHC16rP1JJ && fPeriodEnum != kLHC16sP1JJ && // LHC16sr pPb 8TeV JetJet MC's
3538  fPeriodEnum != kLHC16P1JJ && fPeriodEnum != kLHC16P1JJLowB && // LHC16X Jet Jet MC's
3539  fPeriodEnum != kLHC17P1JJ && fPeriodEnum != kLHC17P1JJLowB && // LHC17X Jet Jet MC's
3540  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
3541  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
3542  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
3543  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
3544  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
3545  fPeriodEnum != kLHC12P2JJ && // LHC12 JetJet MC
3546  fPeriodEnum != kLHC18b11a && // LHC18 GammaJet MC anchored to LHC15o
3547  fPeriodEnum != kLHC18b11b && // LHC18 GammaJet MC anchored to LHC15o
3548  fPeriodEnum != kLHC18b11c && // LHC18 GammaJet MC anchored to LHC15o
3549  fPeriodEnum != kLHC14k1a && fPeriodEnum != kLHC14k1b // LHC11 JetJet MC
3550  ){
3551  NTrials = -1;
3552  XSection = -1;
3553  return;
3554  }
3555 
3556  if(mcEvent){
3557  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
3558  if(cHeader) headerFound = kTRUE;
3559  }else{
3560  //no mcEvent available -> not running on MC
3561  NTrials = -1;
3562  XSection = -1;
3563  return;
3564  }
3565 
3566  if(headerFound){
3567  TList *genHeaders = 0x0;
3568  if(cHeader) genHeaders = cHeader->GetHeaders();
3569  AliGenEventHeader* gh = 0;
3570  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3571  gh = (AliGenEventHeader*)genHeaders->At(i);
3572  TString GeneratorName = gh->GetName();
3573  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0 || GeneratorName.Contains("Pythia8Jets")){
3574  AliGenPythiaEventHeader* gPythia = dynamic_cast<AliGenPythiaEventHeader*>(gh);
3575  NTrials = gPythia->Trials();
3576  XSection = gPythia->GetXsection();
3577  return;
3578  }
3579  }
3580  } else {
3581  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
3582  if(eventHeader){
3583  TString eventHeaderName = eventHeader->ClassName();
3584  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0 || eventHeaderName.Contains("Pythia8Jets")){
3585  AliGenPythiaEventHeader* gPythia = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader);
3586  NTrials = gPythia->Trials();
3587  XSection = gPythia->GetXsection();
3588  return;
3589  }
3590  }
3591  }
3592  // the following part is necessary for pythia8jets embedded in EPOS for AODs
3593  if(event){
3594  if(event->IsA()==AliAODEvent::Class()){
3595  AliAODMCHeader *mch = NULL;
3596  AliAODEvent * aod = dynamic_cast<AliAODEvent*> (event);
3597  if(aod){
3598  mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader"));
3599  if ( mch ){
3600  Int_t nGenerators = mch->GetNCocktailHeaders();
3601  if ( nGenerators > 0 ){
3602  for(Int_t igen = 0; igen < nGenerators; igen++){
3603  AliGenEventHeader * eventHeaderGen = mch->GetCocktailHeader(igen) ;
3604  TString name = eventHeaderGen->GetName();
3605  if (name.CompareTo("AliGenPythiaEventHeader") == 0 || name.Contains("Pythia8Jets") || name.Contains("Pythia8GammaJet")){
3606  AliGenPythiaEventHeader* gPythia = dynamic_cast<AliGenPythiaEventHeader*>(eventHeaderGen);
3607  NTrials = gPythia->Trials();
3608  XSection = gPythia->GetXsection();
3609  return;
3610  }
3611  }
3612  }
3613  }
3614  }
3615  }
3616  }
3617 
3618  NTrials = -1;
3619  XSection = -1;
3620  return;
3621 }
3622 
3623 
3624 //________________________________________________________________________
3625 // Analysing Jet-Jet MC's
3626 //________________________________________________________________________
3627 Float_t AliConvEventCuts::GetPtHard(AliMCEvent *mcEvent, AliVEvent* event){
3628  AliGenCocktailEventHeader *cHeader = 0x0;
3629  Bool_t headerFound = kFALSE;
3630 
3631  if ( fPeriodEnum != kLHC18b8 && // LHC17pq pp 5TeV JetJet MC's
3632  fPeriodEnum != kLHC17g8a && // LHC16qt pPb 5TeV JetJet MC's
3633  fPeriodEnum != kLHC16rP1JJ && fPeriodEnum != kLHC16sP1JJ && // LHC16sr pPb 8TeV JetJet MC's
3634  fPeriodEnum != kLHC16P1JJ && fPeriodEnum != kLHC16P1JJLowB && // LHC16X Jet Jet MC's
3635  fPeriodEnum != kLHC17P1JJ && fPeriodEnum != kLHC17P1JJLowB && // LHC17X Jet Jet MC's
3636  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
3637  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
3638  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
3639  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
3640  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
3641  fPeriodEnum != kLHC12P2JJ && // LHC12 JetJet MC
3642  fPeriodEnum != kLHC14k1a && fPeriodEnum != kLHC14k1b // LHC11 JetJet MC
3643  ) return -1;
3644 
3645  if(mcEvent){
3646  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
3647  if(cHeader) headerFound = kTRUE;
3648  }else{
3649  //no mcEvent available -> not running on MC
3650  return -1;
3651  }
3652 
3653  if(headerFound){
3654  TList *genHeaders = 0x0;
3655  if(cHeader) genHeaders = cHeader->GetHeaders();
3656  AliGenEventHeader* gh = 0;
3657  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3658  gh = (AliGenEventHeader*)genHeaders->At(i);
3659  TString GeneratorName = gh->GetName();
3660  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0 || GeneratorName.Contains("Pythia8Jets")){
3661  return dynamic_cast<AliGenPythiaEventHeader*>(gh)->GetPtHard();
3662  }
3663  }
3664  } else {
3665  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
3666  if(eventHeader){
3667  TString eventHeaderName = eventHeader->ClassName();
3668  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0 || eventHeaderName.Contains("Pythia8Jets")){
3669  return dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->GetPtHard();
3670  }
3671  }
3672 
3673  if(event->IsA()==AliAODEvent::Class()){
3674  AliAODMCHeader *mch = NULL;
3675  AliAODEvent * aod = dynamic_cast<AliAODEvent*> (event);
3676  if(aod){
3677  mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader"));
3678  if ( mch ){
3679  Int_t nGenerators = mch->GetNCocktailHeaders();
3680  if ( nGenerators > 0 ){
3681  for(Int_t igen = 0; igen < nGenerators; igen++)
3682  {
3683  AliGenEventHeader * eventHeaderGen = mch->GetCocktailHeader(igen) ;
3684  TString name = eventHeaderGen->GetName();
3685  if (name.CompareTo("AliGenPythiaEventHeader") == 0 || name.Contains("Pythia8Jets")){
3686  return dynamic_cast<AliGenPythiaEventHeader*>(eventHeaderGen)->GetPtHard();
3687  }
3688  }
3689  }
3690  }
3691  }
3692  }
3693  }
3694 
3695  return -1;
3696 }
3697 
3698 
3699 //________________________________________________________________________
3701  // abort if mimicing not enabled
3702 
3703  if (!fMimicTrigger) return kTRUE;
3704 
3705  Int_t runRangesEMCalL0 [52] = { 144871, 145288, 146375, 146382, // LHC11a
3706  146502, 148522, // LHC11a
3707  150209, 153056, 153911, 153915, // LHC11b,c,d
3708  158135, 158136, 158178, 158182, 160683,
3709  160764, 161139, 161256, 161379, 161457,
3710  161525, 161556, 161558, 161609, 161630,
3711  161724, // LHC11d,e
3712  173731, 177144, 177147, 177653, 177724, 178327, // LHC12x
3713  195180, // LHC13b-f
3714  197469, 197692, // LHC13g
3715  235195, // LHC15a-h
3716  244285, // LHC15i-LHC15m (235196-244284)
3717  244629, // LHC15n (244340-244628)
3718  245141, 246995, // LHC15o (244824-246994)
3719  255539, // LHC16i-k (255515-258574)
3720  258883, // LHC16l (258883-260187)
3721  260216, // LHC16m-p (260216-p)
3722  265015, 265309, // LHC16q (265015-265525)
3723  265589, 265785, // LHC16r (265589-266318)
3724  266405, // LHC16s (266405-267131)
3725  267161, // LHC16t (267161-267166)
3726  270531, // LHC17c-o (270531-281961)
3727  282008, // LHC17pq (282008-282441)
3728  282504 // 2018
3729  };
3730 
3731  Double_t thresholdEMCalL0[51] = { 2.11, 3.43, 1.71, 2.05, // LHC11a 7 TeV
3732  3.43, // LHC11a 2.76TeV
3733  1.94, 3.39, 4.01, 5.25, 5.5, // LHC11b, LHC11c, LHC11d
3734  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,
3735  2.01, 1.75, 1.52, 2.01, 1.52, 1.85,
3736  3.2,
3737  /*2.01*/1.8, // LHC13g
3738  2000, // LS1
3739  1.8, // LHC15a-h
3740  5.0, // LHC15i-m
3741  5.0, // LHC15n
3742  1.0, 1.0, // LHC15o
3743  2.2, // LHC16i-k (255515-258574)
3744  2.2, // LHC16l (258883-260187)
3745  2.5, // LHC16m-p (260216-p)
3746  2.5, 2.5, // LHC16q (265015-265525)
3747  2.5, 2.5, // LHC16r (265589-266318)
3748  3.5, // LHC16s (266405-267131)
3749  2.5, // LHC16t (267161-267166)
3750  2.5, // LHC17c-o (270531-281961)
3751  2.5 // LHC17pq (282008-282441)
3752 // 2.5 // 2018
3753  };
3754 
3755  Double_t spreadEMCalL0[51] = { 0., 0., 0, 0, // LHC11a 7TeV
3756  /*0.7*/0.65, // LHC11a 2.76TeV
3757  0., 0., 0., 0., 0., // LHC11b, LHC11c, LHC11d
3758  0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
3759  0., 0., 0., 0., 0.2, 0.2,/*0.,0.,*/
3760  0.1, // LHC13b-f
3761  /*0.1*/0.12, // LHC13g
3762  0., // LS1
3763  0.1, // LHC15a-h
3764  0.1, // LHC15i-m
3765  0.1, // LHC15n
3766  0.1, 0.1, // LHC15o
3767  0.2, // LHC16i-k (255515-258574)
3768  0.2, // LHC16l (258883-260187)
3769  0.1, // LHC16m-p (260216-p)
3770  0.1, 0.1, // LHC16q (265015-265525)
3771  0.1, 0.1, // LHC16r (265589-266318)
3772  0.1, // LHC16s (266405-267131)
3773  0.1, // LHC16t (267161-267166)
3774  0.1, // LHC17c-o (270531-281961)
3775  0.1 // LHC17pq (282008-282441)
3776 // 0.1 // 2018
3777  };
3778 
3779  Int_t runRangesEMCalL1[21] = { 179796, // LHC12c-i (EGA)
3780  195180, // LHC13b-f
3781  197469, 197692, // LHC13g
3782  235195, // LHC15a-h
3783  244285, // LHC15i-LHC15m (235196-244284)
3784  244629, // LHC15n (244340-244628)
3785  245141, 246995, // LHC15o (244824-246994)
3786  255539, // LHC16i-k (255515-258574)
3787  258883, // LHC16l (258883-260187)
3788  260216, // LHC16m-p (260216-p)
3789  265015, 265309, // LHC16q (265015-265525)
3790  265589, 265785, // LHC16r (265589-266318)
3791  266405, // LHC16s (266405-267131)
3792  267161, // LHC16t (267161-267166)
3793  270531, // LHC17c-o (270531-281961)
3794  282008, // LHC17pq (282008-282441)
3795  282504 // 2018
3796  };
3797 
3798  Double_t thresholdEMCalL1[20] = { 9.5/*8.398*/, // LHC12c-i (EGA)
3799  11.5, /*6.*/ // LHC13b-f
3800  5.5, // LHC13g
3801  2000.0, // LS1
3802  2000.0, // LHC15a-h
3803  5.0, // LHC15i-m
3804  5.0, // LHC15n
3805  2000.0, 10.0, // LHC15o
3806  8.8, // LHC16i-k (255515-258574)
3807  5.5, // LHC16l (258883-260187)
3808  8.8, // LHC16m-p (260216-)
3809  8.8, 10.8, // LHC16q (265015-265525)
3810  10.8, 7.8, // LHC16r (265589-266318)
3811  7.8, // LHC16s (266405-267131)
3812  7.8, // LHC16t (267161-267166)
3813  8.8, // LHC17c-o (270531-281961)
3814  8.8 // LHC17pq (282008-282441)
3815 // 8.8 // 2018
3816  };
3817  Double_t spreadEMCalL1[20] = { 1.0/*0.*/,
3818  0.5,
3819  /*0.4*/ 0.6,
3820  0.0, // LS1
3821  1.2, 0.8, // LHC16r (265589-266318)
3822  0.0, // LHC15a-h
3823  1.0, // LHC15i-m
3824  1.0, // LHC15n
3825  0.0, 1.0, // LHC15o
3826  1.0, // LHC16i-k (255515-258574)
3827  0.8, // LHC16l (258883-260187)
3828  1.0, // LHC16m-p (260216-)
3829  1.0, 1.2, // LHC16q (265015-265525)
3830  0.9, // LHC16s (266405-267131)
3831  0.9, // LHC16t (267161-267166)
3832  1.0, // LHC17c-o (270531-281961)
3833  1.0 // LHC17pq (282008-282441)
3834 // 1.0 // 2018
3835  };
3836 
3837  Int_t runRangesEMCalL1G2[21] = { 195180, // LHC13b-f
3838  197469, 197692, // LHC13g
3839  235195, // LHC15a-h
3840  244285, // LHC15i-LHC15m (235196-244284)
3841  244629, // LHC15n (244340-244628)
3842  245141, 246995, // LHC15o (244824-246994)
3843  255539, // LHC16i-k (255515-258574)
3844  258883, // LHC16l (258883-260187)
3845  260216, // LHC16m-p (260216-)
3846  265015, 265309, // LHC16q (265015-265525)
3847  265589, 265785, // LHC16r (265589-266318)
3848  266405, // LHC16s (266405-267131)
3849  267161, // LHC16t (267161-267166)
3850  270531, // LHC17c-o (270531-281961)
3851  282008, // LHC17pq (282008-282441)
3852  282504 // 2018
3853  };
3854 
3855  Double_t thresholdEMCalL1G2[19] = { 7.2, // LHC13b-f
3856  /*3.9*/3.75, // LHC13g
3857  2000.0, // LS1
3858  1.8, // LHC15a-h
3859  5.0, // LHC15i-m
3860  5.0, // LHC15n
3861  2000.0, 2000.0, // LHC15o
3862  3.9, // LHC16i-k (255515-258574)
3863  3.8, // LHC16l (258883-260187)
3864  3.9, // LHC16m-p (260216-)
3865  3.9, 6.3, // LHC16q (265015-265525)
3866  6.3, 5.3, // LHC16r (265589-266318)
3867  5.3, // LHC16s (266405-267131)
3868  5.3, // LHC16t (267161-267166)
3869  3.9, // LHC17c-o (270531-281961)
3870  3.9 // LHC17pq (282008-282441)
3871 // 3.9 // 2018
3872  };
3873  Double_t spreadEMCalL1G2[19] = { 0.3, // LHC13bf
3874  /*0.2*/0.25, // LHC13g
3875  0., // LS1
3876  0.1, // LHC15a-h
3877  0.1, // LHC15i-m
3878  0.1, // LHC15n
3879  0.1, 1.0, // LHC15o
3880  0.3, // LHC16i-k (255515-258574)
3881  0.3, // LHC16l (258883-260187)
3882  0.3, // LHC16m-p (260216-)
3883  0.3, 0.4, // LHC16q (265015-265525)
3884  0.4, 0.3, // LHC16r (265589-266318)
3885  0.3, // LHC16s (266405-267131)
3886  0.3, // LHC16t (267161-267166)
3887  0.3, // LHC17c-o (270531-281961)
3888  0.3 // LHC17pq (282008-282441)
3889 // 0.3 // 2018
3890  };
3891 
3892  Int_t runnumber = event->GetRunNumber();
3893 
3894  if (fSpecialTrigger == 5 ){
3895  if (runnumber < runRangesEMCalL0[0]) return kTRUE;
3896  Int_t binRun = 0;
3897  while (!(runnumber >= runRangesEMCalL0[binRun] && runnumber < runRangesEMCalL0[binRun+1] ) && binRun < 51 ){
3898 // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL0[binRun] << "\t" << runRangesEMCalL0[binRun+1] << ":\t"<< thresholdEMCalL0[binRun] << "\t" << spreadEMCalL0[binRun] << endl;
3899  binRun++;
3900  }
3901  if (binRun==51) return kFALSE;
3902 // cout << runnumber << "\t"<< binRun << "\t"<< thresholdEMCalL0[binRun] << "\t" << spreadEMCalL0[binRun] << endl;
3903  Double_t threshold = thresholdEMCalL0[binRun];
3904 
3905  if (isMC && spreadEMCalL0[binRun] != 0.){
3906  TF1* triggerSmearing = new TF1("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
3907  triggerSmearing->SetParameter(0, 1/(spreadEMCalL0[binRun]*TMath::Sqrt(TMath::Pi()*2)));
3908  triggerSmearing->SetParameter(1, thresholdEMCalL0[binRun]);
3909  triggerSmearing->SetParameter(2, spreadEMCalL0[binRun]);
3910  threshold = triggerSmearing->GetRandom();
3911  delete triggerSmearing;
3912  }
3913 
3914 // cout << "modified" << "\t"<< threshold << endl;
3915  Int_t nclus = 0;
3916  TClonesArray * arrClustersMimic = NULL;
3917  if(!fCorrTaskSetting.CompareTo("")){
3918  nclus = event->GetNumberOfCaloClusters();
3919  } else {
3920  arrClustersMimic = dynamic_cast<TClonesArray*>(event->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
3921  if(!arrClustersMimic)
3922  AliFatal(Form("%sClustersBranch was not found in AliConvEventCuts! Check the correction framework settings!",fCorrTaskSetting.Data()));
3923  nclus = arrClustersMimic->GetEntries();
3924  }
3925 
3926  if(nclus == 0) return kFALSE;
3927 
3928  // Loop over EMCal clusters
3929  Bool_t eventIsAccepted = kFALSE;
3930  for(Int_t i = 0; i < nclus; i++){
3931  if (eventIsAccepted) continue;
3932  AliVCluster* clus = NULL;
3933  if(event->IsA()==AliESDEvent::Class()){
3934  if(arrClustersMimic)
3935  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersMimic->At(i));
3936  else
3937  clus = event->GetCaloCluster(i);
3938  } else if(event->IsA()==AliAODEvent::Class()){
3939  if(arrClustersMimic)
3940  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersMimic->At(i));
3941  else
3942  clus = event->GetCaloCluster(i);
3943  }
3944 
3945  if (!clus){
3946  if(arrClustersMimic) delete clus;
3947  continue;
3948  }
3949  if (!clus->IsEMCAL()) {
3950  if(arrClustersMimic) delete clus;
3951  continue;
3952  }
3953  if (clus->GetM02()<0.1) {
3954  if(arrClustersMimic) delete clus;
3955  continue;
3956  }
3957  if (clus->GetNCells()<2) {
3958  if(arrClustersMimic) delete clus;
3959  continue;
3960  }
3961  if (clus->E() > threshold ){
3962 // cout << "found L0" << endl;
3963  eventIsAccepted = kTRUE;
3964  }
3965  if(arrClustersMimic)
3966  delete clus;
3967  }
3968  return eventIsAccepted;
3969 
3970  } else if (fSpecialTrigger == 6 ) {
3971 
3972  return kTRUE;
3973  } else if (fSpecialTrigger == 8 || fSpecialTrigger == 10 ) {
3974  if (fSpecialSubTriggerName.CompareTo("7EGA")==0 || fSpecialSubTriggerName.CompareTo("8EGA")==0 || fSpecialSubTriggerName.CompareTo("7EG1")==0 ||fSpecialSubTriggerName.CompareTo("8EG1")==0 ){
3975  if (runnumber < runRangesEMCalL1[0]) return kTRUE;
3976  Int_t binRun = 0;
3977  while (!(runnumber >= runRangesEMCalL1[binRun] && runnumber < runRangesEMCalL1[binRun+1] ) && binRun < 20 ){
3978 // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL1[binRun] << "\t" << runRangesEMCalL1[binRun+1] << ":\t"<< thresholdEMCalL1[binRun]<<"\t"<< spreadEMCalL1[binRun]<< endl;
3979  binRun++;
3980  }
3981  if (binRun==20) return kFALSE;
3982  Double_t threshold = thresholdEMCalL1[binRun];
3983 
3984  if (isMC && spreadEMCalL1[binRun] != 0.){
3985  TF1 triggerSmearing("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
3986  triggerSmearing.SetParameter(0, 1/(spreadEMCalL1[binRun]*TMath::Sqrt(TMath::Pi()*2)));
3987  triggerSmearing.SetParameter(1, thresholdEMCalL1[binRun]);
3988  triggerSmearing.SetParameter(2, spreadEMCalL1[binRun]);
3989  threshold = triggerSmearing.GetRandom();
3990  }
3991 
3992 // cout << runnumber << "\t"<< binRun << "\t L1 \t"<< threshold << endl;
3993 
3994  TClonesArray * arrClustersMimic = NULL;
3995  Int_t nclus = 0;
3996  if(!fCorrTaskSetting.CompareTo("")){
3997  nclus = event->GetNumberOfCaloClusters();
3998  } else {
3999  arrClustersMimic = dynamic_cast<TClonesArray*>(event->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
4000  if(!arrClustersMimic)
4001  AliFatal(Form("%sClustersBranch was not found in AliConvEventCuts! Check the correction framework settings!",fCorrTaskSetting.Data()));
4002  nclus = arrClustersMimic->GetEntries();
4003  }
4004 
4005  if(nclus == 0) return kFALSE;
4006 
4007  // Loop over EMCal clusters
4008  Bool_t eventIsAccepted = kFALSE;
4009  for(Int_t i = 0; i < nclus; i++){
4010  if (eventIsAccepted) continue;
4011  AliVCluster* clus = NULL;
4012  std::unique_ptr<AliVCluster> tmpcluster; // takes care about deleting clusters constructed with new
4013  if(event->IsA()==AliESDEvent::Class()){
4014  if(arrClustersMimic){
4015  tmpcluster = std::unique_ptr<AliVCluster>(new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersMimic->At(i)));
4016  clus = tmpcluster.get();
4017  } else
4018  clus = event->GetCaloCluster(i);
4019  } else if(event->IsA()==AliAODEvent::Class()){
4020  if(arrClustersMimic) {
4021  tmpcluster = std::unique_ptr<AliVCluster>(new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersMimic->At(i)));
4022  clus = tmpcluster.get();
4023  }
4024  else
4025  clus = event->GetCaloCluster(i);
4026  }
4027  if (!clus) {
4028  continue;
4029  }
4030  if (!clus->IsEMCAL()) {
4031  continue;
4032  }
4033  if (clus->GetM02()<0.1) {
4034  continue;
4035  }
4036  if (clus->GetNCells()<2) {
4037  continue;
4038  }
4039  if (clus->E() > threshold ){
4040 // cout << "found L1G1\t" << clus->E() << endl;
4041  eventIsAccepted = kTRUE;
4042  }
4043  }
4044  return eventIsAccepted;
4045  } else if ( fSpecialSubTriggerName.CompareTo("7EG2")==0 ||fSpecialSubTriggerName.CompareTo("8EG2")==0 ){
4046  if (runnumber < runRangesEMCalL1G2[0]) return kTRUE;
4047  Int_t binRun = 0;
4048  while (!(runnumber >= runRangesEMCalL1G2[binRun] && runnumber < runRangesEMCalL1G2[binRun+1] ) && binRun < 19 ){
4049 // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL1G2[binRun] << "\t" << runRangesEMCalL1G2[binRun+1] << ":\t"<< thresholdEMCalL1G2[binRun]<<"\t"<< spreadEMCalL1G2[binRun]<< endl;
4050  binRun++;
4051  }
4052 // cout << runnumber << "\t"<< binRun << "\t L2 \t"<< thresholdEMCalL1G2[binRun]<<"\t"<< spreadEMCalL1G2[binRun]<< endl;
4053  if (binRun==19) return kFALSE;
4054  Double_t threshold = thresholdEMCalL1G2[binRun];
4055  if (isMC && spreadEMCalL1G2[binRun] != 0.){
4056  TF1 triggerSmearing("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
4057  triggerSmearing.SetParameter(0, 1/(spreadEMCalL1G2[binRun]*TMath::Sqrt(TMath::Pi()*2)));
4058  triggerSmearing.SetParameter(1, thresholdEMCalL1G2[binRun]);
4059  triggerSmearing.SetParameter(2, spreadEMCalL1G2[binRun]);
4060  threshold = triggerSmearing.GetRandom();
4061  }
4062 // cout << "\t L2 mod\t"<< threshold << endl;
4063 
4064  Int_t nclus = 0;
4065  TClonesArray * arrClustersMimic = NULL;
4066  if(!fCorrTaskSetting.CompareTo("")){
4067  nclus = event->GetNumberOfCaloClusters();
4068  } else {
4069  arrClustersMimic = dynamic_cast<TClonesArray*>(event->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
4070  if(!arrClustersMimic)
4071  AliFatal(Form("%sClustersBranch was not found in AliConvEventCuts! Check the correction framework settings!",fCorrTaskSetting.Data()));
4072  nclus = arrClustersMimic->GetEntries();
4073  }
4074 
4075  if(nclus == 0) return kFALSE;
4076 
4077  // Loop over EMCal clusters
4078  Bool_t eventIsAccepted = kFALSE;
4079  for(Int_t i = 0; i < nclus; i++){
4080  if (eventIsAccepted) continue;
4081  AliVCluster* clus = NULL;
4082  std::unique_ptr<AliVCluster> tmpcluster; // takes care about deleting clusters constructed with new
4083  if(event->IsA()==AliESDEvent::Class()){
4084  if(arrClustersMimic){
4085  tmpcluster = std::unique_ptr<AliVCluster>(new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersMimic->At(i)));
4086  clus = tmpcluster.get();
4087  }
4088  else
4089  clus = event->GetCaloCluster(i);
4090  } else if(event->IsA()==AliAODEvent::Class()){
4091  if(arrClustersMimic) {
4092  tmpcluster = std::unique_ptr<AliVCluster>(new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersMimic->At(i)));
4093  clus = tmpcluster.get();
4094  }
4095  else
4096  clus = event->GetCaloCluster(i);
4097  }
4098  if (!clus) {
4099  continue;
4100  }
4101  if (!clus->IsEMCAL()) {
4102  continue;
4103  }
4104  if (clus->GetM02()<0.1) {
4105  continue;
4106  }
4107  if (clus->GetNCells()<2) {
4108  continue;
4109  }
4110  if (clus->E() > threshold ){
4111 // cout << "found L1G2" << endl;
4112  eventIsAccepted = kTRUE;
4113  }
4114  }
4115  return eventIsAccepted;
4116  }
4117  return kTRUE;
4118  } else if (fSpecialTrigger == 9 ) {
4119  return kTRUE;
4120  } else {
4121  return kTRUE;
4122  }
4123 
4124  return kTRUE;
4125 }
4126 
4127 
4128 //________________________________________________________________________
4130 {
4131 
4132  AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
4133 
4134 
4135  UInt_t isSelected = AliVEvent::kAny;
4136 
4137  if (fInputHandler==NULL) return kFALSE;
4138  if( fInputHandler->GetEventSelection() || event->IsA()==AliAODEvent::Class()) {
4139 
4140  TString firedTrigClass = event->GetFiredTriggerClasses();
4141  // if no trigger has been selected manually, select kAny in case of presel (also important for AOD filtering!)
4142  // in other cases select standards depending on system
4144  if (fPreSelCut) fOfflineTriggerMask = AliVEvent::kAny;
4145  else {
4146  if (fIsHeavyIon == 1){
4147  fOfflineTriggerMask = AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral;
4148  } else if (fIsHeavyIon == 2){
4149  fOfflineTriggerMask = AliVEvent::kINT7;
4150  } else {
4151  fOfflineTriggerMask = AliVEvent::kMB;
4152  }
4153  }
4154  }
4155 
4156  // in case of MC switch to kAny if no MB/INT7/INT8 has been selected
4157  if(isMC){
4158  if( fIsHeavyIon == 0){
4159  if( fOfflineTriggerMask != AliVEvent::kMB && fOfflineTriggerMask != AliVEvent::kINT7 && fOfflineTriggerMask != AliVEvent::kINT8 ){
4160  fOfflineTriggerMask = AliVEvent::kAny;
4161  }
4162  }else{
4163  fOfflineTriggerMask = AliVEvent::kAny;
4164  }
4165  }
4166 
4167  // DG event selection; special condition
4168  if ( (fSpecialTrigger == 11) && fTriggerSelectedManually && fSpecialSubTriggerName.CompareTo("CCUP25-B-SPD1-CENTNOTRD") == 0 ) {
4169  if (firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 1;
4170  }
4171 
4172 
4173  if (fOfflineTriggerMask){
4174  isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
4175  if (isSelected && !fPreSelCut){
4176 // cout << firedTrigClass.Data() << endl;
4177 // cout << "Special trigger: "<< fSpecialTrigger << " initialized " << fEMCALTrigInitialized << endl;
4178 // if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9){ // EMCAL triggers
4179 // if (!fEMCALTrigInitialized ) InitializeEMCALTrigger(event);
4180 // fTriggersEMCAL= GetTriggerList();
4181 // }
4182  if (fSpecialSubTrigger>0 && !isMC){
4183  if(fNSpecialSubTriggerOptions==2){ // in case two special triggers are available
4184  if (!firedTrigClass.Contains(fSpecialSubTriggerName.Data()) && !firedTrigClass.Contains(fSpecialSubTriggerNameAdditional.Data())) isSelected = 0;
4185  } else { // standard case for just one trigger
4186  if (!firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 0;
4187  }
4188  if (fRejectTriggerOverlap){
4189  // trigger rejection EMC1,7,8
4190  if (fSpecialTrigger == 5){
4192  // trigger rejection for EMC and DMC triggers together
4193  if (fSpecialSubTriggerName.CompareTo("CEMC7") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("CDMC7") == 0){
4194  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4195  } else if (fSpecialSubTriggerName.CompareTo("CEMC8") == 0 && fSpecialSubTriggerName.CompareTo("CDMC8") == 0){
4196  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4197  }
4198  } else {
4199  // separate rejection for EMC and DMC triggers
4200  if( fSpecialSubTriggerName.CompareTo("CEMC7") == 0){
4201  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4202  } else if (fSpecialSubTriggerName.CompareTo("CEMC1") == 0){
4203  if (fInputHandler->IsEventSelected() & AliVEvent::kMB) isSelected = 0;
4204  } else if (fSpecialSubTriggerName.CompareTo("CEMC8") == 0){
4205  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4206  } else if (fSpecialSubTriggerName.CompareTo("CDMC7") == 0){
4207  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4208  } else if (fSpecialSubTriggerName.CompareTo("CDMC1") == 0){
4209  if (fInputHandler->IsEventSelected() & AliVEvent::kMB) isSelected = 0;
4210  } else if (fSpecialSubTriggerName.CompareTo("CDMC8") == 0){
4211  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4212  }
4213  }
4214  }
4215  // gamma triggers -> no overlap with L0 and MB trigger required
4216  if (fSpecialTrigger == 8){
4217  // trigger rejection EGA
4218  if( fSpecialSubTriggerName.CompareTo("7EGA") == 0){
4219  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4220  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4221  } else if (fSpecialSubTriggerName.CompareTo("8EGA") == 0){
4222  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4223  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4224  } else if (fSpecialSubTriggerName.CompareTo("7DGA") == 0){
4225  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4226  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4227  } else if (fSpecialSubTriggerName.CompareTo("8DGA") == 0){
4228  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4229  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4230  }
4231  // trigger rejection EG1 & EG2
4232  // EG1 is the trigger with the highest threshold
4234  // trigger rejection for EMC and DMC triggers together
4235  if (fSpecialSubTriggerName.CompareTo("7EG1") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("7DG1") == 0){
4236  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4237  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4238  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
4239  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
4240  } else if (fSpecialSubTriggerName.CompareTo("8EG1") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("8DG1") == 0){
4241  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4242  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4243  if (firedTrigClass.Contains("8EG2")) isSelected = 0;
4244  if (firedTrigClass.Contains("8DG2")) isSelected = 0;
4245  } else if (fSpecialSubTriggerName.CompareTo("7EG2") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("7DG2") == 0){
4246  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4247  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4248  } else if (fSpecialSubTriggerName.CompareTo("8EG2") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("8DG2") == 0){
4249  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4250  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4251  }
4252  } else {
4253  // separate rejection for EMC and DMC triggers
4254  if (fSpecialSubTriggerName.CompareTo("7EG1") == 0){
4255  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4256  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4257  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
4258  } else if (fSpecialSubTriggerName.CompareTo("8EG1") == 0){
4259  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4260  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4261  if (firedTrigClass.Contains("8EG2")) isSelected = 0;
4262  } else if (fSpecialSubTriggerName.CompareTo("7EG2") == 0){
4263  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4264  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4265  } else if (fSpecialSubTriggerName.CompareTo("8EG2") == 0){
4266  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4267  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4268  } else if (fSpecialSubTriggerName.CompareTo("7DG1") == 0){
4269  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4270  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4271  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
4272  } else if (fSpecialSubTriggerName.CompareTo("8DG1") == 0){
4273  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4274  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4275  if (firedTrigClass.Contains("8DG2")) isSelected = 0;
4276  } else if (fSpecialSubTriggerName.CompareTo("7DG2") == 0){
4277  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4278  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4279  } else if (fSpecialSubTriggerName.CompareTo("8DG2") == 0){
4280  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4281  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4282  }
4283  }
4284  }
4285  // jet triggers -> no overlap with gamma trigger and lower triggers required
4286  if (fSpecialTrigger == 9){
4288  // trigger rejection for EMC and DMC triggers together
4289  if (fSpecialSubTriggerName.CompareTo("7EJ1") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("7DJ1") == 0){
4290  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4291  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4292  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
4293  if (firedTrigClass.Contains("7EG1")) isSelected = 0;
4294  if (firedTrigClass.Contains("7EJ2")) isSelected = 0;
4295  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
4296  if (firedTrigClass.Contains("7DG1")) isSelected = 0;
4297  if (firedTrigClass.Contains("7DJ2")) isSelected = 0;
4298  } else if (fSpecialSubTriggerName.CompareTo("7EJ2") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("7DJ2") == 0){
4299  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4300  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4301  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
4302  if (firedTrigClass.Contains("7EG1")) isSelected = 0;
4303  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
4304  if (firedTrigClass.Contains("7DG1")) isSelected = 0;
4305  }
4306  } else {
4307  // separate rejection for EMC and DMC triggers
4308  if( fSpecialSubTriggerName.CompareTo("7EJE") == 0){
4309  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4310  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4311  if (firedTrigClass.Contains("7EGA")) isSelected = 0;
4312  } else if (fSpecialSubTriggerName.CompareTo("8EJE") == 0){
4313  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4314  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4315  if (firedTrigClass.Contains("8EGA")) isSelected = 0;
4316  } else if (fSpecialSubTriggerName.CompareTo("7EJ1") == 0){
4317  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4318  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4319  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
4320  if (firedTrigClass.Contains("7EG1")) isSelected = 0;
4321  if (firedTrigClass.Contains("7EJ2")) isSelected = 0;
4322  } else if (fSpecialSubTriggerName.CompareTo("8EJ1") == 0){
4323  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4324  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4325  if (firedTrigClass.Contains("8EG2")) isSelected = 0;
4326  if (firedTrigClass.Contains("8EG1")) isSelected = 0;
4327  if (firedTrigClass.Contains("8EJ2")) isSelected = 0;
4328  } else if (fSpecialSubTriggerName.CompareTo("7EJ2") == 0){
4329  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4330  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4331  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
4332  if (firedTrigClass.Contains("7EG1")) isSelected = 0;
4333  } else if (fSpecialSubTriggerName.CompareTo("8EJ2") == 0){
4334  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4335  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4336  if (firedTrigClass.Contains("8EG2")) isSelected = 0;
4337  if (firedTrigClass.Contains("8EG1")) isSelected = 0;
4338  } else if (fSpecialSubTriggerName.CompareTo("7DJ1") == 0){
4339  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4340  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4341  if (firedTrigClass.Contains("7DG1")) isSelected = 0;
4342  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
4343  if (firedTrigClass.Contains("7DJ2")) isSelected = 0;
4344  } else if (fSpecialSubTriggerName.CompareTo("8DJ1") == 0){
4345  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
4346  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4347  if (firedTrigClass.Contains("8DG1")) isSelected = 0;
4348  if (firedTrigClass.Contains("8DG2")) isSelected = 0;
4349  if (firedTrigClass.Contains("8DJ2")) isSelected = 0;
4350  } else if (fSpecialSubTriggerName.CompareTo("7DJ2") == 0){
4351  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4352  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4353  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
4354  if (firedTrigClass.Contains("7DG1")) isSelected = 0;
4355  } else if (fSpecialSubTriggerName.CompareTo("8DG2") == 0){
4356  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
4357  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
4358  if (firedTrigClass.Contains("8DG2")) isSelected = 0;
4359  if (firedTrigClass.Contains("8DG1")) isSelected = 0;
4360  }
4361  }
4362  }
4363  if (fSpecialTrigger == 10 && (fInputHandler->IsEventSelected() & AliVEvent::kCaloOnly) ){
4365  // trigger rejection for EMC and DMC triggers together
4366  if (fSpecialSubTriggerName.CompareTo("7EJ1") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("7DJ1") == 0){
4367  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4368  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
4369  if (firedTrigClass.Contains("DMC7-")) isSelected = 0;
4370  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
4371  if (firedTrigClass.Contains("7EG1")) isSelected = 0;
4372  if (firedTrigClass.Contains("7EJ2")) isSelected = 0;
4373  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
4374  if (firedTrigClass.Contains("7DG1")) isSelected = 0;
4375  if (firedTrigClass.Contains("7DJ2")) isSelected = 0;
4376  } else if (fSpecialSubTriggerName.CompareTo("7EJ2") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("7DJ2") == 0){
4377  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4378  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
4379  if (firedTrigClass.Contains("DMC7-")) isSelected = 0;
4380  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
4381  if (firedTrigClass.Contains("7EG1")) isSelected = 0;
4382  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
4383  if (firedTrigClass.Contains("7DG1")) isSelected = 0;
4384  }
4385  // trigger rejection for EMC and DMC triggers together
4386  if (fSpecialSubTriggerName.CompareTo("7EG1") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("7DG1") == 0){
4387  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4388  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
4389  if (firedTrigClass.Contains("DMC7-")) isSelected = 0;
4390  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
4391  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
4392  } else if (fSpecialSubTriggerName.CompareTo("8EG1") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("8DG1") == 0){
4393  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4394  if (firedTrigClass.Contains("EMC8-")) isSelected = 0;
4395  if (firedTrigClass.Contains("DMC8-")) isSelected = 0;
4396  if (firedTrigClass.Contains("8EG2")) isSelected = 0;
4397  if (firedTrigClass.Contains("8DG2")) isSelected = 0;
4398  } else if (fSpecialSubTriggerName.CompareTo("7EG2") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("7DG2") == 0){
4399  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4400  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
4401  if (firedTrigClass.Contains("DMC7-")) isSelected = 0;
4402  } else if (fSpecialSubTriggerName.CompareTo("8EG2") == 0 && fSpecialSubTriggerNameAdditional.CompareTo("8DG2") == 0){
4403  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4404  if (firedTrigClass.Contains("EMC8-")) isSelected = 0;
4405  if (firedTrigClass.Contains("DMC8-")) isSelected = 0;
4406  }
4407  } else {
4408  // trigger rejection L0 triggers
4409  if (fSpecialSubTriggerName.CompareTo("CEMC7-") == 0){
4410  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4411  } else if (fSpecialSubTriggerName.CompareTo("CEMC1-") == 0){
4412  if (firedTrigClass.Contains("INT1-")) isSelected = 0;
4413  } else if (fSpecialSubTriggerName.CompareTo("CEMC8-") == 0){
4414  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4415  } else if (fSpecialSubTriggerName.CompareTo("CDMC7-") == 0){
4416  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4417  } else if (fSpecialSubTriggerName.CompareTo("CDMC1-") == 0){
4418  if (firedTrigClass.Contains("INT1-")) isSelected = 0;
4419  } else if (fSpecialSubTriggerName.CompareTo("CDMC8-") == 0){
4420  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4421  }
4422  // trigger rejection EGA
4423  if (fSpecialSubTriggerName.CompareTo("7EGA") == 0){
4424  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4425  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
4426  } else if (fSpecialSubTriggerName.CompareTo("8EGA") == 0){
4427  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4428  if (firedTrigClass.Contains("EMC8-")) isSelected = 0;
4429  } else if (fSpecialSubTriggerName.CompareTo("7DGA") == 0){
4430  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4431  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
4432  } else if (fSpecialSubTriggerName.CompareTo("8DGA") == 0){
4433  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4434  if (firedTrigClass.Contains("EMC8-")) isSelected = 0;
4435  }
4436  // trigger rejection L1 triggers
4437  if(fSpecialSubTriggerName.CompareTo("7EG1") == 0){
4438  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4439  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
4440  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
4441  } else if (fSpecialSubTriggerName.CompareTo("8EG1") == 0){
4442  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4443  if (firedTrigClass.Contains("EMC8-")) isSelected = 0;
4444  if (firedTrigClass.Contains("8EG2")) isSelected = 0;
4445  } else if (fSpecialSubTriggerName.CompareTo("7EG2") == 0){
4446  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4447  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
4448  } else if (fSpecialSubTriggerName.CompareTo("8EG2") == 0){
4449  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4450  if (firedTrigClass.Contains("EMC8-")) isSelected = 0;
4451  } else if (fSpecialSubTriggerName.CompareTo("7DG1") == 0){
4452  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4453  if (firedTrigClass.Contains("DMC7-")) isSelected = 0;
4454  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
4455  } else if (fSpecialSubTriggerName.CompareTo("8DG1") == 0){
4456  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4457  if (firedTrigClass.Contains("DMC8-")) isSelected = 0;
4458  if (firedTrigClass.Contains("8DG2")) isSelected = 0;
4459  } else if (fSpecialSubTriggerName.CompareTo("7DG2") == 0){
4460  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4461  if (firedTrigClass.Contains("DMC7-")) isSelected = 0;
4462  } else if (fSpecialSubTriggerName.CompareTo("8DG2") == 0){
4463  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4464  if (firedTrigClass.Contains("DMC8-")) isSelected = 0;
4465  }
4466  }
4467  }
4468  }
4469  if (isSelected != 0 ){
4470 // cout << "I am here" << " :" << fSpecialSubTriggerName.Data() <<endl;
4471  if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9 ){
4473  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassesCorrelated->Fill(0);
4474  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassesCorrelated->Fill(1);
4475  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassesCorrelated->Fill(2);
4476  if ((fInputHandler->IsEventSelected() & AliVEvent::kEMC7) && firedTrigClass.Contains("EMC"))hTriggerClassesCorrelated->Fill(3);
4477  if (firedTrigClass.Contains("7EJE") || firedTrigClass.Contains("8EJE")) hTriggerClassesCorrelated->Fill(4);
4478  if (firedTrigClass.Contains("7EJ1") || firedTrigClass.Contains("8EJ1")) hTriggerClassesCorrelated->Fill(5);
4479  if (firedTrigClass.Contains("7EJ2") || firedTrigClass.Contains("8EJ2")) hTriggerClassesCorrelated->Fill(6);
4480  if (firedTrigClass.Contains("7EGA") || firedTrigClass.Contains("8EGA")) hTriggerClassesCorrelated->Fill(7);
4481  if (firedTrigClass.Contains("7EG1") || firedTrigClass.Contains("8EG1")) hTriggerClassesCorrelated->Fill(8);
4482  if (firedTrigClass.Contains("7EG2") || firedTrigClass.Contains("8EG2")) hTriggerClassesCorrelated->Fill(9);
4483  if ((fInputHandler->IsEventSelected() & AliVEvent::kEMC7) && firedTrigClass.Contains("DMC"))hTriggerClassesCorrelated->Fill(10);
4484  if (firedTrigClass.Contains("7DJE") || firedTrigClass.Contains("8DJE")) hTriggerClassesCorrelated->Fill(11);
4485  if (firedTrigClass.Contains("7DJ1") || firedTrigClass.Contains("8DJ1")) hTriggerClassesCorrelated->Fill(12);
4486  if (firedTrigClass.Contains("7DJ2") || firedTrigClass.Contains("8DJ2")) hTriggerClassesCorrelated->Fill(13);
4487  if (firedTrigClass.Contains("7DGA") || firedTrigClass.Contains("8DGA")) hTriggerClassesCorrelated->Fill(14);
4488  if (firedTrigClass.Contains("7DG1") || firedTrigClass.Contains("8DG1")) hTriggerClassesCorrelated->Fill(15);
4489  if (firedTrigClass.Contains("7DG2") || firedTrigClass.Contains("8DG2")) hTriggerClassesCorrelated->Fill(16);
4490  }
4491  } else if ( fSpecialTrigger == 10 ){
4493  if (fInputHandler->IsEventSelected() & AliVEvent::kCaloOnly){
4494  hTriggerClassesCorrelated->Fill(0);
4495  if (firedTrigClass.Contains("INT7-"))hTriggerClassesCorrelated->Fill(1);
4496  if (firedTrigClass.Contains("EMC1-"))hTriggerClassesCorrelated->Fill(2);
4497  if (firedTrigClass.Contains("EMC7-")|| firedTrigClass.Contains("EMC8-"))hTriggerClassesCorrelated->Fill(3);
4498  if (firedTrigClass.Contains("7EJE") || firedTrigClass.Contains("8EJE")) hTriggerClassesCorrelated->Fill(4);
4499  if (firedTrigClass.Contains("7EJ1") || firedTrigClass.Contains("8EJ1")) hTriggerClassesCorrelated->Fill(5);
4500  if (firedTrigClass.Contains("7EJ2") || firedTrigClass.Contains("8EJ2")) hTriggerClassesCorrelated->Fill(6);
4501  if (firedTrigClass.Contains("7EGA") || firedTrigClass.Contains("8EGA")) hTriggerClassesCorrelated->Fill(7);
4502  if (firedTrigClass.Contains("7EG1") || firedTrigClass.Contains("8EG1")) hTriggerClassesCorrelated->Fill(8);
4503  if (firedTrigClass.Contains("7EG2") || firedTrigClass.Contains("8EG2")) hTriggerClassesCorrelated->Fill(9);
4504  if (firedTrigClass.Contains("DMC7-")|| firedTrigClass.Contains("DMC8-"))hTriggerClassesCorrelated->Fill(10);
4505  if (firedTrigClass.Contains("7DJE") || firedTrigClass.Contains("8DJE")) hTriggerClassesCorrelated->Fill(11);
4506  if (firedTrigClass.Contains("7DJ1") || firedTrigClass.Contains("8DJ1")) hTriggerClassesCorrelated->Fill(12);
4507  if (firedTrigClass.Contains("7DJ2") || firedTrigClass.Contains("8DJ2")) hTriggerClassesCorrelated->Fill(13);
4508  if (firedTrigClass.Contains("7DGA") || firedTrigClass.Contains("8DGA")) hTriggerClassesCorrelated->Fill(14);
4509  if (firedTrigClass.Contains("7DG1") || firedTrigClass.Contains("8DG1")) hTriggerClassesCorrelated->Fill(15);
4510  if (firedTrigClass.Contains("7DG2") || firedTrigClass.Contains("8DG2")) hTriggerClassesCorrelated->Fill(16);
4511  }
4512  }
4513  }
4514  }
4515 
4516  } else if (isMC){
4517  if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9){ // EMCAL triggers
4518 // isSelected = 0;
4519 // if (fTriggersEMCAL > 0)cout << "Special Trigger " << fSpecialTrigger << " triggers: " << fTriggersEMCAL << " selected triggers: " << fTriggersEMCALSelected << " run number: " <<event->GetRunNumber()<<endl;
4520 // if (fTriggersEMCAL&fTriggersEMCALSelected){
4521 // cout << "accepted ++++++++++++++++++++" << endl;
4522  isSelected = 1;
4523 // }
4524  }
4525  }
4526  //if for specific centrality trigger selection
4527  if(fSpecialSubTrigger == 1){
4528  if(fSpecialSubTriggerName.Contains("|") && GetCentrality(event) <= 10.){
4529  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("|");
4530  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
4531  TObjString *NameClass = (TObjString*)ClassesList->At(i);
4532  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
4533  }
4534  } else if(fSpecialSubTriggerName.Contains("%")){
4535  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("%");
4536  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
4537  TObjString *NameClass = (TObjString*)ClassesList->At(i);
4538  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
4539  }
4540  } else if(fSpecialSubTriggerName.Contains("@")){
4541  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("@");
4542  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
4543  TObjString *NameClass = (TObjString*)ClassesList->At(i);
4544  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
4545  }
4546  } else if(fSpecialSubTriggerName.Contains("&")){ //logic AND of two classes
4547  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("&");
4548  TString CheckClass = "";
4549  for (Int_t i=0; i<ClassesList->GetEntriesFast(); i++){
4550  TObjString *NameClass = (TObjString*)ClassesList->At(i);
4551  if (firedTrigClass.Contains(NameClass->GetString())) CheckClass+="1";
4552  else CheckClass+="0";
4553  }
4554  if(CheckClass.Contains("0")) isSelected = 0;
4555  }
4556  else if(firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 1;
4557  }
4558  }
4559  }
4560  }
4561  fIsSDDFired = !(fInputHandler->IsEventSelected() & AliVEvent::kFastOnly);
4562 
4563  Bool_t mimickedTrigger = kTRUE;
4564  if (fMimicTrigger) mimickedTrigger = MimicTrigger(event, isMC);
4565 // cout << "mimicked decision \t" << mimickedTrigger << "expect decision? "<< fMimicTrigger<< endl;
4566 
4567  // Fill Histogram
4568  if(hTriggerClass){
4569  if (fIsSDDFired) hTriggerClass->Fill(34);
4570  if (mimickedTrigger){
4571  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(0);
4572  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClass->Fill(1);
4573  if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClass->Fill(2);
4574  if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClass->Fill(3);
4575  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClass->Fill(4);
4576  if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5);
4577  if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6);
4578  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6);
4579  if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClass->Fill(7);
4580  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClass->Fill(7);
4581  if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClass->Fill(8);
4582  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClass->Fill(8);
4583  if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClass->Fill(9);
4584  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClass->Fill(9);
4585  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClass->Fill(10);
4586  // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClass->Fill(10);
4587  if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClass->Fill(11);
4588  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClass->Fill(12);
4589  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClass->Fill(13);
4590  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClass->Fill(13);
4591  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClass->Fill(13);
4592  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClass->Fill(14);
4593  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClass->Fill(15);
4594  if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(16);
4595  if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(17);
4596  if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClass->Fill(18);
4597  if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClass->Fill(19);
4598  if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClass->Fill(20);
4599  // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClass->Fill(20);
4600  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClass->Fill(21);
4601  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClass->Fill(22);
4602  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClass->Fill(23);
4603  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClass->Fill(24);
4604  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClass->Fill(25);
4605  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClass->Fill(26);
4606  if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClass->Fill(27);
4607  if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClass->Fill(28);
4608  if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClass->Fill(29);
4609  if (fInputHandler->IsEventSelected() & AliVEvent::kCaloOnly)hTriggerClass->Fill(30);
4610  if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClass->Fill(31);
4611  if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(32);
4612  if (!fInputHandler->IsEventSelected()) hTriggerClass->Fill(35);
4613  }
4614  if (mimickedTrigger && fMimicTrigger) hTriggerClass->Fill(36);
4615  }
4616 
4617  if(hTriggerClassSelected && isSelected){
4618  if (mimickedTrigger){
4619  if (!fIsSDDFired) hTriggerClassSelected->Fill(33);
4620  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassSelected->Fill(0);
4621  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassSelected->Fill(1);
4622  if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClassSelected->Fill(2);
4623  if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClassSelected->Fill(3);
4624  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassSelected->Fill(4);
4625  if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClassSelected->Fill(5);
4626  if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClassSelected->Fill(6);
4627  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClassSelected->Fill(6);
4628  if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClassSelected->Fill(7);
4629  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClassSelected->Fill(7);
4630  if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClassSelected->Fill(8);
4631  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClassSelected->Fill(8);
4632  if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClassSelected->Fill(9);
4633  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClassSelected->Fill(9);
4634  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassSelected->Fill(10);
4635  // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClassSelected->Fill(10);
4636  if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClassSelected->Fill(11);
4637  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClassSelected->Fill(12);
4638  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClassSelected->Fill(13);
4639  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClassSelected->Fill(13);
4640  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClassSelected->Fill(13);
4641  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClassSelected->Fill(14);
4642  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClassSelected->Fill(15);
4643  if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClassSelected->Fill(16);
4644  if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClassSelected->Fill(17);
4645  if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClassSelected->Fill(18);
4646  if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClassSelected->Fill(19);
4647  if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClassSelected->Fill(20);
4648  // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClassSelected->Fill(20);
4649  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClassSelected->Fill(21);
4650  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClassSelected->Fill(22);
4651  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClassSelected->Fill(23);
4652  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClassSelected->Fill(24);
4653  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClassSelected->Fill(25);
4654  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClassSelected->Fill(26);
4655  if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClassSelected->Fill(27);
4656  if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClassSelected->Fill(28);
4657  if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClassSelected->Fill(29);
4658  if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClassSelected->Fill(30);
4659  if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClassSelected->Fill(31);
4660  }
4661  if (mimickedTrigger && fMimicTrigger) hTriggerClassSelected->Fill(34);
4662  }
4663 
4664  if(!isSelected)return kFALSE;
4665  if (fMimicTrigger)
4666  if (!mimickedTrigger ) return kFALSE;
4667  return kTRUE;
4668 
4669 }
4670 
4671 //________________________________________________________________________
4673  // returns TString with current cut number
4674  return fCutStringRead;
4675 }
4676 
4677 //________________________________________________________________________
4678 void AliConvEventCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *event){
4679 
4680  if(fNotRejectedStart){
4681  delete[] fNotRejectedStart;
4682  fNotRejectedStart = NULL;
4683  }
4684  if(fNotRejectedEnd){
4685  delete[] fNotRejectedEnd;
4686  fNotRejectedEnd = NULL;
4687  }
4688  if(fGeneratorNames){
4689  delete[] fGeneratorNames;
4690  fGeneratorNames = NULL;
4691  }
4692 
4693  if(rejection == 0) return; // No Rejection
4694 
4695  AliGenCocktailEventHeader *cHeader = 0x0;
4696  AliAODMCHeader *cHeaderAOD = 0x0;
4697  Bool_t headerFound = kFALSE;
4698  AliMCEvent *fMCEvent = 0x0;
4699  TClonesArray *fMCEventAOD = 0x0;
4700  if(event->IsA()==AliMCEvent::Class()){
4701  if(dynamic_cast<AliMCEvent*>(event)){
4702  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(event)->GenEventHeader());
4703  fMCEvent = dynamic_cast<AliMCEvent*>(event);
4704  if(cHeader) headerFound = kTRUE;
4705  }
4706  }
4707  if(event->IsA()==AliAODEvent::Class()){ // event is a AODEvent in case of AOD
4708  cHeaderAOD = dynamic_cast<AliAODMCHeader*>(event->FindListObject(AliAODMCHeader::StdBranchName()));
4709  fMCEventAOD = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
4710  if(cHeaderAOD) headerFound = kTRUE;
4711  }
4712 
4713  if (fDebugLevel > 0 ) cout << "event starts here" << endl;
4714  if(headerFound){
4715  TList *genHeaders = 0x0;
4716  if(cHeader) genHeaders = cHeader->GetHeaders();
4717  if(cHeaderAOD){
4718  genHeaders = cHeaderAOD->GetCocktailHeaders();
4719  if(genHeaders->GetEntries()==1){
4721  return;
4722  }
4723  }
4724  AliGenEventHeader* gh = 0;
4725  fnHeaders = 0;
4726  Int_t firstindexA = 0;
4727  Int_t lastindexA = -1;
4728  if(rejection == 1 || rejection == 3) fnHeaders = 1; // MinBiasHeader
4729  if(rejection == 2 || rejection == 4){ // TList of Headers Names
4730  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
4731  gh = (AliGenEventHeader*)genHeaders->At(i);
4732  TString GeneratorName = gh->GetName();
4733  lastindexA = lastindexA + gh->NProduced();
4734  if (fDebugLevel > 0 ) cout << i << "\t" << GeneratorName.Data() << endl;
4735  for(Int_t j = 0; j<HeaderList->GetEntries();j++){
4736  TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
4737  if (fDebugLevel > 0 ) cout << GeneratorInList.Data() << endl;
4738  if(GeneratorInList.Contains(GeneratorName) ){
4739  if (fDebugLevel > 0 ) cout << "accepted" << endl;
4740  if (GeneratorInList.BeginsWith("PARAM") || GeneratorInList.CompareTo("BOX") == 0 ){
4741  if(fMCEvent){
4742  if (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c ){
4743  if (fDebugLevel > 2 )cout << "number of produced particle: " << gh->NProduced() << endl;
4744  if (fDebugLevel > 2 )cout << "pdg-code of first particle: " << fMCEvent->Particle(firstindexA)->GetPdgCode() << endl;
4745  if (fMCEvent->Particle(firstindexA)->GetPdgCode() == fAddedSignalPDGCode ) {
4746  if (gh->NProduced() > 10 && fMCEvent->Particle(firstindexA+10)->GetPdgCode() == fAddedSignalPDGCode && GeneratorInList.CompareTo("BOX") == 0){
4747  if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
4748  fnHeaders++;
4749  continue;
4750  } else if (gh->NProduced() == 3 && GeneratorInList.Contains("PARAM_EMC") && (i == 3 || i == 5) ){
4751  if (fDebugLevel > 2 ) cout << "accepted EMC header "<< endl;
4752  if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
4753  fnHeaders++;
4754  continue;
4755  } else if (gh->NProduced() > 2 && GeneratorInList.Contains("PARAM_PHOS") && (i == 4 || i == 6) ){
4756  if (fDebugLevel > 2 ) cout << "accepted PHOS header "<< endl;
4757  if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
4758  fnHeaders++;
4759  continue;
4760 
4761  }
4762  continue;
4763  }
4764  } else {
4765  if (fDebugLevel > 0 ) cout << "cond 2: " << fnHeaders << endl;
4766  fnHeaders++;
4767  continue;
4768  }
4769  }
4770  if ( fMCEventAOD){
4771  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindexA));
4772  if (aodMCParticle && (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c) ){
4773  if ( aodMCParticle->GetPdgCode() == fAddedSignalPDGCode ){
4774  if (gh->NProduced() > 10 && GeneratorInList.CompareTo("BOX") == 0){
4775  AliAODMCParticle *aodMCParticle2 = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindexA+10));
4776  if ( aodMCParticle2->GetPdgCode() == fAddedSignalPDGCode ){
4777  if (fDebugLevel > 0 ) cout << "cond 1: " << fnHeaders << endl;
4778  fnHeaders++;
4779  continue;
4780  }
4781  } else if (gh->NProduced() == 3 && GeneratorInList.Contains("PARAM_EMC") && (i == 3 || i == 5) ){
4782  if (fDebugLevel > 2 ) cout << "accepted EMC header "<< endl;
4783  if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
4784  fnHeaders++;
4785  continue;
4786  } else if (gh->NProduced() > 2 && GeneratorInList.Contains("PARAM_PHOS") && (i == 4 || i == 6) ){
4787  if (fDebugLevel > 2 ) cout << "accepted PHOS header "<< endl;
4788  if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
4789  fnHeaders++;
4790  continue;
4791 
4792  }
4793  continue;
4794  }
4795  } else {
4796  if (fDebugLevel > 0 ) cout << "cond 2: " << fnHeaders << endl;
4797  fnHeaders++;
4798  continue;
4799  }
4800  }
4801  continue;
4802  }
4803  if(GeneratorName.CompareTo(GeneratorInList) == 0 ){
4804  if (fDebugLevel > 0 ) cout << "cond 3: "<< fnHeaders << endl;
4805  fnHeaders++;
4806  continue;
4807  }
4808  }
4809  }
4810  firstindexA = firstindexA + gh->NProduced();
4811  }
4812  }
4813  if (fDebugLevel > 0 ) cout << "number of headers: " <<fnHeaders << endl;
4814 
4818 
4819  if(rejection == 1 || rejection == 3){
4820  fNotRejectedStart[0] = 0;
4821  fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced()-1;
4822  fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName();
4823  if (fDebugLevel > 0 ) cout << 0 << "\t" <<fGeneratorNames[0] << "\t" << fNotRejectedStart[0] << "\t" <<fNotRejectedEnd[0] << endl;
4824  return;
4825  }
4826 
4827  Int_t firstindex = 0;
4828  Int_t lastindex = -1;
4829  Int_t number = 0;
4830 
4831  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
4832  gh = (AliGenEventHeader*)genHeaders->At(i);
4833  TString GeneratorName = gh->GetName();
4834  lastindex = lastindex + gh->NProduced();
4835  if (fDebugLevel > 0 ) cout << i << "\t" << GeneratorName.Data() << endl;
4836  for(Int_t j = 0; j<HeaderList->GetEntries();j++){
4837  TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
4838  if(GeneratorInList.Contains(GeneratorName) ){
4839  if (GeneratorInList.Contains("PARAM") || GeneratorInList.CompareTo("BOX") == 0 ){
4840  if(fMCEvent){
4841  if (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c ){
4842  if (fMCEvent->Particle(firstindex)->GetPdgCode() == fAddedSignalPDGCode ) {
4843  if (fDebugLevel > 0 ) cout << "produced " << gh->NProduced() << " with box generator" << endl;
4844  if (gh->NProduced() > 10 && fMCEvent->Particle(firstindex+10)->GetPdgCode() == fAddedSignalPDGCode && GeneratorInList.CompareTo("BOX") == 0){
4845  if (fDebugLevel > 0 ) cout << "one of them was a pi0 or eta" << endl;
4846  fNotRejectedStart[number] = firstindex;
4847  fNotRejectedEnd[number] = lastindex;
4848  fGeneratorNames[number] = GeneratorName;
4849  number++;
4850  if (fDebugLevel > 0 ) cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
4851  continue;
4852  } else if (gh->NProduced() == 3 && GeneratorInList.Contains("PARAM_EMC") && (i == 3 || i == 5) ){
4853  fNotRejectedStart[number] = firstindex;
4854  fNotRejectedEnd[number] = lastindex;
4855