AliPhysics  775474e (775474e)
 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), fMCGenerEventHeaderToAccept("")
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  if ( !generOK ) AliDebug(1, Form("skip label %d, gen %s",mcLabel,genName.Data()) );
292 
293  return generOK;
294 }
295 
296 //_____________________________________________________
299 //_____________________________________________________
301 {
302  Int_t nReject = fRejectEventsWithBit.GetSize();
303 
304  //printf("N reject %d\n", nReject);
305 
306  if( nReject <= 0 )
307  return kTRUE ; // accept the event
308 
309  UInt_t trigFired = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
310 
311  for(Int_t ibit = 0; ibit < nReject; ibit++)
312  {
313  Bool_t reject = (trigFired & fRejectEventsWithBit.At(ibit));
314 
315  //printf("reject %d, ibit %d, bit %d \n",reject, ibit,fRejectEventsWithBit.At(ibit));
316  if(reject) return kFALSE ; // reject the event
317  }
318 
319  return kTRUE ; // accept the event
320 }
321 
322 //_____________________________________________
326 //_____________________________________________
328 {
329  //-----------------------------------------------------------
330  // Reject events depending on the trigger name
331  //-----------------------------------------------------------
332 
333  AliDebug(1,Form("FiredTriggerClass <%s>, selected class <%s>, compare name %d",
336 
337  if ( fFiredTriggerClassName != "" )
338  {
340  return kFALSE;
341  else
342  AliDebug(1,"Accepted triggered event");
343  }
344 
345  fhNEventsAfterCut->Fill(1.5);
346 
347  //-----------------------------------------------------------
348  // Reject events depending on the event species type
349  //-----------------------------------------------------------
350 
351  // Event types:
352  // kStartOfRun = 1, // START_OF_RUN
353  // kEndOfRun = 2, // END_OF_RUN
354  // kStartOfRunFiles = 3, // START_OF_RUN_FILES
355  // kEndOfRunFiles = 4, // END_OF_RUN_FILES
356  // kStartOfBurst = 5, // START_OF_BURST
357  // kEndOfBurst = 6, // END_OF_BURST
358  // kPhysicsEvent = 7, // PHYSICS_EVENT
359  // kCalibrationEvent = 8, // CALIBRATION_EVENT
360  // kFormatError = 9, // EVENT_FORMAT_ERROR
361  // kStartOfData = 10, // START_OF_DATA
362  // kEndOfData = 11, // END_OF_DATA
363  // kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT
364  // kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT
365 
366  Int_t eventType = 0;
367  if(fInputEvent->GetHeader())
368  eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType();
369 
370  AliDebug(3,Form("Event type %d",eventType));
371 
372  // Select only Physics events in data, eventType = 7,
373  // usually done by physics selection
374  // MC not set, eventType =0, I think, so do not apply a value to fEventType by default
375  // LED events have eventType = 8, implemented a selection cut in the past
376  // but not really useful for EMCal data since LED are not reconstructed (unless wrongly assumed as physics)
377 
378  if ( fEventType >= 0 && eventType != fEventType ) return kFALSE ;
379 
380  AliDebug(1,"Pass event species selection");
381 
382  fhNEventsAfterCut->Fill(2.5);
383 
384  //-----------------------------------------------------------------
385  // In case of mixing analysis, select here the trigger of the event
386  //-----------------------------------------------------------------
387 
388  UInt_t isTrigger = kFALSE;
389  UInt_t isMB = kFALSE;
390 
391  if(!fEventTriggerAtSE)
392  {
393  // In case of mixing analysis, accept MB events, not only Trigger
394  // Track and cluster arrays filled for MB in order to create the pool in the corresponding analysis
395  // via de method in the base class FillMixedEventPool()
396 
397  AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
398  AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
399 
400  if(!inputHandler) return kFALSE ; // to content coverity
401 
402  isTrigger = inputHandler->IsEventSelected() & fEventTriggerMask;
403  isMB = inputHandler->IsEventSelected() & fMixEventTriggerMask;
404 
405  if(!isTrigger && !isMB) return kFALSE;
406 
407  //printf("Selected triggered event : %s\n",GetFiredTriggerClasses().Data());
408  AliDebug(0,"Pass uninteresting triggered events rejection in case of mixing analysis");
409 
410  fhNEventsAfterCut->Fill(3.5);
411  }
412 
413 
414  //-------------------------------------------------------------------------------------
415  // Reject or accept events depending on the trigger bit
416  //-------------------------------------------------------------------------------------
417 
420 
421  //printf("AliCaloTrackReader::FillInputEvent() - Accept event? %d, Reject event %d? \n",okA,okR);
422 
423  if(!okA || !okR) return kFALSE;
424 
425  AliDebug(1,"Pass event bit rejection");
426 
427  fhNEventsAfterCut->Fill(4.5);
428 
429  //----------------------------------------------------------------------
430  // Do not count events that were likely triggered by an exotic cluster
431  // or out BC cluster
432  //----------------------------------------------------------------------
433 
434  // Set a bit with the event kind, MB, L0, L1 ...
436 
437  // In case of Mixing, avoid checking the triggers in the min bias events
438  if(!fEventTriggerAtSE && (isMB && !isTrigger)) return kTRUE;
439 
441  {
443  {
444  // Reject triggered events when there is coincidence on both EMCal trigger thresholds,
445  // but the requested trigger is the low trigger threshold
446  if(IsEventEMCALL1Jet1 () && IsEventEMCALL1Jet2 () && fFiredTriggerClassName.Contains("EJ2")) return kFALSE;
447  if(IsEventEMCALL1Gamma1() && IsEventEMCALL1Gamma2() && fFiredTriggerClassName.Contains("EG2")) return kFALSE;
448  }
449 
450  //Get Patches that triggered
452 
453  MatchTriggerCluster(patches);
454 
455  patches.Reset();
456 
457  // If requested, remove badly triggeed events, but only when the EMCal trigger bit is set
459  {
460  AliDebug(1,Form("ACCEPT triggered event? \n exotic? %d - bad cell %d - bad Max cell %d - BC %d - Matched %d\n",
462  if (fIsExoticEvent) return kFALSE;
463  else if(fIsBadCellEvent) return kFALSE;
464  else if(fRemoveUnMatchedTriggers && !fIsTriggerMatch) return kFALSE ;
465  else if(fTriggerClusterBC != 0) return kFALSE;
466  AliDebug(1,Form("\t *** YES for %s",GetFiredTriggerClasses().Data()));
467  }
468 
469  AliDebug(1,"Pass EMCal triggered event rejection \n");
470 
471  fhNEventsAfterCut->Fill(5.5);
472  }
473 
474  //-------------------------------------------------------------------------------------
475  // Select events only fired by a certain trigger configuration if it is provided
476  //-------------------------------------------------------------------------------------
477 
478  if (GetFiredTriggerClasses().Contains("FAST") && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster)
479  {
480  AliDebug(1,Form("Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data()));
481  return kFALSE;
482 
483  fhNEventsAfterCut->Fill(6.5);
484  }
485 
486  //-------------------------------------------------------------------------------------
487  // Reject event if large clusters with large energy
488  // Use only for LHC11a data for the moment, and if input is clusterizer V1 or V1+unfolding
489  // If clusterzer NxN or V2 it does not help
490  //-------------------------------------------------------------------------------------
491 
492  //Int_t run = fInputEvent->GetRunNumber();
493 
494  if ( fRemoveLEDEvents )
495  {
497 
498  if(reject) return kFALSE;
499 
500  AliDebug(1,"Pass LED event rejection");
501 
502  fhNEventsAfterCut->Fill(7.5);
503  } // Remove LED events
504 
505  // All selection criteria passed, accept the event
506  return kTRUE ;
507 }
508 
509 //________________________________________________
514 //________________________________________________
516 {
517  //printf("AliCaloTrackReader::ComparePtHardAndJetPt() - GenHeaderName : %s\n",GetGenEventHeader()->ClassName());
518 
519  if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
520  {
521  TParticle * jet = 0;
522  AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
523  Int_t nTriggerJets = pygeh->NTriggerJets();
524  Float_t ptHard = pygeh->GetPtHard();
525 
526  AliDebug(1,Form("Njets: %d, pT Hard %f",nTriggerJets, ptHard));
527 
528  Float_t tmpjet[]={0,0,0,0};
529  for(Int_t ijet = 0; ijet< nTriggerJets; ijet++)
530  {
531  pygeh->TriggerJet(ijet, tmpjet);
532  jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
533 
534  AliDebug(1,Form("jet %d; pycell jet pT %f",ijet, jet->Pt()));
535 
536  //Compare jet pT and pt Hard
537  if(jet->Pt() > fPtHardAndJetPtFactor * ptHard)
538  {
539  AliInfo(Form("Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n",
540  ptHard, jet->Pt(), fPtHardAndJetPtFactor));
541  return kFALSE;
542  }
543  }
544 
545  if(jet) delete jet;
546  }
547 
548  return kTRUE ;
549 }
550 
551 //____________________________________________________
556 //____________________________________________________
558 {
559  if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
560  {
561  AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
562  Float_t ptHard = pygeh->GetPtHard();
563 
564  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
565  for (Int_t iclus = 0; iclus < nclusters; iclus++)
566  {
567  AliVCluster * clus = fInputEvent->GetCaloCluster(iclus) ;
568  Float_t ecluster = clus->E();
569 
570  if(ecluster > fPtHardAndClusterPtFactor*ptHard)
571  {
572  AliInfo(Form("Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f",ecluster,clus->GetType(),fPtHardAndClusterPtFactor,ptHard));
573 
574  return kFALSE;
575  }
576  }
577 
578  }
579 
580  return kTRUE ;
581 }
582 
583 //___________________________________________________
586 //___________________________________________________
588 {
589 
590  fhNEventsAfterCut = new TH1I("hNEventsAfterCut", "Number of analyzed events", 19, 0, 19) ;
591  //fhNEventsAfterCut->SetXTitle("Selection");
592  fhNEventsAfterCut->SetYTitle("# events");
593  fhNEventsAfterCut->GetXaxis()->SetBinLabel(1 ,"1=Input");
594  fhNEventsAfterCut->GetXaxis()->SetBinLabel(2 ,"2=Trigger string");
595  fhNEventsAfterCut->GetXaxis()->SetBinLabel(3 ,"3=Event Type");
596  fhNEventsAfterCut->GetXaxis()->SetBinLabel(4 ,"4=Mixing Event");
597  fhNEventsAfterCut->GetXaxis()->SetBinLabel(5 ,"5=Trigger Bit");
598  fhNEventsAfterCut->GetXaxis()->SetBinLabel(6 ,"6=Good EMC Trigger");
599  fhNEventsAfterCut->GetXaxis()->SetBinLabel(7 ,"7=!Fast Cluster");
600  fhNEventsAfterCut->GetXaxis()->SetBinLabel(8 ,"8=!LED");
601  fhNEventsAfterCut->GetXaxis()->SetBinLabel(9 ,"9=Time stamp");
602  fhNEventsAfterCut->GetXaxis()->SetBinLabel(10,"10=Z vertex");
603  fhNEventsAfterCut->GetXaxis()->SetBinLabel(11,"11=Primary vertex");
604  fhNEventsAfterCut->GetXaxis()->SetBinLabel(12,"12=Pile-up");
605  fhNEventsAfterCut->GetXaxis()->SetBinLabel(13,"13=V0AND");
606  fhNEventsAfterCut->GetXaxis()->SetBinLabel(14,"14=Centrality");
607  fhNEventsAfterCut->GetXaxis()->SetBinLabel(15,"15=GenHeader");
608  fhNEventsAfterCut->GetXaxis()->SetBinLabel(16,"16=PtHard-Jet");
609  fhNEventsAfterCut->GetXaxis()->SetBinLabel(17,"17=PtHard-Cluster");
610  fhNEventsAfterCut->GetXaxis()->SetBinLabel(18,"18=Track multi.");
611  fhNEventsAfterCut->GetXaxis()->SetBinLabel(19,"19=TOF BC");
613 
614 
615  if(fFillEMCAL)
616  {
617  for(Int_t i = 0; i < 8; i++)
618  {
619  TString names[] = {"NoCut", "Corrected", "GoodCluster", "NonLinearity",
620  "EnergyAndFidutial", "Time", "NCells", "BadDist"};
621 
622  fhEMCALClusterCutsE[i] = new TH1F(Form("hEMCALReaderClusterCuts_%d_%s",i,names[i].Data()),
623  Form("EMCal %d, %s",i,names[i].Data()),
625  fhEMCALClusterCutsE[i]->SetYTitle("# clusters");
626  fhEMCALClusterCutsE[i]->SetXTitle("#it{E} (GeV)");
628  }
629  }
630 
631  if(fFillPHOS)
632  {
633  for(Int_t i = 0; i < 7; i++)
634  {
635  TString names[] = {"NoCut", "ExcludeCPV", "BorderCut", "FiducialCut", "EnergyCut", "NCells", "BadDist"};
636 
637  fhPHOSClusterCutsE[i] = new TH1F(Form("hPHOSReaderClusterCuts_%d_%s",i,names[i].Data()),
638  Form("PHOS Cut %d, %s",i,names[i].Data()),
640  fhPHOSClusterCutsE[i]->SetYTitle("# clusters");
641  fhPHOSClusterCutsE[i]->SetXTitle("#it{E} (GeV)");
643  }
644  }
645 
646  if(fFillCTS)
647  {
648  for(Int_t i = 0; i < 6; i++)
649  {
650  TString names[] = {"NoCut", "Status", "ESD_AOD", "TOF", "DCA","PtAcceptanceMult"};
651 
652  fhCTSTrackCutsPt[i] = new TH1F(Form("hCTSReaderClusterCuts_%d_%s",i,names[i].Data()),
653  Form("CTS Cut %d, %s",i,names[i].Data()),
655  fhCTSTrackCutsPt[i]->SetYTitle("# tracks");
656  fhCTSTrackCutsPt[i]->SetXTitle("#it{p}_{T} (GeV)");
658  }
659  }
660 
661  return fOutputContainer ;
662 }
663 
664 //_____________________________________________________
666 //_____________________________________________________
668 {
669  TString parList ; //this will be list of parameters used for this analysis.
670 
671  const Int_t buffersize = 255;
672  char onePar[buffersize] ;
673 
674  snprintf(onePar,buffersize,"--- Reader ---:") ;
675  parList+=onePar ;
676  snprintf(onePar,buffersize,"Data type: %d; zvertex cut %2.2f; EMC cluster name: <%s> ",fDataType, fZvtxCut, fEMCALClustersListName.Data()) ;
677  parList+=onePar ;
678  snprintf(onePar,buffersize,"Use detector: EMC %d, DCA %d, PHOS %d, CTS %d, EMCcells %d, PHOScells %d ; ",
680  snprintf(onePar,buffersize,"E-pT window: EMC (%2.1f,%2.1f), PHOS (%2.1f,%2.1f), CTS (%2.1f,%2.1f); ",
682  parList+=onePar ;
683  snprintf(onePar,buffersize,"Dist to bad channel: EMC > %2.1f, PHOS > %2.1f; ",fEMCALBadChMinDist,fPHOSBadChMinDist) ;
684  parList+=onePar ;
685  snprintf(onePar,buffersize,"N cells: EMC > %d, PHOS > %d; ",fEMCALNCellsCut,fPHOSNCellsCut) ;
686  parList+=onePar ;
687  snprintf(onePar,buffersize,"EMC time cut single window (%2.2f,%2.2f); ",fEMCALTimeCutMin,fEMCALTimeCutMax) ;
688  parList+=onePar ;
689  snprintf(onePar,buffersize,"Check: calo fid cut %d; ",fCheckFidCut) ;
690  parList+=onePar ;
691  snprintf(onePar,buffersize,"Track: status %d, multip. eta cut %1.1f, SPD hit %d; ",(Int_t) fTrackStatus, fTrackMultEtaCut, fSelectSPDHitTracks) ;
692  parList+=onePar ;
693 
694  if(fUseTrackDCACut)
695  {
696  snprintf(onePar,buffersize,"DCA cut ON, param (%2.4f,%2.4f,%2.4f); ",fTrackDCACut[0],fTrackDCACut[1],fTrackDCACut[2]) ;
697  parList+=onePar ;
698  }
699 
700  snprintf(onePar,buffersize,"Recalculate Clusters = %d, E linearity = %d; ",fRecalculateClusters, fCorrectELinearity) ;
701  parList+=onePar ;
702 
703  snprintf(onePar,buffersize,"SE trigger sel. %d, not? trigger Mask? %d, MB Trigger Mask for mixed %d; ",
705  parList+=onePar ;
706 
707  snprintf(onePar,buffersize,"Select fired trigger %s; Remove Bad trigger event %d, unmatched %d; Accept fastcluster %d, Reject LED %d ",
709  parList+=onePar ;
710 
712  {
713  snprintf(onePar,buffersize,"Accept only labels from: ");
714  parList+=onePar ;
715  for(Int_t i = 0; i< fNMCGenerToAccept; i++)
716  parList+=(fMCGenerToAccept[i]+" ") ;
717 
718  snprintf(onePar,buffersize,"; ");
719  parList+=onePar ;
720  }
721 
723  {
724  snprintf(onePar,buffersize,"EMC M02 smear ON, function %d, param %2.4f, %d<=NLM<=%d; ",
726  parList+=onePar ;
727  }
728 
730  {
731  snprintf(onePar,buffersize,"jet pt / pt hard < %2.1f; ",fPtHardAndJetPtFactor);
732  parList+=onePar ;
733  }
734 
736  {
737  snprintf(onePar,buffersize,"cluster pt / pt hard < %2.2f",fPtHardAndClusterPtFactor);
738  parList+=onePar ;
739  }
740 
741  snprintf(onePar,buffersize,"Centrality: Class %s, Option %d, Bin [%d,%d]; New centrality %d; Event plane method %s; ",
743  parList+=onePar ;
744 
745  return new TObjString(parList) ;
746 }
747 
748 
749 //____________________________________________
751 //____________________________________________
753 {
754  if(fMC)
755  return fMC->Stack();
756  else
757  {
758  AliDebug(1,"Stack is not available");
759  return 0x0 ;
760  }
761 }
762 
763 //______________________________________________
765 //______________________________________________
767 {
768  if(fMC)
769  {
770  return fMC->Header();
771  }
772  else
773  {
774  AliInfo("Header is not available");
775  return 0x0 ;
776  }
777 }
778 
779 //______________________________________________________________
781 //______________________________________________________________
782 AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const
783 {
784  if (ReadStack() && fMC)
785  {
786  AliGenEventHeader * eventHeader = fMC->GenEventHeader();
787 
788  if(fMCGenerEventHeaderToAccept=="") return eventHeader ;
789 
790  AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader);
791 
792  if(!cocktail) return 0x0 ;
793 
794  TList *genHeaders = cocktail->GetHeaders();
795 
796  Int_t nGenerators = genHeaders->GetEntries();
797 
798  for(Int_t igen = 0; igen < nGenerators; igen++)
799  {
800  AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ;
801  TString name = eventHeader2->GetName();
802  //printf("ESD Event header %d %s\n",igen,name.Data());
803 
804  if(name.Contains(fMCGenerEventHeaderToAccept,TString::kIgnoreCase))
805  return eventHeader2 ;
806  }
807 
808  return 0x0;
809 
810  }
811  else if(ReadAODMCParticles() && GetAODMCHeader())
812  {
813  Int_t nGenerators = GetAODMCHeader()->GetNCocktailHeaders();
814 
815  if( nGenerators <= 0) return 0x0;
816 
817  if(fMCGenerEventHeaderToAccept=="") return GetAODMCHeader()->GetCocktailHeader(0);
818 
819  for(Int_t igen = 0; igen < nGenerators; igen++)
820  {
821  AliGenEventHeader * eventHeader = GetAODMCHeader()->GetCocktailHeader(igen) ;
822  TString name = eventHeader->GetName();
823  //printf("AOD Event header %d %s\n",igen,name.Data());
824 
825  if(name.Contains(fMCGenerEventHeaderToAccept,TString::kIgnoreCase))
826  return eventHeader ;
827  }
828 
829  return 0x0;
830 
831  }
832  else
833  {
834  return 0x0;
835  }
836 }
837 
838 //_________________________________________________________
841 //_________________________________________________________
843 {
844  AliInfo("Input are not AODs");
845 
846  return NULL ;
847 }
848 
849 //________________________________________________________
852 //________________________________________________________
853 AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader() const
854 {
855  AliInfo("Input are not AODs");
856 
857  return NULL ;
858 }
859 
860 //___________________________________________________________
868 //___________________________________________________________
869 Int_t AliCaloTrackReader::GetVertexBC(const AliVVertex * vtx)
870 {
871  Int_t vertexBC=vtx->GetBC();
872 
873  if(!fRecalculateVertexBC) return vertexBC;
874 
875  // Value not available, recalculate it.
876 
877  Double_t bz = fInputEvent->GetMagneticField();
878  Bool_t bc0 = kFALSE;
879  Int_t ntr = GetCTSTracks()->GetEntriesFast();
880  //printf("N Tracks %d\n",ntr);
881 
882  for(Int_t i = 0 ; i < ntr ; i++)
883  {
884  AliVTrack * track = (AliVTrack*) (GetCTSTracks()->At(i));
885 
886  //Check if has TOF info, if not skip
887  ULong_t status = track->GetStatus();
888  Bool_t okTOF = (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ;
889  vertexBC = track->GetTOFBunchCrossing(bz);
890  Float_t pt = track->Pt();
891 
892  if(!okTOF) continue;
893 
894  // Get DCA x, y
895  Double_t dca[2] = {1e6,1e6};
896  Double_t covar[3] = {1e6,1e6,1e6};
897  track->PropagateToDCA(vtx,bz,100.,dca,covar);
898 
899  if(AcceptDCA(pt,dca[0]))
900  {
901  if (vertexBC !=0 && fVertexBC != AliVTrack::kTOFBCNA) return vertexBC;
902  else if(vertexBC == 0) bc0 = kTRUE;
903  }
904  }
905 
906  if( bc0 ) vertexBC = 0 ;
907  else vertexBC = AliVTrack::kTOFBCNA ;
908 
909  return vertexBC;
910 }
911 
912 //_____________________________
919 //_____________________________
921 {
922  return track->GetID();
923 }
924 
925 //_____________________________
928 //_____________________________
930 {
932  {
933  AliInfo("Cannot access stack and mcparticles at the same time, change them");
934  fReadStack = kFALSE;
935  fReadAODMCParticles = kFALSE;
936  }
937 
938  // Activate debug level in AliAnaWeights
939  if( fWeightUtils->GetDebug() >= 0 )
940  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(fWeightUtils->ClassName(), fWeightUtils->GetDebug());
941 }
942 
943 //_______________________________________
945 //_______________________________________
947 {
948  fDataType = kESD ;
949  fCTSPtMin = 0.1 ;
950  fEMCALPtMin = 0.1 ;
951  fPHOSPtMin = 0.1 ;
952  fCTSPtMax = 1000. ;
953  fEMCALPtMax = 1000. ;
954  fPHOSPtMax = 1000. ;
955 
956  fEMCALBadChMinDist = 0; // open, 2; // standard
957  fPHOSBadChMinDist = 0; // open, 2; // standard
958 
959  fEMCALNCellsCut = 0; // open, 1; // standard
960  fPHOSNCellsCut = 0; // open, 2; // standard
961 
962  //Track DCA cuts
963  // dca_xy cut = 0.0105+0.0350/TMath::Power(pt,1.1);
964  fTrackDCACut[0] = 0.0105;
965  fTrackDCACut[1] = 0.0350;
966  fTrackDCACut[2] = 1.1;
967 
968  //Do not filter the detectors input by default.
969  fFillEMCAL = kFALSE;
970  fFillDCAL = kFALSE;
971  fFillPHOS = kFALSE;
972  fFillCTS = kFALSE;
973  fFillEMCALCells = kFALSE;
974  fFillPHOSCells = kFALSE;
975 
976  fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
977  fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
978  fDeltaAODFileName = "deltaAODPartCorr.root";
980  fEventTriggerMask = AliVEvent::kAny;
981  fMixEventTriggerMask = AliVEvent::kAnyINT;
982  fEventTriggerAtSE = kTRUE; // Use only events that pass event selection at SE base class
983 
984  fAcceptFastCluster = kTRUE;
985  fEventType = -1;
986 
987  //We want tracks fitted in the detectors:
988  //fTrackStatus=AliESDtrack::kTPCrefit;
989  //fTrackStatus|=AliESDtrack::kITSrefit;
990  fTrackStatus = 0;
991 
992  fV0ADC[0] = 0; fV0ADC[1] = 0;
993  fV0Mul[0] = 0; fV0Mul[1] = 0;
994 
995  fZvtxCut = 10.;
996 
997  fNMixedEvent = 1;
998 
1001 
1002  //Centrality
1003  fUseAliCentrality = kFALSE;
1004  fCentralityClass = "V0M";
1005  fCentralityOpt = 100;
1006  fCentralityBin[0] = fCentralityBin[1]=-1;
1007 
1008  fEventPlaneMethod = "V0";
1009 
1010  // Allocate memory (not sure this is the right place)
1011  fCTSTracks = new TObjArray();
1012  fEMCALClusters = new TObjArray();
1013  fDCALClusters = new TObjArray();
1014  fPHOSClusters = new TObjArray();
1015  //fTriggerAnalysis = new AliTriggerAnalysis;
1016  fAODBranchList = new TList ;
1017  fOutputContainer = new TList ;
1018 
1019  fEnergyHistogramNbins = 200;
1020  fEnergyHistogramLimit[0] = 0 ;
1021  fEnergyHistogramLimit[1] = 100;
1022 
1023  fPileUpParamSPD[0] = 3 ; fPileUpParamSPD[1] = 0.8 ;
1024  fPileUpParamSPD[2] = 3.0 ; fPileUpParamSPD[3] = 2.0 ; fPileUpParamSPD[4] = 5.0;
1025 
1026  // Parametrized time cut (LHC11d)
1029 
1030  // Parametrized time cut (LHC11c)
1031  //fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 1.87; fEMCALParamTimeCutMin[3] = 0.4;
1032  //fEMCALParamTimeCutMax[0] = 3.5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.15; fEMCALParamTimeCutMax[3] = 1.6;
1033 
1034  fTimeStampRunMin = -1;
1035  fTimeStampRunMax = 1e12;
1038 
1039  for(Int_t i = 0; i < 19; i++)
1040  {
1041  fEMCalBCEvent [i] = 0;
1042  fEMCalBCEventCut[i] = 0;
1043  fTrackBCEvent [i] = 0;
1044  fTrackBCEventCut[i] = 0;
1045  }
1046 
1047  // Trigger match-rejection
1048  fTriggerPatchTimeWindow[0] = 8;
1049  fTriggerPatchTimeWindow[1] = 9;
1050 
1051  fTriggerClusterBC = -10000 ;
1054  fTriggerClusterIndex = -1;
1055  fTriggerClusterId = -1;
1056 
1057  //Jets
1060  if(!fNonStandardJets) fNonStandardJets = new TClonesArray("AliAODJet",100);
1063  if(!fBackgroundJets) fBackgroundJets = new AliAODJetEventBackground();
1064 
1065  fSmearShowerShapeWidth = 0.005;
1066  fSmearNLMMin = 1;
1067  fSmearNLMMax = 1;
1068 
1069  fWeightUtils = new AliAnaWeights() ;
1070  fEventWeight = 1 ;
1071 
1072 }
1073 
1074 //__________________________________________________________________________
1077 //__________________________________________________________________________
1079 {
1080  // Parametrized cut depending on E
1081  if(fUseParamTimeCut)
1082  {
1085  //printf("tof %f, minCut %f, maxCut %f\n",tof,minCut,maxCut);
1086  if( tof < minCut || tof > maxCut ) return kFALSE ;
1087  }
1088 
1089  //In any case, the time should to be larger than the fixed window ...
1090  if( tof < fEMCALTimeCutMin || tof > fEMCALTimeCutMax ) return kFALSE ;
1091 
1092  return kTRUE ;
1093 }
1094 
1095 //________________________________________________
1098 //________________________________________________
1100 {
1101  return fInputEvent->IsPileupFromSPD((Int_t) fPileUpParamSPD[0] , fPileUpParamSPD[1] ,
1102  fPileUpParamSPD[2] , fPileUpParamSPD[3] , fPileUpParamSPD[4] );
1103  //printf("Param : %d, %2.2f, %2.2f, %2.2f, %2.2f\n",(Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
1104 }
1105 
1106 //__________________________________________________
1108 //__________________________________________________
1110 {
1111  if(fNPileUpClusters > fNPileUpClustersCut) return kTRUE ;
1112  else return kFALSE;
1113 }
1114 
1115 //________________________________________________________
1117 //________________________________________________________
1119 {
1120  if( IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
1121  else return kFALSE;
1122 }
1123 
1124 //_______________________________________________________
1126 //_______________________________________________________
1128 {
1129  if( IsPileUpFromSPD() || IsPileUpFromEMCal()) return kTRUE ;
1130  else return kFALSE;
1131 }
1132 
1133 //___________________________________________________________
1135 //___________________________________________________________
1137 {
1138  if( IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
1139  else return kFALSE;
1140 }
1141 
1142 //___________________________________________________________
1144 //___________________________________________________________
1146 {
1147  if( !IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
1148  else return kFALSE;
1149 }
1150 
1151 //______________________________________________________________
1153 //______________________________________________________________
1155 {
1156  if( !IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
1157  else return kFALSE;
1158 }
1159 
1160 //___________________________________________________________________________________
1168 //___________________________________________________________________________________
1169 Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileName*/)
1170 {
1171  fEventNumber = iEntry;
1172  fTriggerClusterIndex = -1;
1173  fTriggerClusterId = -1;
1174  fIsTriggerMatch = kFALSE;
1175  fTriggerClusterBC = -10000;
1176  fIsExoticEvent = kFALSE;
1177  fIsBadCellEvent = kFALSE;
1178  fIsBadMaxCellEvent = kFALSE;
1179 
1180  fIsTriggerMatchOpenCut[0] = kFALSE ;
1181  fIsTriggerMatchOpenCut[1] = kFALSE ;
1182  fIsTriggerMatchOpenCut[2] = kFALSE ;
1183 
1184  //fCurrentFileName = TString(currentFileName);
1185  if(!fInputEvent)
1186  {
1187  AliInfo("Input event not available, skip event analysis");
1188  return kFALSE;
1189  }
1190 
1191  fhNEventsAfterCut->Fill(0.5);
1192 
1193  //-----------------------------------------------
1194  // Select the event depending on the trigger type
1195  // and other event characteristics
1196  // like the goodness of the EMCal trigger
1197  //-----------------------------------------------
1198 
1199  Bool_t accept = CheckEventTriggers();
1200  if(!accept) return kFALSE;
1201 
1202  AliDebug(1,"Pass Event trigger selection");
1203 
1204 
1205  //------------------------------------------------------
1206  // Event rejection depending on time stamp
1207  //------------------------------------------------------
1208 
1210  {
1211  AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
1212  if(esd)
1213  {
1214  Int_t timeStamp = esd->GetTimeStamp();
1215  Float_t timeStampFrac = 1.*(timeStamp-fTimeStampRunMin) / (fTimeStampRunMax-fTimeStampRunMin);
1216 
1217  //printf("stamp0 %d, max0 %d, frac %f\n", timeStamp-fTimeStampRunMin,fTimeStampRunMax-fTimeStampRunMin, timeStampFrac);
1218 
1219  if(timeStampFrac < fTimeStampEventFracMin || timeStampFrac > fTimeStampEventFracMax) return kFALSE;
1220  }
1221 
1222  AliDebug(1,"Pass Time Stamp rejection");
1223  fhNEventsAfterCut->Fill(8.5);
1224  }
1225 
1226  //------------------------------------------------------
1227  // Event rejection depending on vertex, pileup, v0and
1228  //------------------------------------------------------
1229 
1230  FillVertexArray();
1231 
1232  //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code
1233  if(!GetMixedEvent() && TMath::Abs(fVertex[0][2]) > fZvtxCut) return kFALSE;
1234 
1235  fhNEventsAfterCut->Fill(9.5);
1236 
1238  {
1239  if( !CheckForPrimaryVertex() ) return kFALSE; // algorithm in ESD/AOD Readers
1240  if( TMath::Abs(fVertex[0][0] ) < 1.e-6 &&
1241  TMath::Abs(fVertex[0][1] ) < 1.e-6 &&
1242  TMath::Abs(fVertex[0][2] ) < 1.e-6 ) return kFALSE;
1243  }
1244 
1245  AliDebug(1,"Pass primary vertex rejection");
1246 
1247  fhNEventsAfterCut->Fill(10.5);
1248 
1249  //printf("Reader : IsPileUp %d, Multi %d\n",IsPileUpFromSPD(),fInputEvent->IsPileupFromSPDInMultBins());
1250 
1252  {
1253  // Do not analyze events with pileup
1254  Bool_t bPileup = IsPileUpFromSPD();
1255  //IsPileupFromSPDInMultBins() // method to try
1256  //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]);
1257  if(bPileup) return kFALSE;
1258 
1259  AliDebug(1,"Pass Pile-Up event rejection");
1260 
1261  fhNEventsAfterCut->Fill(11.5);
1262  }
1263 
1265  {
1266  AliVVZERO* v0 = fInputEvent->GetVZEROData();
1267 
1268  Bool_t bV0AND = ((v0->GetV0ADecision()==1) && (v0->GetV0CDecision()==1));
1269  //bV0AND = fTriggerAnalysis->IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0AND);
1270  //printf("V0AND event? %d\n",bV0AND);
1271 
1272  if(!bV0AND)
1273  {
1274  AliDebug(1,"Reject event by V0AND");
1275  return kFALSE;
1276  }
1277 
1278  AliDebug(1,"Pass V0AND event rejection");
1279 
1280  fhNEventsAfterCut->Fill(12.5);
1281  }
1282 
1283  //------------------------------------------------------
1284  // Check if there is a centrality value, PbPb analysis,
1285  // and if a centrality bin selection is requested
1286  //------------------------------------------------------
1287 
1288  //If we need a centrality bin, we select only those events in the corresponding bin.
1289  Int_t cen = -1;
1290  if ( fCentralityBin[0] >= 0 && fCentralityBin[1] >= 0 )
1291  {
1292  cen = GetEventCentrality();
1293 
1294  if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
1295 
1296  AliDebug(1,"Pass centrality rejection");
1297 
1298  fhNEventsAfterCut->Fill(13.5);
1299  }
1300 
1301  //----------------------------------------------------------------
1302  // Reject the event if the event header name is not
1303  // the one requested among the possible generators.
1304  // Needed in case of cocktail MC generation with multiple options.
1305  //----------------------------------------------------------------
1307  return kFALSE;
1308 
1309  fhNEventsAfterCut->Fill(14.5);
1310 
1311  //---------------------------------------------------------------------------
1312  // In case of analysis of events with jets, skip those with jet pt > 5 pt hard
1313  // To be used on for MC data in pT hard bins
1314  //---------------------------------------------------------------------------
1315 
1317  {
1318  if(!ComparePtHardAndJetPt()) return kFALSE ;
1319  AliDebug(1,"Pass Pt Hard - Jet rejection");
1320  fhNEventsAfterCut->Fill(15.5);
1321  }
1322 
1324  {
1325  if(!ComparePtHardAndClusterPt()) return kFALSE ;
1326  AliDebug(1,"Pass Pt Hard - Cluster rejection");
1327  fhNEventsAfterCut->Fill(16.5);
1328  }
1329 
1330  //------------------------------------------------------------------
1331  // Recover the weight assigned to the event, if provided
1332  // right now only for pT-hard bins and centrality depedent weights
1333  //------------------------------------------------------------------
1335  {
1337 
1338  fWeightUtils->SetPythiaEventHeader(((AliGenPythiaEventHeader*)GetGenEventHeader()));
1339 
1341  }
1342 
1343  //-------------------------------------------------------
1344  // Get the main vertex BC, in case not available
1345  // it is calculated in FillCTS checking the BC of tracks
1346  //------------------------------------------------------
1347  fVertexBC = fInputEvent->GetPrimaryVertex()->GetBC();
1348 
1349  //-----------------------------------------------
1350  // Fill the arrays with cluster/tracks/cells data
1351  //-----------------------------------------------
1352 
1353  if(fFillCTS)
1354  {
1355  FillInputCTS();
1356  //Accept events with at least one track
1357  if(fTrackMult == 0 && fDoRejectNoTrackEvents) return kFALSE ;
1358 
1359  fhNEventsAfterCut->Fill(17.5);
1360 
1361  AliDebug(1,"Pass rejection of null track events");
1362  }
1363 
1365  {
1366  if(fVertexBC != 0 && fVertexBC != AliVTrack::kTOFBCNA) return kFALSE ;
1367 
1368  AliDebug(1,"Pass rejection of events with vertex at BC!=0");
1369 
1370  fhNEventsAfterCut->Fill(18.5);
1371  }
1372 
1373  if(fFillEMCALCells)
1375 
1376  if(fFillPHOSCells)
1378 
1379  if(fFillEMCAL || fFillDCAL)
1380  FillInputEMCAL();
1381 
1382  if(fFillPHOS)
1383  FillInputPHOS();
1384 
1385  FillInputVZERO();
1386 
1387  //one specified jet branch
1392 
1393  AliDebug(1,"Event accepted for analysis");
1394 
1395  return kTRUE ;
1396 }
1397 
1398 //__________________________________________________
1401 //__________________________________________________
1403 {
1404  if(fUseAliCentrality)
1405  {
1406  if ( !GetCentrality() ) return -1;
1407 
1408  AliDebug(1,Form("Cent. Percentile: V0M %2.2f, CL0 %2.2f, CL1 %2.2f; selected class %s",
1409  GetCentrality()->GetCentralityPercentile("V0M"),
1410  GetCentrality()->GetCentralityPercentile("CL0"),
1411  GetCentrality()->GetCentralityPercentile("CL1"),
1412  fCentralityClass.Data()));
1413 
1414  if (fCentralityOpt == 100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); // 100 bins max
1415  else if(fCentralityOpt == 10) return GetCentrality()->GetCentralityClass10(fCentralityClass);// 10 bins max
1416  else if(fCentralityOpt == 20) return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max
1417  else
1418  {
1419  AliInfo(Form("Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt));
1420  return -1;
1421  }
1422  }
1423  else
1424  {
1425  if ( !GetMultSelCen() ) return -1;
1426 
1427  AliDebug(1,Form("Mult. Percentile: V0M %2.2f, CL0 %2.2f, CL1 %2.2f; selected class %s",
1428  GetMultSelCen()->GetMultiplicityPercentile("V0M",1),
1429  GetMultSelCen()->GetMultiplicityPercentile("CL0",1),
1430  GetMultSelCen()->GetMultiplicityPercentile("CL1",1),
1431  fCentralityClass.Data()));
1432 
1433  return GetMultSelCen()->GetMultiplicityPercentile(fCentralityClass, kTRUE); // returns centrality only for events used in calibration
1434 
1435  // equivalent to
1436  //GetMultSelCen()->GetMultiplicityPercentile("V0M", kFALSE); // returns centrality for any event
1437  //Int_t qual = GetMultSelCen()->GetEvSelCode(); if (qual ! = 0) cent = qual;
1438  }
1439 }
1440 
1441 //_____________________________________________________
1444 //_____________________________________________________
1446 {
1447  if( !GetEventPlane() ) return -1000;
1448 
1449  Float_t ep = GetEventPlane()->GetEventplane(GetEventPlaneMethod(), GetInputEvent());
1450 
1451  if(GetEventPlaneMethod()=="Q" && (ep < 0 || ep > TMath::Pi()))
1452  {
1453  AliDebug(1,Form("Bad EP for <Q> method : %f\n",ep));
1454  return -1000;
1455  }
1456  else if(GetEventPlaneMethod().Contains("V0") )
1457  {
1458  if((ep > TMath::Pi()/2 || ep < -TMath::Pi()/2))
1459  {
1460  AliDebug(1,Form("Bad EP for <%s> method : %f\n",GetEventPlaneMethod().Data(), ep));
1461  return -1000;
1462  }
1463 
1464  ep+=TMath::Pi()/2; // put same range as for <Q> method
1465  }
1466 
1467  AliDebug(3,Form("Event plane angle %f",ep));
1468 
1469 // if(fDebug > 0 )
1470 // {
1471 // if (ep > TMath::Pi()) printf("AliCaloTrackReader::GetEventPlaneAngle() - Too large angle = %f\n",ep);
1472 // else if(ep < 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Negative angle = %f\n" ,ep);
1473 // }
1474 
1475  return ep;
1476 }
1477 
1478 //__________________________________________________________
1480 //__________________________________________________________
1482 {
1483  vertex[0] = fVertex[0][0];
1484  vertex[1] = fVertex[0][1];
1485  vertex[2] = fVertex[0][2];
1486 }
1487 
1488 //__________________________________________________________________________
1490 //__________________________________________________________________________
1491 void AliCaloTrackReader::GetVertex(Double_t vertex[3], Int_t evtIndex) const
1492 {
1493  vertex[0] = fVertex[evtIndex][0];
1494  vertex[1] = fVertex[evtIndex][1];
1495  vertex[2] = fVertex[evtIndex][2];
1496 }
1497 
1498 //________________________________________
1501 //________________________________________
1503 {
1504  // Delete previous vertex
1505  if(fVertex)
1506  {
1507  for (Int_t i = 0; i < fNMixedEvent; i++)
1508  {
1509  delete [] fVertex[i] ;
1510  }
1511  delete [] fVertex ;
1512  }
1513 
1514  fVertex = new Double_t*[fNMixedEvent] ;
1515  for (Int_t i = 0; i < fNMixedEvent; i++)
1516  {
1517  fVertex[i] = new Double_t[3] ;
1518  fVertex[i][0] = 0.0 ;
1519  fVertex[i][1] = 0.0 ;
1520  fVertex[i][2] = 0.0 ;
1521  }
1522 
1523  if (!fMixedEvent)
1524  { // Single event analysis
1525  if(fDataType!=kMC)
1526  {
1527 
1528  if(fInputEvent->GetPrimaryVertex())
1529  {
1530  fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]);
1531  }
1532  else
1533  {
1534  AliWarning("NULL primary vertex");
1535  fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1536  }//Primary vertex pointer do not exist
1537 
1538  } else
1539  {// MC read event
1540  fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1541  }
1542 
1543  AliDebug(1,Form("Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]));
1544 
1545  } else
1546  { // MultiEvent analysis
1547  for (Int_t iev = 0; iev < fNMixedEvent; iev++)
1548  {
1549  if (fMixedEvent->GetVertexOfEvent(iev))
1550  fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]);
1551  else
1552  AliWarning("No vertex found");
1553 
1554  AliDebug(1,Form("Multi Event %d Vertex : %f,%f,%f",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]));
1555  }
1556  }
1557 }
1558 
1559 //_____________________________________
1565 //_____________________________________
1567 {
1568  AliDebug(1,"Begin");
1569 
1570  Double_t pTrack[3] = {0,0,0};
1571 
1572  Int_t nTracks = fInputEvent->GetNumberOfTracks() ;
1573  fTrackMult = 0;
1574  Int_t nstatus = 0;
1575  Double_t bz = GetInputEvent()->GetMagneticField();
1576 
1577  for(Int_t i = 0; i < 19; i++)
1578  {
1579  fTrackBCEvent [i] = 0;
1580  fTrackBCEventCut[i] = 0;
1581  }
1582 
1583  Bool_t bc0 = kFALSE;
1584  if(fRecalculateVertexBC) fVertexBC = AliVTrack::kTOFBCNA;
1585 
1586  for (Int_t itrack = 0; itrack < nTracks; itrack++)
1587  {
1588  AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd
1589 
1590  if ( !AcceptParticleMCLabel( TMath::Abs(track->GetLabel()) ) ) continue ;
1591 
1592  fhCTSTrackCutsPt[0]->Fill(track->Pt());
1593 
1594  //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
1595  ULong_t status = track->GetStatus();
1596 
1597  if (fTrackStatus && !((status & fTrackStatus) == fTrackStatus))
1598  continue ;
1599 
1600  fhCTSTrackCutsPt[1]->Fill(track->Pt());
1601 
1602  nstatus++;
1603 
1604  //-------------------------
1605  // Select the tracks depending on cuts of AOD or ESD
1606  if(!SelectTrack(track, pTrack)) continue ;
1607 
1608  fhCTSTrackCutsPt[2]->Fill(track->Pt());
1609 
1610  //-------------------------
1611  // TOF cuts
1612  Bool_t okTOF = ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) ;
1613  Double_t tof = -1000;
1614  Int_t trackBC = -1000 ;
1615 
1616  if(fAccessTrackTOF)
1617  {
1618  if(okTOF)
1619  {
1620  trackBC = track->GetTOFBunchCrossing(bz);
1621  SetTrackEventBC(trackBC+9);
1622 
1623  tof = track->GetTOFsignal()*1e-3;
1624 
1625  //After selecting tracks with small DCA, pointing to vertex, set vertex BC depeding on tracks BC
1627  {
1628  if (trackBC != 0 && trackBC != AliVTrack::kTOFBCNA) fVertexBC = trackBC;
1629  else if(trackBC == 0) bc0 = kTRUE;
1630  }
1631 
1632  //In any case, the time should to be larger than the fixed window ...
1633  if( fUseTrackTimeCut && (trackBC !=0 || tof < fTrackTimeCutMin || tof > fTrackTimeCutMax) )
1634  {
1635  //printf("Remove track time %f and bc = %d\n",tof,trackBC);
1636  continue ;
1637  }
1638  //else printf("Accept track time %f and bc = %d\n",tof,trackBC);
1639  }
1640  }
1641 
1642  fhCTSTrackCutsPt[3]->Fill(track->Pt());
1643 
1644  //---------------------
1645  // DCA cuts
1646  //
1647  fMomentum.SetPxPyPzE(pTrack[0],pTrack[1],pTrack[2],0);
1648 
1649  if(fUseTrackDCACut)
1650  {
1651  Float_t dcaTPC =-999;
1652  //In case of AODs, TPC tracks cannot be propagated back to primary vertex,
1653  if( fDataType == kAOD ) dcaTPC = ((AliAODTrack*) track)->DCA();
1654 
1655  //normal way to get the dca, cut on dca_xy
1656  if(dcaTPC==-999)
1657  {
1658  Double_t dca[2] = {1e6,1e6};
1659  Double_t covar[3] = {1e6,1e6,1e6};
1660  Bool_t okDCA = track->PropagateToDCA(fInputEvent->GetPrimaryVertex(),bz,100.,dca,covar);
1661  if( okDCA) okDCA = AcceptDCA(fMomentum.Pt(),dca[0]);
1662  if(!okDCA)
1663  {
1664  //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f\n",fMomentum.Pt(),dca[0]);
1665  continue ;
1666  }
1667  }
1668  }// DCA cuts
1669 
1670  fhCTSTrackCutsPt[4]->Fill(track->Pt());
1671 
1672  //-------------------------
1673  // Kinematic/acceptance cuts
1674  //
1675  // Count the tracks in eta < 0.9
1676  if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
1677 
1678  if(fCTSPtMin > fMomentum.Pt() || fCTSPtMax < fMomentum.Pt()) continue ;
1679 
1680  // Check effect of cuts on track BC
1681  if(fAccessTrackTOF && okTOF) SetTrackEventBCcut(trackBC+9);
1682 
1683  if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kCTS)) continue;
1684 
1685  fhCTSTrackCutsPt[5]->Fill(track->Pt());
1686 
1687  // ------------------------------
1688  // Add selected tracks to array
1689  AliDebug(2,Form("Selected tracks pt %3.2f, phi %3.2f deg, eta %3.2f",
1690  fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1691 
1692  fCTSTracks->Add(track);
1693 
1694  // TODO, check if remove
1695  if (fMixedEvent) track->SetID(itrack);
1696 
1697  }// track loop
1698 
1699  if( fRecalculateVertexBC && (fVertexBC == 0 || fVertexBC == AliVTrack::kTOFBCNA))
1700  {
1701  if( bc0 ) fVertexBC = 0 ;
1702  else fVertexBC = AliVTrack::kTOFBCNA ;
1703  }
1704 
1705  AliDebug(1,Form("AOD entries %d, input tracks %d, pass status %d, multipliticy %d", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult));//fCTSTracksNormalInputEntries);
1706 }
1707 
1708 //_______________________________________________________________________________
1726 //_______________________________________________________________________________
1728 {
1729  // Accept clusters with the proper label
1730  if ( clus->GetLabel() >= 0 ) // -1 corresponds to noisy MC
1731  {
1732  if ( !AcceptParticleMCLabel(clus->GetLabel()) ) return ;
1733  }
1734 
1735  // TODO, not sure if needed anymore
1736  Int_t vindex = 0 ;
1737  if (fMixedEvent)
1738  vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1739 
1740  clus->GetMomentum(fMomentum, fVertex[vindex]);
1741 
1742  // No correction/cut applied yet
1743  fhEMCALClusterCutsE[0]->Fill(clus->E());
1744 
1745  //if( (fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10 )
1746  AliDebug(2,Form("Input cluster E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1747  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1748 
1749  //---------------------------
1750  // Embedding case
1751  // TO BE REVISED
1753  {
1754  if(clus->GetNLabels()==0 || clus->GetLabel() < 0) return;
1755  //else printf("Embedded cluster, %d, n label %d label %d \n",iclus,clus->GetNLabels(),clus->GetLabel());
1756  }
1757 
1758  //--------------------------------------
1759  // Apply some corrections in the cluster
1760  //
1762  {
1763  //Recalibrate the cluster energy
1765  {
1767 
1768  clus->SetE(energy);
1769  //printf("Recalibrated Energy %f\n",clus->E());
1770 
1773 
1774  } // recalculate E
1775 
1776  //Recalculate distance to bad channels, if new list of bad channels provided
1778 
1779  //Recalculate cluster position
1780  if(GetCaloUtils()->IsRecalculationOfClusterPositionOn())
1781  {
1783  //clus->GetPosition(pos);
1784  //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1785  }
1786 
1787  // Recalculate TOF
1788  if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
1789  {
1790  Double_t tof = clus->GetTOF();
1791  Float_t frac =-1;
1792  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1793 
1794  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1795 
1796  //additional L1 phase shift
1797  if(GetCaloUtils()->GetEMCALRecoUtils()->IsL1PhaseInTimeRecalibrationOn())
1798  {
1799  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absIdMax),
1800  fInputEvent->GetBunchCrossNumber(), tof);
1801  }
1802 
1803  clus->SetTOF(tof);
1804 
1805  }// Time recalibration
1806  }
1807 
1808  // Check effect of corrections
1809  fhEMCALClusterCutsE[1]->Fill(clus->E());
1810 
1811  //-----------------------------------------------------------------
1812  // Reject clusters with bad channels, close to borders and exotic
1813  //
1814  Bool_t goodCluster = GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,
1815  GetCaloUtils()->GetEMCALGeometry(),
1816  GetEMCALCells(),fInputEvent->GetBunchCrossNumber());
1817 
1818  if(!goodCluster)
1819  {
1820  //if( (fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10 )
1821  AliDebug(2,Form("Bad cluster E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1822  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1823 
1824  return;
1825  }
1826 
1827  // Check effect of bad cluster removal
1828  fhEMCALClusterCutsE[2]->Fill(clus->E());
1829 
1830  //Float_t pos[3];
1831  //clus->GetPosition(pos);
1832  //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1833 
1834  //--------------------------------------
1835  // Correct non linearity or smear energy
1836  //
1838  {
1840 
1841  //if( (fDebug > 5 && fMomentum.E() > 0.1) || fDebug > 10 )
1842  AliDebug(5,Form("Correct Non Lin: Old E %3.2f, New E %3.2f",
1843  fMomentum.E(),clus->E()));
1844 
1845  // In case of MC analysis, to match resolution/calibration in real data
1846  // Not needed anymore, just leave for MC studies on systematics
1847  if( GetCaloUtils()->GetEMCALRecoUtils()->IsClusterEnergySmeared() )
1848  {
1849  Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus);
1850 
1851  //if( (fDebug > 5 && fMomentum.E() > 0.1) || fDebug > 10 )
1852  AliDebug(5,Form("Smear energy: Old E %3.2f, New E %3.2f",clus->E(),rdmEnergy));
1853 
1854  clus->SetE(rdmEnergy);
1855  }
1856  }
1857 
1858  clus->GetMomentum(fMomentum, fVertex[vindex]);
1859 
1860  // Check effect linearity correction, energy smearing
1861  fhEMCALClusterCutsE[3]->Fill(clus->E());
1862 
1863  // Check the event BC depending on EMCal clustr before final cuts
1864  Double_t tof = clus->GetTOF()*1e9;
1865 
1866  Int_t bc = TMath::Nint(tof/50) + 9;
1867  //printf("tof %2.2f, bc+5=%d\n",tof,bc);
1868 
1869  SetEMCalEventBC(bc);
1870 
1871  //--------------------------------------
1872  // Apply some kinematical/acceptance cuts
1873  //
1874  if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) return ;
1875 
1876  // Select cluster fiducial region
1877  //
1878  Bool_t bEMCAL = kFALSE;
1879  Bool_t bDCAL = kFALSE;
1880  if(fCheckFidCut)
1881  {
1882  if(fFillEMCAL && fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kEMCAL)) bEMCAL = kTRUE ;
1883  if(fFillDCAL && fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kDCAL )) bDCAL = kTRUE ;
1884  }
1885  else
1886  {
1887  bEMCAL = kTRUE;
1888  }
1889 
1890  //---------------------------------------------------------------------
1891  // Mask all cells in collumns facing ALICE thick material if requested
1892  //
1894  {
1895  Int_t absId = -1;
1896  Int_t iSupMod = -1;
1897  Int_t iphi = -1;
1898  Int_t ieta = -1;
1899  Bool_t shared = kFALSE;
1900  GetCaloUtils()->GetEMCALRecoUtils()->GetMaxEnergyCell(GetCaloUtils()->GetEMCALGeometry(), GetEMCALCells(),clus,absId,iSupMod,ieta,iphi,shared);
1901 
1902  AliDebug(2,Form("Masked collumn: cluster E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1903  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1904 
1905 
1906  if(GetCaloUtils()->MaskFrameCluster(iSupMod, ieta)) return;
1907  }
1908 
1909  // Check effect of energy and fiducial cuts
1910  fhEMCALClusterCutsE[4]->Fill(clus->E());
1911 
1912 
1913  //------------------------------------------
1914  // Apply time cut, count EMCal BC before cut
1915  //
1916  SetEMCalEventBCcut(bc);
1917 
1918  if(!IsInTimeWindow(tof,clus->E()))
1919  {
1920  fNPileUpClusters++ ;
1921  if(fUseEMCALTimeCut)
1922  {
1923  AliDebug(2,Form("Out of time window E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f, time %e",
1924  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta(),tof));
1925 
1926  return ;
1927  }
1928  }
1929  else
1931 
1932  // Check effect of time cut
1933  fhEMCALClusterCutsE[5]->Fill(clus->E());
1934 
1935 
1936  //----------------------------------------------------
1937  // Apply N cells cut
1938  //
1939  if(clus->GetNCells() <= fEMCALNCellsCut && fDataType != AliCaloTrackReader::kMC) return ;
1940 
1941  // Check effect of n cells cut
1942  fhEMCALClusterCutsE[6]->Fill(clus->E());
1943 
1944  //----------------------------------------------------
1945  // Apply distance to bad channel cut
1946  //
1947  Double_t distBad = clus->GetDistanceToBadChannel() ; //Distance to bad channel
1948 
1949  if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
1950 
1951  if(distBad < fEMCALBadChMinDist) return ;
1952 
1953  // Check effect distance to bad channel cut
1954  fhEMCALClusterCutsE[7]->Fill(clus->E());
1955 
1956  //----------------------------------------------------
1957  // Smear the SS to try to match data and simulations,
1958  // do it only for simulations.
1959  //
1960  Int_t nMaxima = GetCaloUtils()->GetNumberOfLocalMaxima(clus, GetEMCALCells());
1961  // Int_t nMaxima = clus->GetNExMax(); // For Run2
1962  if( fSmearShowerShape && clus->GetNCells() > 2 &&
1963  nMaxima >= fSmearNLMMin && nMaxima <= fSmearNLMMax )
1964  {
1965  AliDebug(2,Form("Smear shower shape - Original: %2.4f\n", clus->GetM02()));
1967  {
1968  clus->SetM02( clus->GetM02() + fRandom.Landau(0, fSmearShowerShapeWidth) );
1969  }
1971  {
1972  if(iclus%3 == 0 && clus->GetM02() > 0.1) clus->SetM02( clus->GetM02() + fRandom.Landau(0.05, fSmearShowerShapeWidth) ); //fSmearShowerShapeWidth = 0.035
1973  }
1974  else if (fSmearingFunction == kNoSmearing)
1975  {
1976  clus->SetM02( clus->GetM02() );
1977  }
1978  //clus->SetM02( fRandom.Landau(clus->GetM02(), fSmearShowerShapeWidth) );
1979  AliDebug(2,Form("Width %2.4f Smeared : %2.4f\n", fSmearShowerShapeWidth,clus->GetM02()));
1980  }
1981 
1982  //--------------------------------------------------------
1983  // Fill the corresponding array with the selected clusters
1984  // Usually just filling EMCal array with upper or lower clusters is enough,
1985  // but maybe we want to do EMCal-DCal correlations.
1986 
1987  //if((fDebug > 2 && fMomentum.E() > 0.1) || fDebug > 10)
1988  AliDebug(2,Form("Selected clusters (EMCAL%d, DCAL%d), E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
1989  bEMCAL,bDCAL,fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
1990 
1991 
1992  if (bEMCAL) fEMCALClusters->Add(clus);
1993  else if(bDCAL ) fDCALClusters ->Add(clus);
1994 
1995  // TODO, not sure if needed anymore
1996  if (fMixedEvent)
1997  clus->SetID(iclus) ;
1998 }
1999 
2000 //_______________________________________
2007 //_______________________________________
2009 {
2010  AliDebug(1,"Begin");
2011 
2012  // First recalibrate cells, time or energy
2013  // if(GetCaloUtils()->IsRecalibrationOn())
2014  // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(),
2015  // GetEMCALCells(),
2016  // fInputEvent->GetBunchCrossNumber());
2017 
2018  fNPileUpClusters = 0; // Init counter
2019  fNNonPileUpClusters = 0; // Init counter
2020  for(Int_t i = 0; i < 19; i++)
2021  {
2022  fEMCalBCEvent [i] = 0;
2023  fEMCalBCEventCut[i] = 0;
2024  }
2025 
2026  //Loop to select clusters in fiducial cut and fill container with aodClusters
2027  if(fEMCALClustersListName=="")
2028  {
2029  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2030  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2031  {
2032  AliVCluster * clus = 0;
2033  if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
2034  {
2035  if (clus->IsEMCAL())
2036  {
2037  FillInputEMCALAlgorithm(clus, iclus);
2038  }//EMCAL cluster
2039  }// cluster exists
2040  }// cluster loop
2041 
2042  //Recalculate track matching
2044 
2045  }//Get the clusters from the input event
2046  else
2047  {
2048  TClonesArray * clusterList = 0x0;
2049 
2050  if (fInputEvent->FindListObject(fEMCALClustersListName))
2051  {
2052  clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
2053  }
2054  else if(fOutputEvent)
2055  {
2056  clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
2057  }
2058 
2059  if(!clusterList)
2060  {
2061  AliWarning(Form("Wrong name of list with clusters? <%s>",fEMCALClustersListName.Data()));
2062  return;
2063  }
2064 
2065  Int_t nclusters = clusterList->GetEntriesFast();
2066  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2067  {
2068  AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus));
2069  //printf("E %f\n",clus->E());
2070  if (clus) FillInputEMCALAlgorithm(clus, iclus);
2071  else AliWarning("Null cluster in list!");
2072  }// cluster loop
2073 
2074  // Recalculate the pile-up time, in case long time clusters removed during clusterization
2075  //printf("Input event INIT : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
2076 
2077  fNPileUpClusters = 0; // Init counter
2078  fNNonPileUpClusters = 0; // Init counter
2079  for(Int_t i = 0; i < 19; i++)
2080  {
2081  fEMCalBCEvent [i] = 0;
2082  fEMCalBCEventCut[i] = 0;
2083  }
2084 
2085  for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++)
2086  {
2087  AliVCluster * clus = 0;
2088 
2089  if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
2090  {
2091  if (clus->IsEMCAL())
2092  {
2093 
2094  Float_t frac =-1;
2095  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
2096  Double_t tof = clus->GetTOF();
2097  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
2098  //additional L1 phase shift
2099  if(GetCaloUtils()->GetEMCALRecoUtils()->IsL1PhaseInTimeRecalibrationOn())
2100  {
2101  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absIdMax), fInputEvent->GetBunchCrossNumber(), tof);
2102  }
2103 
2104  tof*=1e9;
2105 
2106  //printf("Input event cluster : AbsIdMax %d, E %2.2f, time %2.2f \n", absIdMax,clus->E(),tof);
2107 
2108  //Reject clusters with bad channels, close to borders and exotic;
2109  if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) continue;
2110 
2111  Int_t bc = TMath::Nint(tof/50) + 9;
2112  SetEMCalEventBC(bc);
2113 
2114  if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) continue ;
2115 
2116  clus->GetMomentum(fMomentum, fVertex[0]);
2117 
2118  if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kEMCAL)) return ;
2119 
2120  SetEMCalEventBCcut(bc);
2121 
2122  if(!IsInTimeWindow(tof,clus->E()))
2123  fNPileUpClusters++ ;
2124  else
2126 
2127  }
2128  }
2129  }
2130 
2131  //printf("Input event : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
2132 
2133  // Recalculate track matching, not necessary if already done in the reclusterization task.
2134  // in case it was not done ...
2136 
2137  }
2138 
2139  AliDebug(1,Form("AOD entries %d, n pile-up clusters %d, n non pile-up %d", fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters));
2140 }
2141 
2142 //_______________________________________
2144 //_______________________________________
2146 {
2147  AliDebug(1,"Begin");
2148 
2149  // Loop to select clusters in fiducial cut and fill container with aodClusters
2150  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2151  TString genName;
2152  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2153  {
2154  AliVCluster * clus = fInputEvent->GetCaloCluster(iclus) ;
2155  if ( !clus ) continue ;
2156 
2157  if ( !clus->IsPHOS() ) continue ;
2158 
2159  if(clus->GetLabel() >=0 ) // -1 corresponds to noisy MC
2160  {
2161  if ( !AcceptParticleMCLabel(clus->GetLabel()) ) continue ;
2162  }
2163 
2164  fhPHOSClusterCutsE[0]->Fill(clus->E());
2165 
2166  // Skip CPV input
2167  if( clus->GetType() == AliVCluster::kPHOSCharged ) continue ;
2168 
2169  fhPHOSClusterCutsE[1]->Fill(clus->E());
2170 
2171  //---------------------------------------------
2172  // Old feature, try to rely on PHOS tender
2173  //
2175  {
2176  // Recalibrate the cluster energy
2178  {
2179  Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
2180  clus->SetE(energy);
2181  }
2182  }
2183 
2184  //----------------------------------------------------------------------------------
2185  // Check if the cluster contains any bad channel and if close to calorimeter borders
2186  //
2187  // Old feature, try to rely on PHOS tender
2188  if( GetCaloUtils()->ClusterContainsBadChannel(kPHOS,clus->GetCellsAbsId(), clus->GetNCells()))
2189  continue;
2190 
2191  if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells()))
2192  continue;
2193 
2194  // TODO, add exotic cut???
2195 
2196  fhPHOSClusterCutsE[2]->Fill(clus->E());
2197 
2198  // TODO Dead code? remove?
2199  Int_t vindex = 0 ;
2200  if (fMixedEvent)
2201  vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
2202 
2203  clus->GetMomentum(fMomentum, fVertex[vindex]);
2204 
2205  //----------------------------------------------------------------------------------
2206  // Remove clusters close to borders
2207  //
2209  continue ;
2210 
2211  fhPHOSClusterCutsE[3]->Fill(clus->E());
2212 
2213  //----------------------------------------------------------------------------------
2214  // Remove clusters with too low energy
2215  //
2216  if (fPHOSPtMin > fMomentum.E() || fPHOSPtMax < fMomentum.E() )
2217  continue ;
2218 
2219  fhPHOSClusterCutsE[4]->Fill(clus->E());
2220 
2221  //----------------------------------------------------
2222  // Apply N cells cut
2223  //
2224  if(clus->GetNCells() <= fPHOSNCellsCut && fDataType != AliCaloTrackReader::kMC) return ;
2225 
2226  // Check effect of n cells cut
2227  fhPHOSClusterCutsE[5]->Fill(clus->E());
2228 
2229  //----------------------------------------------------
2230  // Apply distance to bad channel cut
2231  //
2232  Double_t distBad = clus->GetDistanceToBadChannel() ; //Distance to bad channel
2233 
2234  if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
2235 
2236  if(distBad < fPHOSBadChMinDist) return ;
2237 
2238  // Check effect distance to bad channel cut
2239  fhPHOSClusterCutsE[6]->Fill(clus->E());
2240 
2241  // TODO, add time cut
2242 
2243  //----------------------------------------------------------------------------------
2244  // Add selected clusters to array
2245  //
2246  //if(fDebug > 2 && fMomentum.E() > 0.1)
2247  AliDebug(2,Form("Selected clusters E %3.2f, pt %3.2f, phi %3.2f deg, eta %3.2f",
2248  fMomentum.E(),fMomentum.Pt(),RadToDeg(GetPhi(fMomentum.Phi())),fMomentum.Eta()));
2249 
2250  fPHOSClusters->Add(clus);
2251 
2252  // TODO Dead code? remove?
2253  if (fMixedEvent)
2254  clus->SetID(iclus) ;
2255 
2256  } // esd/aod cluster loop
2257 
2258  AliDebug(1,Form("AOD entries %d",fPHOSClusters->GetEntriesFast())) ;
2259 }
2260 
2261 //____________________________________________
2263 //____________________________________________
2265 {
2266  fEMCALCells = fInputEvent->GetEMCALCells();
2267 }
2268 
2269 //___________________________________________
2271 //___________________________________________
2273 {
2274  fPHOSCells = fInputEvent->GetPHOSCells();
2275 }
2276 
2277 //_______________________________________
2280 //_______________________________________
2282 {
2283  AliVVZERO* v0 = fInputEvent->GetVZEROData();
2284  //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
2285 
2286  if (v0)
2287  {
2288  AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0);
2289  for (Int_t i = 0; i < 32; i++)
2290  {
2291  if(esdV0)
2292  {//Only available in ESDs
2293  fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i);
2294  fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i);
2295  }
2296 
2297  fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i);
2298  fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i);
2299  }
2300 
2301  AliDebug(1,Form("ADC (%d,%d), Multiplicity (%d,%d)",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]));
2302  }
2303  else
2304  {
2305  AliDebug(1,"Cannot retrieve V0 ESD! Run w/ null V0 charges");
2306  }
2307 }
2308 
2309 //_________________________________________________
2313 //_________________________________________________
2315 {
2316  AliDebug(2,"Begin");
2317 
2318  //
2319  //check if branch name is given
2320  if(!fInputNonStandardJetBranchName.Length())
2321  {
2322  fInputEvent->Print();
2323  AliFatal("No non-standard jet branch name specified. Specify among existing ones.");
2324  }
2325 
2326  fNonStandardJets = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fInputNonStandardJetBranchName.Data()));
2327 
2328  if(!fNonStandardJets)
2329  {
2330  //check if jet branch exist; exit if not
2331  fInputEvent->Print();
2332 
2333  AliFatal(Form("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputNonStandardJetBranchName.Data()));
2334  }
2335  else
2336  {
2337  AliDebug(1,Form("AOD input jets %d", fNonStandardJets->GetEntriesFast()));
2338  }
2339 }
2340 
2341 //_________________________________________________
2345 //_________________________________________________
2347 {
2348  AliDebug(1,"Begin");
2349  //
2350  //check if branch name is given
2351  if(!fInputBackgroundJetBranchName.Length())
2352  {
2353  fInputEvent->Print();
2354 
2355  AliFatal("No background jet branch name specified. Specify among existing ones.");
2356  }
2357 
2358  fBackgroundJets = (AliAODJetEventBackground*)(fInputEvent->FindListObject(fInputBackgroundJetBranchName.Data()));
2359 
2360  if(!fBackgroundJets)
2361  {
2362  //check if jet branch exist; exit if not
2363  fInputEvent->Print();
2364 
2365  AliFatal(Form("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputBackgroundJetBranchName.Data()));
2366  }
2367  else
2368  {
2369  AliDebug(1,"FillInputBackgroundJets");
2370  fBackgroundJets->Print("");
2371  }
2372 }
2373 
2374 //____________________________________________________________________
2380 //____________________________________________________________________
2382 {
2383  // init some variables
2384  Int_t trigtimes[30], globCol, globRow,ntimes, i;
2385  Int_t absId = -1; //[100];
2386  Int_t nPatch = 0;
2387 
2388  TArrayI patches(0);
2389 
2390  // get object pointer
2391  AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
2392 
2393  if(!caloTrigger)
2394  {
2395  AliError("Trigger patches input (AliVCaloTrigger) not available in data!");
2396  return patches;
2397  }
2398 
2399  //printf("CaloTrigger Entries %d\n",caloTrigger->GetEntries() );
2400 
2401  // class is not empty
2402  if( caloTrigger->GetEntries() > 0 )
2403  {
2404  // must reset before usage, or the class will fail
2405  caloTrigger->Reset();
2406 
2407  // go throuth the trigger channels
2408  while( caloTrigger->Next() )
2409  {
2410  // get position in global 2x2 tower coordinates
2411  caloTrigger->GetPosition( globCol, globRow );
2412 
2413  //L0
2414  if(IsEventEMCALL0())
2415  {
2416  // get dimension of time arrays
2417  caloTrigger->GetNL0Times( ntimes );
2418 
2419  // no L0s in this channel
2420  // presence of the channel in the iterator still does not guarantee that L0 was produced!!
2421  if( ntimes < 1 )
2422  continue;
2423 
2424  // get timing array
2425  caloTrigger->GetL0Times( trigtimes );
2426  //printf("Get L0 patch : n times %d - trigger time window %d - %d\n",ntimes, tmin,tmax);
2427 
2428  // go through the array
2429  for( i = 0; i < ntimes; i++ )
2430  {
2431  // check if in cut - 8,9 shall be accepted in 2011
2432  if( trigtimes[i] >= tmin && trigtimes[i] <= tmax )
2433  {
2434  //printf("Accepted trigger time %d \n",trigtimes[i]);
2435  //if(nTrig > 99) continue;
2436  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absId);
2437  //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId);
2438  patches.Set(nPatch+1);
2439  patches.AddAt(absId,nPatch++);
2440  }
2441  } // trigger time array
2442  }//L0
2443  else if(IsEventEMCALL1()) // L1
2444  {
2445  Int_t bit = 0;
2446  caloTrigger->GetTriggerBits(bit);
2447 
2448  Int_t sum = 0;
2449  caloTrigger->GetL1TimeSum(sum);
2450  //fBitEGA-=2;
2451  Bool_t isEGA1 = ((bit >> fBitEGA ) & 0x1) && IsEventEMCALL1Gamma1() ;
2452  Bool_t isEGA2 = ((bit >> (fBitEGA+1)) & 0x1) && IsEventEMCALL1Gamma2() ;
2453  Bool_t isEJE1 = ((bit >> fBitEJE ) & 0x1) && IsEventEMCALL1Jet1 () ;
2454  Bool_t isEJE2 = ((bit >> (fBitEJE+1)) & 0x1) && IsEventEMCALL1Jet2 () ;
2455 
2456  //if((bit>> fBitEGA )&0x1) printf("Trig Bit %d - bit %d - EG1 %d - EG2 %d\n",fBitEGA ,bit,IsEventEMCALL1Gamma1(),IsEventEMCALL1Gamma2());
2457  //if((bit>>(fBitEGA+1))&0x1) printf("Trig Bit %d - bit %d - EG1 %d - EG2 %d\n",fBitEGA+1,bit,IsEventEMCALL1Gamma1(),IsEventEMCALL1Gamma2());
2458 
2459  if(!isEGA1 && !isEJE1 && !isEGA2 && !isEJE2) continue;
2460 
2461  Int_t patchsize = -1;
2462  if (isEGA1 || isEGA2) patchsize = 2;
2463  else if (isEJE1 || isEJE2) patchsize = 16;
2464 
2465  //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",
2466  // bit,sum,patchsize,isEGA1,isEGA2,isEJE1,isEJE2,fBitEGA,fBitEJE,IsEventEMCALL1Gamma(),IsEventEMCALL1Jet());
2467 
2468 
2469  // add 2x2 (EGA) or 16x16 (EJE) patches
2470  for(Int_t irow=0; irow < patchsize; irow++)
2471  {
2472  for(Int_t icol=0; icol < patchsize; icol++)
2473  {
2474  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol+icol,globRow+irow, absId);
2475  //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId);
2476  patches.Set(nPatch+1);
2477  patches.AddAt(absId,nPatch++);
2478  }
2479  }
2480 
2481  } // L1
2482 
2483  } // trigger iterator
2484  } // go through triggers
2485 
2486  if(patches.GetSize()<=0) AliInfo(Form("No patch found! for triggers: %s and selected <%s>",
2488  //else printf(">>>>> N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nPatch, patches.At(0), patches.At(patches.GetSize()-1));
2489 
2490  return patches;
2491 }
2492 
2493 //____________________________________________________________
2497 //____________________________________________________________
2499 {
2500  // Init info from previous event
2501  fTriggerClusterIndex = -1;
2502  fTriggerClusterId = -1;
2503  fTriggerClusterBC = -10000;
2504  fIsExoticEvent = kFALSE;
2505  fIsBadCellEvent = kFALSE;
2506  fIsBadMaxCellEvent = kFALSE;
2507 
2508  fIsTriggerMatch = kFALSE;
2509  fIsTriggerMatchOpenCut[0] = kFALSE;
2510  fIsTriggerMatchOpenCut[1] = kFALSE;
2511  fIsTriggerMatchOpenCut[2] = kFALSE;
2512 
2513  // Do only analysis for triggered events
2514  if(!IsEventEMCALL1() && !IsEventEMCALL0())
2515  {
2516  fTriggerClusterBC = 0;
2517  return;
2518  }
2519 
2520  //printf("***** Try to match trigger to cluster %d **** L0 %d, L1 %d\n",fTriggerPatchClusterMatch,IsEventEMCALL0(),IsEventEMCALL1());
2521 
2522  //Recover the list of clusters
2523  TClonesArray * clusterList = 0;
2524  if (fInputEvent->FindListObject(fEMCALClustersListName))
2525  {
2526  clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
2527  }
2528  else if(fOutputEvent)
2529  {
2530  clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
2531  }
2532 
2533  // Get number of clusters and of trigger patches
2534  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2535  if(clusterList)
2536  nclusters = clusterList->GetEntriesFast();
2537 
2538  Int_t nPatch = patches.GetSize();
2539  Float_t exoDiffTime = GetCaloUtils()->GetEMCALRecoUtils()->GetExoticCellDiffTimeCut();
2540 
2541  //Init some variables used in the cluster loop
2542  Float_t tofPatchMax = 100000;
2543  Float_t ePatchMax =-1;
2544 
2545  Float_t tofMax = 100000;
2546  Float_t eMax =-1;
2547 
2548  Int_t clusMax =-1;
2549  Int_t idclusMax =-1;
2550  Bool_t badClMax = kFALSE;
2551  Bool_t badCeMax = kFALSE;
2552  Bool_t exoMax = kFALSE;
2553 // Int_t absIdMaxTrig= -1;
2554  Int_t absIdMaxMax = -1;
2555 
2556  Int_t nOfHighECl = 0 ;
2557 
2558  //
2559  // Check what is the trigger threshold
2560  // set minimu energym of candidate for trigger cluster
2561  //
2563 
2564  Float_t triggerThreshold = fTriggerL1EventThreshold;
2565  if(IsEventEMCALL0()) triggerThreshold = fTriggerL0EventThreshold;
2566  Float_t minE = triggerThreshold / 2.;
2567 
2568  // This method is not really suitable for JET trigger
2569  // but in case, reduce the energy cut since we do not trigger on high energy particle
2570  if(IsEventEMCALL1Jet() || minE < 1) minE = 1;
2571 
2572  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));
2573 
2574  //
2575  // Loop on the clusters, check if there is any that falls into one of the patches
2576  //
2577  for (Int_t iclus = 0; iclus < nclusters; iclus++)
2578  {
2579  AliVCluster * clus = 0;
2580  if(clusterList) clus = (AliVCluster*) clusterList->At(iclus);
2581  else clus = fInputEvent->GetCaloCluster(iclus);
2582 
2583  if ( !clus ) continue ;
2584 
2585  if ( !clus->IsEMCAL() ) continue ;
2586 
2587  //Skip clusters with too low energy to be triggering
2588  if ( clus->E() < minE ) continue ;
2589 
2590  Float_t frac = -1;
2591  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
2592 
2593  Bool_t badCluster = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
2594  clus->GetCellsAbsId(),clus->GetNCells());
2595  UShort_t cellMax[] = {(UShort_t) absIdMax};
2596  Bool_t badCell = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),cellMax,1);
2597 
2598  // if cell is bad, it can happen that time calibration is not available,
2599  // when calculating if it is exotic, this can make it to be exotic by default
2600  // open it temporarily for this cluster
2601  if(badCell)
2602  GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(10000000);
2603 
2604  Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
2605 
2606  // Set back the time cut on exotics
2607  if(badCell)
2608  GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(exoDiffTime);
2609 
2610  // Energy threshold for exotic Ecross typically at 4 GeV,
2611  // for lower energy, check that there are more than 1 cell in the cluster
2612  if(!exotic && clus->GetNCells() < 2) exotic = kTRUE;
2613 
2614  Float_t energy = clus->E();
2615  Int_t idclus = clus->GetID();
2616 
2617  Double_t tof = clus->GetTOF();
2618  if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn() && fTriggerClusterTimeRecal){
2619  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
2620  //additional L1 phase shift
2621  if(GetCaloUtils()->GetEMCALRecoUtils()->IsL1PhaseInTimeRecalibrationOn()){
2622  GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absIdMax), fInputEvent->GetBunchCrossNumber(), tof);
2623  }
2624  }
2625  tof *=1.e9;
2626 
2627  //printf("cluster %d, ID %d, E %2.2f, tof %2.2f, AbsId max %d, exotic %d, bad Cluster %d, bad Cell %d\n",
2628  // iclus,idclus, energy,tof,absIdMax, exotic, badCluster,badCell);
2629 
2630  // Find the highest energy cluster, avobe trigger threshold
2631  // in the event in case no match to trigger is found
2632  if( energy > eMax )
2633  {
2634  tofMax = tof;
2635  eMax = energy;
2636  badClMax = badCluster;
2637  badCeMax = badCell;
2638  exoMax = exotic;
2639  clusMax = iclus;
2640  idclusMax = idclus;
2641  absIdMaxMax = absIdMax;
2642  }
2643 
2644  // count the good clusters in the event avobe the trigger threshold
2645  // to check the exotic events
2646  if(!badCluster && !exotic)
2647  nOfHighECl++;
2648 
2649  // Find match to trigger
2650  if(fTriggerPatchClusterMatch && nPatch>0)
2651  {
2652  for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
2653  {
2654  Int_t absIDCell[4];
2655  GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
2656  //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2657  // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2658 
2659  for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2660  {
2661  if(absIdMax == absIDCell[ipatch])
2662  {
2663  //printf("*** Patches : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), tof);
2664  if(energy > ePatchMax)
2665  {
2666  tofPatchMax = tof;
2667  ePatchMax = energy;
2668  fIsBadCellEvent = badCluster;
2669  fIsBadMaxCellEvent = badCell;
2670  fIsExoticEvent = exotic;
2671  fTriggerClusterIndex = iclus;
2672  fTriggerClusterId = idclus;
2673  fIsTriggerMatch = kTRUE;
2674 // absIdMaxTrig = absIdMax;
2675  }
2676  }
2677  }// cell patch loop
2678  }// trigger patch loop
2679  } // Do trigger patch matching
2680 
2681  }// Cluster loop
2682 
2683  // If there was no match, assign as trigger
2684  // the highest energy cluster in the event
2685  if(!fIsTriggerMatch)
2686  {
2687  tofPatchMax = tofMax;
2688  ePatchMax = eMax;
2689  fIsBadCellEvent = badClMax;
2690  fIsBadMaxCellEvent = badCeMax;
2691  fIsExoticEvent = exoMax;
2692  fTriggerClusterIndex = clusMax;
2693  fTriggerClusterId = idclusMax;
2694  }
2695 
2696  Double_t tofPatchMaxUS = TMath::Abs(tofPatchMax);
2697 
2698  if (tofPatchMaxUS < 28 ) fTriggerClusterBC = 0 ;
2699  else if(tofPatchMaxUS < 75 ) fTriggerClusterBC = 1 ;
2700  else if(tofPatchMaxUS < 125) fTriggerClusterBC = 2 ;
2701  else if(tofPatchMaxUS < 175) fTriggerClusterBC = 3 ;
2702  else if(tofPatchMaxUS < 225) fTriggerClusterBC = 4 ;
2703  else if(tofPatchMaxUS < 275) fTriggerClusterBC = 5 ;
2704  else
2705  {
2706  //printf("AliCaloTrackReader::MatchTriggerCluster() - Large BC - tof %2.3f - Index %d\n",tofPatchMaxUS,fTriggerClusterIndex);
2708  else
2709  {
2710  fTriggerClusterIndex = -2;
2711  fTriggerClusterId = -2;
2712  }
2713  }
2714 
2715  if(tofPatchMax < 0) fTriggerClusterBC*=-1;
2716 
2717 
2718  // 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",
2719  // fTriggerClusterIndex, fTriggerClusterId,ePatchMax, tofPatchMax,
2720  // fTriggerClusterBC, fIsBadCellEvent,fIsBadMaxCellEvent,fIsExoticEvent, fIsTriggerMatch, nOfHighECl,absIdMaxMax);
2721  //
2722  // 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",
2723  // clusMax, idclusMax, eMax,tofMax, badClMax, badCeMax,exoMax);
2724 
2725  //Redo matching but open cuts
2726  if(!fIsTriggerMatch && fTriggerClusterId >= 0)
2727  {
2728  // Open time patch time
2729  TArrayI patchOpen = GetTriggerPatches(7,10);
2730 
2731  Int_t patchAbsIdOpenTime = -1;
2732  for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2733  {
2734  Int_t absIDCell[4];
2735  patchAbsIdOpenTime = patchOpen.At(iabsId);
2736  GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patchAbsIdOpenTime, absIDCell);
2737  //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2738  // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2739 
2740  for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2741  {
2742  if(absIdMaxMax == absIDCell[ipatch])
2743  {
2744  fIsTriggerMatchOpenCut[0] = kTRUE;
2745  break;
2746  }
2747  }// cell patch loop
2748  }// trigger patch loop
2749 
2750  // Check neighbour patches
2751  Int_t patchAbsId = -1;
2752  Int_t globalCol = -1;
2753  Int_t globalRow = -1;
2754  GetCaloUtils()->GetEMCALGeometry()->GetFastORIndexFromCellIndex(absIdMaxMax, patchAbsId);
2755  GetCaloUtils()->GetEMCALGeometry()->GetPositionInEMCALFromAbsFastORIndex(patchAbsId,globalCol,globalRow);
2756 
2757  // Check patches with strict time cut
2758  Int_t patchAbsIdNeigh = -1;
2759  for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2760  {
2761  if(icol < 0 || icol > 47) continue;
2762 
2763  for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2764  {
2765  if(irow < 0 || irow > 63) continue;
2766 
2767  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeigh);
2768 
2769  if ( patchAbsIdNeigh < 0 ) continue;
2770 
2771  for(Int_t iabsId =0; iabsId < patches.GetSize(); iabsId++)
2772  {
2773  if(patchAbsIdNeigh == patches.At(iabsId))
2774  {
2775  fIsTriggerMatchOpenCut[1] = kTRUE;
2776  break;
2777  }
2778  }// trigger patch loop
2779 
2780  }// row
2781  }// col
2782 
2783  // Check patches with open time cut
2784  Int_t patchAbsIdNeighOpenTime = -1;
2785  for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2786  {
2787  if(icol < 0 || icol > 47) continue;
2788 
2789  for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2790  {
2791  if(irow < 0 || irow > 63) continue;
2792 
2793  GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeighOpenTime);
2794 
2795  if ( patchAbsIdNeighOpenTime < 0 ) continue;
2796 
2797  for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2798  {
2799  if(patchAbsIdNeighOpenTime == patchOpen.At(iabsId))
2800  {
2801  fIsTriggerMatchOpenCut[2] = kTRUE;
2802  break;
2803  }
2804  }// trigger patch loop
2805 
2806  }// row
2807  }// col
2808 
2809  // printf("No match, new match: Open time %d-%d, open Neigh %d-%d, both open %d-%d\n",fIsTriggerMatchOpenCut[0],patchAbsIdOpenTime,
2810  // fIsTriggerMatchOpenCut[1],patchAbsIdNeigh,
2811  // fIsTriggerMatchOpenCut[2],patchAbsIdNeighOpenTime);
2812 
2813  patchOpen.Reset();
2814 
2815  }// No trigger match found
2816  //printf("Trigger BC %d, Id %d, Index %d\n",fTriggerClusterBC,fTriggerClusterId,fTriggerClusterIndex);
2817 }
2818 
2819 //_________________________________________________________
2823 //_________________________________________________________
2825 {
2827  {
2828  // get object pointer
2829  AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
2830 
2831  if ( fBitEGA == 6 )
2832  {
2833  if (IsEventEMCALL1Gamma1()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(1);
2834  else if(IsEventEMCALL1Gamma2()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(3);
2835  else if(IsEventEMCALL1Jet1 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(0);
2836  else if(IsEventEMCALL1Jet2 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(2);
2837 
2838  // printf("L1 trigger Threshold Jet1 %f, Gamma1 %f, Jet2 %f, Gamma2 %f\n",
2839  // 0.07874*caloTrigger->GetL1Threshold(0),
2840  // 0.07874*caloTrigger->GetL1Threshold(1),
2841  // 0.07874*caloTrigger->GetL1Threshold(2),
2842  // 0.07874*caloTrigger->GetL1Threshold(3));
2843  }
2844  else
2845  {
2846  // Old AOD data format, in such case, order of thresholds different!!!
2847  if (IsEventEMCALL1Gamma1()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(0);
2848  else if(IsEventEMCALL1Gamma2()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(2);
2849  else if(IsEventEMCALL1Jet1 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(1);
2850  else if(IsEventEMCALL1Jet2 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(3);
2851 
2852  // printf("L1 trigger Threshold Jet1 %f, Gamma1 %f, Jet2 %f, Gamma2 %f\n",
2853  // 0.07874*caloTrigger->GetL1Threshold(1),
2854  // 0.07874*caloTrigger->GetL1Threshold(0),
2855  // 0.07874*caloTrigger->GetL1Threshold(3),
2856  // 0.07874*caloTrigger->GetL1Threshold(2));
2857  }
2858  }
2859 
2860  // Set L0 threshold, if not set by user
2862  {
2863  // Revise for periods > LHC11d
2864  Int_t runNumber = fInputEvent->GetRunNumber();
2865  if (runNumber < 146861) fTriggerL0EventThreshold = 3. ;
2866  else if(runNumber < 154000) fTriggerL0EventThreshold = 4. ;
2867  else if(runNumber < 165000) fTriggerL0EventThreshold = 5.5;
2868  else fTriggerL0EventThreshold = 2 ;
2869  }
2870 }
2871 
2872 //________________________________________________________
2874 //________________________________________________________
2875 void AliCaloTrackReader::Print(const Option_t * opt) const
2876 {
2877  if(! opt)
2878  return;
2879 
2880  printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
2881  printf("Task name : %s\n", fTaskName.Data()) ;
2882  printf("Data type : %d\n", fDataType) ;
2883  printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ;
2884  printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ;
2885  printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ;
2886  printf("CTS Max pT : %2.1f GeV/c\n", fCTSPtMax) ;
2887  printf("EMCAL Max pT : %2.1f GeV/c\n", fEMCALPtMax) ;
2888  printf("PHOS Max pT : %2.1f GeV/c\n", fPHOSPtMax) ;
2889  printf("EMCAL Bad Dist > %2.1f \n" , fEMCALBadChMinDist) ;
2890  printf("PHOS Bad Dist > %2.1f \n" , fPHOSBadChMinDist) ;
2891  printf("EMCAL N cells > %d \n" , fEMCALNCellsCut) ;
2892  printf("PHOS N cells > %d \n" , fPHOSNCellsCut) ;
2893  printf("EMCAL Time Cut: %3.1f < TOF < %3.1f\n", fEMCALTimeCutMin, fEMCALTimeCutMax);
2894  printf("Use CTS = %d\n", fFillCTS) ;
2895  printf("Use EMCAL = %d\n", fFillEMCAL) ;
2896  printf("Use DCAL = %d\n", fFillDCAL) ;
2897  printf("Use PHOS = %d\n", fFillPHOS) ;
2898  printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
2899  printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
2900  printf("Track status = %d\n", (Int_t) fTrackStatus) ;
2901 
2902  printf("Track Mult Eta Cut = %2.2f\n", fTrackMultEtaCut) ;
2903  printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ;
2904  printf("Recalculate Clusters = %d, E linearity = %d\n", fRecalculateClusters, fCorrectELinearity) ;
2905 
2906  printf("Use Triggers selected in SE base class %d; If not what Trigger Mask? %d; MB Trigger Mask for mixed %d \n",
2908 
2910  printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor);
2911 
2913  printf("Compare cluster pt and pt hard to accept event, factor = %2.2f",fPtHardAndClusterPtFactor);
2914 
2915  printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ;
2916  printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ;
2917  printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ;
2918 
2919  printf(" \n") ;
2920 }
2921 
2922 //__________________________________________
2926 //__________________________________________
2928 {
2929  // Count number of cells with energy larger than 0.1 in SM3, cut on this number
2930  Int_t ncellsSM3 = 0;
2931  for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++)
2932  {
2933  Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell);
2934  Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
2935  if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++;
2936  }
2937 
2938  Int_t ncellcut = 21;
2939  if(GetFiredTriggerClasses().Contains("EMC")) ncellcut = 35;
2940 
2941  if(ncellsSM3 >= ncellcut)
2942  {
2943  AliDebug(1,Form("Reject event with ncells in SM3 %d, cut %d, trig %s",
2944  ncellsSM3,ncellcut,GetFiredTriggerClasses().Data()));
2945  return kTRUE;
2946  }
2947 
2948  return kFALSE;
2949 }
2950 
2951 //_________________________________________________________
2955 //_________________________________________________________
2957 {
2958  if(label < 0) return ;
2959 
2960  AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
2961  if(!evt) return ;
2962 
2963  TClonesArray * arr = dynamic_cast<TClonesArray*>(evt->FindListObject("mcparticles")) ;
2964  if(!arr) return ;
2965 
2966  if(label < arr->GetEntriesFast())
2967  {
2968  AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(label));
2969  if(!particle) return ;
2970 
2971  if(label == particle->Label()) return ; // label already OK
2972  //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d - AOD stack %d \n",label, particle->Label());
2973  }
2974  //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d > AOD labels %d \n",label, arr->GetEntriesFast());
2975 
2976  // loop on the particles list and check if there is one with the same label
2977  for(Int_t ind = 0; ind < arr->GetEntriesFast(); ind++ )
2978  {
2979  AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(ind));
2980  if(!particle) continue ;
2981 
2982  if(label == particle->Label())
2983  {
2984  label = ind;
2985  //printf("AliAnalysisTaskEMCALClusterize::RemapMCLabelForAODs() - New Label Index %d \n",label);
2986  return;
2987  }
2988  }
2989 
2990  label = -1;
2991 
2992  //printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label not found set to -1 \n");
2993 }
2994 
2995 //___________________________________
2997 //___________________________________
2999 {
3000  if(fCTSTracks) fCTSTracks -> Clear();
3001  if(fEMCALClusters) fEMCALClusters -> Clear("C");
3002  if(fPHOSClusters) fPHOSClusters -> Clear("C");
3003 
3004  fV0ADC[0] = 0; fV0ADC[1] = 0;
3005  fV0Mul[0] = 0; fV0Mul[1] = 0;
3006 
3007  if(fNonStandardJets) fNonStandardJets -> Clear("C");
3008  fBackgroundJets->Reset();
3009 }
3010 
3011 //___________________________________________
3015 //___________________________________________
3017 {
3018  fEventTrigMinBias = kFALSE;
3019  fEventTrigCentral = kFALSE;
3020  fEventTrigSemiCentral = kFALSE;
3021  fEventTrigEMCALL0 = kFALSE;
3022  fEventTrigEMCALL1Gamma1 = kFALSE;
3023  fEventTrigEMCALL1Gamma2 = kFALSE;
3024  fEventTrigEMCALL1Jet1 = kFALSE;
3025  fEventTrigEMCALL1Jet2 = kFALSE;
3026 
3027  AliDebug(1,Form("Select trigger mask bit %d - Trigger Event %s - Select <%s>",
3029 
3030  if(fEventTriggerMask <=0 )// in case no mask set
3031  {
3032  // EMC triggered event? Which type?
3033  if( GetFiredTriggerClasses().Contains("-B-") || GetFiredTriggerClasses().Contains("-S-") || GetFiredTriggerClasses().Contains("-I-") )
3034  {
3035  if ( GetFiredTriggerClasses().Contains("EGA" ) ||
3036  GetFiredTriggerClasses().Contains("EG1" ) )
3037  {
3038  fEventTrigEMCALL1Gamma1 = kTRUE;
3039  if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
3040  }
3041  else if( GetFiredTriggerClasses().Contains("EG2" ) )
3042  {
3043  fEventTrigEMCALL1Gamma2 = kTRUE;
3044  if( !fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
3045  }
3046  else if( GetFiredTriggerClasses().Contains("EJE" ) ||
3047  GetFiredTriggerClasses().Contains("EJ1" ) )
3048  {
3049  fEventTrigEMCALL1Jet1 = kTRUE;
3050  if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") )
3051  fEventTrigEMCALL1Jet1 = kFALSE;
3052  }
3053  else if( GetFiredTriggerClasses().Contains("EJ2" ) )
3054  {
3055  fEventTrigEMCALL1Jet2 = kTRUE;
3056  if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
3057  }
3058  else if( GetFiredTriggerClasses().Contains("CEMC") &&
3059  !GetFiredTriggerClasses().Contains("EGA" ) &&
3060  !GetFiredTriggerClasses().Contains("EJE" ) &&
3061  !GetFiredTriggerClasses().Contains("EG1" ) &&
3062  !GetFiredTriggerClasses().Contains("EJ1" ) &&
3063  !GetFiredTriggerClasses().Contains("EG2" ) &&
3064  !GetFiredTriggerClasses().Contains("EJ2" ) )
3065  {
3066  fEventTrigEMCALL0 = kTRUE;
3067  }
3068 
3069  //Min bias event trigger?
3070  if (GetFiredTriggerClasses().Contains("CCENT_R2-B-NOPF-ALLNOTRD"))
3071  {
3072  fEventTrigCentral = kTRUE;
3073  }
3074  else if(GetFiredTriggerClasses().Contains("CSEMI_R1-B-NOPF-ALLNOTRD"))
3075  {
3076  fEventTrigSemiCentral = kTRUE;
3077  }
3078  else if((GetFiredTriggerClasses().Contains("CINT") || GetFiredTriggerClasses().Contains("CPBI2_B1") ) &&
3079  GetFiredTriggerClasses().Contains("-NOPF-ALLNOTRD") )
3080  {
3081  fEventTrigMinBias = kTRUE;
3082  }
3083  }
3084  }
3085  else
3086  {
3087  // EMC L1 Gamma
3088  if ( fEventTriggerMask & AliVEvent::kEMCEGA )
3089  {
3090  //printf("EGA trigger bit\n");
3091  if (GetFiredTriggerClasses().Contains("EG"))
3092  {
3093  if (GetFiredTriggerClasses().Contains("EGA")) fEventTrigEMCALL1Gamma1 = kTRUE;
3094  else
3095  {
3096  if(GetFiredTriggerClasses().Contains("EG1")) fEventTrigEMCALL1Gamma1 = kTRUE;
3097  if(GetFiredTriggerClasses().Contains("EG2")) fEventTrigEMCALL1Gamma2 = kTRUE;
3098  }
3099  }
3100  }
3101  // EMC L1 Jet
3102  else if( fEventTriggerMask & AliVEvent::kEMCEJE )
3103  {
3104  //printf("EGA trigger bit\n");
3105  if (GetFiredTriggerClasses().Contains("EJ"))
3106  {
3107  if (GetFiredTriggerClasses().Contains("EJE")) fEventTrigEMCALL1Jet1 = kTRUE;
3108  else
3109  {
3110  if(GetFiredTriggerClasses().Contains("EJ1")) fEventTrigEMCALL1Jet1 = kTRUE;
3111  if(GetFiredTriggerClasses().Contains("EJ2")) fEventTrigEMCALL1Jet2 = kTRUE;
3112  }
3113  }
3114  }
3115  // EMC L0
3116  else if((fEventTriggerMask & AliVEvent::kEMC7) ||
3117  (fEventTriggerMask & AliVEvent::kEMC1) )
3118  {
3119  //printf("L0 trigger bit\n");
3120  fEventTrigEMCALL0 = kTRUE;
3121  }
3122  // Min Bias Pb-Pb
3123  else if( fEventTriggerMask & AliVEvent::kCentral )
3124  {
3125  //printf("MB semi central trigger bit\n");
3126  fEventTrigSemiCentral = kTRUE;
3127  }
3128  // Min Bias Pb-Pb
3129  else if( fEventTriggerMask & AliVEvent::kSemiCentral )
3130  {
3131  //printf("MB central trigger bit\n");
3132  fEventTrigCentral = kTRUE;
3133  }
3134  // Min Bias pp, PbPb, pPb
3135  else if((fEventTriggerMask & AliVEvent::kMB ) ||
3136  (fEventTriggerMask & AliVEvent::kINT7) ||
3137  (fEventTriggerMask & AliVEvent::kINT8) ||
3138  (fEventTriggerMask & AliVEvent::kAnyINT) )
3139  {
3140  //printf("MB trigger bit\n");
3141  fEventTrigMinBias = kTRUE;
3142  }
3143  }
3144 
3145  AliDebug(1,Form("Event bits: \n \t MB %d, Cen %d, Sem %d, L0 %d, L1G1 %d, L1G2 %d, L1J1 %d, L1J2 %d",
3149 
3150  // L1 trigger bit
3151  if( fBitEGA == 0 && fBitEJE == 0 )
3152  {
3153  // Init the trigger bit once, correct depending on AliESD(AOD)CaloTrigger header version
3154 
3155  // Simpler way to do it ...
3156 // if( fInputEvent->GetRunNumber() < 172000 )
3157 // reader->SetEventTriggerL1Bit(4,5); // current LHC11 data
3158 // else
3159 // reader->SetEventTriggerL1Bit(6,8); // LHC12-13 data
3160 
3161  // Old values
3162  fBitEGA = 4;
3163  fBitEJE = 5;
3164 
3165  TFile* file = AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile();
3166 
3167  const TList *clist = file->GetStreamerInfoCache();
3168 
3169  if(clist)
3170  {
3171  TStreamerInfo *cinfo = (TStreamerInfo*)clist->FindObject("AliESDCaloTrigger");
3172  Int_t verid = 5; // newer ESD header version
3173  if(!cinfo)
3174  {
3175  cinfo = (TStreamerInfo*)clist->FindObject("AliAODCaloTrigger");
3176  verid = 3; // newer AOD header version
3177  }
3178 
3179  if(cinfo)
3180  {
3181  Int_t classversionid = cinfo->GetClassVersion();
3182  //printf("********* Header class version %d *********** \n",classversionid);
3183 
3184  if (classversionid >= verid)
3185  {
3186  fBitEGA = 6;
3187  fBitEJE = 8;
3188  }
3189  } else AliInfo("AliCaloTrackReader()::SetEventTriggerBit() - Streamer info for trigger class not available, bit not changed");
3190  } else AliInfo("AliCaloTrackReader::SetEventTriggerBit() - Streamer list not available!, bit not changed");
3191 
3192  } // set once the EJE, EGA trigger bit
3193 }
3194 
3195 //____________________________________________________________
3198 //____________________________________________________________
3199 void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)
3200 {
3201  fInputEvent = input;
3202  fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ;
3203  if (fMixedEvent)
3204  fNMixedEvent = fMixedEvent->GetNumberOfEvents() ;
3205 
3206  //Delete previous vertex
3207  if(fVertex)
3208  {
3209  for (Int_t i = 0; i < fNMixedEvent; i++)
3210  {
3211  delete [] fVertex[i] ;
3212  }
3213  delete [] fVertex ;
3214  }
3215 
3216  fVertex = new Double_t*[fNMixedEvent] ;
3217  for (Int_t i = 0; i < fNMixedEvent; i++)
3218  {
3219  fVertex[i] = new Double_t[3] ;
3220  fVertex[i][0] = 0.0 ;
3221  fVertex[i][1] = 0.0 ;
3222  fVertex[i][2] = 0.0 ;
3223  }
3224 }
3225 
3226 
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 AliGenEventHeader * GetGenEventHeader() 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.
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.
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
Bool_t AcceptParticleMCLabel(Int_t mcLabel) const
AliMCEvent * fMC
! Monte Carlo Event Handler.
TH1I * fhNEventsAfterCut
! Each bin represents number of events resulting after a given selection cut: vertex, trigger, ...
Float_t fPtHardAndJetPtFactor
Factor between ptHard and jet pT to reject/accept event.
TString fMCGenerEventHeaderToAccept
Accept events that contain at least this event header name.
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