AliPhysics  0937c79 (0937c79)
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),
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 fNMS ;
87  delete fHisto ;
88 }
89 
90 //______________________________________________________________________
93 //______________________________________________________________________
95 {
96  if(!fOutputAODBranch)
97  {
98  AliFatal("No AOD branch available!!!\n");
99  return; // coverity
100  }
101 
102  Int_t i = fOutputAODBranch->GetEntriesFast();
103  //new((*fOutputAODBranch)[i]) AliCaloTrackParticle(pc);
104  if (strcmp(fOutputAODBranch->GetClass()->GetName(),"AliCaloTrackParticle")==0)
105  {
106  new((*fOutputAODBranch)[i]) AliCaloTrackParticle(pc);
107  }
108  else if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliCaloTrackParticleCorrelation")==0)
109  {
110  new((*fOutputAODBranch)[i]) AliCaloTrackParticleCorrelation(pc);
111  }
112  else
113  {
114  AliFatal(Form("Cannot add an object of type < %s >, to the AOD TClonesArray \n", fOutputAODBranch->GetClass()->GetName()));
115  }
116 }
117 
118 //__________________________________________________________________________________________
123 //__________________________________________________________________________________________
125 {
126  if (!GetMixedEvent()) return 1; // Not mixed event continue normal processing
127 
128  Int_t evt = -1;
129 
130  if (caloLabel >= 0 )
131  {
132  evt = GetMixedEvent()->EventIndexForCaloCluster(caloLabel) ;
133  }
134  else if(trackLabel >= 0 )
135  {
136  evt = GetMixedEvent()->EventIndex(trackLabel) ;
137  }
138  else
139  return 0; // go to next entry in the particle list
140 
141  if(evt == -1)
142  return 0 ; // to content coverity
143 
144  if (TMath::Abs(GetVertex(evt)[2]) > GetZvertexCut()) return -1; // Vertex out of range process next event
145 
146  return 1 ; // continue processing normally
147 }
148 
149 //________________________________________________________________
152 //________________________________________________________________
154 {
155  AliDebug(3,Form("AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() - Connect Input with name: <%s>; Connect output with name <%s>\n",fInputAODName.Data(),fOutputAODName.Data()));
156 
157  //Get the AOD handler, if output AOD is created use it, if not get the branches from the input which should be deltaAODs
158  AliAODHandler* aodHandler = 0x0;
159  Bool_t outAOD = kFALSE;
160  if((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()) outAOD = kTRUE;
161  if(outAOD) aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
162  else aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
163 
165  {
168  }
169  else if (aodHandler->GetExtensions())
170  {
171  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(GetReader()->GetDeltaAODFileName());
172  if(ext)
173  {
174  AliAODEvent *aodEvent = ext->GetAOD();
175  if(fNewAOD)fOutputAODBranch = (TClonesArray*) aodEvent->FindListObject(fOutputAODName);
176  fInputAODBranch = (TClonesArray*) aodEvent->FindListObject(fInputAODName);
177  if(!fOutputAODBranch && fNewAOD) fOutputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
178  if(!fInputAODBranch) fInputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);
179  }
180  else
181  { // If no Delta AODs, kept in standard branch, to revise.
182  if(fNewAOD && fReader->GetOutputEvent())
183  {
184  fOutputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
185  fInputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);
186  }
187  else
188  {
189  fInputAODBranch = (TClonesArray *) fReader->GetInputEvent()->FindListObject(fInputAODName);
191  fInputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);//Try the output event.
192  }
193  }
194  }
195  else
196  { // If no Delta AODs, kept in standard branch
197  if(fNewAOD && fReader->GetOutputEvent())
198  {
199  fOutputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
200  fInputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);
201  }
202  else
203  {
204  fInputAODBranch = (TClonesArray *) fReader->GetInputEvent()->FindListObject(fInputAODName);
206  fInputAODBranch = (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);//Try the output event.
207  }
208  }
209 
210 // if(GetDebug() > 1)
211 // {
212 // if(fNewAOD && !fOutputAODBranch)
213 // AliInfo(Form("Output Branch <%s>, not found!\n",fOutputAODName.Data()));
214 // if(!fNewAOD && !fInputAODBranch)
215 // AliInfo(Form("Input Branch <%s>, not found!\n",fInputAODName.Data()));
216 // }
217 }
218 
219 //_____________________________________________________________________________________
227 //_____________________________________________________________________________________
229  Int_t & iclus, Int_t first)
230 {
231  if ( !clusters ) return 0x0;
232 
233  for(iclus = first; iclus < clusters->GetEntriesFast(); iclus++)
234  {
235  AliVCluster *cluster= dynamic_cast<AliVCluster*> (clusters->At(iclus));
236  if ( cluster )
237  {
238  if ( cluster->GetID() == clId )
239  {
240  return cluster;
241  }
242  }
243  }// calorimeter clusters loop
244 
245  return 0x0;
246 }
247 
248 //______________________________________________________________________________________
250 //______________________________________________________________________________________
252 {
253  AliDebug(3,Form("AliAnaCaloTrackCorrBaseClass::GetAODBranch() - Get Input Branch with name: <%s>; \n",aodName.Data()));
254 
255  //Get the AOD handler, if output AOD is created use it, if not get the branches from the input which should be deltaAODs
256  AliAODHandler* aodHandler = 0x0;
257  Bool_t outAOD = kFALSE;
258  if((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()) outAOD = kTRUE;
259  if(outAOD) aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
260  else aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
261 
263  {
264  return (TClonesArray *) (fReader->GetAODBranchList())->FindObject(aodName);
265  }
266  else if (aodHandler->GetExtensions())
267  {
268  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(GetReader()->GetDeltaAODFileName());
269  if(ext){
270  AliAODEvent *aodEvent = ext->GetAOD();
271  TClonesArray * aodbranch = (TClonesArray*) aodEvent->FindListObject(aodName);
272  if(aodbranch) return aodbranch;
273  else {
274  if(outAOD) return (TClonesArray *) fReader->GetOutputEvent()->FindListObject(aodName);
275  else return (TClonesArray *) fReader->GetInputEvent() ->FindListObject(aodName);
276  }
277  }
278  else{//If no Delta AODs, kept in standard branch, to revise.
279  if(outAOD) return (TClonesArray *) fReader->GetOutputEvent()->FindListObject(aodName);
280  else return (TClonesArray *) fReader->GetInputEvent() ->FindListObject(aodName);
281  }
282  }
283  else{ //If no Delta AODs, kept in standard branch, to revise.
284  if(outAOD) return (TClonesArray *) fReader->GetOutputEvent()->FindListObject(aodName);
285  else return (TClonesArray *) fReader->GetInputEvent() ->FindListObject(aodName);
286  }
287 }
288 
289 //_____________________________________________________________
291 //_____________________________________________________________
293 {
294  return fReader->GetCTSTracks();
295 }
296 
297 //________________________________________________________________
299 //________________________________________________________________
301 {
302  return fReader->GetPHOSClusters();
303 }
304 
305 //_________________________________________________________________
307 //_________________________________________________________________
309 {
310  return fReader->GetEMCALClusters();
311 }
312 
313 //______________________________________________________________________
315 //______________________________________________________________________
317 {
318  return fReader->GetOutputEvent()->GetCaloClusters();
319 }
320 
321 //________________________________________________________________
323 //________________________________________________________________
325 {
326  return fReader->GetOutputEvent()->GetTracks();
327 }
328 
329 //____________________________________________________________
332 //____________________________________________________________
334 {
335  TString parList ; //this will be list of parameters used for this analysis.
336  const Int_t buffersize = 255;
337  char onePar[buffersize] ;
338  snprintf(onePar,buffersize,"--- AliAnaCaloTrackCorrBaseClass ---\n") ;
339  parList+=onePar ;
340  snprintf(onePar,buffersize,"Minimal P_t: %2.2f ; Max\n", fMinPt) ;
341  parList+=onePar ;
342  snprintf(onePar,buffersize,"Minimal P_t: %2.2f ; Max\n", fMaxPt) ;
343  parList+=onePar ;
344  snprintf(onePar,buffersize,"|t_{1}-t_{2}| < %2.2f ; Max\n", fPairTimeCut) ;
345  parList+=onePar ;
346  snprintf(onePar,buffersize,"fDataMC =%d (Check MC information, on/off) \n",fDataMC) ;
347  parList+=onePar ;
348  snprintf(onePar,buffersize,"fCheckFidCut=%d (Check Fiducial cut selection on/off) \n",fCheckFidCut) ;
349  parList+=onePar ;
350  snprintf(onePar,buffersize,"fCheckRealCaloAcc=%d (Check Real Calo Acceptance on/off) \n",fCheckRealCaloAcc) ;
351  parList+=onePar ;
352  snprintf(onePar,buffersize,"fCheckCaloPID =%d (Use Bayesian PID in calorimetes, on/off) \n",fCheckCaloPID) ;
353  parList+=onePar ;
354  snprintf(onePar,buffersize,"fRecalculateCaloPID =%d (Calculate PID from shower/tof/tracking parameters, on/off) \n",fRecalculateCaloPID) ;
355  parList+=onePar ;
356  snprintf(onePar,buffersize,"fInputAODName =%s Input AOD name \n",fInputAODName.Data()) ;
357  parList+=onePar ;
358  if(fNewAOD)
359  {
360  snprintf(onePar,buffersize,"fOutputAODName =%s Output AOD name \n",fOutputAODName.Data()) ;
361  parList+=onePar ;
362  snprintf(onePar,buffersize,"fOutputAODClassName =%s Output AOD class name \n",fOutputAODClassName.Data()) ;
363  parList+=onePar ;
364  }
365  snprintf(onePar,buffersize,"fAODObjArrayName =%s Reference arrays in AOD name \n",fAODObjArrayName.Data()) ;
366  parList+=onePar ;
367  snprintf(onePar,buffersize,"fAddToHistogramsName =%s String added to beginning of histograms name \n",fAddToHistogramsName.Data()) ;
368  parList+=onePar ;
369 
370  return parList;
371 }
372 
373 //_____________________________________________________________________
384 //_____________________________________________________________________
386  TString & genName , Int_t & index,
387  TString & genNameBkg, Int_t & indexBkg)
388 {
389  if(cluster->GetNLabels() == 0 || cluster->GetLabel() < 0 ) return -1;
390 
391  //(GetReader()->GetMC())->
392  index = GetReader()->GetCocktailGeneratorAndIndex(cluster->GetLabel(), genName);
393  //TString genNameOrg;
394  //(GetReader()->GetMC())->GetCocktailGenerator(cluster->GetLabel(), genNameOrg);
395 
396  //printf("Generator?: %s, index %d\n",genName.Data(), index);
397 
398  Bool_t overlapGener = kFALSE;
399  Bool_t overlapGenerHIJING = kFALSE;
400  Bool_t overlapGenerOther = kFALSE;
401 
402  genNameBkg = "";
403  indexBkg = -1;
404 
405  const UInt_t nlabels = cluster->GetNLabels();
406  //Int_t noverlapsGen = 0;
407  //TString genName2Prev = genName;
408  for(UInt_t ilabel = 1; ilabel < nlabels; ilabel++)
409  {
410  Int_t label2 = cluster->GetLabels()[ilabel];
411  TString genName2;
412  //(GetReader()->GetMC())->GetCocktailGenerator(label2,genName2);
413  Int_t index2 = GetReader()->GetCocktailGeneratorAndIndex(label2, genName2);
414 
415  //if(genName2 != genName2Prev) noverlapsGen++;
416 
417  if(genName2 != genName)
418  {
419  //genName2Prev = genName2;
420 
421  if(!genNameBkg.Contains(genName2) && indexBkg != index2)
422  {
423  genNameBkg = Form("%s_%s",genNameBkg.Data(), genName2.Data());
424  indexBkg = index2;
425  }
426 
427  overlapGener = kTRUE;
428 
429  if( genName2.Contains("ijing") && !genName.Contains("ijing"))
430  overlapGenerHIJING = kTRUE;
431 
432  if(!genName2.Contains("ijing"))
433  overlapGenerOther = kTRUE;
434  }
435  }
436 
437  Int_t genBkgTag = -1;
438 
439  if ( !overlapGener ) genBkgTag = 0; // Pure
440  else if ( overlapGenerHIJING && !overlapGenerOther) genBkgTag = 1; // Gen+Hij
441  else if ( !overlapGenerHIJING && overlapGenerOther) genBkgTag = 2; // GenX+GenY
442  else if ( overlapGenerHIJING && overlapGenerOther) genBkgTag = 3; // GenX+GenY+Hij
443  else genBkgTag = 4;
444 
445  // check overlap with same generator, but not hijing
446  Int_t overpdg[nlabels];
447  Int_t overlab[nlabels];
448  Int_t noverlaps = GetMCAnalysisUtils()->GetNOverlaps(cluster->GetLabels(), nlabels,mctag,-1,GetMC(),overpdg,overlab);
449  Bool_t sameGenOverlap = kFALSE;
450  Bool_t sameGenOverlapHI = kFALSE;
451  for(Int_t iover = 0; iover < noverlaps; iover++)
452  {
453  TString genName2;
454  //(GetReader()->GetMC())->GetCocktailGenerator(overlab[iover],genName2);
455  Int_t index2 = GetReader()->GetCocktailGeneratorAndIndex(overlab[iover], genName2);
456 
457  if ( genName2==genName && index==index2)
458  {
459  if ( !genName.Contains("ijing") ) sameGenOverlap = kTRUE;
460  else sameGenOverlapHI = kTRUE;
461  }
462  }
463 
464  //printf("bkg tag %d, noverlaps %d; same gen overlap %d\n",genBkgTag,noverlaps,sameGenOverlap);
465  if(sameGenOverlap)
466  {
467  if(genBkgTag == 0) genBkgTag = 2; // GenX+GenX
468  if(genBkgTag == 1) genBkgTag = 3; // GenX+GenX+Hij
469  }
470 
471  // Logic a bit different for hijing main particles
472  if(genName.Contains("ijing"))
473  {
474 
475  if(sameGenOverlapHI)
476  {
477  if(!overlapGener) genBkgTag = 1; // Hij+Hij
478  else genBkgTag = 3; // Hij+Gen+Hij
479  }
480  else
481  {
482  if(!overlapGener) genBkgTag = 0; // Pure
483  else genBkgTag = 2; // Hij+Gen
484  }
485  }
486 
487  return genBkgTag;
488 }
489 
490 //_____________________________________________________________________
492 //_____________________________________________________________________
494 {
495  AliInfo(Form("Create AOD branch of %s objects and with name < %s >\n",
496  fOutputAODClassName.Data(),fOutputAODName.Data())) ;
497 
498  TClonesArray * aodBranch = new TClonesArray(fOutputAODClassName, 0);
499 
500  aodBranch->SetName(fOutputAODName);
501 
502  return aodBranch ;
503 }
504 
505 //________________________________________________________
507 //________________________________________________________
509 {
510  return fReader->GetEventNumber() ;
511 }
512 
513 //__________________________________________________________
515 //__________________________________________________________
517 {
518  return fReader->GetMC();
519 }
520 
521 //____________________________________________________________
523 //____________________________________________________________
525 {
526  return fReader->GetHeader();
527 }
528 
529 //____________________________________________________________________________
531 //____________________________________________________________________________
533 {
534  return fReader->GetGenEventHeader();
535 }
536 
537 //_________________________________________________________________
542 //_________________________________________________________________
544 {
545  //curCentrBin = (GetTrackMultiplicity()-1)/5;
546  //if(curCentrBin > GetNCentrBin()-1) curCentrBin=GetNCentrBin()-1;
547  Int_t trackMult = GetReader()->GetTrackMultiplicity();
548 
549  for(Int_t ibin = 0; ibin < GetNTrackMultBin()-1; ibin++)
550  {
551  if(trackMult >= fTrackMultBins[ibin] && trackMult < fTrackMultBins[ibin+1]) return ibin;
552  }
553 
554  AliWarning(Form("Bin not found for track multiplicity %d",trackMult));
555 
556  return -1;
557 }
558 
559 //________________________________________________________________
563 //________________________________________________________________
565 {
566  Int_t curCentrBin = 0;
567 
568  if(fUseTrackMultBins) // pp collisions
569  {
570  return GetTrackMultiplicityBin();
571  }
572  else // Set centrality based on centrality task, PbPb collisions
573  {
574  Float_t minCent = GetReader()->GetCentralityBin(0);
575  Float_t maxCent = GetReader()->GetCentralityBin(1);
576 
577  if((minCent< 0 && maxCent< 0) || minCent>=maxCent)
578  {
579  curCentrBin = GetEventCentrality() * GetNCentrBin() / GetReader()->GetCentralityOpt();
580  if(curCentrBin==GetNCentrBin())
581  {
582  curCentrBin = GetNCentrBin()-1;
583  AliDebug(1,Form("Centrality = %d, put it in last bin \n",GetEventCentrality()));
584  }
585  }
586  else
587  {
588  curCentrBin = (Int_t)((GetEventCentrality()-minCent) * GetNCentrBin() / (maxCent-minCent));
589  if(curCentrBin==GetNCentrBin()) curCentrBin = GetNCentrBin()-1;
590  }
591 
592  AliDebug(1,Form("Current CentrBin %d, centrality %d, n bins %d, max bin from centrality %d",
593  curCentrBin, GetEventCentrality(), GetNCentrBin(), GetReader()->GetCentralityOpt()));
594  }
595 
596  return curCentrBin;
597 }
598 
599 //_______________________________________________________
601 //_______________________________________________________
603 {
604  Int_t curRPBin = 0 ;
605 
606  if(GetNRPBin() > 1 && GetEventPlane())
607  {
608  Float_t epAngle = GetEventPlaneAngle();//->GetEventplane(GetEventPlaneMethod(),fReader->GetInputEvent());
609 
610  if(epAngle < 0 || epAngle >TMath::Pi())
611  {
612  AliWarning(Form("Wrong event plane angle : %f \n",epAngle));
613  return -1;
614  }
615 
616  curRPBin = TMath::Nint(epAngle*(GetNRPBin()-1)/TMath::Pi());
617  if(curRPBin >= GetNRPBin()) printf("RP Bin %d out of range %d",curRPBin,GetNRPBin());
618 
619  AliDebug(1,Form("Current RP bin %d, bin float %f, angle %f, n bins %d",
620  curRPBin,epAngle*(GetNRPBin()-1)/TMath::Pi(),epAngle,GetNRPBin()));
621  }
622 
623  return curRPBin ;
624 }
625 
626 //_______________________________________________________
629 //_______________________________________________________
631 {
632  Double_t v[3] = {0,0,0}; //vertex
633  GetReader()->GetVertex(v);
634 
635  Int_t curZvertBin = (Int_t)(0.5*GetNZvertBin()*(v[2]+GetZvertexCut())/GetZvertexCut());
636 
637  AliDebug(1,Form("AliAnaCaloTrackCorrBaseClass::GetEventVzBin() - %d, vz %2.2f, n bins %d",
638  curZvertBin, v[2], GetNZvertBin()));
639 
640  return curZvertBin;
641 }
642 
643 //________________________________________________________________________________________
645 //________________________________________________________________________________________
647 {
648  if(iCen<0 || iVz < 0 || iRP < 0)
649  return -1;
650  else
651  return iCen*GetNZvertBin()*GetNRPBin()+iVz*GetNRPBin()+iRP;
652 }
653 
654 //________________________________________________________
656 //________________________________________________________
658 {
659  //Get vertex z bin
660  Int_t iVz = GetEventVzBin();
661 
662  // centrality (PbPb) or tracks multiplicity (pp) bin
663  Int_t iCen = GetEventCentralityBin();
664 
665  // reaction plane bin (PbPb)
666  Int_t iRP = GetEventRPBin();
667 
668  Int_t eventBin = GetEventMixBin(iCen, iVz, iRP);
669 
670  AliDebug(1,Form("Bins : cent %d, vz %d, RP %d, event %d/%d",
671  iCen,iVz, iRP, eventBin, GetNZvertBin()*GetNRPBin()*GetNCentrBin()));
672 
673  return eventBin;
674 }
675 
676 //____________________________________________
679 //____________________________________________
681 {
682  if( fDebug >= 0 )
683  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(this->ClassName(),fDebug);
684 
685  if( GetIsolationCut()->GetDebug() >= 0 )
686  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(GetIsolationCut()->ClassName(),GetIsolationCut()->GetDebug());
687 
688  if( GetNeutralMesonSelection()->GetDebug() >= 0 )
689  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(GetNeutralMesonSelection()->ClassName(),GetNeutralMesonSelection()->GetDebug());
690 
691  //printf("Debug levels: Ana %d, Neutral Sel %d, Iso %d\n",fDebug,GetNeutralMesonSelection()->GetDebug(),GetIsolationCut()->GetDebug());
692 }
693 
694 //_________________________________________________
696 //_________________________________________________
698 {
699  fDataMC = kFALSE;
700  fDebug = 0;
701  fCheckCaloPID = kTRUE ;
702  fCheckFidCut = kFALSE ;
703  fCheckRealCaloAcc = kFALSE ;
704  fRecalculateCaloPID = kFALSE ;
705  fMinPt = 0.2 ; //Min pt in particle analysis
706  fMaxPt = 300. ; //Max pt in particle analysis
707  fNZvertBin = 1;
708  fNrpBin = 1;
709 
710  fCalorimeterString = "EMCAL";
711  fCalorimeter = kEMCAL ;
712 
713  fTrackMultBins[0] = 0; fTrackMultBins[1] = 5; fTrackMultBins[2] = 10;
714  fTrackMultBins[3] = 15; fTrackMultBins[4] = 20; fTrackMultBins[5] = 30;
715  fTrackMultBins[6] = 40; fTrackMultBins[7] = 55; fTrackMultBins[8] = 70;
716  for(Int_t ibin=9; ibin < 20; ibin++) fTrackMultBins[ibin] = 10000;
717 
718  //fReader = new AliCaloTrackReader(); //Initialized in maker
719  //fCaloUtils = new AliCalorimeterUtils();//Initialized in maker
720 
721  fNewAOD = kFALSE ;
722  fOutputAODName = "CaloTrackCorr";
723  fOutputAODClassName = "AliCaloTrackParticle";
724  fInputAODName = "CaloTrackCorr";
726  fAODObjArrayName = "Ref";
727 
728  fNCocktailGenNames = 7;
729  // Order matters, here cocktail of MC LHC14a1a
730  fCocktailGenNames[0] = ""; // First must be always empty
731  fCocktailGenNames[1] = "pi0EMC";
732  fCocktailGenNames[2] = "pi0";
733  fCocktailGenNames[3] = "etaEMC";
734  fCocktailGenNames[4] = "eta";
735  fCocktailGenNames[5] = "hijing";
736  fCocktailGenNames[6] = "other";
737 
738  for(Int_t igen = 7; igen < 10; igen++)
739  fCocktailGenNames[igen] = "";
740 
741  for(Int_t igen = 0; igen < 10; igen++)
742  fCocktailGenIndeces[igen] = -1;
743 }
744 
745 //_________________________________________________
750 //_________________________________________________
752 {
754  if(GetCalorimeter()==kPHOS && fNModules > 4) fNModules = 4;
755 
756  fFirstModule = 0;
758 
759  // Set First/Last SM depending on CaloUtils or fiducial cut settings
760 
761  if ( IsFiducialCutOn() )
762  {
763  //printf("Get SM range from FiducialCut\n");
764 
765  if(GetCalorimeter() != kPHOS)
766  {
767  Int_t nSections = GetFiducialCut()->GetEMCALFidCutMaxPhiArray()->GetSize();
768  if( nSections == 1 )
769  {
770  Float_t minPhi = GetFiducialCut()->GetEMCALFidCutMinPhiArray()->At(0);
771  Float_t maxPhi = GetFiducialCut()->GetEMCALFidCutMaxPhiArray()->At(0);
772  //printf("sections %d, min %f, max %f\n",nSections,minPhi,maxPhi);
773 
774  if ( minPhi > 70 && maxPhi < 190) // EMCal
775  {
776  fFirstModule = 0;
777  fLastModule = 11;
778  }
779  else if( minPhi > 250 && maxPhi < 330) // DCal
780  {
781  fFirstModule = 12;
782  fLastModule = 19;
783  }
784  }
785  }
786  }
787 
788  // Overwrite what used in FidCut, if more strict on CaloUtils
789  // Needed for special case in QA analysis train
790  if ( GetCaloUtils()->GetFirstSuperModuleUsed() >= 0 )
791  {
792  if(fFirstModule < GetCaloUtils()->GetFirstSuperModuleUsed() ||
793  fLastModule > GetCaloUtils()->GetLastSuperModuleUsed())
794  {
795  //printf("Get SM range from CaloUtils\n");
796 
799  }
800  }
801 
802  // EMCAL
803  fNMaxCols = 48;
804  fNMaxRows = 24;
805  fNRCU = 2 ;
806  // PHOS
807  if(GetCalorimeter()==kPHOS)
808  {
809  fNMaxCols = 56;
810  fNMaxRows = 64;
811  fNRCU = 4 ;
812  }
813 
816 
818  fNMaxRowsFullMin = 0;
819 
820  if(GetCalorimeter()==kEMCAL)
821  {
823 
825  if(fNMaxRowsFull > 208)
826  fNMaxRowsFull = 208; // 8*24+2/3.*24, reduce since 1/3 SM should not be counted full.
827 
828  fNMaxRowsFullMin = 0;
830 
831  if(fLastModule < 12)
832  {
834  if(fNMaxRowsFullMax > 127) fNMaxRowsFullMax = 127; // 24*5+8
835  fNMaxRowsFullMin = 0;
836  }
837  else if (fFirstModule > 11)
838  {
840  fNMaxRowsFullMin = Int_t(fFirstModule/2)*fNMaxRows-Int_t(2./3.*fNMaxRows); // remove 2/3*24
841  }
842  }
843  else
844  {
846  }
847 
848 // 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",
849 // GetName(),fNModules,fFirstModule,fLastModule, fNMaxCols,fNMaxRows,
850 // fNMaxColsFull,fNMaxRowsFull, fNMaxRowsFullMin,fNMaxRowsFullMax);
851 
852  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)",
855 
856 
857 }
858 
859 //__________________________________________________________________
861 //__________________________________________________________________
863 {
864  if(! opt)
865  return;
866 
867  printf("New AOD: = %d\n", fNewAOD);
868  printf("Input AOD name: = %s\n", fInputAODName.Data());
869  printf("Output AOD name: = %s\n", fOutputAODName.Data());
870  printf("Output AOD Class name: = %s\n", fOutputAODClassName.Data());
871  printf("Name of reference array : %s\n", fAODObjArrayName.Data());
872  printf("String added histograms name : %s\n", fAddToHistogramsName.Data());
873 
874  printf("Min Photon pT = %2.2f\n", fMinPt) ;
875  printf("Max Photon pT = %3.2f\n", fMaxPt) ;
876  printf("Check PID = %d\n", fCheckCaloPID) ;
877  printf("Recalculate PID = %d\n", fRecalculateCaloPID) ;
878  printf("Check Fiducial cut = %d\n", fCheckFidCut) ;
879  printf("Check Real Calo Acc = %d\n", fCheckRealCaloAcc) ;
880  printf("Check MC labels = %d\n", fDataMC);
881  printf("Make plots? = %d\n", fMakePlots);
882  printf("Debug Level = %d\n", fDebug);
883 
884  printf(" \n") ;
885 }
886 
887 //_______________________________________________________________
889 //_______________________________________________________________
891 {
892  fCalorimeterString = calo;
893 
894  if (calo=="EMCAL") fCalorimeter = kEMCAL;
895  else if(calo=="PHOS" ) fCalorimeter = kPHOS;
896  else if(calo=="CTS") fCalorimeter = kCTS;
897  else if(calo=="DCAL") fCalorimeter = kDCAL;
898  else if(calo.Contains("DCAL") && calo.Contains("PHOS")) fCalorimeter = kDCALPHOS;
899  else AliFatal(Form("Detector < %s > not known!", calo.Data()));
900 
901 }
902 
903 //_______________________________________________________________
905 //_______________________________________________________________
907 {
908  fCalorimeter = calo;
909 
910  if (calo==kEMCAL) fCalorimeterString = "EMCAL";
911  else if(calo==kPHOS ) fCalorimeterString = "PHOS";
912  else if(calo==kCTS) fCalorimeterString = "CTS";
913  else if(calo==kDCAL) fCalorimeterString = "DCAL";
914  else if(calo==kDCALPHOS) fCalorimeterString = "DCAL_PHOS";
915  else AliFatal(Form("Detector < %d > not known!", calo));
916 }
917 
918 
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 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.
virtual void SetCalorimeter(TString calo)
Set the calorimeter for the analysis. A string.
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.
virtual TClonesArray * GetAODBranch(TString &aodBranchName) const
Recover ouput and input AOD pointers for each event in AliCaloTrackMaker.
Float_t fMinPt
Maximum pt of (trigger) particles in the analysis.
Bool_t fUseTrackMultBins
Use track multiplicity and not centrality bins in mixing.
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 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:133
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.
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.