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