AliPhysics  c923f52 (c923f52)
 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), fSmearNLMMin(0), fSmearNLMMax(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 //____________________________________________________________
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 
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  {
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, %d<=NLM<=%d; ",
723  parList+=onePar ;
724  }
725 
727  {
728  snprintf(onePar,buffersize,"jet pt / pt hard < %2.1f; ",fPtHardAndJetPtFactor);
729  parList+=onePar ;
730  }
731 
733  {
734  snprintf(onePar,buffersize,"cluster pt / pt hard < %2.2f",fPtHardAndClusterPtFactor);
735  parList+=onePar ;
736  }
737 
738  snprintf(onePar,buffersize,"Centrality: Class %s, Option %d, Bin [%d,%d]; New centrality %d; Event plane method %s; ",
740  parList+=onePar ;
741 
742  return new TObjString(parList) ;
743 }
744 
745 
746 //____________________________________________
748 //____________________________________________
750 {
751  if(fMC)
752  return fMC->Stack();
753  else
754  {
755  AliDebug(1,"Stack is not available");
756  return 0x0 ;
757  }
758 }
759 
760 //______________________________________________
762 //______________________________________________
764 {
765  if(fMC)
766  {
767  return fMC->Header();
768  }
769  else
770  {
771  AliInfo("Header is not available");
772  return 0x0 ;
773  }
774 }
775 
776 //______________________________________________________________
778 //______________________________________________________________
779 AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader(TString headerName) const
780 {
781  if (ReadStack() && fMC)
782  {
783  AliGenEventHeader * eventHeader = fMC->GenEventHeader();
784 
785  if(headerName=="") return eventHeader ;
786 
787  AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader);
788 
789  if(!cocktail) return 0x0 ;
790 
791  TList *genHeaders = cocktail->GetHeaders();
792 
793  Int_t nGenerators = genHeaders->GetEntries();
794 
795  for(Int_t igen = 0; igen < nGenerators; igen++)
796  {
797  AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ;
798  TString name = eventHeader2->GetName();
799 
800  if(name.Contains(headerName,TString::kIgnoreCase)) return eventHeader2 ;
801  }
802 
803  return 0x0;
804 
805  }
806  else if(ReadAODMCParticles() && GetAODMCHeader())
807  {
808  Int_t nGenerators = GetAODMCHeader()->GetNCocktailHeaders();
809 
810  if( nGenerators <= 0) return 0x0;
811 
812  if(headerName=="") return GetAODMCHeader()->GetCocktailHeader(0);
813 
814  for(Int_t igen = 0; igen < nGenerators; igen++)
815  {
816  AliGenEventHeader * eventHeader = GetAODMCHeader()->GetCocktailHeader(igen) ;
817  TString name = eventHeader->GetName();
818 
819  if(name.Contains(headerName,TString::kIgnoreCase)) return eventHeader ;
820  }
821 
822  return 0x0;
823 
824  }
825  else
826  {
827  return 0x0;
828  }
829 }
830 
831 //_________________________________________________________
834 //_________________________________________________________
836 {
837  AliInfo("Input are not AODs");
838 
839  return NULL ;
840 }
841 
842 //________________________________________________________
845 //________________________________________________________
846 AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader() const
847 {
848  AliInfo("Input are not AODs");
849 
850  return NULL ;
851 }
852 
853 //___________________________________________________________
861 //___________________________________________________________
862 Int_t AliCaloTrackReader::GetVertexBC(const AliVVertex * vtx)
863 {
864  Int_t vertexBC=vtx->GetBC();
865 
866  if(!fRecalculateVertexBC) return vertexBC;
867 
868  // Value not available, recalculate it.
869 
870  Double_t bz = fInputEvent->GetMagneticField();
871  Bool_t bc0 = kFALSE;
872  Int_t ntr = GetCTSTracks()->GetEntriesFast();
873  //printf("N Tracks %d\n",ntr);
874 
875  for(Int_t i = 0 ; i < ntr ; i++)
876  {
877  AliVTrack * track = (AliVTrack*) (GetCTSTracks()->At(i));
878 
879  //Check if has TOF info, if not skip
880  ULong_t status = track->GetStatus();
881  Bool_t okTOF = (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ;
882  vertexBC = track->GetTOFBunchCrossing(bz);
883  Float_t pt = track->Pt();
884 
885  if(!okTOF) continue;
886 
887  // Get DCA x, y
888  Double_t dca[2] = {1e6,1e6};
889  Double_t covar[3] = {1e6,1e6,1e6};
890  track->PropagateToDCA(vtx,bz,100.,dca,covar);
891 
892  if(AcceptDCA(pt,dca[0]))
893  {
894  if (vertexBC !=0 && fVertexBC != AliVTrack::kTOFBCNA) return vertexBC;
895  else if(vertexBC == 0) bc0 = kTRUE;
896  }
897  }
898 
899  if( bc0 ) vertexBC = 0 ;
900  else vertexBC = AliVTrack::kTOFBCNA ;
901 
902  return vertexBC;
903 }
904 
905 //_____________________________
912 //_____________________________
914 {
915  return track->GetID();
916 }
917 
918 //_____________________________
921 //_____________________________
923 {
925  {
926  AliInfo("Cannot access stack and mcparticles at the same time, change them");
927  fReadStack = kFALSE;
928  fReadAODMCParticles = kFALSE;
929  }
930 
931  // Activate debug level in AliAnaWeights
932  if( fWeightUtils->GetDebug() >= 0 )
933  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(fWeightUtils->ClassName(), fWeightUtils->GetDebug());
934 }
935 
936 //_______________________________________
938 //_______________________________________
940 {
941  fDataType = kESD ;
942  fCTSPtMin = 0.1 ;
943  fEMCALPtMin = 0.1 ;
944  fPHOSPtMin = 0.1 ;
945  fCTSPtMax = 1000. ;
946  fEMCALPtMax = 1000. ;
947  fPHOSPtMax = 1000. ;
948 
949  fEMCALBadChMinDist = 0; // open, 2; // standard
950  fPHOSBadChMinDist = 0; // open, 2; // standard
951 
952  fEMCALNCellsCut = 0; // open, 1; // standard
953  fPHOSNCellsCut = 0; // open, 2; // standard
954 
955  //Track DCA cuts
956  // dca_xy cut = 0.0105+0.0350/TMath::Power(pt,1.1);
957  fTrackDCACut[0] = 0.0105;
958  fTrackDCACut[1] = 0.0350;
959  fTrackDCACut[2] = 1.1;
960 
961  //Do not filter the detectors input by default.
962  fFillEMCAL = kFALSE;
963  fFillDCAL = kFALSE;
964  fFillPHOS = kFALSE;
965  fFillCTS = kFALSE;
966  fFillEMCALCells = kFALSE;
967  fFillPHOSCells = kFALSE;
968 
969  fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
970  fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
971  fDeltaAODFileName = "deltaAODPartCorr.root";
973  fEventTriggerMask = AliVEvent::kAny;
974  fMixEventTriggerMask = AliVEvent::kAnyINT;
975  fEventTriggerAtSE = kTRUE; // Use only events that pass event selection at SE base class
976 
977  fAcceptFastCluster = kTRUE;
978  fEventType = -1;
979 
980  //We want tracks fitted in the detectors:
981  //fTrackStatus=AliESDtrack::kTPCrefit;
982  //fTrackStatus|=AliESDtrack::kITSrefit;
983  fTrackStatus = 0;
984 
985  fV0ADC[0] = 0; fV0ADC[1] = 0;
986  fV0Mul[0] = 0; fV0Mul[1] = 0;
987 
988  fZvtxCut = 10.;
989 
990  fNMixedEvent = 1;
991 
994 
995  //Centrality
996  fUseAliCentrality = kFALSE;
997  fCentralityClass = "V0M";
998  fCentralityOpt = 100;
999  fCentralityBin[0] = fCentralityBin[1]=-1;
1000 
1001  fEventPlaneMethod = "V0";
1002 
1003  // Allocate memory (not sure this is the right place)
1004  fCTSTracks = new TObjArray();
1005  fEMCALClusters = new TObjArray();
1006  fDCALClusters = new TObjArray();
1007  fPHOSClusters = new TObjArray();
1008  //fTriggerAnalysis = new AliTriggerAnalysis;
1009  fAODBranchList = new TList ;
1010  fOutputContainer = new TList ;
1011 
1012  fEnergyHistogramNbins = 200;
1013  fEnergyHistogramLimit[0] = 0 ;
1014  fEnergyHistogramLimit[1] = 100;
1015 
1016  fPileUpParamSPD[0] = 3 ; fPileUpParamSPD[1] = 0.8 ;
1017  fPileUpParamSPD[2] = 3.0 ; fPileUpParamSPD[3] = 2.0 ; fPileUpParamSPD[4] = 5.0;
1018 
1019  // Parametrized time cut (LHC11d)
1022 
1023  // Parametrized time cut (LHC11c)
1024  //fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 1.87; fEMCALParamTimeCutMin[3] = 0.4;
1025  //fEMCALParamTimeCutMax[0] = 3.5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.15; fEMCALParamTimeCutMax[3] = 1.6;
1026 
1027  fTimeStampRunMin = -1;
1028  fTimeStampRunMax = 1e12;
1031 
1032  for(Int_t i = 0; i < 19; i++)
1033  {
1034  fEMCalBCEvent [i] = 0;
1035  fEMCalBCEventCut[i] = 0;
1036  fTrackBCEvent [i] = 0;
1037  fTrackBCEventCut[i] = 0;
1038  }
1039 
1040  // Trigger match-rejection
1041  fTriggerPatchTimeWindow[0] = 8;
1042  fTriggerPatchTimeWindow[1] = 9;
1043 
1044  fTriggerClusterBC = -10000 ;
1047  fTriggerClusterIndex = -1;
1048  fTriggerClusterId = -1;
1049 
1050  //Jets
1053  if(!fNonStandardJets) fNonStandardJets = new TClonesArray("AliAODJet",100);
1056  if(!fBackgroundJets) fBackgroundJets = new AliAODJetEventBackground();
1057 
1058  fSmearShowerShapeWidth = 0.005;
1059  fSmearNLMMin = 1;
1060  fSmearNLMMax = 1;
1061 
1062  fWeightUtils = new AliAnaWeights() ;
1063  fEventWeight = 1 ;
1064 
1065 }
1066 
1067 //__________________________________________________________________________
1070 //__________________________________________________________________________
1072 {
1073  // Parametrized cut depending on E
1074  if(fUseParamTimeCut)
1075  {
1078  //printf("tof %f, minCut %f, maxCut %f\n",tof,minCut,maxCut);
1079  if( tof < minCut || tof > maxCut ) return kFALSE ;
1080  }
1081 
1082  //In any case, the time should to be larger than the fixed window ...
1083  if( tof < fEMCALTimeCutMin || tof > fEMCALTimeCutMax ) return kFALSE ;
1084 
1085  return kTRUE ;
1086 }
1087 
1088 //________________________________________________
1091 //________________________________________________
1093 {
1094  return fInputEvent->IsPileupFromSPD((Int_t) fPileUpParamSPD[0] , fPileUpParamSPD[1] ,
1095  fPileUpParamSPD[2] , fPileUpParamSPD[3] , fPileUpParamSPD[4] );
1096  //printf("Param : %d, %2.2f, %2.2f, %2.2f, %2.2f\n",(Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
1097 }
1098 
1099 //__________________________________________________
1101 //__________________________________________________
1103 {
1104  if(fNPileUpClusters > fNPileUpClustersCut) return kTRUE ;
1105  else return kFALSE;
1106 }
1107 
1108 //________________________________________________________
1110 //________________________________________________________
1112 {
1113  if( IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
1114  else return kFALSE;
1115 }
1116 
1117 //_______________________________________________________
1119 //_______________________________________________________
1121 {
1122  if( IsPileUpFromSPD() || IsPileUpFromEMCal()) return kTRUE ;
1123  else return kFALSE;
1124 }
1125 
1126 //___________________________________________________________
1128 //___________________________________________________________
1130 {
1131  if( IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
1132  else return kFALSE;
1133 }
1134 
1135 //___________________________________________________________
1137 //___________________________________________________________
1139 {
1140  if( !IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
1141  else return kFALSE;
1142 }
1143 
1144 //______________________________________________________________
1146 //______________________________________________________________
1148 {
1149  if( !IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
1150  else return kFALSE;
1151 }
1152 
1153 //___________________________________________________________________________________
1161 //___________________________________________________________________________________
1162 Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileName*/)
1163 {
1164  fEventNumber = iEntry;
1165  fTriggerClusterIndex = -1;
1166  fTriggerClusterId = -1;
1167  fIsTriggerMatch = kFALSE;
1168  fTriggerClusterBC = -10000;
1169  fIsExoticEvent = kFALSE;
1170  fIsBadCellEvent = kFALSE;
1171  fIsBadMaxCellEvent = kFALSE;
1172 
1173  fIsTriggerMatchOpenCut[0] = kFALSE ;
1174  fIsTriggerMatchOpenCut[1] = kFALSE ;
1175  fIsTriggerMatchOpenCut[2] = kFALSE ;
1176 
1177  //fCurrentFileName = TString(currentFileName);
1178  if(!fInputEvent)
1179  {
1180  AliInfo("Input event not available, skip event analysis");
1181  return kFALSE;
1182  }
1183 
1184  fhNEventsAfterCut->Fill(0.5);
1185 
1186  //-----------------------------------------------
1187  // Select the event depending on the trigger type
1188  // and other event characteristics
1189  // like the goodness of the EMCal trigger
1190  //-----------------------------------------------
1191 
1192  Bool_t accept = CheckEventTriggers();
1193  if(!accept) return kFALSE;
1194 
1195  AliDebug(1,"Pass Event trigger selection");
1196 
1197  //---------------------------------------------------------------------------
1198  // In case of analysis of events with jets, skip those with jet pt > 5 pt hard
1199  // To be used on for MC data in pT hard bins
1200  //---------------------------------------------------------------------------
1201 
1203  {
1204  if(!ComparePtHardAndJetPt()) return kFALSE ;
1205  AliDebug(1,"Pass Pt Hard - Jet rejection");
1206  fhNEventsAfterCut->Fill(8.5);
1207  }
1208 
1210  {
1211  if(!ComparePtHardAndClusterPt()) return kFALSE ;
1212  AliDebug(1,"Pass Pt Hard - Cluster rejection");
1213  fhNEventsAfterCut->Fill(9.5);
1214  }
1215 
1216  //------------------------------------------------------
1217  // Event rejection depending on time stamp
1218  //------------------------------------------------------
1219 
1221  {
1222  AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
1223  if(esd)
1224  {
1225  Int_t timeStamp = esd->GetTimeStamp();
1226  Float_t timeStampFrac = 1.*(timeStamp-fTimeStampRunMin) / (fTimeStampRunMax-fTimeStampRunMin);
1227 
1228  //printf("stamp0 %d, max0 %d, frac %f\n", timeStamp-fTimeStampRunMin,fTimeStampRunMax-fTimeStampRunMin, timeStampFrac);
1229 
1230  if(timeStampFrac < fTimeStampEventFracMin || timeStampFrac > fTimeStampEventFracMax) return kFALSE;
1231  }
1232 
1233  AliDebug(1,"Pass Time Stamp rejection");
1234  fhNEventsAfterCut->Fill(10.5);
1235  }
1236 
1237  //------------------------------------------------------
1238  // Event rejection depending on vertex, pileup, v0and
1239  //------------------------------------------------------
1240 
1241  FillVertexArray();
1242 
1243  //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code
1244  if(!GetMixedEvent() && TMath::Abs(fVertex[0][2]) > fZvtxCut) return kFALSE;
1245 
1246  fhNEventsAfterCut->Fill(11.5);
1247 
1249  {
1250  if( !CheckForPrimaryVertex() ) return kFALSE; // algorithm in ESD/AOD Readers
1251  if( TMath::Abs(fVertex[0][0] ) < 1.e-6 &&
1252  TMath::Abs(fVertex[0][1] ) < 1.e-6 &&
1253  TMath::Abs(fVertex[0][2] ) < 1.e-6 ) return kFALSE;
1254  }
1255 
1256  AliDebug(1,"Pass primary vertex rejection");
1257 
1258  fhNEventsAfterCut->Fill(12.5);
1259 
1260  //printf("Reader : IsPileUp %d, Multi %d\n",IsPileUpFromSPD(),fInputEvent->IsPileupFromSPDInMultBins());
1261 
1263  {
1264  // Do not analyze events with pileup
1265  Bool_t bPileup = IsPileUpFromSPD();
1266  //IsPileupFromSPDInMultBins() // method to try
1267  //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]);
1268  if(bPileup) return kFALSE;
1269 
1270  AliDebug(1,"Pass Pile-Up event rejection");
1271 
1272  fhNEventsAfterCut->Fill(13.5);
1273  }
1274 
1276  {
1277  AliVVZERO* v0 = fInputEvent->GetVZEROData();
1278 
1279  Bool_t bV0AND = ((v0->GetV0ADecision()==1) && (v0->GetV0CDecision()==1));
1280  //bV0AND = fTriggerAnalysis->IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0AND);
1281  //printf("V0AND event? %d\n",bV0AND);
1282 
1283  if(!bV0AND)
1284  {
1285  AliDebug(1,"Reject event by V0AND");
1286  return kFALSE;
1287  }
1288 
1289  AliDebug(1,"Pass V0AND event rejection");
1290 
1291  fhNEventsAfterCut->Fill(14.5);
1292  }
1293 
1294  //------------------------------------------------------
1295  // Check if there is a centrality value, PbPb analysis,
1296  // and if a centrality bin selection is requested
1297  //------------------------------------------------------
1298 
1299  //If we need a centrality bin, we select only those events in the corresponding bin.
1300  Int_t cen = -1;
1301  if ( fCentralityBin[0] >= 0 && fCentralityBin[1] >= 0 )
1302  {
1303  cen = GetEventCentrality();
1304 
1305  if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
1306 
1307  AliDebug(1,"Pass centrality rejection");
1308 
1309  fhNEventsAfterCut->Fill(15.5);
1310  }
1311 
1312  // Recover the weight assigned to the event, if provided
1313  // right now only for pT-hard bins and centrality depedent weights
1315  {
1317 
1318  fWeightUtils->SetPythiaEventHeader(((AliGenPythiaEventHeader*)GetGenEventHeader()));
1319 
1321  }
1322 
1323  //-------------------------------------------------------
1324  // Get the main vertex BC, in case not available
1325  // it is calculated in FillCTS checking the BC of tracks
1326  //------------------------------------------------------
1327  fVertexBC = fInputEvent->GetPrimaryVertex()->GetBC();
1328 
1329  //-----------------------------------------------
1330  // Fill the arrays with cluster/tracks/cells data
1331  //-----------------------------------------------
1332 
1333  if(fFillCTS)
1334  {
1335  FillInputCTS();
1336  //Accept events with at least one track
1337  if(fTrackMult == 0 && fDoRejectNoTrackEvents) return kFALSE ;
1338 
1339  fhNEventsAfterCut->Fill(16.5);
1340 
1341  AliDebug(1,"Pass rejection of null track events");
1342  }
1343 
1345  {
1346  if(fVertexBC != 0 && fVertexBC != AliVTrack::kTOFBCNA) return kFALSE ;
1347 
1348  AliDebug(1,"Pass rejection of events with vertex at BC!=0");
1349 
1350  fhNEventsAfterCut->Fill(17.5);
1351  }
1352 
1353  if(fFillEMCALCells)
1355 
1356  if(fFillPHOSCells)
1358 
1359  if(fFillEMCAL || fFillDCAL)
1360  FillInputEMCAL();
1361 
1362  if(fFillPHOS)
1363  FillInputPHOS();
1364 
1365  FillInputVZERO();
1366 
1367  //one specified jet branch
1372 
1373  AliDebug(1,"Event accepted for analysis");
1374 
1375  return kTRUE ;
1376 }
1377 
1378 //__________________________________________________
1381 //__________________________________________________
1383 {
1384  if(fUseAliCentrality)
1385  {
1386  if ( !GetCentrality() ) return -1;
1387 
1388  AliDebug(1,Form("Cent. Percentile: V0M %2.2f, CL0 %2.2f, CL1 %2.2f; selected class %s",
1389  GetCentrality()->GetCentralityPercentile("V0M"),
1390  GetCentrality()->GetCentralityPercentile("CL0"),
1391  GetCentrality()->GetCentralityPercentile("CL1"),
1392  fCentralityClass.Data()));
1393 
1394  if (fCentralityOpt == 100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); // 100 bins max
1395  else if(fCentralityOpt == 10) return GetCentrality()->GetCentralityClass10(fCentralityClass);// 10 bins max
1396  else if(fCentralityOpt == 20) return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max
1397  else
1398  {
1399  AliInfo(Form("Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt));
1400  return -1;
1401  }
1402  }
1403  else
1404  {
1405  if ( !GetMultSelCen() ) return -1;
1406 
1407  AliDebug(1,Form("Mult. Percentile: V0M %2.2f, CL0 %2.2f, CL1 %2.2f; selected class %s",
1408  GetMultSelCen()->GetMultiplicityPercentile("V0M",1),
1409  GetMultSelCen()->GetMultiplicityPercentile("CL0",1),
1410  GetMultSelCen()->GetMultiplicityPercentile("CL1",1),
1411  fCentralityClass.Data()));
1412 
1413  return GetMultSelCen()->GetMultiplicityPercentile(fCentralityClass, kTRUE); // returns centrality only for events used in calibration
1414 
1415  // equivalent to
1416  //GetMultSelCen()->GetMultiplicityPercentile("V0M", kFALSE); // returns centrality for any event
1417  //Int_t qual = GetMultSelCen()->GetEvSelCode(); if (qual ! = 0) cent = qual;
1418  }
1419 }
1420 
1421 //_____________________________________________________
1424 //_____________________________________________________
1426 {
1427  if( !GetEventPlane() ) return -1000;
1428 
1429  Float_t ep = GetEventPlane()->GetEventplane(GetEventPlaneMethod(), GetInputEvent());
1430 
1431  if(GetEventPlaneMethod()=="Q" && (ep < 0 || ep > TMath::Pi()))
1432  {
1433  AliDebug(1,Form("Bad EP for <Q> method : %f\n",ep));
1434  return -1000;
1435  }
1436  else if(GetEventPlaneMethod().Contains("V0") )
1437  {
1438  if((ep > TMath::Pi()/2 || ep < -TMath::Pi()/2))
1439  {
1440  AliDebug(1,Form("Bad EP for <%s> method : %f\n",GetEventPlaneMethod().Data(), ep));
1441  return -1000;
1442  }
1443 
1444  ep+=TMath::Pi()/2; // put same range as for <Q> method
1445  }
1446 
1447  AliDebug(3,Form("Event plane angle %f",ep));
1448 
1449 // if(fDebug > 0 )
1450 // {
1451 // if (ep > TMath::Pi()) printf("AliCaloTrackReader::GetEventPlaneAngle() - Too large angle = %f\n",ep);
1452 // else if(ep < 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Negative angle = %f\n" ,ep);
1453 // }
1454 
1455  return ep;
1456 }
1457 
1458 //__________________________________________________________
1460 //__________________________________________________________
1462 {
1463  vertex[0] = fVertex[0][0];
1464  vertex[1] = fVertex[0][1];
1465  vertex[2] = fVertex[0][2];
1466 }
1467 
1468 //__________________________________________________________________________
1470 //__________________________________________________________________________
1471 void AliCaloTrackReader::GetVertex(Double_t vertex[3], Int_t evtIndex) const
1472 {
1473  vertex[0] = fVertex[evtIndex][0];
1474  vertex[1] = fVertex[evtIndex][1];
1475  vertex[2] = fVertex[evtIndex][2];
1476 }
1477 
1478 //________________________________________
1481 //________________________________________
1483 {
1484  // Delete previous vertex
1485  if(fVertex)
1486  {
1487  for (Int_t i = 0; i < fNMixedEvent; i++)
1488  {
1489  delete [] fVertex[i] ;
1490  }
1491  delete [] fVertex ;
1492  }
1493 
1494  fVertex = new Double_t*[fNMixedEvent] ;
1495  for (Int_t i = 0; i < fNMixedEvent; i++)
1496  {
1497  fVertex[i] = new Double_t[3] ;
1498  fVertex[i][0] = 0.0 ;
1499  fVertex[i][1] = 0.0 ;
1500  fVertex[i][2] = 0.0 ;
1501  }
1502 
1503  if (!fMixedEvent)
1504  { // Single event analysis
1505  if(fDataType!=kMC)
1506  {
1507 
1508  if(fInputEvent->GetPrimaryVertex())
1509  {
1510  fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]);
1511  }
1512  else
1513  {
1514  AliWarning("NULL primary vertex");
1515  fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1516  }//Primary vertex pointer do not exist
1517 
1518  } else
1519  {// MC read event
1520  fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1521  }
1522 
1523  AliDebug(1,Form("Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]));
1524 
1525  } else
1526  { // MultiEvent analysis
1527  for (Int_t iev = 0; iev < fNMixedEvent; iev++)
1528  {
1529  if (fMixedEvent->GetVertexOfEvent(iev))
1530  fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]);
1531  else
1532  AliWarning("No vertex found");
1533 
1534  AliDebug(1,Form("Multi Event %d Vertex : %f,%f,%f",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]));
1535  }
1536  }
1537 }
1538 
1539 //_____________________________________
1545 //_____________________________________
1547 {
1548  AliDebug(1,"Begin");
1549 
1550  Double_t pTrack[3] = {0,0,0};
1551 
1552  Int_t nTracks = fInputEvent->GetNumberOfTracks() ;
1553  fTrackMult = 0;
1554  Int_t nstatus = 0;
1555  Double_t bz = GetInputEvent()->GetMagneticField();
1556 
1557  for(Int_t i = 0; i < 19; i++)
1558  {
1559  fTrackBCEvent [i] = 0;
1560  fTrackBCEventCut[i] = 0;
1561  }
1562 
1563  Bool_t bc0 = kFALSE;
1564  if(fRecalculateVertexBC) fVertexBC = AliVTrack::kTOFBCNA;
1565 
1566  for (Int_t itrack = 0; itrack < nTracks; itrack++)
1567  {
1568  AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd
1569 
1570  if ( !AcceptParticleMCLabel( TMath::Abs(track->GetLabel()) ) ) continue ;
1571 
1572  fhCTSTrackCutsPt[0]->Fill(track->Pt());
1573 
1574  //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
1575  ULong_t status = track->GetStatus();
1576 
1577  if (fTrackStatus && !((status & fTrackStatus) == fTrackStatus))
1578  continue ;
1579 
1580  fhCTSTrackCutsPt[1]->Fill(track->Pt());
1581 
1582  nstatus++;
1583 
1584  //-------------------------
1585  // Select the tracks depending on cuts of AOD or ESD
1586  if(!SelectTrack(track, pTrack)) continue ;
1587 
1588  fhCTSTrackCutsPt[2]->Fill(track->Pt());
1589 
1590  //-------------------------
1591  // TOF cuts
1592  Bool_t okTOF = ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) ;
1593  Double_t tof = -1000;
1594  Int_t trackBC = -1000 ;
1595 
1596  if(fAccessTrackTOF)
1597  {
1598  if(okTOF)
1599  {
1600  trackBC = track->GetTOFBunchCrossing(bz);
1601  SetTrackEventBC(trackBC+9);
1602 
1603  tof = track->GetTOFsignal()*1e-3;
1604 
1605  //After selecting tracks with small DCA, pointing to vertex, set vertex BC depeding on tracks BC
1607  {
1608  if (trackBC != 0 && trackBC != AliVTrack::kTOFBCNA) fVertexBC = trackBC;
1609  else if(trackBC == 0) bc0 = kTRUE;
1610  }
1611 
1612  //In any case, the time should to be larger than the fixed window ...
1613  if( fUseTrackTimeCut && (trackBC !=0 || tof < fTrackTimeCutMin || tof > fTrackTimeCutMax) )
1614  {
1615  //printf("Remove track time %f and bc = %d\n",tof,trackBC);
1616  continue ;
1617  }
1618  //else printf("Accept track time %f and bc = %d\n",tof,trackBC);
1619  }
1620  }
1621 
1622  fhCTSTrackCutsPt[3]->Fill(track->Pt());
1623 
1624  //---------------------
1625  // DCA cuts
1626  //
1627  fMomentum.SetPxPyPzE(pTrack[0],pTrack[1],pTrack[2],0);
1628 
1629  if(fUseTrackDCACut)
1630  {
1631  Float_t dcaTPC =-999;
1632  //In case of AODs, TPC tracks cannot be propagated back to primary vertex,
1633  if( fDataType == kAOD ) dcaTPC = ((AliAODTrack*) track)->DCA();
1634 
1635  //normal way to get the dca, cut on dca_xy
1636  if(dcaTPC==-999)
1637  {
1638  Double_t dca[2] = {1e6,1e6};
1639  Double_t covar[3] = {1e6,1e6,1e6};
1640  Bool_t okDCA = track->PropagateToDCA(fInputEvent->GetPrimaryVertex(),bz,100.,dca,covar);
1641  if( okDCA) okDCA = AcceptDCA(fMomentum.Pt(),dca[0]);
1642  if(!okDCA)
1643  {
1644  //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f\n",fMomentum.Pt(),dca[0]);
1645  continue ;
1646  }
1647  }
1648  }// DCA cuts
1649 
1650  fhCTSTrackCutsPt[4]->Fill(track->Pt());
1651 
1652  //-------------------------
1653  // Kinematic/acceptance cuts
1654  //
1655  // Count the tracks in eta < 0.9
1656  if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
1657 
1658  if(fCTSPtMin > fMomentum.Pt() || fCTSPtMax < fMomentum.Pt()) continue ;
1659 
1660  // Check effect of cuts on track BC
1661  if(fAccessTrackTOF && okTOF) SetTrackEventBCcut(trackBC+9);
1662 
1663  if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kCTS)) continue;
1664 
1665  fhCTSTrackCutsPt[5]->Fill(track->Pt());
1666 
1667  // ------------------------------
1668  // Add selected tracks to array
1669  AliDebug(2,Form("Selected tracks pt %3.2f, phi %3.2f deg, eta %3.2f",
1670  fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1671 
1672  fCTSTracks->Add(track);
1673 
1674  // TODO, check if remove
1675  if (fMixedEvent) track->SetID(itrack);
1676 
1677  }// track loop
1678 
1679  if( fRecalculateVertexBC && (fVertexBC == 0 || fVertexBC == AliVTrack::kTOFBCNA))
1680  {
1681  if( bc0 ) fVertexBC = 0 ;
1682  else fVertexBC = AliVTrack::kTOFBCNA ;
1683  }
1684 
1685  AliDebug(1,Form("AOD entries %d, input tracks %d, pass status %d, multipliticy %d", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult));//fCTSTracksNormalInputEntries);
1686 }
1687 
1688 //_______________________________________________________________________________
1706 //_______________________________________________________________________________
1708 {
1709  // Accept clusters with the proper label
1710  if(clus->GetLabel() >=0 ) // -1 corresponds to noisy MC
1711  {
1712  if ( !AcceptParticleMCLabel(clus->GetLabel()) ) return ;
1713  }
1714 
1715  // TODO, not sure if needed anymore
1716  Int_t vindex = 0 ;
1717  if (fMixedEvent)
1718  vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1719 
1720  clus->GetMomentum(fMomentum, fVertex[vindex]);
1721 
1722  // No correction/cut applied yet
1723  fhEMCALClusterCutsE[0]->Fill(clus->E());
1724 
1725  //if( (fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10 )
1726  AliDebug(2,Form("Input cluster E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1727  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1728 
1729  //---------------------------
1730  // Embedding case
1731  // TO BE REVISED
1733  {
1734  if(clus->GetNLabels()==0 || clus->GetLabel() < 0) return;
1735  //else printf("Embedded cluster, %d, n label %d label %d \n",iclus,clus->GetNLabels(),clus->GetLabel());
1736  }
1737 
1738  //--------------------------------------
1739  // Apply some corrections in the cluster
1740  //
1742  {
1743  //Recalibrate the cluster energy
1745  {
1747 
1748  clus->SetE(energy);
1749  //printf("Recalibrated Energy %f\n",clus->E());
1750 
1753 
1754  } // recalculate E
1755 
1756  //Recalculate distance to bad channels, if new list of bad channels provided
1758 
1759  //Recalculate cluster position
1760  if(GetCaloUtils()->IsRecalculationOfClusterPositionOn())
1761  {
1763  //clus->GetPosition(pos);
1764  //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1765  }
1766 
1767  // Recalculate TOF
1768  if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
1769  {
1770  Double_t tof = clus->GetTOF();
1771  Float_t frac =-1;
1772  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1773 
1774  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1775 
1776  //additional L1 phase shift
1777  if(GetCaloUtils()->GetEMCALRecoUtils()->IsL1PhaseInTimeRecalibrationOn())
1778  {
1779  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absIdMax),
1780  fInputEvent->GetBunchCrossNumber(), tof);
1781  }
1782 
1783  clus->SetTOF(tof);
1784 
1785  }// Time recalibration
1786  }
1787 
1788  // Check effect of corrections
1789  fhEMCALClusterCutsE[1]->Fill(clus->E());
1790 
1791  //-----------------------------------------------------------------
1792  // Reject clusters with bad channels, close to borders and exotic
1793  //
1794  Bool_t goodCluster = GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,
1795  GetCaloUtils()->GetEMCALGeometry(),
1796  GetEMCALCells(),fInputEvent->GetBunchCrossNumber());
1797 
1798  if(!goodCluster)
1799  {
1800  //if( (fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10 )
1801  AliDebug(2,Form("Bad cluster E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1802  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1803 
1804  return;
1805  }
1806 
1807  // Check effect of bad cluster removal
1808  fhEMCALClusterCutsE[2]->Fill(clus->E());
1809 
1810  //Float_t pos[3];
1811  //clus->GetPosition(pos);
1812  //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1813 
1814  //--------------------------------------
1815  // Correct non linearity or smear energy
1816  //
1818  {
1820 
1821  //if( (fDebug > 5 && fMomentum.E() > 0.1) || fDebug > 10 )
1822  AliDebug(5,Form("Correct Non Lin: Old E %3.2f, New E %3.2f",
1823  fMomentum.E(),clus->E()));
1824 
1825  // In case of MC analysis, to match resolution/calibration in real data
1826  // Not needed anymore, just leave for MC studies on systematics
1827  if( GetCaloUtils()->GetEMCALRecoUtils()->IsClusterEnergySmeared() )
1828  {
1829  Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus);
1830 
1831  //if( (fDebug > 5 && fMomentum.E() > 0.1) || fDebug > 10 )
1832  AliDebug(5,Form("Smear energy: Old E %3.2f, New E %3.2f",clus->E(),rdmEnergy));
1833 
1834  clus->SetE(rdmEnergy);
1835  }
1836  }
1837 
1838  clus->GetMomentum(fMomentum, fVertex[vindex]);
1839 
1840  // Check effect linearity correction, energy smearing
1841  fhEMCALClusterCutsE[3]->Fill(clus->E());
1842 
1843  // Check the event BC depending on EMCal clustr before final cuts
1844  Double_t tof = clus->GetTOF()*1e9;
1845 
1846  Int_t bc = TMath::Nint(tof/50) + 9;
1847  //printf("tof %2.2f, bc+5=%d\n",tof,bc);
1848 
1849  SetEMCalEventBC(bc);
1850 
1851  //--------------------------------------
1852  // Apply some kinematical/acceptance cuts
1853  //
1854  if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) return ;
1855 
1856  // Select cluster fiducial region
1857  //
1858  Bool_t bEMCAL = kFALSE;
1859  Bool_t bDCAL = kFALSE;
1860  if(fCheckFidCut)
1861  {
1862  if(fFillEMCAL && fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kEMCAL)) bEMCAL = kTRUE ;
1863  if(fFillDCAL && fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kDCAL )) bDCAL = kTRUE ;
1864  }
1865  else
1866  {
1867  bEMCAL = kTRUE;
1868  }
1869 
1870  //---------------------------------------------------------------------
1871  // Mask all cells in collumns facing ALICE thick material if requested
1872  //
1874  {
1875  Int_t absId = -1;
1876  Int_t iSupMod = -1;
1877  Int_t iphi = -1;
1878  Int_t ieta = -1;
1879  Bool_t shared = kFALSE;
1880  GetCaloUtils()->GetEMCALRecoUtils()->GetMaxEnergyCell(GetCaloUtils()->GetEMCALGeometry(), GetEMCALCells(),clus,absId,iSupMod,ieta,iphi,shared);
1881 
1882  AliDebug(2,Form("Masked collumn: cluster E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1883  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1884 
1885 
1886  if(GetCaloUtils()->MaskFrameCluster(iSupMod, ieta)) return;
1887  }
1888 
1889  // Check effect of energy and fiducial cuts
1890  fhEMCALClusterCutsE[4]->Fill(clus->E());
1891 
1892 
1893  //------------------------------------------
1894  // Apply time cut, count EMCal BC before cut
1895  //
1896  SetEMCalEventBCcut(bc);
1897 
1898  if(!IsInTimeWindow(tof,clus->E()))
1899  {
1900  fNPileUpClusters++ ;
1901  if(fUseEMCALTimeCut)
1902  {
1903  AliDebug(2,Form("Out of time window E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f, time %e",
1904  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta(),tof));
1905 
1906  return ;
1907  }
1908  }
1909  else
1911 
1912  // Check effect of time cut
1913  fhEMCALClusterCutsE[5]->Fill(clus->E());
1914 
1915 
1916  //----------------------------------------------------
1917  // Apply N cells cut
1918  //
1919  if(clus->GetNCells() <= fEMCALNCellsCut && fDataType != AliCaloTrackReader::kMC) return ;
1920 
1921  // Check effect of n cells cut
1922  fhEMCALClusterCutsE[6]->Fill(clus->E());
1923 
1924  //----------------------------------------------------
1925  // Apply distance to bad channel cut
1926  //
1927  Double_t distBad = clus->GetDistanceToBadChannel() ; //Distance to bad channel
1928 
1929  if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
1930 
1931  if(distBad < fEMCALBadChMinDist) return ;
1932 
1933  // Check effect distance to bad channel cut
1934  fhEMCALClusterCutsE[7]->Fill(clus->E());
1935 
1936  //----------------------------------------------------
1937  // Smear the SS to try to match data and simulations,
1938  // do it only for simulations.
1939  //
1940  Int_t nMaxima = GetCaloUtils()->GetNumberOfLocalMaxima(clus, GetEMCALCells());
1941  // Int_t nMaxima = clus->GetNExMax(); // For Run2
1942  if( fSmearShowerShape && clus->GetNCells() > 2 &&
1943  nMaxima >= fSmearNLMMin && nMaxima <= fSmearNLMMax )
1944  {
1945  AliDebug(2,Form("Smear shower shape - Original: %2.4f\n", clus->GetM02()));
1947  {
1948  clus->SetM02( clus->GetM02() + fRandom.Landau(0, fSmearShowerShapeWidth) );
1949  }
1951  {
1952  if(iclus%3 == 0 && clus->GetM02() > 0.1) clus->SetM02( clus->GetM02() + fRandom.Landau(0.05, fSmearShowerShapeWidth) ); //fSmearShowerShapeWidth = 0.035
1953  }
1954  //clus->SetM02( fRandom.Landau(clus->GetM02(), fSmearShowerShapeWidth) );
1955  AliDebug(2,Form("Width %2.4f Smeared : %2.4f\n", fSmearShowerShapeWidth,clus->GetM02()));
1956  }
1957 
1958  //--------------------------------------------------------
1959  // Fill the corresponding array with the selected clusters
1960  // Usually just filling EMCal array with upper or lower clusters is enough,
1961  // but maybe we want to do EMCal-DCal correlations.
1962 
1963  //if((fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10)
1964  AliDebug(2,Form("Selected clusters (EMCAL%d, DCAL%d), E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1965  bEMCAL,bDCAL,fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1966 
1967 
1968  if (bEMCAL) fEMCALClusters->Add(clus);
1969  else if(bDCAL ) fDCALClusters ->Add(clus);
1970 
1971  // TODO, not sure if needed anymore
1972  if (fMixedEvent)
1973  clus->SetID(iclus) ;
1974 }
1975 
1976 //_______________________________________
1983 //_______________________________________
1985 {
1986  AliDebug(1,"Begin");
1987 
1988  // First recalibrate cells, time or energy
1989  // if(GetCaloUtils()->IsRecalibrationOn())
1990  // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(),
1991  // GetEMCALCells(),
1992  // fInputEvent->GetBunchCrossNumber());
1993 
1994  fNPileUpClusters = 0; // Init counter
1995  fNNonPileUpClusters = 0; // Init counter
1996  for(Int_t i = 0; i < 19; i++)
1997  {
1998  fEMCalBCEvent [i] = 0;
1999  fEMCalBCEventCut[i] = 0;
2000  }
2001 
2002  //Loop to select clusters in fiducial cut and fill container with aodClusters
2003  if(fEMCALClustersListName=="")
2004  {
2005  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2006  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2007  {
2008  AliVCluster * clus = 0;
2009  if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
2010  {
2011  if (clus->IsEMCAL())
2012  {
2013  FillInputEMCALAlgorithm(clus, iclus);
2014  }//EMCAL cluster
2015  }// cluster exists
2016  }// cluster loop
2017 
2018  //Recalculate track matching
2020 
2021  }//Get the clusters from the input event
2022  else
2023  {
2024  TClonesArray * clusterList = 0x0;
2025 
2026  if (fInputEvent->FindListObject(fEMCALClustersListName))
2027  {
2028  clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
2029  }
2030  else if(fOutputEvent)
2031  {
2032  clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
2033  }
2034 
2035  if(!clusterList)
2036  {
2037  AliWarning(Form("Wrong name of list with clusters? <%s>",fEMCALClustersListName.Data()));
2038  return;
2039  }
2040 
2041  Int_t nclusters = clusterList->GetEntriesFast();
2042  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2043  {
2044  AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus));
2045  //printf("E %f\n",clus->E());
2046  if (clus) FillInputEMCALAlgorithm(clus, iclus);
2047  else AliWarning("Null cluster in list!");
2048  }// cluster loop
2049 
2050  // Recalculate the pile-up time, in case long time clusters removed during clusterization
2051  //printf("Input event INIT : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
2052 
2053  fNPileUpClusters = 0; // Init counter
2054  fNNonPileUpClusters = 0; // Init counter
2055  for(Int_t i = 0; i < 19; i++)
2056  {
2057  fEMCalBCEvent [i] = 0;
2058  fEMCalBCEventCut[i] = 0;
2059  }
2060 
2061  for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++)
2062  {
2063  AliVCluster * clus = 0;
2064 
2065  if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
2066  {
2067  if (clus->IsEMCAL())
2068  {
2069 
2070  Float_t frac =-1;
2071  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
2072  Double_t tof = clus->GetTOF();
2073  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
2074  //additional L1 phase shift
2075  if(GetCaloUtils()->GetEMCALRecoUtils()->IsL1PhaseInTimeRecalibrationOn())
2076  {
2077  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absIdMax), fInputEvent->GetBunchCrossNumber(), tof);
2078  }
2079 
2080  tof*=1e9;
2081 
2082  //printf("Input event cluster : AbsIdMax %d, E %2.2f, time %2.2f \n", absIdMax,clus->E(),tof);
2083 
2084  //Reject clusters with bad channels, close to borders and exotic;
2085  if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) continue;
2086 
2087  Int_t bc = TMath::Nint(tof/50) + 9;
2088  SetEMCalEventBC(bc);
2089 
2090  if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) continue ;
2091 
2092  clus->GetMomentum(fMomentum, fVertex[0]);
2093 
2094  if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kEMCAL)) return ;
2095 
2096  SetEMCalEventBCcut(bc);
2097 
2098  if(!IsInTimeWindow(tof,clus->E()))
2099  fNPileUpClusters++ ;
2100  else
2102 
2103  }
2104  }
2105  }
2106 
2107  //printf("Input event : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
2108 
2109  // Recalculate track matching, not necessary if already done in the reclusterization task.
2110  // in case it was not done ...
2112 
2113  }
2114 
2115  AliDebug(1,Form("AOD entries %d, n pile-up clusters %d, n non pile-up %d", fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters));
2116 }
2117 
2118 //_______________________________________
2120 //_______________________________________
2122 {
2123  AliDebug(1,"Begin");
2124 
2125  // Loop to select clusters in fiducial cut and fill container with aodClusters
2126  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2127  TString genName;
2128  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2129  {
2130  AliVCluster * clus = fInputEvent->GetCaloCluster(iclus) ;
2131  if ( !clus ) continue ;
2132 
2133  if ( !clus->IsPHOS() ) continue ;
2134 
2135  if(clus->GetLabel() >=0 ) // -1 corresponds to noisy MC
2136  {
2137  if ( !AcceptParticleMCLabel(clus->GetLabel()) ) continue ;
2138  }
2139 
2140  fhPHOSClusterCutsE[0]->Fill(clus->E());
2141 
2142  // Skip CPV input
2143  if( clus->GetType() == AliVCluster::kPHOSCharged ) continue ;
2144 
2145  fhPHOSClusterCutsE[1]->Fill(clus->E());
2146 
2147  //---------------------------------------------
2148  // Old feature, try to rely on PHOS tender
2149  //
2151  {
2152  // Recalibrate the cluster energy
2154  {
2155  Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
2156  clus->SetE(energy);
2157  }
2158  }
2159 
2160  //----------------------------------------------------------------------------------
2161  // Check if the cluster contains any bad channel and if close to calorimeter borders
2162  //
2163  // Old feature, try to rely on PHOS tender
2164  if( GetCaloUtils()->ClusterContainsBadChannel(kPHOS,clus->GetCellsAbsId(), clus->GetNCells()))
2165  continue;
2166 
2167  if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells()))
2168  continue;
2169 
2170  // TODO, add exotic cut???
2171 
2172  fhPHOSClusterCutsE[2]->Fill(clus->E());
2173 
2174  // TODO Dead code? remove?
2175  Int_t vindex = 0 ;
2176  if (fMixedEvent)
2177  vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
2178 
2179  clus->GetMomentum(fMomentum, fVertex[vindex]);
2180 
2181  //----------------------------------------------------------------------------------
2182  // Remove clusters close to borders
2183  //
2185  continue ;
2186 
2187  fhPHOSClusterCutsE[3]->Fill(clus->E());
2188 
2189  //----------------------------------------------------------------------------------
2190  // Remove clusters with too low energy
2191  //
2192  if (fPHOSPtMin > fMomentum.E() || fPHOSPtMax < fMomentum.E() )
2193  continue ;
2194 
2195  fhPHOSClusterCutsE[4]->Fill(clus->E());
2196 
2197  //----------------------------------------------------
2198  // Apply N cells cut
2199  //
2200  if(clus->GetNCells() <= fPHOSNCellsCut && fDataType != AliCaloTrackReader::kMC) return ;
2201 
2202  // Check effect of n cells cut
2203  fhPHOSClusterCutsE[5]->Fill(clus->E());
2204 
2205  //----------------------------------------------------
2206  // Apply distance to bad channel cut
2207  //
2208  Double_t distBad = clus->GetDistanceToBadChannel() ; //Distance to bad channel
2209 
2210  if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
2211 
2212  if(distBad < fPHOSBadChMinDist) return ;
2213 
2214  // Check effect distance to bad channel cut
2215  fhPHOSClusterCutsE[6]->Fill(clus->E());
2216 
2217  // TODO, add time cut
2218 
2219  //----------------------------------------------------------------------------------
2220  // Add selected clusters to array
2221  //
2222  //if(fDebug > 2 && fMomentum.E() > 0.1)
2223  AliDebug(2,Form("Selected clusters E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
2224  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
2225 
2226  fPHOSClusters->Add(clus);
2227 
2228  // TODO Dead code? remove?
2229  if (fMixedEvent)
2230  clus->SetID(iclus) ;
2231 
2232  } // esd/aod cluster loop
2233 
2234  AliDebug(1,Form("AOD entries %d",fPHOSClusters->GetEntriesFast())) ;
2235 }
2236 
2237 //____________________________________________
2239 //____________________________________________
2241 {
2242  fEMCALCells = fInputEvent->GetEMCALCells();
2243 }
2244 
2245 //___________________________________________
2247 //___________________________________________
2249 {
2250  fPHOSCells = fInputEvent->GetPHOSCells();
2251 }
2252 
2253 //_______________________________________
2256 //_______________________________________
2258 {
2259  AliVVZERO* v0 = fInputEvent->GetVZEROData();
2260  //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
2261 
2262  if (v0)
2263  {
2264  AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0);
2265  for (Int_t i = 0; i < 32; i++)
2266  {
2267  if(esdV0)
2268  {//Only available in ESDs
2269  fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i);
2270  fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i);
2271  }
2272 
2273  fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i);
2274  fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i);
2275  }
2276 
2277  AliDebug(1,Form("ADC (%d,%d), Multiplicity (%d,%d)",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]));
2278  }
2279  else
2280  {
2281  AliDebug(1,"Cannot retrieve V0 ESD! Run w/ null V0 charges");
2282  }
2283 }
2284 
2285 //_________________________________________________
2289 //_________________________________________________
2291 {
2292  AliDebug(2,"Begin");
2293 
2294  //
2295  //check if branch name is given
2296  if(!fInputNonStandardJetBranchName.Length())
2297  {
2298  fInputEvent->Print();
2299  AliFatal("No non-standard jet branch name specified. Specify among existing ones.");
2300  }
2301 
2302  fNonStandardJets = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fInputNonStandardJetBranchName.Data()));
2303 
2304  if(!fNonStandardJets)
2305  {
2306  //check if jet branch exist; exit if not
2307  fInputEvent->Print();
2308 
2309  AliFatal(Form("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputNonStandardJetBranchName.Data()));
2310  }
2311  else
2312  {
2313  AliDebug(1,Form("AOD input jets %d", fNonStandardJets->GetEntriesFast()));
2314  }
2315 }
2316 
2317 //_________________________________________________
2321 //_________________________________________________
2323 {
2324  AliDebug(1,"Begin");
2325  //
2326  //check if branch name is given
2327  if(!fInputBackgroundJetBranchName.Length())
2328  {
2329  fInputEvent->Print();
2330 
2331  AliFatal("No background jet branch name specified. Specify among existing ones.");
2332  }
2333 
2334  fBackgroundJets = (AliAODJetEventBackground*)(fInputEvent->FindListObject(fInputBackgroundJetBranchName.Data()));
2335 
2336  if(!fBackgroundJets)
2337  {
2338  //check if jet branch exist; exit if not
2339  fInputEvent->Print();
2340 
2341  AliFatal(Form("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputBackgroundJetBranchName.Data()));
2342  }
2343  else
2344  {
2345  AliDebug(1,"FillInputBackgroundJets");
2346  fBackgroundJets->Print("");
2347  }
2348 }
2349 
2350 //____________________________________________________________________
2356 //____________________________________________________________________
2358 {
2359  // init some variables
2360  Int_t trigtimes[30], globCol, globRow,ntimes, i;
2361  Int_t absId = -1; //[100];
2362  Int_t nPatch = 0;
2363 
2364  TArrayI patches(0);
2365 
2366  // get object pointer
2367  AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
2368 
2369  if(!caloTrigger)
2370  {
2371  AliError("Trigger patches input (AliVCaloTrigger) not available in data!");
2372  return patches;
2373  }
2374 
2375  //printf("CaloTrigger Entries %d\n",caloTrigger->GetEntries() );
2376 
2377  // class is not empty
2378  if( caloTrigger->GetEntries() > 0 )
2379  {
2380  // must reset before usage, or the class will fail
2381  caloTrigger->Reset();
2382 
2383  // go throuth the trigger channels
2384  while( caloTrigger->Next() )
2385  {
2386  // get position in global 2x2 tower coordinates
2387  caloTrigger->GetPosition( globCol, globRow );
2388 
2389  //L0
2390  if(IsEventEMCALL0())
2391  {
2392  // get dimension of time arrays
2393  caloTrigger->GetNL0Times( ntimes );
2394 
2395  // no L0s in this channel
2396  // presence of the channel in the iterator still does not guarantee that L0 was produced!!
2397  if( ntimes < 1 )
2398  continue;
2399 
2400  // get timing array
2401  caloTrigger->GetL0Times( trigtimes );
2402  //printf("Get L0 patch : n times %d - trigger time window %d - %d\n",ntimes, tmin,tmax);
2403 
2404  // go through the array
2405  for( i = 0; i < ntimes; i++ )
2406  {
2407  // check if in cut - 8,9 shall be accepted in 2011
2408  if( trigtimes[i] >= tmin && trigtimes[i] <= tmax )
2409  {
2410  //printf("Accepted trigger time %d \n",trigtimes[i]);
2411  //if(nTrig > 99) continue;
2412  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absId);
2413  //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId);
2414  patches.Set(nPatch+1);
2415  patches.AddAt(absId,nPatch++);
2416  }
2417  } // trigger time array
2418  }//L0
2419  else if(IsEventEMCALL1()) // L1
2420  {
2421  Int_t bit = 0;
2422  caloTrigger->GetTriggerBits(bit);
2423 
2424  Int_t sum = 0;
2425  caloTrigger->GetL1TimeSum(sum);
2426  //fBitEGA-=2;
2427  Bool_t isEGA1 = ((bit >> fBitEGA ) & 0x1) && IsEventEMCALL1Gamma1() ;
2428  Bool_t isEGA2 = ((bit >> (fBitEGA+1)) & 0x1) && IsEventEMCALL1Gamma2() ;
2429  Bool_t isEJE1 = ((bit >> fBitEJE ) & 0x1) && IsEventEMCALL1Jet1 () ;
2430  Bool_t isEJE2 = ((bit >> (fBitEJE+1)) & 0x1) && IsEventEMCALL1Jet2 () ;
2431 
2432  //if((bit>> fBitEGA )&0x1) printf("Trig Bit %d - bit %d - EG1 %d - EG2 %d\n",fBitEGA ,bit,IsEventEMCALL1Gamma1(),IsEventEMCALL1Gamma2());
2433  //if((bit>>(fBitEGA+1))&0x1) printf("Trig Bit %d - bit %d - EG1 %d - EG2 %d\n",fBitEGA+1,bit,IsEventEMCALL1Gamma1(),IsEventEMCALL1Gamma2());
2434 
2435  if(!isEGA1 && !isEJE1 && !isEGA2 && !isEJE2) continue;
2436 
2437  Int_t patchsize = -1;
2438  if (isEGA1 || isEGA2) patchsize = 2;
2439  else if (isEJE1 || isEJE2) patchsize = 16;
2440 
2441  //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",
2442  // bit,sum,patchsize,isEGA1,isEGA2,isEJE1,isEJE2,fBitEGA,fBitEJE,IsEventEMCALL1Gamma(),IsEventEMCALL1Jet());
2443 
2444 
2445  // add 2x2 (EGA) or 16x16 (EJE) patches
2446  for(Int_t irow=0; irow < patchsize; irow++)
2447  {
2448  for(Int_t icol=0; icol < patchsize; icol++)
2449  {
2450  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol+icol,globRow+irow, absId);
2451  //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId);
2452  patches.Set(nPatch+1);
2453  patches.AddAt(absId,nPatch++);
2454  }
2455  }
2456 
2457  } // L1
2458 
2459  } // trigger iterator
2460  } // go through triggers
2461 
2462  if(patches.GetSize()<=0) AliInfo(Form("No patch found! for triggers: %s and selected <%s>",
2464  //else printf(">>>>> N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nPatch, patches.At(0), patches.At(patches.GetSize()-1));
2465 
2466  return patches;
2467 }
2468 
2469 //____________________________________________________________
2473 //____________________________________________________________
2475 {
2476  // Init info from previous event
2477  fTriggerClusterIndex = -1;
2478  fTriggerClusterId = -1;
2479  fTriggerClusterBC = -10000;
2480  fIsExoticEvent = kFALSE;
2481  fIsBadCellEvent = kFALSE;
2482  fIsBadMaxCellEvent = kFALSE;
2483 
2484  fIsTriggerMatch = kFALSE;
2485  fIsTriggerMatchOpenCut[0] = kFALSE;
2486  fIsTriggerMatchOpenCut[1] = kFALSE;
2487  fIsTriggerMatchOpenCut[2] = kFALSE;
2488 
2489  // Do only analysis for triggered events
2490  if(!IsEventEMCALL1() && !IsEventEMCALL0())
2491  {
2492  fTriggerClusterBC = 0;
2493  return;
2494  }
2495 
2496  //printf("***** Try to match trigger to cluster %d **** L0 %d, L1 %d\n",fTriggerPatchClusterMatch,IsEventEMCALL0(),IsEventEMCALL1());
2497 
2498  //Recover the list of clusters
2499  TClonesArray * clusterList = 0;
2500  if (fInputEvent->FindListObject(fEMCALClustersListName))
2501  {
2502  clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
2503  }
2504  else if(fOutputEvent)
2505  {
2506  clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
2507  }
2508 
2509  // Get number of clusters and of trigger patches
2510  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2511  if(clusterList)
2512  nclusters = clusterList->GetEntriesFast();
2513 
2514  Int_t nPatch = patches.GetSize();
2515  Float_t exoDiffTime = GetCaloUtils()->GetEMCALRecoUtils()->GetExoticCellDiffTimeCut();
2516 
2517  //Init some variables used in the cluster loop
2518  Float_t tofPatchMax = 100000;
2519  Float_t ePatchMax =-1;
2520 
2521  Float_t tofMax = 100000;
2522  Float_t eMax =-1;
2523 
2524  Int_t clusMax =-1;
2525  Int_t idclusMax =-1;
2526  Bool_t badClMax = kFALSE;
2527  Bool_t badCeMax = kFALSE;
2528  Bool_t exoMax = kFALSE;
2529 // Int_t absIdMaxTrig= -1;
2530  Int_t absIdMaxMax = -1;
2531 
2532  Int_t nOfHighECl = 0 ;
2533 
2534  //
2535  // Check what is the trigger threshold
2536  // set minimu energym of candidate for trigger cluster
2537  //
2539 
2540  Float_t triggerThreshold = fTriggerL1EventThreshold;
2541  if(IsEventEMCALL0()) triggerThreshold = fTriggerL0EventThreshold;
2542  Float_t minE = triggerThreshold / 2.;
2543 
2544  // This method is not really suitable for JET trigger
2545  // but in case, reduce the energy cut since we do not trigger on high energy particle
2546  if(IsEventEMCALL1Jet() || minE < 1) minE = 1;
2547 
2548  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));
2549 
2550  //
2551  // Loop on the clusters, check if there is any that falls into one of the patches
2552  //
2553  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2554  {
2555  AliVCluster * clus = 0;
2556  if(clusterList) clus = (AliVCluster*) clusterList->At(iclus);
2557  else clus = fInputEvent->GetCaloCluster(iclus);
2558 
2559  if ( !clus ) continue ;
2560 
2561  if ( !clus->IsEMCAL() ) continue ;
2562 
2563  //Skip clusters with too low energy to be triggering
2564  if ( clus->E() < minE ) continue ;
2565 
2566  Float_t frac = -1;
2567  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
2568 
2569  Bool_t badCluster = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
2570  clus->GetCellsAbsId(),clus->GetNCells());
2571  UShort_t cellMax[] = {(UShort_t) absIdMax};
2572  Bool_t badCell = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),cellMax,1);
2573 
2574  // if cell is bad, it can happen that time calibration is not available,
2575  // when calculating if it is exotic, this can make it to be exotic by default
2576  // open it temporarily for this cluster
2577  if(badCell)
2578  GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(10000000);
2579 
2580  Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
2581 
2582  // Set back the time cut on exotics
2583  if(badCell)
2584  GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(exoDiffTime);
2585 
2586  // Energy threshold for exotic Ecross typically at 4 GeV,
2587  // for lower energy, check that there are more than 1 cell in the cluster
2588  if(!exotic && clus->GetNCells() < 2) exotic = kTRUE;
2589 
2590  Float_t energy = clus->E();
2591  Int_t idclus = clus->GetID();
2592 
2593  Double_t tof = clus->GetTOF();
2594  if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn() && fTriggerClusterTimeRecal){
2595  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
2596  //additional L1 phase shift
2597  if(GetCaloUtils()->GetEMCALRecoUtils()->IsL1PhaseInTimeRecalibrationOn()){
2598  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absIdMax), fInputEvent->GetBunchCrossNumber(), tof);
2599  }
2600  }
2601  tof *=1.e9;
2602 
2603  //printf("cluster %d, ID %d, E %2.2f, tof %2.2f, AbsId max %d, exotic %d, bad Cluster %d, bad Cell %d\n",
2604  // iclus,idclus, energy,tof,absIdMax, exotic, badCluster,badCell);
2605 
2606  // Find the highest energy cluster, avobe trigger threshold
2607  // in the event in case no match to trigger is found
2608  if( energy > eMax )
2609  {
2610  tofMax = tof;
2611  eMax = energy;
2612  badClMax = badCluster;
2613  badCeMax = badCell;
2614  exoMax = exotic;
2615  clusMax = iclus;
2616  idclusMax = idclus;
2617  absIdMaxMax = absIdMax;
2618  }
2619 
2620  // count the good clusters in the event avobe the trigger threshold
2621  // to check the exotic events
2622  if(!badCluster && !exotic)
2623  nOfHighECl++;
2624 
2625  // Find match to trigger
2626  if(fTriggerPatchClusterMatch && nPatch>0)
2627  {
2628  for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
2629  {
2630  Int_t absIDCell[4];
2631  GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
2632  //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2633  // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2634 
2635  for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2636  {
2637  if(absIdMax == absIDCell[ipatch])
2638  {
2639  //printf("*** Patches : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), tof);
2640  if(energy > ePatchMax)
2641  {
2642  tofPatchMax = tof;
2643  ePatchMax = energy;
2644  fIsBadCellEvent = badCluster;
2645  fIsBadMaxCellEvent = badCell;
2646  fIsExoticEvent = exotic;
2647  fTriggerClusterIndex = iclus;
2648  fTriggerClusterId = idclus;
2649  fIsTriggerMatch = kTRUE;
2650 // absIdMaxTrig = absIdMax;
2651  }
2652  }
2653  }// cell patch loop
2654  }// trigger patch loop
2655  } // Do trigger patch matching
2656 
2657  }// Cluster loop
2658 
2659  // If there was no match, assign as trigger
2660  // the highest energy cluster in the event
2661  if(!fIsTriggerMatch)
2662  {
2663  tofPatchMax = tofMax;
2664  ePatchMax = eMax;
2665  fIsBadCellEvent = badClMax;
2666  fIsBadMaxCellEvent = badCeMax;
2667  fIsExoticEvent = exoMax;
2668  fTriggerClusterIndex = clusMax;
2669  fTriggerClusterId = idclusMax;
2670  }
2671 
2672  Double_t tofPatchMaxUS = TMath::Abs(tofPatchMax);
2673 
2674  if (tofPatchMaxUS < 28 ) fTriggerClusterBC = 0 ;
2675  else if(tofPatchMaxUS < 75 ) fTriggerClusterBC = 1 ;
2676  else if(tofPatchMaxUS < 125) fTriggerClusterBC = 2 ;
2677  else if(tofPatchMaxUS < 175) fTriggerClusterBC = 3 ;
2678  else if(tofPatchMaxUS < 225) fTriggerClusterBC = 4 ;
2679  else if(tofPatchMaxUS < 275) fTriggerClusterBC = 5 ;
2680  else
2681  {
2682  //printf("AliCaloTrackReader::MatchTriggerCluster() - Large BC - tof %2.3f - Index %d\n",tofPatchMaxUS,fTriggerClusterIndex);
2684  else
2685  {
2686  fTriggerClusterIndex = -2;
2687  fTriggerClusterId = -2;
2688  }
2689  }
2690 
2691  if(tofPatchMax < 0) fTriggerClusterBC*=-1;
2692 
2693 
2694  // 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",
2695  // fTriggerClusterIndex, fTriggerClusterId,ePatchMax, tofPatchMax,
2696  // fTriggerClusterBC, fIsBadCellEvent,fIsBadMaxCellEvent,fIsExoticEvent, fIsTriggerMatch, nOfHighECl,absIdMaxMax);
2697  //
2698  // 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",
2699  // clusMax, idclusMax, eMax,tofMax, badClMax, badCeMax,exoMax);
2700 
2701  //Redo matching but open cuts
2702  if(!fIsTriggerMatch && fTriggerClusterId >= 0)
2703  {
2704  // Open time patch time
2705  TArrayI patchOpen = GetTriggerPatches(7,10);
2706 
2707  Int_t patchAbsIdOpenTime = -1;
2708  for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2709  {
2710  Int_t absIDCell[4];
2711  patchAbsIdOpenTime = patchOpen.At(iabsId);
2712  GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patchAbsIdOpenTime, absIDCell);
2713  //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2714  // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2715 
2716  for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2717  {
2718  if(absIdMaxMax == absIDCell[ipatch])
2719  {
2720  fIsTriggerMatchOpenCut[0] = kTRUE;
2721  break;
2722  }
2723  }// cell patch loop
2724  }// trigger patch loop
2725 
2726  // Check neighbour patches
2727  Int_t patchAbsId = -1;
2728  Int_t globalCol = -1;
2729  Int_t globalRow = -1;
2730  GetCaloUtils()->GetEMCALGeometry()->GetFastORIndexFromCellIndex(absIdMaxMax, patchAbsId);
2731  GetCaloUtils()->GetEMCALGeometry()->GetPositionInEMCALFromAbsFastORIndex(patchAbsId,globalCol,globalRow);
2732 
2733  // Check patches with strict time cut
2734  Int_t patchAbsIdNeigh = -1;
2735  for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2736  {
2737  if(icol < 0 || icol > 47) continue;
2738 
2739  for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2740  {
2741  if(irow < 0 || irow > 63) continue;
2742 
2743  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeigh);
2744 
2745  if ( patchAbsIdNeigh < 0 ) continue;
2746 
2747  for(Int_t iabsId =0; iabsId < patches.GetSize(); iabsId++)
2748  {
2749  if(patchAbsIdNeigh == patches.At(iabsId))
2750  {
2751  fIsTriggerMatchOpenCut[1] = kTRUE;
2752  break;
2753  }
2754  }// trigger patch loop
2755 
2756  }// row
2757  }// col
2758 
2759  // Check patches with open time cut
2760  Int_t patchAbsIdNeighOpenTime = -1;
2761  for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2762  {
2763  if(icol < 0 || icol > 47) continue;
2764 
2765  for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2766  {
2767  if(irow < 0 || irow > 63) continue;
2768 
2769  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeighOpenTime);
2770 
2771  if ( patchAbsIdNeighOpenTime < 0 ) continue;
2772 
2773  for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2774  {
2775  if(patchAbsIdNeighOpenTime == patchOpen.At(iabsId))
2776  {
2777  fIsTriggerMatchOpenCut[2] = kTRUE;
2778  break;
2779  }
2780  }// trigger patch loop
2781 
2782  }// row
2783  }// col
2784 
2785  // printf("No match, new match: Open time %d-%d, open Neigh %d-%d, both open %d-%d\n",fIsTriggerMatchOpenCut[0],patchAbsIdOpenTime,
2786  // fIsTriggerMatchOpenCut[1],patchAbsIdNeigh,
2787  // fIsTriggerMatchOpenCut[2],patchAbsIdNeighOpenTime);
2788 
2789  patchOpen.Reset();
2790 
2791  }// No trigger match found
2792  //printf("Trigger BC %d, Id %d, Index %d\n",fTriggerClusterBC,fTriggerClusterId,fTriggerClusterIndex);
2793 }
2794 
2795 //_________________________________________________________
2799 //_________________________________________________________
2801 {
2803  {
2804  // get object pointer
2805  AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
2806 
2807  if ( fBitEGA == 6 )
2808  {
2809  if (IsEventEMCALL1Gamma1()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(1);
2810  else if(IsEventEMCALL1Gamma2()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(3);
2811  else if(IsEventEMCALL1Jet1 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(0);
2812  else if(IsEventEMCALL1Jet2 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(2);
2813 
2814  // printf("L1 trigger Threshold Jet1 %f, Gamma1 %f, Jet2 %f, Gamma2 %f\n",
2815  // 0.07874*caloTrigger->GetL1Threshold(0),
2816  // 0.07874*caloTrigger->GetL1Threshold(1),
2817  // 0.07874*caloTrigger->GetL1Threshold(2),
2818  // 0.07874*caloTrigger->GetL1Threshold(3));
2819  }
2820  else
2821  {
2822  // Old AOD data format, in such case, order of thresholds different!!!
2823  if (IsEventEMCALL1Gamma1()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(0);
2824  else if(IsEventEMCALL1Gamma2()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(2);
2825  else if(IsEventEMCALL1Jet1 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(1);
2826  else if(IsEventEMCALL1Jet2 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(3);
2827 
2828  // printf("L1 trigger Threshold Jet1 %f, Gamma1 %f, Jet2 %f, Gamma2 %f\n",
2829  // 0.07874*caloTrigger->GetL1Threshold(1),
2830  // 0.07874*caloTrigger->GetL1Threshold(0),
2831  // 0.07874*caloTrigger->GetL1Threshold(3),
2832  // 0.07874*caloTrigger->GetL1Threshold(2));
2833  }
2834  }
2835 
2836  // Set L0 threshold, if not set by user
2838  {
2839  // Revise for periods > LHC11d
2840  Int_t runNumber = fInputEvent->GetRunNumber();
2841  if (runNumber < 146861) fTriggerL0EventThreshold = 3. ;
2842  else if(runNumber < 154000) fTriggerL0EventThreshold = 4. ;
2843  else if(runNumber < 165000) fTriggerL0EventThreshold = 5.5;
2844  else fTriggerL0EventThreshold = 2 ;
2845  }
2846 }
2847 
2848 //________________________________________________________
2850 //________________________________________________________
2851 void AliCaloTrackReader::Print(const Option_t * opt) const
2852 {
2853  if(! opt)
2854  return;
2855 
2856  printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
2857  printf("Task name : %s\n", fTaskName.Data()) ;
2858  printf("Data type : %d\n", fDataType) ;
2859  printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ;
2860  printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ;
2861  printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ;
2862  printf("CTS Max pT : %2.1f GeV/c\n", fCTSPtMax) ;
2863  printf("EMCAL Max pT : %2.1f GeV/c\n", fEMCALPtMax) ;
2864  printf("PHOS Max pT : %2.1f GeV/c\n", fPHOSPtMax) ;
2865  printf("EMCAL Bad Dist > %2.1f \n" , fEMCALBadChMinDist) ;
2866  printf("PHOS Bad Dist > %2.1f \n" , fPHOSBadChMinDist) ;
2867  printf("EMCAL N cells > %d \n" , fEMCALNCellsCut) ;
2868  printf("PHOS N cells > %d \n" , fPHOSNCellsCut) ;
2869  printf("EMCAL Time Cut: %3.1f < TOF < %3.1f\n", fEMCALTimeCutMin, fEMCALTimeCutMax);
2870  printf("Use CTS = %d\n", fFillCTS) ;
2871  printf("Use EMCAL = %d\n", fFillEMCAL) ;
2872  printf("Use DCAL = %d\n", fFillDCAL) ;
2873  printf("Use PHOS = %d\n", fFillPHOS) ;
2874  printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
2875  printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
2876  printf("Track status = %d\n", (Int_t) fTrackStatus) ;
2877 
2878  printf("Track Mult Eta Cut = %2.2f\n", fTrackMultEtaCut) ;
2879  printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ;
2880  printf("Recalculate Clusters = %d, E linearity = %d\n", fRecalculateClusters, fCorrectELinearity) ;
2881 
2882  printf("Use Triggers selected in SE base class %d; If not what Trigger Mask? %d; MB Trigger Mask for mixed %d \n",
2884 
2886  printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor);
2887 
2889  printf("Compare cluster pt and pt hard to accept event, factor = %2.2f",fPtHardAndClusterPtFactor);
2890 
2891  printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ;
2892  printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ;
2893  printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ;
2894 
2895  printf(" \n") ;
2896 }
2897 
2898 //__________________________________________
2902 //__________________________________________
2904 {
2905  // Count number of cells with energy larger than 0.1 in SM3, cut on this number
2906  Int_t ncellsSM3 = 0;
2907  for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++)
2908  {
2909  Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell);
2910  Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
2911  if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++;
2912  }
2913 
2914  Int_t ncellcut = 21;
2915  if(GetFiredTriggerClasses().Contains("EMC")) ncellcut = 35;
2916 
2917  if(ncellsSM3 >= ncellcut)
2918  {
2919  AliDebug(1,Form("Reject event with ncells in SM3 %d, cut %d, trig %s",
2920  ncellsSM3,ncellcut,GetFiredTriggerClasses().Data()));
2921  return kTRUE;
2922  }
2923 
2924  return kFALSE;
2925 }
2926 
2927 //_________________________________________________________
2931 //_________________________________________________________
2933 {
2934  if(label < 0) return ;
2935 
2936  AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
2937  if(!evt) return ;
2938 
2939  TClonesArray * arr = dynamic_cast<TClonesArray*>(evt->FindListObject("mcparticles")) ;
2940  if(!arr) return ;
2941 
2942  if(label < arr->GetEntriesFast())
2943  {
2944  AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(label));
2945  if(!particle) return ;
2946 
2947  if(label == particle->Label()) return ; // label already OK
2948  //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d - AOD stack %d \n",label, particle->Label());
2949  }
2950  //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d > AOD labels %d \n",label, arr->GetEntriesFast());
2951 
2952  // loop on the particles list and check if there is one with the same label
2953  for(Int_t ind = 0; ind < arr->GetEntriesFast(); ind++ )
2954  {
2955  AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(ind));
2956  if(!particle) continue ;
2957 
2958  if(label == particle->Label())
2959  {
2960  label = ind;
2961  //printf("AliAnalysisTaskEMCALClusterize::RemapMCLabelForAODs() - New Label Index %d \n",label);
2962  return;
2963  }
2964  }
2965 
2966  label = -1;
2967 
2968  //printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label not found set to -1 \n");
2969 }
2970 
2971 //___________________________________
2973 //___________________________________
2975 {
2976  if(fCTSTracks) fCTSTracks -> Clear();
2977  if(fEMCALClusters) fEMCALClusters -> Clear("C");
2978  if(fPHOSClusters) fPHOSClusters -> Clear("C");
2979 
2980  fV0ADC[0] = 0; fV0ADC[1] = 0;
2981  fV0Mul[0] = 0; fV0Mul[1] = 0;
2982 
2983  if(fNonStandardJets) fNonStandardJets -> Clear("C");
2984  fBackgroundJets->Reset();
2985 }
2986 
2987 //___________________________________________
2991 //___________________________________________
2993 {
2994  fEventTrigMinBias = kFALSE;
2995  fEventTrigCentral = kFALSE;
2996  fEventTrigSemiCentral = kFALSE;
2997  fEventTrigEMCALL0 = kFALSE;
2998  fEventTrigEMCALL1Gamma1 = kFALSE;
2999  fEventTrigEMCALL1Gamma2 = kFALSE;
3000  fEventTrigEMCALL1Jet1 = kFALSE;
3001  fEventTrigEMCALL1Jet2 = kFALSE;
3002 
3003  AliDebug(1,Form("Select trigger mask bit %d - Trigger Event %s - Select <%s>",
3005 
3006  if(fEventTriggerMask <=0 )// in case no mask set
3007  {
3008  // EMC triggered event? Which type?
3009  if( GetFiredTriggerClasses().Contains("-B-") || GetFiredTriggerClasses().Contains("-S-") || GetFiredTriggerClasses().Contains("-I-") )
3010  {
3011  if ( GetFiredTriggerClasses().Contains("EGA" ) ||
3012  GetFiredTriggerClasses().Contains("EG1" ) )
3013  {
3014  fEventTrigEMCALL1Gamma1 = kTRUE;
3015  if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
3016  }
3017  else if( GetFiredTriggerClasses().Contains("EG2" ) )
3018  {
3019  fEventTrigEMCALL1Gamma2 = kTRUE;
3020  if( !fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
3021  }
3022  else if( GetFiredTriggerClasses().Contains("EJE" ) ||
3023  GetFiredTriggerClasses().Contains("EJ1" ) )
3024  {
3025  fEventTrigEMCALL1Jet1 = kTRUE;
3026  if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") )
3027  fEventTrigEMCALL1Jet1 = kFALSE;
3028  }
3029  else if( GetFiredTriggerClasses().Contains("EJ2" ) )
3030  {
3031  fEventTrigEMCALL1Jet2 = kTRUE;
3032  if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
3033  }
3034  else if( GetFiredTriggerClasses().Contains("CEMC") &&
3035  !GetFiredTriggerClasses().Contains("EGA" ) &&
3036  !GetFiredTriggerClasses().Contains("EJE" ) &&
3037  !GetFiredTriggerClasses().Contains("EG1" ) &&
3038  !GetFiredTriggerClasses().Contains("EJ1" ) &&
3039  !GetFiredTriggerClasses().Contains("EG2" ) &&
3040  !GetFiredTriggerClasses().Contains("EJ2" ) )
3041  {
3042  fEventTrigEMCALL0 = kTRUE;
3043  }
3044 
3045  //Min bias event trigger?
3046  if (GetFiredTriggerClasses().Contains("CCENT_R2-B-NOPF-ALLNOTRD"))
3047  {
3048  fEventTrigCentral = kTRUE;
3049  }
3050  else if(GetFiredTriggerClasses().Contains("CSEMI_R1-B-NOPF-ALLNOTRD"))
3051  {
3052  fEventTrigSemiCentral = kTRUE;
3053  }
3054  else if((GetFiredTriggerClasses().Contains("CINT") || GetFiredTriggerClasses().Contains("CPBI2_B1") ) &&
3055  GetFiredTriggerClasses().Contains("-NOPF-ALLNOTRD") )
3056  {
3057  fEventTrigMinBias = kTRUE;
3058  }
3059  }
3060  }
3061  else
3062  {
3063  // EMC L1 Gamma
3064  if ( fEventTriggerMask & AliVEvent::kEMCEGA )
3065  {
3066  //printf("EGA trigger bit\n");
3067  if (GetFiredTriggerClasses().Contains("EG"))
3068  {
3069  if (GetFiredTriggerClasses().Contains("EGA")) fEventTrigEMCALL1Gamma1 = kTRUE;
3070  else
3071  {
3072  if(GetFiredTriggerClasses().Contains("EG1")) fEventTrigEMCALL1Gamma1 = kTRUE;
3073  if(GetFiredTriggerClasses().Contains("EG2")) fEventTrigEMCALL1Gamma2 = kTRUE;
3074  }
3075  }
3076  }
3077  // EMC L1 Jet
3078  else if( fEventTriggerMask & AliVEvent::kEMCEJE )
3079  {
3080  //printf("EGA trigger bit\n");
3081  if (GetFiredTriggerClasses().Contains("EJ"))
3082  {
3083  if (GetFiredTriggerClasses().Contains("EJE")) fEventTrigEMCALL1Jet1 = kTRUE;
3084  else
3085  {
3086  if(GetFiredTriggerClasses().Contains("EJ1")) fEventTrigEMCALL1Jet1 = kTRUE;
3087  if(GetFiredTriggerClasses().Contains("EJ2")) fEventTrigEMCALL1Jet2 = kTRUE;
3088  }
3089  }
3090  }
3091  // EMC L0
3092  else if((fEventTriggerMask & AliVEvent::kEMC7) ||
3093  (fEventTriggerMask & AliVEvent::kEMC1) )
3094  {
3095  //printf("L0 trigger bit\n");
3096  fEventTrigEMCALL0 = kTRUE;
3097  }
3098  // Min Bias Pb-Pb
3099  else if( fEventTriggerMask & AliVEvent::kCentral )
3100  {
3101  //printf("MB semi central trigger bit\n");
3102  fEventTrigSemiCentral = kTRUE;
3103  }
3104  // Min Bias Pb-Pb
3105  else if( fEventTriggerMask & AliVEvent::kSemiCentral )
3106  {
3107  //printf("MB central trigger bit\n");
3108  fEventTrigCentral = kTRUE;
3109  }
3110  // Min Bias pp, PbPb, pPb
3111  else if((fEventTriggerMask & AliVEvent::kMB ) ||
3112  (fEventTriggerMask & AliVEvent::kINT7) ||
3113  (fEventTriggerMask & AliVEvent::kINT8) ||
3114  (fEventTriggerMask & AliVEvent::kAnyINT) )
3115  {
3116  //printf("MB trigger bit\n");
3117  fEventTrigMinBias = kTRUE;
3118  }
3119  }
3120 
3121  AliDebug(1,Form("Event bits: \n \t MB %d, Cen %d, Sem %d, L0 %d, L1G1 %d, L1G2 %d, L1J1 %d, L1J2 %d",
3125 
3126  // L1 trigger bit
3127  if( fBitEGA == 0 && fBitEJE == 0 )
3128  {
3129  // Init the trigger bit once, correct depending on AliESD(AOD)CaloTrigger header version
3130 
3131  // Simpler way to do it ...
3132 // if( fInputEvent->GetRunNumber() < 172000 )
3133 // reader->SetEventTriggerL1Bit(4,5); // current LHC11 data
3134 // else
3135 // reader->SetEventTriggerL1Bit(6,8); // LHC12-13 data
3136 
3137  // Old values
3138  fBitEGA = 4;
3139  fBitEJE = 5;
3140 
3141  TFile* file = AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile();
3142 
3143  const TList *clist = file->GetStreamerInfoCache();
3144 
3145  if(clist)
3146  {
3147  TStreamerInfo *cinfo = (TStreamerInfo*)clist->FindObject("AliESDCaloTrigger");
3148  Int_t verid = 5; // newer ESD header version
3149  if(!cinfo)
3150  {
3151  cinfo = (TStreamerInfo*)clist->FindObject("AliAODCaloTrigger");
3152  verid = 3; // newer AOD header version
3153  }
3154 
3155  if(cinfo)
3156  {
3157  Int_t classversionid = cinfo->GetClassVersion();
3158  //printf("********* Header class version %d *********** \n",classversionid);
3159 
3160  if (classversionid >= verid)
3161  {
3162  fBitEGA = 6;
3163  fBitEJE = 8;
3164  }
3165  } else AliInfo("AliCaloTrackReader()::SetEventTriggerBit() - Streamer info for trigger class not available, bit not changed");
3166  } else AliInfo("AliCaloTrackReader::SetEventTriggerBit() - Streamer list not available!, bit not changed");
3167 
3168  } // set once the EJE, EGA trigger bit
3169 }
3170 
3171 //____________________________________________________________
3174 //____________________________________________________________
3175 void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)
3176 {
3177  fInputEvent = input;
3178  fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ;
3179  if (fMixedEvent)
3180  fNMixedEvent = fMixedEvent->GetNumberOfEvents() ;
3181 
3182  //Delete previous vertex
3183  if(fVertex)
3184  {
3185  for (Int_t i = 0; i < fNMixedEvent; i++)
3186  {
3187  delete [] fVertex[i] ;
3188  }
3189  delete [] fVertex ;
3190  }
3191 
3192  fVertex = new Double_t*[fNMixedEvent] ;
3193  for (Int_t i = 0; i < fNMixedEvent; i++)
3194  {
3195  fVertex[i] = new Double_t[3] ;
3196  fVertex[i][0] = 0.0 ;
3197  fVertex[i][1] = 0.0 ;
3198  fVertex[i][2] = 0.0 ;
3199  }
3200 }
3201 
3202 
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.
double Double_t
Definition: External.C:58
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
Int_t fSmearNLMMin
Do smearing for clusters with at least this value.
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.
int Int_t
Definition: External.C:63
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
Definition: External.C:204
TString GetFiredTriggerClasses() const
Bool_t ReadStack() const
unsigned int UInt_t
Definition: External.C:33
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.
float Float_t
Definition: External.C:68
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.
unsigned long ULong_t
Definition: External.C:38
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.
Int_t GetNumberOfLocalMaxima(AliVCluster *cluster, AliVCaloCells *cells)
Find the number of local maxima in cluster.
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
Int_t fSmearNLMMax
Do smearing for clusters with at maximum this value.
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.
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.
unsigned short UShort_t
Definition: External.C:28
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.
const char Option_t
Definition: External.C:48
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.
bool Bool_t
Definition: External.C:53
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.
ClassImp(AliAnalysisTaskCascadeTester) AliAnalysisTaskCascadeTester
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