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