AliPhysics  3337bb0 (3337bb0)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnaCaloTrackCorrBaseClass.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 <TClonesArray.h>
18 //#include <Riostream.h>
19 
20 //---- AliRoot system ----
22 #include "AliCaloTrackReader.h"
23 #include "AliCalorimeterUtils.h"
24 #include "AliCaloPID.h"
25 #include "AliFiducialCut.h"
26 #include "AliIsolationCut.h"
27 #include "AliMCAnalysisUtils.h"
29 #include "AliVCaloCells.h"
30 #include "AliMCEvent.h"
31 #include "AliAODEvent.h"
32 #include "AliAODHandler.h"
33 #include "AliCaloTrackParticle.h"
34 
38 
39 //__________________________________________________________
42 //__________________________________________________________
44 TObject(),
45 fNModules(20), fNRCU(2),
46 fFirstModule(0), fLastModule(19),
47 fNMaxCols(48), fNMaxRows(24),
48 fNMaxColsFull(48), fNMaxRowsFull(24),
49 fNMaxRowsFullMin(0), fNMaxRowsFullMax(24),
50 fDataMC(0), fDebug(0),
51 fCalorimeter(-1), fCalorimeterString(""),
52 fCheckFidCut(0), fCheckRealCaloAcc(0),
53 fCheckCaloPID(0), fRecalculateCaloPID(0),
54 fMinPt(0), fMaxPt(0),
55 fPairTimeCut(200), fTRDSMCovered(-1),
56 fNZvertBin(0), fNrpBin(0),
57 fNCentrBin(0), fNmaxMixEv(0),
58 fDoOwnMix(0), fUseTrackMultBins(0),
59 fFillPileUpHistograms(0), fFillHighMultHistograms(0),
60 fMakePlots(kFALSE),
61 fInputAODBranch(0x0), fInputAODName(""),
62 fOutputAODBranch(0x0), fNewAOD(kFALSE),
63 fOutputAODName(""), fOutputAODClassName(""),
64 fAODObjArrayName(""), fAddToHistogramsName(""),
65 fCaloPID(0x0), fCaloUtils(0x0),
66 fFidCut(0x0), fHisto(0x0),
67 fIC(0x0), fMCUtils(0x0),
68 fNMS(0x0), fReader(0x0),
69 fStudyClusterOverlapsPerGenerator(0),
70 fNCocktailGenNames(0)
71 {
73 }
74 
75 //___________________________________________________________
77 //___________________________________________________________
79 {
80  //delete fCaloUtils ; //Already deleted in maker
81  //delete fReader ; //Already deleted in maker
82 
83  delete fCaloPID ;
84  delete fFidCut ;
85  delete fIC ;
86  delete fMCUtils ;
87  delete fNMS ;
88  delete fHisto ;
89 }
90 
91 //______________________________________________________________________
94 //______________________________________________________________________
96 {
97  if(!fOutputAODBranch)
98  {
99  AliFatal("No AOD branch available!!!\n");
100  return; // coverity
101  }
102 
103  Int_t i = fOutputAODBranch->GetEntriesFast();
104  //new((*fOutputAODBranch)[i]) AliCaloTrackParticle(pc);
105  if (strcmp(fOutputAODBranch->GetClass()->GetName(),"AliCaloTrackParticle")==0)
106  {
107  new((*fOutputAODBranch)[i]) AliCaloTrackParticle(pc);
108  }
109  else if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliCaloTrackParticleCorrelation")==0)
110  {
111  new((*fOutputAODBranch)[i]) AliCaloTrackParticleCorrelation(pc);
112  }
113  else
114  {
115  AliFatal(Form("Cannot add an object of type < %s >, to the AOD TClonesArray \n", fOutputAODBranch->GetClass()->GetName()));
116  }
117 }
118 
119 //__________________________________________________________________________________________
124 //__________________________________________________________________________________________
126 {
127  if (!GetMixedEvent()) return 1; // Not mixed event continue normal processing
128 
129  Int_t evt = -1;
130 
131  if (caloLabel >= 0 )
132  {
133  evt = GetMixedEvent()->EventIndexForCaloCluster(caloLabel) ;
134  }
135  else if(trackLabel >= 0 )
136  {
137  evt = GetMixedEvent()->EventIndex(trackLabel) ;
138  }
139  else
140  return 0; // go to next entry in the particle list
141 
142  if(evt == -1)
143  return 0 ; // to content coverity
144 
145  if (TMath::Abs(GetVertex(evt)[2]) > GetZvertexCut()) return -1; // Vertex out of range process next event
146 
147  return 1 ; // continue processing normally
148 }
149 
150 //________________________________________________________________
153 //________________________________________________________________
155 {
156  AliDebug(3,Form("AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() - Connect Input with name: <%s>; Connect output with name <%s>\n",fInputAODName.Data(),fOutputAODName.Data()));
157 
158  //Get the AOD handler, if output AOD is created use it, if not get the branches from the input which should be deltaAODs
159  AliAODHandler* aodHandler = 0x0;
160  Bool_t outAOD = kFALSE;
161  if((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()) outAOD = kTRUE;
162  if(outAOD) aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
163  else aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
164 
166  {
169  }
170  else if (aodHandler->GetExtensions())
171  {
172  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(GetReader()->GetDeltaAODFileName());
173  if(ext)
174  {
175  AliAODEvent *aodEvent = ext->GetAOD();
176  if(fNewAOD)fOutputAODBranch = (TClonesArray*) aodEvent->FindListObject(fOutputAODName);
177  fInputAODBranch = (TClonesArray*) aodEvent->FindListObject(fInputAODName);
178  if(!fOutputAODBranch && fNewAOD) fOutputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
179  if(!fInputAODBranch) fInputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);
180  }
181  else
182  { // If no Delta AODs, kept in standard branch, to revise.
183  if(fNewAOD && fReader->GetOutputEvent())
184  {
185  fOutputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
186  fInputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);
187  }
188  else
189  {
190  fInputAODBranch = (TClonesArray *) fReader->GetInputEvent()->FindListObject(fInputAODName);
192  fInputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);//Try the output event.
193  }
194  }
195  }
196  else
197  { // If no Delta AODs, kept in standard branch
198  if(fNewAOD && fReader->GetOutputEvent())
199  {
200  fOutputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
201  fInputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);
202  }
203  else
204  {
205  fInputAODBranch = (TClonesArray *) fReader->GetInputEvent()->FindListObject(fInputAODName);
207  fInputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);//Try the output event.
208  }
209  }
210 
211 // if(GetDebug() > 1)
212 // {
213 // if(fNewAOD && !fOutputAODBranch)
214 // AliInfo(Form("Output Branch <%s>, not found!\n",fOutputAODName.Data()));
215 // if(!fNewAOD && !fInputAODBranch)
216 // AliInfo(Form("Input Branch <%s>, not found!\n",fInputAODName.Data()));
217 // }
218 }
219 
220 //_____________________________________________________________________________________
228 //_____________________________________________________________________________________
230  Int_t & iclus, Int_t first)
231 {
232  if ( !clusters ) return 0x0;
233 
234  for(iclus = first; iclus < clusters->GetEntriesFast(); iclus++)
235  {
236  AliVCluster *cluster= dynamic_cast<AliVCluster*> (clusters->At(iclus));
237  if ( cluster )
238  {
239  if ( cluster->GetID() == clId )
240  {
241  return cluster;
242  }
243  }
244  }// calorimeter clusters loop
245 
246  return 0x0;
247 }
248 
249 //______________________________________________________________________________________
251 //______________________________________________________________________________________
252 TClonesArray * AliAnaCaloTrackCorrBaseClass::GetAODBranch(const TString & aodName) const
253 {
254  AliDebug(3,Form("AliAnaCaloTrackCorrBaseClass::GetAODBranch() - Get Input Branch with name: <%s>; \n",aodName.Data()));
255 
256  //Get the AOD handler, if output AOD is created use it, if not get the branches from the input which should be deltaAODs
257  AliAODHandler* aodHandler = 0x0;
258  Bool_t outAOD = kFALSE;
259  if((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()) outAOD = kTRUE;
260  if(outAOD) aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
261  else aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
262 
264  {
265  return (TClonesArray *) (fReader->GetAODBranchList())->FindObject(aodName);
266  }
267  else if (aodHandler->GetExtensions())
268  {
269  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(GetReader()->GetDeltaAODFileName());
270  if(ext){
271  AliAODEvent *aodEvent = ext->GetAOD();
272  TClonesArray * aodbranch = (TClonesArray*) aodEvent->FindListObject(aodName);
273  if(aodbranch) return aodbranch;
274  else {
275  if(outAOD) return (TClonesArray *) fReader->GetOutputEvent()->FindListObject(aodName);
276  else return (TClonesArray *) fReader->GetInputEvent() ->FindListObject(aodName);
277  }
278  }
279  else{//If no Delta AODs, kept in standard branch, to revise.
280  if(outAOD) return (TClonesArray *) fReader->GetOutputEvent()->FindListObject(aodName);
281  else return (TClonesArray *) fReader->GetInputEvent() ->FindListObject(aodName);
282  }
283  }
284  else{ //If no Delta AODs, kept in standard branch, to revise.
285  if(outAOD) return (TClonesArray *) fReader->GetOutputEvent()->FindListObject(aodName);
286  else return (TClonesArray *) fReader->GetInputEvent() ->FindListObject(aodName);
287  }
288 }
289 
290 //_____________________________________________________________
292 //_____________________________________________________________
294 {
295  return fReader->GetCTSTracks();
296 }
297 
298 //________________________________________________________________
300 //________________________________________________________________
302 {
303  return fReader->GetPHOSClusters();
304 }
305 
306 //_________________________________________________________________
308 //_________________________________________________________________
310 {
311  return fReader->GetEMCALClusters();
312 }
313 
314 //______________________________________________________________________
316 //______________________________________________________________________
318 {
319  return fReader->GetOutputEvent()->GetCaloClusters();
320 }
321 
322 //________________________________________________________________
324 //________________________________________________________________
326 {
327  return fReader->GetOutputEvent()->GetTracks();
328 }
329 
330 //____________________________________________________________
333 //____________________________________________________________
335 {
336  TString parList ; //this will be list of parameters used for this analysis.
337  const Int_t buffersize = 255;
338  char onePar[buffersize] ;
339  snprintf(onePar,buffersize,"--- AliAnaCaloTrackCorrBaseClass ---\n") ;
340  parList+=onePar ;
341  snprintf(onePar,buffersize,"Minimal P_t: %2.2f ; Max\n", fMinPt) ;
342  parList+=onePar ;
343  snprintf(onePar,buffersize,"Minimal P_t: %2.2f ; Max\n", fMaxPt) ;
344  parList+=onePar ;
345  snprintf(onePar,buffersize,"|t_{1}-t_{2}| < %2.2f ; Max\n", fPairTimeCut) ;
346  parList+=onePar ;
347  snprintf(onePar,buffersize,"fDataMC =%d (Check MC information, on/off) \n",fDataMC) ;
348  parList+=onePar ;
349  snprintf(onePar,buffersize,"fCheckFidCut=%d (Check Fiducial cut selection on/off) \n",fCheckFidCut) ;
350  parList+=onePar ;
351  snprintf(onePar,buffersize,"fCheckRealCaloAcc=%d (Check Real Calo Acceptance on/off) \n",fCheckRealCaloAcc) ;
352  parList+=onePar ;
353  snprintf(onePar,buffersize,"fCheckCaloPID =%d (Use Bayesian PID in calorimetes, on/off) \n",fCheckCaloPID) ;
354  parList+=onePar ;
355  snprintf(onePar,buffersize,"fRecalculateCaloPID =%d (Calculate PID from shower/tof/tracking parameters, on/off) \n",fRecalculateCaloPID) ;
356  parList+=onePar ;
357  snprintf(onePar,buffersize,"fInputAODName =%s Input AOD name \n",fInputAODName.Data()) ;
358  parList+=onePar ;
359  if(fNewAOD)
360  {
361  snprintf(onePar,buffersize,"fOutputAODName =%s Output AOD name \n",fOutputAODName.Data()) ;
362  parList+=onePar ;
363  snprintf(onePar,buffersize,"fOutputAODClassName =%s Output AOD class name \n",fOutputAODClassName.Data()) ;
364  parList+=onePar ;
365  }
366  snprintf(onePar,buffersize,"fAODObjArrayName =%s Reference arrays in AOD name \n",fAODObjArrayName.Data()) ;
367  parList+=onePar ;
368  snprintf(onePar,buffersize,"fAddToHistogramsName =%s String added to beginning of histograms name \n",fAddToHistogramsName.Data()) ;
369  parList+=onePar ;
370 
371  return parList;
372 }
373 
374 //_____________________________________________________________________
385 //_____________________________________________________________________
387  TString & genName , Int_t & index,
388  TString & genNameBkg, Int_t & indexBkg)
389 {
390  if(cluster->GetNLabels() == 0 || cluster->GetLabel() < 0 ) return -1;
391 
392  //(GetReader()->GetMC())->
393  index = GetReader()->GetCocktailGeneratorAndIndex(cluster->GetLabel(), genName);
394  //TString genNameOrg;
395  //(GetReader()->GetMC())->GetCocktailGenerator(cluster->GetLabel(), genNameOrg);
396 
397  //printf("Generator?: %s, index %d\n",genName.Data(), index);
398 
399  Bool_t overlapGener = kFALSE;
400  Bool_t overlapGenerHIJING = kFALSE;
401  Bool_t overlapGenerOther = kFALSE;
402 
403  genNameBkg = "";
404  indexBkg = -1;
405 
406  const UInt_t nlabels = cluster->GetNLabels();
407  //Int_t noverlapsGen = 0;
408  //TString genName2Prev = genName;
409  for(UInt_t ilabel = 1; ilabel < nlabels; ilabel++)
410  {
411  Int_t label2 = cluster->GetLabels()[ilabel];
412  TString genName2;
413  //(GetReader()->GetMC())->GetCocktailGenerator(label2,genName2);
414  Int_t index2 = GetReader()->GetCocktailGeneratorAndIndex(label2, genName2);
415 
416  //if(genName2 != genName2Prev) noverlapsGen++;
417 
418  if(genName2 != genName)
419  {
420  //genName2Prev = genName2;
421 
422  if(!genNameBkg.Contains(genName2) && indexBkg != index2)
423  {
424  genNameBkg = Form("%s_%s",genNameBkg.Data(), genName2.Data());
425  indexBkg = index2;
426  }
427 
428  overlapGener = kTRUE;
429 
430  if( genName2.Contains("ijing") && !genName.Contains("ijing"))
431  overlapGenerHIJING = kTRUE;
432 
433  if(!genName2.Contains("ijing"))
434  overlapGenerOther = kTRUE;
435  }
436  }
437 
438  Int_t genBkgTag = -1;
439 
440  if ( !overlapGener ) genBkgTag = 0; // Pure
441  else if ( overlapGenerHIJING && !overlapGenerOther) genBkgTag = 1; // Gen+Hij
442  else if ( !overlapGenerHIJING && overlapGenerOther) genBkgTag = 2; // GenX+GenY
443  else if ( overlapGenerHIJING && overlapGenerOther) genBkgTag = 3; // GenX+GenY+Hij
444  else genBkgTag = 4;
445 
446  // check overlap with same generator, but not hijing
447  Int_t overpdg[nlabels];
448  Int_t overlab[nlabels];
449  Int_t noverlaps = GetMCAnalysisUtils()->GetNOverlaps(cluster->GetLabels(), nlabels,mctag,-1,GetMC(),overpdg,overlab);
450  Bool_t sameGenOverlap = kFALSE;
451  Bool_t sameGenOverlapHI = kFALSE;
452  for(Int_t iover = 0; iover < noverlaps; iover++)
453  {
454  TString genName2;
455  //(GetReader()->GetMC())->GetCocktailGenerator(overlab[iover],genName2);
456  Int_t index2 = GetReader()->GetCocktailGeneratorAndIndex(overlab[iover], genName2);
457 
458  if ( genName2==genName && index==index2)
459  {
460  if ( !genName.Contains("ijing") ) sameGenOverlap = kTRUE;
461  else sameGenOverlapHI = kTRUE;
462  }
463  }
464 
465  //printf("bkg tag %d, noverlaps %d; same gen overlap %d\n",genBkgTag,noverlaps,sameGenOverlap);
466  if(sameGenOverlap)
467  {
468  if(genBkgTag == 0) genBkgTag = 2; // GenX+GenX
469  if(genBkgTag == 1) genBkgTag = 3; // GenX+GenX+Hij
470  }
471 
472  // Logic a bit different for hijing main particles
473  if(genName.Contains("ijing"))
474  {
475 
476  if(sameGenOverlapHI)
477  {
478  if(!overlapGener) genBkgTag = 1; // Hij+Hij
479  else genBkgTag = 3; // Hij+Gen+Hij
480  }
481  else
482  {
483  if(!overlapGener) genBkgTag = 0; // Pure
484  else genBkgTag = 2; // Hij+Gen
485  }
486  }
487 
488  return genBkgTag;
489 }
490 
491 //_____________________________________________________________________
493 //_____________________________________________________________________
495 {
496  AliInfo(Form("Create AOD branch of %s objects and with name < %s >\n",
497  fOutputAODClassName.Data(),fOutputAODName.Data())) ;
498 
499  TClonesArray * aodBranch = new TClonesArray(fOutputAODClassName, 0);
500 
501  aodBranch->SetName(fOutputAODName);
502 
503  return aodBranch ;
504 }
505 
506 //________________________________________________________
508 //________________________________________________________
510 {
511  return fReader->GetEventNumber() ;
512 }
513 
514 //__________________________________________________________
516 //__________________________________________________________
518 {
519  return fReader->GetMC();
520 }
521 
522 //____________________________________________________________
524 //____________________________________________________________
526 {
527  return fReader->GetHeader();
528 }
529 
530 //____________________________________________________________________________
532 //____________________________________________________________________________
534 {
535  return fReader->GetGenEventHeader();
536 }
537 
538 //_________________________________________________________________
543 //_________________________________________________________________
545 {
546  //curCentrBin = (GetTrackMultiplicity()-1)/5;
547  //if(curCentrBin > GetNCentrBin()-1) curCentrBin=GetNCentrBin()-1;
548  Int_t trackMult = GetReader()->GetTrackMultiplicity();
549 
550  for(Int_t ibin = 0; ibin < GetNTrackMultBin()-1; ibin++)
551  {
552  if(trackMult >= fTrackMultBins[ibin] && trackMult < fTrackMultBins[ibin+1]) return ibin;
553  }
554 
555  AliWarning(Form("Bin not found for track multiplicity %d",trackMult));
556 
557  return -1;
558 }
559 
560 //________________________________________________________________
564 //________________________________________________________________
566 {
567  Int_t curCentrBin = 0;
568 
569  if(fUseTrackMultBins) // pp collisions
570  {
571  return GetTrackMultiplicityBin();
572  }
573  else // Set centrality based on centrality task, PbPb collisions
574  {
575  Float_t minCent = GetReader()->GetCentralityBin(0);
576  Float_t maxCent = GetReader()->GetCentralityBin(1);
577 
578  if((minCent< 0 && maxCent< 0) || minCent>=maxCent)
579  {
580  curCentrBin = GetEventCentrality() * GetNCentrBin() / GetReader()->GetCentralityOpt();
581  if(curCentrBin==GetNCentrBin())
582  {
583  curCentrBin = GetNCentrBin()-1;
584  AliDebug(1,Form("Centrality = %d, put it in last bin \n",GetEventCentrality()));
585  }
586  }
587  else
588  {
589  curCentrBin = (Int_t)((GetEventCentrality()-minCent) * GetNCentrBin() / (maxCent-minCent));
590  if(curCentrBin==GetNCentrBin()) curCentrBin = GetNCentrBin()-1;
591  }
592 
593  AliDebug(1,Form("Current CentrBin %d, centrality %d, n bins %d, max bin from centrality %d",
594  curCentrBin, GetEventCentrality(), GetNCentrBin(), GetReader()->GetCentralityOpt()));
595  }
596 
597  return curCentrBin;
598 }
599 
600 //_______________________________________________________
602 //_______________________________________________________
604 {
605  Int_t curRPBin = 0 ;
606 
607  if(GetNRPBin() > 1 && GetEventPlane())
608  {
609  Float_t epAngle = GetEventPlaneAngle();//->GetEventplane(GetEventPlaneMethod(),fReader->GetInputEvent());
610 
611  if(epAngle < 0 || epAngle >TMath::Pi())
612  {
613  AliWarning(Form("Wrong event plane angle : %f \n",epAngle));
614  return -1;
615  }
616 
617  curRPBin = TMath::Nint(epAngle*(GetNRPBin()-1)/TMath::Pi());
618  if(curRPBin >= GetNRPBin()) printf("RP Bin %d out of range %d",curRPBin,GetNRPBin());
619 
620  AliDebug(1,Form("Current RP bin %d, bin float %f, angle %f, n bins %d",
621  curRPBin,epAngle*(GetNRPBin()-1)/TMath::Pi(),epAngle,GetNRPBin()));
622  }
623 
624  return curRPBin ;
625 }
626 
627 //_______________________________________________________
630 //_______________________________________________________
632 {
633  Double_t v[3] = {0,0,0}; //vertex
634  GetReader()->GetVertex(v);
635 
636  Int_t curZvertBin = (Int_t)(0.5*GetNZvertBin()*(v[2]+GetZvertexCut())/GetZvertexCut());
637 
638  AliDebug(1,Form("AliAnaCaloTrackCorrBaseClass::GetEventVzBin() - %d, vz %2.2f, n bins %d",
639  curZvertBin, v[2], GetNZvertBin()));
640 
641  return curZvertBin;
642 }
643 
644 //________________________________________________________________________________________
646 //________________________________________________________________________________________
648 {
649  if(iCen<0 || iVz < 0 || iRP < 0)
650  return -1;
651  else
652  return iCen*GetNZvertBin()*GetNRPBin()+iVz*GetNRPBin()+iRP;
653 }
654 
655 //________________________________________________________
657 //________________________________________________________
659 {
660  //Get vertex z bin
661  Int_t iVz = GetEventVzBin();
662 
663  // centrality (PbPb) or tracks multiplicity (pp) bin
664  Int_t iCen = GetEventCentralityBin();
665 
666  // reaction plane bin (PbPb)
667  Int_t iRP = GetEventRPBin();
668 
669  Int_t eventBin = GetEventMixBin(iCen, iVz, iRP);
670 
671  AliDebug(1,Form("Bins : cent %d, vz %d, RP %d, event %d/%d",
672  iCen,iVz, iRP, eventBin, GetNZvertBin()*GetNRPBin()*GetNCentrBin()));
673 
674  return eventBin;
675 }
676 
677 //____________________________________________
680 //____________________________________________
682 {
683  if( fDebug >= 0 )
684  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(this->ClassName(),fDebug);
685 
686  if( GetMCAnalysisUtils()->GetDebug() >= 0 )
687  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(GetMCAnalysisUtils()->ClassName(),GetMCAnalysisUtils()->GetDebug());
688 
689  if( GetIsolationCut()->GetDebug() >= 0 )
690  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(GetIsolationCut()->ClassName(),GetIsolationCut()->GetDebug());
691 
692  if( GetNeutralMesonSelection()->GetDebug() >= 0 )
693  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(GetNeutralMesonSelection()->ClassName(),GetNeutralMesonSelection()->GetDebug());
694 
695  //printf("Debug levels: Ana %d, MC %d, Iso %d\n",fDebug,GetMCAnalysisUtils()->GetDebug(),GetIsolationCut()->GetDebug());
696 }
697 
698 //_________________________________________________
700 //_________________________________________________
702 {
703  fDataMC = kFALSE;
704  fDebug = 0;
705  fCheckCaloPID = kTRUE ;
706  fCheckFidCut = kFALSE ;
707  fCheckRealCaloAcc = kFALSE ;
708  fRecalculateCaloPID = kFALSE ;
709  fMinPt = 0.2 ; //Min pt in particle analysis
710  fMaxPt = 300. ; //Max pt in particle analysis
711  fNZvertBin = 1;
712  fNrpBin = 1;
713 
714  fCalorimeterString = "EMCAL";
715  fCalorimeter = kEMCAL ;
716 
717  fTrackMultBins[0] = 0; fTrackMultBins[1] = 5; fTrackMultBins[2] = 10;
718  fTrackMultBins[3] = 15; fTrackMultBins[4] = 20; fTrackMultBins[5] = 30;
719  fTrackMultBins[6] = 40; fTrackMultBins[7] = 55; fTrackMultBins[8] = 70;
720  for(Int_t ibin=9; ibin < 20; ibin++) fTrackMultBins[ibin] = 10000;
721 
722  //fReader = new AliCaloTrackReader(); //Initialized in maker
723  //fCaloUtils = new AliCalorimeterUtils();//Initialized in maker
724 
725  fNewAOD = kFALSE ;
726  fOutputAODName = "CaloTrackCorr";
727  fOutputAODClassName = "AliCaloTrackParticle";
728  fInputAODName = "CaloTrackCorr";
730  fAODObjArrayName = "Ref";
731 
732  fNCocktailGenNames = 7;
733  // Order matters, here cocktail of MC LHC14a1a
734  fCocktailGenNames[0] = ""; // First must be always empty
735  fCocktailGenNames[1] = "pi0EMC";
736  fCocktailGenNames[2] = "pi0";
737  fCocktailGenNames[3] = "etaEMC";
738  fCocktailGenNames[4] = "eta";
739  fCocktailGenNames[5] = "hijing";
740  fCocktailGenNames[6] = "other";
741 
742  for(Int_t igen = 7; igen < 10; igen++)
743  fCocktailGenNames[igen] = "";
744 
745  for(Int_t igen = 0; igen < 10; igen++)
746  fCocktailGenIndeces[igen] = -1;
747 }
748 
749 //_________________________________________________
754 //_________________________________________________
756 {
758  if(GetCalorimeter()==kPHOS && fNModules > 4) fNModules = 4;
759 
760  fFirstModule = 0;
762 
763  // Set First/Last SM depending on CaloUtils or fiducial cut settings
764 
765  if ( IsFiducialCutOn() )
766  {
767  //printf("Get SM range from FiducialCut\n");
768 
769  if(GetCalorimeter() != kPHOS)
770  {
771  Int_t nSections = GetFiducialCut()->GetEMCALFidCutMaxPhiArray()->GetSize();
772  if( nSections == 1 )
773  {
774  Float_t minPhi = GetFiducialCut()->GetEMCALFidCutMinPhiArray()->At(0);
775  Float_t maxPhi = GetFiducialCut()->GetEMCALFidCutMaxPhiArray()->At(0);
776  //printf("sections %d, min %f, max %f\n",nSections,minPhi,maxPhi);
777 
778  if ( minPhi > 70 && maxPhi < 190) // EMCal
779  {
780  fFirstModule = 0;
781  fLastModule = 11;
782  }
783  else if( minPhi > 250 && maxPhi < 330) // DCal
784  {
785  fFirstModule = 12;
786  fLastModule = 19;
787  }
788  }
789  }
790  }
791 
792  // Overwrite what used in FidCut, if more strict on CaloUtils
793  // Needed for special case in QA analysis train
794  if ( GetCaloUtils()->GetFirstSuperModuleUsed() >= 0 )
795  {
796  if(fFirstModule < GetCaloUtils()->GetFirstSuperModuleUsed() ||
797  fLastModule > GetCaloUtils()->GetLastSuperModuleUsed())
798  {
799  //printf("Get SM range from CaloUtils\n");
800 
803  }
804  }
805 
806  // EMCAL
807  fNMaxCols = 48;
808  fNMaxRows = 24;
809  fNRCU = 2 ;
810  // PHOS
811  if(GetCalorimeter()==kPHOS)
812  {
813  fNMaxCols = 56;
814  fNMaxRows = 64;
815  fNRCU = 4 ;
816  }
817 
820 
822  fNMaxRowsFullMin = 0;
823 
824  if(GetCalorimeter()==kEMCAL)
825  {
827 
829  if(fNMaxRowsFull > 208)
830  fNMaxRowsFull = 208; // 8*24+2/3.*24, reduce since 1/3 SM should not be counted full.
831 
832  fNMaxRowsFullMin = 0;
834 
835  if(fLastModule < 12)
836  {
838  if(fNMaxRowsFullMax > 127) fNMaxRowsFullMax = 127; // 24*5+8
839  fNMaxRowsFullMin = 0;
840  }
841  else if (fFirstModule > 11)
842  {
844  fNMaxRowsFullMin = Int_t(fFirstModule/2)*fNMaxRows-Int_t(2./3.*fNMaxRows); // remove 2/3*24
845  }
846  }
847  else
848  {
850  }
851 
852 // printf("%s: N SM %d, first SM %d, last SM %d, SM col-row (%d,%d), Full detector col-row (%d, %d), partial calo row min-max(%d,%d) \n",
853 // GetName(),fNModules,fFirstModule,fLastModule, fNMaxCols,fNMaxRows,
854 // fNMaxColsFull,fNMaxRowsFull, fNMaxRowsFullMin,fNMaxRowsFullMax);
855 
856  AliDebug(1,Form("N SM %d, first SM %d, last SM %d, SM col-row (%d,%d), Full detector col-row (%d, %d), partial calo row min-max(%d,%d)",
859 
860 
861 }
862 
863 //__________________________________________________________________
865 //__________________________________________________________________
867 {
868  if(! opt)
869  return;
870 
871  printf("New AOD: = %d\n", fNewAOD);
872  printf("Input AOD name: = %s\n", fInputAODName.Data());
873  printf("Output AOD name: = %s\n", fOutputAODName.Data());
874  printf("Output AOD Class name: = %s\n", fOutputAODClassName.Data());
875  printf("Name of reference array : %s\n", fAODObjArrayName.Data());
876  printf("String added histograms name : %s\n", fAddToHistogramsName.Data());
877 
878  printf("Min Photon pT = %2.2f\n", fMinPt) ;
879  printf("Max Photon pT = %3.2f\n", fMaxPt) ;
880  printf("Check PID = %d\n", fCheckCaloPID) ;
881  printf("Recalculate PID = %d\n", fRecalculateCaloPID) ;
882  printf("Check Fiducial cut = %d\n", fCheckFidCut) ;
883  printf("Check Real Calo Acc = %d\n", fCheckRealCaloAcc) ;
884  printf("Check MC labels = %d\n", fDataMC);
885  printf("Make plots? = %d\n", fMakePlots);
886  printf("Debug Level = %d\n", fDebug);
887 
888  printf(" \n") ;
889 }
890 
891 //_______________________________________________________________
893 //_______________________________________________________________
895 {
896  fCalorimeterString = calo;
897 
898  if (calo=="EMCAL") fCalorimeter = kEMCAL;
899  else if(calo=="PHOS" ) fCalorimeter = kPHOS;
900  else if(calo=="CTS") fCalorimeter = kCTS;
901  else if(calo=="DCAL") fCalorimeter = kDCAL;
902  else if(calo.Contains("DCAL") && calo.Contains("PHOS")) fCalorimeter = kDCALPHOS;
903  else AliFatal(Form("Detector < %s > not known!", calo.Data()));
904 
905 }
906 
907 //_______________________________________________________________
909 //_______________________________________________________________
911 {
912  fCalorimeter = calo;
913 
914  if (calo==kEMCAL) fCalorimeterString = "EMCAL";
915  else if(calo==kPHOS ) fCalorimeterString = "PHOS";
916  else if(calo==kCTS) fCalorimeterString = "CTS";
917  else if(calo==kDCAL) fCalorimeterString = "DCAL";
918  else if(calo==kDCALPHOS) fCalorimeterString = "DCAL_PHOS";
919  else AliFatal(Form("Detector < %d > not known!", calo));
920 }
921 
922 
AliFiducialCut * fFidCut
Acceptance cuts detector dependent.
TString fOutputAODName
Name of output AOD branch.
virtual AliHeader * GetMCHeader() const
Int_t GetCocktailGeneratorBackgroundTag(AliVCluster *clus, Int_t mctag, TString &genName, Int_t &index, TString &genNameBkg, Int_t &indexBkg)
virtual AliMCEvent * GetMC() const
virtual ~AliAnaCaloTrackCorrBaseClass()
Destructor.
Int_t GetDebug() const
virtual TObjArray * GetCTSTracks() const
virtual void InitParameters()
Initialize the parameters of the analysis.
Int_t fNMaxColsFull
Number of EMCAL/PHOS columns full detector.
double Double_t
Definition: External.C:58
virtual void AddAODParticle(AliCaloTrackParticle part)
virtual AliHeader * GetHeader() const
Int_t fCocktailGenIndeces[10]
Array with indeces of generators to study.
Int_t fTrackMultBins[20]
Multiplicity bins limits. Number of bins set with SetNTrackMult() that calls SetNCentrBin().
Int_t GetLastSuperModuleUsed() const
Int_t fLastModule
Last EMCAL/PHOS module, set in CaloUtils or depending fidutial cuts.
Bool_t fCheckFidCut
Do analysis for clusters in defined region.
virtual void GetVertex(Double_t vertex[3]) const
virtual TObjArray * GetEMCALClusters() const
Bool_t WriteDeltaAODToFile() const
virtual AliVEvent * GetInputEvent() const
virtual void SetCalorimeter(TString &calo)
Set the calorimeter for the analysis. A string.
virtual Int_t GetNTrackMultBin() const
Number of bins in centrality.
virtual AliIsolationCut * GetIsolationCut()
virtual Float_t GetZvertexCut() const
Maximal number of events for mixin.
Int_t fNModules
Number of EMCAL/PHOS modules to use in analysis, set in CaloUtils.
virtual Double_t GetEventPlaneAngle() const
Bool_t fRecalculateCaloPID
Recalculate PID or use PID weights in calorimeters.
Float_t fPairTimeCut
Maximum difference between time of cluster pairs (ns).
AliHistogramRanges * fHisto
Histogram ranges container.
TArrayF * GetEMCALFidCutMaxPhiArray() const
Int_t fNMaxCols
Number of EMCAL/PHOS columns per SM.
virtual AliNeutralMesonSelection * GetNeutralMesonSelection()
virtual AliGenEventHeader * GetMCGenEventHeader() const
TString fInputAODName
Name of input AOD branch.
Int_t fFirstModule
First EMCAL/PHOS module, set in CaloUtils or depending fidutial cuts.
virtual AliGenEventHeader * GetGenEventHeader() const
virtual void GetVertex(Double_t v[3]) const
TString fCocktailGenNames[10]
Array with name of generators to study, first must be always empty.
AliCaloTrackReader * fReader
Access to ESD/AOD/MC data and other utilities.
TString fCalorimeterString
Calorimeter selection.
virtual Float_t GetCentralityBin(Int_t i) const
virtual Int_t GetEventNumber() const
Daughter of AliCaloTrackParticle that includes correlation part.
Int_t GetCocktailGeneratorAndIndex(Int_t index, TString &nameGen) const
Base class for CaloTrackCorr analysis algorithms.
virtual AliFiducialCut * GetFiducialCut()
int Int_t
Definition: External.C:63
Container for input particle information on CaloTrackCorr package.
Int_t GetTrackMultiplicity(Int_t cut=0) const
unsigned int UInt_t
Definition: External.C:33
virtual TList * GetAODBranchList() const
float Float_t
Definition: External.C:68
TClonesArray * fInputAODBranch
! Selected input particles branch.
Float_t fMinPt
Maximum pt of (trigger) particles in the analysis.
Bool_t fUseTrackMultBins
Use track multiplicity and not centrality bins in mixing.
virtual TClonesArray * GetAODBranch(const TString &aodBranchName) const
Recover ouput and input AOD pointers for each event in AliCaloTrackMaker.
virtual Int_t GetCentralityOpt() const
virtual AliAODEvent * GetOutputEvent() const
AliIsolationCut * fIC
Isolation cut utils.
Float_t fMaxPt
Minimum pt of (trigger) particles in the analysis.
virtual AliCalorimeterUtils * GetCaloUtils() const
Int_t fNMaxRowsFullMin
Last of EMCAL/PHOS rows full detector.
Int_t GetDebug() const
Int_t GetNumberOfSuperModulesUsed() const
virtual AliEventplane * GetEventPlane() const
Bool_t fCheckRealCaloAcc
When analysis of MC particle kinematics, check their hit in Calorimeter in Real Geometry or use AliFi...
Bool_t outAOD
Definition: ana.C:67
TString fOutputAODClassName
Type of aod objects to be stored in the TClonesArray (AliCaloTrackParticle, AliCaloTrackParticleCorre...
virtual Int_t GetNCentrBin() const
Number of bins in reaction plain.
virtual TObjArray * GetPHOSClusters() const
virtual TObjArray * GetPHOSClusters() const
TObject * FindObject(int bin, const char *nameH, const TList *lst, Bool_t normPerEvent=kTRUE)
virtual TClonesArray * GetAODCaloClusters() const
Int_t fNRCU
Number of EMCAL/PHOS RCU.
Bool_t fNewAOD
Flag, new aod branch added to the analysis or not.
AliMCAnalysisUtils * fMCUtils
MonteCarlo Analysis utils.
virtual Int_t GetNRPBin() const
Number of bins in vertex.
virtual TClonesArray * GetCreateOutputAODBranch()
Create AOD branch filled in the analysis.
Int_t fNMaxRowsFull
Number of EMCAL/PHOS rows full detector.
virtual AliMCAnalysisUtils * GetMCAnalysisUtils()
AliCaloPID * fCaloPID
PID calculation utils.
Int_t fNCocktailGenNames
Number of generators to study.
virtual Int_t GetTrackMultiplicityBin() const
Cut on vertex position.
Int_t fNrpBin
Number of bins in event container for reaction plain.
AliNeutralMesonSelection * fNMS
Neutral Meson Selection utities.
virtual void Print(const Option_t *) const
Print some relevant parameters set for the analysis.
Bool_t fDataMC
Flag to access MC data when using ESD or AOD.
TClonesArray * fOutputAODBranch
! Selected output particles branch.
const char Option_t
Definition: External.C:48
virtual TClonesArray * GetAODTracks() const
virtual AliVCluster * FindCluster(TObjArray *clusters, Int_t clId, Int_t &iclus, Int_t first=0)
virtual AliCaloTrackReader * GetReader() const
bool Bool_t
Definition: External.C:53
Int_t fNZvertBin
Number of bins in event container for vertex position.
Int_t fNMaxRowsFullMax
First of EMCAL/PHOS rows full detector.
Bool_t fCheckCaloPID
Do analysis for calorimeters.
Int_t fCalorimeter
Calorimeter selection.
TString fAddToHistogramsName
Add this string to histograms name.
Int_t GetFirstSuperModuleUsed() const
virtual TObjArray * GetEMCALClusters() const
DCal, not used so far, just in case.
virtual Int_t CheckMixedEventVertex(Int_t caloLabel, Int_t trackLabel)
TArrayF * GetEMCALFidCutMinPhiArray() const
TString fAODObjArrayName
Name of ref array kept in a TList in AliAODParticleCorrelation with clusters or track. references.
Int_t GetNOverlaps(const Int_t *label, UInt_t nlabels, Int_t mctag, Int_t mesonLabel, AliMCEvent *mcevent, Int_t *overpdg, Int_t *overlabel)
virtual AliMixedEvent * GetMixedEvent() const
virtual TObjArray * GetCTSTracks() const
Int_t fNMaxRows
Number of EMCAL/PHOS rows per SM.