AliPhysics  116b2d6 (116b2d6)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliCaloTrackReader.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
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 
16 // --- ROOT system ---
17 #include <TFile.h>
18 #include <TGeoManager.h>
19 #include <TStreamerInfo.h>
20 
21 // ---- ANALYSIS system ----
22 #include "AliMCEvent.h"
23 #include "AliAODMCHeader.h"
24 #include "AliGenPythiaEventHeader.h"
25 #include "AliGenCocktailEventHeader.h"
26 #include "AliGenHijingEventHeader.h"
27 #include "AliESDEvent.h"
28 #include "AliAODEvent.h"
29 #include "AliVTrack.h"
30 #include "AliVParticle.h"
31 #include "AliMixedEvent.h"
32 //#include "AliTriggerAnalysis.h"
33 #include "AliESDVZERO.h"
34 #include "AliVCaloCells.h"
35 #include "AliAnalysisManager.h"
36 #include "AliInputEventHandler.h"
37 #include "AliAODMCParticle.h"
38 #include "AliStack.h"
39 #include "AliLog.h"
40 #include "AliMultSelection.h"
41 
42 // ---- Detectors ----
43 #include "AliPHOSGeoUtils.h"
44 #include "AliEMCALGeometry.h"
45 #include "AliEMCALRecoUtils.h"
46 
47 // ---- CaloTrackCorr ---
48 #include "AliCalorimeterUtils.h"
49 #include "AliCaloTrackReader.h"
50 
51 // ---- Jets ----
52 #include "AliAODJet.h"
53 #include "AliAODJetEventBackground.h"
54 
58 
59 //________________________________________
61 //________________________________________
63 TObject(), fEventNumber(-1), //fCurrentFileName(""),
64 fDataType(0), fDebug(0),
65 fFiducialCut(0x0), fCheckFidCut(kFALSE),
66 fComparePtHardAndJetPt(0), fPtHardAndJetPtFactor(0),
67 fComparePtHardAndClusterPt(0),fPtHardAndClusterPtFactor(0),
68 fCTSPtMin(0), fEMCALPtMin(0), fPHOSPtMin(0),
69 fCTSPtMax(0), fEMCALPtMax(0), fPHOSPtMax(0),
70 fEMCALBadChMinDist(0), fPHOSBadChMinDist (0),
71 fEMCALNCellsCut(0), fPHOSNCellsCut(0),
72 fUseEMCALTimeCut(1), fUseParamTimeCut(0),
73 fUseTrackTimeCut(0), fAccessTrackTOF(0),
74 fEMCALTimeCutMin(-10000), fEMCALTimeCutMax(10000),
75 fEMCALParamTimeCutMin(), fEMCALParamTimeCutMax(),
76 fTrackTimeCutMin(-10000), fTrackTimeCutMax(10000),
77 fUseTrackDCACut(0),
78 fAODBranchList(0x0),
79 fCTSTracks(0x0), fEMCALClusters(0x0),
80 fDCALClusters(0x0), fPHOSClusters(0x0),
81 fEMCALCells(0x0), fPHOSCells(0x0),
82 fInputEvent(0x0), fOutputEvent(0x0),fMC(0x0),
83 fFillCTS(0), fFillEMCAL(0),
84 fFillDCAL(0), fFillPHOS(0),
85 fFillEMCALCells(0), fFillPHOSCells(0),
86 fRecalculateClusters(kFALSE),fCorrectELinearity(kTRUE),
87 fSelectEmbeddedClusters(kFALSE),
88 fSmearShowerShape(0), fSmearShowerShapeWidth(0), fRandom(),
89 fSmearingFunction(0),
90 fTrackStatus(0), fSelectSPDHitTracks(0),
91 fTrackMult(0), fTrackMultEtaCut(0.9),
92 fReadStack(kFALSE), fReadAODMCParticles(kFALSE),
93 fDeltaAODFileName(""), fFiredTriggerClassName(""),
94 
95 fEventTriggerMask(0), fMixEventTriggerMask(0), fEventTriggerAtSE(0),
96 fEventTrigMinBias(0), fEventTrigCentral(0),
97 fEventTrigSemiCentral(0), fEventTrigEMCALL0(0),
98 fEventTrigEMCALL1Gamma1(0), fEventTrigEMCALL1Gamma2(0),
99 fEventTrigEMCALL1Jet1(0), fEventTrigEMCALL1Jet2(0),
100 fBitEGA(0), fBitEJE(0),
101 
102 fEventType(-1),
103 fTaskName(""), fCaloUtils(0x0),
104 fWeightUtils(0x0), fEventWeight(1),
105 fMixedEvent(NULL), fNMixedEvent(0), fVertex(NULL),
106 fListMixedTracksEvents(), fListMixedCaloEvents(),
107 fLastMixedTracksEvent(-1), fLastMixedCaloEvent(-1),
108 fWriteOutputDeltaAOD(kFALSE),
109 fEMCALClustersListName(""), fZvtxCut(0.),
110 fAcceptFastCluster(kFALSE), fRemoveLEDEvents(kFALSE),
111 //Trigger rejection
112 fRemoveBadTriggerEvents(0), fTriggerPatchClusterMatch(1),
113 fTriggerPatchTimeWindow(), fTriggerL0EventThreshold(0),
114 fTriggerL1EventThreshold(0), fTriggerL1EventThresholdFix(0),
115 fTriggerClusterBC(0), fTriggerClusterIndex(0), fTriggerClusterId(0),
116 fIsExoticEvent(0), fIsBadCellEvent(0), fIsBadMaxCellEvent(0),
117 fIsTriggerMatch(0), fIsTriggerMatchOpenCut(),
118 fTriggerClusterTimeRecal(kTRUE), fRemoveUnMatchedTriggers(kTRUE),
119 fDoPileUpEventRejection(kFALSE), fDoV0ANDEventSelection(kFALSE),
120 fDoVertexBCEventSelection(kFALSE),
121 fDoRejectNoTrackEvents(kFALSE),
122 fUseEventsWithPrimaryVertex(kFALSE),
123 //fTriggerAnalysis (0x0),
124 fTimeStampEventSelect(0),
125 fTimeStampEventFracMin(0), fTimeStampEventFracMax(0),
126 fTimeStampRunMin(0), fTimeStampRunMax(0),
127 fNPileUpClusters(-1), fNNonPileUpClusters(-1), fNPileUpClustersCut(3),
128 fVertexBC(-200), fRecalculateVertexBC(0),
129 fUseAliCentrality(0), fCentralityClass(""), fCentralityOpt(0),
130 fEventPlaneMethod(""),
131 fFillInputNonStandardJetBranch(kFALSE),
132 fNonStandardJets(new TClonesArray("AliAODJet",100)), fInputNonStandardJetBranchName("jets"),
133 fFillInputBackgroundJetBranch(kFALSE),
134 fBackgroundJets(0x0),fInputBackgroundJetBranchName("jets"),
135 fAcceptEventsWithBit(0), fRejectEventsWithBit(0), fRejectEMCalTriggerEventsWith2Tresholds(0),
136 fMomentum(), fOutputContainer(0x0), fEnergyHistogramNbins(0),
137 fhNEventsAfterCut(0), fNMCGenerToAccept(0)
138 {
139  for(Int_t i = 0; i < 8; i++) fhEMCALClusterCutsE [i]= 0x0 ;
140  for(Int_t i = 0; i < 7; i++) fhPHOSClusterCutsE [i]= 0x0 ;
141  for(Int_t i = 0; i < 6; i++) fhCTSTrackCutsPt [i]= 0x0 ;
142  for(Int_t j = 0; j < 5; j++) fMCGenerToAccept [j] = "";
143 
144 
145  InitParameters();
146 }
147 
148 //_______________________________________
150 //_______________________________________
152 {
153  DeletePointers();
154 }
155 
156 //_______________________________________
159 //_______________________________________
161 {
162  delete fFiducialCut ;
163 
164  if(fAODBranchList)
165  {
166  fAODBranchList->Delete();
167  delete fAODBranchList ;
168  }
169 
170  if(fCTSTracks)
171  {
172  if(fDataType!=kMC)fCTSTracks->Clear() ;
173  else fCTSTracks->Delete() ;
174  delete fCTSTracks ;
175  }
176 
177  if(fEMCALClusters)
178  {
179  if(fDataType!=kMC)fEMCALClusters->Clear("C") ;
180  else fEMCALClusters->Delete() ;
181  delete fEMCALClusters ;
182  }
183 
184  if(fDCALClusters)
185  {
186  if(fDataType!=kMC)fDCALClusters->Clear("C") ;
187  else fDCALClusters->Delete() ;
188  delete fDCALClusters ;
189  }
190 
191  if(fPHOSClusters)
192  {
193  if(fDataType!=kMC)fPHOSClusters->Clear("C") ;
194  else fPHOSClusters->Delete() ;
195  delete fPHOSClusters ;
196  }
197 
198  if(fVertex)
199  {
200  for (Int_t i = 0; i < fNMixedEvent; i++)
201  {
202  delete [] fVertex[i] ;
203 
204  }
205  delete [] fVertex ;
206  }
207 
208  //delete fTriggerAnalysis;
209 
210  if(fNonStandardJets)
211  {
212  if(fDataType!=kMC) fNonStandardJets->Clear("C") ;
213  else fNonStandardJets->Delete() ;
214  delete fNonStandardJets ;
215  }
216  delete fBackgroundJets ;
217 
218  fRejectEventsWithBit.Reset();
219  fAcceptEventsWithBit.Reset();
220 
221  if ( fWeightUtils ) delete fWeightUtils ;
222 
223  // Pointers not owned, done by the analysis frame
224  // if(fInputEvent) delete fInputEvent ;
225  // if(fOutputEvent) delete fOutputEvent ;
226  // if(fMC) delete fMC ;
227  // Pointer not owned, deleted by maker
228  // if (fCaloUtils) delete fCaloUtils ;
229 }
230 
231 //____________________________________________________________
235 //____________________________________________________________
236 Bool_t AliCaloTrackReader::AcceptDCA(Float_t pt, Float_t dca)
237 {
238  Float_t cut = fTrackDCACut[0]+fTrackDCACut[1]/TMath::Power(pt,fTrackDCACut[2]);
239 
240  if(TMath::Abs(dca) < cut)
241  return kTRUE;
242  else
243  return kFALSE;
244 }
245 
246 //_____________________________________________________
249 //_____________________________________________________
251 {
252  Int_t nAccept = fAcceptEventsWithBit.GetSize();
253 
254  //printf("N accept %d\n", nAccept);
255 
256  if( nAccept <= 0 )
257  return kTRUE ; // accept the event
258 
259  UInt_t trigFired = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
260 
261  for(Int_t ibit = 0; ibit < nAccept; ibit++)
262  {
263  Bool_t accept = (trigFired & fAcceptEventsWithBit.At(ibit));
264 
265  //printf("accept %d, ibit %d, bit %d \n",accept, ibit,fAcceptEventsWithBit.At(ibit));
266  if(accept) return kTRUE ; // accept the event
267  }
268 
269  return kFALSE ; // reject the event
270 }
271 
272 //_____________________________________________________
277 //_____________________________________________________
279 {
280  if( !fMC || fNMCGenerToAccept <= 0 ) return kTRUE;
281 
282  TString genName;
283  fMC->GetCocktailGenerator(mcLabel,genName);
284 
285  Bool_t generOK = kFALSE;
286  for(Int_t ig = 0; ig < fNMCGenerToAccept; ig++)
287  {
288  if ( genName.Contains(fMCGenerToAccept[ig]) ) generOK = kTRUE;
289  }
290 
291  return generOK;
292 }
293 
294 //_____________________________________________________
297 //_____________________________________________________
299 {
300  Int_t nReject = fRejectEventsWithBit.GetSize();
301 
302  //printf("N reject %d\n", nReject);
303 
304  if( nReject <= 0 )
305  return kTRUE ; // accept the event
306 
307  UInt_t trigFired = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
308 
309  for(Int_t ibit = 0; ibit < nReject; ibit++)
310  {
311  Bool_t reject = (trigFired & fRejectEventsWithBit.At(ibit));
312 
313  //printf("reject %d, ibit %d, bit %d \n",reject, ibit,fRejectEventsWithBit.At(ibit));
314  if(reject) return kFALSE ; // reject the event
315  }
316 
317  return kTRUE ; // accept the event
318 }
319 
320 //_____________________________________________
324 //_____________________________________________
326 {
327  //-----------------------------------------------------------
328  // Reject events depending on the trigger name
329  //-----------------------------------------------------------
330 
331  AliDebug(1,Form("FiredTriggerClass <%s>, selected class <%s>, compare name %d",
334 
335  if ( fFiredTriggerClassName != "" )
336  {
338  return kFALSE;
339  else
340  AliDebug(1,"Accepted triggered event");
341  }
342 
343  fhNEventsAfterCut->Fill(1.5);
344 
345  //-----------------------------------------------------------
346  // Reject events depending on the event species type
347  //-----------------------------------------------------------
348 
349  // Event types:
350  // kStartOfRun = 1, // START_OF_RUN
351  // kEndOfRun = 2, // END_OF_RUN
352  // kStartOfRunFiles = 3, // START_OF_RUN_FILES
353  // kEndOfRunFiles = 4, // END_OF_RUN_FILES
354  // kStartOfBurst = 5, // START_OF_BURST
355  // kEndOfBurst = 6, // END_OF_BURST
356  // kPhysicsEvent = 7, // PHYSICS_EVENT
357  // kCalibrationEvent = 8, // CALIBRATION_EVENT
358  // kFormatError = 9, // EVENT_FORMAT_ERROR
359  // kStartOfData = 10, // START_OF_DATA
360  // kEndOfData = 11, // END_OF_DATA
361  // kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT
362  // kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT
363 
364  Int_t eventType = 0;
365  if(fInputEvent->GetHeader())
366  eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType();
367 
368  AliDebug(3,Form("Event type %d",eventType));
369 
370  // Select only Physics events in data, eventType = 7,
371  // usually done by physics selection
372  // MC not set, eventType =0, I think, so do not apply a value to fEventType by default
373  // LED events have eventType = 8, implemented a selection cut in the past
374  // but not really useful for EMCal data since LED are not reconstructed (unless wrongly assumed as physics)
375 
376  if ( fEventType >= 0 && eventType != fEventType ) return kFALSE ;
377 
378  AliDebug(1,"Pass event species selection");
379 
380  fhNEventsAfterCut->Fill(2.5);
381 
382  //-----------------------------------------------------------------
383  // In case of mixing analysis, select here the trigger of the event
384  //-----------------------------------------------------------------
385 
386  UInt_t isTrigger = kFALSE;
387  UInt_t isMB = kFALSE;
388 
389  if(!fEventTriggerAtSE)
390  {
391  // In case of mixing analysis, accept MB events, not only Trigger
392  // Track and cluster arrays filled for MB in order to create the pool in the corresponding analysis
393  // via de method in the base class FillMixedEventPool()
394 
395  AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
396  AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
397 
398  if(!inputHandler) return kFALSE ; // to content coverity
399 
400  isTrigger = inputHandler->IsEventSelected() & fEventTriggerMask;
401  isMB = inputHandler->IsEventSelected() & fMixEventTriggerMask;
402 
403  if(!isTrigger && !isMB) return kFALSE;
404 
405  //printf("Selected triggered event : %s\n",GetFiredTriggerClasses().Data());
406  AliDebug(0,"Pass uninteresting triggered events rejection in case of mixing analysis");
407 
408  fhNEventsAfterCut->Fill(3.5);
409  }
410 
411 
412  //-------------------------------------------------------------------------------------
413  // Reject or accept events depending on the trigger bit
414  //-------------------------------------------------------------------------------------
415 
416  Bool_t okA = AcceptEventWithTriggerBit();
417  Bool_t okR = RejectEventWithTriggerBit();
418 
419  //printf("AliCaloTrackReader::FillInputEvent() - Accept event? %d, Reject event %d? \n",okA,okR);
420 
421  if(!okA || !okR) return kFALSE;
422 
423  AliDebug(1,"Pass event bit rejection");
424 
425  fhNEventsAfterCut->Fill(4.5);
426 
427  //----------------------------------------------------------------------
428  // Do not count events that were likely triggered by an exotic cluster
429  // or out BC cluster
430  //----------------------------------------------------------------------
431 
432  // Set a bit with the event kind, MB, L0, L1 ...
434 
435  // In case of Mixing, avoid checking the triggers in the min bias events
436  if(!fEventTriggerAtSE && (isMB && !isTrigger)) return kTRUE;
437 
439  {
441  {
442  // Reject triggered events when there is coincidence on both EMCal trigger thresholds,
443  // but the requested trigger is the low trigger threshold
444  if(IsEventEMCALL1Jet1 () && IsEventEMCALL1Jet2 () && fFiredTriggerClassName.Contains("EJ2")) return kFALSE;
445  if(IsEventEMCALL1Gamma1() && IsEventEMCALL1Gamma2() && fFiredTriggerClassName.Contains("EG2")) return kFALSE;
446  }
447 
448  //Get Patches that triggered
450 
451  MatchTriggerCluster(patches);
452 
453  patches.Reset();
454 
455  // If requested, remove badly triggeed events, but only when the EMCal trigger bit is set
457  {
458  AliDebug(1,Form("ACCEPT triggered event? \n exotic? %d - bad cell %d - bad Max cell %d - BC %d - Matched %d\n",
460  if (fIsExoticEvent) return kFALSE;
461  else if(fIsBadCellEvent) return kFALSE;
462  else if(fRemoveUnMatchedTriggers && !fIsTriggerMatch) return kFALSE ;
463  else if(fTriggerClusterBC != 0) return kFALSE;
464  AliDebug(1,Form("\t *** YES for %s",GetFiredTriggerClasses().Data()));
465  }
466 
467  AliDebug(1,"Pass EMCal triggered event rejection \n");
468 
469  fhNEventsAfterCut->Fill(5.5);
470  }
471 
472  //-------------------------------------------------------------------------------------
473  // Select events only fired by a certain trigger configuration if it is provided
474  //-------------------------------------------------------------------------------------
475 
476  if (GetFiredTriggerClasses().Contains("FAST") && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster)
477  {
478  AliDebug(1,Form("Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data()));
479  return kFALSE;
480 
481  fhNEventsAfterCut->Fill(6.5);
482  }
483 
484  //-------------------------------------------------------------------------------------
485  // Reject event if large clusters with large energy
486  // Use only for LHC11a data for the moment, and if input is clusterizer V1 or V1+unfolding
487  // If clusterzer NxN or V2 it does not help
488  //-------------------------------------------------------------------------------------
489 
490  //Int_t run = fInputEvent->GetRunNumber();
491 
492  if ( fRemoveLEDEvents )
493  {
494  Bool_t reject = RejectLEDEvents();
495 
496  if(reject) return kFALSE;
497 
498  AliDebug(1,"Pass LED event rejection");
499 
500  fhNEventsAfterCut->Fill(7.5);
501  } // Remove LED events
502 
503  // All selection criteria passed, accept the event
504  return kTRUE ;
505 }
506 
507 //________________________________________________
512 //________________________________________________
514 {
515  //printf("AliCaloTrackReader::ComparePtHardAndJetPt() - GenHeaderName : %s\n",GetGenEventHeader()->ClassName());
516 
517  if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
518  {
519  TParticle * jet = 0;
520  AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
521  Int_t nTriggerJets = pygeh->NTriggerJets();
522  Float_t ptHard = pygeh->GetPtHard();
523 
524  AliDebug(1,Form("Njets: %d, pT Hard %f",nTriggerJets, ptHard));
525 
526  Float_t tmpjet[]={0,0,0,0};
527  for(Int_t ijet = 0; ijet< nTriggerJets; ijet++)
528  {
529  pygeh->TriggerJet(ijet, tmpjet);
530  jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
531 
532  AliDebug(1,Form("jet %d; pycell jet pT %f",ijet, jet->Pt()));
533 
534  //Compare jet pT and pt Hard
535  if(jet->Pt() > fPtHardAndJetPtFactor * ptHard)
536  {
537  AliInfo(Form("Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n",
538  ptHard, jet->Pt(), fPtHardAndJetPtFactor));
539  return kFALSE;
540  }
541  }
542 
543  if(jet) delete jet;
544  }
545 
546  return kTRUE ;
547 }
548 
549 //____________________________________________________
554 //____________________________________________________
556 {
557  if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
558  {
559  AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
560  Float_t ptHard = pygeh->GetPtHard();
561 
562  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
563  for (Int_t iclus = 0; iclus < nclusters; iclus++)
564  {
565  AliVCluster * clus = fInputEvent->GetCaloCluster(iclus) ;
566  Float_t ecluster = clus->E();
567 
568  if(ecluster > fPtHardAndClusterPtFactor*ptHard)
569  {
570  AliInfo(Form("Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f",ecluster,clus->GetType(),fPtHardAndClusterPtFactor,ptHard));
571 
572  return kFALSE;
573  }
574  }
575 
576  }
577 
578  return kTRUE ;
579 }
580 
581 //___________________________________________________
584 //___________________________________________________
586 {
587 
588  fhNEventsAfterCut = new TH1I("hNEventsAfterCut", "Number of analyzed events", 18, 0, 18) ;
589  //fhNEventsAfterCut->SetXTitle("Selection");
590  fhNEventsAfterCut->SetYTitle("# events");
591  fhNEventsAfterCut->GetXaxis()->SetBinLabel(1 ,"1=Input");
592  fhNEventsAfterCut->GetXaxis()->SetBinLabel(2 ,"2=Trigger string");
593  fhNEventsAfterCut->GetXaxis()->SetBinLabel(3 ,"3=Event Type");
594  fhNEventsAfterCut->GetXaxis()->SetBinLabel(4 ,"4=Mixing Event");
595  fhNEventsAfterCut->GetXaxis()->SetBinLabel(5 ,"5=Trigger Bit");
596  fhNEventsAfterCut->GetXaxis()->SetBinLabel(6 ,"6=Good EMC Trigger");
597  fhNEventsAfterCut->GetXaxis()->SetBinLabel(7 ,"7=!Fast Cluster");
598  fhNEventsAfterCut->GetXaxis()->SetBinLabel(8 ,"8=!LED");
599  fhNEventsAfterCut->GetXaxis()->SetBinLabel(9 ,"9=PtHard-Jet");
600  fhNEventsAfterCut->GetXaxis()->SetBinLabel(10,"10=PtHard-Cluster");
601  fhNEventsAfterCut->GetXaxis()->SetBinLabel(11,"11=Time stamp");
602  fhNEventsAfterCut->GetXaxis()->SetBinLabel(12,"12=Z vertex");
603  fhNEventsAfterCut->GetXaxis()->SetBinLabel(13,"13=Primary vertex");
604  fhNEventsAfterCut->GetXaxis()->SetBinLabel(14,"14=Pile-up");
605  fhNEventsAfterCut->GetXaxis()->SetBinLabel(15,"15=V0AND");
606  fhNEventsAfterCut->GetXaxis()->SetBinLabel(16,"16=Centrality");
607  fhNEventsAfterCut->GetXaxis()->SetBinLabel(17,"17=Track multi.");
608  fhNEventsAfterCut->GetXaxis()->SetBinLabel(18,"18=TOF BC");
610 
611 
612  if(fFillEMCAL)
613  {
614  for(Int_t i = 0; i < 8; i++)
615  {
616  TString names[] = {"NoCut", "Corrected", "GoodCluster", "NonLinearity",
617  "EnergyAndFidutial", "Time", "NCells", "BadDist"};
618 
619  fhEMCALClusterCutsE[i] = new TH1F(Form("hEMCALReaderClusterCuts_%d_%s",i,names[i].Data()),
620  Form("EMCal %d, %s",i,names[i].Data()),
622  fhEMCALClusterCutsE[i]->SetYTitle("# clusters");
623  fhEMCALClusterCutsE[i]->SetXTitle("#it{E} (GeV)");
625  }
626  }
627 
628  if(fFillPHOS)
629  {
630  for(Int_t i = 0; i < 7; i++)
631  {
632  TString names[] = {"NoCut", "ExcludeCPV", "BorderCut", "FiducialCut", "EnergyCut", "NCells", "BadDist"};
633 
634  fhPHOSClusterCutsE[i] = new TH1F(Form("hPHOSReaderClusterCuts_%d_%s",i,names[i].Data()),
635  Form("PHOS Cut %d, %s",i,names[i].Data()),
637  fhPHOSClusterCutsE[i]->SetYTitle("# clusters");
638  fhPHOSClusterCutsE[i]->SetXTitle("#it{E} (GeV)");
640  }
641  }
642 
643  if(fFillCTS)
644  {
645  for(Int_t i = 0; i < 6; i++)
646  {
647  TString names[] = {"NoCut", "Status", "ESD_AOD", "TOF", "DCA","PtAcceptanceMult"};
648 
649  fhCTSTrackCutsPt[i] = new TH1F(Form("hCTSReaderClusterCuts_%d_%s",i,names[i].Data()),
650  Form("CTS Cut %d, %s",i,names[i].Data()),
652  fhCTSTrackCutsPt[i]->SetYTitle("# tracks");
653  fhCTSTrackCutsPt[i]->SetXTitle("#it{p}_{T} (GeV)");
655  }
656  }
657 
658  return fOutputContainer ;
659 }
660 
661 //_____________________________________________________
663 //_____________________________________________________
665 {
666  TString parList ; //this will be list of parameters used for this analysis.
667 
668  const Int_t buffersize = 255;
669  char onePar[buffersize] ;
670 
671  snprintf(onePar,buffersize,"--- Reader ---:") ;
672  parList+=onePar ;
673  snprintf(onePar,buffersize,"Data type: %d; zvertex cut %2.2f; EMC cluster name: <%s> ",fDataType, fZvtxCut, fEMCALClustersListName.Data()) ;
674  parList+=onePar ;
675  snprintf(onePar,buffersize,"Use detector: EMC %d, DCA %d, PHOS %d, CTS %d, EMCcells %d, PHOScells %d ; ",
677  snprintf(onePar,buffersize,"E-pT window: EMC (%2.1f,%2.1f), PHOS (%2.1f,%2.1f), CTS (%2.1f,%2.1f); ",
679  parList+=onePar ;
680  snprintf(onePar,buffersize,"Dist to bad channel: EMC > %2.1f, PHOS > %2.1f; ",fEMCALBadChMinDist,fPHOSBadChMinDist) ;
681  parList+=onePar ;
682  snprintf(onePar,buffersize,"N cells: EMC > %d, PHOS > %d; ",fEMCALNCellsCut,fPHOSNCellsCut) ;
683  parList+=onePar ;
684  snprintf(onePar,buffersize,"EMC time cut single window (%2.2f,%2.2f); ",fEMCALTimeCutMin,fEMCALTimeCutMax) ;
685  parList+=onePar ;
686  snprintf(onePar,buffersize,"Check: calo fid cut %d; ",fCheckFidCut) ;
687  parList+=onePar ;
688  snprintf(onePar,buffersize,"Track: status %d, multip. eta cut %1.1f, SPD hit %d; ",(Int_t) fTrackStatus, fTrackMultEtaCut, fSelectSPDHitTracks) ;
689  parList+=onePar ;
690 
691  if(fUseTrackDCACut)
692  {
693  snprintf(onePar,buffersize,"DCA cut ON, param (%2.4f,%2.4f,%2.4f); ",fTrackDCACut[0],fTrackDCACut[1],fTrackDCACut[2]) ;
694  parList+=onePar ;
695  }
696 
697  snprintf(onePar,buffersize,"Recalculate Clusters = %d, E linearity = %d; ",fRecalculateClusters, fCorrectELinearity) ;
698  parList+=onePar ;
699 
700  snprintf(onePar,buffersize,"SE trigger sel. %d, not? trigger Mask? %d, MB Trigger Mask for mixed %d; ",
702  parList+=onePar ;
703 
704  snprintf(onePar,buffersize,"Select fired trigger %s; Remove Bad trigger event %d, unmatched %d; Accept fastcluster %d, Reject LED %d ",
706  parList+=onePar ;
707 
709  {
710  snprintf(onePar,buffersize,"Accept only labels from: ");
711  parList+=onePar ;
712  for(Int_t i = 0; i< fNMCGenerToAccept; i++)
713  parList+=(fMCGenerToAccept[i]+" ") ;
714 
715  snprintf(onePar,buffersize,"; ");
716  parList+=onePar ;
717  }
718 
720  {
721  snprintf(onePar,buffersize,"EMC M02 smear ON, function %d, param %2.4f; ",fSmearingFunction,fSmearShowerShapeWidth) ;
722  parList+=onePar ;
723  }
724 
726  {
727  snprintf(onePar,buffersize,"jet pt / pt hard < %2.1f; ",fPtHardAndJetPtFactor);
728  parList+=onePar ;
729  }
730 
732  {
733  snprintf(onePar,buffersize,"cluster pt / pt hard < %2.2f",fPtHardAndClusterPtFactor);
734  parList+=onePar ;
735  }
736 
737  snprintf(onePar,buffersize,"Centrality: Class %s, Option %d, Bin [%d,%d]; New centrality %d; Event plane method %s; ",
739  parList+=onePar ;
740 
741  return new TObjString(parList) ;
742 }
743 
744 
745 //____________________________________________
747 //____________________________________________
749 {
750  if(fMC)
751  return fMC->Stack();
752  else
753  {
754  AliDebug(1,"Stack is not available");
755  return 0x0 ;
756  }
757 }
758 
759 //______________________________________________
761 //______________________________________________
763 {
764  if(fMC)
765  {
766  return fMC->Header();
767  }
768  else
769  {
770  AliInfo("Header is not available");
771  return 0x0 ;
772  }
773 }
774 
775 //______________________________________________________________
777 //______________________________________________________________
778 AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader(TString headerName) const
779 {
780  if (ReadStack() && fMC)
781  {
782  AliGenEventHeader * eventHeader = fMC->GenEventHeader();
783 
784  if(headerName=="") return eventHeader ;
785 
786  AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader);
787 
788  if(!cocktail) return 0x0 ;
789 
790  TList *genHeaders = cocktail->GetHeaders();
791 
792  Int_t nGenerators = genHeaders->GetEntries();
793 
794  for(Int_t igen = 0; igen < nGenerators; igen++)
795  {
796  AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ;
797  TString name = eventHeader2->GetName();
798 
799  if(name.Contains(headerName,TString::kIgnoreCase)) return eventHeader2 ;
800  }
801 
802  return 0x0;
803 
804  }
805  else if(ReadAODMCParticles() && GetAODMCHeader())
806  {
807  Int_t nGenerators = GetAODMCHeader()->GetNCocktailHeaders();
808 
809  if( nGenerators <= 0) return 0x0;
810 
811  if(headerName=="") return GetAODMCHeader()->GetCocktailHeader(0);
812 
813  for(Int_t igen = 0; igen < nGenerators; igen++)
814  {
815  AliGenEventHeader * eventHeader = GetAODMCHeader()->GetCocktailHeader(igen) ;
816  TString name = eventHeader->GetName();
817 
818  if(name.Contains(headerName,TString::kIgnoreCase)) return eventHeader ;
819  }
820 
821  return 0x0;
822 
823  }
824  else
825  {
826  return 0x0;
827  }
828 }
829 
830 //_________________________________________________________
833 //_________________________________________________________
835 {
836  AliInfo("Input are not AODs");
837 
838  return NULL ;
839 }
840 
841 //________________________________________________________
844 //________________________________________________________
845 AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader() const
846 {
847  AliInfo("Input are not AODs");
848 
849  return NULL ;
850 }
851 
852 //___________________________________________________________
860 //___________________________________________________________
861 Int_t AliCaloTrackReader::GetVertexBC(const AliVVertex * vtx)
862 {
863  Int_t vertexBC=vtx->GetBC();
864 
865  if(!fRecalculateVertexBC) return vertexBC;
866 
867  // Value not available, recalculate it.
868 
869  Double_t bz = fInputEvent->GetMagneticField();
870  Bool_t bc0 = kFALSE;
871  Int_t ntr = GetCTSTracks()->GetEntriesFast();
872  //printf("N Tracks %d\n",ntr);
873 
874  for(Int_t i = 0 ; i < ntr ; i++)
875  {
876  AliVTrack * track = (AliVTrack*) (GetCTSTracks()->At(i));
877 
878  //Check if has TOF info, if not skip
879  ULong_t status = track->GetStatus();
880  Bool_t okTOF = (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ;
881  vertexBC = track->GetTOFBunchCrossing(bz);
882  Float_t pt = track->Pt();
883 
884  if(!okTOF) continue;
885 
886  // Get DCA x, y
887  Double_t dca[2] = {1e6,1e6};
888  Double_t covar[3] = {1e6,1e6,1e6};
889  track->PropagateToDCA(vtx,bz,100.,dca,covar);
890 
891  if(AcceptDCA(pt,dca[0]))
892  {
893  if (vertexBC !=0 && fVertexBC != AliVTrack::kTOFBCNA) return vertexBC;
894  else if(vertexBC == 0) bc0 = kTRUE;
895  }
896  }
897 
898  if( bc0 ) vertexBC = 0 ;
899  else vertexBC = AliVTrack::kTOFBCNA ;
900 
901  return vertexBC;
902 }
903 
904 //_____________________________
911 //_____________________________
912 Int_t AliCaloTrackReader::GetTrackID(AliVTrack* track)
913 {
914  return track->GetID();
915 }
916 
917 //_____________________________
920 //_____________________________
922 {
924  {
925  AliInfo("Cannot access stack and mcparticles at the same time, change them");
926  fReadStack = kFALSE;
927  fReadAODMCParticles = kFALSE;
928  }
929 
930  // Activate debug level in AliAnaWeights
931  if( fWeightUtils->GetDebug() >= 0 )
932  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(fWeightUtils->ClassName(), fWeightUtils->GetDebug());
933 }
934 
935 //_______________________________________
937 //_______________________________________
939 {
940  fDataType = kESD ;
941  fCTSPtMin = 0.1 ;
942  fEMCALPtMin = 0.1 ;
943  fPHOSPtMin = 0.1 ;
944  fCTSPtMax = 1000. ;
945  fEMCALPtMax = 1000. ;
946  fPHOSPtMax = 1000. ;
947 
948  fEMCALBadChMinDist = 0; // open, 2; // standard
949  fPHOSBadChMinDist = 0; // open, 2; // standard
950 
951  fEMCALNCellsCut = 0; // open, 1; // standard
952  fPHOSNCellsCut = 0; // open, 2; // standard
953 
954  //Track DCA cuts
955  // dca_xy cut = 0.0105+0.0350/TMath::Power(pt,1.1);
956  fTrackDCACut[0] = 0.0105;
957  fTrackDCACut[1] = 0.0350;
958  fTrackDCACut[2] = 1.1;
959 
960  //Do not filter the detectors input by default.
961  fFillEMCAL = kFALSE;
962  fFillDCAL = kFALSE;
963  fFillPHOS = kFALSE;
964  fFillCTS = kFALSE;
965  fFillEMCALCells = kFALSE;
966  fFillPHOSCells = kFALSE;
967 
968  fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
969  fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
970  fDeltaAODFileName = "deltaAODPartCorr.root";
972  fEventTriggerMask = AliVEvent::kAny;
973  fMixEventTriggerMask = AliVEvent::kAnyINT;
974  fEventTriggerAtSE = kTRUE; // Use only events that pass event selection at SE base class
975 
976  fAcceptFastCluster = kTRUE;
977  fEventType = -1;
978 
979  //We want tracks fitted in the detectors:
980  //fTrackStatus=AliESDtrack::kTPCrefit;
981  //fTrackStatus|=AliESDtrack::kITSrefit;
982  fTrackStatus = 0;
983 
984  fV0ADC[0] = 0; fV0ADC[1] = 0;
985  fV0Mul[0] = 0; fV0Mul[1] = 0;
986 
987  fZvtxCut = 10.;
988 
989  fNMixedEvent = 1;
990 
993 
994  //Centrality
995  fUseAliCentrality = kFALSE;
996  fCentralityClass = "V0M";
997  fCentralityOpt = 100;
998  fCentralityBin[0] = fCentralityBin[1]=-1;
999 
1000  fEventPlaneMethod = "V0";
1001 
1002  // Allocate memory (not sure this is the right place)
1003  fCTSTracks = new TObjArray();
1004  fEMCALClusters = new TObjArray();
1005  fDCALClusters = new TObjArray();
1006  fPHOSClusters = new TObjArray();
1007  //fTriggerAnalysis = new AliTriggerAnalysis;
1008  fAODBranchList = new TList ;
1009  fOutputContainer = new TList ;
1010 
1011  fEnergyHistogramNbins = 200;
1012  fEnergyHistogramLimit[0] = 0 ;
1013  fEnergyHistogramLimit[1] = 100;
1014 
1015  fPileUpParamSPD[0] = 3 ; fPileUpParamSPD[1] = 0.8 ;
1016  fPileUpParamSPD[2] = 3.0 ; fPileUpParamSPD[3] = 2.0 ; fPileUpParamSPD[4] = 5.0;
1017 
1018  // Parametrized time cut (LHC11d)
1021 
1022  // Parametrized time cut (LHC11c)
1023  //fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 1.87; fEMCALParamTimeCutMin[3] = 0.4;
1024  //fEMCALParamTimeCutMax[0] = 3.5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.15; fEMCALParamTimeCutMax[3] = 1.6;
1025 
1026  fTimeStampRunMin = -1;
1027  fTimeStampRunMax = 1e12;
1030 
1031  for(Int_t i = 0; i < 19; i++)
1032  {
1033  fEMCalBCEvent [i] = 0;
1034  fEMCalBCEventCut[i] = 0;
1035  fTrackBCEvent [i] = 0;
1036  fTrackBCEventCut[i] = 0;
1037  }
1038 
1039  // Trigger match-rejection
1040  fTriggerPatchTimeWindow[0] = 8;
1041  fTriggerPatchTimeWindow[1] = 9;
1042 
1043  fTriggerClusterBC = -10000 ;
1046  fTriggerClusterIndex = -1;
1047  fTriggerClusterId = -1;
1048 
1049  //Jets
1052  if(!fNonStandardJets) fNonStandardJets = new TClonesArray("AliAODJet",100);
1055  if(!fBackgroundJets) fBackgroundJets = new AliAODJetEventBackground();
1056 
1057  fSmearShowerShapeWidth = 0.005;
1058 
1059  fWeightUtils = new AliAnaWeights() ;
1060  fEventWeight = 1 ;
1061 
1062 }
1063 
1064 //__________________________________________________________________________
1067 //__________________________________________________________________________
1068 Bool_t AliCaloTrackReader::IsInTimeWindow(Double_t tof, Float_t energy) const
1069 {
1070  // Parametrized cut depending on E
1071  if(fUseParamTimeCut)
1072  {
1073  Float_t minCut= fEMCALParamTimeCutMin[0]+fEMCALParamTimeCutMin[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMin[2])/fEMCALParamTimeCutMin[3]);
1074  Float_t maxCut= fEMCALParamTimeCutMax[0]+fEMCALParamTimeCutMax[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMax[2])/fEMCALParamTimeCutMax[3]);
1075  //printf("tof %f, minCut %f, maxCut %f\n",tof,minCut,maxCut);
1076  if( tof < minCut || tof > maxCut ) return kFALSE ;
1077  }
1078 
1079  //In any case, the time should to be larger than the fixed window ...
1080  if( tof < fEMCALTimeCutMin || tof > fEMCALTimeCutMax ) return kFALSE ;
1081 
1082  return kTRUE ;
1083 }
1084 
1085 //________________________________________________
1088 //________________________________________________
1090 {
1091  return fInputEvent->IsPileupFromSPD((Int_t) fPileUpParamSPD[0] , fPileUpParamSPD[1] ,
1092  fPileUpParamSPD[2] , fPileUpParamSPD[3] , fPileUpParamSPD[4] );
1093  //printf("Param : %d, %2.2f, %2.2f, %2.2f, %2.2f\n",(Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
1094 }
1095 
1096 //__________________________________________________
1098 //__________________________________________________
1100 {
1101  if(fNPileUpClusters > fNPileUpClustersCut) return kTRUE ;
1102  else return kFALSE;
1103 }
1104 
1105 //________________________________________________________
1107 //________________________________________________________
1109 {
1110  if( IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
1111  else return kFALSE;
1112 }
1113 
1114 //_______________________________________________________
1116 //_______________________________________________________
1118 {
1119  if( IsPileUpFromSPD() || IsPileUpFromEMCal()) return kTRUE ;
1120  else return kFALSE;
1121 }
1122 
1123 //___________________________________________________________
1125 //___________________________________________________________
1127 {
1128  if( IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
1129  else return kFALSE;
1130 }
1131 
1132 //___________________________________________________________
1134 //___________________________________________________________
1136 {
1137  if( !IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
1138  else return kFALSE;
1139 }
1140 
1141 //______________________________________________________________
1143 //______________________________________________________________
1145 {
1146  if( !IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
1147  else return kFALSE;
1148 }
1149 
1150 //___________________________________________________________________________________
1158 //___________________________________________________________________________________
1159 Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileName*/)
1160 {
1161  fEventNumber = iEntry;
1162  fTriggerClusterIndex = -1;
1163  fTriggerClusterId = -1;
1164  fIsTriggerMatch = kFALSE;
1165  fTriggerClusterBC = -10000;
1166  fIsExoticEvent = kFALSE;
1167  fIsBadCellEvent = kFALSE;
1168  fIsBadMaxCellEvent = kFALSE;
1169 
1170  fIsTriggerMatchOpenCut[0] = kFALSE ;
1171  fIsTriggerMatchOpenCut[1] = kFALSE ;
1172  fIsTriggerMatchOpenCut[2] = kFALSE ;
1173 
1174  //fCurrentFileName = TString(currentFileName);
1175  if(!fInputEvent)
1176  {
1177  AliInfo("Input event not available, skip event analysis");
1178  return kFALSE;
1179  }
1180 
1181  fhNEventsAfterCut->Fill(0.5);
1182 
1183  //-----------------------------------------------
1184  // Select the event depending on the trigger type
1185  // and other event characteristics
1186  // like the goodness of the EMCal trigger
1187  //-----------------------------------------------
1188 
1189  Bool_t accept = CheckEventTriggers();
1190  if(!accept) return kFALSE;
1191 
1192  AliDebug(1,"Pass Event trigger selection");
1193 
1194  //---------------------------------------------------------------------------
1195  // In case of analysis of events with jets, skip those with jet pt > 5 pt hard
1196  // To be used on for MC data in pT hard bins
1197  //---------------------------------------------------------------------------
1198 
1200  {
1201  if(!ComparePtHardAndJetPt()) return kFALSE ;
1202  AliDebug(1,"Pass Pt Hard - Jet rejection");
1203  fhNEventsAfterCut->Fill(8.5);
1204  }
1205 
1207  {
1208  if(!ComparePtHardAndClusterPt()) return kFALSE ;
1209  AliDebug(1,"Pass Pt Hard - Cluster rejection");
1210  fhNEventsAfterCut->Fill(9.5);
1211  }
1212 
1213  //------------------------------------------------------
1214  // Event rejection depending on time stamp
1215  //------------------------------------------------------
1216 
1218  {
1219  AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
1220  if(esd)
1221  {
1222  Int_t timeStamp = esd->GetTimeStamp();
1223  Float_t timeStampFrac = 1.*(timeStamp-fTimeStampRunMin) / (fTimeStampRunMax-fTimeStampRunMin);
1224 
1225  //printf("stamp0 %d, max0 %d, frac %f\n", timeStamp-fTimeStampRunMin,fTimeStampRunMax-fTimeStampRunMin, timeStampFrac);
1226 
1227  if(timeStampFrac < fTimeStampEventFracMin || timeStampFrac > fTimeStampEventFracMax) return kFALSE;
1228  }
1229 
1230  AliDebug(1,"Pass Time Stamp rejection");
1231  fhNEventsAfterCut->Fill(10.5);
1232  }
1233 
1234  //------------------------------------------------------
1235  // Event rejection depending on vertex, pileup, v0and
1236  //------------------------------------------------------
1237 
1238  FillVertexArray();
1239 
1240  //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code
1241  if(!GetMixedEvent() && TMath::Abs(fVertex[0][2]) > fZvtxCut) return kFALSE;
1242 
1243  fhNEventsAfterCut->Fill(11.5);
1244 
1246  {
1247  if( !CheckForPrimaryVertex() ) return kFALSE; // algorithm in ESD/AOD Readers
1248  if( TMath::Abs(fVertex[0][0] ) < 1.e-6 &&
1249  TMath::Abs(fVertex[0][1] ) < 1.e-6 &&
1250  TMath::Abs(fVertex[0][2] ) < 1.e-6 ) return kFALSE;
1251  }
1252 
1253  AliDebug(1,"Pass primary vertex rejection");
1254 
1255  fhNEventsAfterCut->Fill(12.5);
1256 
1257  //printf("Reader : IsPileUp %d, Multi %d\n",IsPileUpFromSPD(),fInputEvent->IsPileupFromSPDInMultBins());
1258 
1260  {
1261  // Do not analyze events with pileup
1262  Bool_t bPileup = IsPileUpFromSPD();
1263  //IsPileupFromSPDInMultBins() // method to try
1264  //printf("pile-up %d, %d, %2.2f, %2.2f, %2.2f, %2.2f\n",bPileup, (Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
1265  if(bPileup) return kFALSE;
1266 
1267  AliDebug(1,"Pass Pile-Up event rejection");
1268 
1269  fhNEventsAfterCut->Fill(13.5);
1270  }
1271 
1273  {
1274  AliVVZERO* v0 = fInputEvent->GetVZEROData();
1275 
1276  Bool_t bV0AND = ((v0->GetV0ADecision()==1) && (v0->GetV0CDecision()==1));
1277  //bV0AND = fTriggerAnalysis->IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0AND);
1278  //printf("V0AND event? %d\n",bV0AND);
1279 
1280  if(!bV0AND)
1281  {
1282  AliDebug(1,"Reject event by V0AND");
1283  return kFALSE;
1284  }
1285 
1286  AliDebug(1,"Pass V0AND event rejection");
1287 
1288  fhNEventsAfterCut->Fill(14.5);
1289  }
1290 
1291  //------------------------------------------------------
1292  // Check if there is a centrality value, PbPb analysis,
1293  // and if a centrality bin selection is requested
1294  //------------------------------------------------------
1295 
1296  //If we need a centrality bin, we select only those events in the corresponding bin.
1297  Int_t cen = -1;
1298  if ( fCentralityBin[0] >= 0 && fCentralityBin[1] >= 0 )
1299  {
1300  cen = GetEventCentrality();
1301 
1302  if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
1303 
1304  AliDebug(1,"Pass centrality rejection");
1305 
1306  fhNEventsAfterCut->Fill(15.5);
1307  }
1308 
1309  // Recover the weight assigned to the event, if provided
1310  // right now only for pT-hard bins and centrality depedent weights
1312  {
1314 
1315  fWeightUtils->SetPythiaEventHeader(((AliGenPythiaEventHeader*)GetGenEventHeader()));
1316 
1318  }
1319 
1320  //-------------------------------------------------------
1321  // Get the main vertex BC, in case not available
1322  // it is calculated in FillCTS checking the BC of tracks
1323  //------------------------------------------------------
1324  fVertexBC = fInputEvent->GetPrimaryVertex()->GetBC();
1325 
1326  //-----------------------------------------------
1327  // Fill the arrays with cluster/tracks/cells data
1328  //-----------------------------------------------
1329 
1330  if(fFillCTS)
1331  {
1332  FillInputCTS();
1333  //Accept events with at least one track
1334  if(fTrackMult == 0 && fDoRejectNoTrackEvents) return kFALSE ;
1335 
1336  fhNEventsAfterCut->Fill(16.5);
1337 
1338  AliDebug(1,"Pass rejection of null track events");
1339  }
1340 
1342  {
1343  if(fVertexBC != 0 && fVertexBC != AliVTrack::kTOFBCNA) return kFALSE ;
1344 
1345  AliDebug(1,"Pass rejection of events with vertex at BC!=0");
1346 
1347  fhNEventsAfterCut->Fill(17.5);
1348  }
1349 
1350  if(fFillEMCALCells)
1352 
1353  if(fFillPHOSCells)
1355 
1356  if(fFillEMCAL || fFillDCAL)
1357  FillInputEMCAL();
1358 
1359  if(fFillPHOS)
1360  FillInputPHOS();
1361 
1362  FillInputVZERO();
1363 
1364  //one specified jet branch
1369 
1370  AliDebug(1,"Event accepted for analysis");
1371 
1372  return kTRUE ;
1373 }
1374 
1375 //__________________________________________________
1378 //__________________________________________________
1380 {
1381  if(fUseAliCentrality)
1382  {
1383  if ( !GetCentrality() ) return -1;
1384 
1385  if (fCentralityOpt == 100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); // 100 bins max
1386  else if(fCentralityOpt == 10) return GetCentrality()->GetCentralityClass10(fCentralityClass);// 10 bins max
1387  else if(fCentralityOpt == 20) return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max
1388  else
1389  {
1390  AliInfo(Form("Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt));
1391  return -1;
1392  }
1393  }
1394  else
1395  {
1396  if ( !GetMultSelCen() ) return -1;
1397 
1398  return GetMultSelCen()->GetMultiplicityPercentile(fCentralityClass, kTRUE); // returns centrality only for events used in calibration
1399 
1400  // equivalent to
1401  //GetMultSelCen()->GetMultiplicityPercentile("V0M", kFALSE); // returns centrality for any event
1402  //Int_t qual = GetMultSelCen()->GetEvSelCode(); if (qual ! = 0) cent = qual;
1403  }
1404 }
1405 
1406 //_____________________________________________________
1409 //_____________________________________________________
1411 {
1412  if( !GetEventPlane() ) return -1000;
1413 
1414  Float_t ep = GetEventPlane()->GetEventplane(GetEventPlaneMethod(), GetInputEvent());
1415 
1416  if(GetEventPlaneMethod()=="Q" && (ep < 0 || ep > TMath::Pi()))
1417  {
1418  AliDebug(1,Form("Bad EP for <Q> method : %f\n",ep));
1419  return -1000;
1420  }
1421  else if(GetEventPlaneMethod().Contains("V0") )
1422  {
1423  if((ep > TMath::Pi()/2 || ep < -TMath::Pi()/2))
1424  {
1425  AliDebug(1,Form("Bad EP for <%s> method : %f\n",GetEventPlaneMethod().Data(), ep));
1426  return -1000;
1427  }
1428 
1429  ep+=TMath::Pi()/2; // put same range as for <Q> method
1430  }
1431 
1432  AliDebug(3,Form("Event plane angle %f",ep));
1433 
1434 // if(fDebug > 0 )
1435 // {
1436 // if (ep > TMath::Pi()) printf("AliCaloTrackReader::GetEventPlaneAngle() - Too large angle = %f\n",ep);
1437 // else if(ep < 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Negative angle = %f\n" ,ep);
1438 // }
1439 
1440  return ep;
1441 }
1442 
1443 //__________________________________________________________
1445 //__________________________________________________________
1446 void AliCaloTrackReader::GetVertex(Double_t vertex[3]) const
1447 {
1448  vertex[0] = fVertex[0][0];
1449  vertex[1] = fVertex[0][1];
1450  vertex[2] = fVertex[0][2];
1451 }
1452 
1453 //__________________________________________________________________________
1455 //__________________________________________________________________________
1456 void AliCaloTrackReader::GetVertex(Double_t vertex[3], Int_t evtIndex) const
1457 {
1458  vertex[0] = fVertex[evtIndex][0];
1459  vertex[1] = fVertex[evtIndex][1];
1460  vertex[2] = fVertex[evtIndex][2];
1461 }
1462 
1463 //________________________________________
1466 //________________________________________
1468 {
1469  // Delete previous vertex
1470  if(fVertex)
1471  {
1472  for (Int_t i = 0; i < fNMixedEvent; i++)
1473  {
1474  delete [] fVertex[i] ;
1475  }
1476  delete [] fVertex ;
1477  }
1478 
1479  fVertex = new Double_t*[fNMixedEvent] ;
1480  for (Int_t i = 0; i < fNMixedEvent; i++)
1481  {
1482  fVertex[i] = new Double_t[3] ;
1483  fVertex[i][0] = 0.0 ;
1484  fVertex[i][1] = 0.0 ;
1485  fVertex[i][2] = 0.0 ;
1486  }
1487 
1488  if (!fMixedEvent)
1489  { // Single event analysis
1490  if(fDataType!=kMC)
1491  {
1492 
1493  if(fInputEvent->GetPrimaryVertex())
1494  {
1495  fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]);
1496  }
1497  else
1498  {
1499  AliWarning("NULL primary vertex");
1500  fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1501  }//Primary vertex pointer do not exist
1502 
1503  } else
1504  {// MC read event
1505  fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1506  }
1507 
1508  AliDebug(1,Form("Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]));
1509 
1510  } else
1511  { // MultiEvent analysis
1512  for (Int_t iev = 0; iev < fNMixedEvent; iev++)
1513  {
1514  if (fMixedEvent->GetVertexOfEvent(iev))
1515  fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]);
1516  else
1517  AliWarning("No vertex found");
1518 
1519  AliDebug(1,Form("Multi Event %d Vertex : %f,%f,%f",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]));
1520  }
1521  }
1522 }
1523 
1524 //_____________________________________
1530 //_____________________________________
1532 {
1533  AliDebug(1,"Begin");
1534 
1535  Double_t pTrack[3] = {0,0,0};
1536 
1537  Int_t nTracks = fInputEvent->GetNumberOfTracks() ;
1538  fTrackMult = 0;
1539  Int_t nstatus = 0;
1540  Double_t bz = GetInputEvent()->GetMagneticField();
1541 
1542  for(Int_t i = 0; i < 19; i++)
1543  {
1544  fTrackBCEvent [i] = 0;
1545  fTrackBCEventCut[i] = 0;
1546  }
1547 
1548  Bool_t bc0 = kFALSE;
1549  if(fRecalculateVertexBC) fVertexBC = AliVTrack::kTOFBCNA;
1550 
1551  for (Int_t itrack = 0; itrack < nTracks; itrack++)
1552  {
1553  AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd
1554 
1555  if ( !AcceptParticleMCLabel( TMath::Abs(track->GetLabel()) ) ) continue ;
1556 
1557  fhCTSTrackCutsPt[0]->Fill(track->Pt());
1558 
1559  //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
1560  ULong_t status = track->GetStatus();
1561 
1562  if (fTrackStatus && !((status & fTrackStatus) == fTrackStatus))
1563  continue ;
1564 
1565  fhCTSTrackCutsPt[1]->Fill(track->Pt());
1566 
1567  nstatus++;
1568 
1569  //-------------------------
1570  // Select the tracks depending on cuts of AOD or ESD
1571  if(!SelectTrack(track, pTrack)) continue ;
1572 
1573  fhCTSTrackCutsPt[2]->Fill(track->Pt());
1574 
1575  //-------------------------
1576  // TOF cuts
1577  Bool_t okTOF = ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) ;
1578  Double_t tof = -1000;
1579  Int_t trackBC = -1000 ;
1580 
1581  if(fAccessTrackTOF)
1582  {
1583  if(okTOF)
1584  {
1585  trackBC = track->GetTOFBunchCrossing(bz);
1586  SetTrackEventBC(trackBC+9);
1587 
1588  tof = track->GetTOFsignal()*1e-3;
1589 
1590  //After selecting tracks with small DCA, pointing to vertex, set vertex BC depeding on tracks BC
1592  {
1593  if (trackBC != 0 && trackBC != AliVTrack::kTOFBCNA) fVertexBC = trackBC;
1594  else if(trackBC == 0) bc0 = kTRUE;
1595  }
1596 
1597  //In any case, the time should to be larger than the fixed window ...
1598  if( fUseTrackTimeCut && (trackBC !=0 || tof < fTrackTimeCutMin || tof > fTrackTimeCutMax) )
1599  {
1600  //printf("Remove track time %f and bc = %d\n",tof,trackBC);
1601  continue ;
1602  }
1603  //else printf("Accept track time %f and bc = %d\n",tof,trackBC);
1604  }
1605  }
1606 
1607  fhCTSTrackCutsPt[3]->Fill(track->Pt());
1608 
1609  //---------------------
1610  // DCA cuts
1611  //
1612  fMomentum.SetPxPyPzE(pTrack[0],pTrack[1],pTrack[2],0);
1613 
1614  if(fUseTrackDCACut)
1615  {
1616  Float_t dcaTPC =-999;
1617  //In case of AODs, TPC tracks cannot be propagated back to primary vertex,
1618  if( fDataType == kAOD ) dcaTPC = ((AliAODTrack*) track)->DCA();
1619 
1620  //normal way to get the dca, cut on dca_xy
1621  if(dcaTPC==-999)
1622  {
1623  Double_t dca[2] = {1e6,1e6};
1624  Double_t covar[3] = {1e6,1e6,1e6};
1625  Bool_t okDCA = track->PropagateToDCA(fInputEvent->GetPrimaryVertex(),bz,100.,dca,covar);
1626  if( okDCA) okDCA = AcceptDCA(fMomentum.Pt(),dca[0]);
1627  if(!okDCA)
1628  {
1629  //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f\n",fMomentum.Pt(),dca[0]);
1630  continue ;
1631  }
1632  }
1633  }// DCA cuts
1634 
1635  fhCTSTrackCutsPt[4]->Fill(track->Pt());
1636 
1637  //-------------------------
1638  // Kinematic/acceptance cuts
1639  //
1640  // Count the tracks in eta < 0.9
1641  if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
1642 
1643  if(fCTSPtMin > fMomentum.Pt() || fCTSPtMax < fMomentum.Pt()) continue ;
1644 
1645  // Check effect of cuts on track BC
1646  if(fAccessTrackTOF && okTOF) SetTrackEventBCcut(trackBC+9);
1647 
1648  if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kCTS)) continue;
1649 
1650  fhCTSTrackCutsPt[5]->Fill(track->Pt());
1651 
1652  // ------------------------------
1653  // Add selected tracks to array
1654  AliDebug(2,Form("Selected tracks pt %3.2f, phi %3.2f deg, eta %3.2f",
1655  fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1656 
1657  fCTSTracks->Add(track);
1658 
1659  // TODO, check if remove
1660  if (fMixedEvent) track->SetID(itrack);
1661 
1662  }// track loop
1663 
1664  if( fRecalculateVertexBC && (fVertexBC == 0 || fVertexBC == AliVTrack::kTOFBCNA))
1665  {
1666  if( bc0 ) fVertexBC = 0 ;
1667  else fVertexBC = AliVTrack::kTOFBCNA ;
1668  }
1669 
1670  AliDebug(1,Form("AOD entries %d, input tracks %d, pass status %d, multipliticy %d", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult));//fCTSTracksNormalInputEntries);
1671 }
1672 
1673 //_______________________________________________________________________________
1691 //_______________________________________________________________________________
1692 void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, Int_t iclus)
1693 {
1694  // Accept clusters with the proper label
1695  if(clus->GetLabel() >=0 ) // -1 corresponds to noisy MC
1696  {
1697  if ( !AcceptParticleMCLabel(clus->GetLabel()) ) return ;
1698  }
1699 
1700  // TODO, not sure if needed anymore
1701  Int_t vindex = 0 ;
1702  if (fMixedEvent)
1703  vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1704 
1705  clus->GetMomentum(fMomentum, fVertex[vindex]);
1706 
1707  // No correction/cut applied yet
1708  fhEMCALClusterCutsE[0]->Fill(clus->E());
1709 
1710  //if( (fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10 )
1711  AliDebug(2,Form("Input cluster E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1712  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1713 
1714  //---------------------------
1715  // Embedding case
1716  // TO BE REVISED
1718  {
1719  if(clus->GetNLabels()==0 || clus->GetLabel() < 0) return;
1720  //else printf("Embedded cluster, %d, n label %d label %d \n",iclus,clus->GetNLabels(),clus->GetLabel());
1721  }
1722 
1723  //--------------------------------------
1724  // Apply some corrections in the cluster
1725  //
1727  {
1728  //Recalibrate the cluster energy
1730  {
1732 
1733  clus->SetE(energy);
1734  //printf("Recalibrated Energy %f\n",clus->E());
1735 
1738 
1739  } // recalculate E
1740 
1741  //Recalculate distance to bad channels, if new list of bad channels provided
1743 
1744  //Recalculate cluster position
1745  if(GetCaloUtils()->IsRecalculationOfClusterPositionOn())
1746  {
1748  //clus->GetPosition(pos);
1749  //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1750  }
1751 
1752  // Recalculate TOF
1753  if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
1754  {
1755  Double_t tof = clus->GetTOF();
1756  Float_t frac =-1;
1757  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1758 
1759  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1760 
1761  //additional L1 phase shift
1762  if(GetCaloUtils()->GetEMCALRecoUtils()->IsL1PhaseInTimeRecalibrationOn())
1763  {
1764  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absIdMax),
1765  fInputEvent->GetBunchCrossNumber(), tof);
1766  }
1767 
1768  clus->SetTOF(tof);
1769 
1770  }// Time recalibration
1771  }
1772 
1773  // Check effect of corrections
1774  fhEMCALClusterCutsE[1]->Fill(clus->E());
1775 
1776  //-----------------------------------------------------------------
1777  // Reject clusters with bad channels, close to borders and exotic
1778  //
1779  Bool_t goodCluster = GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,
1780  GetCaloUtils()->GetEMCALGeometry(),
1781  GetEMCALCells(),fInputEvent->GetBunchCrossNumber());
1782 
1783  if(!goodCluster)
1784  {
1785  //if( (fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10 )
1786  AliDebug(2,Form("Bad cluster E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1787  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1788 
1789  return;
1790  }
1791 
1792  // Check effect of bad cluster removal
1793  fhEMCALClusterCutsE[2]->Fill(clus->E());
1794 
1795  //Float_t pos[3];
1796  //clus->GetPosition(pos);
1797  //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1798 
1799  //--------------------------------------
1800  // Correct non linearity or smear energy
1801  //
1803  {
1805 
1806  //if( (fDebug > 5 && fMomentum.E() > 0.1) || fDebug > 10 )
1807  AliDebug(5,Form("Correct Non Lin: Old E %3.2f, New E %3.2f",
1808  fMomentum.E(),clus->E()));
1809 
1810  // In case of MC analysis, to match resolution/calibration in real data
1811  // Not needed anymore, just leave for MC studies on systematics
1812  if( GetCaloUtils()->GetEMCALRecoUtils()->IsClusterEnergySmeared() )
1813  {
1814  Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus);
1815 
1816  //if( (fDebug > 5 && fMomentum.E() > 0.1) || fDebug > 10 )
1817  AliDebug(5,Form("Smear energy: Old E %3.2f, New E %3.2f",clus->E(),rdmEnergy));
1818 
1819  clus->SetE(rdmEnergy);
1820  }
1821  }
1822 
1823  clus->GetMomentum(fMomentum, fVertex[vindex]);
1824 
1825  // Check effect linearity correction, energy smearing
1826  fhEMCALClusterCutsE[3]->Fill(clus->E());
1827 
1828  // Check the event BC depending on EMCal clustr before final cuts
1829  Double_t tof = clus->GetTOF()*1e9;
1830 
1831  Int_t bc = TMath::Nint(tof/50) + 9;
1832  //printf("tof %2.2f, bc+5=%d\n",tof,bc);
1833 
1834  SetEMCalEventBC(bc);
1835 
1836  //--------------------------------------
1837  // Apply some kinematical/acceptance cuts
1838  //
1839  if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) return ;
1840 
1841  // Select cluster fiducial region
1842  //
1843  Bool_t bEMCAL = kFALSE;
1844  Bool_t bDCAL = kFALSE;
1845  if(fCheckFidCut)
1846  {
1847  if(fFillEMCAL && fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kEMCAL)) bEMCAL = kTRUE ;
1848  if(fFillDCAL && fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kDCAL )) bDCAL = kTRUE ;
1849  }
1850  else
1851  {
1852  bEMCAL = kTRUE;
1853  }
1854 
1855  //---------------------------------------------------------------------
1856  // Mask all cells in collumns facing ALICE thick material if requested
1857  //
1859  {
1860  Int_t absId = -1;
1861  Int_t iSupMod = -1;
1862  Int_t iphi = -1;
1863  Int_t ieta = -1;
1864  Bool_t shared = kFALSE;
1865  GetCaloUtils()->GetEMCALRecoUtils()->GetMaxEnergyCell(GetCaloUtils()->GetEMCALGeometry(), GetEMCALCells(),clus,absId,iSupMod,ieta,iphi,shared);
1866 
1867  AliDebug(2,Form("Masked collumn: cluster E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1868  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1869 
1870 
1871  if(GetCaloUtils()->MaskFrameCluster(iSupMod, ieta)) return;
1872  }
1873 
1874  // Check effect of energy and fiducial cuts
1875  fhEMCALClusterCutsE[4]->Fill(clus->E());
1876 
1877 
1878  //------------------------------------------
1879  // Apply time cut, count EMCal BC before cut
1880  //
1881  SetEMCalEventBCcut(bc);
1882 
1883  if(!IsInTimeWindow(tof,clus->E()))
1884  {
1885  fNPileUpClusters++ ;
1886  if(fUseEMCALTimeCut)
1887  {
1888  AliDebug(2,Form("Out of time window E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f, time %e",
1889  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta(),tof));
1890 
1891  return ;
1892  }
1893  }
1894  else
1896 
1897  // Check effect of time cut
1898  fhEMCALClusterCutsE[5]->Fill(clus->E());
1899 
1900 
1901  //----------------------------------------------------
1902  // Apply N cells cut
1903  //
1904  if(clus->GetNCells() <= fEMCALNCellsCut && fDataType != AliCaloTrackReader::kMC) return ;
1905 
1906  // Check effect of n cells cut
1907  fhEMCALClusterCutsE[6]->Fill(clus->E());
1908 
1909  //----------------------------------------------------
1910  // Apply distance to bad channel cut
1911  //
1912  Double_t distBad = clus->GetDistanceToBadChannel() ; //Distance to bad channel
1913 
1914  if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
1915 
1916  if(distBad < fEMCALBadChMinDist) return ;
1917 
1918  // Check effect distance to bad channel cut
1919  fhEMCALClusterCutsE[7]->Fill(clus->E());
1920 
1921  //----------------------------------------------------
1922  // Smear the SS to try to match data and simulations,
1923  // do it only for simulations.
1924  //
1925  if( fSmearShowerShape && clus->GetNCells() > 2)
1926  {
1927  AliDebug(2,Form("Smear shower shape - Original: %2.4f\n", clus->GetM02()));
1929  {
1930  clus->SetM02( clus->GetM02() + fRandom.Landau(0, fSmearShowerShapeWidth) );
1931  }
1933  {
1934  if(iclus%3 == 0 && clus->GetM02() > 0.1) clus->SetM02( clus->GetM02() + fRandom.Landau(0.05, fSmearShowerShapeWidth) ); //fSmearShowerShapeWidth = 0.035
1935  }
1936  //clus->SetM02( fRandom.Landau(clus->GetM02(), fSmearShowerShapeWidth) );
1937  AliDebug(2,Form("Width %2.4f Smeared : %2.4f\n", fSmearShowerShapeWidth,clus->GetM02()));
1938  }
1939 
1940  //--------------------------------------------------------
1941  // Fill the corresponding array with the selected clusters
1942  // Usually just filling EMCal array with upper or lower clusters is enough,
1943  // but maybe we want to do EMCal-DCal correlations.
1944 
1945  //if((fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10)
1946  AliDebug(2,Form("Selected clusters (EMCAL%d, DCAL%d), E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1947  bEMCAL,bDCAL,fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1948 
1949 
1950  if (bEMCAL) fEMCALClusters->Add(clus);
1951  else if(bDCAL ) fDCALClusters ->Add(clus);
1952 
1953  // TODO, not sure if needed anymore
1954  if (fMixedEvent)
1955  clus->SetID(iclus) ;
1956 }
1957 
1958 //_______________________________________
1965 //_______________________________________
1967 {
1968  AliDebug(1,"Begin");
1969 
1970  // First recalibrate cells, time or energy
1971  // if(GetCaloUtils()->IsRecalibrationOn())
1972  // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(),
1973  // GetEMCALCells(),
1974  // fInputEvent->GetBunchCrossNumber());
1975 
1976  fNPileUpClusters = 0; // Init counter
1977  fNNonPileUpClusters = 0; // Init counter
1978  for(Int_t i = 0; i < 19; i++)
1979  {
1980  fEMCalBCEvent [i] = 0;
1981  fEMCalBCEventCut[i] = 0;
1982  }
1983 
1984  //Loop to select clusters in fiducial cut and fill container with aodClusters
1985  if(fEMCALClustersListName=="")
1986  {
1987  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
1988  for (Int_t iclus = 0; iclus < nclusters; iclus++)
1989  {
1990  AliVCluster * clus = 0;
1991  if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1992  {
1993  if (clus->IsEMCAL())
1994  {
1995  FillInputEMCALAlgorithm(clus, iclus);
1996  }//EMCAL cluster
1997  }// cluster exists
1998  }// cluster loop
1999 
2000  //Recalculate track matching
2002 
2003  }//Get the clusters from the input event
2004  else
2005  {
2006  TClonesArray * clusterList = 0x0;
2007 
2008  if (fInputEvent->FindListObject(fEMCALClustersListName))
2009  {
2010  clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
2011  }
2012  else if(fOutputEvent)
2013  {
2014  clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
2015  }
2016 
2017  if(!clusterList)
2018  {
2019  AliWarning(Form("Wrong name of list with clusters? <%s>",fEMCALClustersListName.Data()));
2020  return;
2021  }
2022 
2023  Int_t nclusters = clusterList->GetEntriesFast();
2024  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2025  {
2026  AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus));
2027  //printf("E %f\n",clus->E());
2028  if (clus) FillInputEMCALAlgorithm(clus, iclus);
2029  else AliWarning("Null cluster in list!");
2030  }// cluster loop
2031 
2032  // Recalculate the pile-up time, in case long time clusters removed during clusterization
2033  //printf("Input event INIT : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
2034 
2035  fNPileUpClusters = 0; // Init counter
2036  fNNonPileUpClusters = 0; // Init counter
2037  for(Int_t i = 0; i < 19; i++)
2038  {
2039  fEMCalBCEvent [i] = 0;
2040  fEMCalBCEventCut[i] = 0;
2041  }
2042 
2043  for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++)
2044  {
2045  AliVCluster * clus = 0;
2046 
2047  if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
2048  {
2049  if (clus->IsEMCAL())
2050  {
2051 
2052  Float_t frac =-1;
2053  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
2054  Double_t tof = clus->GetTOF();
2055  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
2056  //additional L1 phase shift
2057  if(GetCaloUtils()->GetEMCALRecoUtils()->IsL1PhaseInTimeRecalibrationOn())
2058  {
2059  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absIdMax), fInputEvent->GetBunchCrossNumber(), tof);
2060  }
2061 
2062  tof*=1e9;
2063 
2064  //printf("Input event cluster : AbsIdMax %d, E %2.2f, time %2.2f \n", absIdMax,clus->E(),tof);
2065 
2066  //Reject clusters with bad channels, close to borders and exotic;
2067  if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) continue;
2068 
2069  Int_t bc = TMath::Nint(tof/50) + 9;
2070  SetEMCalEventBC(bc);
2071 
2072  if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) continue ;
2073 
2074  clus->GetMomentum(fMomentum, fVertex[0]);
2075 
2076  if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kEMCAL)) return ;
2077 
2078  SetEMCalEventBCcut(bc);
2079 
2080  if(!IsInTimeWindow(tof,clus->E()))
2081  fNPileUpClusters++ ;
2082  else
2084 
2085  }
2086  }
2087  }
2088 
2089  //printf("Input event : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
2090 
2091  // Recalculate track matching, not necessary if already done in the reclusterization task.
2092  // in case it was not done ...
2094 
2095  }
2096 
2097  AliDebug(1,Form("AOD entries %d, n pile-up clusters %d, n non pile-up %d", fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters));
2098 }
2099 
2100 //_______________________________________
2102 //_______________________________________
2104 {
2105  AliDebug(1,"Begin");
2106 
2107  // Loop to select clusters in fiducial cut and fill container with aodClusters
2108  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2109  TString genName;
2110  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2111  {
2112  AliVCluster * clus = fInputEvent->GetCaloCluster(iclus) ;
2113  if ( !clus ) continue ;
2114 
2115  if ( !clus->IsPHOS() ) continue ;
2116 
2117  if(clus->GetLabel() >=0 ) // -1 corresponds to noisy MC
2118  {
2119  if ( !AcceptParticleMCLabel(clus->GetLabel()) ) continue ;
2120  }
2121 
2122  fhPHOSClusterCutsE[0]->Fill(clus->E());
2123 
2124  // Skip CPV input
2125  if( clus->GetType() == AliVCluster::kPHOSCharged ) continue ;
2126 
2127  fhPHOSClusterCutsE[1]->Fill(clus->E());
2128 
2129  //---------------------------------------------
2130  // Old feature, try to rely on PHOS tender
2131  //
2133  {
2134  // Recalibrate the cluster energy
2136  {
2137  Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
2138  clus->SetE(energy);
2139  }
2140  }
2141 
2142  //----------------------------------------------------------------------------------
2143  // Check if the cluster contains any bad channel and if close to calorimeter borders
2144  //
2145  // Old feature, try to rely on PHOS tender
2146  if( GetCaloUtils()->ClusterContainsBadChannel(kPHOS,clus->GetCellsAbsId(), clus->GetNCells()))
2147  continue;
2148 
2149  if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells()))
2150  continue;
2151 
2152  // TODO, add exotic cut???
2153 
2154  fhPHOSClusterCutsE[2]->Fill(clus->E());
2155 
2156  // TODO Dead code? remove?
2157  Int_t vindex = 0 ;
2158  if (fMixedEvent)
2159  vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
2160 
2161  clus->GetMomentum(fMomentum, fVertex[vindex]);
2162 
2163  //----------------------------------------------------------------------------------
2164  // Remove clusters close to borders
2165  //
2167  continue ;
2168 
2169  fhPHOSClusterCutsE[3]->Fill(clus->E());
2170 
2171  //----------------------------------------------------------------------------------
2172  // Remove clusters with too low energy
2173  //
2174  if (fPHOSPtMin > fMomentum.E() || fPHOSPtMax < fMomentum.E() )
2175  continue ;
2176 
2177  fhPHOSClusterCutsE[4]->Fill(clus->E());
2178 
2179  //----------------------------------------------------
2180  // Apply N cells cut
2181  //
2182  if(clus->GetNCells() <= fPHOSNCellsCut && fDataType != AliCaloTrackReader::kMC) return ;
2183 
2184  // Check effect of n cells cut
2185  fhPHOSClusterCutsE[5]->Fill(clus->E());
2186 
2187  //----------------------------------------------------
2188  // Apply distance to bad channel cut
2189  //
2190  Double_t distBad = clus->GetDistanceToBadChannel() ; //Distance to bad channel
2191 
2192  if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
2193 
2194  if(distBad < fPHOSBadChMinDist) return ;
2195 
2196  // Check effect distance to bad channel cut
2197  fhPHOSClusterCutsE[6]->Fill(clus->E());
2198 
2199  // TODO, add time cut
2200 
2201  //----------------------------------------------------------------------------------
2202  // Add selected clusters to array
2203  //
2204  //if(fDebug > 2 && fMomentum.E() > 0.1)
2205  AliDebug(2,Form("Selected clusters E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
2206  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
2207 
2208  fPHOSClusters->Add(clus);
2209 
2210  // TODO Dead code? remove?
2211  if (fMixedEvent)
2212  clus->SetID(iclus) ;
2213 
2214  } // esd/aod cluster loop
2215 
2216  AliDebug(1,Form("AOD entries %d",fPHOSClusters->GetEntriesFast())) ;
2217 }
2218 
2219 //____________________________________________
2221 //____________________________________________
2223 {
2224  fEMCALCells = fInputEvent->GetEMCALCells();
2225 }
2226 
2227 //___________________________________________
2229 //___________________________________________
2231 {
2232  fPHOSCells = fInputEvent->GetPHOSCells();
2233 }
2234 
2235 //_______________________________________
2238 //_______________________________________
2240 {
2241  AliVVZERO* v0 = fInputEvent->GetVZEROData();
2242  //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
2243 
2244  if (v0)
2245  {
2246  AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0);
2247  for (Int_t i = 0; i < 32; i++)
2248  {
2249  if(esdV0)
2250  {//Only available in ESDs
2251  fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i);
2252  fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i);
2253  }
2254 
2255  fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i);
2256  fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i);
2257  }
2258 
2259  AliDebug(1,Form("ADC (%d,%d), Multiplicity (%d,%d)",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]));
2260  }
2261  else
2262  {
2263  AliDebug(1,"Cannot retrieve V0 ESD! Run w/ null V0 charges");
2264  }
2265 }
2266 
2267 //_________________________________________________
2271 //_________________________________________________
2273 {
2274  AliDebug(2,"Begin");
2275 
2276  //
2277  //check if branch name is given
2278  if(!fInputNonStandardJetBranchName.Length())
2279  {
2280  fInputEvent->Print();
2281  AliFatal("No non-standard jet branch name specified. Specify among existing ones.");
2282  }
2283 
2284  fNonStandardJets = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fInputNonStandardJetBranchName.Data()));
2285 
2286  if(!fNonStandardJets)
2287  {
2288  //check if jet branch exist; exit if not
2289  fInputEvent->Print();
2290 
2291  AliFatal(Form("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputNonStandardJetBranchName.Data()));
2292  }
2293  else
2294  {
2295  AliDebug(1,Form("AOD input jets %d", fNonStandardJets->GetEntriesFast()));
2296  }
2297 }
2298 
2299 //_________________________________________________
2303 //_________________________________________________
2305 {
2306  AliDebug(1,"Begin");
2307  //
2308  //check if branch name is given
2309  if(!fInputBackgroundJetBranchName.Length())
2310  {
2311  fInputEvent->Print();
2312 
2313  AliFatal("No background jet branch name specified. Specify among existing ones.");
2314  }
2315 
2316  fBackgroundJets = (AliAODJetEventBackground*)(fInputEvent->FindListObject(fInputBackgroundJetBranchName.Data()));
2317 
2318  if(!fBackgroundJets)
2319  {
2320  //check if jet branch exist; exit if not
2321  fInputEvent->Print();
2322 
2323  AliFatal(Form("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputBackgroundJetBranchName.Data()));
2324  }
2325  else
2326  {
2327  AliDebug(1,"FillInputBackgroundJets");
2328  fBackgroundJets->Print("");
2329  }
2330 }
2331 
2332 //____________________________________________________________________
2338 //____________________________________________________________________
2339 TArrayI AliCaloTrackReader::GetTriggerPatches(Int_t tmin, Int_t tmax )
2340 {
2341  // init some variables
2342  Int_t trigtimes[30], globCol, globRow,ntimes, i;
2343  Int_t absId = -1; //[100];
2344  Int_t nPatch = 0;
2345 
2346  TArrayI patches(0);
2347 
2348  // get object pointer
2349  AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
2350 
2351  if(!caloTrigger)
2352  {
2353  AliError("Trigger patches input (AliVCaloTrigger) not available in data!");
2354  return patches;
2355  }
2356 
2357  //printf("CaloTrigger Entries %d\n",caloTrigger->GetEntries() );
2358 
2359  // class is not empty
2360  if( caloTrigger->GetEntries() > 0 )
2361  {
2362  // must reset before usage, or the class will fail
2363  caloTrigger->Reset();
2364 
2365  // go throuth the trigger channels
2366  while( caloTrigger->Next() )
2367  {
2368  // get position in global 2x2 tower coordinates
2369  caloTrigger->GetPosition( globCol, globRow );
2370 
2371  //L0
2372  if(IsEventEMCALL0())
2373  {
2374  // get dimension of time arrays
2375  caloTrigger->GetNL0Times( ntimes );
2376 
2377  // no L0s in this channel
2378  // presence of the channel in the iterator still does not guarantee that L0 was produced!!
2379  if( ntimes < 1 )
2380  continue;
2381 
2382  // get timing array
2383  caloTrigger->GetL0Times( trigtimes );
2384  //printf("Get L0 patch : n times %d - trigger time window %d - %d\n",ntimes, tmin,tmax);
2385 
2386  // go through the array
2387  for( i = 0; i < ntimes; i++ )
2388  {
2389  // check if in cut - 8,9 shall be accepted in 2011
2390  if( trigtimes[i] >= tmin && trigtimes[i] <= tmax )
2391  {
2392  //printf("Accepted trigger time %d \n",trigtimes[i]);
2393  //if(nTrig > 99) continue;
2394  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absId);
2395  //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId);
2396  patches.Set(nPatch+1);
2397  patches.AddAt(absId,nPatch++);
2398  }
2399  } // trigger time array
2400  }//L0
2401  else if(IsEventEMCALL1()) // L1
2402  {
2403  Int_t bit = 0;
2404  caloTrigger->GetTriggerBits(bit);
2405 
2406  Int_t sum = 0;
2407  caloTrigger->GetL1TimeSum(sum);
2408  //fBitEGA-=2;
2409  Bool_t isEGA1 = ((bit >> fBitEGA ) & 0x1) && IsEventEMCALL1Gamma1() ;
2410  Bool_t isEGA2 = ((bit >> (fBitEGA+1)) & 0x1) && IsEventEMCALL1Gamma2() ;
2411  Bool_t isEJE1 = ((bit >> fBitEJE ) & 0x1) && IsEventEMCALL1Jet1 () ;
2412  Bool_t isEJE2 = ((bit >> (fBitEJE+1)) & 0x1) && IsEventEMCALL1Jet2 () ;
2413 
2414  //if((bit>> fBitEGA )&0x1) printf("Trig Bit %d - bit %d - EG1 %d - EG2 %d\n",fBitEGA ,bit,IsEventEMCALL1Gamma1(),IsEventEMCALL1Gamma2());
2415  //if((bit>>(fBitEGA+1))&0x1) printf("Trig Bit %d - bit %d - EG1 %d - EG2 %d\n",fBitEGA+1,bit,IsEventEMCALL1Gamma1(),IsEventEMCALL1Gamma2());
2416 
2417  if(!isEGA1 && !isEJE1 && !isEGA2 && !isEJE2) continue;
2418 
2419  Int_t patchsize = -1;
2420  if (isEGA1 || isEGA2) patchsize = 2;
2421  else if (isEJE1 || isEJE2) patchsize = 16;
2422 
2423  //printf("**** Get L1 Patch: Bit %x, sum %d, patchsize %d, EGA1 %d, EGA2 %d, EJE1 %d, EJE2 %d, EGA bit %d, EJE bit %d, Trigger Gamma %d, Trigger Jet %d\n",
2424  // bit,sum,patchsize,isEGA1,isEGA2,isEJE1,isEJE2,fBitEGA,fBitEJE,IsEventEMCALL1Gamma(),IsEventEMCALL1Jet());
2425 
2426 
2427  // add 2x2 (EGA) or 16x16 (EJE) patches
2428  for(Int_t irow=0; irow < patchsize; irow++)
2429  {
2430  for(Int_t icol=0; icol < patchsize; icol++)
2431  {
2432  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol+icol,globRow+irow, absId);
2433  //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId);
2434  patches.Set(nPatch+1);
2435  patches.AddAt(absId,nPatch++);
2436  }
2437  }
2438 
2439  } // L1
2440 
2441  } // trigger iterator
2442  } // go through triggers
2443 
2444  if(patches.GetSize()<=0) AliInfo(Form("No patch found! for triggers: %s and selected <%s>",
2446  //else printf(">>>>> N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nPatch, patches.At(0), patches.At(patches.GetSize()-1));
2447 
2448  return patches;
2449 }
2450 
2451 //____________________________________________________________
2455 //____________________________________________________________
2457 {
2458  // Init info from previous event
2459  fTriggerClusterIndex = -1;
2460  fTriggerClusterId = -1;
2461  fTriggerClusterBC = -10000;
2462  fIsExoticEvent = kFALSE;
2463  fIsBadCellEvent = kFALSE;
2464  fIsBadMaxCellEvent = kFALSE;
2465 
2466  fIsTriggerMatch = kFALSE;
2467  fIsTriggerMatchOpenCut[0] = kFALSE;
2468  fIsTriggerMatchOpenCut[1] = kFALSE;
2469  fIsTriggerMatchOpenCut[2] = kFALSE;
2470 
2471  // Do only analysis for triggered events
2472  if(!IsEventEMCALL1() && !IsEventEMCALL0())
2473  {
2474  fTriggerClusterBC = 0;
2475  return;
2476  }
2477 
2478  //printf("***** Try to match trigger to cluster %d **** L0 %d, L1 %d\n",fTriggerPatchClusterMatch,IsEventEMCALL0(),IsEventEMCALL1());
2479 
2480  //Recover the list of clusters
2481  TClonesArray * clusterList = 0;
2482  if (fInputEvent->FindListObject(fEMCALClustersListName))
2483  {
2484  clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
2485  }
2486  else if(fOutputEvent)
2487  {
2488  clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
2489  }
2490 
2491  // Get number of clusters and of trigger patches
2492  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2493  if(clusterList)
2494  nclusters = clusterList->GetEntriesFast();
2495 
2496  Int_t nPatch = patches.GetSize();
2497  Float_t exoDiffTime = GetCaloUtils()->GetEMCALRecoUtils()->GetExoticCellDiffTimeCut();
2498 
2499  //Init some variables used in the cluster loop
2500  Float_t tofPatchMax = 100000;
2501  Float_t ePatchMax =-1;
2502 
2503  Float_t tofMax = 100000;
2504  Float_t eMax =-1;
2505 
2506  Int_t clusMax =-1;
2507  Int_t idclusMax =-1;
2508  Bool_t badClMax = kFALSE;
2509  Bool_t badCeMax = kFALSE;
2510  Bool_t exoMax = kFALSE;
2511 // Int_t absIdMaxTrig= -1;
2512  Int_t absIdMaxMax = -1;
2513 
2514  Int_t nOfHighECl = 0 ;
2515 
2516  //
2517  // Check what is the trigger threshold
2518  // set minimu energym of candidate for trigger cluster
2519  //
2521 
2522  Float_t triggerThreshold = fTriggerL1EventThreshold;
2523  if(IsEventEMCALL0()) triggerThreshold = fTriggerL0EventThreshold;
2524  Float_t minE = triggerThreshold / 2.;
2525 
2526  // This method is not really suitable for JET trigger
2527  // but in case, reduce the energy cut since we do not trigger on high energy particle
2528  if(IsEventEMCALL1Jet() || minE < 1) minE = 1;
2529 
2530  AliDebug(1,Form("IsL1Trigger %d, IsL1JetTrigger? %d, IsL0Trigger %d, L1 threshold %2.1f, L0 threshold %2.1f, Min cluster E %2.2f",IsEventEMCALL1Jet(), IsEventEMCALL1(), IsEventEMCALL0(), fTriggerL1EventThreshold,fTriggerL0EventThreshold,minE));
2531 
2532  //
2533  // Loop on the clusters, check if there is any that falls into one of the patches
2534  //
2535  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2536  {
2537  AliVCluster * clus = 0;
2538  if(clusterList) clus = (AliVCluster*) clusterList->At(iclus);
2539  else clus = fInputEvent->GetCaloCluster(iclus);
2540 
2541  if ( !clus ) continue ;
2542 
2543  if ( !clus->IsEMCAL() ) continue ;
2544 
2545  //Skip clusters with too low energy to be triggering
2546  if ( clus->E() < minE ) continue ;
2547 
2548  Float_t frac = -1;
2549  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
2550 
2551  Bool_t badCluster = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
2552  clus->GetCellsAbsId(),clus->GetNCells());
2553  UShort_t cellMax[] = {(UShort_t) absIdMax};
2554  Bool_t badCell = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),cellMax,1);
2555 
2556  // if cell is bad, it can happen that time calibration is not available,
2557  // when calculating if it is exotic, this can make it to be exotic by default
2558  // open it temporarily for this cluster
2559  if(badCell)
2560  GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(10000000);
2561 
2562  Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
2563 
2564  // Set back the time cut on exotics
2565  if(badCell)
2566  GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(exoDiffTime);
2567 
2568  // Energy threshold for exotic Ecross typically at 4 GeV,
2569  // for lower energy, check that there are more than 1 cell in the cluster
2570  if(!exotic && clus->GetNCells() < 2) exotic = kTRUE;
2571 
2572  Float_t energy = clus->E();
2573  Int_t idclus = clus->GetID();
2574 
2575  Double_t tof = clus->GetTOF();
2576  if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn() && fTriggerClusterTimeRecal){
2577  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
2578  //additional L1 phase shift
2579  if(GetCaloUtils()->GetEMCALRecoUtils()->IsL1PhaseInTimeRecalibrationOn()){
2580  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absIdMax), fInputEvent->GetBunchCrossNumber(), tof);
2581  }
2582  }
2583  tof *=1.e9;
2584 
2585  //printf("cluster %d, ID %d, E %2.2f, tof %2.2f, AbsId max %d, exotic %d, bad Cluster %d, bad Cell %d\n",
2586  // iclus,idclus, energy,tof,absIdMax, exotic, badCluster,badCell);
2587 
2588  // Find the highest energy cluster, avobe trigger threshold
2589  // in the event in case no match to trigger is found
2590  if( energy > eMax )
2591  {
2592  tofMax = tof;
2593  eMax = energy;
2594  badClMax = badCluster;
2595  badCeMax = badCell;
2596  exoMax = exotic;
2597  clusMax = iclus;
2598  idclusMax = idclus;
2599  absIdMaxMax = absIdMax;
2600  }
2601 
2602  // count the good clusters in the event avobe the trigger threshold
2603  // to check the exotic events
2604  if(!badCluster && !exotic)
2605  nOfHighECl++;
2606 
2607  // Find match to trigger
2608  if(fTriggerPatchClusterMatch && nPatch>0)
2609  {
2610  for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
2611  {
2612  Int_t absIDCell[4];
2613  GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
2614  //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2615  // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2616 
2617  for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2618  {
2619  if(absIdMax == absIDCell[ipatch])
2620  {
2621  //printf("*** Patches : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), tof);
2622  if(energy > ePatchMax)
2623  {
2624  tofPatchMax = tof;
2625  ePatchMax = energy;
2626  fIsBadCellEvent = badCluster;
2627  fIsBadMaxCellEvent = badCell;
2628  fIsExoticEvent = exotic;
2629  fTriggerClusterIndex = iclus;
2630  fTriggerClusterId = idclus;
2631  fIsTriggerMatch = kTRUE;
2632 // absIdMaxTrig = absIdMax;
2633  }
2634  }
2635  }// cell patch loop
2636  }// trigger patch loop
2637  } // Do trigger patch matching
2638 
2639  }// Cluster loop
2640 
2641  // If there was no match, assign as trigger
2642  // the highest energy cluster in the event
2643  if(!fIsTriggerMatch)
2644  {
2645  tofPatchMax = tofMax;
2646  ePatchMax = eMax;
2647  fIsBadCellEvent = badClMax;
2648  fIsBadMaxCellEvent = badCeMax;
2649  fIsExoticEvent = exoMax;
2650  fTriggerClusterIndex = clusMax;
2651  fTriggerClusterId = idclusMax;
2652  }
2653 
2654  Double_t tofPatchMaxUS = TMath::Abs(tofPatchMax);
2655 
2656  if (tofPatchMaxUS < 28 ) fTriggerClusterBC = 0 ;
2657  else if(tofPatchMaxUS < 75 ) fTriggerClusterBC = 1 ;
2658  else if(tofPatchMaxUS < 125) fTriggerClusterBC = 2 ;
2659  else if(tofPatchMaxUS < 175) fTriggerClusterBC = 3 ;
2660  else if(tofPatchMaxUS < 225) fTriggerClusterBC = 4 ;
2661  else if(tofPatchMaxUS < 275) fTriggerClusterBC = 5 ;
2662  else
2663  {
2664  //printf("AliCaloTrackReader::MatchTriggerCluster() - Large BC - tof %2.3f - Index %d\n",tofPatchMaxUS,fTriggerClusterIndex);
2666  else
2667  {
2668  fTriggerClusterIndex = -2;
2669  fTriggerClusterId = -2;
2670  }
2671  }
2672 
2673  if(tofPatchMax < 0) fTriggerClusterBC*=-1;
2674 
2675 
2676  // printf("AliCaloTrackReader::MatchTriggerCluster(TArrayI patches) - Trigger cluster: index %d, ID %d, E = %2.2f, tof = %2.2f (BC = %d), bad cluster? %d, bad cell? %d, exotic? %d, patch match? %d, n High E cluster %d, absId Max %d\n",
2677  // fTriggerClusterIndex, fTriggerClusterId,ePatchMax, tofPatchMax,
2678  // fTriggerClusterBC, fIsBadCellEvent,fIsBadMaxCellEvent,fIsExoticEvent, fIsTriggerMatch, nOfHighECl,absIdMaxMax);
2679  //
2680  // if(!fIsTriggerMatch) printf("\t highest energy cluster: index %d, ID %d, E = %2.2f, tof = %2.2f, bad cluster? %d, bad cell? %d, exotic? %d\n",
2681  // clusMax, idclusMax, eMax,tofMax, badClMax, badCeMax,exoMax);
2682 
2683  //Redo matching but open cuts
2684  if(!fIsTriggerMatch && fTriggerClusterId >= 0)
2685  {
2686  // Open time patch time
2687  TArrayI patchOpen = GetTriggerPatches(7,10);
2688 
2689  Int_t patchAbsIdOpenTime = -1;
2690  for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2691  {
2692  Int_t absIDCell[4];
2693  patchAbsIdOpenTime = patchOpen.At(iabsId);
2694  GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patchAbsIdOpenTime, absIDCell);
2695  //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2696  // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2697 
2698  for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2699  {
2700  if(absIdMaxMax == absIDCell[ipatch])
2701  {
2702  fIsTriggerMatchOpenCut[0] = kTRUE;
2703  break;
2704  }
2705  }// cell patch loop
2706  }// trigger patch loop
2707 
2708  // Check neighbour patches
2709  Int_t patchAbsId = -1;
2710  Int_t globalCol = -1;
2711  Int_t globalRow = -1;
2712  GetCaloUtils()->GetEMCALGeometry()->GetFastORIndexFromCellIndex(absIdMaxMax, patchAbsId);
2713  GetCaloUtils()->GetEMCALGeometry()->GetPositionInEMCALFromAbsFastORIndex(patchAbsId,globalCol,globalRow);
2714 
2715  // Check patches with strict time cut
2716  Int_t patchAbsIdNeigh = -1;
2717  for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2718  {
2719  if(icol < 0 || icol > 47) continue;
2720 
2721  for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2722  {
2723  if(irow < 0 || irow > 63) continue;
2724 
2725  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeigh);
2726 
2727  if ( patchAbsIdNeigh < 0 ) continue;
2728 
2729  for(Int_t iabsId =0; iabsId < patches.GetSize(); iabsId++)
2730  {
2731  if(patchAbsIdNeigh == patches.At(iabsId))
2732  {
2733  fIsTriggerMatchOpenCut[1] = kTRUE;
2734  break;
2735  }
2736  }// trigger patch loop
2737 
2738  }// row
2739  }// col
2740 
2741  // Check patches with open time cut
2742  Int_t patchAbsIdNeighOpenTime = -1;
2743  for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2744  {
2745  if(icol < 0 || icol > 47) continue;
2746 
2747  for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2748  {
2749  if(irow < 0 || irow > 63) continue;
2750 
2751  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeighOpenTime);
2752 
2753  if ( patchAbsIdNeighOpenTime < 0 ) continue;
2754 
2755  for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2756  {
2757  if(patchAbsIdNeighOpenTime == patchOpen.At(iabsId))
2758  {
2759  fIsTriggerMatchOpenCut[2] = kTRUE;
2760  break;
2761  }
2762  }// trigger patch loop
2763 
2764  }// row
2765  }// col
2766 
2767  // printf("No match, new match: Open time %d-%d, open Neigh %d-%d, both open %d-%d\n",fIsTriggerMatchOpenCut[0],patchAbsIdOpenTime,
2768  // fIsTriggerMatchOpenCut[1],patchAbsIdNeigh,
2769  // fIsTriggerMatchOpenCut[2],patchAbsIdNeighOpenTime);
2770 
2771  patchOpen.Reset();
2772 
2773  }// No trigger match found
2774  //printf("Trigger BC %d, Id %d, Index %d\n",fTriggerClusterBC,fTriggerClusterId,fTriggerClusterIndex);
2775 }
2776 
2777 //_________________________________________________________
2781 //_________________________________________________________
2783 {
2785  {
2786  // get object pointer
2787  AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
2788 
2789  if ( fBitEGA == 6 )
2790  {
2791  if (IsEventEMCALL1Gamma1()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(1);
2792  else if(IsEventEMCALL1Gamma2()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(3);
2793  else if(IsEventEMCALL1Jet1 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(0);
2794  else if(IsEventEMCALL1Jet2 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(2);
2795 
2796  // printf("L1 trigger Threshold Jet1 %f, Gamma1 %f, Jet2 %f, Gamma2 %f\n",
2797  // 0.07874*caloTrigger->GetL1Threshold(0),
2798  // 0.07874*caloTrigger->GetL1Threshold(1),
2799  // 0.07874*caloTrigger->GetL1Threshold(2),
2800  // 0.07874*caloTrigger->GetL1Threshold(3));
2801  }
2802  else
2803  {
2804  // Old AOD data format, in such case, order of thresholds different!!!
2805  if (IsEventEMCALL1Gamma1()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(0);
2806  else if(IsEventEMCALL1Gamma2()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(2);
2807  else if(IsEventEMCALL1Jet1 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(1);
2808  else if(IsEventEMCALL1Jet2 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(3);
2809 
2810  // printf("L1 trigger Threshold Jet1 %f, Gamma1 %f, Jet2 %f, Gamma2 %f\n",
2811  // 0.07874*caloTrigger->GetL1Threshold(1),
2812  // 0.07874*caloTrigger->GetL1Threshold(0),
2813  // 0.07874*caloTrigger->GetL1Threshold(3),
2814  // 0.07874*caloTrigger->GetL1Threshold(2));
2815  }
2816  }
2817 
2818  // Set L0 threshold, if not set by user
2820  {
2821  // Revise for periods > LHC11d
2822  Int_t runNumber = fInputEvent->GetRunNumber();
2823  if (runNumber < 146861) fTriggerL0EventThreshold = 3. ;
2824  else if(runNumber < 154000) fTriggerL0EventThreshold = 4. ;
2825  else if(runNumber < 165000) fTriggerL0EventThreshold = 5.5;
2826  else fTriggerL0EventThreshold = 2 ;
2827  }
2828 }
2829 
2830 //________________________________________________________
2832 //________________________________________________________
2833 void AliCaloTrackReader::Print(const Option_t * opt) const
2834 {
2835  if(! opt)
2836  return;
2837 
2838  printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
2839  printf("Task name : %s\n", fTaskName.Data()) ;
2840  printf("Data type : %d\n", fDataType) ;
2841  printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ;
2842  printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ;
2843  printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ;
2844  printf("CTS Max pT : %2.1f GeV/c\n", fCTSPtMax) ;
2845  printf("EMCAL Max pT : %2.1f GeV/c\n", fEMCALPtMax) ;
2846  printf("PHOS Max pT : %2.1f GeV/c\n", fPHOSPtMax) ;
2847  printf("EMCAL Bad Dist > %2.1f \n" , fEMCALBadChMinDist) ;
2848  printf("PHOS Bad Dist > %2.1f \n" , fPHOSBadChMinDist) ;
2849  printf("EMCAL N cells > %d \n" , fEMCALNCellsCut) ;
2850  printf("PHOS N cells > %d \n" , fPHOSNCellsCut) ;
2851  printf("EMCAL Time Cut: %3.1f < TOF < %3.1f\n", fEMCALTimeCutMin, fEMCALTimeCutMax);
2852  printf("Use CTS = %d\n", fFillCTS) ;
2853  printf("Use EMCAL = %d\n", fFillEMCAL) ;
2854  printf("Use DCAL = %d\n", fFillDCAL) ;
2855  printf("Use PHOS = %d\n", fFillPHOS) ;
2856  printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
2857  printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
2858  printf("Track status = %d\n", (Int_t) fTrackStatus) ;
2859 
2860  printf("Track Mult Eta Cut = %2.2f\n", fTrackMultEtaCut) ;
2861  printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ;
2862  printf("Recalculate Clusters = %d, E linearity = %d\n", fRecalculateClusters, fCorrectELinearity) ;
2863 
2864  printf("Use Triggers selected in SE base class %d; If not what Trigger Mask? %d; MB Trigger Mask for mixed %d \n",
2866 
2868  printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor);
2869 
2871  printf("Compare cluster pt and pt hard to accept event, factor = %2.2f",fPtHardAndClusterPtFactor);
2872 
2873  printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ;
2874  printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ;
2875  printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ;
2876 
2877  printf(" \n") ;
2878 }
2879 
2880 //__________________________________________
2884 //__________________________________________
2886 {
2887  // Count number of cells with energy larger than 0.1 in SM3, cut on this number
2888  Int_t ncellsSM3 = 0;
2889  for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++)
2890  {
2891  Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell);
2892  Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
2893  if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++;
2894  }
2895 
2896  Int_t ncellcut = 21;
2897  if(GetFiredTriggerClasses().Contains("EMC")) ncellcut = 35;
2898 
2899  if(ncellsSM3 >= ncellcut)
2900  {
2901  AliDebug(1,Form("Reject event with ncells in SM3 %d, cut %d, trig %s",
2902  ncellsSM3,ncellcut,GetFiredTriggerClasses().Data()));
2903  return kTRUE;
2904  }
2905 
2906  return kFALSE;
2907 }
2908 
2909 //_________________________________________________________
2913 //_________________________________________________________
2915 {
2916  if(label < 0) return ;
2917 
2918  AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
2919  if(!evt) return ;
2920 
2921  TClonesArray * arr = dynamic_cast<TClonesArray*>(evt->FindListObject("mcparticles")) ;
2922  if(!arr) return ;
2923 
2924  if(label < arr->GetEntriesFast())
2925  {
2926  AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(label));
2927  if(!particle) return ;
2928 
2929  if(label == particle->Label()) return ; // label already OK
2930  //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d - AOD stack %d \n",label, particle->Label());
2931  }
2932  //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d > AOD labels %d \n",label, arr->GetEntriesFast());
2933 
2934  // loop on the particles list and check if there is one with the same label
2935  for(Int_t ind = 0; ind < arr->GetEntriesFast(); ind++ )
2936  {
2937  AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(ind));
2938  if(!particle) continue ;
2939 
2940  if(label == particle->Label())
2941  {
2942  label = ind;
2943  //printf("AliAnalysisTaskEMCALClusterize::RemapMCLabelForAODs() - New Label Index %d \n",label);
2944  return;
2945  }
2946  }
2947 
2948  label = -1;
2949 
2950  //printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label not found set to -1 \n");
2951 }
2952 
2953 //___________________________________
2955 //___________________________________
2957 {
2958  if(fCTSTracks) fCTSTracks -> Clear();
2959  if(fEMCALClusters) fEMCALClusters -> Clear("C");
2960  if(fPHOSClusters) fPHOSClusters -> Clear("C");
2961 
2962  fV0ADC[0] = 0; fV0ADC[1] = 0;
2963  fV0Mul[0] = 0; fV0Mul[1] = 0;
2964 
2965  if(fNonStandardJets) fNonStandardJets -> Clear("C");
2966  fBackgroundJets->Reset();
2967 }
2968 
2969 //___________________________________________
2973 //___________________________________________
2975 {
2976  fEventTrigMinBias = kFALSE;
2977  fEventTrigCentral = kFALSE;
2978  fEventTrigSemiCentral = kFALSE;
2979  fEventTrigEMCALL0 = kFALSE;
2980  fEventTrigEMCALL1Gamma1 = kFALSE;
2981  fEventTrigEMCALL1Gamma2 = kFALSE;
2982  fEventTrigEMCALL1Jet1 = kFALSE;
2983  fEventTrigEMCALL1Jet2 = kFALSE;
2984 
2985  AliDebug(1,Form("Select trigger mask bit %d - Trigger Event %s - Select <%s>",
2987 
2988  if(fEventTriggerMask <=0 )// in case no mask set
2989  {
2990  // EMC triggered event? Which type?
2991  if( GetFiredTriggerClasses().Contains("-B-") || GetFiredTriggerClasses().Contains("-S-") || GetFiredTriggerClasses().Contains("-I-") )
2992  {
2993  if ( GetFiredTriggerClasses().Contains("EGA" ) ||
2994  GetFiredTriggerClasses().Contains("EG1" ) )
2995  {
2996  fEventTrigEMCALL1Gamma1 = kTRUE;
2997  if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
2998  }
2999  else if( GetFiredTriggerClasses().Contains("EG2" ) )
3000  {
3001  fEventTrigEMCALL1Gamma2 = kTRUE;
3002  if( !fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
3003  }
3004  else if( GetFiredTriggerClasses().Contains("EJE" ) ||
3005  GetFiredTriggerClasses().Contains("EJ1" ) )
3006  {
3007  fEventTrigEMCALL1Jet1 = kTRUE;
3008  if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") )
3009  fEventTrigEMCALL1Jet1 = kFALSE;
3010  }
3011  else if( GetFiredTriggerClasses().Contains("EJ2" ) )
3012  {
3013  fEventTrigEMCALL1Jet2 = kTRUE;
3014  if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
3015  }
3016  else if( GetFiredTriggerClasses().Contains("CEMC") &&
3017  !GetFiredTriggerClasses().Contains("EGA" ) &&
3018  !GetFiredTriggerClasses().Contains("EJE" ) &&
3019  !GetFiredTriggerClasses().Contains("EG1" ) &&
3020  !GetFiredTriggerClasses().Contains("EJ1" ) &&
3021  !GetFiredTriggerClasses().Contains("EG2" ) &&
3022  !GetFiredTriggerClasses().Contains("EJ2" ) )
3023  {
3024  fEventTrigEMCALL0 = kTRUE;
3025  }
3026 
3027  //Min bias event trigger?
3028  if (GetFiredTriggerClasses().Contains("CCENT_R2-B-NOPF-ALLNOTRD"))
3029  {
3030  fEventTrigCentral = kTRUE;
3031  }
3032  else if(GetFiredTriggerClasses().Contains("CSEMI_R1-B-NOPF-ALLNOTRD"))
3033  {
3034  fEventTrigSemiCentral = kTRUE;
3035  }
3036  else if((GetFiredTriggerClasses().Contains("CINT") || GetFiredTriggerClasses().Contains("CPBI2_B1") ) &&
3037  GetFiredTriggerClasses().Contains("-NOPF-ALLNOTRD") )
3038  {
3039  fEventTrigMinBias = kTRUE;
3040  }
3041  }
3042  }
3043  else
3044  {
3045  // EMC L1 Gamma
3046  if ( fEventTriggerMask & AliVEvent::kEMCEGA )
3047  {
3048  //printf("EGA trigger bit\n");
3049  if (GetFiredTriggerClasses().Contains("EG"))
3050  {
3051  if (GetFiredTriggerClasses().Contains("EGA")) fEventTrigEMCALL1Gamma1 = kTRUE;
3052  else
3053  {
3054  if(GetFiredTriggerClasses().Contains("EG1")) fEventTrigEMCALL1Gamma1 = kTRUE;
3055  if(GetFiredTriggerClasses().Contains("EG2")) fEventTrigEMCALL1Gamma2 = kTRUE;
3056  }
3057  }
3058  }
3059  // EMC L1 Jet
3060  else if( fEventTriggerMask & AliVEvent::kEMCEJE )
3061  {
3062  //printf("EGA trigger bit\n");
3063  if (GetFiredTriggerClasses().Contains("EJ"))
3064  {
3065  if (GetFiredTriggerClasses().Contains("EJE")) fEventTrigEMCALL1Jet1 = kTRUE;
3066  else
3067  {
3068  if(GetFiredTriggerClasses().Contains("EJ1")) fEventTrigEMCALL1Jet1 = kTRUE;
3069  if(GetFiredTriggerClasses().Contains("EJ2")) fEventTrigEMCALL1Jet2 = kTRUE;
3070  }
3071  }
3072  }
3073  // EMC L0
3074  else if((fEventTriggerMask & AliVEvent::kEMC7) ||
3075  (fEventTriggerMask & AliVEvent::kEMC1) )
3076  {
3077  //printf("L0 trigger bit\n");
3078  fEventTrigEMCALL0 = kTRUE;
3079  }
3080  // Min Bias Pb-Pb
3081  else if( fEventTriggerMask & AliVEvent::kCentral )
3082  {
3083  //printf("MB semi central trigger bit\n");
3084  fEventTrigSemiCentral = kTRUE;
3085  }
3086  // Min Bias Pb-Pb
3087  else if( fEventTriggerMask & AliVEvent::kSemiCentral )
3088  {
3089  //printf("MB central trigger bit\n");
3090  fEventTrigCentral = kTRUE;
3091  }
3092  // Min Bias pp, PbPb, pPb
3093  else if((fEventTriggerMask & AliVEvent::kMB ) ||
3094  (fEventTriggerMask & AliVEvent::kINT7) ||
3095  (fEventTriggerMask & AliVEvent::kINT8) ||
3096  (fEventTriggerMask & AliVEvent::kAnyINT) )
3097  {
3098  //printf("MB trigger bit\n");
3099  fEventTrigMinBias = kTRUE;
3100  }
3101  }
3102 
3103  AliDebug(1,Form("Event bits: \n \t MB %d, Cen %d, Sem %d, L0 %d, L1G1 %d, L1G2 %d, L1J1 %d, L1J2 %d",
3107 
3108  // L1 trigger bit
3109  if( fBitEGA == 0 && fBitEJE == 0 )
3110  {
3111  // Init the trigger bit once, correct depending on AliESD(AOD)CaloTrigger header version
3112 
3113  // Simpler way to do it ...
3114 // if( fInputEvent->GetRunNumber() < 172000 )
3115 // reader->SetEventTriggerL1Bit(4,5); // current LHC11 data
3116 // else
3117 // reader->SetEventTriggerL1Bit(6,8); // LHC12-13 data
3118 
3119  // Old values
3120  fBitEGA = 4;
3121  fBitEJE = 5;
3122 
3123  TFile* file = AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile();
3124 
3125  const TList *clist = file->GetStreamerInfoCache();
3126 
3127  if(clist)
3128  {
3129  TStreamerInfo *cinfo = (TStreamerInfo*)clist->FindObject("AliESDCaloTrigger");
3130  Int_t verid = 5; // newer ESD header version
3131  if(!cinfo)
3132  {
3133  cinfo = (TStreamerInfo*)clist->FindObject("AliAODCaloTrigger");
3134  verid = 3; // newer AOD header version
3135  }
3136 
3137  if(cinfo)
3138  {
3139  Int_t classversionid = cinfo->GetClassVersion();
3140  //printf("********* Header class version %d *********** \n",classversionid);
3141 
3142  if (classversionid >= verid)
3143  {
3144  fBitEGA = 6;
3145  fBitEJE = 8;
3146  }
3147  } else AliInfo("AliCaloTrackReader()::SetEventTriggerBit() - Streamer info for trigger class not available, bit not changed");
3148  } else AliInfo("AliCaloTrackReader::SetEventTriggerBit() - Streamer list not available!, bit not changed");
3149 
3150  } // set once the EJE, EGA trigger bit
3151 }
3152 
3153 //____________________________________________________________
3156 //____________________________________________________________
3157 void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)
3158 {
3159  fInputEvent = input;
3160  fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ;
3161  if (fMixedEvent)
3162  fNMixedEvent = fMixedEvent->GetNumberOfEvents() ;
3163 
3164  //Delete previous vertex
3165  if(fVertex)
3166  {
3167  for (Int_t i = 0; i < fNMixedEvent; i++)
3168  {
3169  delete [] fVertex[i] ;
3170  }
3171  delete [] fVertex ;
3172  }
3173 
3174  fVertex = new Double_t*[fNMixedEvent] ;
3175  for (Int_t i = 0; i < fNMixedEvent; i++)
3176  {
3177  fVertex[i] = new Double_t[3] ;
3178  fVertex[i][0] = 0.0 ;
3179  fVertex[i][1] = 0.0 ;
3180  fVertex[i][2] = 0.0 ;
3181  }
3182 }
3183 
3184 
Bool_t IsPileUpFromSPD() const
Double_t fEventWeight
Weight assigned to the event when filling histograms.
Bool_t fUseTrackDCACut
Do DCA selection.
TArrayI GetTriggerPatches(Int_t tmin, Int_t tmax)
virtual void FillInputVZERO()
Int_t fV0ADC[2]
Integrated V0 signal.
Bool_t fComparePtHardAndClusterPt
In MonteCarlo, jet events, reject events with too large cluster energy.
AliAnaWeights * fWeightUtils
Pointer to AliAnaWeights.
AliCalorimeterUtils * GetCaloUtils() const
Float_t fTimeStampEventFracMin
Minimum value of time stamp fraction event.
Bool_t fReadAODMCParticles
Access kine information from filtered AOD MC particles.
virtual void FillInputNonStandardJets()
Double_t fEMCALTimeCutMax
Remove clusters/cells with time larger than this value, in ns.
Int_t fBitEJE
Trigger bit on VCaloTrigger for EJE.
TLorentzVector fMomentum
! Temporal TLorentzVector container, avoid declaration of TLorentzVectors per event.
Double_t fTimeStampRunMin
Minimum value of time stamp in run.
Bool_t fDoPileUpEventRejection
Select pile-up events by SPD.
void SetCentrality(Float_t cen)
Definition: AliAnaWeights.h:51
TObjArray * fPHOSClusters
Temporal array with PHOS CaloClusters.
Double_t fTrackDCACut[3]
Remove tracks with DCA larger than cut, parameters of function stored here.
Bool_t fUseEventsWithPrimaryVertex
Select events with primary vertex.
virtual AliVCaloCells * GetPHOSCells() const
Bool_t fIsBadCellEvent
Bad cell triggered event flag, any cell in cluster is bad.
Bool_t IsCorrectionOfClusterEnergyOn() const
Bool_t fEventTrigEMCALL1Gamma1
Event is L1-Gamma, threshold 1 on its name, it should correspond kEMCEGA.
virtual AliHeader * GetHeader() const
Bool_t IsEventEMCALL1Jet1() const
Bool_t IsEventEMCALL1Gamma1() const
AliEMCALRecoUtils * GetEMCALRecoUtils() const
Bool_t ReadAODMCParticles() const
TString fEventPlaneMethod
Name of event plane method, by default "Q".
Int_t fTrackBCEventCut[19]
Fill one entry per event if there is a track in a given BC, depend on track pT, acceptance cut...
Bool_t fDoVertexBCEventSelection
Select events with vertex on BC=0 or -100.
AliMixedEvent * fMixedEvent
! Mixed event object. This class is not the owner.
virtual AliVEvent * GetInputEvent() const
Bool_t IsPileUpFromSPDAndNotEMCal() const
Check if event is from pile-up determined by SPD and not by EMCal.
Bool_t IsEventEMCALL1() const
Float_t fPtHardAndClusterPtFactor
Factor between ptHard and cluster pT to reject/accept event.
Bool_t fAcceptFastCluster
Accept events from fast cluster, exclude these events for LHC11a.
Bool_t fSmearShowerShape
Smear shower shape (use in MC).
AliVEvent * fInputEvent
! pointer to esd or aod input.
Calculate the weight to the event to be applied when filling histograms.
Definition: AliAnaWeights.h:32
virtual void SetInputEvent(AliVEvent *input)
Double_t fTrackTimeCutMax
Remove tracks with time larger than this value, in ns.
Int_t fTriggerClusterBC
Event triggered by a cluster in BC -5 0 to 5.
virtual AliMultSelection * GetMultSelCen() const
TString fEMCALClustersListName
Alternative list of clusters produced elsewhere and not from InputEvent.
void RecalculateClusterTrackMatching(AliVEvent *event, TObjArray *clusterArray=0x0)
Float_t fPHOSBadChMinDist
Minimal distance to bad channel to accept cluster in PHOS, cm.
Bool_t fWriteOutputDeltaAOD
Write the created delta AOD objects into file.
Int_t fV0Mul[2]
Integrated V0 Multiplicity.
void RecalculateClusterDistanceToBadChannel(AliVCaloCells *cells, AliVCluster *clu)
Float_t fEMCALPtMin
pT Threshold on emcal clusters.
Bool_t fTriggerClusterTimeRecal
In case cluster already calibrated, do not try to recalibrate even if recalib on in AliEMCALRecoUtils...
Double_t ** fVertex
! Vertex array 3 dim for each mixed event buffer.
TH1F * fhCTSTrackCutsPt[6]
! Control histogram on the different CTS tracks selection cuts, pT
Int_t GetDebug() const
Definition: AliAnaWeights.h:91
UInt_t fEventTriggerMask
Select this triggerered event.
virtual Int_t GetEventCentrality() const
virtual AliCentrality * GetCentrality() const
AliVCaloCells * fPHOSCells
! Temporal array with PHOS AliVCaloCells.
TList * fOutputContainer
! Output container with cut control histograms.
Bool_t IsEventEMCALL1Gamma2() const
virtual AliMixedEvent * GetMixedEvent() const
Int_t fEnergyHistogramNbins
Binning of the control histograms, min and max window.
Bool_t fFillInputBackgroundJetBranch
Flag to use data from background jets.
void SetTrackEventBC(Int_t bc)
virtual Bool_t ComparePtHardAndClusterPt()
TList * fAODBranchList
List with AOD branches created and needed in analysis.
void RemapMCLabelForAODs(Int_t &label)
Bool_t fEventTrigSemiCentral
Event is AliVEvent::kSemiCentral on its name, it should correspond to PbPb.
TRandom3 fRandom
! Random generator.
Bool_t AcceptDCA(Float_t pt, Float_t dca)
Bool_t IsPileUpFromNotSPDAndNotEMCal() const
Check if event not from pile-up determined neither by SPD nor by EMCal.
Bool_t fFillCTS
Use data from CTS.
virtual void InitParameters()
Initialize the parameters with default.
Bool_t AcceptParticleMCLabel(Int_t mcLabel)
virtual void GetVertex(Double_t v[3]) const
Bool_t IsRecalibrationOn() const
virtual Bool_t FillInputEvent(Int_t iEntry, const char *currentFileName)
Float_t fPHOSPtMin
pT Threshold on phos clusters.
Bool_t fSelectEmbeddedClusters
Use only simulated clusters that come from embedding.
Bool_t fEventTrigMinBias
Event is min bias on its name, it should correspond to AliVEvent::kMB, AliVEvent::kAnyInt.
Float_t fEMCALParamTimeCutMin[4]
Remove clusters/cells with time smaller than parametrized value, in ns.
Int_t fEventNumber
Event number.
void RecalculateClusterPID(AliVCluster *clu)
TString fTaskName
Name of task that executes the analysis.
Bool_t fRemoveBadTriggerEvents
Remove triggered events because trigger was exotic, bad, or out of BC.
Bool_t IsPileUpFromSPDOrEMCal() const
Check if event is from pile-up determined by SPD or EMCal.
Bool_t IsPileUpFromEMCalAndNotSPD() const
Check if event is from pile-up determined by EMCal, not by SPD.
Bool_t fEventTrigEMCALL1Gamma2
Event is L1-Gamma, threshold 2 on its name, it should correspond kEMCEGA.
Bool_t fEventTrigEMCALL1Jet1
Event is L1-Gamma, threshold 1 on its name, it should correspond kEMCEGA.
Bool_t fFillEMCALCells
Use data from EMCAL.
Float_t fEnergyHistogramLimit[2]
Binning of the control histograms, number of bins.
Int_t fTriggerClusterId
Id of trigger cluster (cluster->GetID()).
Int_t fPHOSNCellsCut
Accept for the analysis PHOS clusters with more than fNCellsCut cells.
Float_t fCTSPtMax
pT Threshold on charged particles.
Double_t fEMCALParamTimeCutMax[4]
Remove clusters/cells with time larger than parametrized value, in ns.
virtual void FillInputEMCALCells()
Connects the array with EMCAL cells and the pointer.
Bool_t fFillPHOSCells
Use data from PHOS.
virtual AliVCaloCells * GetEMCALCells() const
Bool_t fRemoveLEDEvents
Remove events where LED was wrongly firing - EMCAL LHC11a.
virtual AliGenEventHeader * GetGenEventHeader(TString name="") const
AliEMCALGeometry * GetEMCALGeometry() const
Bool_t fIsBadMaxCellEvent
Bad cell triggered event flag, only max energy cell is bad.
void RecalculateClusterShowerShapeParameters(AliVCaloCells *cells, AliVCluster *clu)
Bool_t fSelectSPDHitTracks
Ensure that track hits SPD layers.
TString fFiredTriggerClassName
Name of trigger event type used to do the analysis.
virtual TClonesArray * GetAODMCParticles() const
TString GetFiredTriggerClasses() const
Bool_t ReadStack() const
TObjArray * fEMCALClusters
Temporal array with EMCAL CaloClusters.
Bool_t IsEventEMCALL1Jet() const
Float_t fPHOSPtMax
pT Threshold on phos clusters.
Bool_t fAccessTrackTOF
Access the track TOF, in case of problems when accessing GetTOFBunchCrossing.
virtual Bool_t CheckForPrimaryVertex() const
Int_t fEMCalBCEvent[19]
Fill one entry per event if there is a cluster in a given BC.
TString fInputBackgroundJetBranchName
Name of background jet branch.
virtual AliEventplane * GetEventPlane() const
Bool_t fEventTriggerAtSE
Select triggered event at SE base task or here.
Int_t fNMCGenerToAccept
Number of MC generators that should not be included in analysis.
Float_t fEMCALPtMax
pT Threshold on emcal clusters.
Int_t fEventType
Set the event species: 7 physics, 0 MC, 8 LED (not useful now)
virtual Bool_t ComparePtHardAndJetPt()
Bool_t IsInFiducialCut(Float_t eta, Float_t phi, Int_t det) const
Bool_t fEventTrigCentral
Event is AliVEvent::kCentral on its name, it should correspond to PbPb.
virtual TObjString * GetListOfParameters()
Save parameters used for analysis in a string.
Float_t fTrackMultEtaCut
Track multiplicity eta cut.
TString fMCGenerToAccept[5]
List with name of generators that should not be included.
Int_t fCentralityBin[2]
Minimum and maximum value of the centrality for the analysis.
virtual void FillInputPHOSCells()
Connects the array with PHOS cells and the pointer.
Base class for event, clusters and tracks filtering and preparation for the analysis.
TObjArray * fDCALClusters
Temporal array with DCAL CaloClusters, not needed in the normal case, use just EMCal array with DCal ...
Bool_t fUseTrackTimeCut
Do time cut selection.
virtual TString GetEventPlaneMethod() const
virtual Int_t GetTrackID(AliVTrack *track)
TArrayI fAcceptEventsWithBit
Accept events if trigger bit is on.
TH1F * fhEMCALClusterCutsE[8]
! Control histogram on the different EMCal cluster selection cuts, E
virtual void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
void MatchTriggerCluster(TArrayI patches)
Bool_t fTimeStampEventSelect
Select events within a fraction of data taking time.
Double_t fTimeStampRunMax
Maximum value of time stamp in run.
Double_t fEMCALTimeCutMin
Remove clusters/cells with time smaller than this value, in ns.
Bool_t fEventTrigEMCALL1Jet2
Event is L1-Gamma, threshold 2 on its name, it should correspond kEMCEGA.
void SetEMCalEventBCcut(Int_t bc)
Int_t fNPileUpClustersCut
Cut to select event as pile-up.
Bool_t fCheckFidCut
Do analysis for clusters in defined region.
virtual ~AliCaloTrackReader()
Destructor.
Bool_t fEventTrigEMCALL0
Event is EMCal L0 on its name, it should correspond to AliVEvent::kEMC7, AliVEvent::kEMC1.
Bool_t IsWeightSettingOn() const
Definition: AliAnaWeights.h:89
Int_t fTrackBCEvent[19]
Fill one entry per event if there is a track in a given BC.
virtual void FillInputEMCALAlgorithm(AliVCluster *clus, Int_t iclus)
Bool_t fComparePtHardAndJetPt
In MonteCarlo, jet events, reject fake events with wrong jet energy.
Int_t fNNonPileUpClusters
Number of clusters with time below 20 ns.
Int_t fNMixedEvent
Number of events in mixed event buffer.
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Int_t fCentralityOpt
Option for the returned value of the centrality, possible options 5, 10, 100.
Float_t fZvtxCut
Cut on vertex position.
energy
void RecalculateClusterPosition(AliVCaloCells *cells, AliVCluster *clu)
AliCaloTrackReader()
Constructor. Initialize parameters.
Bool_t fTriggerPatchClusterMatch
Search for the trigger patch and check if associated cluster was the trigger.
Bool_t fUseParamTimeCut
Use simple or parametrized time cut.
Int_t GetNMaskCellColumns() const
AliFiducialCut * fFiducialCut
Acceptance cuts.
Bool_t fRejectEMCalTriggerEventsWith2Tresholds
Reject events EG2 also triggered by EG1 or EJ2 also triggered by EJ1.
TH1F * fhPHOSClusterCutsE[7]
! Control histogram on the different PHOS cluster selection cuts, E
virtual void FillInputEMCAL()
Bool_t fFillEMCAL
Use data from EMCAL.
Bool_t fFillPHOS
Use data from PHOS.
AliVCaloCells * fEMCALCells
! Temporal array with EMCAL AliVCaloCells.
virtual AliAODMCHeader * GetAODMCHeader() const
Int_t fEMCALNCellsCut
Accept for the analysis EMCAL clusters with more than fNCellsCut cells.
void CorrectClusterEnergy(AliVCluster *cl)
Correct cluster energy non linearity.
Float_t fCTSPtMin
pT Threshold on charged particles.
virtual AliStack * GetStack() const
Float_t fTriggerL0EventThreshold
L0 Threshold to look for triggered events, set outside.
Float_t fTimeStampEventFracMax
Maximum value of time stamp fraction event.
virtual void ResetLists()
Reset lists, called in AliAnaCaloTrackCorrMaker.
Int_t fNPileUpClusters
Number of clusters with time avobe 20 ns.
Int_t fTrackMult
Track multiplicity.
AliAODEvent * fOutputEvent
! pointer to aod output.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Bool_t fRecalculateClusters
Correct clusters, recalculate them if recalibration parameters is given.
Bool_t fDoRejectNoTrackEvents
Reject events with no selected tracks in event.
Bool_t IsEventEMCALL1Jet2() const
Float_t fEMCALBadChMinDist
Minimal distance to bad channel to accept cluster in EMCal, cell units.
Bool_t fReadStack
Access kine information from stack.
Bool_t fIsTriggerMatchOpenCut[3]
Could not match the event to a trigger patch?, retry opening cuts.
UInt_t fMixEventTriggerMask
Select this triggerered event for mixing, tipically kMB or kAnyINT.
Float_t RadToDeg(Float_t rad) const
TFile * file
virtual void FillVertexArray()
Bool_t IsInTimeWindow(Double_t tof, Float_t energy) const
Bool_t fRemoveUnMatchedTriggers
Analyze events where trigger patch and cluster where found or not.
virtual Double_t GetEventPlaneAngle() const
void SetPythiaEventHeader(AliGenPythiaEventHeader *py)
Definition: AliAnaWeights.h:79
TObjArray * fCTSTracks
Temporal array with tracks.
Int_t fTriggerPatchTimeWindow[2]
Trigger patch selection window.
AliMCEvent * fMC
! Monte Carlo Event Handler.
TH1I * fhNEventsAfterCut
! Each bin represents number of events resulting after a given selection cut: vertex, trigger, ...
Float_t fPtHardAndJetPtFactor
Factor between ptHard and jet pT to reject/accept event.
TString fDeltaAODFileName
Delta AOD file name.
Int_t GetVertexBC() const
Bool_t IsPileUpFromEMCal() const
Check if event is from pile-up determined by EMCal.
virtual Double_t GetWeight()
Bool_t fFillInputNonStandardJetBranch
Flag to use data from non standard jets.
TClonesArray * fNonStandardJets
! Temporal array with jets.
Int_t fEMCalBCEventCut[19]
Fill one entry per event if there is a cluster in a given BC, depend on cluster E, acceptance cut.
Int_t fTriggerClusterIndex
Index in clusters array of trigger cluster.
Bool_t fTriggerL1EventThresholdFix
L1 Threshold is fix and set outside.
Float_t fSmearShowerShapeWidth
Smear shower shape landau function "width" (use in MC).
Int_t fBitEGA
Trigger bit on VCaloTrigger for EGA.
virtual void FillInputBackgroundJets()
Bool_t fDoV0ANDEventSelection
Select events depending on V0AND.
AliAODJetEventBackground * fBackgroundJets
! Background jets.
Bool_t fCorrectELinearity
Correct cluster linearity, always on.
virtual TList * GetCreateControlHistograms()
Int_t fVertexBC
Vertex BC.
Bool_t fIsExoticEvent
Exotic trigger event flag.
TString fInputNonStandardJetBranchName
Name of non standard jet branch.
TArrayI fRejectEventsWithBit
Reject events if trigger bit is on.
Bool_t fUseEMCALTimeCut
Do time cut selection.
Float_t GetPhi(Float_t phi) const
Shift phi angle in case of negative value 360 degrees. Example TLorenzVector::Phi defined in -pi to p...
Int_t fDataType
Select MC: Kinematics, Data: ESD/AOD, MCData: Both.
virtual Bool_t SelectTrack(AliVTrack *, Double_t *)
Int_t GetMaxEnergyCell(AliVCaloCells *cells, AliVCluster *clu, Float_t &fraction) const
For a given CaloCluster, it gets the absId of the cell with maximum energy deposit.
Bool_t fFillDCAL
Use data from DCAL, not needed in the normal case, use just EMCal array with DCal limits...
void SetTrackEventBCcut(Int_t bc)
Bool_t fIsTriggerMatch
Could match the event to a trigger patch?
Float_t fTriggerL1EventThreshold
L1 Threshold to look for triggered events, set in data.
TString fCentralityClass
Name of selected centrality class.
ULong_t fTrackStatus
Track selection bit, select tracks refitted in TPC, ITS ...
Bool_t IsPileUpFromSPDAndEMCal() const
Check if event is from pile-up determined by SPD and EMCal.
virtual void FillInputPHOS()
Fill the array with PHOS filtered clusters.
virtual TObjArray * GetCTSTracks() const
Bool_t fUseAliCentrality
Select as centrality estimator AliCentrality (Run1) or AliMultSelection (Run1 and Run2) ...
Int_t fSmearingFunction
Choice of smearing function. 0 no smearing. 1 smearing from Gustavo (Landau center at 0)...
Bool_t fRecalculateVertexBC
Recalculate vertex BC from tracks pointing to vertex.
Float_t RecalibrateClusterEnergy(AliVCluster *cluster, AliVCaloCells *cells)
Recalibrate the cluster energy, considering the recalibration map and the energy of the cells that co...
void SetEMCalEventBC(Int_t bc)
Bool_t reject
Bool_t CheckCellFiducialRegion(AliVCluster *cluster, AliVCaloCells *cells) const
Bool_t IsEventEMCALL0() const