]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrBaseClass.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWG / CaloTrackCorrBase / AliAnaCaloTrackCorrBaseClass.cxx
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 //_________________________________________________________________________
17 // Base class for CaloTrackCorr analysis algorithms
18 //-- Author: Gustavo Conesa (LNF-INFN, LPSC-Grenoble) 
19 //
20 //
21 //_________________________________________________________________________
22
23
24 // --- ROOT system ---
25 #include <TClonesArray.h>
26 //#include <Riostream.h>
27
28 //---- AliRoot system ----
29 #include "AliAnaCaloTrackCorrBaseClass.h"
30 #include "AliCaloTrackReader.h"
31 #include "AliCalorimeterUtils.h"
32 #include "AliCaloPID.h"
33 #include "AliFiducialCut.h"
34 #include "AliIsolationCut.h"
35 #include "AliMCAnalysisUtils.h"
36 #include "AliNeutralMesonSelection.h"
37 #include "AliVCaloCells.h" 
38 #include "AliAODEvent.h"
39 #include "AliAODHandler.h"
40 #include "AliAODPWG4Particle.h"
41
42 ClassImp(AliAnaCaloTrackCorrBaseClass)
43
44
45 //__________________________________________________________
46 AliAnaCaloTrackCorrBaseClass::AliAnaCaloTrackCorrBaseClass() : 
47 TObject(), 
48 fDataMC(0),                   fDebug(0),
49 fCalorimeter(-1),             fCalorimeterString(""),
50 fCheckFidCut(0),              fCheckRealCaloAcc(0),
51 fCheckCaloPID(0),             fRecalculateCaloPID(0), 
52 fMinPt(0),                    fMaxPt(0),
53 fPairTimeCut(200),            fTRDSMCovered(-1),
54 fNZvertBin(0),                fNrpBin(0),
55 fNCentrBin(0),                fNmaxMixEv(0),
56 fDoOwnMix(0),                 fUseTrackMultBins(0),
57 fFillPileUpHistograms(0),     fFillHighMultHistograms(0),
58 fMakePlots(kFALSE),
59 fInputAODBranch(0x0),         fInputAODName(""),
60 fOutputAODBranch(0x0),        fNewAOD(kFALSE),
61 fOutputAODName(""),           fOutputAODClassName(""),
62 fAODObjArrayName(""),         fAddToHistogramsName(""),
63 fCaloPID(0x0),                fCaloUtils(0x0),
64 fFidCut(0x0),                 fHisto(0x0),
65 fIC(0x0),                     fMCUtils(0x0),                
66 fNMS(0x0),                    fReader(0x0)
67 {
68   //Default Ctor
69   
70   //Initialize parameters
71   InitParameters();
72 }
73
74 //___________________________________________________________
75 AliAnaCaloTrackCorrBaseClass::~AliAnaCaloTrackCorrBaseClass() 
76 {
77   // Remove all pointers except analysis output pointers.
78   
79   //delete fCaloUtils ; //Already deleted in maker
80   //delete fReader ;    //Already deleted in maker
81         
82   delete fCaloPID ; 
83   delete fFidCut  ;  
84   delete fIC      ;      
85   delete fMCUtils ; 
86   delete fNMS     ;     
87   delete fHisto   ;    
88 }
89
90 //______________________________________________________________________
91 void AliAnaCaloTrackCorrBaseClass::AddAODParticle(AliAODPWG4Particle pc)
92 {
93   //Put AOD calo cluster in the AODParticleCorrelation array
94   
95   if(!fOutputAODBranch)
96   {
97     AliFatal("No AOD branch available!!!\n");
98     return; // coverity
99   }
100   
101   Int_t i = fOutputAODBranch->GetEntriesFast();
102   //new((*fOutputAODBranch)[i])  AliAODPWG4Particle(pc);
103   if     (strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4Particle")==0)
104   {
105     new((*fOutputAODBranch)[i])  AliAODPWG4Particle(pc);
106   }
107   else if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4ParticleCorrelation")==0)
108   {
109     new((*fOutputAODBranch)[i])  AliAODPWG4ParticleCorrelation(pc);
110   }
111   else
112   {
113     AliFatal(Form("Cannot add an object of type < %s >, to the AOD TClonesArray \n", fOutputAODBranch->GetClass()->GetName()));
114   }
115   
116 }
117
118 //__________________________________________________________________________________________
119 Int_t AliAnaCaloTrackCorrBaseClass::CheckMixedEventVertex(Int_t caloLabel, Int_t trackLabel)
120 {
121   // Check vertex in mixed events
122   
123   if (!GetMixedEvent()) return 1; // Not mixed event continue normal processing
124   
125   Int_t evt = -1;
126   
127   if     (caloLabel  >= 0 )
128   {
129     evt = GetMixedEvent()->EventIndexForCaloCluster(caloLabel) ;
130   }
131   else if(trackLabel >= 0 )
132   {
133     evt = GetMixedEvent()->EventIndex(trackLabel) ;
134   }
135   else  
136     return 0; // go to next entry in the particle list
137   
138   if(evt == -1) 
139     return 0 ; // to content coverity
140   
141   if (TMath::Abs(GetVertex(evt)[2]) > GetZvertexCut())  return -1; // Vertex out of range process next event
142   
143   return 1 ; // continue processing normally
144   
145 }
146
147 //________________________________________________________________
148 void AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() 
149 {
150   //Recover ouput and input AOD pointers for each event in the maker
151         
152   //Delta AODs
153   AliDebug(3,Form("AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() - Connect Input with name: <%s>; Connect output with name <%s>\n",fInputAODName.Data(),fOutputAODName.Data()));
154   
155   //Get the AOD handler, if output AOD is created use it, if not get the branches from the input which should be deltaAODs
156   AliAODHandler* aodHandler = 0x0;
157   Bool_t outAOD = kFALSE;
158   if((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()) outAOD = kTRUE;
159   if(outAOD) aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); 
160   else       aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
161   
162   if(!GetReader()->WriteDeltaAODToFile())
163   {
164     fOutputAODBranch =  (TClonesArray *) (fReader->GetAODBranchList())->FindObject(fOutputAODName);
165     fInputAODBranch  =  (TClonesArray *) (fReader->GetAODBranchList())->FindObject(fInputAODName);      
166   }
167   else if (aodHandler->GetExtensions())
168   {
169     AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(GetReader()->GetDeltaAODFileName()); 
170     if(ext)
171     {
172       AliAODEvent *aodEvent = ext->GetAOD(); 
173       if(fNewAOD)fOutputAODBranch = (TClonesArray*) aodEvent->FindListObject(fOutputAODName);
174       fInputAODBranch = (TClonesArray*) aodEvent->FindListObject(fInputAODName);          
175       if(!fOutputAODBranch && fNewAOD) fOutputAODBranch =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
176       if(!fInputAODBranch)  fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);
177     }
178     else
179     { // If no Delta AODs, kept in standard branch, to revise.
180       if(fNewAOD && fReader->GetOutputEvent())
181       {
182         fOutputAODBranch =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
183         fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);  
184       }
185       else
186       {
187         fInputAODBranch  =  (TClonesArray *) fReader->GetInputEvent()->FindListObject(fInputAODName);   
188         if(!fInputAODBranch && fReader->GetOutputEvent() ) 
189           fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);//Try the output event.
190       }
191     }
192   }
193   else
194   { // If no Delta AODs, kept in standard branch
195     if(fNewAOD && fReader->GetOutputEvent())
196     {
197       fOutputAODBranch =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
198       fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);    
199     }
200     else
201     {
202       fInputAODBranch  =  (TClonesArray *) fReader->GetInputEvent()->FindListObject(fInputAODName);
203       if(!fInputAODBranch && fReader->GetOutputEvent())  
204         fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);//Try the output event.
205     }
206   }
207   
208 //  if(GetDebug() > 1)
209 //  {
210 //    if(fNewAOD && !fOutputAODBranch) 
211 //      AliInfo(Form("Output Branch <%s>, not found!\n",fOutputAODName.Data()));
212 //    if(!fNewAOD && !fInputAODBranch) 
213 //      AliInfo(Form("Input Branch  <%s>, not found!\n",fInputAODName.Data()));
214 //  }
215 }
216
217 //_____________________________________________________________________________________
218 AliVCluster * AliAnaCaloTrackCorrBaseClass::FindCluster(TObjArray* clusters, Int_t id,
219                                                         Int_t & iclus, Int_t first)
220 {
221   // Given the cluster ID stored in AliAODPWG4Particle, get the originator cluster and its index in the array
222   
223   if(!clusters) return 0x0;
224   
225   for(iclus = first; iclus < clusters->GetEntriesFast(); iclus++)
226   {
227     AliVCluster *cluster= dynamic_cast<AliVCluster*> (clusters->At(iclus));
228     if(cluster)
229     {
230       if(cluster->GetID()==id)
231       {
232         return cluster;
233       }
234     }      
235   }// calorimeter clusters loop
236   
237   return 0x0;
238   
239 }
240
241 //______________________________________________________________________________________
242 TClonesArray * AliAnaCaloTrackCorrBaseClass::GetAODBranch(const TString & aodName) const
243 {
244         //Recover ouput and input AOD pointers for each event in the maker
245         
246         //Delta AODs
247   
248         AliDebug(3,Form("AliAnaCaloTrackCorrBaseClass::GetAODBranch() - Get Input Branch with name: <%s>; \n",aodName.Data()));
249         
250   //Get the AOD handler, if output AOD is created use it, if not get the branches from the input which should be deltaAODs
251   AliAODHandler* aodHandler = 0x0;
252   Bool_t outAOD = kFALSE;
253   if((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()) outAOD = kTRUE;
254   if(outAOD) aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); 
255   else       aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
256   
257   if(!GetReader()->WriteDeltaAODToFile())
258   {
259     return  (TClonesArray *) (fReader->GetAODBranchList())->FindObject(aodName);
260   }
261   else if (aodHandler->GetExtensions())
262   { 
263     AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(GetReader()->GetDeltaAODFileName()); 
264     if(ext){
265       AliAODEvent *aodEvent = ext->GetAOD(); 
266       TClonesArray * aodbranch =  (TClonesArray*) aodEvent->FindListObject(aodName);
267       if(aodbranch) return aodbranch;
268       else {
269         if(outAOD) return  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(aodName);
270         else       return  (TClonesArray *) fReader->GetInputEvent() ->FindListObject(aodName);
271       }
272     }
273     else{//If no Delta AODs, kept in standard branch, to revise. 
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 }
284
285 //_____________________________________________________________
286 TObjArray *  AliAnaCaloTrackCorrBaseClass::GetCTSTracks() const 
287 {
288   //Get list of referenced tracks from reader
289   
290   return fReader->GetCTSTracks(); 
291   
292 }
293
294 //________________________________________________________________
295 TObjArray *  AliAnaCaloTrackCorrBaseClass::GetPHOSClusters() const 
296 {
297   //Get list of PHOS reference caloclusters from reader
298   
299   return fReader->GetPHOSClusters(); 
300   
301 }
302
303 //_________________________________________________________________
304 TObjArray *  AliAnaCaloTrackCorrBaseClass::GetEMCALClusters() const 
305 {
306   //Get list of emcal referenced caloclusters from reader
307   
308   return fReader->GetEMCALClusters(); 
309   
310 }
311
312 //______________________________________________________________________
313 TClonesArray *  AliAnaCaloTrackCorrBaseClass::GetAODCaloClusters() const 
314 {
315   //Get list of all caloclusters in AOD output file 
316   
317   return fReader->GetOutputEvent()->GetCaloClusters(); 
318   
319 }
320
321 //________________________________________________________________
322 TClonesArray *  AliAnaCaloTrackCorrBaseClass::GetAODTracks() const 
323 {
324   //Get list of all tracks in AOD output file 
325   
326   return fReader->GetOutputEvent()->GetTracks(); 
327   
328 }
329
330 //____________________________________________________________
331 TString  AliAnaCaloTrackCorrBaseClass::GetBaseParametersList()  
332 {
333   //Put data member values in string to keep in output container
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
374 //_____________________________________________________________________
375 TClonesArray * AliAnaCaloTrackCorrBaseClass::GetCreateOutputAODBranch() 
376 {
377   //Create AOD branch filled in the analysis
378   
379   AliInfo(Form("Create AOD branch of %s objects and with name < %s >\n",
380           fOutputAODClassName.Data(),fOutputAODName.Data())) ;
381   
382   TClonesArray * aodBranch = new TClonesArray(fOutputAODClassName, 0);
383   aodBranch->SetName(fOutputAODName);
384   return aodBranch ;
385   
386 }
387
388 //________________________________________________________
389 Int_t AliAnaCaloTrackCorrBaseClass::GetEventNumber() const 
390 {
391   //Get current event number
392   
393   return fReader->GetEventNumber() ; 
394   
395 }
396
397
398 //__________________________________________________________
399 AliStack *  AliAnaCaloTrackCorrBaseClass::GetMCStack() const 
400 {
401   //Get stack pointer from reader
402   
403   return fReader->GetStack(); 
404   
405 }
406 //____________________________________________________________
407 AliHeader *  AliAnaCaloTrackCorrBaseClass::GetMCHeader() const
408 {
409   //Get header pointer from reader
410   
411   return fReader->GetHeader(); 
412   
413 }
414
415 //____________________________________________________________________________
416 AliGenEventHeader *  AliAnaCaloTrackCorrBaseClass::GetMCGenEventHeader() const
417 {
418   //Get GenEventHeader pointer from reader
419   
420   return fReader->GetGenEventHeader(); 
421   
422 }
423
424
425 //_________________________________________________________________
426 Int_t AliAnaCaloTrackCorrBaseClass::GetTrackMultiplicityBin() const
427 {
428   // Track multiplicity bins
429   
430   //curCentrBin = (GetTrackMultiplicity()-1)/5;
431   //if(curCentrBin > GetNCentrBin()-1) curCentrBin=GetNCentrBin()-1;
432   Int_t trackMult = GetReader()->GetTrackMultiplicity();
433   
434   for(Int_t ibin = 0; ibin < GetNTrackMultBin()-1; ibin++)
435   {
436     if(trackMult >= fTrackMultBins[ibin] && trackMult < fTrackMultBins[ibin+1]) return ibin;
437   }
438   
439   AliWarning(Form("Bin not found for track multiplicity %d",trackMult));
440   
441   return -1;
442 }
443
444 //________________________________________________________________
445 Int_t AliAnaCaloTrackCorrBaseClass::GetEventCentralityBin() const
446 {
447   // Define the centrality bin for mixing
448   // In pp collisions analysis hardcoded track multiplicities
449   
450   Int_t curCentrBin = 0;
451   
452   if(fUseTrackMultBins) // pp collisions
453   {
454     return GetTrackMultiplicityBin();
455   }
456   else // Set centrality based on centrality task, PbPb collisions
457   {
458     Float_t minCent = GetReader()->GetCentralityBin(0);
459     Float_t maxCent = GetReader()->GetCentralityBin(1);
460     
461     if((minCent< 0 && maxCent< 0) || minCent>=maxCent)
462     {
463       curCentrBin = GetEventCentrality() * GetNCentrBin() / GetReader()->GetCentralityOpt();
464       if(curCentrBin==GetNCentrBin())
465       {
466         curCentrBin = GetNCentrBin()-1;
467         AliDebug(1,Form("Centrality = %d, put it in last bin \n",GetEventCentrality()));
468       }
469     }
470     else
471     {
472       curCentrBin = (Int_t)((GetEventCentrality()-minCent) * GetNCentrBin() / (maxCent-minCent));
473       if(curCentrBin==GetNCentrBin()) curCentrBin = GetNCentrBin()-1;
474     }
475     
476     AliDebug(1,Form("Current CentrBin %d, centrality %d, n bins %d, max bin from centrality %d",
477                     curCentrBin, GetEventCentrality(), GetNCentrBin(), GetReader()->GetCentralityOpt()));
478   }
479   
480   return curCentrBin;
481   
482 }
483
484 //_______________________________________________________
485 Int_t AliAnaCaloTrackCorrBaseClass::GetEventRPBin() const
486 {
487   //Reaction plane bin
488   
489   Int_t curRPBin  = 0 ;
490   
491   if(GetNRPBin() > 1 && GetEventPlane())
492   {
493     Float_t epAngle = GetEventPlaneAngle();//->GetEventplane(GetEventPlaneMethod(),fReader->GetInputEvent());
494     
495     if(epAngle < 0 || epAngle >TMath::Pi())
496     { 
497       AliWarning(Form("Wrong event plane angle : %f \n",epAngle));
498       return -1;
499     }
500     
501     curRPBin = TMath::Nint(epAngle*(GetNRPBin()-1)/TMath::Pi());
502     if(curRPBin >= GetNRPBin()) printf("RP Bin %d out of range %d",curRPBin,GetNRPBin());
503     
504     AliDebug(1,Form("Current RP bin %d, bin float %f, angle %f, n bins %d",
505                     curRPBin,epAngle*(GetNRPBin()-1)/TMath::Pi(),epAngle,GetNRPBin()));
506   }  
507   
508   return curRPBin ;
509   
510 }
511
512 //_______________________________________________________
513 Int_t AliAnaCaloTrackCorrBaseClass::GetEventVzBin() const
514 {
515   // Return Vz bin, divide vertex in GetNZvertBin() bins, 
516   // depending on the vertex cut
517   
518   Double_t v[3] = {0,0,0}; //vertex 
519   GetReader()->GetVertex(v);
520   
521   Int_t curZvertBin = (Int_t)(0.5*GetNZvertBin()*(v[2]+GetZvertexCut())/GetZvertexCut());
522   
523   AliDebug(1,Form("AliAnaCaloTrackCorrBaseClass::GetEventVzBin() - %d, vz %2.2f, n bins %d",
524                   curZvertBin, v[2], GetNZvertBin()));
525   
526   return curZvertBin;
527 }
528
529 //________________________________________________________________________________________
530 Int_t AliAnaCaloTrackCorrBaseClass::GetEventMixBin(Int_t iCen, Int_t iVz, Int_t iRP) const
531 {
532   // Event mixing bin, combination of vz, centrality and reaction plane bins
533   
534   if(iCen<0 || iVz < 0 || iRP < 0)
535     return -1;
536   else
537     return iCen*GetNZvertBin()*GetNRPBin()+iVz*GetNRPBin()+iRP;
538 }
539
540 //________________________________________________________
541 Int_t AliAnaCaloTrackCorrBaseClass::GetEventMixBin() const
542 {
543   // Event mixing bin, combination of vz, centrality and reaction plane bins
544   
545   //Get vertex z bin
546   Int_t iVz =  GetEventVzBin();
547   
548   // centrality (PbPb) or tracks multiplicity (pp) bin
549   Int_t iCen = GetEventCentralityBin();
550   
551   // reaction plane bin (PbPb)
552   Int_t iRP = GetEventRPBin();  
553   
554   Int_t eventBin = GetEventMixBin(iCen, iVz, iRP);
555   
556   AliDebug(1,Form("Bins : cent %d, vz %d, RP %d, event %d/%d",
557                   iCen,iVz, iRP, eventBin, GetNZvertBin()*GetNRPBin()*GetNCentrBin()));
558   
559   return eventBin;
560   
561 }
562
563 //____________________________________________
564 void AliAnaCaloTrackCorrBaseClass::InitDebug()
565 {
566   // Init once the debugging level, if requested
567   
568   // Activate debug level in analysis
569
570   if( fDebug >= 0 )
571     (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(this->ClassName(),fDebug);
572   
573   if( GetMCAnalysisUtils()->GetDebug() >= 0 )
574     (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(GetMCAnalysisUtils()->ClassName(),GetMCAnalysisUtils()->GetDebug());
575   
576   if( GetIsolationCut()->GetDebug() >= 0 )
577     (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(GetIsolationCut()   ->ClassName(),GetIsolationCut()->GetDebug());
578   
579   //printf("Debug levels: Ana %d, MC %d, Iso %d\n",fDebug,GetMCAnalysisUtils()->GetDebug(),GetIsolationCut()->GetDebug());
580
581 }
582
583 //_________________________________________________
584 void AliAnaCaloTrackCorrBaseClass::InitParameters()
585
586   //Initialize the parameters of the analysis.
587   fDataMC              = kFALSE;
588   fDebug               = 0;
589   fCheckCaloPID        = kTRUE ;
590   fCheckFidCut         = kFALSE ;
591   fCheckRealCaloAcc    = kFALSE ;
592   fRecalculateCaloPID  = kFALSE ;
593   fMinPt               = 0.2  ; //Min pt in particle analysis
594   fMaxPt               = 300. ; //Max pt in particle analysis
595   fNZvertBin           = 1;
596   fNrpBin              = 1;
597   
598   fCalorimeterString   = "EMCAL";
599   fCalorimeter         = kEMCAL ;
600   
601   fTrackMultBins[0] =  0;  fTrackMultBins[1] =  5;  fTrackMultBins[2] = 10;
602   fTrackMultBins[3] = 15;  fTrackMultBins[4] = 20;  fTrackMultBins[5] = 30;
603   fTrackMultBins[6] = 40;  fTrackMultBins[7] = 55;  fTrackMultBins[8] = 70;
604   for(Int_t ibin=9; ibin < 20; ibin++) fTrackMultBins[ibin] = 10000;
605   
606   //fReader    = new AliCaloTrackReader(); //Initialized in maker
607   //fCaloUtils = new AliCalorimeterUtils();//Initialized in maker
608   
609   fNewAOD              = kFALSE ;
610   fOutputAODName       = "CaloTrackCorr";
611   fOutputAODClassName  = "AliAODPWG4Particle";
612   fInputAODName        = "CaloTrackCorr";
613   fAddToHistogramsName = "";
614   fAODObjArrayName     = "Ref";
615   
616 }
617
618 //__________________________________________________________________
619 void AliAnaCaloTrackCorrBaseClass::Print(const Option_t * opt) const
620 {
621   //Print some relevant parameters set for the analysis
622   
623   if(! opt)
624     return;
625         
626   printf("New AOD:            =     %d\n",      fNewAOD);
627   printf("Input AOD name:     =     %s\n",      fInputAODName.Data());
628   printf("Output AOD name:    =     %s\n",      fOutputAODName.Data());
629   printf("Output AOD Class name: =  %s\n",      fOutputAODClassName.Data());
630   printf("Name of reference array      : %s\n", fAODObjArrayName.Data());
631   printf("String added histograms name : %s\n", fAddToHistogramsName.Data());
632
633   printf("Min Photon pT       =     %2.2f\n", fMinPt) ;
634   printf("Max Photon pT       =     %3.2f\n", fMaxPt) ;
635   printf("Check PID           =     %d\n",    fCheckCaloPID) ;
636   printf("Recalculate PID     =     %d\n",    fRecalculateCaloPID) ;
637   printf("Check Fiducial cut  =     %d\n",    fCheckFidCut) ;
638   printf("Check Real Calo Acc =     %d\n",    fCheckRealCaloAcc) ;
639   printf("Check MC labels     =     %d\n",    fDataMC);
640   printf("Make plots?         =     %d\n",    fMakePlots);
641   printf("Debug Level         =     %d\n",    fDebug);
642   
643   printf("    \n") ;
644   
645
646
647 //_______________________________________________________________
648 void AliAnaCaloTrackCorrBaseClass::SetCalorimeter(TString & calo)
649 {
650   // Set the calorimeter for the analysis
651   
652   fCalorimeterString = calo;
653   
654   if     (calo=="EMCAL") fCalorimeter = kEMCAL;
655   else if(calo=="PHOS" ) fCalorimeter = kPHOS;
656   else if(calo=="CTS")   fCalorimeter = kCTS;
657   else if(calo=="DCAL")  fCalorimeter = kDCAL;
658   else if(calo.Contains("DCAL") && calo.Contains("PHOS")) fCalorimeter = kDCALPHOS;
659   else AliFatal(Form("Detector < %s > not known!", calo.Data()));
660
661 }
662
663 //___________________________________________________________
664 void AliAnaCaloTrackCorrBaseClass::SetCalorimeter(Int_t calo)
665 {
666   // Set the calorimeter for the analysis
667   
668   fCalorimeter = calo;
669   
670   if     (calo==kEMCAL)    fCalorimeterString = "EMCAL";
671   else if(calo==kPHOS )    fCalorimeterString = "PHOS";
672   else if(calo==kCTS)      fCalorimeterString = "CTS";
673   else if(calo==kDCAL)     fCalorimeterString = "DCAL";
674   else if(calo==kDCALPHOS) fCalorimeterString = "DCAL_PHOS";
675   else AliFatal(Form("Detector < %d > not known!", calo));
676
677 }
678
679