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