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