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