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