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