AliPhysics  59e0e03 (59e0e03)
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  printf("EnergyVar-enum: '%i', PeriodVar-enum: '%i' \n", fEnergyEnum, fPeriodEnum );
989  if (fIsHeavyIon == 0) {
990  printf("Running in pp mode \n");
991  if (fSpecialTrigger == 0){
992  if (fSpecialSubTrigger == 0){
993  printf("\t only events triggered by V0OR will be analysed \n");
994  } else if (fSpecialSubTrigger == 1){
995  printf("\t only events where SDD was present will be analysed \n");
996  }
997  } else if (fSpecialTrigger == 1){
998  if (fSpecialSubTrigger == 0){
999  printf("\t only events triggered by V0AND will be analysed \n");
1000  } else if(fSpecialSubTrigger == 1){
1001  printf("\t only events where SDD was present will be analysed and triggered by VOAND\n");
1002  }
1003  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps");
1004  } else if (fSpecialTrigger > 1){
1005  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
1006  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
1007  }
1008  if ( !(fCentralityMin == 0 && fCentralityMax == 0) && !(fCentralityMax < fCentralityMin) ){
1009  printf("\t Multiplicity cut %d - %d \n", fCentralityMin, fCentralityMax);
1010  }
1011  } else if (fIsHeavyIon == 1){
1012  printf("Running in PbPb mode \n");
1013  if (fDetectorCentrality == 0){
1014  printf("\t centrality selection based on V0M \n");
1015  } else if (fDetectorCentrality == 1){
1016  printf("\t centrality selection based on Cl1 \n");
1017  } else if (fDetectorCentrality == 2){
1018  printf("\t centrality selection based on ZNA \n");
1019  }
1020  if (fModCentralityClass == 0){
1021  printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10);
1022  } else if ( fModCentralityClass == 1){
1023  printf("\t %d - %d \n", fCentralityMin*5, fCentralityMax*5);
1024  } else if ( fModCentralityClass == 2){
1025  printf("\t %d - %d \n", fCentralityMin, fCentralityMax);
1026  } else if (fModCentralityClass == 3){
1027  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*10, fCentralityMax*10);
1028  } else if ( fModCentralityClass == 4){
1029  printf("\t %d - %d, with Track mult in MC as data \n", fCentralityMin*5, fCentralityMax*5);
1030  } else if (fModCentralityClass == 5){
1031  printf("\t %d - %d, with overlapping Track mult in MC as data \n", fCentralityMin*10, fCentralityMax*10);
1032  } else if ( fModCentralityClass == 6){
1033  printf("\t %d - %d, with overlapping Track mult in MC as data \n", fCentralityMin*5, fCentralityMax*5);
1034  }
1035  if (fSpecialTrigger == 0){
1036  printf("\t only events triggered by kMB, kCentral, kSemiCentral will be analysed \n");
1037  } else if (fSpecialTrigger > 1){
1038  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
1039  printf("\n\t SpecialTrigger is: %s\n", fSpecialTriggerName.Data());
1040  printf("\t SpecialSubTrigger is: %s\n", fSpecialSubTriggerName.Data());
1041  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
1042  }
1043  } else if (fIsHeavyIon == 2){
1044  printf("Running in pPb mode \n");
1045  if (fDetectorCentrality == 0){
1046  printf("\t centrality selection based on V0A \n");
1047  } else if (fDetectorCentrality == 1){
1048  printf("\t centrality selection based on Cl1 \n");
1049  } else if (fDetectorCentrality == 2){
1050  printf("\t centrality selection based on ZNA \n");
1051  }
1052  if (fModCentralityClass == 0){
1053  printf("\t %d - %d \n", fCentralityMin*10, fCentralityMax*10);
1054  } else if ( fModCentralityClass == 1){
1055  printf("\t %d - %d \n", fCentralityMin*5, fCentralityMax*5);
1056  } else if ( fModCentralityClass == 2){
1057  printf("\t %d - %d \n", fCentralityMin, fCentralityMax);
1058  }
1059  if (fSpecialTrigger == 0){
1060  printf("\t only events triggered by kINT7 will be analysed \n");
1061  } else if (fSpecialTrigger > 1){
1062  printf("\t only events triggered by %s %s\n", fSpecialTriggerName.Data(), fSpecialSubTriggerName.Data());
1063  if (fRejectTriggerOverlap) printf("\t reject trigger overlaps\n\n");
1064  }
1065  }
1066  if (fEnableVertexCut) printf("\t Vertex cut with |Z_{vtx}| <%2.2f \n",fMaxVertexZ);
1067  else printf("\t No vertex cut \n");
1068 
1069  if (fRemovePileUp ==1 ) {
1070  printf("\t Doing pile up removal \n");
1071  if (fRemovePileUpSPD ==1 ){
1072  printf("\t Doing pile up removal using SPD \n");
1073  }
1074  if (fDoPileUpRejectV0MTPCout ==1 ){
1075  printf("\t Doing extra pile up removal V0M vs TPCout \n");
1076  }
1078  printf("\t Doing extra past-future pile up removal\n");
1079  }
1080  }
1081 
1082  printf("MC event cuts: \n");
1083  if (fRejectExtraSignals == 0) printf("\t no rejection was applied \n");
1084  else if (fRejectExtraSignals == 1) printf("\t only MB header will be inspected \n");
1085  else if (fRejectExtraSignals == 4) printf("\t special handling for Jets embedded in MB events \n");
1086  else if (fRejectExtraSignals > 1) printf("\t special header have been selected \n");
1087  printf("\t maximum factor between jet and pt hard = %2.2f \n", fMaxFacPtHard);
1088 }
1089 
1092 { // Set Cut
1093  switch(isHeavyIon){
1094  case 0: // pp
1095  fIsHeavyIon=0;
1096  break;
1097  case 1: // V0M PbPb & XeXe
1098  // steps of 10%
1099  fIsHeavyIon=1;
1101  break;
1102  case 2: // CL1 PbPb & XeXe
1103  // steps of 10%
1104  fIsHeavyIon=1;
1106  break;
1107  case 3: // V0M PbPb & XeXe
1108  // steps of 5%
1109  // 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%
1110  fIsHeavyIon=1;
1113  break;
1114  case 4: // V0M PbPb & XeXe & primary track mult for MC different track array
1115  // steps of 10%
1116  fIsHeavyIon=1;
1119  break;
1120  case 5: // V0M PbPb & XeXe & primary track mult for MC
1121  // steps of 10%
1122  fIsHeavyIon=1;
1125  break;
1126  case 6: // V0M PbPb & XeXe & primary track mult for MC
1127  // steps of 5%
1128  // 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%
1129  fIsHeavyIon=1;
1132  break;
1133  case 7: // V0M PbPb & XeXe & primary track mult for MC different track array
1134  // steps of 5%
1135  // 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%
1136  fIsHeavyIon=1;
1139  break;
1140  case 8: // pPb V0A
1141  // steps of 10%
1142  fIsHeavyIon=2;
1144  break;
1145  case 9: // pPb CL1
1146  // steps of 10%
1147  fIsHeavyIon=2;
1149  break;
1150  case 10: // a: pPb V0A
1151  // steps of 5%
1152  // 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%
1153  fIsHeavyIon=2;
1156  break;
1157  case 11: // b: pPb CL1
1158  // steps of 5%
1159  // 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%
1160  fIsHeavyIon=2;
1163  break;
1164  case 12: // c: pPb V0A
1165  // steps of 1%
1166  // 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%
1167  fIsHeavyIon=2;
1170  break;
1171  case 13: // d: pPb CL1
1172  // steps of 1%
1173  // 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%
1174  fIsHeavyIon=2;
1177  break;
1178  case 14: // e: pPb ZNA
1179  // steps of 10%
1180  fIsHeavyIon=2;
1182  break;
1183  case 15: // f: pPb ZNA
1184  // steps of 5%
1185  // 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%
1186  fIsHeavyIon=2;
1189  break;
1190  case 16: // g: pPb CL1
1191  // steps of 1%
1192  // 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%
1193  fIsHeavyIon=2;
1196  break;
1197 
1198  default:
1199  AliError(Form("SetHeavyIon not defined %d",isHeavyIon));
1200  return kFALSE;
1201  }
1202  return kTRUE;
1203 }
1204 
1205 //___________________________________________________________________
1207 {
1208  // Set Cut
1209  if(minCentrality<0||minCentrality>20){
1210  AliError(Form("minCentrality not defined %d",minCentrality));
1211  return kFALSE;
1212  }
1213 
1214  fCentralityMin=minCentrality;
1215  return kTRUE;
1216 }
1217 
1218 //___________________________________________________________________
1220 {
1221  // Set Cut
1222  if(maxCentrality<0||maxCentrality>20){
1223  AliError(Form("maxCentrality not defined %d",maxCentrality));
1224  return kFALSE;
1225  }
1226  fCentralityMax=maxCentrality;
1227  return kTRUE;
1228 }
1229 
1232 {
1233  // Set Cut
1234  switch(selectSpecialTrigger){
1235  case 0:
1236  fSpecialTrigger=0; // V0OR
1237  break;
1238  case 1:
1239  fSpecialTrigger=1; // V0AND
1240  break;
1241 // case 2:
1242 // fSpecialTrigger=2; //
1243 // break;
1244  case 3:
1245  fSpecialTrigger=3; //specific centrality trigger selection
1246  fSpecialTriggerName="AliVEvent::kCentral/kSemiCentral/kMB";
1247  break;
1248  case 4:
1249  fSpecialTrigger=4; // trigger alias kTRD
1250  fOfflineTriggerMask=AliVEvent::kTRD;
1251  fTriggerSelectedManually = kTRUE;
1252  fSpecialTriggerName="AliVEvent::kTRD";
1253  break;
1254  case 5:
1255  fSpecialTrigger=5; // trigger alias kEMC
1256  fOfflineTriggerMask=AliVEvent::kEMC7 | AliVEvent::kEMC8 | AliVEvent::kEMC1 ;
1257  fTriggerSelectedManually = kTRUE;
1259  SETBIT(fTriggersEMCALSelected, kL0);
1260  fSpecialTriggerName="AliVEvent::kEMC7/kEMC8/kEMC1";
1261  break;
1262  case 6:
1263  fSpecialTrigger=6; // trigger alias kPHI
1264  fOfflineTriggerMask=AliVEvent::kPHI7 | AliVEvent::kPHI1 | AliVEvent::kPHI8 | AliVEvent::kPHOSPb;
1265  fTriggerSelectedManually = kTRUE;
1266  fSpecialTriggerName="AliVEvent::kPHI7/kPHI1/kPHI8/kPHOSPb";
1267  break;
1268  case 7:
1269  fSpecialTrigger=7; // trigger alias kHighMult
1270  fOfflineTriggerMask=AliVEvent::kHighMult;
1271  fTriggerSelectedManually = kTRUE;
1272  fSpecialTriggerName="AliVEvent::kHighMult";
1273  break;
1274  case 8:
1275  fSpecialTrigger=8; // trigger alias kEMCEGA
1276  fOfflineTriggerMask=AliVEvent::kEMCEGA;
1277  fTriggerSelectedManually = kTRUE;
1279  SETBIT(fTriggersEMCALSelected, kG2);
1280  fSpecialTriggerName="AliVEvent::kEMCEGA";
1281  break;
1282  case 9:
1283  fSpecialTrigger=9; // trigger alias kEMCEJE
1284  fOfflineTriggerMask=AliVEvent::kEMCEJE;
1285  fTriggerSelectedManually = kTRUE;
1287  SETBIT(fTriggersEMCALSelected, kJ2);
1288  fSpecialTriggerName="AliVEvent::kEMCEJE";
1289  break;
1290  case 10: //CALO and CALOFAST
1291  fSpecialTrigger=10; // trigger alias kEMC
1292  fOfflineTriggerMask=AliVEvent::kCaloOnly;
1293  fTriggerSelectedManually = kTRUE;
1295  fSpecialTriggerName="AliVEvent::kCaloOnly";
1296  break;
1297  default:
1298  AliError("Warning: Special Trigger Not known");
1299  return 0;
1300  }
1301  return 1;
1302 }
1303 
1306 {
1307  // Set Cut
1308  if (fSpecialTrigger == 0){ //OR
1309  switch(selectSpecialSubTriggerClass){
1310  case 0://with VZERO
1311  fSpecialTrigger=0;
1313 // AliInfo("Info: Nothing to be done");
1314  break;
1315  case 3: //V0OR with SDD requested (will only work with LHC11a dataset)
1317 // cout << "V0OR with SDD requested" << endl;
1318  break;
1319  default:
1320  AliError("Warning: Special Subtrigger Class Not known");
1321  return 0;
1322  }
1323  } else if (fSpecialTrigger == 1){ //AND with different detectors
1324  switch(selectSpecialSubTriggerClass){
1325  case 0: //with VZERO general implementation of V0AND (periods LHC11c onwards)
1326  fSpecialTrigger=0;
1328  fOfflineTriggerMask=AliVEvent::kINT7;
1329  fTriggerSelectedManually = kTRUE;
1330  fSpecialTriggerName="AliVEvent::kINT7";
1331  break;
1332  case 1: //with TZERO
1333  fSpecialTrigger=0;
1335  fOfflineTriggerMask=AliVEvent::kINT8;
1336  fTriggerSelectedManually = kTRUE;
1337  fSpecialTriggerName="AliVEvent::kINT8";
1338  break;
1339  case 2: //with VZERO (will only work with LHC11a dataset)
1340  fSpecialTrigger=1;
1342 // AliInfo("Info: Nothing to be done");
1343  break;
1344  case 3: //V0AND with SDD requested (will only work with LHC11a dataset)
1345  fSpecialTrigger=1;
1347  break;
1348  default:
1349  AliError("Warning: Special Subtrigger Class Not known");
1350  return 0;
1351  }
1352  } else if (fSpecialTrigger == 3){ // Selecting kCentral and kSemiCentral from trigger classes, not aliases
1353  switch(selectSpecialSubTriggerClass){
1354  case 0: // all together
1357 // AliInfo("Info: Nothing to be done");
1358  break;
1359  case 1: // kCentral - no vertex restriction
1362  fSpecialSubTriggerName="CVHN";
1363 // cout << "kCentralOpen" << endl;
1364  break;
1365  case 2: // kCentral - T00 +- 10 cm
1368  fSpecialSubTriggerName="CCENT";
1369 // cout << "kCentralVertex" << endl;
1370  break;
1371  case 3: // kCentral - both
1374  fSpecialSubTriggerName="CVHN|CCENT|CSEMI|CVLN";
1375 // cout << "kCentral both" << endl;
1376  break;
1377  case 4: // kSemiCentral - no vertex restriction
1380  fSpecialSubTriggerName="CVLN";
1381 // cout << "kSemiCentralOpen" << endl;
1382  break;
1383  case 5: // kSemiCentral - T00 +- 10 cm
1386  fSpecialSubTriggerName="CSEMI";
1387 // cout << "kSemiCentralVertex" << endl;
1388  break;
1389  case 6: // kSemiCentral - both
1392  fSpecialSubTriggerName="CSEMI%CVLN";
1393 // cout << "kSemiCentral both" << endl;
1394  break;
1395  case 7: // kMB
1398  fSpecialSubTriggerName="CPBI1_|CPBI1-";
1399 // cout << "kMB 1" << endl;
1400  break;
1401  case 8: // kMB
1404  fSpecialSubTriggerName="CPBI2_|CPBI2-";
1405 // cout << "kMB 2" << endl;
1406  break;
1407  case 9: // kMB
1410  fSpecialSubTriggerName="CPBI2_@CPBI2-@CPBI2_@CPBI2-";
1411 // cout << "kMB both" << endl;
1412  break;
1413  case 10: // 0V0M
1414  fOfflineTriggerMask=AliVEvent::kINT7;
1415  fTriggerSelectedManually = kTRUE;
1418  fSpecialSubTriggerName="C0V0M";
1419  break;
1420  case 11: // 0V0L
1421  fOfflineTriggerMask=AliVEvent::kINT7;
1422  fTriggerSelectedManually = kTRUE;
1425  fSpecialSubTriggerName="C0V0L";
1426  break;
1427  case 12: // 0VHM
1428  fOfflineTriggerMask=AliVEvent::kINT7;
1429  fTriggerSelectedManually = kTRUE;
1432  fSpecialSubTriggerName="C0VHM";
1433  break;
1434  case 13: // VOL7
1435  fOfflineTriggerMask=AliVEvent::kINT7;
1436  fTriggerSelectedManually = kTRUE;
1439  fSpecialSubTriggerName="CV0L7";
1440  break;
1441  case 14: // 0STC
1442  fOfflineTriggerMask=AliVEvent::kINT7;
1443  fTriggerSelectedManually = kTRUE;
1446  fSpecialSubTriggerName="C0STC";
1447  break;
1448  default:
1449  AliError("Warning: Special Subtrigger Class Not known");
1450  return 0;
1451  }
1452  } else if (fSpecialTrigger == 4){ // Subdivision of TRD trigger classes
1453  switch(selectSpecialSubTriggerClass){
1454  case 0: // all together
1457 // AliInfo("Info: Nothing to be done");
1458  break;
1459  case 1: // 7WUHSH - V0AND with single electron in TRD & EMCAL
1462  fSpecialSubTriggerName="7WUHEE";
1463  break;
1464  case 2: // 8WUHSH - T0AND with single electron in TRD & EMCAL
1467  fSpecialSubTriggerName="8WUHEE";
1468  break;
1469  case 3: // 7WUHSE - V0AND with single high pt electron in TRD
1472  fSpecialSubTriggerName="7WUHSE";
1473  break;
1474  case 4: // 8WUHSE - T0AND with single high pt electron in TRD
1477  fSpecialSubTriggerName="8WUHSE";
1478  break;
1479  case 5: // 7WUHJE - V0AND with jet in TRD
1482  fSpecialSubTriggerName="7WUHJT";
1483  break;
1484  case 6: // 8WUHJE - T0AND with jet in TRD
1487  fSpecialSubTriggerName="8WUHJT";
1488  break;
1489  case 7: // 7WUHQU - V0AND with dielectron pair in TRD
1492  fSpecialSubTriggerName="7WUHQU";
1493  break;
1494  case 8: // 8WUHQU - T0AND with dielectron pair in TRD
1497  fSpecialSubTriggerName="8WUHQU";
1498  break;
1499  default:
1500  AliError("Warning: Special Subtrigger Class Not known");
1501  return 0;
1502  }
1503  } else if (fSpecialTrigger == 5){ // Subdivision of kEMC trigger classes
1504  switch(selectSpecialSubTriggerClass){
1505  case 0: // all together
1508 // AliInfo("Info: Nothing to be done");
1509  break;
1510  case 1: // CEMC1 - V0OR and EMCAL fired
1511  fOfflineTriggerMask=AliVEvent::kEMC1;
1512  fSpecialTriggerName="AliVEvent::kEMC1";
1515  fSpecialSubTriggerName="CEMC1";
1516  break;
1517  case 2: // CEMC7 - V0AND and EMCAL fired
1519  fOfflineTriggerMask=AliVEvent::kEMC7;
1520  fSpecialTriggerName="AliVEvent::kEMC7";
1522  fSpecialSubTriggerName="CEMC7";
1523  break;
1524  case 3: // CEMC8 - T0OR and EMCAL fired
1525  fOfflineTriggerMask=AliVEvent::kEMC8;
1526  fSpecialTriggerName="AliVEvent::kEMC8";
1529  fSpecialSubTriggerName="CEMC8";
1530  break;
1531  case 4: // CDMC1 - V0OR and DCAL fired
1532  fOfflineTriggerMask=AliVEvent::kEMC1;
1533  fSpecialTriggerName="AliVEvent::kEMC1";
1536  fSpecialSubTriggerName="CDMC1";
1537  break;
1538  case 5: // CDMC7 - V0AND and DCAL fired
1540  fOfflineTriggerMask=AliVEvent::kEMC7;
1541  fSpecialTriggerName="AliVEvent::kEMC7";
1543  fSpecialSubTriggerName="CDMC7";
1544  break;
1545  case 6: // CDMC8 - T0OR and DCAL fired
1546  fOfflineTriggerMask=AliVEvent::kEMC8;
1547  fSpecialTriggerName="AliVEvent::kEMC8";
1550  fSpecialSubTriggerName="CDMC8";
1551  break;
1552  default:
1553  AliError("Warning: Special Subtrigger Class Not known");
1554  return 0;
1555  }
1556  }else if (fSpecialTrigger == 6){ // Subdivision of kPHI trigger classes
1557  switch(selectSpecialSubTriggerClass){
1558  case 0: // all together
1561 // AliInfo("Info: Nothing to be done");
1562  break;
1563  case 1: // CEMC1 - V0OR and EMCAL fired
1564  fOfflineTriggerMask=AliVEvent::kPHI1;
1565  fSpecialTriggerName="AliVEvent::kPHI1";
1568  fSpecialSubTriggerName="CPHI1";
1569  break;
1570  case 2: // CEMC7 - V0AND and EMCAL fired
1572  fOfflineTriggerMask=AliVEvent::kPHI7;
1573  fSpecialTriggerName="AliVEvent::kPHI7";
1575  fSpecialSubTriggerName="CPHI7";
1576  break;
1577  case 3: // CEMC8 - T0OR and EMCAL fired
1578  fOfflineTriggerMask=AliVEvent::kPHI8;
1579  fSpecialTriggerName="AliVEvent::kPHI8";
1582  fSpecialSubTriggerName="CPHI8";
1583  break;
1584  default:
1585  AliError("Warning: Special Subtrigger Class Not known");
1586  return 0;
1587  }
1588  } else if (fSpecialTrigger == 7){ // Subdivision of kHighMult trigger classes
1589  switch(selectSpecialSubTriggerClass){
1590  case 0: // all together
1593 // AliInfo("Info: Nothing to be done");
1594  break;
1595  case 1: // CSHM1 - V0OR and high mult fired
1598  fSpecialSubTriggerName="CSHM1";
1599  break;
1600  case 2: // CSHM7 - V0AND and high mult fired
1603  fSpecialSubTriggerName="CSHM7";
1604  break;
1605  case 3: // CSHM8 - T0OR and high mult fired
1608  fSpecialSubTriggerName="CSHM8";
1609  break;
1610  case 4: // V0 high mult trigger
1612  fOfflineTriggerMask=AliVEvent::kAny;
1613  fSpecialTriggerName="V0Mult";
1615  fSpecialSubTriggerName="CVHMV0M-B-";
1616  break;
1617  case 5: // SPD high mult trigger
1619  fOfflineTriggerMask=AliVEvent::kAny;
1620  fSpecialTriggerName="SPMult";
1622  fSpecialSubTriggerName="CVHMSH2-B-";
1623  break;
1624  case 6: // V0 high mult trigger with pileup condition on
1626  fOfflineTriggerMask=AliVEvent::kAny;
1627  fSpecialTriggerName="V0Mult";
1629  fSpecialSubTriggerName="CVHMV0M-B-SPD2";
1630  break;
1631 
1632  default:
1633  AliError("Warning: Special Subtrigger Class Not known");
1634  return 0;
1635  }
1636  }else if (fSpecialTrigger == 8){ // Subdivision of kEMCEGA trigger classes
1637  switch(selectSpecialSubTriggerClass){
1638  case 0: // all together
1641 // AliInfo("Info: Nothing to be done");
1642  break;
1643  case 1: // 7EGA - CINT7 EGA
1646  fSpecialSubTriggerName="7EGA";
1648  SETBIT(fTriggersEMCALSelected, kG2);
1649  break;
1650  case 2: // 8EGA - CINT8 EGA
1653  fSpecialSubTriggerName="8EGA";
1655  SETBIT(fTriggersEMCALSelected, kG2);
1656  break;
1657  case 3: // 7EG1 - CINT7 EG1
1660  fSpecialSubTriggerName="7EG1";
1662  SETBIT(fTriggersEMCALSelected, kG1);
1663  break;
1664  case 4: // 8EG1 - CINT8 EG1
1667  fSpecialSubTriggerName="8EG1";
1669  SETBIT(fTriggersEMCALSelected, kG1);
1670  break;
1671  case 5: // 7EG2 - CINT7 EG2
1674  fSpecialSubTriggerName="7EG2";
1676  SETBIT(fTriggersEMCALSelected, kG2);
1677  break;
1678  case 6: // 8EG2 - CINT8 EG2
1681  fSpecialSubTriggerName="8EG2";
1683  SETBIT(fTriggersEMCALSelected, kG2);
1684  break;
1685  case 7: // 7DGA - CINT7 DGA
1688  fSpecialSubTriggerName="7DGA";
1690  SETBIT(fTriggersEMCALSelected, kG2);
1691  break;
1692  case 8: // 8DGA - CINT8 DGA
1695  fSpecialSubTriggerName="8DGA";
1697  SETBIT(fTriggersEMCALSelected, kG2);
1698  break;
1699  case 9: // 7DG1 - CINT7 DG1
1702  fSpecialSubTriggerName="7DG1";
1704  SETBIT(fTriggersEMCALSelected, kG1);
1705  break;
1706  case 10: // 8DG1 - CINT8 DG1
1709  fSpecialSubTriggerName="8DG1";
1711  SETBIT(fTriggersEMCALSelected, kG1);
1712  break;
1713  case 11: // 7DG2 - CINT7 DG2
1716  fSpecialSubTriggerName="7DG2";
1718  SETBIT(fTriggersEMCALSelected, kG2);
1719  break;
1720  case 12: // 8DG2 - CINT8 DG2
1723  fSpecialSubTriggerName="8DG2";
1725  SETBIT(fTriggersEMCALSelected, kG2);
1726  break;
1727 
1728  default:
1729  AliError("Warning: Special Subtrigger Class Not known");
1730  return 0;
1731  }
1732  } else if (fSpecialTrigger == 9){ // Subdivision of kEMCEGA trigger classes
1733  switch(selectSpecialSubTriggerClass){
1734  case 0: // all together
1737 // AliInfo("Info: Nothing to be done");
1738  break;
1739  case 1: // 7EJE - CINT7 EJE
1742  fSpecialSubTriggerName="7EJE";
1744  SETBIT(fTriggersEMCALSelected, kJ2);
1745  break;
1746  case 2: // 8EJE - CINT8 EJE
1749  fSpecialSubTriggerName="8EJE";
1751  SETBIT(fTriggersEMCALSelected, kJ2);
1752  break;
1753  case 3: // 7EJ1 - CINT7 EJ1
1756  fSpecialSubTriggerName="7EJ1";
1758  SETBIT(fTriggersEMCALSelected, kJ1);
1759  break;
1760  case 4: // 8EJ1 - CINT8 EJ1
1763  fSpecialSubTriggerName="8EJ1";
1765  SETBIT(fTriggersEMCALSelected, kJ1);
1766  break;
1767  case 5: // 7EJ2 - CINT7 EJ2
1770  fSpecialSubTriggerName="7EJ2";
1772  SETBIT(fTriggersEMCALSelected, kJ2);
1773  break;
1774  case 6: // 8EJ2 - CINT8 EJ2
1777  fSpecialSubTriggerName="8EJ2";
1779  SETBIT(fTriggersEMCALSelected, kJ2);
1780  break;
1781  case 7: // 7DJ1 - CINT7 DJ1
1784  fSpecialSubTriggerName="7DJ1";
1786  SETBIT(fTriggersEMCALSelected, kJ1);
1787  break;
1788  case 8: // 8DJ1 - CINT8 DJ1
1791  fSpecialSubTriggerName="8DJ1";
1793  SETBIT(fTriggersEMCALSelected, kJ1);
1794  break;
1795  case 9: // 7DJ2 - CINT7 DJ2
1798  fSpecialSubTriggerName="7DJ2";
1800  SETBIT(fTriggersEMCALSelected, kJ2);
1801  break;
1802  case 10: // 8DJ2 - CINT8 DJ2
1805  fSpecialSubTriggerName="8DJ2";
1807  SETBIT(fTriggersEMCALSelected, kJ2);
1808  break;
1809 
1810  default:
1811  AliError("Warning: Special Subtrigger Class Not known");
1812  return 0;
1813  }
1814  } else if (fSpecialTrigger == 10){ // Subdivision of kEMC trigger classes
1815  switch(selectSpecialSubTriggerClass){
1816  case 0: // all together
1819  fSpecialSubTriggerName="CINT7";
1820  fSpecialTriggerName="AliVEvent::kCaloOnly/INT7";
1821  break;
1822  case 1: // CEMC7 - V0AND and EMCAL fired
1825  fSpecialSubTriggerName="CEMC7-";
1826  fSpecialTriggerName="AliVEvent::kCaloOnly/EMC7";
1827  break;
1828  case 2: // CEMC7EG2 - V0AND and EMCAL fired
1831  fSpecialSubTriggerName="7EG2";
1832  fSpecialTriggerName="AliVEvent::kCaloOnly/7EG2";
1833  break;
1834  case 3: // CEMC7EG1 - V0AND and EMCAL fired
1837  fSpecialSubTriggerName="7EG1";
1838  fSpecialTriggerName="AliVEvent::kCaloOnly/7EG1";
1839  break;
1840  case 4: // CEMC7EJ2 - V0AND and EMCAL fired
1843  fSpecialSubTriggerName="7EJ2";
1844  fSpecialTriggerName="AliVEvent::kCaloOnly/7EJ2";
1845  break;
1846  case 5: // CEMC7EJ1 - V0AND and EMCAL fired
1849  fSpecialSubTriggerName="7EJ1";
1850  fSpecialTriggerName="AliVEvent::kCaloOnly/7EJ1";
1851  break;
1852  case 6: // CDMC7 - V0AND and DCAL fired
1855  fSpecialSubTriggerName="CDMC7-";
1856  fSpecialTriggerName="AliVEvent::kCaloOnly/DMC7";
1857  break;
1858  case 7: // CDMC7DG2 - V0AND and DCAL fired
1861  fSpecialSubTriggerName="7DG2";
1862  fSpecialTriggerName="AliVEvent::kCaloOnly/7DG2";
1863  break;
1864  case 8: // CDMC7DG1 - V0AND and DCAL fired
1867  fSpecialSubTriggerName="7DG1";
1868  fSpecialTriggerName="AliVEvent::kCaloOnly/7DG1";
1869  break;
1870  case 9: // CDMC7DJ2 - V0AND and DCAL fired
1873  fSpecialSubTriggerName="7DJ2";
1874  fSpecialTriggerName="AliVEvent::kCaloOnly/7DJ2";
1875  break;
1876  case 10: // DEMC7DJ1 - V0AND and DCAL fired - a
1879  fSpecialSubTriggerName="7DJ1";
1880  fSpecialTriggerName="AliVEvent::kCaloOnly/7DJ1";
1881  break;
1882  case 11: // CEMC8 - V0AND and EMCAL fired - b
1885  fSpecialSubTriggerName="CEMC8-";
1886  fSpecialTriggerName="AliVEvent::kCaloOnly/EMC8";
1887  break;
1888  case 12: // CEMC8EG2 - V0AND and EMCAL fired - c
1891  fSpecialSubTriggerName="8EG2";
1892  fSpecialTriggerName="AliVEvent::kCaloOnly/8EG2";
1893  break;
1894  case 13: // CEMC8EG1 - V0AND and EMCAL fired - d
1897  fSpecialSubTriggerName="8EG1";
1898  fSpecialTriggerName="AliVEvent::kCaloOnly/8EG1";
1899  break;
1900  case 14: // CEMC8EJ2 - V0AND and EMCAL fired - e
1903  fSpecialSubTriggerName="8EJ2";
1904  fSpecialTriggerName="AliVEvent::kCaloOnly/8EJ2";
1905  break;
1906  case 15: // CEMC8EJ1 - V0AND and EMCAL fired - f
1909  fSpecialSubTriggerName="8EJ1";
1910  fSpecialTriggerName="AliVEvent::kCaloOnly/8EJ1";
1911  break;
1912  case 16: // CDMC8 - V0AND and DCAL fired - g
1915  fSpecialSubTriggerName="CDMC8-";
1916  fSpecialTriggerName="AliVEvent::kCaloOnly/DMC8";
1917  break;
1918  case 17: // CDMC8DG2 - V0AND and DCAL fired - h
1921  fSpecialSubTriggerName="8DG2";
1922  fSpecialTriggerName="AliVEvent::kCaloOnly/8DG2";
1923  break;
1924  case 18: // CDMC8DG1 - V0AND and DCAL fired - i
1927  fSpecialSubTriggerName="8DG1";
1928  fSpecialTriggerName="AliVEvent::kCaloOnly/8DG1";
1929  break;
1930  case 19: // CDMC8DJ2 - V0AND and DCAL fired - j
1933  fSpecialSubTriggerName="8DJ2";
1934  fSpecialTriggerName="AliVEvent::kCaloOnly/8DJ2";
1935  break;
1936  case 20: // DEMC8DJ1 - V0AND and DCAL fired - k
1939  fSpecialSubTriggerName="8DJ1";
1940  fSpecialTriggerName="AliVEvent::kCaloOnly/8DJ1";
1941  break;
1942  default:
1943  AliError("Warning: Special Subtrigger Class Not known");
1944  return 0;
1945  }
1946  }
1947  return 1;
1948 }
1949 
1950 //________________________________________________________________________
1952 {
1953  // Set Cut
1954  fMultiplicityMethod=multiplicityMethod;
1955 
1956  // 0 Photon Multiplicity
1957  // 1 TPC Track multiplicity
1958  // 2 V0 Mult
1959  // 3 SPD Mult
1960 
1961  return kTRUE;
1962 }
1963 
1964 //________________________________________________________________________
1966 {// Set Cut
1967  switch(removePileUp){
1968  case 0:
1969  fRemovePileUp = kFALSE;
1970  break;
1971  case 1:
1972  fRemovePileUp = kTRUE;
1973  fRemovePileUpSPD = kTRUE;
1974  break;
1975  case 2:
1976  fRemovePileUp = kTRUE;
1977  fRemovePileUpSPD = kTRUE;
1980  break;
1981  case 3:
1982  fRemovePileUp = kTRUE;
1983  fRemovePileUpSPD = kTRUE;
1986  break;
1987  case 4:
1988  fRemovePileUp = kTRUE;
1989  fRemovePileUpSPD = kTRUE;
1992  break;
1993  case 5:
1994  fRemovePileUp = kTRUE;
1995  fRemovePileUpSPD = kTRUE;
1998  break;
1999  case 6:
2000  fRemovePileUp = kTRUE;
2001  fRemovePileUpSPD = kTRUE;
2002  fDoPileUpRejectV0MTPCout = kTRUE;
2003  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2004  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
2005  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
2006  if (fIsHeavyIon==1){
2007  if(fPeriodEnum == kLHC15o){
2008  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2009  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2010  break;
2011  }else{
2012  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
2013  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
2014  break;
2015  }
2016  } else if(fIsHeavyIon == 2){
2017  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
2018  fFPileUpRejectV0MTPCout->SetParameter(1,2.0);
2019  break;
2020  }else{
2021  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
2022  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
2023  break;
2024  }
2025  break;
2026  case 7:
2027  fRemovePileUp = kTRUE;
2028  fRemovePileUpSPD = kTRUE;
2029  fDoPileUpRejectV0MTPCout = kTRUE;
2030  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2031  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
2032  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
2033  if (fIsHeavyIon==1){
2034  if(fPeriodEnum == kLHC15o){
2035  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2036  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2037  break;
2038  }else{
2039  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2040  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
2041  break;
2042  }
2043  } else if(fIsHeavyIon == 2){
2044  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
2045  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
2046  break;
2047  }else{
2048  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
2049  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
2050  break;
2051  }
2052  break;
2053  case 8:
2054  fRemovePileUp = kTRUE;
2055  fRemovePileUpSPD = kTRUE;
2056  fDoPileUpRejectV0MTPCout = kTRUE;
2057  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2058  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
2059  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
2060  if (fIsHeavyIon==1){
2061  if(fPeriodEnum == kLHC15o){
2062  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2063  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2064  break;
2065  }else{
2066  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
2067  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
2068  break;
2069  }
2070  } else if(fIsHeavyIon == 2){
2071  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
2072  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
2073  break;
2074  }else{
2075  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
2076  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
2077  break;
2078  }
2079  break;
2080  case 9:
2081  fRemovePileUp = kTRUE;
2082  fRemovePileUpSPD = kTRUE;
2085  fDoPileUpRejectV0MTPCout = kTRUE;
2086  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2087  fFPileUpRejectV0MTPCout->SetParameter(0,0.);
2088  fFPileUpRejectV0MTPCout->SetParameter(1,0.);
2089  if (fIsHeavyIon==1){
2090  if(fPeriodEnum == kLHC15o){
2091  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2092  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2093  break;
2094  }else{
2095  fFPileUpRejectV0MTPCout->SetParameter(0,-1500.);
2096  fFPileUpRejectV0MTPCout->SetParameter(1,3.0);
2097  break;
2098  }
2099  } else if(fIsHeavyIon == 2){
2100  fFPileUpRejectV0MTPCout->SetParameter(0,-200.);
2101  fFPileUpRejectV0MTPCout->SetParameter(1,1.5);
2102  break;
2103  }else{
2104  fFPileUpRejectV0MTPCout->SetParameter(0,-300.);
2105  fFPileUpRejectV0MTPCout->SetParameter(1,4.0);
2106  break;
2107  }
2108  break;
2109  case 10: // for Pb-Pb
2110  fRemovePileUp = kTRUE;
2111  fRemovePileUpSPD = kTRUE;
2112  fUtils->SetASPDCvsTCut(200.);
2113  fUtils->SetBSPDCvsTCut(7.);
2114  fDoPileUpRejectV0MTPCout = kTRUE;
2115  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2116  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2117  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2118  break;
2119  case 11: // for Pb-Pb
2120  fRemovePileUp = kTRUE;
2121  fRemovePileUpSPD = kFALSE;
2122  fDoPileUpRejectV0MTPCout = kTRUE;
2123  fFPileUpRejectV0MTPCout = new TF1("fFPileUpRejectV0MTPCout","[0] + [1]*x",0.,10000.);
2124  fFPileUpRejectV0MTPCout->SetParameter(0,-2500.);
2125  fFPileUpRejectV0MTPCout->SetParameter(1,5.0);
2126  break;
2127  default:
2128  AliError("RemovePileUpCut not defined");
2129  return kFALSE;
2130  }
2131  return kTRUE;
2132 }
2133 
2134 //________________________________________________________________________
2136 
2137  switch(extraSignal){
2138  case 0:
2139  fRejectExtraSignals = 0;
2140  break; // No Rejection
2141  case 1:
2142  fRejectExtraSignals = 1;
2143  break; // MinBias Header
2144  case 2:
2145  fRejectExtraSignals = 2;
2146  break; // User String Array
2147  case 3:
2148  fRejectExtraSignals = 3;
2149  break; // Rejection for Gamma Correction only
2150  case 4:
2151  fRejectExtraSignals = 4;
2152  break; // Special handling of Jet weights for Jets embedded in MB events
2153  default:
2154  AliError(Form("Extra Signal Rejection not defined %d",extraSignal));
2155  return kFALSE;
2156  }
2157  return kTRUE;
2158 }
2159 
2160 //________________________________________________________________________
2162 
2163  switch(vertexCut){
2164  case 0: // no Vertex required // NOT fully working yet
2165  fEnableVertexCut = kFALSE;
2166  fMaxVertexZ = 1000;
2167  break;
2168  case 1: // vertex within +-15 cm
2169  fEnableVertexCut = kTRUE;
2170  fMaxVertexZ = 15;
2171  break;
2172  case 2: // vertex within +-12.5 cm
2173  fEnableVertexCut = kTRUE;
2174  fMaxVertexZ = 12.5;
2175  break;
2176  case 3: // vertex within +-10 cm
2177  fEnableVertexCut = kTRUE;
2178  fMaxVertexZ = 10.0;
2179  break;
2180  case 4: // vertex within +-7.5 cm
2181  fEnableVertexCut = kTRUE;
2182  fMaxVertexZ = 7.5;
2183  break;
2184  case 5: // vertex within +-5 cm
2185  fEnableVertexCut = kTRUE;
2186  fMaxVertexZ = 5.;
2187  break;
2188  default:
2189  AliError(Form("Vertex Cut not defined %d",vertexCut));
2190  return kFALSE;
2191  }
2192  return kTRUE;
2193 }
2194 
2195 //-------------------------------------------------------------
2197  if (fPeriodEnum == kLHC15n || // pp 5TeV
2198  fPeriodEnum == kLHC15o || // PbPb 5TeV
2199  fPeriodEnum == kLHC15k1a1 || fPeriodEnum == kLHC15k1a2 || fPeriodEnum == kLHC15k1a3 || fPeriodEnum == kLHC16j7 || // MC PbPb 5TeV LowIR
2200  fPeriodEnum == kLHC16g1 || fPeriodEnum == kLHC16g1a || fPeriodEnum == kLHC16g1b || fPeriodEnum == kLHC16g1c || // MC PbPb 5TeV general purpose
2201  fPeriodEnum == kLHC16g2 || // MC PbPb 5TeV EPOS-LHC
2202  fPeriodEnum == kLHC16g3 || // MC PbPb 5TeV DPMJET
2203  fPeriodEnum == kLHC16h4 || // MC PbPb 5TeV GA added pi0 and eta
2204  fPeriodEnum == kLHC16i1a || fPeriodEnum == kLHC16i1b || fPeriodEnum == kLHC16i1c || // MC PbPb 5TeV LF added (multi-)strange
2205  fPeriodEnum == kLHC16i2a || fPeriodEnum == kLHC16i2b || fPeriodEnum == kLHC16i2c || // MC PbPb 5TeV HF added hadronic decays
2206  fPeriodEnum == kLHC16i3a || fPeriodEnum == kLHC16i3b || fPeriodEnum == kLHC16i3c || // MC PbPb 5TeV HF added electron decays
2207  fPeriodEnum == kLHC16h2a || fPeriodEnum == kLHC16h2b || fPeriodEnum == kLHC16h2c || // MC PbPb 5TeV jet-jet
2209  fPeriodEnum == kLHC15g3a3 || fPeriodEnum == kLHC15g3c3 || // MC pp 13TeV
2210  fPeriodEnum == kLHC16qt || // pPb 5TeV LHC16qt
2211  fPeriodEnum == kLHC16r || fPeriodEnum == kLHC16s || // pPb 8TeV LHC16rs
2212  fPeriodEnum == kLHC17f2a || fPeriodEnum == kLHC17f2b || fPeriodEnum == kLHC17g8a || // MC pPb 5TeV LHC16qt
2214  fPeriodEnum == kLHC17f3 || fPeriodEnum == kLHC17f4 || // MC pPb 8TeV LHC16sr
2215  fPeriodEnum == kLHC17n || // Xe-Xe LHC17n
2216  fPeriodEnum == kLHC17j7 || // MC Xe-Xe LHC17n
2217  fPeriodEnum == kLHC17pq || // pp 5TeV LHC17pq
2218  fPeriodEnum == kLHC17l3b || // MC pp 5TeV LHC17pq
2219  fPeriodEnum == kLHC17l4b || // MC pp 5TeV LHC17pq
2220  fPeriodEnum == kLHC18b8 // MC Jet Jet pp 5TeV LHC17pq
2221  ){
2222  return kTRUE;
2223  } else {
2224  return kFALSE;
2225  }
2226 }
2227 
2228 //-------------------------------------------------------------
2230 { // Get Event Centrality
2231 
2232  AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
2233  Int_t runnumber = event->GetRunNumber();
2234  if(esdEvent){
2236  AliMultSelection *MultSelection = (AliMultSelection*)event->FindListObject("MultSelection");
2237  if(!MultSelection){
2238  AliWarning ("AliMultSelection object not found !");
2239  return -1;
2240  }else{
2241  if(fDetectorCentrality==0){
2242  if(fIsHeavyIon==2){
2243  if (runnumber > 266329 && runnumber < 267139)
2244  return MultSelection->GetMultiplicityPercentile("V0C");// default for Pbp
2245  else
2246  return MultSelection->GetMultiplicityPercentile("V0A");// default for pPb
2247  } else {
2248  return MultSelection->GetMultiplicityPercentile("V0M");// default
2249  }
2250  } else if(fDetectorCentrality==1){
2251  return MultSelection->GetMultiplicityPercentile("CL1",kTRUE);
2252  } else if(fDetectorCentrality==2){
2253  if (runnumber > 266329 && runnumber < 267139)
2254  return MultSelection->GetMultiplicityPercentile("ZNC",kTRUE);
2255  else
2256  return MultSelection->GetMultiplicityPercentile("ZNA",kTRUE);
2257  }
2258  }
2259  }else{
2260  AliCentrality *fESDCentrality = (AliCentrality*)esdEvent->GetCentrality();
2261  if(fDetectorCentrality==0){
2262  if(fIsHeavyIon==2){
2263  if (runnumber > 196432 && runnumber < 197389)
2264  return fESDCentrality->GetCentralityPercentile("V0C"); // default for Pbp
2265  else
2266  return fESDCentrality->GetCentralityPercentile("V0A"); // default for pPb
2267  } else {
2268  return fESDCentrality->GetCentralityPercentile("V0M"); // default
2269  }
2270  } else if(fDetectorCentrality==1){
2271  return fESDCentrality->GetCentralityPercentile("CL1");
2272  } else if(fDetectorCentrality==2){
2273  if (runnumber > 196432 && runnumber < 197389)
2274  return fESDCentrality->GetCentralityPercentile("ZNC");
2275  else
2276  return fESDCentrality->GetCentralityPercentile("ZNA");
2277  }
2278  }
2279  }
2280 
2281  AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
2282  if(aodEvent){
2284  AliMultSelection *MultSelection = (AliMultSelection*)aodEvent->FindListObject("MultSelection");
2285  if(!MultSelection){
2286  AliWarning ("AliMultSelection object not found !");
2287  return -1;
2288  } else{
2289  if(fDetectorCentrality==0){
2290  if(fIsHeavyIon==2) return MultSelection->GetMultiplicityPercentile("V0A");// default for pPb
2291  else return MultSelection->GetMultiplicityPercentile("V0M",kTRUE);
2292  }else if(fDetectorCentrality==1) return MultSelection->GetMultiplicityPercentile("CL1",kTRUE);
2293  else if(fDetectorCentrality==2) return MultSelection->GetMultiplicityPercentile("ZNA",kTRUE);
2294  }
2295  }else{
2296  if(aodEvent->GetHeader()){return ((AliVAODHeader*)aodEvent->GetHeader())->GetCentrality();}
2297  }
2298  }
2299 
2300  return -1;
2301 }
2302 
2303 //_____________________________________________________________________________________
2304 Bool_t AliConvEventCuts::IsCentralitySelected(AliVEvent *event, AliMCEvent *mcEvent)
2305 {
2306  // Centrality Selection
2307  if(!fIsHeavyIon){
2308  if ((fCentralityMin == 0 && fCentralityMax == 0) || (fCentralityMin > fCentralityMax) ){
2309  return kTRUE;
2310  } else {
2311  Int_t primaryTracksPP[9] = { 0, 2, 5, 10, 15,
2312  30, 50, 100, 1000
2313  };
2314  Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks();
2315  if ( nprimaryTracks >= primaryTracksPP[fCentralityMin] && nprimaryTracks < primaryTracksPP[fCentralityMax]){
2316  return kTRUE;
2317  } else {
2318  return kFALSE;
2319  }
2320  return kFALSE;
2321  }
2322  }
2323  if(fCentralityMin == fCentralityMax ) return kTRUE;//0-100%
2324  else if ( fCentralityMax==0) fCentralityMax=10; //CentralityRange = fCentralityMin-10*multfactor
2326  if(centrality<0 && !mcEvent)return kFALSE;
2327 
2328  Int_t centralityC=0;
2329  if (fModCentralityClass == 0){
2330  centralityC= Int_t(centrality/10);
2331  if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2332  return kTRUE;
2333  else return kFALSE;
2334  }
2335  else if (fModCentralityClass == 1){
2336  centralityC= Int_t(centrality);
2337  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2338  return kTRUE;
2339  } else return kFALSE;
2340  }
2341  else if (fModCentralityClass == 2){
2342  centralityC= Int_t(centrality);
2343  if(centralityC >= fCentralityMin && centralityC < fCentralityMax){
2344  return kTRUE;
2345  } else return kFALSE;
2346  }
2347  Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks();
2348  Int_t PrimaryTracks10[11][2] =
2349  {
2350  {9999,9999}, // 0 //1550 changed to 9999 on 9 Dec
2351  {1210, 928}, // 10
2352  { 817, 658}, // 20
2353  { 536, 435}, // 30
2354  { 337, 276}, // 40
2355  { 197, 162}, // 50
2356  { 106, 100}, // 60
2357  { 51, 44}, // 70
2358  { 21, 18}, // 80
2359  { 0, 0}, // 90
2360  { 0, 0}// 100 // only max accessible
2361  };
2362  Int_t PrimaryTracksLHC11h10[11][2] =
2363  {
2364  {9999,9999}, // 0 //1550 changed to 9999 on 9 Dec
2365  { 985, 928}, // 10
2366  { 661, 658}, // 20
2367  { 434, 435}, // 30
2368  { 275, 276}, // 40
2369  { 173, 162}, // 50
2370  { 100, 100}, // 60
2371  { 42, 44}, // 70
2372  { 19, 18}, // 80
2373  { 0, 0}, // 90
2374  { 0, 0}// 100 // only max accessible
2375  };
2376  Int_t PrimaryTracksLHC15o10[11][2] =
2377  {
2378  {2500, 2700}, // 0-10% cent class max # of tracks: max value of the data distribution
2379  {1498, 1498}, // 0-10% cent class min # of tracks
2380  {1012, 1012}, // 10-20
2381  { 669, 669}, // 20-30
2382  { 423, 423}, // 30-40
2383  { 251, 251}, // 40-50
2384  { 136, 136}, // 50-60
2385  { 67, 67}, // 60-70
2386  { 28, 28}, // 70-80
2387  { 0, 0}, // 80-90% cent class min # of tracks
2388  { 0, 0} // not used
2389  };
2390  Int_t PrimaryTracksLHC10h5[21][2] =
2391  {
2392  {9999,9999}, // 0 ///1550 changed to 9999 on 9 Dec
2393  {1485,1168}, // 5
2394  {1210, 928}, // 10
2395  { 995, 795}, // 15
2396  { 817, 658}, // 20
2397  { 666, 538}, // 25
2398  { 536, 435}, // 30
2399  { 428, 350}, // 35
2400  { 337, 276}, // 40
2401  { 260, 214}, // 45
2402  { 197, 162}, // 50
2403  { 147, 125}, // 55
2404  { 106, 100}, // 60
2405  { 75, 63}, // 65
2406  { 51, 44}, // 70
2407  { 34, 29}, // 75
2408  { 21, 18}, // 80
2409  { 13, 11}, // 85
2410  { 6, 6}, // 90
2411  { 3, 3}, // 95
2412  { 0, 0} // 100 only max accessible
2413  };
2414  Int_t PrimaryTracksLHC11h5[21][2] =
2415  {
2416  {9999,9999}, // 0 ///1550 changed to 9999 on 9 Dec
2417  {1166,1168}, // 5
2418  { 953, 928}, // 10
2419  { 805, 795}, // 15
2420  { 655, 658}, // 20
2421  { 535, 538}, // 25
2422  { 435, 435}, // 30
2423  { 349, 350}, // 35
2424  { 275, 276}, // 40
2425  { 214, 214}, // 45
2426  { 165, 162}, // 50
2427  { 127, 125}, // 55
2428  { 93, 100}, // 60
2429  { 64, 63}, // 65
2430  { 44, 44}, // 70
2431  { 30, 29}, // 75
2432  { 18, 18}, // 80
2433  { 11, 11}, // 85
2434  { 6, 6}, // 90
2435  { 3, 3}, // 95
2436  { 0, 0} // 100 only max accessible
2437  };
2438  Int_t PrimaryTracksLHC15o5[21][2] =
2439  {
2440  { 2500, 2700}, // 0-5% cent class max # of tracks: max value of the data distribution
2441  { 1827, 1827}, // 0-5% cent class min # of tracks
2442  { 1498, 1498}, // 5-10
2443  { 1234, 1234}, // 10-15
2444  { 1012, 1012}, // 15-20
2445  { 827, 827}, // 20-25
2446  { 669, 669}, // 25-30
2447  { 536, 536}, // 30-35
2448  { 423, 423}, // 35-40
2449  { 329, 329}, // 40-45
2450  { 251, 251}, // 45-50
2451  { 188, 188}, // 50-55
2452  { 136, 136}, // 55-60
2453  { 97, 97}, // 60-65
2454  { 67, 67}, // 65-70
2455  { 44, 44}, // 70-75
2456  { 28, 28}, // 75-80
2457  { 17, 17}, // 80-85
2458  { 10, 10}, // 85-90
2459  { 5, 5}, // 90-95 cent class minimum # of tracks
2460  { 0, 0} // 95-100
2461  };
2462  Int_t PrimaryTracksLHC17n10[11][2] =
2463  {
2464  {9999,9999}, // 0 // 1500 max in hist but set to real max
2465  { 800, 800}, // 10 // guess
2466  { 628, 628}, // 20
2467  { 350, 350}, // 30 // guess
2468  { 268, 268}, // 40
2469  { 200, 200}, // 50 // guess
2470  { 100, 100}, // 60 // guess
2471  { 51, 44}, // 70 // guess
2472  { 21, 18}, // 80 // guess
2473  { 0, 0}, // 90 // guess
2474  { 0, 0} // 100 // only max accessible
2475  };
2476 
2477  Int_t column = 0;
2478  if(event->IsA()==AliESDEvent::Class()) column = 0;
2479  if(event->IsA()==AliAODEvent::Class()) column = 1;
2480 
2481  if (fModCentralityClass == 3){
2482  if(mcEvent){
2483  // setting specific arry for LHC11h for MC track mult
2485  if(nprimaryTracks > PrimaryTracksLHC11h10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h10[fCentralityMin][column])
2486  return kTRUE;
2487  else return kFALSE;
2488  // setting specific arry for LHC17n for MC track mult
2489  } else if(fPeriodEnum == kLHC17j7 ){
2490  if(nprimaryTracks > PrimaryTracksLHC17n10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC17n10[fCentralityMin][column])
2491  return kTRUE;
2492  else return kFALSE;
2493  // settings for LHC15o MCs
2495  centralityC= Int_t(centrality/10);
2496  if(centralityC >= fCentralityMin && centralityC < fCentralityMax){
2497  if(fCentralityMin==0 && nprimaryTracks >= PrimaryTracksLHC15o10[0][column]) return kFALSE;
2498  else return kTRUE;
2499  } else return kFALSE;
2500  // setting specific arry for LHC10h for MC track mult
2501  } else {
2502  if(nprimaryTracks > PrimaryTracks10[fCentralityMax][column] && nprimaryTracks <= PrimaryTracks10[fCentralityMin][column])
2503  return kTRUE;
2504  else return kFALSE;
2505  }
2506  }
2507  else{
2508  centralityC= Int_t(centrality/10);
2509  if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2510  return kTRUE;
2511  else return kFALSE;
2512  }
2513  }
2514  else if (fModCentralityClass ==4){
2515  if(mcEvent){
2516  // setting specific arry for LHC11h for MC track mult
2518  if(nprimaryTracks > PrimaryTracksLHC11h5[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h5[fCentralityMin][column])
2519  return kTRUE;
2520  else return kFALSE;
2521  // settings for LHC15o MCs
2523  centralityC = Int_t(centrality);
2524  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2525  if(fCentralityMin==0 && nprimaryTracks >= PrimaryTracksLHC15o5[0][column]) return kFALSE;
2526  else return kTRUE;
2527  } else return kFALSE;
2528  // setting specific arry for LHC10h for MC track mult
2529  } else {
2530  if(nprimaryTracks > PrimaryTracksLHC10h5[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC10h5[fCentralityMin][column])
2531  return kTRUE;
2532  else return kFALSE;
2533  }
2534  }
2535  else{
2536  centralityC= Int_t(centrality);
2537  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2538  return kTRUE;
2539  } else return kFALSE;
2540  }
2541  }
2542 
2543  Int_t PrimaryTracksLHC11h10AltMin[11][2] =
2544  {
2545  {1550,1550}, // 0 - 0
2546  { 800, 800}, // 10 - 1
2547  { 600, 600}, // 20 - 2
2548  { 400, 400}, // 30 - 3
2549  { 240, 240}, // 40 - 4
2550  { 130, 130}, // 50 - 5
2551  { 90, 90}, // 60 - 6
2552  { 35, 35}, // 70 - 7
2553  { 15, 15}, // 80 - 8
2554  { 5, 5}, // 90 - 9
2555  { 0, 0} // 100 // only max accessible
2556  };
2557  Int_t PrimaryTracksLHC11h10AltMax[11][2] =
2558  {
2559  {1550,1550}, // 0 //1550 changed to 9999 on 9 Dec
2560  {1000,1000}, // 10
2561  { 700, 700}, // 20
2562  { 480, 480}, // 30
2563  { 300, 300}, // 40
2564  { 200, 200}, // 50
2565  { 120, 120}, // 60
2566  { 50, 50}, // 70
2567  { 22, 22}, // 80
2568  { 10, 10}, // 90
2569  { 0, 0} // 100 // only max accessible
2570  };
2571  Int_t PrimaryTracksLHC11h5AltMin[21][2] =
2572  {
2573  {1550,1550}, // 0
2574  {1000,1000}, // 5
2575  { 800, 800}, // 10
2576  { 700, 700}, // 15
2577  { 600, 600}, // 20
2578  { 500, 500}, // 25
2579  { 400, 400}, // 30
2580  { 300, 300}, // 35
2581  { 240, 240}, // 40
2582  { 180, 180}, // 45
2583  { 130, 130}, // 50
2584  { 127, 125}, // 55
2585  { 90, 90}, // 60
2586  { 55, 55}, // 65
2587  { 35, 35}, // 70
2588  { 25, 25}, // 75
2589  { 15, 15}, // 80
2590  { 11, 11}, // 85
2591  { 5, 5}, // 90
2592  { 0, 0}, // 95
2593  { 0, 0} // 100 only max accessible
2594  };
2595  Int_t PrimaryTracksLHC11h5AltMax[21][2] =
2596  {
2597  {1550,1550}, // 0
2598  {1250,1250}, // 5
2599  {1000,1000}, // 10
2600  { 805, 795}, // 15
2601  { 700, 700}, // 20
2602  { 585, 585}, // 25
2603  { 480, 480}, // 30
2604  { 380, 380}, // 35
2605  { 300, 300}, // 40
2606  { 235, 235}, // 45
2607  { 200, 200}, // 50
2608  { 140, 140}, // 55
2609  { 120, 120}, // 60
2610  { 70, 70}, // 65
2611  { 50, 50}, // 70
2612  { 35, 25}, // 75
2613  { 22, 22}, // 80
2614  { 15, 15}, // 85
2615  { 10, 10}, // 90
2616  { 5, 5}, // 95
2617  { 0, 0} // 100 only max accessible
2618  };
2619 
2620  if (fModCentralityClass == 5){
2621  if(mcEvent){
2622  // setting specific arry for LHC11h for MC track mult
2624  if(nprimaryTracks > PrimaryTracksLHC11h10AltMin[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h10AltMax[fCentralityMin][column])
2625  return kTRUE;
2626  else return kFALSE;
2627  // default return
2628  } else {
2629  return kFALSE;
2630  }
2631  } else {
2632  centralityC= Int_t(centrality/10);
2633  if(centralityC >= fCentralityMin && centralityC < fCentralityMax)
2634  return kTRUE;
2635  else return kFALSE;
2636  }
2637  }
2638  else if (fModCentralityClass ==6){
2639  if(mcEvent){
2640  // setting specific arry for LHC11h for MC track mult
2642  if(nprimaryTracks > PrimaryTracksLHC11h5AltMin[fCentralityMax][column] && nprimaryTracks <= PrimaryTracksLHC11h5AltMax[fCentralityMin][column])
2643  return kTRUE;
2644  else return kFALSE;
2645  } else {
2646  return kFALSE;
2647  }
2648  } else{
2649  centralityC= Int_t(centrality);
2650  if(centralityC >= fCentralityMin*5 && centralityC < fCentralityMax*5){
2651  return kTRUE;
2652  } else return kFALSE;
2653  }
2654  }
2655 
2656  return kFALSE;
2657 }
2658 
2659 //________________________________________________________________________
2661  // Cut on z position of primary vertex
2662  Double_t fVertexZ=event->GetPrimaryVertex()->GetZ();
2663  Double_t fVertexZSPD = 0;
2664  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2665  if(fESDEvent){
2666  fVertexZSPD = fESDEvent->GetPrimaryVertexSPD()->GetZ();
2667  }
2668  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2669  if(fAODEvent){
2670  fVertexZSPD = fAODEvent->GetPrimaryVertexSPD()->GetZ();
2671  }
2672 
2673  if(TMath::Abs(fVertexZ)>fMaxVertexZ)return kFALSE;
2674 
2675 
2676  if (fPeriodEnum == kLHC11h){
2677  if (TMath::Abs(fVertexZ-fVertexZSPD) > 0.1) return kFALSE;
2678  }
2679  if (fIsHeavyIon == 2){
2680  if(!fUtils->IsVertexSelected2013pA(event)) return kFALSE;
2681  }
2682 
2683  return kTRUE;
2684 }
2685 
2686 //________________________________________________________________________
2688 {
2690  return kFALSE;
2691  TBits fIR1 = event->GetHeader()->GetIRInt1InteractionMap(); // IR1 contains V0 information (VIR)
2692  TBits fIR2 = event->GetHeader()->GetIRInt2InteractionMap(); // IR2 contains T0 information
2693  UShort_t bunchCrossings = event->GetBunchCrossNumber();
2695  for(Int_t i = 0; i<180;i++){
2696  if(fIR1.TestBitNumber(i))
2697  fHistoPastFutureBits->Fill((i*25)-90*25);
2698  }
2699  }
2700 
2701  Bool_t isOutOfBunchPileup = 0;
2702  Int_t pf1 = fPastFutureRejectionLow +bunchCrossings%4;
2703  Int_t pf2 = fPastFutureRejectionHigh+bunchCrossings%4;
2704  if(pf1 < -89) pf1 = -89;
2705  if(pf2 > 89) pf2 = 89;
2706  Int_t pf2maxForT0 = pf2;
2707  Int_t ir1skip = 0;
2708  for (Int_t i=pf1;i<=pf2;i++) {
2709  if (i==0) continue;
2710  if (i<=pf2maxForT0) isOutOfBunchPileup|=fIR2.TestBitNumber(90+i); // T0-based clean-up
2711  if (i>0 && i<=ir1skip) continue; // skip next 2 for old IR definitions
2712  isOutOfBunchPileup|=fIR1.TestBitNumber(90+i); // V0-based clean-up
2713  }
2714  return isOutOfBunchPileup;
2715 }
2716 //________________________________________________________________________
2717 
2719 {
2720  Bool_t isPileUpV0MTPCout=0;
2721 
2722  Double_t multV0M;
2723  Double_t valFunc;
2724  if (fIsHeavyIon==2){
2725  multV0M = event->GetVZEROData()->GetMTotV0A();
2726  }else{
2727  multV0M = event->GetVZEROData()->GetMTotV0A() + event->GetVZEROData()->GetMTotV0C() ;
2728  }
2729 
2730  if ( fFPileUpRejectV0MTPCout != 0x0 ){
2731  valFunc= fFPileUpRejectV0MTPCout->Eval(((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfTPCoutTracks());
2732  if (multV0M < valFunc ) isPileUpV0MTPCout=1;
2733  }
2734 
2735  return isPileUpV0MTPCout;
2736 
2737 }
2738 //________________________________________________________________________
2740  // returns number of contributors to the vertex
2741 
2742  AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(event);
2743  if(fESDEvent){
2744  if (fESDEvent->GetPrimaryVertex() != NULL){
2745  if(fESDEvent->GetPrimaryVertex()->GetNContributors()>0) {
2746  // cout << "accepted global" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertex()->GetNContributors() << endl;
2747  return fESDEvent->GetPrimaryVertex()->GetNContributors();
2748  }
2749  }
2750 
2751  if(fESDEvent->GetPrimaryVertexSPD() !=NULL){
2752  if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2753  // cout << "accepted SPD" << fESDEvent->GetEventNumberInFile() << " with NCont: " << fESDEvent->GetPrimaryVertexSPD()->GetNContributors() << endl;
2754  return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
2755  }else {
2756  AliWarning(Form("Number of contributors from bad vertex type:: %s",fESDEvent->GetPrimaryVertex()->GetName()));
2757  // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
2758  return 0;
2759  }
2760  }
2761  }
2762 
2763  AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(event);
2764  if(fAODEvent){
2765  if (fAODEvent->GetPrimaryVertex() != NULL){
2766  if(fAODEvent->GetPrimaryVertex()->GetNContributors()>0) {
2767  return fAODEvent->GetPrimaryVertex()->GetNContributors();
2768  }
2769  }
2770  if(fAODEvent->GetPrimaryVertexSPD() !=NULL){
2771  if(fAODEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
2772  return fAODEvent->GetPrimaryVertexSPD()->GetNContributors();
2773  } else {
2774  AliWarning(Form("Number of contributors from bad vertex type:: %s",fAODEvent->GetPrimaryVertex()->GetName()));
2775  return 0;
2776  }
2777  }
2778  }
2779  // cout << "rejected " << fESDEvent->GetEventNumberInFile() << endl;
2780  return 0;
2781 }
2782 
2783 //________________________________________________________________________
2784 // Analysing Jet-Jet MC's
2785 //________________________________________________________________________
2786 Bool_t AliConvEventCuts::IsJetJetMCEventAccepted(AliMCEvent *mcEvent, Double_t& weight, AliVEvent* event ){
2787  AliGenCocktailEventHeader *cHeader = 0x0;
2788  Bool_t headerFound = kFALSE;
2789  weight = -1;
2790  fMaxPtJetMC = 0;
2791 
2792  if ( fPeriodEnum != kLHC18b8 && // LHC17pq pp 5TeV JetJet MC's
2793  fPeriodEnum != kLHC17i3a1 && // LHC16ijklop GammaJet MC EMCal triggered
2794  fPeriodEnum != kLHC17g8a && // LHC16qt pPb 5TeV JetJet MC's
2795  fPeriodEnum != kLHC16rP1JJ && fPeriodEnum != kLHC16sP1JJ && // LHC16sr pPb 8TeV JetJet MC's
2796  fPeriodEnum != kLHC16P1JJ && fPeriodEnum != kLHC16P1JJLowB && // LHC16X Jet Jet MC's
2797  fPeriodEnum != kLHC17P1JJ && fPeriodEnum != kLHC17P1JJLowB && // LHC17X Jet Jet MC's
2798  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
2799  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
2800  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
2801  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
2802  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
2803  fPeriodEnum != kLHC12P2JJ // LHC12 JetJet MC
2804  ){
2805 
2806  weight = 1;
2807  return kTRUE;
2808  }
2809 
2810  if(mcEvent){
2811  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
2812  if(cHeader) headerFound = kTRUE;
2813  }else{
2814  //no mcEvent available -> not running on MC
2815  weight = 1;
2816  return kTRUE;
2817  }
2818 
2819  if(headerFound){
2820  TList *genHeaders = 0x0;
2821  if(cHeader) genHeaders = cHeader->GetHeaders();
2822  AliGenEventHeader* gh = 0;
2823  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
2824  gh = (AliGenEventHeader*)genHeaders->At(i);
2825  TString GeneratorName = gh->GetName();
2826  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0 || GeneratorName.Contains("Pythia8Jets")){
2827  Bool_t eventAccepted = kTRUE;
2828  TParticle * jet = 0;
2829  Int_t nTriggerJets = dynamic_cast<AliGenPythiaEventHeader*>(gh)->NTriggerJets();
2830  Float_t ptHard = dynamic_cast<AliGenPythiaEventHeader*>(gh)->GetPtHard();
2831  Float_t tmpjet[]={0,0,0,0};
2832  for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){
2833  dynamic_cast<AliGenPythiaEventHeader*>(gh)->TriggerJet(ijet, tmpjet);
2834  jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
2835  //Compare jet pT and pt Hard
2836  if(jet->Pt() > fMaxFacPtHard * ptHard){
2837  eventAccepted= kFALSE;
2838  }
2839  if (jet->Pt() > fMaxPtJetMC) fMaxPtJetMC = jet->Pt();
2840  }
2841  if (jet) delete jet;
2842  if (mcEvent){
2843  for(Long_t i = 0; i < mcEvent->GetNumberOfPrimaries(); i++) {
2844  TParticle* particle = (TParticle *)mcEvent->Particle(i);
2845  if (!particle) continue;
2846  if (TMath::Abs(particle->GetPdgCode()) == 111 || TMath::Abs(particle->GetPdgCode()) == 221){
2847  if (particle->Pt() > fMaxFacPtHardSingleParticle*ptHard){
2848  eventAccepted= kFALSE;
2849  }
2850  }
2851 
2852  }
2853  }
2854 
2856  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2857  21, 28, 36, 45, 57,
2858  70, 85, 99, 115, 132,
2859  150, 169, 190, 212, 235,
2860  1000000};
2861  Double_t weightsBins[20] = { 43.7553, 13.5848, 6.788, 2.67826, 0.975255,
2862  0.39069, 0.127342, 0.0465597, 0.0206539, 0.00750243,
2863  0.00319118, 0.00122291, 0.000641232, 0.000321437, 0.000168273,
2864  9.17033e-05, 5.34755e-05, 3.01354e-05, 1.74518e-05, 2.8004e-05};
2865  Int_t bin = 0;
2866  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2867  if (bin < 20) weight = weightsBins[bin];
2868 
2869  } else if ( fPeriodEnum == kLHC16P1JJ || fPeriodEnum == kLHC17P1JJ ){
2870  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2871  21, 28, 36, 45, 57,
2872  70, 85, 99, 115, 132,
2873  150, 169, 190, 212, 235,
2874  1000000};
2875  Double_t weightsBins[20] = { 43.8654, 13.6215, 6.79856, 2.67526, 0.978794,
2876  0.390797, 0.127769, 0.0465714, 0.0206173, 0.00750282,
2877  0.00318773, 0.00122533, 0.000644385, 0.000321225, 0.00016846,
2878  9.18305e-05, 5.33507e-05, 3.00677e-05, 1.74608e-05, 2.80823e-05};
2879 
2880  Int_t bin = 0;
2881  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2882  if (bin < 20) weight = weightsBins[bin];
2883 
2884  } else if ( fPeriodEnum == kLHC16h3 ){
2885  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2886  21, 28, 36, 45, 57,
2887  70, 85, 99, 115, 132,
2888  150, 169, 190, 212, 235,
2889  1000000};
2890  Double_t weightsBins[20] = { 16.0869, 4.61169, 2.14976, 0.782544, 0.264854,
2891  9.7619E-02, 2.92747E-02, 9.89515E-03, 4.05152E-03, 1.35393E-03,
2892  5.29864E-04, 1.88317E-04, 9.23E-05, 4.29E-05, 2.09E-05,
2893  1.06E-05, 5.76E-06, 3.00E-06, 1.62E-06, 2.10E-06 };
2894  Int_t bin = 0;
2895  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2896  if (bin < 20) weight = weightsBins[bin];
2897 
2898 
2899  } else if ( fPeriodEnum == kLHC15a3b || fPeriodEnum == kLHC15g1b ){
2900  Double_t ptHardBinRanges[13] = { 5, 7, 9, 12, 16,
2901  21, 28, 36, 45, 57,
2902  70, 85, 1000};
2903  Double_t weightsBins[12] = { 7.858393e-03, 4.718691e-03, 4.077575e-03, 2.814527e-03, 1.669625e-03,
2904  1.007535e-03, 4.536554e-04, 2.111041e-04, 1.094840e-04, 4.404973e-05,
2905  1.933238e-05, 1.562895e-05};
2906  Int_t bin = 0;
2907  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2908  if (bin < 12) weight = weightsBins[bin];
2909 
2910  } else if ( fPeriodEnum == kLHC15g1a ){
2911  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
2912  84, 117, 152, 191, 1000000,
2913  5, 7, 9, 12, 16,
2914  21, 28, 36, 45, 57 };
2915  Double_t weightsBins[19] = { 4.43629 , 0.49523, 0.0394921, 0.00383174, 0.000446559,
2916  6.37374e-05, 1.03134e-05, 2.27012e-06, 7.59281e-07, 0,
2917  2.62906, 1.12884, 0.656873, 0.262822, 0.0876732,
2918  0.0307759, 0.0087083, 0.0027664, 0.00106203};
2919 
2920  Int_t bin = 0;
2921  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
2922  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
2923  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2924  if (bin < 19) weight = weightsBins[bin];
2925 
2926  } else if ( fPeriodEnum == kLHC15a3a || fPeriodEnum == kLHC15a3a_plus ) {
2927  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
2928  84, 117, 152, 191, 1000000,
2929  5, 7, 9, 12, 16,
2930  21, 28, 36, 45, 57 };
2931  // LHC15a3a
2932  Double_t weightsBins[19] = { 4.43897 , 0.495766, 0.039486, 0.00383011, 0.000447104,
2933  6.37277e-05, 1.03166e-05, 2.26971e-06, 7.59023e-07, 0,
2934  2.63331, 1.12815, 0.657034, 0.262756, 0.0877227,
2935  0.0307638, 0.00870635, 0.00276658, 0.00106229};
2936  Int_t bin = 0;
2937  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
2938  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
2939  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2940  if (bin < 19) weight = weightsBins[bin];
2941 
2942  } else if ( fPeriodEnum == kLHC12P2JJ ){
2943  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
2944  21, 28, 36, 45, 57,
2945  70, 85, 99, 115, 132,
2946  150, 169, 190, 212, 235,
2947  1000000};
2948  Double_t weightsBins[20] = { 28.3084, 8.43277, 4.07753, 1.54359, 0.543318,
2949  0.208394, 0.0652349, 0.0186904, 0.00834528, 0.00301414,
2950  0.00125939, 0.000474403, 0.000244052, 0.00011924, 6.09838e-05,
2951  3.24148e-05, 1.84314e-05, 1.00926e-05, 5.68632e-06, 8.38092e-06};
2952  Int_t bin = 0;
2953  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2954  if (bin < 20) weight = weightsBins[bin];
2955 
2956  } else if ( fPeriodEnum == kLHC16c3a ){ // ALIROOT-5901
2957  Double_t ptHardBinRanges[6] = { 7, 9, 12, 16, 21, 1000};
2958  Double_t weightsBins[5] = { 6.731200e-03, 7.995602e-03, 6.778717e-03, 4.643571e-03, 6.014497e-03}; //preliminary estimates
2959  Int_t bin = 0;
2960  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2961  if (bin < 5) weight = weightsBins[bin];
2962 
2963  } else if (fPeriodEnum == kLHC16c3b ){ // ALIROOT-5901
2964  Double_t ptHardBinRanges[7] = { 14, 19, 26, 35, 48, 66, 1000};
2965  Double_t weightsBins[6] = { 6.071458e-03, 3.941701e-03, 2.001984e-03, 9.862765e-04, 3.893911e-04, 1.865924e-04}; //preliminary estimates
2966  Int_t bin = 0;
2967  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2968  if (bin < 6) weight = weightsBins[bin];
2969 
2970  } else if (fPeriodEnum == kLHC16c3c ){ // ALIROOT-5901
2971  Double_t ptHardBinRanges[8] = { 0, 5, 11, 21, 36, 57, 84, 1000};
2972  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
2973  Int_t bin = 0;
2974  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2975  if (bin < 7) weight = weightsBins[bin];
2976 
2977  } else if ( fPeriodEnum == kLHC13b4_fix || fPeriodEnum == kLHC13b4_plus ){
2978  Double_t ptHardBinRanges[11] = { 5, 11, 21, 36, 57,
2979  84, 117, 152, 191, 234,
2980  1000};
2981  Double_t weightsBins[10] = { 2.24185e-6 , 2.48463e-7, 2.23171e-8, 2.43667e-9, 3.29934e-10,
2982  5.34592e-11, 1.00937e-11, 2.6493e-12, 8.53912e-13, 5.43077e-13};
2983  Int_t bin = 0;
2984  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2985  if (bin < 10) weight = weightsBins[bin];
2986  } else if ( fPeriodEnum == kLHC17g8a ){ // preliminary weights obtained from local running
2987  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};
2988  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};
2989  Int_t bin = 0;
2990  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2991  if (bin < 20) weight = weightsBins[bin];
2992  } else if ( fPeriodEnum == kLHC16rP1JJ ){ // preliminary weights obtained from local running
2993  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};
2994  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};
2995  Int_t bin = 0;
2996  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
2997  if (bin < 20) weight = weightsBins[bin];
2998  } else if ( fPeriodEnum == kLHC16sP1JJ ){ // preliminary weights obtained from local running
2999  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};
3000  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};
3001  Int_t bin = 0;
3002  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3003  if (bin < 20) weight = weightsBins[bin];
3004  } else if ( fPeriodEnum == kLHC17i3a1 ){ // weights obtained from ga_pp_mc_aod train 912
3005  Double_t ptHardBinRanges[7] = { 5, 11, 21, 36, 57, 84, 10000};
3006  Double_t weightsBins[6] = { 0.0002181, 3.13684e-05, 5.01515e-06, 9.50662e-07, 2.08186e-07, 7.96555e-08};
3007  Int_t bin = 0;
3008  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3009  if (bin < 6) weight = weightsBins[bin];
3010  } else {
3011  weight = 1;
3012  }
3013 
3014  if (weight == -1) return kFALSE;
3015  else return eventAccepted;
3016 
3017  }
3018  }
3019  } else {
3020  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
3021  TString eventHeaderName = eventHeader->ClassName();
3022  Bool_t eventAccepted = kFALSE;
3023  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0 || eventHeaderName.Contains("Pythia8Jets")){
3024  eventAccepted = kTRUE;
3025  }else { //special case for pythia8jets embedded in EPOSLHC for AODs
3026  if(event->IsA()==AliAODEvent::Class()){
3027  AliAODMCHeader *mch = NULL;
3028  AliAODEvent * aod = dynamic_cast<AliAODEvent*> (event);
3029  if(aod){
3030  mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader"));
3031  if ( mch ){
3032  Int_t nGenerators = mch->GetNCocktailHeaders();
3033  if ( nGenerators > 0 ){
3034  for(Int_t igen = 0; igen < nGenerators; igen++)
3035  {
3036  AliGenEventHeader * eventHeaderGen = mch->GetCocktailHeader(igen) ;
3037  TString name = eventHeaderGen->GetName();
3038  if (name.CompareTo("AliGenPythiaEventHeader") == 0 || name.Contains("Pythia8Jets")){
3039  eventAccepted = kTRUE;
3040  eventHeader = eventHeaderGen;
3041  }
3042  }
3043  }
3044  }
3045  }
3046  }
3047  }
3048  if(eventAccepted){
3049  TParticle * jet = 0;
3050  Int_t nTriggerJets = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->NTriggerJets();
3051  Float_t ptHard = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->GetPtHard();
3052  Float_t tmpjet[]={0,0,0,0};
3053  for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){
3054  dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->TriggerJet(ijet, tmpjet);
3055  jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
3056  //Compare jet pT and pt Hard
3057  if(jet->Pt() > fMaxFacPtHard * ptHard){
3058  eventAccepted= kFALSE;
3059  }
3060  if (jet->Pt() > fMaxPtJetMC) fMaxPtJetMC = jet->Pt();
3061  }
3062  if (mcEvent){
3063  for(Long_t i = 0; i < mcEvent->GetNumberOfPrimaries(); i++) {
3064  TParticle* particle = (TParticle *)mcEvent->Particle(i);
3065  if (!particle) continue;
3066  if (TMath::Abs(particle->GetPdgCode()) == 111 || TMath::Abs(particle->GetPdgCode()) == 221){
3067  if (particle->Pt() > fMaxFacPtHardSingleParticle*ptHard){
3068  eventAccepted= kFALSE;
3069  }
3070  }
3071 
3072  }
3073  }
3074 
3076  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3077  21, 28, 36, 45, 57,
3078  70, 85, 99, 115, 132,
3079  150, 169, 190, 212, 235,
3080  1000000};
3081  Double_t weightsBins[20] = { 43.7553, 13.5848, 6.788, 2.67826, 0.975255,
3082  0.39069, 0.127342, 0.0465597, 0.0206539, 0.00750243,
3083  0.00319118, 0.00122291, 0.000641232, 0.000321437, 0.000168273,
3084  9.17033e-05, 5.34755e-05, 3.01354e-05, 1.74518e-05, 2.8004e-05};
3085  Int_t bin = 0;
3086  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3087  if (bin < 20) weight = weightsBins[bin];
3088 
3089  } else if ( fPeriodEnum == kLHC16P1JJ || fPeriodEnum == kLHC17P1JJ){
3090  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3091  21, 28, 36, 45, 57,
3092  70, 85, 99, 115, 132,
3093  150, 169, 190, 212, 235,
3094  1000000};
3095  Double_t weightsBins[20] = { 43.8654, 13.6215, 6.79856, 2.67526, 0.978794,
3096  0.390797, 0.127769, 0.0465714, 0.0206173, 0.00750282,
3097  0.00318773, 0.00122533, 0.000644385, 0.000321225, 0.00016846,
3098  9.18305e-05, 5.33507e-05, 3.00677e-05, 1.74608e-05, 2.80823e-05};
3099 
3100  Int_t bin = 0;
3101  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3102  if (bin < 20) weight = weightsBins[bin];
3103 
3104  } else if ( fPeriodEnum == kLHC16h3 ){
3105  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3106  21, 28, 36, 45, 57,
3107  70, 85, 99, 115, 132,
3108  150, 169, 190, 212, 235,
3109  1000000};
3110  Double_t weightsBins[20] = { 16.0869, 4.61169, 2.14976, 0.782544, 0.264854,
3111  9.7619E-02, 2.92747E-02, 9.89515E-03, 4.05152E-03, 1.35393E-03,
3112  5.29864E-04, 1.88317E-04, 9.23E-05, 4.29E-05, 2.09E-05,
3113  1.06E-05, 5.76E-06, 3.00E-06, 1.62E-06, 2.10E-06 };
3114  Int_t bin = 0;
3115  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3116  if (bin < 20) weight = weightsBins[bin];
3117 
3118 
3119  } else if ( fPeriodEnum == kLHC15a3b || fPeriodEnum == kLHC15g1b ){
3120  Double_t ptHardBinRanges[13] = { 5, 7, 9, 12, 16,
3121  21, 28, 36, 45, 57,
3122  70, 85, 1000};
3123  Double_t weightsBins[12] = { 7.858393e-03, 4.718691e-03, 4.077575e-03, 2.814527e-03, 1.669625e-03,
3124  1.007535e-03, 4.536554e-04, 2.111041e-04, 1.094840e-04, 4.404973e-05,
3125  1.933238e-05, 1.562895e-05};
3126  Int_t bin = 0;
3127  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3128  if (bin < 12) weight = weightsBins[bin];
3129 
3130  } else if ( fPeriodEnum == kLHC15g1a ){
3131  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
3132  84, 117, 152, 191, 1000000,
3133  5, 7, 9, 12, 16,
3134  21, 28, 36, 45, 57 };
3135  Double_t weightsBins[19] = { 4.43629 , 0.49523, 0.0394921, 0.00383174, 0.000446559,
3136  6.37374e-05, 1.03134e-05, 2.27012e-06, 7.59281e-07, 0,
3137  2.62906, 1.12884, 0.656873, 0.262822, 0.0876732,
3138  0.0307759, 0.0087083, 0.0027664, 0.00106203};
3139 
3140  Int_t bin = 0;
3141  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
3142  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
3143  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3144  if (bin < 19) weight = weightsBins[bin];
3145 
3146  } else if ( fPeriodEnum == kLHC15a3a || fPeriodEnum == kLHC15a3a_plus ) {
3147  Double_t ptHardBinRanges[20] = { 5, 11, 21, 36, 57,
3148  84, 117, 152, 191, 1000000,
3149  5, 7, 9, 12, 16,
3150  21, 28, 36, 45, 57 };
3151  // LHC15a3a
3152  Double_t weightsBins[19] = { 4.43897 , 0.495766, 0.039486, 0.00383011, 0.000447104,
3153  6.37277e-05, 1.03166e-05, 2.26971e-06, 7.59023e-07, 0,
3154  2.63331, 1.12815, 0.657034, 0.262756, 0.0877227,
3155  0.0307638, 0.00870635, 0.00276658, 0.00106229};
3156  Int_t bin = 0;
3157  Int_t binFromFile = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetPtHardFromFile();
3158  if (binFromFile != -1 && binFromFile >9 && ptHard < 57) bin = 9;
3159  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3160  if (bin < 19) weight = weightsBins[bin];
3161 
3162  } else if ( fPeriodEnum == kLHC12P2JJ ){
3163  Double_t ptHardBinRanges[21] = { 5, 7, 9, 12, 16,
3164  21, 28, 36, 45, 57,
3165  70, 85, 99, 115, 132,
3166  150, 169, 190, 212, 235,
3167  1000000};
3168  Double_t weightsBins[20] = { 28.3084, 8.43277, 4.07753, 1.54359, 0.543318,
3169  0.208394, 0.0652349, 0.0186904, 0.00834528, 0.00301414,
3170  0.00125939, 0.000474403, 0.000244052, 0.00011924, 6.09838e-05,
3171  3.24148e-05, 1.84314e-05, 1.00926e-05, 5.68632e-06, 8.38092e-06};
3172  Int_t bin = 0;
3173  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3174  if (bin < 20) weight = weightsBins[bin];
3175 
3176  } else if ( fPeriodEnum == kLHC16c3a ){ //ALIROOT-5901
3177  Double_t ptHardBinRanges[6] = { 7, 9, 12, 16, 21, 1000};
3178  Double_t weightsBins[5] = { 6.731200e-03, 7.995602e-03, 6.778717e-03, 4.643571e-03, 6.014497e-03}; //preliminary estimates
3179  Int_t bin = 0;
3180  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3181  if (bin < 5) weight = weightsBins[bin];
3182 
3183  } else if (fPeriodEnum == kLHC16c3b ){ //ALIROOT-5901
3184  Double_t ptHardBinRanges[7] = { 14, 19, 26, 35, 48, 66, 1000};
3185  Double_t weightsBins[6] = { 6.071458e-03, 3.941701e-03, 2.001984e-03, 9.862765e-04, 3.893911e-04, 1.865924e-04}; //preliminary estimates
3186  Int_t bin = 0;
3187  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3188  if (bin < 6) weight = weightsBins[bin];
3189 
3190  } else if (fPeriodEnum == kLHC16c3c ){ //ALIROOT-5901
3191  Double_t ptHardBinRanges[8] = { 0, 5, 11, 21, 36, 57, 84, 1000};
3192  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
3193  Int_t bin = 0;
3194  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3195  if (bin < 7) weight = weightsBins[bin];
3196 
3197  } else if ( fPeriodEnum == kLHC13b4_fix || fPeriodEnum == kLHC13b4_plus ){
3198  Double_t ptHardBinRanges[11] = { 5, 11, 21, 36, 57,
3199  84, 117, 152, 191, 234,
3200  1000};
3201  Double_t weightsBins[10] = { 2.24185e-6 , 2.48463e-7, 2.23171e-8, 2.43667e-9, 3.29934e-10,
3202  5.34592e-11, 1.00937e-11, 2.6493e-12, 8.53912e-13, 5.43077e-13};
3203  Int_t bin = 0;
3204  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3205  if (bin < 10) weight = weightsBins[bin];
3206  } else if ( fPeriodEnum == kLHC16rP1JJ ){ // preliminary weights obtained from local running
3207  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};
3208  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};
3209  Int_t bin = 0;
3210  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3211  if (bin < 20) weight = weightsBins[bin];
3212  } else if ( fPeriodEnum == kLHC16sP1JJ ){ // preliminary weights obtained from local running
3213  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};
3214  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};
3215  Int_t bin = 0;
3216  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3217  if (bin < 20) weight = weightsBins[bin];
3218  } else if ( fPeriodEnum == kLHC17i3a1 ){ // weights obtained from ga_pp_mc_aod train 912
3219  Double_t ptHardBinRanges[7] = { 5, 11, 21, 36, 57, 84, 10000};
3220  Double_t weightsBins[6] = { 0.0002181, 3.13684e-05, 5.01515e-06, 9.50662e-07, 2.08186e-07, 7.96555e-08};
3221  Int_t bin = 0;
3222  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3223  if (bin < 6) weight = weightsBins[bin];
3224  } else if ( fPeriodEnum == kLHC18b8 ){
3225  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};
3226  Double_t weightsBins[20] = { 16.1083, 4.60917, 2.15196, 0.782021, 0.26541,
3227  0.0978374, 0.0294286, 0.00989457, 0.0040615, 0.00135787,
3228  0.000531766, 0.000188772, 9.23331e-05, 4.30245e-05, 2.10196e-05,
3229  1.06695e-05, 5.78742e-06, 3.02897e-06, 1.62702e-06, 2.12118e-06 };
3230 
3231  Int_t bin = 0;
3232  while (!((ptHard< ptHardBinRanges[bin+1] && ptHard > ptHardBinRanges[bin]) || (ptHard == ptHardBinRanges[bin]) ) )bin++;
3233  if (bin < 20) weight = weightsBins[bin];
3234  } else {
3235  weight = 1;
3236  }
3237 
3238  if (weight == -1) return kFALSE;
3239  else return eventAccepted;
3240 
3241  } else {
3242  return kFALSE;
3243  }
3244  }
3245 
3246  return kFALSE;
3247 }
3248 
3249 //________________________________________________________________________
3250 // Analysing Jet-Jet MC's
3251 //________________________________________________________________________
3252 void AliConvEventCuts::GetXSectionAndNTrials(AliMCEvent *mcEvent, Float_t &XSection, Float_t &NTrials, AliVEvent* event){
3253 
3254  AliGenCocktailEventHeader *cHeader = 0x0;
3255  Bool_t headerFound = kFALSE;
3256  if ( fPeriodEnum != kLHC18b8 && // LHC17pq pp 5TeV JetJet MC's
3257  fPeriodEnum != kLHC17i3a1 && // LHC16ijklop GammaJet MC EMCal triggered
3258  fPeriodEnum != kLHC17g8a && // LHC16qt pPb 5TeV JetJet MC's
3259  fPeriodEnum != kLHC16rP1JJ && fPeriodEnum != kLHC16sP1JJ && // LHC16sr pPb 8TeV JetJet MC's
3260  fPeriodEnum != kLHC16P1JJ && fPeriodEnum != kLHC16P1JJLowB && // LHC16X Jet Jet MC's
3261  fPeriodEnum != kLHC17P1JJ && fPeriodEnum != kLHC17P1JJLowB && // LHC17X Jet Jet MC's
3262  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
3263  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
3264  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
3265  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
3266  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
3267  fPeriodEnum != kLHC12P2JJ // LHC12 JetJet MC
3268  ){
3269  NTrials = -1;
3270  XSection = -1;
3271  return;
3272  }
3273 
3274  if(mcEvent){
3275  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
3276  if(cHeader) headerFound = kTRUE;
3277  }else{
3278  //no mcEvent available -> not running on MC
3279  NTrials = -1;
3280  XSection = -1;
3281  return;
3282  }
3283 
3284  if(headerFound){
3285  TList *genHeaders = 0x0;
3286  if(cHeader) genHeaders = cHeader->GetHeaders();
3287  AliGenEventHeader* gh = 0;
3288  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3289  gh = (AliGenEventHeader*)genHeaders->At(i);
3290  TString GeneratorName = gh->GetName();
3291  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0 || GeneratorName.Contains("Pythia8Jets")){
3292  AliGenPythiaEventHeader* gPythia = dynamic_cast<AliGenPythiaEventHeader*>(gh);
3293  NTrials = gPythia->Trials();
3294  XSection = gPythia->GetXsection();
3295  return;
3296  }
3297  }
3298  } else {
3299  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
3300  if(eventHeader){
3301  TString eventHeaderName = eventHeader->ClassName();
3302  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0 || eventHeaderName.Contains("Pythia8Jets")){
3303  AliGenPythiaEventHeader* gPythia = dynamic_cast<AliGenPythiaEventHeader*>(eventHeader);
3304  NTrials = gPythia->Trials();
3305  XSection = gPythia->GetXsection();
3306  return;
3307  }
3308  }
3309  }
3310  // the following part is necessary for pythia8jets embedded in EPOS for AODs
3311  if(event){
3312  if(event->IsA()==AliAODEvent::Class()){
3313  AliAODMCHeader *mch = NULL;
3314  AliAODEvent * aod = dynamic_cast<AliAODEvent*> (event);
3315  if(aod){
3316  mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader"));
3317  if ( mch ){
3318  Int_t nGenerators = mch->GetNCocktailHeaders();
3319  if ( nGenerators > 0 ){
3320  for(Int_t igen = 0; igen < nGenerators; igen++){
3321  AliGenEventHeader * eventHeaderGen = mch->GetCocktailHeader(igen) ;
3322  TString name = eventHeaderGen->GetName();
3323  if (name.CompareTo("AliGenPythiaEventHeader") == 0 || name.Contains("Pythia8Jets")){
3324  AliGenPythiaEventHeader* gPythia = dynamic_cast<AliGenPythiaEventHeader*>(eventHeaderGen);
3325  NTrials = gPythia->Trials();
3326  XSection = gPythia->GetXsection();
3327  return;
3328  }
3329  }
3330  }
3331  }
3332  }
3333  }
3334  }
3335 
3336  NTrials = -1;
3337  XSection = -1;
3338  return;
3339 }
3340 
3341 
3342 //________________________________________________________________________
3343 // Analysing Jet-Jet MC's
3344 //________________________________________________________________________
3345 Float_t AliConvEventCuts::GetPtHard(AliMCEvent *mcEvent, AliVEvent* event){
3346  AliGenCocktailEventHeader *cHeader = 0x0;
3347  Bool_t headerFound = kFALSE;
3348 
3349  if ( fPeriodEnum != kLHC18b8 && // LHC17pq pp 5TeV JetJet MC's
3350  fPeriodEnum != kLHC17g8a && // LHC16qt pPb 5TeV JetJet MC's
3351  fPeriodEnum != kLHC16rP1JJ && fPeriodEnum != kLHC16sP1JJ && // LHC16sr pPb 8TeV JetJet MC's
3352  fPeriodEnum != kLHC16P1JJ && fPeriodEnum != kLHC16P1JJLowB && // LHC16X Jet Jet MC's
3353  fPeriodEnum != kLHC17P1JJ && fPeriodEnum != kLHC17P1JJLowB && // LHC17X Jet Jet MC's
3354  fPeriodEnum != kLHC16h3 && // LHC15n Jet Jet MC's
3355  fPeriodEnum != kLHC15a3a && fPeriodEnum != kLHC15a3a_plus && fPeriodEnum != kLHC15a3b && // LHC13g Jet Jet MC's
3356  fPeriodEnum != kLHC15g1a && fPeriodEnum != kLHC15g1b && // LHC11a Jet Jet MC's
3357  fPeriodEnum != kLHC13b4_fix && fPeriodEnum != kLHC13b4_plus && // LHC13 pPb Jet Jet MC's
3358  fPeriodEnum != kLHC16c3a && fPeriodEnum != kLHC16c3b && fPeriodEnum != kLHC16c3c && // LHC13 pPb Jet Jet MC's
3359  fPeriodEnum != kLHC12P2JJ // LHC12 JetJet MC
3360  ) return -1;
3361 
3362  if(mcEvent){
3363  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(mcEvent->GenEventHeader());
3364  if(cHeader) headerFound = kTRUE;
3365  }else{
3366  //no mcEvent available -> not running on MC
3367  return -1;
3368  }
3369 
3370  if(headerFound){
3371  TList *genHeaders = 0x0;
3372  if(cHeader) genHeaders = cHeader->GetHeaders();
3373  AliGenEventHeader* gh = 0;
3374  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
3375  gh = (AliGenEventHeader*)genHeaders->At(i);
3376  TString GeneratorName = gh->GetName();
3377  if (GeneratorName.CompareTo("AliGenPythiaEventHeader") == 0 || GeneratorName.Contains("Pythia8Jets")){
3378  return dynamic_cast<AliGenPythiaEventHeader*>(gh)->GetPtHard();
3379  }
3380  }
3381  } else {
3382  AliGenEventHeader * eventHeader = mcEvent->GenEventHeader();
3383  if(eventHeader){
3384  TString eventHeaderName = eventHeader->ClassName();
3385  if (eventHeaderName.CompareTo("AliGenPythiaEventHeader") == 0 || eventHeaderName.Contains("Pythia8Jets")){
3386  return dynamic_cast<AliGenPythiaEventHeader*>(eventHeader)->GetPtHard();
3387  }
3388  }
3389 
3390  if(event->IsA()==AliAODEvent::Class()){
3391  AliAODMCHeader *mch = NULL;
3392  AliAODEvent * aod = dynamic_cast<AliAODEvent*> (event);
3393  if(aod){
3394  mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader"));
3395  if ( mch ){
3396  Int_t nGenerators = mch->GetNCocktailHeaders();
3397  if ( nGenerators > 0 ){
3398  for(Int_t igen = 0; igen < nGenerators; igen++)
3399  {
3400  AliGenEventHeader * eventHeaderGen = mch->GetCocktailHeader(igen) ;
3401  TString name = eventHeaderGen->GetName();
3402  if (name.CompareTo("AliGenPythiaEventHeader") == 0 || name.Contains("Pythia8Jets")){
3403  return dynamic_cast<AliGenPythiaEventHeader*>(eventHeaderGen)->GetPtHard();
3404  }
3405  }
3406  }
3407  }
3408  }
3409  }
3410  }
3411 
3412  return -1;
3413 }
3414 
3415 
3416 //________________________________________________________________________
3418  // abort if mimicing not enabled
3419 
3420  if (!fMimicTrigger) return kTRUE;
3421 
3422  Int_t runRangesEMCalL0 [52] = { 144871, 145288, 146375, 146382, // LHC11a
3423  146502, 148522, // LHC11a
3424  150209, 153056, 153911, 153915, // LHC11b,c,d
3425  158135, 158136, 158178, 158182, 160683,
3426  160764, 161139, 161256, 161379, 161457,
3427  161525, 161556, 161558, 161609, 161630,
3428  161724, // LHC11d,e
3429  173731, 177144, 177147, 177653, 177724, 178327, // LHC12x
3430  195180, // LHC13b-f
3431  197469, 197692, // LHC13g
3432  235195, // LHC15a-h
3433  244285, // LHC15i-LHC15m (235196-244284)
3434  244629, // LHC15n (244340-244628)
3435  245141, 246995, // LHC15o (244824-246994)
3436  255539, // LHC16i-k (255515-258574)
3437  258883, // LHC16l (258883-260187)
3438  260216, // LHC16m-p (260216-p)
3439  265015, 265309, // LHC16q (265015-265525)
3440  265589, 265785, // LHC16r (265589-266318)
3441  266405, // LHC16s (266405-267131)
3442  267161, // LHC16t (267161-267166)
3443  270531, // LHC17c-o (270531-281961)
3444  282008, // LHC17pq (282008-282441)
3445  282504 // 2018
3446  };
3447 
3448  Double_t thresholdEMCalL0[51] = { 2.11, 3.43, 1.71, 2.05, // LHC11a 7 TeV
3449  3.43, // LHC11a 2.76TeV
3450  1.94, 3.39, 4.01, 5.25, 5.5, // LHC11b, LHC11c, LHC11d
3451  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,
3452  2.01, 1.75, 1.52, 2.01, 1.52, 1.85,
3453  3.2,
3454  /*2.01*/1.8, // LHC13g
3455  2000, // LS1
3456  1.8, // LHC15a-h
3457  5.0, // LHC15i-m
3458  5.0, // LHC15n
3459  1.0, 1.0, // LHC15o
3460  2.2, // LHC16i-k (255515-258574)
3461  2.2, // LHC16l (258883-260187)
3462  2.5, // LHC16m-p (260216-p)
3463  2.5, 2.5, // LHC16q (265015-265525)
3464  2.5, 2.5, // LHC16r (265589-266318)
3465  3.5, // LHC16s (266405-267131)
3466  2.5, // LHC16t (267161-267166)
3467  2.5, // LHC17c-o (270531-281961)
3468  2.5 // LHC17pq (282008-282441)
3469 // 2.5 // 2018
3470  };
3471 
3472  Double_t spreadEMCalL0[51] = { 0., 0., 0, 0, // LHC11a 7TeV
3473  /*0.7*/0.65, // LHC11a 2.76TeV
3474  0., 0., 0., 0., 0., // LHC11b, LHC11c, LHC11d
3475  0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
3476  0., 0., 0., 0., 0.2, 0.2,/*0.,0.,*/
3477  0.1, // LHC13b-f
3478  /*0.1*/0.12, // LHC13g
3479  0., // LS1
3480  0.1, // LHC15a-h
3481  0.1, // LHC15i-m
3482  0.1, // LHC15n
3483  0.1, 0.1, // LHC15o
3484  0.2, // LHC16i-k (255515-258574)
3485  0.2, // LHC16l (258883-260187)
3486  0.1, // LHC16m-p (260216-p)
3487  0.1, 0.1, // LHC16q (265015-265525)
3488  0.1, 0.1, // LHC16r (265589-266318)
3489  0.1, // LHC16s (266405-267131)
3490  0.1, // LHC16t (267161-267166)
3491  0.1, // LHC17c-o (270531-281961)
3492  0.1 // LHC17pq (282008-282441)
3493 // 0.1 // 2018
3494  };
3495 
3496  Int_t runRangesEMCalL1[21] = { 179796, // LHC12c-i (EGA)
3497  195180, // LHC13b-f
3498  197469, 197692, // LHC13g
3499  235195, // LHC15a-h
3500  244285, // LHC15i-LHC15m (235196-244284)
3501  244629, // LHC15n (244340-244628)
3502  245141, 246995, // LHC15o (244824-246994)
3503  255539, // LHC16i-k (255515-258574)
3504  258883, // LHC16l (258883-260187)
3505  260216, // LHC16m-p (260216-p)
3506  265015, 265309, // LHC16q (265015-265525)
3507  265589, 265785, // LHC16r (265589-266318)
3508  266405, // LHC16s (266405-267131)
3509  267161, // LHC16t (267161-267166)
3510  270531, // LHC17c-o (270531-281961)
3511  282008, // LHC17pq (282008-282441)
3512  282504 // 2018
3513  };
3514 
3515  Double_t thresholdEMCalL1[20] = { 9.5/*8.398*/, // LHC12c-i (EGA)
3516  11.5, /*6.*/ // LHC13b-f
3517  5.5, // LHC13g
3518  2000.0, // LS1
3519  2000.0, // LHC15a-h
3520  5.0, // LHC15i-m
3521  5.0, // LHC15n
3522  2000.0, 10.0, // LHC15o
3523  8.8, // LHC16i-k (255515-258574)
3524  5.5, // LHC16l (258883-260187)
3525  8.8, // LHC16m-p (260216-)
3526  8.8, 10.8, // LHC16q (265015-265525)
3527  10.8, 7.8, // LHC16r (265589-266318)
3528  7.8, // LHC16s (266405-267131)
3529  7.8, // LHC16t (267161-267166)
3530  8.8, // LHC17c-o (270531-281961)
3531  8.8 // LHC17pq (282008-282441)
3532 // 8.8 // 2018
3533  };
3534  Double_t spreadEMCalL1[20] = { 1.0/*0.*/,
3535  0.5,
3536  /*0.4*/ 0.6,
3537  0.0, // LS1
3538  1.2, 0.8, // LHC16r (265589-266318)
3539  0.0, // LHC15a-h
3540  1.0, // LHC15i-m
3541  1.0, // LHC15n
3542  0.0, 1.0, // LHC15o
3543  1.0, // LHC16i-k (255515-258574)
3544  0.8, // LHC16l (258883-260187)
3545  1.0, // LHC16m-p (260216-)
3546  1.0, 1.2, // LHC16q (265015-265525)
3547  0.9, // LHC16s (266405-267131)
3548  0.9, // LHC16t (267161-267166)
3549  1.0, // LHC17c-o (270531-281961)
3550  1.0 // LHC17pq (282008-282441)
3551 // 1.0 // 2018
3552  };
3553 
3554  Int_t runRangesEMCalL1G2[21] = { 195180, // LHC13b-f
3555  197469, 197692, // LHC13g
3556  235195, // LHC15a-h
3557  244285, // LHC15i-LHC15m (235196-244284)
3558  244629, // LHC15n (244340-244628)
3559  245141, 246995, // LHC15o (244824-246994)
3560  255539, // LHC16i-k (255515-258574)
3561  258883, // LHC16l (258883-260187)
3562  260216, // LHC16m-p (260216-)
3563  265015, 265309, // LHC16q (265015-265525)
3564  265589, 265785, // LHC16r (265589-266318)
3565  266405, // LHC16s (266405-267131)
3566  267161, // LHC16t (267161-267166)
3567  270531, // LHC17c-o (270531-281961)
3568  282008, // LHC17pq (282008-282441)
3569  282504 // 2018
3570  };
3571 
3572  Double_t thresholdEMCalL1G2[19] = { 7.2, // LHC13b-f
3573  /*3.9*/3.75, // LHC13g
3574  2000.0, // LS1
3575  1.8, // LHC15a-h
3576  5.0, // LHC15i-m
3577  5.0, // LHC15n
3578  2000.0, 2000.0, // LHC15o
3579  3.9, // LHC16i-k (255515-258574)
3580  3.8, // LHC16l (258883-260187)
3581  3.9, // LHC16m-p (260216-)
3582  3.9, 6.3, // LHC16q (265015-265525)
3583  6.3, 5.3, // LHC16r (265589-266318)
3584  5.3, // LHC16s (266405-267131)
3585  5.3, // LHC16t (267161-267166)
3586  3.9, // LHC17c-o (270531-281961)
3587  3.9 // LHC17pq (282008-282441)
3588 // 3.9 // 2018
3589  };
3590  Double_t spreadEMCalL1G2[19] = { 0.3, // LHC13bf
3591  /*0.2*/0.25, // LHC13g
3592  0., // LS1
3593  0.1, // LHC15a-h
3594  0.1, // LHC15i-m
3595  0.1, // LHC15n
3596  0.1, 1.0, // LHC15o
3597  0.3, // LHC16i-k (255515-258574)
3598  0.3, // LHC16l (258883-260187)
3599  0.3, // LHC16m-p (260216-)
3600  0.3, 0.4, // LHC16q (265015-265525)
3601  0.4, 0.3, // LHC16r (265589-266318)
3602  0.3, // LHC16s (266405-267131)
3603  0.3, // LHC16t (267161-267166)
3604  0.3, // LHC17c-o (270531-281961)
3605  0.3 // LHC17pq (282008-282441)
3606 // 0.3 // 2018
3607  };
3608 
3609  Int_t runnumber = event->GetRunNumber();
3610 
3611  if (fSpecialTrigger == 5 ){
3612  if (runnumber < runRangesEMCalL0[0]) return kTRUE;
3613  Int_t binRun = 0;
3614  while (!(runnumber >= runRangesEMCalL0[binRun] && runnumber < runRangesEMCalL0[binRun+1] ) && binRun < 51 ){
3615 // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL0[binRun] << "\t" << runRangesEMCalL0[binRun+1] << ":\t"<< thresholdEMCalL0[binRun] << "\t" << spreadEMCalL0[binRun] << endl;
3616  binRun++;
3617  }
3618  if (binRun==51) return kFALSE;
3619 // cout << runnumber << "\t"<< binRun << "\t"<< thresholdEMCalL0[binRun] << "\t" << spreadEMCalL0[binRun] << endl;
3620  Double_t threshold = thresholdEMCalL0[binRun];
3621 
3622  if (isMC && spreadEMCalL0[binRun] != 0.){
3623  TF1* triggerSmearing = new TF1("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
3624  triggerSmearing->SetParameter(0, 1/(spreadEMCalL0[binRun]*TMath::Sqrt(TMath::Pi()*2)));
3625  triggerSmearing->SetParameter(1, thresholdEMCalL0[binRun]);
3626  triggerSmearing->SetParameter(2, spreadEMCalL0[binRun]);
3627  threshold = triggerSmearing->GetRandom();
3628  delete triggerSmearing;
3629  }
3630 
3631 // cout << "modified" << "\t"<< threshold << endl;
3632  Int_t nclus = 0;
3633  TClonesArray * arrClustersMimic = NULL;
3634  if(!fCorrTaskSetting.CompareTo("")){
3635  nclus = event->GetNumberOfCaloClusters();
3636  } else {
3637  arrClustersMimic = dynamic_cast<TClonesArray*>(event->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
3638  if(!arrClustersMimic)
3639  AliFatal(Form("%sClustersBranch was not found in AliConvEventCuts! Check the correction framework settings!",fCorrTaskSetting.Data()));
3640  nclus = arrClustersMimic->GetEntries();
3641  }
3642 
3643  if(nclus == 0) return kFALSE;
3644 
3645  // Loop over EMCal clusters
3646  Bool_t eventIsAccepted = kFALSE;
3647  for(Int_t i = 0; i < nclus; i++){
3648  if (eventIsAccepted) continue;
3649  AliVCluster* clus = NULL;
3650  if(event->IsA()==AliESDEvent::Class()){
3651  if(arrClustersMimic)
3652  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersMimic->At(i));
3653  else
3654  clus = event->GetCaloCluster(i);
3655  } else if(event->IsA()==AliAODEvent::Class()){
3656  if(arrClustersMimic)
3657  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersMimic->At(i));
3658  else
3659  clus = event->GetCaloCluster(i);
3660  }
3661 
3662  if (!clus){
3663  if(arrClustersMimic) delete clus;
3664  continue;
3665  }
3666  if (!clus->IsEMCAL()) {
3667  if(arrClustersMimic) delete clus;
3668  continue;
3669  }
3670  if (clus->GetM02()<0.1) {
3671  if(arrClustersMimic) delete clus;
3672  continue;
3673  }
3674  if (clus->GetNCells()<2) {
3675  if(arrClustersMimic) delete clus;
3676  continue;
3677  }
3678  if (clus->E() > threshold ){
3679 // cout << "found L0" << endl;
3680  eventIsAccepted = kTRUE;
3681  }
3682  if(arrClustersMimic)
3683  delete clus;
3684  }
3685  return eventIsAccepted;
3686 
3687  } else if (fSpecialTrigger == 6 ) {
3688 
3689  return kTRUE;
3690  } else if (fSpecialTrigger == 8 ) {
3691  if (fSpecialSubTriggerName.CompareTo("7EGA")==0 || fSpecialSubTriggerName.CompareTo("8EGA")==0 || fSpecialSubTriggerName.CompareTo("7EG1")==0 ||fSpecialSubTriggerName.CompareTo("8EG1")==0 ){
3692  if (runnumber < runRangesEMCalL1[0]) return kTRUE;
3693  Int_t binRun = 0;
3694  while (!(runnumber >= runRangesEMCalL1[binRun] && runnumber < runRangesEMCalL1[binRun+1] ) && binRun < 20 ){
3695 // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL1[binRun] << "\t" << runRangesEMCalL1[binRun+1] << ":\t"<< thresholdEMCalL1[binRun]<<"\t"<< spreadEMCalL1[binRun]<< endl;
3696  binRun++;
3697  }
3698  if (binRun==20) return kFALSE;
3699  Double_t threshold = thresholdEMCalL1[binRun];
3700 
3701  if (isMC && spreadEMCalL1[binRun] != 0.){
3702  TF1* triggerSmearing = new TF1("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
3703  triggerSmearing->SetParameter(0, 1/(spreadEMCalL1[binRun]*TMath::Sqrt(TMath::Pi()*2)));
3704  triggerSmearing->SetParameter(1, thresholdEMCalL1[binRun]);
3705  triggerSmearing->SetParameter(2, spreadEMCalL1[binRun]);
3706  threshold = triggerSmearing->GetRandom();
3707  delete triggerSmearing;
3708  }
3709 
3710 // cout << runnumber << "\t"<< binRun << "\t L1 \t"<< threshold << endl;
3711 
3712  TClonesArray * arrClustersMimic = NULL;
3713  Int_t nclus = 0;
3714  if(!fCorrTaskSetting.CompareTo("")){
3715  nclus = event->GetNumberOfCaloClusters();
3716  } else {
3717  arrClustersMimic = dynamic_cast<TClonesArray*>(event->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
3718  if(!arrClustersMimic)
3719  AliFatal(Form("%sClustersBranch was not found in AliConvEventCuts! Check the correction framework settings!",fCorrTaskSetting.Data()));
3720  nclus = arrClustersMimic->GetEntries();
3721  }
3722 
3723  if(nclus == 0) return kFALSE;
3724 
3725  // Loop over EMCal clusters
3726  Bool_t eventIsAccepted = kFALSE;
3727  for(Int_t i = 0; i < nclus; i++){
3728  if (eventIsAccepted) continue;
3729  AliVCluster* clus = NULL;
3730  if(event->IsA()==AliESDEvent::Class()){
3731  if(arrClustersMimic)
3732  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersMimic->At(i));
3733  else
3734  clus = event->GetCaloCluster(i);
3735  } else if(event->IsA()==AliAODEvent::Class()){
3736  if(arrClustersMimic)
3737  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersMimic->At(i));
3738  else
3739  clus = event->GetCaloCluster(i);
3740  }
3741  if (!clus) {
3742  if(arrClustersMimic) delete clus;
3743  continue;
3744  }
3745  if (!clus->IsEMCAL()) {
3746  if(arrClustersMimic) delete clus;
3747  continue;
3748  }
3749  if (clus->GetM02()<0.1) {
3750  if(arrClustersMimic) delete clus;
3751  continue;
3752  }
3753  if (clus->GetNCells()<2) {
3754  if(arrClustersMimic) delete clus;
3755  continue;
3756  }
3757  if (clus->E() > threshold ){
3758 // cout << "found L1G1\t" << clus->E() << endl;
3759  eventIsAccepted = kTRUE;
3760  }
3761  if(arrClustersMimic)
3762  delete clus;
3763  }
3764  return eventIsAccepted;
3765  } else if ( fSpecialSubTriggerName.CompareTo("7EG2")==0 ||fSpecialSubTriggerName.CompareTo("8EG2")==0 ){
3766  if (runnumber < runRangesEMCalL1G2[0]) return kTRUE;
3767  Int_t binRun = 0;
3768  while (!(runnumber >= runRangesEMCalL1G2[binRun] && runnumber < runRangesEMCalL1G2[binRun+1] ) && binRun < 19 ){
3769 // cout << runnumber << "\t" << binRun << "\t" << runRangesEMCalL1G2[binRun] << "\t" << runRangesEMCalL1G2[binRun+1] << ":\t"<< thresholdEMCalL1G2[binRun]<<"\t"<< spreadEMCalL1G2[binRun]<< endl;
3770  binRun++;
3771  }
3772 // cout << runnumber << "\t"<< binRun << "\t L2 \t"<< thresholdEMCalL1G2[binRun]<<"\t"<< spreadEMCalL1G2[binRun]<< endl;
3773  if (binRun==19) return kFALSE;
3774  Double_t threshold = thresholdEMCalL1G2[binRun];
3775  if (isMC && spreadEMCalL1G2[binRun] != 0.){
3776  TF1* triggerSmearing = new TF1("triggerSmearing","[0]*exp(-0.5*((x-[1])/[2])**2)",0,15);
3777  triggerSmearing->SetParameter(0, 1/(spreadEMCalL1G2[binRun]*TMath::Sqrt(TMath::Pi()*2)));
3778  triggerSmearing->SetParameter(1, thresholdEMCalL1G2[binRun]);
3779  triggerSmearing->SetParameter(2, spreadEMCalL1G2[binRun]);
3780  threshold = triggerSmearing->GetRandom();
3781  delete triggerSmearing;
3782  }
3783 // cout << "\t L2 mod\t"<< threshold << endl;
3784 
3785  Int_t nclus = 0;
3786  TClonesArray * arrClustersMimic = NULL;
3787  if(!fCorrTaskSetting.CompareTo("")){
3788  nclus = event->GetNumberOfCaloClusters();
3789  } else {
3790  arrClustersMimic = dynamic_cast<TClonesArray*>(event->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
3791  if(!arrClustersMimic)
3792  AliFatal(Form("%sClustersBranch was not found in AliConvEventCuts! Check the correction framework settings!",fCorrTaskSetting.Data()));
3793  nclus = arrClustersMimic->GetEntries();
3794  }
3795 
3796  if(nclus == 0) return kFALSE;
3797 
3798  // Loop over EMCal clusters
3799  Bool_t eventIsAccepted = kFALSE;
3800  for(Int_t i = 0; i < nclus; i++){
3801  if (eventIsAccepted) continue;
3802  AliVCluster* clus = NULL;
3803  if(event->IsA()==AliESDEvent::Class()){
3804  if(arrClustersMimic)
3805  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersMimic->At(i));
3806  else
3807  clus = event->GetCaloCluster(i);
3808  } else if(event->IsA()==AliAODEvent::Class()){
3809  if(arrClustersMimic)
3810  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersMimic->At(i));
3811  else
3812  clus = event->GetCaloCluster(i);
3813  }
3814  if (!clus) {
3815  if(arrClustersMimic) delete clus;
3816  continue;
3817  }
3818  if (!clus->IsEMCAL()) {
3819  if(arrClustersMimic) delete clus;
3820  continue;
3821  }
3822  if (clus->GetM02()<0.1) {
3823  if(arrClustersMimic) delete clus;
3824  continue;
3825  }
3826  if (clus->GetNCells()<2) {
3827  if(arrClustersMimic) delete clus;
3828  continue;
3829  }
3830  if (clus->E() > threshold ){
3831 // cout << "found L1G2" << endl;
3832  eventIsAccepted = kTRUE;
3833  }
3834  if(arrClustersMimic)
3835  delete clus;
3836  }
3837  return eventIsAccepted;
3838  }
3839  return kTRUE;
3840  } else if (fSpecialTrigger == 9 ) {
3841  return kTRUE;
3842  } else {
3843  return kTRUE;
3844  }
3845 
3846  return kTRUE;
3847 }
3848 
3849 
3850 //________________________________________________________________________
3852 {
3853 
3854  AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
3855 
3856 
3857  UInt_t isSelected = AliVEvent::kAny;
3858 
3859  if (fInputHandler==NULL) return kFALSE;
3860  if( fInputHandler->GetEventSelection() || event->IsA()==AliAODEvent::Class()) {
3861 
3862  TString firedTrigClass = event->GetFiredTriggerClasses();
3863  // if no trigger has been selected manually, select kAny in case of presel (also important for AOD filtering!)
3864  // in other cases select standards depending on system
3866  if (fPreSelCut) fOfflineTriggerMask = AliVEvent::kAny;
3867  else {
3868  if (fIsHeavyIon == 1){
3869  fOfflineTriggerMask = AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral;
3870  } else if (fIsHeavyIon == 2){
3871  fOfflineTriggerMask = AliVEvent::kINT7;
3872  } else {
3873  fOfflineTriggerMask = AliVEvent::kMB;
3874  }
3875  }
3876  }
3877 
3878  // in case of MC switch to kAny if no MB/INT7/INT8 has been selected
3879  if(isMC){
3880  if( fIsHeavyIon == 0){
3881  if( fOfflineTriggerMask != AliVEvent::kMB && fOfflineTriggerMask != AliVEvent::kINT7 && fOfflineTriggerMask != AliVEvent::kINT8 ){
3882  fOfflineTriggerMask = AliVEvent::kAny;
3883  }
3884  }else{
3885  fOfflineTriggerMask = AliVEvent::kAny;
3886  }
3887  }
3888 
3889  if (fOfflineTriggerMask){
3890  isSelected = fOfflineTriggerMask & fInputHandler->IsEventSelected();
3891  if (isSelected && !fPreSelCut){
3892 // cout << firedTrigClass.Data() << endl;
3893 // cout << "Special trigger: "<< fSpecialTrigger << " initialized " << fEMCALTrigInitialized << endl;
3894 // if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9){ // EMCAL triggers
3895 // if (!fEMCALTrigInitialized ) InitializeEMCALTrigger(event);
3896 // fTriggersEMCAL= GetTriggerList();
3897 // }
3898  if (fSpecialSubTrigger>0 && !isMC){
3899  if (!firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 0;
3900  if (fRejectTriggerOverlap){
3901  // trigger rejection EMC1,7,8
3902  if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CEMC7") == 0){
3903  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3904  } else if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CEMC1") == 0){
3905  if (fInputHandler->IsEventSelected() & AliVEvent::kMB) isSelected = 0;
3906  } else if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CEMC8") == 0){
3907  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3908  } else if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CDMC7") == 0){
3909  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3910  } else if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CDMC1") == 0){
3911  if (fInputHandler->IsEventSelected() & AliVEvent::kMB) isSelected = 0;
3912  } else if (fSpecialTrigger == 5 && fSpecialSubTriggerName.CompareTo("CDMC8") == 0){
3913  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3914  }
3915  // trigger rejection EGA
3916  if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EGA") == 0){
3917  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3918  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3919  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EGA") == 0){
3920  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3921  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3922  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7DGA") == 0){
3923  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3924  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3925  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8DGA") == 0){
3926  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3927  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3928  }
3929  // trigger rejection EG1 & EG2
3930  // EG1 is the trigger with the highest threshold
3931  if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EG1") == 0){
3932 // cout << firedTrigClass.Data() << endl;
3933  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3934 // cout << "INT7? " << isSelected << endl;
3935  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3936 // cout << "CEM7? " << isSelected << endl;
3937  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
3938 // cout << "7EG2? " << isSelected << endl;
3939  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EG1") == 0){
3940  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3941  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3942  if (firedTrigClass.Contains("8EG2")) isSelected = 0;
3943  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7EG2") == 0){
3944 // cout << firedTrigClass.Data() << endl;
3945  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3946 // cout << "INT7? " << isSelected << endl;
3947  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3948 // cout << "CEM7? " << isSelected << endl;
3949  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8EG2") == 0){
3950  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3951  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3952  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7DG1") == 0){
3953  // cout << firedTrigClass.Data() << endl;
3954  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3955  // cout << "INT7? " << isSelected << endl;
3956  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3957  // cout << "CEM7? " << isSelected << endl;
3958  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
3959  // cout << "7EG2? " << isSelected << endl;
3960  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8DG1") == 0){
3961  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8) isSelected = 0;
3962  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3963  if (firedTrigClass.Contains("8DG2")) isSelected = 0;
3964  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("7DG2") == 0){
3965  // cout << firedTrigClass.Data() << endl;
3966  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3967  // cout << "INT7? " << isSelected << endl;
3968  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3969  // cout << "CEM7? " << isSelected << endl;
3970  } else if (fSpecialTrigger == 8 && fSpecialSubTriggerName.CompareTo("8DG2") == 0){
3971  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7) isSelected = 0;
3972  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7) isSelected = 0;
3973  }
3974  if (fSpecialTrigger == 10 && (fInputHandler->IsEventSelected() & AliVEvent::kCaloOnly) ){
3975  // trigger rejection L0 triggers
3976  if (fSpecialSubTriggerName.CompareTo("CEMC7-") == 0){
3977  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
3978  } else if (fSpecialSubTriggerName.CompareTo("CEMC1-") == 0){
3979  if (firedTrigClass.Contains("INT1-")) isSelected = 0;
3980  } else if (fSpecialSubTriggerName.CompareTo("CEMC8-") == 0){
3981  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
3982  } else if (fSpecialSubTriggerName.CompareTo("CDMC7-") == 0){
3983  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
3984  } else if (fSpecialSubTriggerName.CompareTo("CDMC1-") == 0){
3985  if (firedTrigClass.Contains("INT1-")) isSelected = 0;
3986  } else if (fSpecialSubTriggerName.CompareTo("CDMC8-") == 0){
3987  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
3988  }
3989  // trigger rejection EGA
3990  if (fSpecialSubTriggerName.CompareTo("7EGA") == 0){
3991  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
3992  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
3993  } else if (fSpecialSubTriggerName.CompareTo("8EGA") == 0){
3994  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
3995  if (firedTrigClass.Contains("EMC8-")) isSelected = 0;
3996  } else if (fSpecialSubTriggerName.CompareTo("7DGA") == 0){
3997  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
3998  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
3999  } else if (fSpecialSubTriggerName.CompareTo("8DGA") == 0){
4000  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4001  if (firedTrigClass.Contains("EMC8-")) isSelected = 0;
4002  }
4003  // trigger rejection L1 triggers
4004  if(fSpecialSubTriggerName.CompareTo("7EG1") == 0){
4005  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4006  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
4007  if (firedTrigClass.Contains("7EG2")) isSelected = 0;
4008  } else if (fSpecialSubTriggerName.CompareTo("8EG1") == 0){
4009  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4010  if (firedTrigClass.Contains("EMC8-")) isSelected = 0;
4011  if (firedTrigClass.Contains("8EG2")) isSelected = 0;
4012  } else if (fSpecialSubTriggerName.CompareTo("7EG2") == 0){
4013  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4014  if (firedTrigClass.Contains("EMC7-")) isSelected = 0;
4015  } else if (fSpecialSubTriggerName.CompareTo("8EG2") == 0){
4016  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4017  if (firedTrigClass.Contains("EMC8-")) isSelected = 0;
4018  } else if (fSpecialSubTriggerName.CompareTo("7DG1") == 0){
4019  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4020  if (firedTrigClass.Contains("DMC7-")) isSelected = 0;
4021  if (firedTrigClass.Contains("7DG2")) isSelected = 0;
4022  } else if (fSpecialSubTriggerName.CompareTo("8DG1") == 0){
4023  if (firedTrigClass.Contains("INT8-")) isSelected = 0;
4024  if (firedTrigClass.Contains("DMC8-")) isSelected = 0;
4025  if (firedTrigClass.Contains("8DG2")) isSelected = 0;
4026  } else if (fSpecialSubTriggerName.CompareTo("7DG2") == 0){
4027  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4028  if (firedTrigClass.Contains("DMC7-")) isSelected = 0;
4029  } else if (fSpecialSubTriggerName.CompareTo("8DG2") == 0){
4030  if (firedTrigClass.Contains("INT7-")) isSelected = 0;
4031  if (firedTrigClass.Contains("DMC8-")) isSelected = 0;
4032  }
4033  }
4034  }
4035  if (isSelected != 0 ){
4036 // cout << "I am here" << " :" << fSpecialSubTriggerName.Data() <<endl;
4037  if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9 ){
4039  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassesCorrelated->Fill(0);
4040  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassesCorrelated->Fill(1);
4041  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassesCorrelated->Fill(2);
4042  if ((fInputHandler->IsEventSelected() & AliVEvent::kEMC7) && firedTrigClass.Contains("EMC"))hTriggerClassesCorrelated->Fill(3);
4043  if (firedTrigClass.Contains("7EJE") || firedTrigClass.Contains("8EJE")) hTriggerClassesCorrelated->Fill(4);
4044  if (firedTrigClass.Contains("7EJ1") || firedTrigClass.Contains("8EJ1")) hTriggerClassesCorrelated->Fill(5);
4045  if (firedTrigClass.Contains("7EJ2") || firedTrigClass.Contains("8EJ2")) hTriggerClassesCorrelated->Fill(6);
4046  if (firedTrigClass.Contains("7EGA") || firedTrigClass.Contains("8EGA")) hTriggerClassesCorrelated->Fill(7);
4047  if (firedTrigClass.Contains("7EG1") || firedTrigClass.Contains("8EG1")) hTriggerClassesCorrelated->Fill(8);
4048  if (firedTrigClass.Contains("7EG2") || firedTrigClass.Contains("8EG2")) hTriggerClassesCorrelated->Fill(9);
4049  if ((fInputHandler->IsEventSelected() & AliVEvent::kEMC7) && firedTrigClass.Contains("DMC"))hTriggerClassesCorrelated->Fill(10);
4050  if (firedTrigClass.Contains("7DJE") || firedTrigClass.Contains("8DJE")) hTriggerClassesCorrelated->Fill(11);
4051  if (firedTrigClass.Contains("7DJ1") || firedTrigClass.Contains("8DJ1")) hTriggerClassesCorrelated->Fill(12);
4052  if (firedTrigClass.Contains("7DJ2") || firedTrigClass.Contains("8DJ2")) hTriggerClassesCorrelated->Fill(13);
4053  if (firedTrigClass.Contains("7DGA") || firedTrigClass.Contains("8DGA")) hTriggerClassesCorrelated->Fill(14);
4054  if (firedTrigClass.Contains("7DG1") || firedTrigClass.Contains("8DG1")) hTriggerClassesCorrelated->Fill(15);
4055  if (firedTrigClass.Contains("7DG2") || firedTrigClass.Contains("8DG2")) hTriggerClassesCorrelated->Fill(16);
4056  }
4057  } else if ( fSpecialTrigger == 10 ){
4059  if (fInputHandler->IsEventSelected() & AliVEvent::kCaloOnly){
4060  hTriggerClassesCorrelated->Fill(0);
4061  if (firedTrigClass.Contains("INT7-"))hTriggerClassesCorrelated->Fill(1);
4062  if (firedTrigClass.Contains("EMC1-"))hTriggerClassesCorrelated->Fill(2);
4063  if (firedTrigClass.Contains("EMC7-")|| firedTrigClass.Contains("EMC8-"))hTriggerClassesCorrelated->Fill(3);
4064  if (firedTrigClass.Contains("7EJE") || firedTrigClass.Contains("8EJE")) hTriggerClassesCorrelated->Fill(4);
4065  if (firedTrigClass.Contains("7EJ1") || firedTrigClass.Contains("8EJ1")) hTriggerClassesCorrelated->Fill(5);
4066  if (firedTrigClass.Contains("7EJ2") || firedTrigClass.Contains("8EJ2")) hTriggerClassesCorrelated->Fill(6);
4067  if (firedTrigClass.Contains("7EGA") || firedTrigClass.Contains("8EGA")) hTriggerClassesCorrelated->Fill(7);
4068  if (firedTrigClass.Contains("7EG1") || firedTrigClass.Contains("8EG1")) hTriggerClassesCorrelated->Fill(8);
4069  if (firedTrigClass.Contains("7EG2") || firedTrigClass.Contains("8EG2")) hTriggerClassesCorrelated->Fill(9);
4070  if (firedTrigClass.Contains("DMC7-")|| firedTrigClass.Contains("DMC8-"))hTriggerClassesCorrelated->Fill(10);
4071  if (firedTrigClass.Contains("7DJE") || firedTrigClass.Contains("8DJE")) hTriggerClassesCorrelated->Fill(11);
4072  if (firedTrigClass.Contains("7DJ1") || firedTrigClass.Contains("8DJ1")) hTriggerClassesCorrelated->Fill(12);
4073  if (firedTrigClass.Contains("7DJ2") || firedTrigClass.Contains("8DJ2")) hTriggerClassesCorrelated->Fill(13);
4074  if (firedTrigClass.Contains("7DGA") || firedTrigClass.Contains("8DGA")) hTriggerClassesCorrelated->Fill(14);
4075  if (firedTrigClass.Contains("7DG1") || firedTrigClass.Contains("8DG1")) hTriggerClassesCorrelated->Fill(15);
4076  if (firedTrigClass.Contains("7DG2") || firedTrigClass.Contains("8DG2")) hTriggerClassesCorrelated->Fill(16);
4077  }
4078  }
4079  }
4080  }
4081 
4082  } else if (isMC){
4083  if (fSpecialTrigger == 5 || fSpecialTrigger == 8 || fSpecialTrigger == 9){ // EMCAL triggers
4084 // isSelected = 0;
4085 // if (fTriggersEMCAL > 0)cout << "Special Trigger " << fSpecialTrigger << " triggers: " << fTriggersEMCAL << " selected triggers: " << fTriggersEMCALSelected << " run number: " <<event->GetRunNumber()<<endl;
4086 // if (fTriggersEMCAL&fTriggersEMCALSelected){
4087 // cout << "accepted ++++++++++++++++++++" << endl;
4088  isSelected = 1;
4089 // }
4090  }
4091  }
4092  //if for specific centrality trigger selection
4093  if(fSpecialSubTrigger == 1){
4094  if(fSpecialSubTriggerName.Contains("|") && GetCentrality(event) <= 10.){
4095  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("|");
4096  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
4097  TObjString *NameClass = (TObjString*)ClassesList->At(i);
4098  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
4099  }
4100  } else if(fSpecialSubTriggerName.Contains("%")){
4101  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("%");
4102  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
4103  TObjString *NameClass = (TObjString*)ClassesList->At(i);
4104  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
4105  }
4106  } else if(fSpecialSubTriggerName.Contains("@")){
4107  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("@");
4108  for (Int_t i=0; i<ClassesList->GetEntriesFast();++i){
4109  TObjString *NameClass = (TObjString*)ClassesList->At(i);
4110  if (firedTrigClass.Contains(NameClass->GetString())) isSelected = 1;
4111  }
4112  } else if(fSpecialSubTriggerName.Contains("&")){ //logic AND of two classes
4113  TObjArray *ClassesList = fSpecialSubTriggerName.Tokenize("&");
4114  TString CheckClass = "";
4115  for (Int_t i=0; i<ClassesList->GetEntriesFast(); i++){
4116  TObjString *NameClass = (TObjString*)ClassesList->At(i);
4117  if (firedTrigClass.Contains(NameClass->GetString())) CheckClass+="1";
4118  else CheckClass+="0";
4119  }
4120  if(CheckClass.Contains("0")) isSelected = 0;
4121  }
4122  else if(firedTrigClass.Contains(fSpecialSubTriggerName.Data())) isSelected = 1;
4123  }
4124  }
4125  }
4126  }
4127  fIsSDDFired = !(fInputHandler->IsEventSelected() & AliVEvent::kFastOnly);
4128 
4129  Bool_t mimickedTrigger = kTRUE;
4130  if (fMimicTrigger) mimickedTrigger = MimicTrigger(event, isMC);
4131 // cout << "mimicked decision \t" << mimickedTrigger << "expect decision? "<< fMimicTrigger<< endl;
4132 
4133  // Fill Histogram
4134  if(hTriggerClass){
4135  if (fIsSDDFired) hTriggerClass->Fill(34);
4136  if (mimickedTrigger){
4137  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(0);
4138  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClass->Fill(1);
4139  if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClass->Fill(2);
4140  if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClass->Fill(3);
4141  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClass->Fill(4);
4142  if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5);
4143  if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClass->Fill(6);
4144  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClass->Fill(6);
4145  if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClass->Fill(7);
4146  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClass->Fill(7);
4147  if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClass->Fill(8);
4148  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClass->Fill(8);
4149  if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClass->Fill(9);
4150  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClass->Fill(9);
4151  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClass->Fill(10);
4152  // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClass->Fill(10);
4153  if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClass->Fill(11);
4154  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClass->Fill(12);
4155  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClass->Fill(13);
4156  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClass->Fill(13);
4157  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClass->Fill(13);
4158  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClass->Fill(14);
4159  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClass->Fill(15);
4160  if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(16);
4161  if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(17);
4162  if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClass->Fill(18);
4163  if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClass->Fill(19);
4164  if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClass->Fill(20);
4165  // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClass->Fill(20);
4166  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClass->Fill(21);
4167  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClass->Fill(22);
4168  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClass->Fill(23);
4169  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClass->Fill(24);
4170  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClass->Fill(25);
4171  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClass->Fill(26);
4172  if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClass->Fill(27);
4173  if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClass->Fill(28);
4174  if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClass->Fill(29);
4175  if (fInputHandler->IsEventSelected() & AliVEvent::kCaloOnly)hTriggerClass->Fill(30);
4176  if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClass->Fill(31);
4177  if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(32);
4178  if (!fInputHandler->IsEventSelected()) hTriggerClass->Fill(35);
4179  }
4180  if (mimickedTrigger && fMimicTrigger) hTriggerClass->Fill(36);
4181  }
4182 
4183  if(hTriggerClassSelected && isSelected){
4184  if (mimickedTrigger){
4185  if (!fIsSDDFired) hTriggerClassSelected->Fill(33);
4186  if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClassSelected->Fill(0);
4187  if (fInputHandler->IsEventSelected() & AliVEvent::kINT7)hTriggerClassSelected->Fill(1);
4188  if (fInputHandler->IsEventSelected() & AliVEvent::kMUON)hTriggerClassSelected->Fill(2);
4189  if (fInputHandler->IsEventSelected() & AliVEvent::kHighMult)hTriggerClassSelected->Fill(3);
4190  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC1)hTriggerClassSelected->Fill(4);
4191  if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClassSelected->Fill(5);
4192  if (fInputHandler->IsEventSelected() & AliVEvent::kCMUS5)hTriggerClassSelected->Fill(6);
4193  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSPB)hTriggerClassSelected->Fill(6);
4194  if (fInputHandler->IsEventSelected() & AliVEvent::kMUSH7)hTriggerClassSelected->Fill(7);
4195  // if (fInputHandler->IsEventSelected() & AliVEvent::kMUSHPB)hTriggerClassSelected->Fill(7);
4196  if (fInputHandler->IsEventSelected() & AliVEvent::kMUL7)hTriggerClassSelected->Fill(8);
4197  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikePB)hTriggerClassSelected->Fill(8);
4198  if (fInputHandler->IsEventSelected() & AliVEvent::kMUU7)hTriggerClassSelected->Fill(9);
4199  // if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikePB)hTriggerClassSelected->Fill(9);
4200  if (fInputHandler->IsEventSelected() & AliVEvent::kEMC7)hTriggerClassSelected->Fill(10);
4201  // if (fInputHandler->IsEventSelected() & AliVEvent::kEMC8)hTriggerClassSelected->Fill(10);
4202  if (fInputHandler->IsEventSelected() & AliVEvent::kMUS7)hTriggerClassSelected->Fill(11);
4203  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI1)hTriggerClassSelected->Fill(12);
4204  if (fInputHandler->IsEventSelected() & AliVEvent::kPHI7)hTriggerClassSelected->Fill(13);
4205  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHI8)hTriggerClassSelected->Fill(13);
4206  // if (fInputHandler->IsEventSelected() & AliVEvent::kPHOSPb)hTriggerClassSelected->Fill(13);
4207  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE)hTriggerClassSelected->Fill(14);
4208  if (fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)hTriggerClassSelected->Fill(15);
4209  if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClassSelected->Fill(16);
4210  if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClassSelected->Fill(17);
4211  if (fInputHandler->IsEventSelected() & AliVEvent::kDG5)hTriggerClassSelected->Fill(18);
4212  if (fInputHandler->IsEventSelected() & AliVEvent::kZED)hTriggerClassSelected->Fill(19);
4213  if (fInputHandler->IsEventSelected() & AliVEvent::kSPI7)hTriggerClassSelected->Fill(20);
4214  // if (fInputHandler->IsEventSelected() & AliVEvent::kSPI)hTriggerClassSelected->Fill(20);
4215  if (fInputHandler->IsEventSelected() & AliVEvent::kINT8)hTriggerClassSelected->Fill(21);
4216  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleLowPt8)hTriggerClassSelected->Fill(22);
4217  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonSingleHighPt8)hTriggerClassSelected->Fill(23);
4218  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonLikeLowPt8)hTriggerClassSelected->Fill(24);
4219  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt8)hTriggerClassSelected->Fill(25);
4220  if (fInputHandler->IsEventSelected() & AliVEvent::kMuonUnlikeLowPt0)hTriggerClassSelected->Fill(26);
4221  if (fInputHandler->IsEventSelected() & AliVEvent::kUserDefined)hTriggerClassSelected->Fill(27);
4222  if (fInputHandler->IsEventSelected() & AliVEvent::kTRD)hTriggerClassSelected->Fill(28);
4223  if (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)hTriggerClassSelected->Fill(29);
4224  if (fInputHandler->IsEventSelected() & AliVEvent::kAnyINT)hTriggerClassSelected->Fill(30);
4225  if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClassSelected->Fill(31);
4226  }
4227  if (mimickedTrigger && fMimicTrigger) hTriggerClassSelected->Fill(34);
4228  }
4229 
4230  if(!isSelected)return kFALSE;
4231  if (fMimicTrigger)
4232  if (!mimickedTrigger ) return kFALSE;
4233  return kTRUE;
4234 
4235 }
4236 
4237 //________________________________________________________________________
4239  // returns TString with current cut number
4240  return fCutStringRead;
4241 }
4242 
4243 //________________________________________________________________________
4244 void AliConvEventCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *event){
4245 
4246  if(fNotRejectedStart){
4247  delete[] fNotRejectedStart;
4248  fNotRejectedStart = NULL;
4249  }
4250  if(fNotRejectedEnd){
4251  delete[] fNotRejectedEnd;
4252  fNotRejectedEnd = NULL;
4253  }
4254  if(fGeneratorNames){
4255  delete[] fGeneratorNames;
4256  fGeneratorNames = NULL;
4257  }
4258 
4259  if(rejection == 0) return; // No Rejection
4260 
4261  AliGenCocktailEventHeader *cHeader = 0x0;
4262  AliAODMCHeader *cHeaderAOD = 0x0;
4263  Bool_t headerFound = kFALSE;
4264  AliMCEvent *fMCEvent = 0x0;
4265  TClonesArray *fMCEventAOD = 0x0;
4266  if(event->IsA()==AliMCEvent::Class()){
4267  if(dynamic_cast<AliMCEvent*>(event)){
4268  cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(event)->GenEventHeader());
4269  fMCEvent = dynamic_cast<AliMCEvent*>(event);
4270  if(cHeader) headerFound = kTRUE;
4271  }
4272  }
4273  if(event->IsA()==AliAODEvent::Class()){ // event is a AODEvent in case of AOD
4274  cHeaderAOD = dynamic_cast<AliAODMCHeader*>(event->FindListObject(AliAODMCHeader::StdBranchName()));
4275  fMCEventAOD = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
4276  if(cHeaderAOD) headerFound = kTRUE;
4277  }
4278 
4279  if (fDebugLevel > 0 ) cout << "event starts here" << endl;
4280  if(headerFound){
4281  TList *genHeaders = 0x0;
4282  if(cHeader) genHeaders = cHeader->GetHeaders();
4283  if(cHeaderAOD){
4284  genHeaders = cHeaderAOD->GetCocktailHeaders();
4285  if(genHeaders->GetEntries()==1){
4287  return;
4288  }
4289  }
4290  AliGenEventHeader* gh = 0;
4291  fnHeaders = 0;
4292  Int_t firstindexA = 0;
4293  Int_t lastindexA = -1;
4294  if(rejection == 1 || rejection == 3) fnHeaders = 1; // MinBiasHeader
4295  if(rejection == 2 || rejection == 4){ // TList of Headers Names
4296  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
4297  gh = (AliGenEventHeader*)genHeaders->At(i);
4298  TString GeneratorName = gh->GetName();
4299  lastindexA = lastindexA + gh->NProduced();
4300  if (fDebugLevel > 0 ) cout << i << "\t" << GeneratorName.Data() << endl;
4301  for(Int_t j = 0; j<HeaderList->GetEntries();j++){
4302  TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
4303  if (fDebugLevel > 0 ) cout << GeneratorInList.Data() << endl;
4304  if(GeneratorInList.Contains(GeneratorName) ){
4305  if (fDebugLevel > 0 ) cout << "accepted" << endl;
4306  if (GeneratorInList.BeginsWith("PARAM") || GeneratorInList.CompareTo("BOX") == 0 ){
4307  if(fMCEvent){
4308  if (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c ){
4309  if (fDebugLevel > 2 )cout << "number of produced particle: " << gh->NProduced() << endl;
4310  if (fDebugLevel > 2 )cout << "pdg-code of first particle: " << fMCEvent->Particle(firstindexA)->GetPdgCode() << endl;
4311  if (fMCEvent->Particle(firstindexA)->GetPdgCode() == fAddedSignalPDGCode ) {
4312  if (gh->NProduced() > 10 && fMCEvent->Particle(firstindexA+10)->GetPdgCode() == fAddedSignalPDGCode && GeneratorInList.CompareTo("BOX") == 0){
4313  if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
4314  fnHeaders++;
4315  continue;
4316  } else if (gh->NProduced() == 3 && GeneratorInList.Contains("PARAM_EMC") && (i == 3 || i == 5) ){
4317  if (fDebugLevel > 2 ) cout << "accepted EMC header "<< endl;
4318  if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
4319  fnHeaders++;
4320  continue;
4321  } else if (gh->NProduced() > 2 && GeneratorInList.Contains("PARAM_PHOS") && (i == 4 || i == 6) ){
4322  if (fDebugLevel > 2 ) cout << "accepted PHOS header "<< endl;
4323  if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
4324  fnHeaders++;
4325  continue;
4326 
4327  }
4328  continue;
4329  }
4330  } else {
4331  if (fDebugLevel > 0 ) cout << "cond 2: " << fnHeaders << endl;
4332  fnHeaders++;
4333  continue;
4334  }
4335  }
4336  if ( fMCEventAOD){
4337  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindexA));
4338  if (aodMCParticle && (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c) ){
4339  if ( aodMCParticle->GetPdgCode() == fAddedSignalPDGCode ){
4340  if (gh->NProduced() > 10 && GeneratorInList.CompareTo("BOX") == 0){
4341  AliAODMCParticle *aodMCParticle2 = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindexA+10));
4342  if ( aodMCParticle2->GetPdgCode() == fAddedSignalPDGCode ){
4343  if (fDebugLevel > 0 ) cout << "cond 1: " << fnHeaders << endl;
4344  fnHeaders++;
4345  continue;
4346  }
4347  } else if (gh->NProduced() == 3 && GeneratorInList.Contains("PARAM_EMC") && (i == 3 || i == 5) ){
4348  if (fDebugLevel > 2 ) cout << "accepted EMC header "<< endl;
4349  if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
4350  fnHeaders++;
4351  continue;
4352  } else if (gh->NProduced() > 2 && GeneratorInList.Contains("PARAM_PHOS") && (i == 4 || i == 6) ){
4353  if (fDebugLevel > 2 ) cout << "accepted PHOS header "<< endl;
4354  if (fDebugLevel > 0 ) cout << "cond 1: "<< fnHeaders << endl;
4355  fnHeaders++;
4356  continue;
4357 
4358  }
4359  continue;
4360  }
4361  } else {
4362  if (fDebugLevel > 0 ) cout << "cond 2: " << fnHeaders << endl;
4363  fnHeaders++;
4364  continue;
4365  }
4366  }
4367  continue;
4368  }
4369  if(GeneratorName.CompareTo(GeneratorInList) == 0 ){
4370  if (fDebugLevel > 0 ) cout << "cond 3: "<< fnHeaders << endl;
4371  fnHeaders++;
4372  continue;
4373  }
4374  }
4375  }
4376  firstindexA = firstindexA + gh->NProduced();
4377  }
4378  }
4379  if (fDebugLevel > 0 ) cout << "number of headers: " <<fnHeaders << endl;
4380 
4384 
4385  if(rejection == 1 || rejection == 3){
4386  fNotRejectedStart[0] = 0;
4387  fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced()-1;
4388  fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName();
4389  if (fDebugLevel > 0 ) cout << 0 << "\t" <<fGeneratorNames[0] << "\t" << fNotRejectedStart[0] << "\t" <<fNotRejectedEnd[0] << endl;
4390  return;
4391  }
4392 
4393  Int_t firstindex = 0;
4394  Int_t lastindex = -1;
4395  Int_t number = 0;
4396 
4397  for(Int_t i = 0; i<genHeaders->GetEntries();i++){
4398  gh = (AliGenEventHeader*)genHeaders->At(i);
4399  TString GeneratorName = gh->GetName();
4400  lastindex = lastindex + gh->NProduced();
4401  if (fDebugLevel > 0 ) cout << i << "\t" << GeneratorName.Data() << endl;
4402  for(Int_t j = 0; j<HeaderList->GetEntries();j++){
4403  TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
4404  if(GeneratorInList.Contains(GeneratorName) ){
4405  if (GeneratorInList.Contains("PARAM") || GeneratorInList.CompareTo("BOX") == 0 ){
4406  if(fMCEvent){
4407  if (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c ){
4408  if (fMCEvent->Particle(firstindex)->GetPdgCode() == fAddedSignalPDGCode ) {
4409  if (fDebugLevel > 0 ) cout << "produced " << gh->NProduced() << " with box generator" << endl;
4410  if (gh->NProduced() > 10 && fMCEvent->Particle(firstindex+10)->GetPdgCode() == fAddedSignalPDGCode && GeneratorInList.CompareTo("BOX") == 0){
4411  if (fDebugLevel > 0 ) cout << "one of them was a pi0 or eta" << endl;
4412  fNotRejectedStart[number] = firstindex;
4413  fNotRejectedEnd[number] = lastindex;
4414  fGeneratorNames[number] = GeneratorName;
4415  number++;
4416  if (fDebugLevel > 0 ) cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
4417  continue;
4418  } else if (gh->NProduced() == 3 && GeneratorInList.Contains("PARAM_EMC") && (i == 3 || i == 5) ){
4419  fNotRejectedStart[number] = firstindex;
4420  fNotRejectedEnd[number] = lastindex;
4421  fGeneratorNames[number] = GeneratorName;
4422  number++;
4423  if (fDebugLevel > 0 ) cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
4424  continue;
4425  } else if (gh->NProduced() > 2 && GeneratorInList.Contains("PARAM_PHOS") && (i == 4 || i == 6) ){
4426  fNotRejectedStart[number] = firstindex;
4427  fNotRejectedEnd[number] = lastindex;
4428  fGeneratorNames[number] = GeneratorName;
4429  number++;
4430  if (fDebugLevel > 0 ) cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
4431  continue;
4432  }
4433  }
4434  continue;
4435  } else {
4436  fNotRejectedStart[number] = firstindex;
4437  fNotRejectedEnd[number] = lastindex;
4438  fGeneratorNames[number] = GeneratorName;
4439  number++;
4440  continue;
4441  }
4442  }
4443  if ( fMCEventAOD){
4444  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindex));
4445  if (fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c ){
4446  if ( aodMCParticle->GetPdgCode() == fAddedSignalPDGCode ){
4447  if (gh->NProduced() > 10 && GeneratorInList.CompareTo("BOX") == 0) {
4448  AliAODMCParticle *aodMCParticle2 = static_cast<AliAODMCParticle*>(fMCEventAOD->At(firstindex+10));
4449  if ( aodMCParticle2->GetPdgCode() == fAddedSignalPDGCode ){
4450  fNotRejectedEnd[number] = lastindex;
4451  fNotRejectedStart[number] = firstindex;
4452  fGeneratorNames[number] = GeneratorName;
4453  number++;
4454  }
4455  continue;
4456  } else if (gh->NProduced() == 3 && GeneratorInList.Contains("PARAM_EMC") && (i == 3 || i == 5) ){
4457  fNotRejectedStart[number] = firstindex;
4458  fNotRejectedEnd[number] = lastindex;
4459  fGeneratorNames[number] = GeneratorName;
4460  number++;
4461  if (fDebugLevel > 0 ) cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
4462  continue;
4463  } else if (gh->NProduced() > 2 && GeneratorInList.Contains("PARAM_PHOS") && (i == 4 || i == 6) ){
4464  fNotRejectedStart[number] = firstindex;
4465  fNotRejectedEnd[number] = lastindex;
4466  fGeneratorNames[number] = GeneratorName;
4467  number++;
4468  if (fDebugLevel > 0 ) cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
4469  continue;
4470  }
4471  continue;
4472  }
4473  } else {
4474  fNotRejectedStart[number] = firstindex;
4475  fNotRejectedEnd[number] = lastindex;
4476  fGeneratorNames[number] = GeneratorName;
4477  number++;
4478  continue;
4479  }
4480  }
4481  continue;
4482  } else if(GeneratorName.CompareTo(GeneratorInList) == 0 ){
4483  fNotRejectedStart[number] = firstindex;
4484  fNotRejectedEnd[number] = lastindex;
4485  fGeneratorNames[number] = GeneratorName;
4486  if (fDebugLevel > 0 ) cout << "Number of particles produced for: " << i << "\t" << GeneratorName.Data() << "\t" << lastindex-firstindex+1 << endl;
4487  number++;
4488  continue;
4489  }
4490 
4491  }
4492  }
4493  firstindex = firstindex + gh->NProduced();
4494  }
4495  if (fDebugLevel > 0 ) {
4496  for (Int_t i = 0; i < number; i++){
4497  cout << i << "\t" <<fGeneratorNames[i] << "\t" << fNotRejectedStart[i] << "\t" <<fNotRejectedEnd[i] << endl;
4498  }
4499  }
4500  } else { // No Cocktail Header Found
4501  fNotRejectedStart = new Int_t[1];
4502  fNotRejectedEnd = new Int_t[1];
4503 
4504  fnHeaders = 1;
4505  fNotRejectedStart[0] = 0;
4506  fNotRejectedEnd[0] = static_cast<AliMCEvent*>(event)->GetNumberOfPrimaries()-1;
4507  if (rejection > 1){
4508  fNotRejectedStart[0] = -1;
4509  fNotRejectedEnd[0] = -1;
4510  }
4511 
4512  fGeneratorNames = new TString[1];
4513  fGeneratorNames[0] = "NoCocktailGeneratorFound";
4514 // SetRejectExtraSignalsCut(0);
4515  }
4516 
4517 }
4518 
4519 //_________________________________________________________________________
4520 Int_t AliConvEventCuts::IsParticleFromBGEvent(Int_t index, AliMCEvent *mcEvent, AliVEvent *InputEvent, Int_t debug ){
4521 
4522  // if (debug > 2 ) cout << index << endl;
4523  if(index < 0) return 0; // No Particle
4524 
4525  Int_t accepted = 0;
4526  if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){
4527  if(!mcEvent) return 0; // no mcEvent available, return 0
4528  if(index >= mcEvent->GetNumberOfPrimaries()){ // initial particle is secondary particle
4529  if( ((TParticle*)mcEvent->Particle(index))->GetMother(0) < 0) return 0; // material particle, return 0
4530  return IsParticleFromBGEvent(((TParticle*)mcEvent->Particle(index))->GetMother(0),mcEvent,InputEvent, debug);
4531  }
4532  for(Int_t i = 0;i<fnHeaders;i++){
4533  // if (debug > 2 ) cout << "header " << fGeneratorNames[i].Data() << ":"<< fNotRejectedStart[i] << "\t" << fNotRejectedEnd[i] << endl;
4534  if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
4535  if (debug > 1 ) cout << "accepted:" << index << "\t header " << fGeneratorNames[i].Data() << ": "<< fNotRejectedStart[i] << "\t" << fNotRejectedEnd[i] << endl;
4536  accepted = 1;
4537  if(i == 0) accepted = 2; // MB Header
4538  }
4539  }
4540  if (debug > 1 && !accepted) cout << "rejected:" << index << endl;
4541  }
4542  else if(InputEvent->IsA()==AliAODEvent::Class()){
4543  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
4544  if (AODMCTrackArray){
4545  AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
4546  if(!aodMCParticle) return 0; // no particle
4547  if(!aodMCParticle->IsPrimary()){
4548  if( aodMCParticle->GetMother() < 0) return 0;// material particle, return 0
4549  return IsParticleFromBGEvent(aodMCParticle->GetMother(),mcEvent,InputEvent, debug);
4550  }
4551  index = TMath::Abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index))->GetLabel());
4552  for(Int_t i = 0;i<fnHeaders;i++){
4553  if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
4554  accepted = 1;
4555  if(i == 0) accepted = 2; // MB Header
4556  }
4557  }
4558  }
4559  }
4560 
4561  return accepted;
4562 }
4563 
4564 //_________________________________________________________________________
4565 Int_t AliConvEventCuts::IsEventAcceptedByCut(AliConvEventCuts *ReaderCuts, AliVEvent *event, AliMCEvent *mcEvent, Int_t isHeavyIon, Bool_t isEMCALAnalysis){
4566 
4567  Bool_t isMC = kFALSE;
4568  if (mcEvent){isMC = kTRUE;}
4569 
4570  if ( !IsTriggerSelected(event, isMC) )
4571  return 3;
4572 
4573  if( !(IsCentralitySelected(event,mcEvent)))
4574  return 1; // Check Centrality --> Not Accepted => eventQuality = 1
4575 
4576  Bool_t hasV0And = ReaderCuts->HasV0AND();
4577  Bool_t isSDDFired = ReaderCuts->IsSDDFired();
4578 
4579  if( ( (IsSpecialTrigger() == 0 && IsSpecialSubTrigger() == 1) || (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 1) ) && !isSDDFired && !mcEvent)
4580  //if V0OR with SDD requested or V0AND with SDD request but the SDD has not fired
4581  return 7; // V0 with SDD requested but no fired
4582 
4583  if( ( (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 0) || (IsSpecialTrigger() == 1 && IsSpecialSubTrigger() == 1) ) && !hasV0And)
4584  //if V0AND (only) or V0AND with SDD requested but V0AND requested but no fired
4585  return 8; // V0AND requested but no fired
4586 
4587 
4588  if( (IsSpecialTrigger() == 2 || IsSpecialTrigger() == 3) && !isSDDFired && !mcEvent)
4589  return 7; // With SDD requested but no fired
4590 
4591  if( (IsSpecialTrigger() == 1 || IsSpecialTrigger() == 3) && !hasV0And)
4592  return 8; // V0AND requested but no fired
4593 
4594  // Special EMCAL checks due to hardware issues in LHC11a
4595  if (isEMCALAnalysis || IsSpecialTrigger() == 5 || IsSpecialTrigger() == 8 || IsSpecialTrigger() == 9 ){
4596  Int_t runnumber = event->GetRunNumber();
4597  if ((runnumber>=144871) && (runnumber<=146860)) {
4598 
4599  AliVCaloCells *cells = event->GetEMCALCells();
4600  const Short_t nCells = cells->GetNumberOfCells();
4601 
4602  if (event->IsA()==AliESDEvent::Class()) AliAnalysisManager::GetAnalysisManager()->LoadBranch("EMCALCells.");
4603 
4604  AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
4605  if (!fInputHandler) return 3;
4606 
4607  // count cells above threshold
4608  Int_t nCellCount[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
4609  for(Int_t iCell=0; iCell<nCells; ++iCell) {
4610  Short_t cellId = cells->GetCellNumber(iCell);
4611  Double_t cellE = cells->GetCellAmplitude(cellId);
4612  Int_t sm = cellId / (24*48);
4613  if (cellE>0.1) ++nCellCount[sm];
4614  }
4615 
4616  Bool_t fIsLedEvent = kFALSE;
4617  if (nCellCount[4] > 100) {
4618  fIsLedEvent = kTRUE;
4619  } else {
4620  if ((runnumber>=146858) && (runnumber<=146860)) {
4621  if ((fInputHandler->IsEventSelected() & AliVEvent::kMB) && (nCellCount[3]>=21))
4622  fIsLedEvent = kTRUE;
4623  else if ((fInputHandler->IsEventSelected() & AliVEvent::kEMC1) && (nCellCount[3]>=35))
4624  fIsLedEvent = kTRUE;
4625  }
4626  }
4627  if (fIsLedEvent) {
4628  return 9;
4629  }
4630  }
4631  }
4632 
4633  // SPD clusters vs tracklets to check for pileup/background
4634  Int_t nClustersLayer0 = event->GetNumberOfITSClusters(0);
4635  Int_t nClustersLayer1 = event->GetNumberOfITSClusters(1);
4636  Int_t nTracklets = event->GetMultiplicity()->GetNumberOfTracklets();
4637  if(hSPDClusterTrackletBackgroundBefore) hSPDClusterTrackletBackgroundBefore->Fill(nTracklets, (nClustersLayer0 + nClustersLayer1));
4638 
4639 
4640  Double_t distZMax = 0;
4641  if(event->IsA()==AliESDEvent::Class()){
4642  Int_t nPileVert = ((AliESDEvent*)event)->GetNumberOfPileupVerticesSPD();
4643  if (hNPileupVertices) hNPileupVertices->Fill(nPileVert);
4644  if (nPileVert > 0){
4645  for(Int_t i=0; i<nPileVert;i++){
4646  const AliESDVertex* pv= ((AliESDEvent*)event)->GetPileupVertexSPD(i);
4647  Int_t nc2 = pv->GetNContributors();
4648  if(nc2>=3){
4649  Double_t z1 = ((AliESDEvent*)event)->GetPrimaryVertexSPD()->GetZ();
4650  Double_t z2 = pv->GetZ();
4651  Double_t distZ = z2-z1;
4652  if (TMath::Abs(distZMax) < TMath::Abs(distZ) ){
4653  distZMax = distZ;
4654  }
4655  }
4656  }
4657  if (hPileupVertexToPrimZ) hPileupVertexToPrimZ->Fill(distZMax);
4658  }
4659  }
4660  if(GetPastFutureLowBC()!=0 && GetPastFutureHighBC()!=0 ){
4661  if(IsOutOfBunchPileupPastFuture(event))
4662  return 12;
4663  }
4664 
4665  if( isHeavyIon != 2 && GetIsFromPileupSPD()){
4666  if(event->IsPileupFromSPD(3,0.8,3.,2.,5.) ){
4668  return 6; // Check Pileup --> Not Accepted => eventQuality = 6
4669  }
4670  if (fUtils->IsSPDClusterVsTrackletBG(event)){
4672  return 11; // Check Pileup --> Not Accepted => eventQuality = 11
4673  }
4674  }
4675  if(isHeavyIon == 2 && GetIsFromPileupSPD()){
4676  if(fUtils->IsPileUpEvent(event) ){
4678  return 6; // Check Pileup --> Not Accepted => eventQuality = 6
4679  }
4680  if (fUtils->IsSPDClusterVsTrackletBG(event)){
4682  return 11; // Check Pileup --> Not Accepted => eventQuality = 11
4683  }
4684  }
4685 
4687  if( IsPileUpV0MTPCout(event) ){
4688  return 13;
4689  }
4690  }
4691 
4692  if(hCentrality)hCentrality->Fill(GetCentrality(event));
4693 
4694  if(hVertexZ)hVertexZ->Fill(event->GetPrimaryVertex()->GetZ());
4695 // if(hCentralityVsNumberOfPrimaryTracks)
4696 // hCentralityVsNumberOfPrimaryTracks->Fill(GetCentrality(event),
4697 // ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()
4698 // ->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks());
4699 
4700  if(fIsHeavyIon == 1){
4701  AliEventplane *EventPlane = event->GetEventplane();
4702  fEventPlaneAngle = EventPlane->GetEventplane("V0",event,2);
4703  if(hEventPlaneAngle)hEventPlaneAngle->Fill(TMath::Abs(fEventPlaneAngle));
4704  }
4705  if(hSPDClusterTrackletBackground) hSPDClusterTrackletBackground->Fill(nTracklets, (nClustersLayer0 + nClustersLayer1));
4706 
4707  return 0;
4708 }
4709 
4710 
4711 //_________________________________________________________________________
4713 
4714  AliInfo("Inside the GetWeightForCentralityFlattening function");
4715  Double_t centrality = 0.;
4716  //obtain centrality for ESD or AOD
4717  if(!event || event->IsA()==AliESDEvent::Class()){
4718  AliESDEvent *esdEvent=dynamic_cast<AliESDEvent*>(event);
4719  if(esdEvent){
4720  AliCentrality *fESDCentrality=(AliCentrality*)esdEvent->GetCentrality();
4721  if(fDetectorCentrality==0 && fIsHeavyIon==1){
4722  centrality = fESDCentrality->GetCentralityPercentile("V0M"); // default for PbPb
4723  }
4724  }
4725  } else if(event->IsA()==AliAODEvent::Class()){
4726  AliAODEvent *aodEvent=dynamic_cast<AliAODEvent*>(event);
4727  if(aodEvent){
4728  if(aodEvent->GetHeader()){
4729  centrality = ((AliVAODHeader*)aodEvent->GetHeader())->GetCentrality();
4730  }
4731  }
4732  }
4733 
4734  //Get the maximum vlaue from the reference distribution and interpolated value
4735  Float_t GetValueForWeight = 1.;
4736  Float_t maximum = 1.;
4737  Double_t weightCentrality = 1.;
4738  Bool_t CorrCentrLoop = kFALSE;
4739 
4740  //depending on the value of the flag, flattening in different cent. range
4741  if ( fDoCentralityFlat == 1 && (centrality >= 0. && centrality <= 20.) ){
4742  GetValueForWeight = hCentralityNotFlat->Interpolate(centrality);
4743  maximum = hCentralityNotFlat->GetMaximum();
4744  CorrCentrLoop = kTRUE;
4745  } else if ( fDoCentralityFlat == 8 ){
4746  GetValueForWeight = hCentralityNotFlat->Interpolate(centrality);
4747  maximum = hCentralityNotFlat->GetMaximum();
4748  CorrCentrLoop = kTRUE;
4749  } else {
4750  CorrCentrLoop = kFALSE;
4751  }
4752 
4753  if (CorrCentrLoop && GetValueForWeight != 0. && maximum !=0. && isfinite(GetValueForWeight) && isfinite(maximum) ){
4754  weightCentrality = maximum/GetValueForWeight;
4755  if (!isfinite(GetValueForWeight)) weightCentrality = 1.;
4756  if (!isfinite(weightCentrality)) weightCentrality = 1.;
4757  }
4758 
4759  return weightCentrality;
4760 }
4761 
4762 //_________________________________________________________________________
4764 
4765  Double_t weightMult = 1.;
4766 
4767  Float_t valueMultData = -1.;
4768  Float_t valueMultMC = -1.;
4769 
4770  if (hReweightMultData == NULL || hReweightMultMC == NULL ) return weightMult;
4771 
4772  valueMultData = hReweightMultData->Interpolate(mult);
4773  valueMultMC = hReweightMultMC->Interpolate(mult);
4774 
4775  Float_t relativeErrorMC = hReweightMultMC->GetBinError(hReweightMultMC->FindBin(mult))/hReweightMultMC->GetBinContent(hReweightMultMC->FindBin(mult));
4776  Float_t relativeErrorData = hReweightMultData->GetBinError(hReweightMultData->FindBin(mult))/hReweightMultData->GetBinContent(hReweightMultData->FindBin(mult));
4777 
4778  if (relativeErrorData < 0.2 && relativeErrorMC < 0.2 ){
4779  if (isfinite(valueMultData) && isfinite(valueMultMC) ){
4780  weightMult = valueMultData/valueMultMC;
4781  }
4782  }
4783 
4784  return weightMult;
4785 }
4786 
4787 
4788 
4789 //_________________________________________________________________________
4790 Float_t AliConvEventCuts::GetWeightForMeson(Int_t index, AliMCEvent *mcEvent, AliVEvent *event){
4791 
4792  if(index < 0) return 0; // No Particle
4793 
4794  // check if MC production should be weighted. If it is with added particles check that particle is not rejected
4795  Int_t kCaseGen = 0;
4796  if (fPeriodEnum == kLHC13d2 || fPeriodEnum == kLHC13d2b || // LHC10h MCs
4797  fPeriodEnum == kLHC14a1a || fPeriodEnum == kLHC14a1b || fPeriodEnum == kLHC14a1c || // LHC11h MCs
4798  fPeriodEnum == kLHC13e7 || fPeriodEnum == kLHC13b2_efix || fPeriodEnum == kLHC14b2 || // LHC13bc MCs
4799  fPeriodEnum == kLHC14e2b || // LHC12[a-i] pass 1 MCs
4800  fPeriodEnum == kLHC12f1a || fPeriodEnum == kLHC12f1b || fPeriodEnum == kLHC12i3 || // LHC11a MCs
4801  fPeriodEnum == kLHC16h4 ) // LHC15o MC
4802  kCaseGen = 1; // added particles MC
4804  kCaseGen = 2; // regular MC
4805  if (kCaseGen == 0) return 1.;
4806  if(kCaseGen==1 && !IsParticleFromBGEvent(index, mcEvent, event)) return 1.;
4807 
4808  // get pT and pdg code
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  // get MC value
4829  Float_t functionResultMC = 1.;
4830  if ( PDGCode == 111 && fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0){
4831  functionResultMC = hReweightMCHistPi0->Interpolate(mesonPt);
4832  }
4833  if ( PDGCode == 221 && fDoReweightHistoMCEta && hReweightMCHistEta!= 0x0){
4834  functionResultMC = hReweightMCHistEta->Interpolate(mesonPt);
4835  }
4836  if ( PDGCode == 310 && fDoReweightHistoMCK0s && hReweightMCHistK0s!= 0x0){
4837  functionResultMC = hReweightMCHistK0s->Interpolate(mesonPt);
4838  }
4839 
4840  // get data value
4841  Float_t functionResultData = 1;
4842  if ( PDGCode == 111 && fDoReweightHistoMCPi0 && fFitDataPi0!= 0x0){
4843  functionResultData = fFitDataPi0->Eval(mesonPt);
4844  }
4845  if ( PDGCode == 221 && fDoReweightHistoMCEta && fFitDataEta!= 0x0){
4846  functionResultData = fFitDataEta->Eval(mesonPt);
4847  }
4848  if ( PDGCode == 310 && fDoReweightHistoMCK0s && fFitDataK0s!= 0x0){
4849  functionResultData = fFitDataK0s->Eval(mesonPt);
4850  }
4851 
4852  // calculate weight from data and MC
4853  Double_t weight = 1;
4854  if (PDGCode == 111 || PDGCode == 221){
4855  if (functionResultData != 0. && functionResultMC != 0. && isfinite(functionResultData) && isfinite(functionResultMC)){
4856  weight = functionResultData/functionResultMC;
4857  if ( kCaseGen == 3){ // never true ?
4858  if (PDGCode == 111){
4859  if (!(fDoReweightHistoMCPi0 && hReweightMCHistPi0!= 0x0 && PDGCode == 111)){
4860  weight = 1.;
4861  }
4862  }
4863  if (PDGCode == 221){
4864  if (!(fDoReweightHistoMCEta && hReweightMCHistEta!= 0x0 && PDGCode == 221)){
4865  weight = 1.;
4866  }
4867  }
4868  }
4869  if (!isfinite(functionResultData)) weight = 1.;
4870  if (!isfinite(weight)) weight = 1.;
4871  }
4872  } else if (PDGCode == 310 && functionResultMC != 0 && isfinite(functionResultMC)){
4873  weight = functionResultMC;
4874  }
4875  return weight;
4876 }
4877 
4878 
4881 
4882  if( fPeriodEnum == kLHC13bc || // mainly minimum bias
4883  fPeriodEnum == kLHC13de || // mainly triggered
4884  fPeriodEnum == kLHC13b4_fix || fPeriodEnum == kLHC13b4_plus || // MC Pythia 6 (Jet-Jet), anchor LHC13b-e
4885  fPeriodEnum == kLHC13b2_efix || //MC DPMJET, anchr LHC13b+c
4886  fPeriodEnum == kLHC13e7 || //MC HIJING, anchr LHC13b+c
4887  fPeriodEnum == kLHC14b2 //MC HIJING, anchr LHC13b+c
4888  ){
4889  printf(" Gamma Conversion Cuts %s :: pPb Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),-0.465);
4890  SetEtaShift(-0.465);
4891  } else if( fPeriodEnum == kLHC13f ) {
4892  printf(" Gamma Conversion Cuts %s :: Pbp Run doing Eta Shift of %f \n\n",(GetCutNumber()).Data(),0.465);
4893  SetEtaShift(+0.465);
4894  }
4895  else printf(" Gamma Conversion Cuts %s :: Automatic Eta Shift requested but Period is not known -> No Shift \n\n",(GetCutNumber()).Data());
4896 }
4897 
4898 //________________________________________________________________________
4899 AliEMCALTriggerPatchInfo* AliConvEventCuts::GetMainTriggerPatch