]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
mixing bin calculation methods moved to base class, add reaction plane bin, removal...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 9 Jun 2012 16:18:42 +0000 (16:18 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 9 Jun 2012 16:18:42 +0000 (16:18 +0000)
PWGGA/CaloTrackCorrelations/AliAnaParticleHadronCorrelation.cxx
PWGGA/CaloTrackCorrelations/AliAnaParticleHadronCorrelation.h
PWGGA/CaloTrackCorrelations/AliAnaPi0.cxx
PWGGA/CaloTrackCorrelations/AliAnaPi0.h

index d11df16bc96b79a8a53515417cf31ddbaf983c91..ecba1488f57334eb49f73c8866dbb0255d078e1d 100755 (executable)
@@ -52,6 +52,7 @@
 #include "AliMixedEvent.h"
 #include "AliAnalysisManager.h"
 #include "AliInputEventHandler.h"
+#include "AliEventplane.h"
 
 ClassImp(AliAnaParticleHadronCorrelation)
 
@@ -69,8 +70,7 @@ ClassImp(AliAnaParticleHadronCorrelation)
     fMakeAbsoluteLeading(0),        fMakeNearSideLeading(0),      
     fLeadingTriggerIndex(-1),       fHMPIDCorrelation(0),  fFillBradHisto(0),
     fNAssocPtBins(0),               fAssocPtBinLimit(),
-    fDoOwnMix(0),                   fUseTrackMultBins(0),
-    fListMixEvents(),               
+    fListMixEvents(),               fIsPoolEvent(0),
     //Histograms
     fhPtLeading(0),                 fhPhiLeading(0),       
     fhEtaLeading(0),                fhDeltaPhiDeltaEtaCharged(0),
@@ -124,9 +124,10 @@ ClassImp(AliAnaParticleHadronCorrelation)
     //Mixing
     fhNEventsTrigger(0),            
     fhNtracksAll(0),                fhNtracksTrigger(0),            
-    fhNtracksINT(0),               
+    fhNtracksMB(0),               
     fhMixDeltaPhiCharged(0),        fhMixDeltaPhiDeltaEtaCharged(0),
-    fhMixDeltaPhiChargedAssocPtBin(),fhMixDeltaPhiDeltaEtaChargedAssocPtBin(0)
+    fhMixDeltaPhiChargedAssocPtBin(),fhMixDeltaPhiDeltaEtaChargedAssocPtBin(0),
+    fhEventBin(0),                   fhEventMixBin(0)
 { 
   //Default Ctor
     
@@ -139,14 +140,18 @@ AliAnaParticleHadronCorrelation::~AliAnaParticleHadronCorrelation()
 {
   // Remove event containers
   
-  if(fDoOwnMix && fListMixEvents)
+  if(DoOwnMix() && fListMixEvents)
   {      
     for(Int_t iz=0; iz < GetNZvertBin(); iz++)
     {
       for(Int_t ic=0; ic < GetNCentrBin(); ic++)
       {
-        fListMixEvents[ic*GetNZvertBin()+iz]->Delete() ;
-        delete fListMixEvents[ic*GetNZvertBin()+iz] ;
+         for(Int_t irp=0; irp<GetNRPBin(); irp++)
+         {
+           Int_t bin = GetEventMixBin(ic, iz, irp);
+           fListMixEvents[bin]->Delete() ;
+           delete fListMixEvents[bin] ;
+         }
       }
     }
     
@@ -258,11 +263,11 @@ Bool_t AliAnaParticleHadronCorrelation::FillChargedMCCorrelationHistograms(const
   
   Float_t mcxE    =-mcAssocPt/mcTrigPt*TMath::Cos(mcdeltaPhi);// -(mcAssocPx*pxprim+mcAssocPy*pyprim)/(mcTrigPt*mcTrigPt);  
   Float_t mchbpXE =-100 ;
-  if(mcxE > 0 ) mchbpXE = TMath::Log(1./mcxE);
+  if(mcxE > 0 ) mchbpXE = TMath::Log10(1./mcxE);
   
   Float_t mczT    = mcAssocPt/mcTrigPt ;
   Float_t mchbpZT =-100 ;
-  if(mczT > 0 ) mchbpZT = TMath::Log(1./mczT);
+  if(mczT > 0 ) mchbpZT = TMath::Log10(1./mczT);
   
   //Selection within angular range
   if( mcdeltaPhi< -TMath::PiOver2())  mcdeltaPhi+=TMath::TwoPi();
@@ -374,10 +379,10 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventHistograms(const
   if(uexE < 0.) uexE = -uexE;
     
   fhXEUeCharged->Fill(ptTrig,uexE);
-  if(uexE > 0) fhPtHbpXEUeCharged->Fill(ptTrig,TMath::Log(1/uexE));
+  if(uexE > 0) fhPtHbpXEUeCharged->Fill(ptTrig,TMath::Log10(1/uexE));
   
   fhZTUeCharged->Fill(ptTrig,uezT);
-  if(uexE > 0) fhPtHbpZTUeCharged->Fill(ptTrig,TMath::Log(1/uezT));
+  if(uexE > 0) fhPtHbpZTUeCharged->Fill(ptTrig,TMath::Log10(1/uezT));
   
   if(DoEventSelect())
   {
@@ -450,7 +455,7 @@ void AliAnaParticleHadronCorrelation::FillDecayPhotonCorrelationHistograms(const
     fhDeltaPhiDecayCharged->Fill(ptDecay1, deltaPhiDecay1);
     fhDeltaPhiDecayCharged->Fill(ptDecay2, deltaPhiDecay2);
     
-    if(GetDebug() > 1)printf("AliAnaParticleHadronCorrelation::FillDecayPhotonHistograms( Charged corr) - deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaPhiDecay1, deltaPhiDecay2);
+    if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::FillDecayPhotonHistograms( Charged corr) - deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaPhiDecay1, deltaPhiDecay2);
     
     if( (deltaPhiDecay1 > fDeltaPhiMinCut) && ( deltaPhiDecay1 < fDeltaPhiMaxCut) )
     {
@@ -468,7 +473,7 @@ void AliAnaParticleHadronCorrelation::FillDecayPhotonCorrelationHistograms(const
     fhDeltaPhiDecayCharged->Fill(ptDecay1, deltaPhiDecay1);
     fhDeltaPhiDecayCharged->Fill(ptDecay2, deltaPhiDecay2);
     
-    if(GetDebug() > 1)printf("AliAnaParticleHadronCorrelation::FillDecayPhotonHistograms(Neutral corr) - deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaPhiDecay1, deltaPhiDecay2);
+    if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::FillDecayPhotonHistograms(Neutral corr) - deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaPhiDecay1, deltaPhiDecay2);
     
     if( (deltaPhiDecay1 > fDeltaPhiMinCut) && ( deltaPhiDecay1 < fDeltaPhiMaxCut) )
     {
@@ -537,6 +542,9 @@ void AliAnaParticleHadronCorrelation::FillChargedEventMixPool()
 {
   // Mixed event init
     
+  //printf("FillChargedEventMixPool for %s\n",GetInputAODName().Data());
+  fIsPoolEvent = kFALSE;
+  
   Int_t nTracks = GetCTSTracks()->GetEntriesFast();
   
   fhNtracksAll->Fill(nTracks);
@@ -551,57 +559,22 @@ void AliAnaParticleHadronCorrelation::FillChargedEventMixPool()
     fhNtracksTrigger->Fill(nTracks);
   }
   
-  if(inputHandler->IsEventSelected( ) & AliVEvent::kAnyINT)
+  if(inputHandler->IsEventSelected( ) & AliVEvent::kMB)
   {
     
-    fhNtracksINT->Fill(nTracks);
-    
-    //Get vertex z bin
-    Double_t v[3] = {0,0,0}; //vertex ;
-    GetReader()->GetVertex(v);
-    
-    Int_t curZvertBin = (Int_t)(0.5*GetNZvertBin()*(v[2]+GetZvertexCut())/GetZvertexCut()) ;
-    
-    // centrality or tracks bin
-    Int_t curCentrBin = 0;
-    if(fUseTrackMultBins)
-    { // Track multiplicity bins
-      //curCentrBin = (GetTrackMultiplicity()-1)/5; 
-      //if(curCentrBin > GetNCentrBin()-1) curCentrBin=GetNCentrBin()-1;
-      Int_t trackMult = GetReader()->GetTrackMultiplicity();
-      if(trackMult<=5)
-        curCentrBin=8;
-      else if(trackMult<=10)
-        curCentrBin=7;
-      else if(trackMult<=15)
-        curCentrBin=6;
-      else if(trackMult<=20)
-        curCentrBin=5;
-      else if(trackMult<=30)
-        curCentrBin=4;
-      else if(trackMult<=40)
-        curCentrBin=3;
-      else if(trackMult<=55)
-        curCentrBin=2;
-      else if(trackMult<=70)
-        curCentrBin=1 ;
-      else curCentrBin=0 ;        
-    }
-    else // Set centrality based on centrality task
-    {
-      curCentrBin = GetEventCentrality() * GetNCentrBin() / GetReader()->GetCentralityOpt(); 
-      if(GetDebug() > 0 )printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - curCentrBin %d, centrality %d, n bins %d, max bin from centrality %d\n",
-                                curCentrBin, GetEventCentrality(), GetNCentrBin(), GetReader()->GetCentralityOpt());        
-    }
+    fhNtracksMB->Fill(nTracks);
     
     TObjArray * mixEventTracks = new TObjArray;
     
-    //printf("curCen %d, curZ %d, bin %d\n",curCentrBin,curZvertBin,curCentrBin*GetNZvertBin()+curZvertBin);
+    Int_t eventBin = GetEventMixBin();
+    //printf("***** Pool Event bin : %d - nTracks %d\n",eventBin, GetCTSTracks()->GetEntriesFast());
+    
+    //Check that the bin exists, if not (bad determination of RP, centrality or vz bin) do nothing
+    if(eventBin < 0) return;
     
-    if(!fListMixEvents[curCentrBin*GetNZvertBin()+curZvertBin]) 
-      fListMixEvents[curCentrBin*GetNZvertBin()+curZvertBin]=new TList();
+    if(!fListMixEvents[eventBin]) fListMixEvents[eventBin] = new TList();
     
-    TList * pool = fListMixEvents[curCentrBin*GetNZvertBin()+curZvertBin];
+    TList * pool = fListMixEvents[eventBin];
     
     TVector3 p3;  
     for(Int_t ipr = 0;ipr < GetCTSTracks()->GetEntriesFast() ; ipr ++ )
@@ -624,13 +597,17 @@ void AliAnaParticleHadronCorrelation::FillChargedEventMixPool()
     
     pool->AddFirst(mixEventTracks);
     mixEventTracks = 0;
-    if(pool->GetSize() >= GetNMaxEvMix())
+    //printf("Pool size %d, max %d\n",pool->GetSize(), GetNMaxEvMix());
+    
+    if(pool->GetSize() > GetNMaxEvMix())
     {//Remove last event
       TClonesArray * tmp = static_cast<TClonesArray*>(pool->Last()) ;
       pool->RemoveLast() ;
       delete tmp ;
     }
     
+    fIsPoolEvent = kTRUE;
+    
   } // MB event
   
 }
@@ -1447,26 +1424,45 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
     outputContainer->Add(fhMCPtAssocDeltaPhi) ;      
   } //for MC histogram
   
-  if(fDoOwnMix)
+  if(DoOwnMix())
   {
     //create event containers
-    fListMixEvents= new TList*[GetNCentrBin()*GetNZvertBin()] ;
+    fListMixEvents= new TList*[GetNCentrBin()*GetNZvertBin()*GetNRPBin()] ;
     
-    for(Int_t ic=0; ic<GetNCentrBin(); ic++){
-      for(Int_t iz=0; iz<GetNZvertBin(); iz++){
-        fListMixEvents[ic*GetNZvertBin()+iz] = new TList() ;
-        fListMixEvents[ic*GetNZvertBin()+iz]->SetOwner(kFALSE);
+    for(Int_t ic=0; ic<GetNCentrBin(); ic++)
+    {
+      for(Int_t iz=0; iz<GetNZvertBin(); iz++)
+      {
+        for(Int_t irp=0; irp<GetNRPBin(); irp++)
+        {
+          //printf("GetCreateOutputObjects - Bins : cent %d, vz %d, RP %d, event %d/%d\n",
+          //       ic,iz, irp, ic*GetNZvertBin()*GetNRPBin()+iz*GetNRPBin()+irp,GetNZvertBin()*GetNRPBin()*GetNCentrBin());
+          fListMixEvents[ic*GetNZvertBin()*GetNRPBin()+iz*GetNRPBin()+irp] = new TList() ;
+          fListMixEvents[ic*GetNZvertBin()*GetNRPBin()+iz*GetNRPBin()+irp]->SetOwner(kFALSE);
+        }
       }
     }    
     
+    fhEventBin=new TH1I("hEventBin","Number of real events per bin(cen,vz,rp)",
+                        GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1,0, 
+                        GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1) ;
+    fhEventBin->SetXTitle("bin");
+    outputContainer->Add(fhEventBin) ;
+
+    fhEventMixBin=new TH1I("hEventMixBin","Number of events  per bin(cen,vz,rp)",
+                           GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1,0,
+                           GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1) ;
+    fhEventMixBin->SetXTitle("bin");
+    outputContainer->Add(fhEventMixBin) ;
+
     fhNtracksAll=new TH1F("hNtracksAll","Number of tracks w/o event trigger",2000,0,2000);
     outputContainer->Add(fhNtracksAll);
     
     fhNtracksTrigger=new TH1F("hNtracksTriggerEvent","Number of tracks w/ event trigger",2000,0,2000);
     outputContainer->Add(fhNtracksTrigger);
     
-    fhNtracksINT=new TH1F("hNtracksMBEvent","Number of tracks w/ event trigger kAnyINT",2000,0,2000);
-    outputContainer->Add(fhNtracksINT);
+    fhNtracksMB=new TH1F("hNtracksMBEvent","Number of tracks w/ event trigger kMB",2000,0,2000);
+    outputContainer->Add(fhNtracksMB);
     
     fhMixDeltaPhiCharged  = new TH2F
     ("hMixDeltaPhiCharged","Mixed event : #phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}",
@@ -1553,7 +1549,6 @@ Bool_t AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum(const AliAODPWG4P
   
 } 
 
-
 //____________________________________________________
 void AliAnaParticleHadronCorrelation::InitParameters()
 {
@@ -1624,7 +1619,7 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD()
   if(!GetMixedEvent() && TMath::Abs(v[2]) > GetZvertexCut()) return ;   
   
   // Fill the pool with tracks if requested
-  if(fDoOwnMix) FillChargedEventMixPool();
+  if(DoOwnMix()) FillChargedEventMixPool();
 
   //Loop on stored AOD particles, find leading trigger
   Double_t ptTrig      = fMinTriggerPt ;
@@ -1891,12 +1886,12 @@ Bool_t  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Partic
       
       // Imbalance zT/xE/pOut
       zT = pt/ptTrig ;
-      if(zT > 0 ) hbpZT = TMath::Log(1./zT);
+      if(zT > 0 ) hbpZT = TMath::Log10(1./zT);
       else        hbpZT =-100;
       
       xE   =-pt/ptTrig*TMath::Cos(deltaPhi); // -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
       //if(xE <0.)xE =-xE;
-      if(xE > 0 ) hbpXE = TMath::Log(1./xE); 
+      if(xE > 0 ) hbpXE = TMath::Log10(1./xE); 
       else        hbpXE =-100;
     
       pout = pt*TMath::Sin(deltaPhi) ;
@@ -1946,7 +1941,7 @@ Bool_t  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Partic
   }
   
   //Own mixed event, add event and remove previous or fill the mixed histograms
-  if(fDoOwnMix && bFillHisto)
+  if(DoOwnMix() && bFillHisto)
   {
       MakeChargedMixCorrelation(aodParticle);
   }
@@ -1959,78 +1954,57 @@ Bool_t  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Partic
 //______________________________________________________________________________________________________________________
 void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4ParticleCorrelation *aodParticle)
 {  
-  if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Make trigger particle - charged hadron mixed event correlation \n");
+  // Mix current trigger with tracks in another MB event
   
-  Double_t v[3] = {0,0,0}; //vertex ;
-  GetReader()->GetVertex(v);
+  if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Make trigger particle - charged hadron mixed event correlation \n");
   
   if(GetMixedEvent()) return;  // This is not the mixed event from general mixing frame
   
-  
   // Get the event with similar caracteristics
-  
-  //Get vertex z bin
-  
-  Int_t curZvertBin = (Int_t)(0.5*GetNZvertBin()*(v[2]+GetZvertexCut())/GetZvertexCut()) ;
-  
-  // centrality or tracks bin
-  Int_t curCentrBin = 0;
-  if(fUseTrackMultBins)
-  { // Track multiplicity bins
-    //curCentrBin = (GetTrackMultiplicity()-1)/5; 
-    //if(curCentrBin > GetNCentrBin()-1) curCentrBin=GetNCentrBin()-1;
-    Int_t trackMult = GetReader()->GetTrackMultiplicity();
-    if(trackMult<=5)
-      curCentrBin=8;
-    else if(trackMult<=10)
-      curCentrBin=7;
-    else if(trackMult<=15)
-      curCentrBin=6;
-    else if(trackMult<=20)
-      curCentrBin=5;
-    else if(trackMult<=30)
-      curCentrBin=4;
-    else if(trackMult<=40)
-      curCentrBin=3;
-    else if(trackMult<=55)
-      curCentrBin=2;
-    else if(trackMult<=70)
-      curCentrBin=1 ;
-    else curCentrBin=0 ;        
-  }
-  else // Set centrality based on centrality task
-  {
-    curCentrBin = GetEventCentrality() * GetNCentrBin() / GetReader()->GetCentralityOpt(); 
-    if(GetDebug() > 0 )printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - curCentrBin %d, centrality %d, n bins %d, max bin from centrality %d\n",
-                              curCentrBin, GetEventCentrality(), GetNCentrBin(), GetReader()->GetCentralityOpt());        
-  }
+  //printf("MakeChargedMixCorrelation for %s\n",GetInputAODName().Data());
+
+  AliAnalysisManager   * manager      = AliAnalysisManager::GetAnalysisManager();
+  AliInputEventHandler * inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
+
+  if(!(inputHandler->IsEventSelected( ) & GetReader()->GetEventTriggerMask())) return;
   
   // Get the pool, check if it exits
-  if(!fListMixEvents[curCentrBin*GetNZvertBin()+curZvertBin]) return ;
+  Int_t eventBin = GetEventMixBin();
+
+  fhEventBin->Fill(eventBin);
   
-  //printf("curCen %d, curZ %d, bin %d\n",curCentrBin,curZvertBin,curCentrBin*GetNZvertBin()+curZvertBin);
+  //Check that the bin exists, if not (bad determination of RP, centrality or vz bin) do nothing
+  if(eventBin < 0) return;
   
-  TList * pool = fListMixEvents[curCentrBin*GetNZvertBin()+curZvertBin];
+  TList * pool = fListMixEvents[eventBin];
+
+  if(!pool) return ;
     
   Double_t ptTrig  = aodParticle->Pt();
   Double_t etaTrig = aodParticle->Eta();
   Double_t phiTrig = aodParticle->Phi();
   if(phiTrig < 0.) phiTrig+=TMath::TwoPi();
   
-  if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - leading trigger pt=%f, phi=%f, eta=%f\n",ptTrig,phiTrig,etaTrig);
+  if(GetDebug() > 1) 
+    printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Pool bin %d size %d, Pool event? %d, leading trigger pt=%f, phi=%f, eta=%f\n",
+           eventBin,pool->GetSize(), fIsPoolEvent, ptTrig,phiTrig,etaTrig);
   
   Double_t ptAssoc  = -999.;
-  Double_t phiAssoc = -999. ;
+  Double_t phiAssoc = -999.;
   Double_t etaAssoc = -999.;
   Double_t deltaPhi = -999.;
   Double_t deltaEta = -999.;
   
-  for(Int_t ev=0; ev <pool->GetSize(); ev++)
+  //Start from first event in pool except if in this same event the pool was filled
+  for(Int_t ev=fIsPoolEvent; ev < pool->GetSize(); ev++)
   {
     TObjArray* bgTracks = static_cast<TObjArray*>(pool->At(ev));
     
-    Int_t nTracks=bgTracks->GetEntriesFast();
+    fhEventMixBin->Fill(eventBin);
     
+    Int_t nTracks=bgTracks->GetEntriesFast();
+    //printf("\t Read Pool event %d, nTracks %d\n",ev,nTracks);
+
     for(Int_t j1 = 0;j1 <nTracks; j1++ )
     {
       AliAODPWG4Particle *track = (AliAODPWG4Particle*) bgTracks->At(j1) ;
@@ -2041,7 +2015,7 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
       etaAssoc = track->Eta();
       phiAssoc = track->Phi() ;
       if(phiAssoc < 0) phiAssoc+=TMath::TwoPi();
-      
+            
       if(IsFiducialCutOn())
       {
         Bool_t in = GetFiducialCut()->IsInFiducialCut(*aodParticle->Momentum(),"CTS") ;
@@ -2169,8 +2143,8 @@ Bool_t  AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4Partic
       hbpXE = -100;
       hbpZT = -100;
       
-      if(xE > 0 ) hbpXE = TMath::Log(1./xE); 
-      if(zT > 0 ) hbpZT = TMath::Log(1./zT); 
+      if(xE > 0 ) hbpXE = TMath::Log10(1./xE); 
+      if(zT > 0 ) hbpZT = TMath::Log10(1./zT); 
       
       if(fPi0Trigger && decayFound)
         FillDecayPhotonCorrelationHistograms(pt, phi, decayMom1,decayMom2,kFALSE) ;
@@ -2255,7 +2229,8 @@ void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(AliAODPWG4Partic
   if(GetReader()->ReadStack())
   {
     stack =  GetMCStack() ;
-    if(!stack) {
+    if(!stack) 
+    {
       printf(" AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation- Stack not available, is the MC handler called? STOP\n");
       abort();
     }
@@ -2436,9 +2411,9 @@ void AliAnaParticleHadronCorrelation::SetAssocPtBinLimit(Int_t ibin, Float_t pt)
   {
     fAssocPtBinLimit[ibin] = pt  ;
   }
-  else {
+  else 
+  {
     printf("AliAnaParticleHadronCorrelation::SetAssocPtBinLimit() - bin  number too large %d > %d or small, nothing done\n", ibin, fNAssocPtBins) ; 
-    
   }
 }
 
index da986e872dee3489382ddc9caf4313b9af31ad45..f7dfe1377127d206a32dd49747a96b16a1f8dd15 100755 (executable)
@@ -97,7 +97,6 @@ class AliAnaParticleHadronCorrelation : public AliAnaCaloTrackCorrBaseClass {
                                                          const Float_t zT,       const Float_t hbpZT, 
                                                          const Float_t deltaPhi);  
   
-  
   // Parameter setter and getter
   
   Float_t      GetMinimumTriggerPt()       const { return fMinTriggerPt          ; }
@@ -164,13 +163,7 @@ class AliAnaParticleHadronCorrelation : public AliAnaCaloTrackCorrBaseClass {
   
   void         SetNAssocPtBins(Int_t n) ;     
   void         SetAssocPtBinLimit(Int_t ibin, Float_t pt) ;
-  
-  void         SwitchOnOwnMix()                  { fDoOwnMix            = kTRUE  ; }
-  void         SwitchOffOwnMix()                 { fDoOwnMix            = kFALSE ; }
-
-  void         SwitchOnTrackMultBins()           { fUseTrackMultBins    = kTRUE  ; }
-  void         SwitchOffTrackMultBins()          { fUseTrackMultBins    = kFALSE ; }
-                
+                  
  private:
   Float_t      fMinTriggerPt ;                 // Minimum trigger hadron pt
   Float_t      fMaxAssocPt ;                   // Maximum associated hadron pt
@@ -193,10 +186,8 @@ class AliAnaParticleHadronCorrelation : public AliAnaCaloTrackCorrBaseClass {
   Int_t        fNAssocPtBins ;                 // Number of associated pT bins under study
   Float_t      fAssocPtBinLimit[10] ;          // Associated pT under study
   
-  Bool_t       fDoOwnMix;                      // Do combinatorial background not the one provided by the frame
-  Bool_t       fUseTrackMultBins;              // Use track multiplicity and not centrality bins
-  TList **     fListMixEvents ;                //![GetNCentrBin()*GetNZvertBin()] Containers for photons in stored events for mixing
-  
+  TList **     fListMixEvents ;                //![GetNCentrBin()*GetNZvertBin()*GetNRPBin()] Containers for photons in stored events for mixing
+  Bool_t       fIsPoolEvent;                   // Signal if in the current event the pool was filled
   //Histograms
 
   //leading particles 
@@ -320,16 +311,19 @@ class AliAnaParticleHadronCorrelation : public AliAnaCaloTrackCorrBaseClass {
   TH1I *       fhNEventsTrigger;               //! number of analyzed triggered events
   TH1F *       fhNtracksAll;                   //! total number of tracks 
   TH1F *       fhNtracksTrigger;               //! total number of tracks in triggered events 
-  TH1F *       fhNtracksINT;                   //! total number of tracks in MB events
+  TH1F *       fhNtracksMB;                    //! total number of tracks in MB events
   TH2F *       fhMixDeltaPhiCharged  ;         //! Difference of charged particle phi and trigger particle  phi as function of  trigger particle pT
   TH2F *       fhMixDeltaPhiDeltaEtaCharged  ; //! Difference of charged particle phi and trigger particle  phi as function eta difference
   TH2F **      fhMixDeltaPhiChargedAssocPtBin; //![fNAssocPtBins] Difference of charged particle phi and trigger particle  phi as function of  trigger particle pT, for different associated bins
   TH2F **      fhMixDeltaPhiDeltaEtaChargedAssocPtBin; //![fNAssocPtBins] Difference of charged particle phi and trigger particle  phi  as function eta difference, for different associated bins
 
+  TH1I *       fhEventBin;                     //! Number of real  events in a particular bin (cen,vz,rp)
+  TH1I *       fhEventMixBin;                  //! Number of mixed events in a particular bin (cen,vz,rp)
+  
   AliAnaParticleHadronCorrelation(              const AliAnaParticleHadronCorrelation & ph) ; // cpy ctor
   AliAnaParticleHadronCorrelation & operator = (const AliAnaParticleHadronCorrelation & ph) ; // cpy assignment
        
-  ClassDef(AliAnaParticleHadronCorrelation,13)
+  ClassDef(AliAnaParticleHadronCorrelation,14)
 } ;
  
 
index 2fe85bfcf27a5086164e602af0c13486a043e670..3a6f0ad553b0283c90db6931717cbc24bd086ea2 100755 (executable)
@@ -59,14 +59,14 @@ ClassImp(AliAnaPi0)
 
 //________________________________________________________________________________________________________________________________________________  
 AliAnaPi0::AliAnaPi0() : AliAnaCaloTrackCorrBaseClass(),
-fDoOwnMix(kFALSE),           fEventsList(0x0), 
+fEventsList(0x0), 
 fCalorimeter(""),            fNModules(12),              
 fUseAngleCut(kFALSE),        fUseAngleEDepCut(kFALSE),     fAngleCut(0),                 fAngleMaxCut(7.),
 fMultiCutAna(kFALSE),        fMultiCutAnaSim(kFALSE),
 fNPtCuts(0),                 fNAsymCuts(0),                fNCellNCuts(0),               fNPIDBits(0),  
-fMakeInvPtPlots(kFALSE),     fSameSM(kFALSE),              fFillSMCombinations(kFALSE),  fCheckConversion(kFALSE),
-fUseTrackMultBins(kFALSE),   fUsePhotonMultBins(kFALSE),   fUseAverCellEBins(kFALSE),    fUseAverClusterEBins(kFALSE),
-fUseAverClusterEDenBins(0),  fFillBadDistHisto(kFALSE),    fFillSSCombinations(kFALSE),  
+fMakeInvPtPlots(kFALSE),     fSameSM(kFALSE),              
+fFillSMCombinations(kFALSE), fCheckConversion(kFALSE),
+fFillBadDistHisto(kFALSE),   fFillSSCombinations(kFALSE),  
 fFillAngleHisto(kFALSE),     fFillAsymmetryHisto(kFALSE),
 //Histograms
 fhAverTotECluster(0),        fhAverTotECell(0),            fhAverTotECellvsCluster(0),
@@ -80,8 +80,9 @@ fhReInvPt2(0x0),             fhMiInvPt2(0x0),              fhReInvPt3(0x0),
 fhRePtNCellAsymCuts(0x0),    fhMiPtNCellAsymCuts(0x0),     fhRePtNCellAsymCutsSM(),  
 fhRePIDBits(0x0),            fhRePtMult(0x0),              fhReSS(), 
 fhRePtAsym(0x0),             fhRePtAsymPi0(0x0),           fhRePtAsymEta(0x0),  
-fhEvents(0x0),               fhCentrality(0x0),            fhCentralityNoPair(0x0),
-fhEventPlaneAngle(0x0),      fhEventPlaneResolution(0x0),
+fhEventBin(0),               fhEventMixBin(0),
+fhCentrality(0x0),           fhCentralityNoPair(0x0),
+fhEventPlaneResolution(0x0),
 fhRealOpeningAngle(0x0),     fhRealCosOpeningAngle(0x0),   fhMixedOpeningAngle(0x0),     fhMixedCosOpeningAngle(0x0),
 // MC histograms
 fhPrimPi0Pt(0x0),            fhPrimPi0AccPt(0x0),          fhPrimPi0Y(0x0),              fhPrimPi0AccY(0x0), 
@@ -103,12 +104,16 @@ fhReMCFromConversion(0),     fhReMCFromNotConversion(0),   fhReMCFromMixConversi
 AliAnaPi0::~AliAnaPi0() {
   // Remove event containers
   
-  if(fDoOwnMix && fEventsList){
-    for(Int_t ic=0; ic<GetNCentrBin(); ic++){
-      for(Int_t iz=0; iz<GetNZvertBin(); iz++){
-        for(Int_t irp=0; irp<GetNRPBin(); irp++){
-          fEventsList[ic*GetNZvertBin()*GetNRPBin()+iz*GetNRPBin()+irp]->Delete() ;
-          delete fEventsList[ic*GetNZvertBin()*GetNRPBin()+iz*GetNRPBin()+irp] ;
+  if(DoOwnMix() && fEventsList){
+    for(Int_t ic=0; ic<GetNCentrBin(); ic++)
+    {
+      for(Int_t iz=0; iz<GetNZvertBin(); iz++)
+      {
+        for(Int_t irp=0; irp<GetNRPBin(); irp++)
+        {
+          Int_t bin = GetEventMixBin(ic,iz,irp);
+          fEventsList[bin]->Delete() ;
+          delete fEventsList[bin] ;
         }
       }
     }
@@ -171,9 +176,6 @@ TObjString * AliAnaPi0::GetAnalysisCuts()
   parList+=onePar ;
   snprintf(onePar,buffersize,"Depth of event buffer: %d \n",GetNMaxEvMix()) ;
   parList+=onePar ;
-  snprintf(onePar,buffersize,"Pair in same Module: %d ; Fill Different SM histos %d; CheckConversions %d; TrackMult as centrality: %d; PhotonMult as centrality: %d; cluster E as centrality: %d; cell as centrality: %d; Fill InvPt histos %d\n",
-           fSameSM, fFillSMCombinations, fCheckConversion, fUseTrackMultBins, fUsePhotonMultBins, fUseAverClusterEBins, fUseAverCellEBins, fMakeInvPtPlots) ;
-  parList+=onePar ;
   snprintf(onePar,buffersize,"Select pairs with their angle: %d, edep %d, min angle %2.3f, max angle %2.3f,\n",fUseAngleCut, fUseAngleEDepCut,fAngleCut,fAngleMaxCut) ;
   parList+=onePar ;
   snprintf(onePar,buffersize," Asymmetry cuts: n = %d, asymmetry < ",fNAsymCuts) ;
@@ -211,11 +213,15 @@ TList * AliAnaPi0::GetCreateOutputObjects()
   //create event containers
   fEventsList = new TList*[GetNCentrBin()*GetNZvertBin()*GetNRPBin()] ;
        
-  for(Int_t ic=0; ic<GetNCentrBin(); ic++){
-    for(Int_t iz=0; iz<GetNZvertBin(); iz++){
-      for(Int_t irp=0; irp<GetNRPBin(); irp++){
-        fEventsList[ic*GetNZvertBin()*GetNRPBin()+iz*GetNRPBin()+irp] = new TList() ;
-        fEventsList[ic*GetNZvertBin()*GetNRPBin()+iz*GetNRPBin()+irp]->SetOwner(kFALSE);
+  for(Int_t ic=0; ic<GetNCentrBin(); ic++)
+  {
+    for(Int_t iz=0; iz<GetNZvertBin(); iz++)
+    {
+      for(Int_t irp=0; irp<GetNRPBin(); irp++)
+      {
+        Int_t bin = GetEventMixBin(ic,iz,irp);
+        fEventsList[bin] = new TList() ;
+        fEventsList[bin]->SetOwner(kFALSE);
       }
     }
   }
@@ -280,38 +286,9 @@ TList * AliAnaPi0::GetCreateOutputObjects()
   Int_t ntrmbins  = GetHistogramRanges()->GetHistoTrackMultiplicityBins();
   Int_t ntrmmax   = GetHistogramRanges()->GetHistoTrackMultiplicityMax();
   Int_t ntrmmin   = GetHistogramRanges()->GetHistoTrackMultiplicityMin(); 
-  
-  if(GetNCentrBin() > 1 && (fUseAverCellEBins||fUseAverClusterEBins||fUseAverClusterEDenBins)){
-    
-    fhAverTotECluster = new TH1F("hAverTotECluster","hAverTotECluster",200,0,50) ;
-    fhAverTotECluster->SetXTitle("E_{cluster, aver. SM} (GeV)");
-    outputContainer->Add(fhAverTotECluster) ;
-    
-    fhAverTotECell    = new TH1F("hAverTotECell","hAverTotECell",200,0,50) ;
-    fhAverTotECell->SetXTitle("E_{cell, aver. SM} (GeV)");
-    outputContainer->Add(fhAverTotECell) ;
     
-    fhAverTotECellvsCluster    = new TH2F("hAverTotECellvsCluster","hAverTotECellvsCluster",200,0,50,200,0,50) ;
-    fhAverTotECellvsCluster->SetYTitle("E_{cell, aver. SM} (GeV)");
-    fhAverTotECellvsCluster->SetXTitle("E_{cluster, aver. SM} (GeV)");
-    outputContainer->Add(fhAverTotECellvsCluster) ;
-    
-    fhEDensityCluster = new TH1F("hEDensityCluster","hEDensityCluster",200,0,50) ;
-    fhEDensityCluster->SetXTitle("#Sigma E_{cluster} / N_{cluster} (GeV)");
-    outputContainer->Add(fhEDensityCluster) ;
-    
-    fhEDensityCell    = new TH1F("hEDensityCell","hEDensityCell",200,0,50) ;
-    fhEDensityCell->SetXTitle("#Sigma E_{cell} / N_{cell} (GeV)");
-    outputContainer->Add(fhEDensityCell) ;
-    
-    fhEDensityCellvsCluster    = new TH2F("hEDensityCellvsCluster","hEDensityCellvsCluster",200,0,50,200,0,50) ;
-    fhEDensityCellvsCluster->SetYTitle("#Sigma E_{cell} / N_{cell} (GeV)");
-    fhEDensityCellvsCluster->SetXTitle("#Sigma E_{cluster} / N_{cluster} (GeV)");
-    outputContainer->Add(fhEDensityCellvsCluster) ;
-    
-  }//counting and average histograms
-  
-  if(fCheckConversion){
+  if(fCheckConversion)
+  {
     fhReConv = new TH2F("hReConv","Real Pair with one recombined conversion ",nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
     fhReConv->SetXTitle("p_{T} (GeV/c)");
     fhReConv->SetYTitle("m_{#gamma,#gamma} (GeV/c^{2})");
@@ -322,7 +299,8 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     fhReConv2->SetYTitle("m_{#gamma,#gamma} (GeV/c^{2})");
     outputContainer->Add(fhReConv2) ;
     
-    if(fDoOwnMix){
+    if(DoOwnMix())
+    {
       fhMiConv = new TH2F("hMiConv","Mixed Pair with one recombined conversion ",nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
       fhMiConv->SetXTitle("p_{T} (GeV/c)");
       fhMiConv->SetYTitle("m_{#gamma,#gamma} (GeV/c^{2})");
@@ -401,7 +379,8 @@ TList * AliAnaPi0::GetCreateOutputObjects()
             outputContainer->Add(fhReInvPt3[index]) ;
           }
         }
-        if(fDoOwnMix){
+        if(DoOwnMix())
+        {
           //Distance to bad module 1
           snprintf(key, buffersize,"hMi_cen%d_pidbit%d_asy%d_dist1",ic,ipid,iasym) ;
           snprintf(title, buffersize,"Mixed m_{#gamma#gamma} distr. for centrality=%d, PID bit=%d and asymmetry %1.2f, dist bad 1",
@@ -573,15 +552,20 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     outputContainer->Add(fhReSS[2]) ;
   }
   
-  fhEvents=new TH3F("hEvents","Number of events",GetNCentrBin(),0.,1.*GetNCentrBin(),
-                    GetNZvertBin(),0.,1.*GetNZvertBin(),GetNRPBin(),0.,1.*GetNRPBin()) ;
+  fhEventBin=new TH1I("hEventBin","Number of real pairs per bin(cen,vz,rp)",
+                      GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1,0, 
+                      GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1) ;
+  fhEventBin->SetXTitle("bin");
+  outputContainer->Add(fhEventBin) ;
   
-  fhEvents->SetXTitle("Centrality bin");
-  fhEvents->SetYTitle("Z vertex bin bin");
-  fhEvents->SetZTitle("RP bin");
-  outputContainer->Add(fhEvents) ;
+  fhEventMixBin=new TH1I("hEventMixBin","Number of mixed pairs per bin(cen,vz,rp)",
+                         GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1,0,
+                         GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1) ;
+  fhEventMixBin->SetXTitle("bin");
+  outputContainer->Add(fhEventMixBin) ;  
        
-  if(GetNCentrBin()>1){
+  if(GetNCentrBin()>1)
+  {
     fhCentrality=new TH1F("hCentralityBin","Number of events in centrality bin",GetNCentrBin(),0.,1.*GetNCentrBin()) ;
     fhCentrality->SetXTitle("Centrality bin");
     outputContainer->Add(fhCentrality) ;
@@ -591,21 +575,16 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     outputContainer->Add(fhCentralityNoPair) ;
   }
   
-  if(GetNRPBin() > 1 ){
-    
-    fhEventPlaneAngle=new TH1F("hEventPlaneAngleBin","Number of events in centrality bin",100,0.,TMath::TwoPi()) ;
-    fhEventPlaneAngle->SetXTitle("EP angle (rad)");
-    outputContainer->Add(fhEventPlaneAngle) ;
-    
-    if(GetNCentrBin()>1){
-      fhEventPlaneResolution=new TH2F("hEventPlaneResolution","Event plane resolution",GetNCentrBin(),0,GetNCentrBin(),100,0.,TMath::TwoPi()) ;
-      fhEventPlaneResolution->SetYTitle("Resolution");
-      fhEventPlaneResolution->SetXTitle("Centrality Bin");
-      outputContainer->Add(fhEventPlaneResolution) ;
-    }
+  if(GetNRPBin() > 1 && GetNCentrBin()>1 )
+  {
+    fhEventPlaneResolution=new TH2F("hEventPlaneResolution","Event plane resolution",GetNCentrBin(),0,GetNCentrBin(),100,0.,TMath::TwoPi()) ;
+    fhEventPlaneResolution->SetYTitle("Resolution");
+    fhEventPlaneResolution->SetXTitle("Centrality Bin");
+    outputContainer->Add(fhEventPlaneResolution) ;
   }
   
-  if(fFillAngleHisto){
+  if(fFillAngleHisto)
+  {
     fhRealOpeningAngle  = new TH2F
     ("hRealOpeningAngle","Angle between all #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,300,0,TMath::Pi()); 
     fhRealOpeningAngle->SetYTitle("#theta(rad)");
@@ -618,8 +597,8 @@ TList * AliAnaPi0::GetCreateOutputObjects()
     fhRealCosOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
     outputContainer->Add(fhRealCosOpeningAngle) ;
     
-    if(fDoOwnMix){
-      
+    if(DoOwnMix())
+    {
       fhMixedOpeningAngle  = new TH2F
       ("hMixedOpeningAngle","Angle between all #gamma pair vs E_{#pi^{0}}, Mixed pairs",nptbins,ptmin,ptmax,300,0,TMath::Pi()); 
       fhMixedOpeningAngle->SetYTitle("#theta(rad)");
@@ -932,7 +911,8 @@ TList * AliAnaPi0::GetCreateOutputObjects()
         }
       }//EMCAL
       
-      if(fDoOwnMix){ 
+      if(DoOwnMix())
+      { 
         snprintf(key, buffersize,"hMiMod_%d",imod) ;
         snprintf(title, buffersize,"Mixed m_{#gamma#gamma} distr. for Module %d",imod) ;
         fhMiMod[imod]  = new TH2F(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
@@ -1534,47 +1514,6 @@ void AliAnaPi0::FillMCVersusRecDataHistograms(const Int_t index1,  const Int_t i
   }
 }  
 
-//____________________________________________________________________________________________________________________________________________________
-void AliAnaPi0::CountAndGetAverages(Int_t &nClus,Int_t &nCell, Float_t &eClusTot,Float_t &eCellTot, Float_t &eDenClus,Float_t &eDenCell) {
-  // Count the number of clusters and cells, deposited energy, and do some averages in case multiplicity bins dependent on such numbers
-  // are requested
-  if(fCalorimeter=="EMCAL"){ 
-    nClus = GetEMCALClusters()  ->GetEntriesFast();
-    nCell = GetEMCALCells()->GetNumberOfCells();
-    for(Int_t icl=0; icl < nClus; icl++) {
-      Float_t e1 = ((AliVCluster*)GetEMCALClusters()->At(icl))->E();
-      eClusTot +=  e1;
-    }// first cluster
-    
-    for(Int_t jce=0; jce < nCell; jce++) eCellTot +=  GetEMCALCells()->GetAmplitude(jce);
-  }
-  else {                     
-    nClus = GetPHOSClusters()->GetEntriesFast();
-    nCell = GetPHOSCells()   ->GetNumberOfCells();
-    for(Int_t icl=0; icl < nClus; icl++) {
-      Float_t e1 = ((AliVCluster*)GetPHOSClusters()->At(icl))->E();
-      eClusTot +=  e1;
-    }// first cluster
-    for(Int_t jce=0; jce < nCell; jce++) eCellTot +=  GetPHOSCells()->GetAmplitude(jce);
-  }
-  if(GetDebug() > 1) 
-    printf("AliAnaPi0::MakeAnalysisFillHistograms() - # Clusters %d, sum cluster E per SM %f,# Cells %d, sum cell E per SM %f\n", nClus,eClusTot,nCell,eCellTot);
-  
-  //Fill histograms with "energy density", ncell and nclust will be > 0 since there are at least 2 "photons"
-  eDenClus = eClusTot/nClus;
-  eDenCell = eCellTot/nCell;
-  fhEDensityCluster      ->Fill(eDenClus);
-  fhEDensityCell         ->Fill(eDenCell);
-  fhEDensityCellvsCluster->Fill(eDenClus, eDenCell);
-  //Fill the average number of cells or clusters per SM
-  eClusTot /=fNModules;
-  eCellTot /=fNModules;
-  fhAverTotECluster      ->Fill(eClusTot);
-  fhAverTotECell         ->Fill(eCellTot);
-  fhAverTotECellvsCluster->Fill(eClusTot, eCellTot);
-  //printf("Average Cluster: E %f, density %f;  Average Cell E %f, density  %f\n ",eClusTot,eDenClus,eCellTot,eDenCell);
-}
-
 //____________________________________________________________________________________________________________________________________________________
 void AliAnaPi0::MakeAnalysisFillHistograms() 
 {
@@ -1595,16 +1534,6 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
   
   //Init some variables
   Int_t   nPhot    = GetInputAODBranch()->GetEntriesFast() ;
-  Int_t   nClus    = 0;
-  Int_t   nCell    = 0;
-  Float_t eClusTot = 0;
-  Float_t eCellTot = 0;
-  Float_t eDenClus = 0;
-  Float_t eDenCell = 0;
-  
-  if(GetNCentrBin() > 1 && (fUseAverCellEBins||fUseAverClusterEBins||fUseAverClusterEDenBins))
-    CountAndGetAverages(nClus,nCell,eClusTot,eCellTot,eDenClus,eDenCell);
-  
   
   if(GetDebug() > 1) 
     printf("AliAnaPi0::MakeAnalysisFillHistograms() - Photon entries %d\n", nPhot);
@@ -1626,10 +1555,11 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
   Double_t vert[]       = {0.0, 0.0, 0.0} ; //vertex 
   Int_t evtIndex1       = 0 ; 
   Int_t currentEvtIndex = -1; 
-  Int_t curCentrBin     = 0 ; 
-  Int_t curRPBin        = 0 ; 
-  Int_t curZvertBin     = 0 ;
-  
+  Int_t curCentrBin     = GetEventCentralityBin();
+  //Int_t curVzBin        = GetEventVzBin();
+  //Int_t curRPBin        = GetEventRPBin();
+  Int_t eventbin        = GetEventMixBin();
+
   //Get shower shape information of clusters
   TObjArray *clusters = 0;
   if     (fCalorimeter=="EMCAL") clusters = GetEMCALClusters();
@@ -1638,7 +1568,8 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
   //---------------------------------
   //First loop on photons/clusters
   //---------------------------------
-  for(Int_t i1=0; i1<nPhot-1; i1++){
+  for(Int_t i1=0; i1<nPhot-1; i1++)
+  {
     AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ;
     //printf("AliAnaPi0::MakeAnalysisFillHistograms() : cluster1 id %d\n",p1->GetCaloLabel(0));
     
@@ -1655,78 +1586,16 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
     if(TMath::Abs(vert[2]) > GetZvertexCut()) continue ;   //vertex cut
     
     
-    //----------------------------------------------------------------------------
-    // Get the multiplicity bin. Different cases: centrality (PbPb), 
-    // average cluster multiplicity, average cell multiplicity, track multiplicity 
-    // default is centrality bins
-    //----------------------------------------------------------------------------
-    if (evtIndex1 != currentEvtIndex) {
-      if(fUseTrackMultBins){ // Track multiplicity bins
-        //printf("track  mult %d\n",GetTrackMultiplicity());
-        curCentrBin = (GetTrackMultiplicity()-1)/5; 
-        if(curCentrBin > GetNCentrBin()-1) curCentrBin=GetNCentrBin()-1;
-        //printf("track mult bin %d\n",curCentrBin);
-      }
-      else if(fUsePhotonMultBins){ // Photon multiplicity bins
-        //printf("photon  mult %d cluster mult %d\n",nPhot, nClus);
-        curCentrBin = nPhot-2; 
-        if(curCentrBin > GetNCentrBin() -1) curCentrBin=GetNCentrBin()-1;
-        //printf("photon mult bin %d\n",curRPBin);        
-      }
-      else if(fUseAverClusterEBins){ // Cluster average energy bins
-        //Bins for pp, if needed can be done in a more general way
-        curCentrBin = (Int_t) eClusTot/10 * GetNCentrBin(); 
-        if(curCentrBin > GetNCentrBin()-1) curCentrBin=GetNCentrBin()-1;
-        //printf("cluster E average %f, bin %d \n",eClusTot,curCentrBin);
-      }
-      else if(fUseAverCellEBins){ // Cell average energy bins
-        //Bins for pp, if needed can be done in a more general way
-        curCentrBin = (Int_t) eCellTot/10*GetNCentrBin(); 
-        if(curCentrBin > GetNCentrBin()-1) curCentrBin=GetNCentrBin()-1;
-        //printf("cell E average %f, bin %d \n",eCellTot,curCentrBin);
-      }
-      else if(fUseAverClusterEDenBins){ // Energy density bins
-        //Bins for pp, if needed can be done in a more general way
-        curCentrBin = (Int_t) eDenClus/10*GetNCentrBin(); 
-        if(curCentrBin > GetNCentrBin()-1) curCentrBin=GetNCentrBin()-1;
-        //printf("cluster Eden average %f, bin %d \n",eDenClus,curCentrBin);
-      } 
-      else { //Event centrality
-        // Centrality task returns at maximum 10, 20 or 100, depending on option chosen and 
-        // number of bins, the bin has to be corrected
-        curCentrBin = GetEventCentrality() * GetNCentrBin() / GetReader()->GetCentralityOpt(); 
-        if(GetDebug() > 0 )printf("AliAnaPi0::MakeAnalysisFillHistograms() - curCentrBin %d, centrality %d, n bins %d, max bin from centrality %d\n",
-                                  curCentrBin, GetEventCentrality(), GetNCentrBin(), GetReader()->GetCentralityOpt());
-      }
-      
-      if (curCentrBin < 0 || curCentrBin >= GetNCentrBin()){ 
-        if(GetDebug() > 0) 
-          printf("AliAnaPi0::MakeAnalysisFillHistograms() - Centrality bin <%d> not expected, n bins <%d> , return\n",curCentrBin,GetNCentrBin());
-        return;
-      }
-      
-      //Reaction plane bin
-      curRPBin    = 0 ;
-      if(GetNRPBin()>1 && GetEventPlane()){
-        Float_t epAngle = GetEventPlane()->GetEventplane(GetEventPlaneMethod());
-        fhEventPlaneAngle->Fill(epAngle);
-        curRPBin = TMath::Nint(epAngle*(GetNRPBin()-1)/TMath::Pi());
-        if(curRPBin >= GetNRPBin()) printf("RP Bin %d out of range %d\n",curRPBin,GetNRPBin());
-        //printf("RP: %d, %f, angle %f, n bin %d\n", curRPBin,epAngle*(GetNRPBin()-1)/TMath::Pi(),epAngle,GetNRPBin());
-      }
-      
-      //Get vertex z bin
-      curZvertBin = (Int_t)(0.5*GetNZvertBin()*(vert[2]+GetZvertexCut())/GetZvertexCut()) ;
-      
+    if (evtIndex1 != currentEvtIndex) 
+    {
       //Fill event bin info
-      fhEvents    ->Fill(curCentrBin+0.5,curZvertBin+0.5,curRPBin+0.5) ;
-      if(GetNCentrBin() > 1) {
+      fhEventBin->Fill(eventbin) ;
+      if(GetNCentrBin() > 1) 
+      {
         fhCentrality->Fill(curCentrBin);
         if(GetNRPBin() > 1 && GetEventPlane()) fhEventPlaneResolution->Fill(curCentrBin,TMath::Cos(2.*GetEventPlane()->GetQsubRes()));
       }
       currentEvtIndex = evtIndex1 ; 
-      if(GetDebug() > 1) 
-        printf("AliAnaPi0::MakeAnalysisFillHistograms() - Centrality %d, Vertex Bin %d, RP bin %d \n",curCentrBin,curRPBin,curZvertBin);
     }
     
     //printf("AliAnaPi0::MakeAnalysisFillHistograms(): Photon 1 Evt %d  Vertex : %f,%f,%f\n",evtIndex1, GetVertex(evtIndex1)[0] ,GetVertex(evtIndex1)[1],GetVertex(evtIndex1)[2]);
@@ -1743,11 +1612,14 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
     Bool_t bFound1        = kFALSE;
     Int_t  caloLabel1     = p1->GetCaloLabel(0);
     Bool_t iclus1         =-1;
-    if(clusters){
+    if(clusters)
+    {
       for(Int_t iclus = 0; iclus < clusters->GetEntriesFast(); iclus++){
         AliVCluster *cluster= dynamic_cast<AliVCluster*> (clusters->At(iclus));
-        if(cluster){
-          if     (cluster->GetID()==caloLabel1) {
+        if(cluster)
+        {
+          if     (cluster->GetID()==caloLabel1) 
+          {
             bFound1  = kTRUE  ;
             cluster1 = cluster;
             iclus1   = iclus;
@@ -1760,7 +1632,8 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
     //---------------------------------
     //Second loop on photons/clusters
     //---------------------------------
-    for(Int_t i2=i1+1; i2<nPhot; i2++){
+    for(Int_t i2=i1+1; i2<nPhot; i2++)
+    {
       AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i2)) ;
       
       //In case of mixing frame, check we are not in the same event as the first cluster
@@ -1801,7 +1674,8 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
       
       Float_t tof2  = -1;
       Float_t l02   = -1;
-      if(cluster2 && bFound2){
+      if(cluster2 && bFound2)
+      {
         tof2  = cluster2->GetTOF()*1e9;
         l02   = cluster2->GetM02();
 
@@ -1809,7 +1683,8 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
       //      else printf("cluster2 not available: calo label %d / %d, cluster ID %d\n",
       //                  p2->GetCaloLabel(0),(GetReader()->GetInputEvent())->GetNumberOfCaloClusters()-1,cluster2->GetID());
       
-      if(clusters){
+      if(clusters)
+      {
         Double_t t12diff = tof1-tof2;
         if(TMath::Abs(t12diff) > GetPairTimeCut()) continue;
       }
@@ -1854,15 +1729,17 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
       //-------------------------------------------------------------------------------------------------
       //Fill module dependent histograms, put a cut on assymmetry on the first available cut in the array
       //-------------------------------------------------------------------------------------------------
-      if(a < fAsymCuts[0] && fFillSMCombinations){
+      if(a < fAsymCuts[0] && fFillSMCombinations)
+      {
         if(module1==module2 && module1 >=0 && module1<fNModules)
           fhReMod[module1]->Fill(pt,m) ;
         
-        if(fCalorimeter=="EMCAL"){
-          
+        if(fCalorimeter=="EMCAL")
+        {
           // Same sector
           Int_t j=0;
-          for(Int_t i = 0; i < fNModules/2; i++){
+          for(Int_t i = 0; i < fNModules/2; i++)
+          {
             j=2*i;
             if((module1==j && module2==j+1) || (module1==j+1 && module2==j)) fhReSameSectorEMCALMod[i]->Fill(pt,m) ;
           }
@@ -1882,10 +1759,11 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
       //In case we want only pairs in same (super) module, check their origin.
       Bool_t ok = kTRUE;
       if(fSameSM && module1!=module2) ok=kFALSE;
-      if(ok){
-        
+      if(ok)
+      {
         //Check if one of the clusters comes from a conversion 
-        if(fCheckConversion){
+        if(fCheckConversion)
+        {
           if     (p1->IsTagged() && p2->IsTagged()) fhReConv2->Fill(pt,m);
           else if(p1->IsTagged() || p2->IsTagged()) fhReConv ->Fill(pt,m);
         }
@@ -1925,13 +1803,15 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
         }// pid bit loop
         
         //Fill histograms with opening angle
-        if(fFillAngleHisto){
+        if(fFillAngleHisto)
+        {
           fhRealOpeningAngle   ->Fill(pt,angle);
           fhRealCosOpeningAngle->Fill(pt,TMath::Cos(angle));
         }
         
         //Fill histograms with pair assymmetry
-        if(fFillAsymmetryHisto){
+        if(fFillAsymmetryHisto)
+        {
           fhRePtAsym->Fill(pt,a);
           if(m > 0.10 && m < 0.17) fhRePtAsymPi0->Fill(pt,a);
           if(m > 0.45 && m < 0.65) fhRePtAsymEta->Fill(pt,a);
@@ -1942,11 +1822,12 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
         //-------------------------------------------------------        
         Int_t ncell1 = 0;
         Int_t ncell2 = 0;
-        if(fMultiCutAna || (IsDataMC() && fMultiCutAnaSim)){
-          
+        if(fMultiCutAna || (IsDataMC() && fMultiCutAnaSim))
+        {
           AliVEvent * event = GetReader()->GetInputEvent();
           if(event){
-            for(Int_t iclus = 0; iclus < event->GetNumberOfCaloClusters(); iclus++){
+            for(Int_t iclus = 0; iclus < event->GetNumberOfCaloClusters(); iclus++)
+            {
               AliVCluster *cluster = event->GetCaloCluster(iclus);
               
               Bool_t is = kFALSE;
@@ -2032,18 +1913,25 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
   //-------------------------------------------------------------
   // Mixing
   //-------------------------------------------------------------
-  if(fDoOwnMix){
-    //printf("Cen bin %d, RP bin %d, e aver %f, mult %d\n",curCentrBin,curRPBin, eClusTot, nPhot);
+  if(DoOwnMix())
+  {
     //Recover events in with same characteristics as the current event
-    TList * evMixList=fEventsList[curCentrBin*GetNZvertBin()*GetNRPBin()+curZvertBin*GetNRPBin()+curRPBin] ;
+    
+    //Check that the bin exists, if not (bad determination of RP, centrality or vz bin) do nothing
+    if(eventbin < 0) return ;
+    
+    TList * evMixList=fEventsList[eventbin] ;
     Int_t nMixed = evMixList->GetSize() ;
-    for(Int_t ii=0; ii<nMixed; ii++){  
+    for(Int_t ii=0; ii<nMixed; ii++)
+    {  
       TClonesArray* ev2= (TClonesArray*) (evMixList->At(ii));
       Int_t nPhot2=ev2->GetEntriesFast() ;
       Double_t m = -999;
       if(GetDebug() > 1) 
-        printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed event %d photon entries %d, centrality bin %d\n", ii, nPhot2, curCentrBin);
-      
+        printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed event %d photon entries %d, centrality bin %d\n", ii, nPhot2, GetEventCentralityBin());
+
+      fhEventMixBin->Fill(eventbin) ;
+
       //---------------------------------
       //First loop on photons/clusters
       //---------------------------------      
@@ -2132,7 +2020,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
               if((p1->IsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){ 
                 for(Int_t iasym=0; iasym < fNAsymCuts; iasym++){
                   if(a < fAsymCuts[iasym]){
-                    Int_t index = ((curCentrBin*fNPIDBits)+ipid)*fNAsymCuts + iasym;
+                    Int_t index = ((GetEventCentralityBin()*fNPIDBits)+ipid)*fNAsymCuts + iasym;
                     fhMi1     [index]->Fill(pt,m) ;
                     if(fMakeInvPtPlots)fhMiInvPt1[index]->Fill(pt,m,1./pt) ;
                     if(fFillBadDistHisto){
index 2034b4474a5a68538f57909731b200eb71a5fb49..e20e17f9d7287c3109d8a0b984499f1e7b4fba74 100755 (executable)
@@ -54,26 +54,7 @@ class AliAnaPi0 : public AliAnaCaloTrackCorrBaseClass {
   // EVENT Bin Methods
   //-------------------------------
 
-  Int_t        GetEventIndex(AliAODPWG4Particle * part, Double_t * vert)  ;
-
-  void         CountAndGetAverages(Int_t &nClus,Int_t &nCell, Float_t &eClusTot,Float_t &eCellTot, Float_t &eDenClus,Float_t &eDenCell) ;
-  
-  //Switchs for event multiplicity bin option, by default, centrality
-  
-  void         SwitchOnTrackMultBins()          { fUseTrackMultBins    = kTRUE  ; }
-  void         SwitchOffTrackMultBins()         { fUseTrackMultBins    = kFALSE ; }
-  
-  void         SwitchOnPhotonMultBins()         { fUsePhotonMultBins   = kTRUE  ; }
-  void         SwitchOffPhotonMultBins()        { fUsePhotonMultBins   = kFALSE ; }
-  
-  void         SwitchOnClusterEBins()           { fUseAverClusterEBins = kTRUE  ; }
-  void         SwitchOffClusterEBins()          { fUseAverClusterEBins = kFALSE ; }
-  
-  void         SwitchOnCellEBins()              { fUseAverCellEBins    = kTRUE  ; }
-  void         SwitchOffCellEBins()             { fUseAverCellEBins    = kFALSE ; }
-
-  void         SwitchOnClusterEDenBins()        { fUseAverClusterEDenBins = kTRUE  ; }
-  void         SwitchOffClusterEDenBins()       { fUseAverClusterEDenBins = kFALSE ; }
+  Int_t        GetEventIndex(AliAODPWG4Particle * part, Double_t * vert)  ;  
 
   //-------------------------------
        //Opening angle pair selection
@@ -90,12 +71,6 @@ class AliAnaPi0 : public AliAnaCaloTrackCorrBaseClass {
   void         SwitchOnFillAngleHisto()         { fFillAngleHisto      = kTRUE  ; }
   void         SwitchOffFillAngleHisto()        { fFillAngleHisto      = kFALSE ; }
   
-  //-------------------------------
-  // Use mixing code of this class
-  //-------------------------------
-  void         SwitchOnOwnMix()                 { fDoOwnMix            = kTRUE  ; }
-  void         SwitchOffOwnMix()                { fDoOwnMix            = kFALSE ; }
-
   //------------------------------------------
   //Do analysis only with clusters in same SM or different combinations of SM
   //------------------------------------------
@@ -154,7 +129,6 @@ class AliAnaPi0 : public AliAnaCaloTrackCorrBaseClass {
   
   private:
 
-  Bool_t   fDoOwnMix;                  // Do combinatorial background not the one provided by the frame
   TList ** fEventsList ;               //![GetNCentrBin()*GetNZvertBin()*GetNRPBin()] Containers for photons in stored events
 
   TString  fCalorimeter ;              // Select Calorimeter for IM
@@ -182,11 +156,6 @@ class AliAnaPi0 : public AliAnaCaloTrackCorrBaseClass {
   Bool_t   fSameSM;                    // Select only pairs in same SM;
   Bool_t   fFillSMCombinations;        // Fill histograms with different cluster pairs in SM combinations
   Bool_t   fCheckConversion;           // Fill histograms with tagged photons as conversion
-  Bool_t   fUseTrackMultBins;          // Use track multiplicity and not centrality bins
-  Bool_t   fUsePhotonMultBins;         // Use photon multiplicity and not centrality bins
-  Bool_t   fUseAverCellEBins;          // Use cell average energy and not centrality bins
-  Bool_t   fUseAverClusterEBins;       // Use cluster average energy and not centrality bins
-  Bool_t   fUseAverClusterEDenBins;    // Use cluster average energy density and not centrality bins
   Bool_t   fFillBadDistHisto;          // Do plots for different distances to bad channels
   Bool_t   fFillSSCombinations;        // Do invariant mass for different combination of shower shape clusters
   Bool_t   fFillAngleHisto;            // Fill histograms with pair opening angle
@@ -247,11 +216,11 @@ class AliAnaPi0 : public AliAnaCaloTrackCorrBaseClass {
   TH2F *   fhRePtAsymEta ;             //! REAL two-photon pt vs asymmetry, close to eta mass
   
   //Centrality, Event plane bins
-  TH3F *   fhEvents;                   //! Number of events per centrality, RP, zbin
+  TH1I *   fhEventBin;                 //! Number of real  pairs in a particular bin (cen,vz,rp)
+  TH1I *   fhEventMixBin;              //! Number of mixed pairs in a particular bin (cen,vz,rp)
   TH1F *   fhCentrality;               //! Histogram with centrality bins with at least one pare
   TH1F *   fhCentralityNoPair;         //! Histogram with centrality bins with no pair
 
-  TH1F *   fhEventPlaneAngle;          //! Histogram with Event plane angle
   TH2F *   fhEventPlaneResolution;     //! Histogram with Event plane resolution vs centrality
   
   // Pair opening angle
@@ -308,7 +277,7 @@ class AliAnaPi0 : public AliAnaCaloTrackCorrBaseClass {
   AliAnaPi0(              const AliAnaPi0 & api0) ; // cpy ctor
   AliAnaPi0 & operator = (const AliAnaPi0 & api0) ; // cpy assignment
   
-  ClassDef(AliAnaPi0,22)
+  ClassDef(AliAnaPi0,23)
 } ;