AliPhysics  7273240 (7273240)
 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  else if (fSmearingFunction == kNoSmearing)
1955  {
1956  clus->SetM02( clus->GetM02() );
1957  }
1958  //clus->SetM02( fRandom.Landau(clus->GetM02(), fSmearShowerShapeWidth) );
1959  AliDebug(2,Form("Width %2.4f Smeared : %2.4f\n", fSmearShowerShapeWidth,clus->GetM02()));
1960  }
1961 
1962  //--------------------------------------------------------
1963  // Fill the corresponding array with the selected clusters
1964  // Usually just filling EMCal array with upper or lower clusters is enough,
1965  // but maybe we want to do EMCal-DCal correlations.
1966 
1967  //if((fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10)
1968  AliDebug(2,Form("Selected clusters (EMCAL%d, DCAL%d), E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1969  bEMCAL,bDCAL,fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1970 
1971 
1972  if (bEMCAL) fEMCALClusters->Add(clus);
1973  else if(bDCAL ) fDCALClusters ->Add(clus);
1974 
1975  // TODO, not sure if needed anymore
1976  if (fMixedEvent)
1977  clus->SetID(iclus) ;
1978 }
1979 
1980 //_______________________________________
1987 //_______________________________________
1989 {
1990  AliDebug(1,"Begin");
1991 
1992  // First recalibrate cells, time or energy
1993  // if(GetCaloUtils()->IsRecalibrationOn())
1994  // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(),
1995  // GetEMCALCells(),
1996  // fInputEvent->GetBunchCrossNumber());
1997 
1998  fNPileUpClusters = 0; // Init counter
1999  fNNonPileUpClusters = 0; // Init counter
2000  for(Int_t i = 0; i < 19; i++)
2001  {
2002  fEMCalBCEvent [i] = 0;
2003  fEMCalBCEventCut[i] = 0;
2004  }
2005 
2006  //Loop to select clusters in fiducial cut and fill container with aodClusters
2007  if(fEMCALClustersListName=="")
2008  {
2009  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2010  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2011  {
2012  AliVCluster * clus = 0;
2013  if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
2014  {
2015  if (clus->IsEMCAL())
2016  {
2017  FillInputEMCALAlgorithm(clus, iclus);
2018  }//EMCAL cluster
2019  }// cluster exists
2020  }// cluster loop
2021 
2022  //Recalculate track matching
2024 
2025  }//Get the clusters from the input event
2026  else
2027  {
2028  TClonesArray * clusterList = 0x0;
2029 
2030  if (fInputEvent->FindListObject(fEMCALClustersListName))
2031  {
2032  clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
2033  }
2034  else if(fOutputEvent)
2035  {
2036  clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
2037  }
2038 
2039  if(!clusterList)
2040  {
2041  AliWarning(Form("Wrong name of list with clusters? <%s>",fEMCALClustersListName.Data()));
2042  return;
2043  }
2044 
2045  Int_t nclusters = clusterList->GetEntriesFast();
2046  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2047  {
2048  AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus));
2049  //printf("E %f\n",clus->E());
2050  if (clus) FillInputEMCALAlgorithm(clus, iclus);
2051  else AliWarning("Null cluster in list!");
2052  }// cluster loop
2053 
2054  // Recalculate the pile-up time, in case long time clusters removed during clusterization
2055  //printf("Input event INIT : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
2056 
2057  fNPileUpClusters = 0; // Init counter
2058  fNNonPileUpClusters = 0; // Init counter
2059  for(Int_t i = 0; i < 19; i++)
2060  {
2061  fEMCalBCEvent [i] = 0;
2062  fEMCalBCEventCut[i] = 0;
2063  }
2064 
2065  for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++)
2066  {
2067  AliVCluster * clus = 0;
2068 
2069  if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
2070  {
2071  if (clus->IsEMCAL())
2072  {
2073 
2074  Float_t frac =-1;
2075  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
2076  Double_t tof = clus->GetTOF();
2077  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
2078  //additional L1 phase shift
2079  if(GetCaloUtils()->GetEMCALRecoUtils()->IsL1PhaseInTimeRecalibrationOn())
2080  {
2081  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absIdMax), fInputEvent->GetBunchCrossNumber(), tof);
2082  }
2083 
2084  tof*=1e9;
2085 
2086  //printf("Input event cluster : AbsIdMax %d, E %2.2f, time %2.2f \n", absIdMax,clus->E(),tof);
2087 
2088  //Reject clusters with bad channels, close to borders and exotic;
2089  if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) continue;
2090 
2091  Int_t bc = TMath::Nint(tof/50) + 9;
2092  SetEMCalEventBC(bc);
2093 
2094  if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) continue ;
2095 
2096  clus->GetMomentum(fMomentum, fVertex[0]);
2097 
2098  if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kEMCAL)) return ;
2099 
2100  SetEMCalEventBCcut(bc);
2101 
2102  if(!IsInTimeWindow(tof,clus->E()))
2103  fNPileUpClusters++ ;
2104  else
2106 
2107  }
2108  }
2109  }
2110 
2111  //printf("Input event : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
2112 
2113  // Recalculate track matching, not necessary if already done in the reclusterization task.
2114  // in case it was not done ...
2116 
2117  }
2118 
2119  AliDebug(1,Form("AOD entries %d, n pile-up clusters %d, n non pile-up %d", fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters));
2120 }
2121 
2122 //_______________________________________
2124 //_______________________________________
2126 {
2127  AliDebug(1,"Begin");
2128 
2129  // Loop to select clusters in fiducial cut and fill container with aodClusters
2130  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2131  TString genName;
2132  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2133  {
2134  AliVCluster * clus = fInputEvent->GetCaloCluster(iclus) ;
2135  if ( !clus ) continue ;
2136 
2137  if ( !clus->IsPHOS() ) continue ;
2138 
2139  if(clus->GetLabel() >=0 ) // -1 corresponds to noisy MC
2140  {
2141  if ( !AcceptParticleMCLabel(clus->GetLabel()) ) continue ;
2142  }
2143 
2144  fhPHOSClusterCutsE[0]->Fill(clus->E());
2145 
2146  // Skip CPV input
2147  if( clus->GetType() == AliVCluster::kPHOSCharged ) continue ;
2148 
2149  fhPHOSClusterCutsE[1]->Fill(clus->E());
2150 
2151  //---------------------------------------------
2152  // Old feature, try to rely on PHOS tender
2153  //
2155  {
2156  // Recalibrate the cluster energy
2158  {
2159  Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
2160  clus->SetE(energy);
2161  }
2162  }
2163 
2164  //----------------------------------------------------------------------------------
2165  // Check if the cluster contains any bad channel and if close to calorimeter borders
2166  //
2167  // Old feature, try to rely on PHOS tender
2168  if( GetCaloUtils()->ClusterContainsBadChannel(kPHOS,clus->GetCellsAbsId(), clus->GetNCells()))
2169  continue;
2170 
2171  if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells()))
2172  continue;
2173 
2174  // TODO, add exotic cut???
2175 
2176  fhPHOSClusterCutsE[2]->Fill(clus->E());
2177 
2178  // TODO Dead code? remove?
2179  Int_t vindex = 0 ;
2180  if (fMixedEvent)
2181  vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
2182 
2183  clus->GetMomentum(fMomentum, fVertex[vindex]);
2184 
2185  //----------------------------------------------------------------------------------
2186  // Remove clusters close to borders
2187  //
2189  continue ;
2190 
2191  fhPHOSClusterCutsE[3]->Fill(clus->E());
2192 
2193  //----------------------------------------------------------------------------------
2194  // Remove clusters with too low energy
2195  //
2196  if (fPHOSPtMin > fMomentum.E() || fPHOSPtMax < fMomentum.E() )
2197  continue ;
2198 
2199  fhPHOSClusterCutsE[4]->Fill(clus->E());
2200 
2201  //----------------------------------------------------
2202  // Apply N cells cut
2203  //
2204  if(clus->GetNCells() <= fPHOSNCellsCut && fDataType != AliCaloTrackReader::kMC) return ;
2205 
2206  // Check effect of n cells cut
2207  fhPHOSClusterCutsE[5]->Fill(clus->E());
2208 
2209  //----------------------------------------------------
2210  // Apply distance to bad channel cut
2211  //
2212  Double_t distBad = clus->GetDistanceToBadChannel() ; //Distance to bad channel
2213 
2214  if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
2215 
2216  if(distBad < fPHOSBadChMinDist) return ;
2217 
2218  // Check effect distance to bad channel cut
2219  fhPHOSClusterCutsE[6]->Fill(clus->E());
2220 
2221  // TODO, add time cut
2222 
2223  //----------------------------------------------------------------------------------
2224  // Add selected clusters to array
2225  //
2226  //if(fDebug > 2 && fMomentum.E() > 0.1)
2227  AliDebug(2,Form("Selected clusters E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
2228  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
2229 
2230  fPHOSClusters->Add(clus);
2231 
2232  // TODO Dead code? remove?
2233  if (fMixedEvent)
2234  clus->SetID(iclus) ;
2235 
2236  } // esd/aod cluster loop
2237 
2238  AliDebug(1,Form("AOD entries %d",fPHOSClusters->GetEntriesFast())) ;
2239 }
2240 
2241 //____________________________________________
2243 //____________________________________________
2245 {
2246  fEMCALCells = fInputEvent->GetEMCALCells();
2247 }
2248 
2249 //___________________________________________
2251 //___________________________________________
2253 {
2254  fPHOSCells = fInputEvent->GetPHOSCells();
2255 }
2256 
2257 //_______________________________________
2260 //_______________________________________
2262 {
2263  AliVVZERO* v0 = fInputEvent->GetVZEROData();
2264  //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
2265 
2266  if (v0)
2267  {
2268  AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0);
2269  for (Int_t i = 0; i < 32; i++)
2270  {
2271  if(esdV0)
2272  {//Only available in ESDs
2273  fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i);
2274  fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i);
2275  }
2276 
2277  fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i);
2278  fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i);
2279  }
2280 
2281  AliDebug(1,Form("ADC (%d,%d), Multiplicity (%d,%d)",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]));
2282  }
2283  else
2284  {
2285  AliDebug(1,"Cannot retrieve V0 ESD! Run w/ null V0 charges");
2286  }
2287 }
2288 
2289 //_________________________________________________
2293 //_________________________________________________
2295 {
2296  AliDebug(2,"Begin");
2297 
2298  //
2299  //check if branch name is given
2300  if(!fInputNonStandardJetBranchName.Length())
2301  {
2302  fInputEvent->Print();
2303  AliFatal("No non-standard jet branch name specified. Specify among existing ones.");
2304  }
2305 
2306  fNonStandardJets = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fInputNonStandardJetBranchName.Data()));
2307 
2308  if(!fNonStandardJets)
2309  {
2310  //check if jet branch exist; exit if not
2311  fInputEvent->Print();
2312 
2313  AliFatal(Form("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputNonStandardJetBranchName.Data()));
2314  }
2315  else
2316  {
2317  AliDebug(1,Form("AOD input jets %d", fNonStandardJets->GetEntriesFast()));
2318  }
2319 }
2320 
2321 //_________________________________________________
2325 //_________________________________________________
2327 {
2328  AliDebug(1,"Begin");
2329  //
2330  //check if branch name is given
2331  if(!fInputBackgroundJetBranchName.Length())
2332  {
2333  fInputEvent->Print();
2334 
2335  AliFatal("No background jet branch name specified. Specify among existing ones.");
2336  }
2337 
2338  fBackgroundJets = (AliAODJetEventBackground*)(fInputEvent->FindListObject(fInputBackgroundJetBranchName.Data()));
2339 
2340  if(!fBackgroundJets)
2341  {
2342  //check if jet branch exist; exit if not
2343  fInputEvent->Print();
2344 
2345  AliFatal(Form("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputBackgroundJetBranchName.Data()));
2346  }
2347  else
2348  {
2349  AliDebug(1,"FillInputBackgroundJets");
2350  fBackgroundJets->Print("");
2351  }
2352 }
2353 
2354 //____________________________________________________________________
2360 //____________________________________________________________________
2362 {
2363  // init some variables
2364  Int_t trigtimes[30], globCol, globRow,ntimes, i;
2365  Int_t absId = -1; //[100];
2366  Int_t nPatch = 0;
2367 
2368  TArrayI patches(0);
2369 
2370  // get object pointer
2371  AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
2372 
2373  if(!caloTrigger)
2374  {
2375  AliError("Trigger patches input (AliVCaloTrigger) not available in data!");
2376  return patches;
2377  }
2378 
2379  //printf("CaloTrigger Entries %d\n",caloTrigger->GetEntries() );
2380 
2381  // class is not empty
2382  if( caloTrigger->GetEntries() > 0 )
2383  {
2384  // must reset before usage, or the class will fail
2385  caloTrigger->Reset();
2386 
2387  // go throuth the trigger channels
2388  while( caloTrigger->Next() )
2389  {
2390  // get position in global 2x2 tower coordinates
2391  caloTrigger->GetPosition( globCol, globRow );
2392 
2393  //L0
2394  if(IsEventEMCALL0())
2395  {
2396  // get dimension of time arrays
2397  caloTrigger->GetNL0Times( ntimes );
2398 
2399  // no L0s in this channel
2400  // presence of the channel in the iterator still does not guarantee that L0 was produced!!
2401  if( ntimes < 1 )
2402  continue;
2403 
2404  // get timing array
2405  caloTrigger->GetL0Times( trigtimes );
2406  //printf("Get L0 patch : n times %d - trigger time window %d - %d\n",ntimes, tmin,tmax);
2407 
2408  // go through the array
2409  for( i = 0; i < ntimes; i++ )
2410  {
2411  // check if in cut - 8,9 shall be accepted in 2011
2412  if( trigtimes[i] >= tmin && trigtimes[i] <= tmax )
2413  {
2414  //printf("Accepted trigger time %d \n",trigtimes[i]);
2415  //if(nTrig > 99) continue;
2416  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absId);
2417  //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId);
2418  patches.Set(nPatch+1);
2419  patches.AddAt(absId,nPatch++);
2420  }
2421  } // trigger time array
2422  }//L0
2423  else if(IsEventEMCALL1()) // L1
2424  {
2425  Int_t bit = 0;
2426  caloTrigger->GetTriggerBits(bit);
2427 
2428  Int_t sum = 0;
2429  caloTrigger->GetL1TimeSum(sum);
2430  //fBitEGA-=2;
2431  Bool_t isEGA1 = ((bit >> fBitEGA ) & 0x1) && IsEventEMCALL1Gamma1() ;
2432  Bool_t isEGA2 = ((bit >> (fBitEGA+1)) & 0x1) && IsEventEMCALL1Gamma2() ;
2433  Bool_t isEJE1 = ((bit >> fBitEJE ) & 0x1) && IsEventEMCALL1Jet1 () ;
2434  Bool_t isEJE2 = ((bit >> (fBitEJE+1)) & 0x1) && IsEventEMCALL1Jet2 () ;
2435 
2436  //if((bit>> fBitEGA )&0x1) printf("Trig Bit %d - bit %d - EG1 %d - EG2 %d\n",fBitEGA ,bit,IsEventEMCALL1Gamma1(),IsEventEMCALL1Gamma2());
2437  //if((bit>>(fBitEGA+1))&0x1) printf("Trig Bit %d - bit %d - EG1 %d - EG2 %d\n",fBitEGA+1,bit,IsEventEMCALL1Gamma1(),IsEventEMCALL1Gamma2());
2438 
2439  if(!isEGA1 && !isEJE1 && !isEGA2 && !isEJE2) continue;
2440 
2441  Int_t patchsize = -1;
2442  if (isEGA1 || isEGA2) patchsize = 2;
2443  else if (isEJE1 || isEJE2) patchsize = 16;
2444 
2445  //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",
2446  // bit,sum,patchsize,isEGA1,isEGA2,isEJE1,isEJE2,fBitEGA,fBitEJE,IsEventEMCALL1Gamma(),IsEventEMCALL1Jet());
2447 
2448 
2449  // add 2x2 (EGA) or 16x16 (EJE) patches
2450  for(Int_t irow=0; irow < patchsize; irow++)
2451  {
2452  for(Int_t icol=0; icol < patchsize; icol++)
2453  {
2454  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol+icol,globRow+irow, absId);
2455  //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId);
2456  patches.Set(nPatch+1);
2457  patches.AddAt(absId,nPatch++);
2458  }
2459  }
2460 
2461  } // L1
2462 
2463  } // trigger iterator
2464  } // go through triggers
2465 
2466  if(patches.GetSize()<=0) AliInfo(Form("No patch found! for triggers: %s and selected <%s>",
2468  //else printf(">>>>> N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nPatch, patches.At(0), patches.At(patches.GetSize()-1));
2469 
2470  return patches;
2471 }
2472 
2473 //____________________________________________________________
2477 //____________________________________________________________
2479 {
2480  // Init info from previous event
2481  fTriggerClusterIndex = -1;
2482  fTriggerClusterId = -1;
2483  fTriggerClusterBC = -10000;
2484  fIsExoticEvent = kFALSE;
2485  fIsBadCellEvent = kFALSE;
2486  fIsBadMaxCellEvent = kFALSE;
2487 
2488  fIsTriggerMatch = kFALSE;
2489  fIsTriggerMatchOpenCut[0] = kFALSE;
2490  fIsTriggerMatchOpenCut[1] = kFALSE;
2491  fIsTriggerMatchOpenCut[2] = kFALSE;
2492 
2493  // Do only analysis for triggered events
2494  if(!IsEventEMCALL1() && !IsEventEMCALL0())
2495  {
2496  fTriggerClusterBC = 0;
2497  return;
2498  }
2499 
2500  //printf("***** Try to match trigger to cluster %d **** L0 %d, L1 %d\n",fTriggerPatchClusterMatch,IsEventEMCALL0(),IsEventEMCALL1());
2501 
2502  //Recover the list of clusters
2503  TClonesArray * clusterList = 0;
2504  if (fInputEvent->FindListObject(fEMCALClustersListName))
2505  {
2506  clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
2507  }
2508  else if(fOutputEvent)
2509  {
2510  clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
2511  }
2512 
2513  // Get number of clusters and of trigger patches
2514  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2515  if(clusterList)
2516  nclusters = clusterList->GetEntriesFast();
2517 
2518  Int_t nPatch = patches.GetSize();
2519  Float_t exoDiffTime = GetCaloUtils()->GetEMCALRecoUtils()->GetExoticCellDiffTimeCut();
2520 
2521  //Init some variables used in the cluster loop
2522  Float_t tofPatchMax = 100000;
2523  Float_t ePatchMax =-1;
2524 
2525  Float_t tofMax = 100000;
2526  Float_t eMax =-1;
2527 
2528  Int_t clusMax =-1;
2529  Int_t idclusMax =-1;
2530  Bool_t badClMax = kFALSE;
2531  Bool_t badCeMax = kFALSE;
2532  Bool_t exoMax = kFALSE;
2533 // Int_t absIdMaxTrig= -1;
2534  Int_t absIdMaxMax = -1;
2535 
2536  Int_t nOfHighECl = 0 ;
2537 
2538  //
2539  // Check what is the trigger threshold
2540  // set minimu energym of candidate for trigger cluster
2541  //
2543 
2544  Float_t triggerThreshold = fTriggerL1EventThreshold;
2545  if(IsEventEMCALL0()) triggerThreshold = fTriggerL0EventThreshold;
2546  Float_t minE = triggerThreshold / 2.;
2547 
2548  // This method is not really suitable for JET trigger
2549  // but in case, reduce the energy cut since we do not trigger on high energy particle
2550  if(IsEventEMCALL1Jet() || minE < 1) minE = 1;
2551 
2552  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));
2553 
2554  //
2555  // Loop on the clusters, check if there is any that falls into one of the patches
2556  //
2557  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2558  {
2559  AliVCluster * clus = 0;
2560  if(clusterList) clus = (AliVCluster*) clusterList->At(iclus);
2561  else clus = fInputEvent->GetCaloCluster(iclus);
2562 
2563  if ( !clus ) continue ;
2564 
2565  if ( !clus->IsEMCAL() ) continue ;
2566 
2567  //Skip clusters with too low energy to be triggering
2568  if ( clus->E() < minE ) continue ;
2569 
2570  Float_t frac = -1;
2571  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
2572 
2573  Bool_t badCluster = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
2574  clus->GetCellsAbsId(),clus->GetNCells());
2575  UShort_t cellMax[] = {(UShort_t) absIdMax};
2576  Bool_t badCell = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),cellMax,1);
2577 
2578  // if cell is bad, it can happen that time calibration is not available,
2579  // when calculating if it is exotic, this can make it to be exotic by default
2580  // open it temporarily for this cluster
2581  if(badCell)
2582  GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(10000000);
2583 
2584  Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
2585 
2586  // Set back the time cut on exotics
2587  if(badCell)
2588  GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(exoDiffTime);
2589 
2590  // Energy threshold for exotic Ecross typically at 4 GeV,
2591  // for lower energy, check that there are more than 1 cell in the cluster
2592  if(!exotic && clus->GetNCells() < 2) exotic = kTRUE;
2593 
2594  Float_t energy = clus->E();
2595  Int_t idclus = clus->GetID();
2596 
2597  Double_t tof = clus->GetTOF();
2598  if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn() && fTriggerClusterTimeRecal){
2599  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
2600  //additional L1 phase shift
2601  if(GetCaloUtils()->GetEMCALRecoUtils()->IsL1PhaseInTimeRecalibrationOn()){
2602  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absIdMax), fInputEvent->GetBunchCrossNumber(), tof);
2603  }
2604  }
2605  tof *=1.e9;
2606 
2607  //printf("cluster %d, ID %d, E %2.2f, tof %2.2f, AbsId max %d, exotic %d, bad Cluster %d, bad Cell %d\n",
2608  // iclus,idclus, energy,tof,absIdMax, exotic, badCluster,badCell);
2609 
2610  // Find the highest energy cluster, avobe trigger threshold
2611  // in the event in case no match to trigger is found
2612  if( energy > eMax )
2613  {
2614  tofMax = tof;
2615  eMax = energy;
2616  badClMax = badCluster;
2617  badCeMax = badCell;
2618  exoMax = exotic;
2619  clusMax = iclus;
2620  idclusMax = idclus;
2621  absIdMaxMax = absIdMax;
2622  }
2623 
2624  // count the good clusters in the event avobe the trigger threshold
2625  // to check the exotic events
2626  if(!badCluster && !exotic)
2627  nOfHighECl++;
2628 
2629  // Find match to trigger
2630  if(fTriggerPatchClusterMatch && nPatch>0)
2631  {
2632  for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
2633  {
2634  Int_t absIDCell[4];
2635  GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
2636  //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2637  // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2638 
2639  for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2640  {
2641  if(absIdMax == absIDCell[ipatch])
2642  {
2643  //printf("*** Patches : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), tof);
2644  if(energy > ePatchMax)
2645  {
2646  tofPatchMax = tof;
2647  ePatchMax = energy;
2648  fIsBadCellEvent = badCluster;
2649  fIsBadMaxCellEvent = badCell;
2650  fIsExoticEvent = exotic;
2651  fTriggerClusterIndex = iclus;
2652  fTriggerClusterId = idclus;
2653  fIsTriggerMatch = kTRUE;
2654 // absIdMaxTrig = absIdMax;
2655  }
2656  }
2657  }// cell patch loop
2658  }// trigger patch loop
2659  } // Do trigger patch matching
2660 
2661  }// Cluster loop
2662 
2663  // If there was no match, assign as trigger
2664  // the highest energy cluster in the event
2665  if(!fIsTriggerMatch)
2666  {
2667  tofPatchMax = tofMax;
2668  ePatchMax = eMax;
2669  fIsBadCellEvent = badClMax;
2670  fIsBadMaxCellEvent = badCeMax;
2671  fIsExoticEvent = exoMax;
2672  fTriggerClusterIndex = clusMax;
2673  fTriggerClusterId = idclusMax;
2674  }
2675 
2676  Double_t tofPatchMaxUS = TMath::Abs(tofPatchMax);
2677 
2678  if (tofPatchMaxUS < 28 ) fTriggerClusterBC = 0 ;
2679  else if(tofPatchMaxUS < 75 ) fTriggerClusterBC = 1 ;
2680  else if(tofPatchMaxUS < 125) fTriggerClusterBC = 2 ;
2681  else if(tofPatchMaxUS < 175) fTriggerClusterBC = 3 ;
2682  else if(tofPatchMaxUS < 225) fTriggerClusterBC = 4 ;
2683  else if(tofPatchMaxUS < 275) fTriggerClusterBC = 5 ;
2684  else
2685  {
2686  //printf("AliCaloTrackReader::MatchTriggerCluster() - Large BC - tof %2.3f - Index %d\n",tofPatchMaxUS,fTriggerClusterIndex);
2688  else
2689  {
2690  fTriggerClusterIndex = -2;
2691  fTriggerClusterId = -2;
2692  }
2693  }
2694 
2695  if(tofPatchMax < 0) fTriggerClusterBC*=-1;
2696 
2697 
2698  // 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",
2699  // fTriggerClusterIndex, fTriggerClusterId,ePatchMax, tofPatchMax,
2700  // fTriggerClusterBC, fIsBadCellEvent,fIsBadMaxCellEvent,fIsExoticEvent, fIsTriggerMatch, nOfHighECl,absIdMaxMax);
2701  //
2702  // 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",
2703  // clusMax, idclusMax, eMax,tofMax, badClMax, badCeMax,exoMax);
2704 
2705  //Redo matching but open cuts
2706  if(!fIsTriggerMatch && fTriggerClusterId >= 0)
2707  {
2708  // Open time patch time
2709  TArrayI patchOpen = GetTriggerPatches(7,10);
2710 
2711  Int_t patchAbsIdOpenTime = -1;
2712  for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2713  {
2714  Int_t absIDCell[4];
2715  patchAbsIdOpenTime = patchOpen.At(iabsId);
2716  GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patchAbsIdOpenTime, absIDCell);
2717  //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2718  // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2719 
2720  for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2721  {
2722  if(absIdMaxMax == absIDCell[ipatch])
2723  {
2724  fIsTriggerMatchOpenCut[0] = kTRUE;
2725  break;
2726  }
2727  }// cell patch loop
2728  }// trigger patch loop
2729 
2730  // Check neighbour patches
2731  Int_t patchAbsId = -1;
2732  Int_t globalCol = -1;
2733  Int_t globalRow = -1;
2734  GetCaloUtils()->GetEMCALGeometry()->GetFastORIndexFromCellIndex(absIdMaxMax, patchAbsId);
2735  GetCaloUtils()->GetEMCALGeometry()->GetPositionInEMCALFromAbsFastORIndex(patchAbsId,globalCol,globalRow);
2736 
2737  // Check patches with strict time cut
2738  Int_t patchAbsIdNeigh = -1;
2739  for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2740  {
2741  if(icol < 0 || icol > 47) continue;
2742 
2743  for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2744  {
2745  if(irow < 0 || irow > 63) continue;
2746 
2747  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeigh);
2748 
2749  if ( patchAbsIdNeigh < 0 ) continue;
2750 
2751  for(Int_t iabsId =0; iabsId < patches.GetSize(); iabsId++)
2752  {
2753  if(patchAbsIdNeigh == patches.At(iabsId))
2754  {
2755  fIsTriggerMatchOpenCut[1] = kTRUE;
2756  break;
2757  }
2758  }// trigger patch loop
2759 
2760  }// row
2761  }// col
2762 
2763  // Check patches with open time cut
2764  Int_t patchAbsIdNeighOpenTime = -1;
2765  for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2766  {
2767  if(icol < 0 || icol > 47) continue;
2768 
2769  for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2770  {
2771  if(irow < 0 || irow > 63) continue;
2772 
2773  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeighOpenTime);
2774 
2775  if ( patchAbsIdNeighOpenTime < 0 ) continue;
2776 
2777  for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2778  {
2779  if(patchAbsIdNeighOpenTime == patchOpen.At(iabsId))
2780  {
2781  fIsTriggerMatchOpenCut[2] = kTRUE;
2782  break;
2783  }
2784  }// trigger patch loop
2785 
2786  }// row
2787  }// col
2788 
2789  // printf("No match, new match: Open time %d-%d, open Neigh %d-%d, both open %d-%d\n",fIsTriggerMatchOpenCut[0],patchAbsIdOpenTime,
2790  // fIsTriggerMatchOpenCut[1],patchAbsIdNeigh,
2791  // fIsTriggerMatchOpenCut[2],patchAbsIdNeighOpenTime);
2792 
2793  patchOpen.Reset();
2794 
2795  }// No trigger match found
2796  //printf("Trigger BC %d, Id %d, Index %d\n",fTriggerClusterBC,fTriggerClusterId,fTriggerClusterIndex);
2797 }
2798 
2799 //_________________________________________________________
2803 //_________________________________________________________
2805 {
2807  {
2808  // get object pointer
2809  AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
2810 
2811  if ( fBitEGA == 6 )
2812  {
2813  if (IsEventEMCALL1Gamma1()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(1);
2814  else if(IsEventEMCALL1Gamma2()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(3);
2815  else if(IsEventEMCALL1Jet1 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(0);
2816  else if(IsEventEMCALL1Jet2 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(2);
2817 
2818  // printf("L1 trigger Threshold Jet1 %f, Gamma1 %f, Jet2 %f, Gamma2 %f\n",
2819  // 0.07874*caloTrigger->GetL1Threshold(0),
2820  // 0.07874*caloTrigger->GetL1Threshold(1),
2821  // 0.07874*caloTrigger->GetL1Threshold(2),
2822  // 0.07874*caloTrigger->GetL1Threshold(3));
2823  }
2824  else
2825  {
2826  // Old AOD data format, in such case, order of thresholds different!!!
2827  if (IsEventEMCALL1Gamma1()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(0);
2828  else if(IsEventEMCALL1Gamma2()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(2);
2829  else if(IsEventEMCALL1Jet1 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(1);
2830  else if(IsEventEMCALL1Jet2 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(3);
2831 
2832  // printf("L1 trigger Threshold Jet1 %f, Gamma1 %f, Jet2 %f, Gamma2 %f\n",
2833  // 0.07874*caloTrigger->GetL1Threshold(1),
2834  // 0.07874*caloTrigger->GetL1Threshold(0),
2835  // 0.07874*caloTrigger->GetL1Threshold(3),
2836  // 0.07874*caloTrigger->GetL1Threshold(2));
2837  }
2838  }
2839 
2840  // Set L0 threshold, if not set by user
2842  {
2843  // Revise for periods > LHC11d
2844  Int_t runNumber = fInputEvent->GetRunNumber();
2845  if (runNumber < 146861) fTriggerL0EventThreshold = 3. ;
2846  else if(runNumber < 154000) fTriggerL0EventThreshold = 4. ;
2847  else if(runNumber < 165000) fTriggerL0EventThreshold = 5.5;
2848  else fTriggerL0EventThreshold = 2 ;
2849  }
2850 }
2851 
2852 //________________________________________________________
2854 //________________________________________________________
2855 void AliCaloTrackReader::Print(const Option_t * opt) const
2856 {
2857  if(! opt)
2858  return;
2859 
2860  printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
2861  printf("Task name : %s\n", fTaskName.Data()) ;
2862  printf("Data type : %d\n", fDataType) ;
2863  printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ;
2864  printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ;
2865  printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ;
2866  printf("CTS Max pT : %2.1f GeV/c\n", fCTSPtMax) ;
2867  printf("EMCAL Max pT : %2.1f GeV/c\n", fEMCALPtMax) ;
2868  printf("PHOS Max pT : %2.1f GeV/c\n", fPHOSPtMax) ;
2869  printf("EMCAL Bad Dist > %2.1f \n" , fEMCALBadChMinDist) ;
2870  printf("PHOS Bad Dist > %2.1f \n" , fPHOSBadChMinDist) ;
2871  printf("EMCAL N cells > %d \n" , fEMCALNCellsCut) ;
2872  printf("PHOS N cells > %d \n" , fPHOSNCellsCut) ;
2873  printf("EMCAL Time Cut: %3.1f < TOF < %3.1f\n", fEMCALTimeCutMin, fEMCALTimeCutMax);
2874  printf("Use CTS = %d\n", fFillCTS) ;
2875  printf("Use EMCAL = %d\n", fFillEMCAL) ;
2876  printf("Use DCAL = %d\n", fFillDCAL) ;
2877  printf("Use PHOS = %d\n", fFillPHOS) ;
2878  printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
2879  printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
2880  printf("Track status = %d\n", (Int_t) fTrackStatus) ;
2881 
2882  printf("Track Mult Eta Cut = %2.2f\n", fTrackMultEtaCut) ;
2883  printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ;
2884  printf("Recalculate Clusters = %d, E linearity = %d\n", fRecalculateClusters, fCorrectELinearity) ;
2885 
2886  printf("Use Triggers selected in SE base class %d; If not what Trigger Mask? %d; MB Trigger Mask for mixed %d \n",
2888 
2890  printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor);
2891 
2893  printf("Compare cluster pt and pt hard to accept event, factor = %2.2f",fPtHardAndClusterPtFactor);
2894 
2895  printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ;
2896  printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ;
2897  printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ;
2898 
2899  printf(" \n") ;
2900 }
2901 
2902 //__________________________________________
2906 //__________________________________________
2908 {
2909  // Count number of cells with energy larger than 0.1 in SM3, cut on this number
2910  Int_t ncellsSM3 = 0;
2911  for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++)
2912  {
2913  Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell);
2914  Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
2915  if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++;
2916  }
2917 
2918  Int_t ncellcut = 21;
2919  if(GetFiredTriggerClasses().Contains("EMC")) ncellcut = 35;
2920 
2921  if(ncellsSM3 >= ncellcut)
2922  {
2923  AliDebug(1,Form("Reject event with ncells in SM3 %d, cut %d, trig %s",
2924  ncellsSM3,ncellcut,GetFiredTriggerClasses().Data()));
2925  return kTRUE;
2926  }
2927 
2928  return kFALSE;
2929 }
2930 
2931 //_________________________________________________________
2935 //_________________________________________________________
2937 {
2938  if(label < 0) return ;
2939 
2940  AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
2941  if(!evt) return ;
2942 
2943  TClonesArray * arr = dynamic_cast<TClonesArray*>(evt->FindListObject("mcparticles")) ;
2944  if(!arr) return ;
2945 
2946  if(label < arr->GetEntriesFast())
2947  {
2948  AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(label));
2949  if(!particle) return ;
2950 
2951  if(label == particle->Label()) return ; // label already OK
2952  //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d - AOD stack %d \n",label, particle->Label());
2953  }
2954  //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d > AOD labels %d \n",label, arr->GetEntriesFast());
2955 
2956  // loop on the particles list and check if there is one with the same label
2957  for(Int_t ind = 0; ind < arr->GetEntriesFast(); ind++ )
2958  {
2959  AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(ind));
2960  if(!particle) continue ;
2961 
2962  if(label == particle->Label())
2963  {
2964  label = ind;
2965  //printf("AliAnalysisTaskEMCALClusterize::RemapMCLabelForAODs() - New Label Index %d \n",label);
2966  return;
2967  }
2968  }
2969 
2970  label = -1;
2971 
2972  //printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label not found set to -1 \n");
2973 }
2974 
2975 //___________________________________
2977 //___________________________________
2979 {
2980  if(fCTSTracks) fCTSTracks -> Clear();
2981  if(fEMCALClusters) fEMCALClusters -> Clear("C");
2982  if(fPHOSClusters) fPHOSClusters -> Clear("C");
2983 
2984  fV0ADC[0] = 0; fV0ADC[1] = 0;
2985  fV0Mul[0] = 0; fV0Mul[1] = 0;
2986 
2987  if(fNonStandardJets) fNonStandardJets -> Clear("C");
2988  fBackgroundJets->Reset();
2989 }
2990 
2991 //___________________________________________
2995 //___________________________________________
2997 {
2998  fEventTrigMinBias = kFALSE;
2999  fEventTrigCentral = kFALSE;
3000  fEventTrigSemiCentral = kFALSE;
3001  fEventTrigEMCALL0 = kFALSE;
3002  fEventTrigEMCALL1Gamma1 = kFALSE;
3003  fEventTrigEMCALL1Gamma2 = kFALSE;
3004  fEventTrigEMCALL1Jet1 = kFALSE;
3005  fEventTrigEMCALL1Jet2 = kFALSE;
3006 
3007  AliDebug(1,Form("Select trigger mask bit %d - Trigger Event %s - Select <%s>",
3009 
3010  if(fEventTriggerMask <=0 )// in case no mask set
3011  {
3012  // EMC triggered event? Which type?
3013  if( GetFiredTriggerClasses().Contains("-B-") || GetFiredTriggerClasses().Contains("-S-") || GetFiredTriggerClasses().Contains("-I-") )
3014  {
3015  if ( GetFiredTriggerClasses().Contains("EGA" ) ||
3016  GetFiredTriggerClasses().Contains("EG1" ) )
3017  {
3018  fEventTrigEMCALL1Gamma1 = kTRUE;
3019  if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
3020  }
3021  else if( GetFiredTriggerClasses().Contains("EG2" ) )
3022  {
3023  fEventTrigEMCALL1Gamma2 = kTRUE;
3024  if( !fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
3025  }
3026  else if( GetFiredTriggerClasses().Contains("EJE" ) ||
3027  GetFiredTriggerClasses().Contains("EJ1" ) )
3028  {
3029  fEventTrigEMCALL1Jet1 = kTRUE;
3030  if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") )
3031  fEventTrigEMCALL1Jet1 = kFALSE;
3032  }
3033  else if( GetFiredTriggerClasses().Contains("EJ2" ) )
3034  {
3035  fEventTrigEMCALL1Jet2 = kTRUE;
3036  if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
3037  }
3038  else if( GetFiredTriggerClasses().Contains("CEMC") &&
3039  !GetFiredTriggerClasses().Contains("EGA" ) &&
3040  !GetFiredTriggerClasses().Contains("EJE" ) &&
3041  !GetFiredTriggerClasses().Contains("EG1" ) &&
3042  !GetFiredTriggerClasses().Contains("EJ1" ) &&
3043  !GetFiredTriggerClasses().Contains("EG2" ) &&
3044  !GetFiredTriggerClasses().Contains("EJ2" ) )
3045  {
3046  fEventTrigEMCALL0 = kTRUE;
3047  }
3048 
3049  //Min bias event trigger?
3050  if (GetFiredTriggerClasses().Contains("CCENT_R2-B-NOPF-ALLNOTRD"))
3051  {
3052  fEventTrigCentral = kTRUE;
3053  }
3054  else if(GetFiredTriggerClasses().Contains("CSEMI_R1-B-NOPF-ALLNOTRD"))
3055  {
3056  fEventTrigSemiCentral = kTRUE;
3057  }
3058  else if((GetFiredTriggerClasses().Contains("CINT") || GetFiredTriggerClasses().Contains("CPBI2_B1") ) &&
3059  GetFiredTriggerClasses().Contains("-NOPF-ALLNOTRD") )
3060  {
3061  fEventTrigMinBias = kTRUE;
3062  }
3063  }
3064  }
3065  else
3066  {
3067  // EMC L1 Gamma
3068  if ( fEventTriggerMask & AliVEvent::kEMCEGA )
3069  {
3070  //printf("EGA trigger bit\n");
3071  if (GetFiredTriggerClasses().Contains("EG"))
3072  {
3073  if (GetFiredTriggerClasses().Contains("EGA")) fEventTrigEMCALL1Gamma1 = kTRUE;
3074  else
3075  {
3076  if(GetFiredTriggerClasses().Contains("EG1")) fEventTrigEMCALL1Gamma1 = kTRUE;
3077  if(GetFiredTriggerClasses().Contains("EG2")) fEventTrigEMCALL1Gamma2 = kTRUE;
3078  }
3079  }
3080  }
3081  // EMC L1 Jet
3082  else if( fEventTriggerMask & AliVEvent::kEMCEJE )
3083  {
3084  //printf("EGA trigger bit\n");
3085  if (GetFiredTriggerClasses().Contains("EJ"))
3086  {
3087  if (GetFiredTriggerClasses().Contains("EJE")) fEventTrigEMCALL1Jet1 = kTRUE;
3088  else
3089  {
3090  if(GetFiredTriggerClasses().Contains("EJ1")) fEventTrigEMCALL1Jet1 = kTRUE;
3091  if(GetFiredTriggerClasses().Contains("EJ2")) fEventTrigEMCALL1Jet2 = kTRUE;
3092  }
3093  }
3094  }
3095  // EMC L0
3096  else if((fEventTriggerMask & AliVEvent::kEMC7) ||
3097  (fEventTriggerMask & AliVEvent::kEMC1) )
3098  {
3099  //printf("L0 trigger bit\n");
3100  fEventTrigEMCALL0 = kTRUE;
3101  }
3102  // Min Bias Pb-Pb
3103  else if( fEventTriggerMask & AliVEvent::kCentral )
3104  {
3105  //printf("MB semi central trigger bit\n");
3106  fEventTrigSemiCentral = kTRUE;
3107  }
3108  // Min Bias Pb-Pb
3109  else if( fEventTriggerMask & AliVEvent::kSemiCentral )
3110  {
3111  //printf("MB central trigger bit\n");
3112  fEventTrigCentral = kTRUE;
3113  }
3114  // Min Bias pp, PbPb, pPb
3115  else if((fEventTriggerMask & AliVEvent::kMB ) ||
3116  (fEventTriggerMask & AliVEvent::kINT7) ||
3117  (fEventTriggerMask & AliVEvent::kINT8) ||
3118  (fEventTriggerMask & AliVEvent::kAnyINT) )
3119  {
3120  //printf("MB trigger bit\n");
3121  fEventTrigMinBias = kTRUE;
3122  }
3123  }
3124 
3125  AliDebug(1,Form("Event bits: \n \t MB %d, Cen %d, Sem %d, L0 %d, L1G1 %d, L1G2 %d, L1J1 %d, L1J2 %d",
3129 
3130  // L1 trigger bit
3131  if( fBitEGA == 0 && fBitEJE == 0 )
3132  {
3133  // Init the trigger bit once, correct depending on AliESD(AOD)CaloTrigger header version
3134 
3135  // Simpler way to do it ...
3136 // if( fInputEvent->GetRunNumber() < 172000 )
3137 // reader->SetEventTriggerL1Bit(4,5); // current LHC11 data
3138 // else
3139 // reader->SetEventTriggerL1Bit(6,8); // LHC12-13 data
3140 
3141  // Old values
3142  fBitEGA = 4;
3143  fBitEJE = 5;
3144 
3145  TFile* file = AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile();
3146 
3147  const TList *clist = file->GetStreamerInfoCache();
3148 
3149  if(clist)
3150  {
3151  TStreamerInfo *cinfo = (TStreamerInfo*)clist->FindObject("AliESDCaloTrigger");
3152  Int_t verid = 5; // newer ESD header version
3153  if(!cinfo)
3154  {
3155  cinfo = (TStreamerInfo*)clist->FindObject("AliAODCaloTrigger");
3156  verid = 3; // newer AOD header version
3157  }
3158 
3159  if(cinfo)
3160  {
3161  Int_t classversionid = cinfo->GetClassVersion();
3162  //printf("********* Header class version %d *********** \n",classversionid);
3163 
3164  if (classversionid >= verid)
3165  {
3166  fBitEGA = 6;
3167  fBitEJE = 8;
3168  }
3169  } else AliInfo("AliCaloTrackReader()::SetEventTriggerBit() - Streamer info for trigger class not available, bit not changed");
3170  } else AliInfo("AliCaloTrackReader::SetEventTriggerBit() - Streamer list not available!, bit not changed");
3171 
3172  } // set once the EJE, EGA trigger bit
3173 }
3174 
3175 //____________________________________________________________
3178 //____________________________________________________________
3179 void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)
3180 {
3181  fInputEvent = input;
3182  fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ;
3183  if (fMixedEvent)
3184  fNMixedEvent = fMixedEvent->GetNumberOfEvents() ;
3185 
3186  //Delete previous vertex
3187  if(fVertex)
3188  {
3189  for (Int_t i = 0; i < fNMixedEvent; i++)
3190  {
3191  delete [] fVertex[i] ;
3192  }
3193  delete [] fVertex ;
3194  }
3195 
3196  fVertex = new Double_t*[fNMixedEvent] ;
3197  for (Int_t i = 0; i < fNMixedEvent; i++)
3198  {
3199  fVertex[i] = new Double_t[3] ;
3200  fVertex[i][0] = 0.0 ;
3201  fVertex[i][1] = 0.0 ;
3202  fVertex[i][2] = 0.0 ;
3203  }
3204 }
3205 
3206 
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.
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()
void RecalculateClusterTrackMatching(AliVEvent *event, TObjArray *clusterArray=0x0, AliMCEvent *mc=0x0)
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.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Bool_t fRecalculateClusters
Correct clusters, recalculate them if recalibration parameters is given.
Bool_t fDoRejectNoTrackEvents
Reject events with no selected tracks in event.
Bool_t IsEventEMCALL1Jet2() const
Float_t fEMCALBadChMinDist
Minimal distance to bad channel to accept cluster in EMCal, cell units.
Bool_t fReadStack
Access kine information from stack.
Bool_t fIsTriggerMatchOpenCut[3]
Could not match the event to a trigger patch?, retry opening cuts.
UInt_t fMixEventTriggerMask
Select this triggerered event for mixing, tipically kMB or kAnyINT.
Float_t RadToDeg(Float_t rad) const
TFile * file
virtual void FillVertexArray()
Bool_t IsInTimeWindow(Double_t tof, Float_t energy) const
Bool_t fRemoveUnMatchedTriggers
Analyze events where trigger patch and cluster where found or not.
virtual Double_t GetEventPlaneAngle() const
void SetPythiaEventHeader(AliGenPythiaEventHeader *py)
Definition: AliAnaWeights.h:79
TObjArray * fCTSTracks
Temporal array with tracks.
Int_t fTriggerPatchTimeWindow[2]
Trigger patch selection window.
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.
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