Corrections for gcc 4.0
[u/mrichter/AliRoot.git] / HBTAN / AliHBTAnalysis.cxx
index a216f8b..b330210 100644 (file)
 // ALICE Off-Line framework:
 //
 // Piotr.Skowronski@cern.ch
-// more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html
+// more info: http://aliweb.cern.ch/people/skowron/analyzer/index.html
 //
 ////////////////////////////////////////////////////////////////////////////
 //_________________________________________________________
 
+#include <Riostream.h>
+#include <AliESD.h>
 
 #include <TSystem.h>
 #include <TFile.h>
@@ -34,6 +36,7 @@
 #include "AliHBTPair.h"
 #include "AliHBTFunction.h"
 #include "AliHBTMonitorFunction.h"
+#include "AliLog.h"
  
 
 ClassImp(AliHBTAnalysis)
@@ -124,7 +127,7 @@ AliHBTAnalysis::~AliHBTAnalysis()
     
    if (fIsOwner)
     {
-      if (AliVAODParticle::GetDebug()>5)Info("~AliHBTAnalysis","Is Owner: Attempting to delete functions");
+      AliDebug(5,"Is Owner: Attempting to delete functions");
       DeleteFunctions();
       if (AliVAODParticle::GetDebug()>5)Info("~AliHBTAnalysis","Delete functions done");
     }
@@ -355,8 +358,6 @@ Int_t AliHBTAnalysis::ProcessRecAndSim(AliAOD* aodrec, AliAOD* aodsim)
   AliAOD * trackEvent = aodrec, *partEvent = aodsim;
   AliAOD* trackEvent1 = new AliAOD();
   AliAOD* partEvent1 = new AliAOD();
-  partEvent1->SetOwner(kTRUE);
-  trackEvent1->SetOwner(kTRUE);
 
   AliAOD * trackEvent2,*partEvent2;
   
@@ -398,7 +399,7 @@ Int_t AliHBTAnalysis::ProcessRecAndSim(AliAOD* aodrec, AliAOD* aodsim)
      /******   filling numerators    ********/
      /***************************************/
      if ( (j%fDisplayMixingInfo) == 0)
-        Info("ProcessTracksAndParticles",
+        Info("ProcessRecAndSim",
              "Mixing particle %d with particles from the same event",j);
 
      part1= partEvent->GetParticle(j);
@@ -476,7 +477,7 @@ Int_t AliHBTAnalysis::ProcessRecAndSim(AliAOD* aodrec, AliAOD* aodsim)
 
         m++;
         if ( (j%fDisplayMixingInfo) == 0)
-           Info("ProcessTracksAndParticles",
+           Info("ProcessRecAndSim",
                 "Mixing particle %d from current event with particles from event %d",j,-m);
 
         for(Int_t l = 0; l<partEvent2->GetNumberOfParticles();l++)   //  ... on all particles
@@ -530,7 +531,6 @@ Int_t AliHBTAnalysis::ProcessSim(AliAOD* /*aodrec*/, AliAOD* aodsim)
   
   AliAOD* partEvent = aodsim;
   AliAOD* partEvent1 = new AliAOD();
-  partEvent1->SetOwner(kTRUE);
 
   AliAOD* partEvent2;
   
@@ -542,106 +542,106 @@ Int_t AliHBTAnalysis::ProcessSim(AliAOD* /*aodrec*/, AliAOD* aodsim)
   
   register UInt_t ii;
   
-  
-
   if ( !partEvent )
    {
-     Error("ProcessRecAndSim","Can not get event");
+     Error("ProcessSim","Can not get event");
      return 1;
    }
 
 
   for (Int_t j = 0; j<partEvent->GetNumberOfParticles() ; j++)
    {
-     /***************************************/
-     /******   Looping same events   ********/
-     /******   filling numerators    ********/
-     /***************************************/
-     if ( (j%fDisplayMixingInfo) == 0)
-        Info("ProcessTracksAndParticles",
-             "Mixing particle %d with particles from the same event",j);
+   /***************************************/
+   /******   Looping same events   ********/
+   /******   filling numerators    ********/
+   /***************************************/
+   if ( (j%fDisplayMixingInfo) == 0)
+      Info("ProcessSim",
+           "Mixing particle %d with particles from the same event",j);
 
-     part1= partEvent->GetParticle(j);
+   part1= partEvent->GetParticle(j);
 
-     Bool_t firstcut = fPairCut->GetFirstPartCut()->Rejected(part1);
+   Bool_t firstcut = fPairCut->GetFirstPartCut()->Rejected(part1);
 
-     if (fBufferSize != 0) 
-       if ( (firstcut == kFALSE) || ( fPairCut->GetSecondPartCut()->Rejected(part1) == kFALSE ) )
-        {
-          //accepted by any cut
-          // we have to copy because reader keeps only one event
+   if (fBufferSize != 0) 
+     if ( (firstcut == kFALSE) || ( fPairCut->GetSecondPartCut()->Rejected(part1) == kFALSE ) )
+      {
+        //accepted by any cut
+        // we have to copy because reader keeps only one event
 
-          partEvent1->AddParticle(part1);
-        }
+        partEvent1->AddParticle(part1);
+      }
 
-     if (firstcut) continue;
+   if (firstcut) continue;
 
-     for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
-       fParticleMonitorFunctions[ii]->Process(part1);
+   for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
+     fParticleMonitorFunctions[ii]->Process(part1);
 
-     if ( fNParticleFunctions == 0 ) continue;
+   if ( fNParticleFunctions == 0 ) continue;
 
-     for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
-      {
-        part2= partEvent->GetParticle(k);
-        if (part1->GetUID() == part2->GetUID()) continue;
-        partpair->SetParticles(part1,part2);
+   for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
+    {
+      part2= partEvent->GetParticle(k);
+      if (part1->GetUID() == part2->GetUID()) continue;
+      partpair->SetParticles(part1,part2);
+
+         if(fPairCut->Rejected(partpair)) //check pair cut
+          { //do not meets crietria of the 
+            if( fPairCut->Rejected((AliHBTPair*)partpair->GetSwappedPair()) ) continue;
+            else tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
+          }
+         else
+          {
+            tmppartpair = partpair;
+          }
 
-           if(fPairCut->Rejected(partpair)) //check pair cut
-            { //do not meets crietria of the 
-              if( fPairCut->Rejected((AliHBTPair*)partpair->GetSwappedPair()) ) continue;
-              else tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
-            }
-           else
-            {
-              tmppartpair = partpair;
-            }
+      for(ii = 0;ii<fNParticleFunctions;ii++)
+             fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
 
-        for(ii = 0;ii<fNParticleFunctions;ii++)
-               fParticleFunctions[ii]->ProcessSameEventParticles(tmppartpair);
+     //end of 2nd loop over particles from the same event  
+    }//for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
 
-       //end of 2nd loop over particles from the same event  
-      }//for (Int_t k =j+1; k < partEvent->GetNumberOfParticles() ; k++)
+   /***************************************/
+   /***** Filling denominators    *********/
+   /***************************************/
+   if (fBufferSize == 0) continue;
 
-     /***************************************/
-     /***** Filling denominators    *********/
-     /***************************************/
-     if (fBufferSize == 0) continue;
+   fPartBuffer->ResetIter();
+       Int_t m = 0;
+       while (( partEvent2 = fPartBuffer->Next() ))
+        {
+          m++;
+          if ( (j%fDisplayMixingInfo) == 0)
+             Info("ProcessSim",
+                  "Mixing particle %d from current event with particles from event %d",j,-m);
+          for(Int_t l = 0; l<partEvent2->GetNumberOfParticles();l++)   //  ... on all particles
+            {
 
-     fPartBuffer->ResetIter();
-         Int_t m = 0;
-         while (( partEvent2 = fPartBuffer->Next() ))
-          {
-            m++;
-            if ( (j%fDisplayMixingInfo) == 0)
-               Info("ProcessParticles",
-                    "Mixing particle %d from current event with particles from event %d",j,-m);
-            for(Int_t l = 0; l<partEvent2->GetNumberOfParticles();l++)   //  ... on all particles
-              {
-
-                part2= partEvent2->GetParticle(l);
-                partpair->SetParticles(part1,part2);
-
-                if( fPairCut->Rejected(partpair) ) //check pair cut
-                  { //do not meets crietria of the 
-                    if( fPairCut->Rejected((AliHBTPair*)partpair->GetSwappedPair()) )
-                      continue;
-                    else 
-                     {
-                       tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
-                     }
-                  }
-                else
-                 {//meets criteria of the pair cut
-                  tmppartpair = partpair;
-                 }
-                 
-                for(ii = 0;ii<fNParticleFunctions;ii++)
-                  fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
-                 
-             }//for(Int_t l = 0; l<N2;l++)   //  ... on all particles
-          }
-       }
+              part2= partEvent2->GetParticle(l);
+              partpair->SetParticles(part1,part2);
+
+              if( fPairCut->Rejected(partpair) ) //check pair cut
+                { //do not meets crietria of the 
+                  if( fPairCut->Rejected((AliHBTPair*)partpair->GetSwappedPair()) )
+                    continue;
+                  else 
+                   {
+                     tmppartpair = (AliHBTPair*)partpair->GetSwappedPair();
+                   }
+                }
+              else
+               {//meets criteria of the pair cut
+                tmppartpair = partpair;
+               }
+
+              for(ii = 0;ii<fNParticleFunctions;ii++)
+                fParticleFunctions[ii]->ProcessDiffEventParticles(tmppartpair);
+
+           }//for(Int_t l = 0; l<N2;l++)   //  ... on all particles
+        }
+     }
+
+       
   delete fPartBuffer->Push(partEvent1);
  //end of loop over events  
   return 0;
@@ -654,7 +654,6 @@ Int_t AliHBTAnalysis::ProcessRec(AliAOD* aodrec, AliAOD* /*aodsim*/)
   
   AliAOD* trackEvent = aodrec;
   AliAOD* trackEvent1 = new AliAOD();
-  trackEvent1->SetOwner(kTRUE);
 
   AliAOD* trackEvent2;
   
@@ -665,7 +664,6 @@ Int_t AliHBTAnalysis::ProcessRec(AliAOD* aodrec, AliAOD* /*aodsim*/)
   AliHBTPair * tmptrackpair;
   
   register UInt_t ii;
-  
 
   if ( !trackEvent )
    {
@@ -681,7 +679,7 @@ Int_t AliHBTAnalysis::ProcessRec(AliAOD* aodrec, AliAOD* /*aodsim*/)
      /******   filling numerators    ********/
      /***************************************/
      if ( (j%fDisplayMixingInfo) == 0)
-        Info("ProcessTracksAndParticles",
+        Info("ProcessRec",
              "Mixing Particle %d with Particles from the same event",j);
 
      track1= trackEvent->GetParticle(j);
@@ -702,7 +700,7 @@ Int_t AliHBTAnalysis::ProcessRec(AliAOD* aodrec, AliAOD* /*aodsim*/)
      for(ii = 0; ii<fNParticleMonitorFunctions; ii++)
        fParticleMonitorFunctions[ii]->Process(track1);
 
-     if ( fNParticleFunctions == 0 ) continue;
+     if ( fNTrackFunctions == 0 ) continue;
 
      for (Int_t k =j+1; k < trackEvent->GetNumberOfParticles() ; k++)
       {
@@ -721,7 +719,7 @@ Int_t AliHBTAnalysis::ProcessRec(AliAOD* aodrec, AliAOD* /*aodsim*/)
             }
 
         for(ii = 0;ii<fNTrackFunctions;ii++)
-               fParticleFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
+               fTrackFunctions[ii]->ProcessSameEventParticles(tmptrackpair);
 
        //end of 2nd loop over Particles from the same event  
       }//for (Int_t k =j+1; k < trackEvent->GetNumberOfParticles() ; k++)
@@ -732,39 +730,39 @@ Int_t AliHBTAnalysis::ProcessRec(AliAOD* aodrec, AliAOD* /*aodsim*/)
      if (fBufferSize == 0) continue;
 
      fTrackBuffer->ResetIter();
-         Int_t m = 0;
-         while (( trackEvent2 = fTrackBuffer->Next() ))
+     Int_t m = 0;
+     while (( trackEvent2 = fTrackBuffer->Next() ))
+      {
+        m++;
+        if ( (j%fDisplayMixingInfo) == 0)
+           Info("ProcessRec",
+                "Mixing Particle %d from current event with Particles from event %d",j,-m);
+        for(Int_t l = 0; l<trackEvent2->GetNumberOfParticles();l++)   //  ... on all Particles
           {
-            m++;
-            if ( (j%fDisplayMixingInfo) == 0)
-               Info("ProcessParticles",
-                    "Mixing Particle %d from current event with Particles from event %d",j,-m);
-            for(Int_t l = 0; l<trackEvent2->GetNumberOfParticles();l++)   //  ... on all Particles
-              {
-
-                track2= trackEvent2->GetParticle(l);
-                trackpair->SetParticles(track1,track2);
-
-                if( fPairCut->Rejected(trackpair) ) //check pair cut
-                  { //do not meets crietria of the 
-                    if( fPairCut->Rejected((AliHBTPair*)trackpair->GetSwappedPair()) )
-                      continue;
-                    else 
-                     {
-                       tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
-                     }
-                  }
-                else
-                 {//meets criteria of the pair cut
-                  tmptrackpair = trackpair;
+
+            track2= trackEvent2->GetParticle(l);
+            trackpair->SetParticles(track1,track2);
+
+            if( fPairCut->Rejected(trackpair) ) //check pair cut
+              { //do not meets crietria of the 
+                if( fPairCut->Rejected((AliHBTPair*)trackpair->GetSwappedPair()) )
+                  continue;
+                else 
+                 {
+                   tmptrackpair = (AliHBTPair*)trackpair->GetSwappedPair();
                  }
-                 
-                for(ii = 0;ii<fNTrackFunctions;ii++)
-                  fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
-                 
-             }//for(Int_t l = 0; l<N2;l++)   //  ... on all Particles
-          }
-       }
+              }
+            else
+             {//meets criteria of the pair cut
+              tmptrackpair = trackpair;
+             }
+
+            for(ii = 0;ii<fNTrackFunctions;ii++)
+              fTrackFunctions[ii]->ProcessDiffEventParticles(tmptrackpair);
+
+         }//for(Int_t l = 0; l<N2;l++)   //  ... on all Particles
+      }
+   }
   delete fTrackBuffer->Push(trackEvent1);
  //end of loop over events  
   return 0;
@@ -802,6 +800,8 @@ Int_t AliHBTAnalysis::ProcessRecAndSimNonId(AliAOD* aodrec, AliAOD* aodsim)
   static AliAOD aodsim1;
 
   AliAOD * trackEvent1=&aodrec1,*partEvent1=&aodsim1;//Particle that passes first particle cut, this event
+  trackEvent1->Reset();
+  partEvent1->Reset();
   AliAOD * trackEvent2=0x0,*partEvent2=0x0;//Particle that passes second particle cut, this event
   AliAOD * trackEvent3=0x0,*partEvent3=0x0;//Particle that passes second particle cut, events from buffer
 
@@ -816,12 +816,6 @@ Int_t AliHBTAnalysis::ProcessRecAndSimNonId(AliAOD* aodrec, AliAOD* aodsim)
 
   register UInt_t ii;
   
-  
-  trackEvent1 = new AliAOD();
-  partEvent1 = new AliAOD();
-  trackEvent1->SetOwner(kFALSE);
-  partEvent1->SetOwner(kFALSE);;
-  
   /********************************/
   /*      Filtering out           */
   /********************************/
@@ -829,8 +823,6 @@ Int_t AliHBTAnalysis::ProcessRecAndSimNonId(AliAOD* aodrec, AliAOD* aodsim)
    {
      partEvent2  = new AliAOD();
      trackEvent2 = new AliAOD();
-     partEvent2->SetOwner(kTRUE);
-     trackEvent2->SetOwner(kTRUE);
    }
 
   FilterOut(partEvent1, partEvent2, rawpartEvent, trackEvent1, trackEvent2, rawtrackEvent);
@@ -885,49 +877,49 @@ Int_t AliHBTAnalysis::ProcessRecAndSimNonId(AliAOD* aodrec, AliAOD* aodsim)
          }
        }
 
- if ( fBufferSize == 0) continue;//do not mix diff histograms
- /***************************************/
- /***** Filling denominators    *********/
- /***************************************/
- fPartBuffer->ResetIter();
- fTrackBuffer->ResetIter();
+   if ( fBufferSize == 0) continue;//do not mix diff histograms
+   /***************************************/
+   /***** Filling denominators    *********/
+   /***************************************/
+   fPartBuffer->ResetIter();
+   fTrackBuffer->ResetIter();
 
- Int_t nmonitor = 0;
+   Int_t nmonitor = 0;
 
- while ( (partEvent3 = fPartBuffer->Next() ) != 0x0)
-  {
-    trackEvent3 = fTrackBuffer->Next();
+   while ( (partEvent3 = fPartBuffer->Next() ) != 0x0)
+    {
+      trackEvent3 = fTrackBuffer->Next();
 
-    if ( (j%fDisplayMixingInfo) == 0) 
-      Info("ProcessTracksAndParticlesNonIdentAnal",
-           "Mixing particle %d from current event with particles from event%d",j,-(++nmonitor));
+      if ( (j%fDisplayMixingInfo) == 0) 
+        Info("ProcessTracksAndParticlesNonIdentAnal",
+             "Mixing particle %d from current event with particles from event%d",j,-(++nmonitor));
 
-    for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
-      {
-        part2= partEvent3->GetParticle(k);
-        partpair->SetParticles(part1,part2);
+      for (Int_t k = 0; k < partEvent3->GetNumberOfParticles() ; k++)
+        {
+          part2= partEvent3->GetParticle(k);
+          partpair->SetParticles(part1,part2);
 
-        track2= trackEvent3->GetParticle(k);
-        trackpair->SetParticles(track1,track2);
+          track2= trackEvent3->GetParticle(k);
+          trackpair->SetParticles(track1,track2);
 
-        if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
-         { //do not meets crietria of the pair cut
-          continue; 
-         }
-        else
-         {//meets criteria of the pair cut
-          UInt_t ii;
-          for(ii = 0;ii<fNParticleFunctions;ii++)
-                 fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
+          if( (this->*fkPassPairProp)(partpair,trackpair) ) //check pair cut
+           { //do not meets crietria of the pair cut
+            continue; 
+           }
+          else
+           {//meets criteria of the pair cut
+            UInt_t ii;
+            for(ii = 0;ii<fNParticleFunctions;ii++)
+                   fParticleFunctions[ii]->ProcessDiffEventParticles(partpair);
 
-          for(ii = 0;ii<fNTrackFunctions;ii++)
-                 fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
+            for(ii = 0;ii<fNTrackFunctions;ii++)
+                   fTrackFunctions[ii]->ProcessDiffEventParticles(trackpair);
 
-          for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
-                 fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(trackpair,partpair);
-         }
-       }// for particles event2
-     }//while event2
+            for(ii = 0;ii<fNParticleAndTrackFunctions;ii++)
+                   fParticleAndTrackFunctions[ii]->ProcessDiffEventParticles(trackpair,partpair);
+           }
+         }// for particles event2
+       }//while event2
    }//for over particles in event1
 
  delete fPartBuffer->Push(partEvent2);
@@ -952,6 +944,7 @@ Int_t AliHBTAnalysis::ProcessSimNonId(AliAOD* /*aodrec*/, AliAOD* aodsim)
   static AliAOD aodsim1;
 
   AliAOD* partEvent1=&aodsim1;//Particle that passes first particle cut, this event
+  partEvent1->Reset();
   AliAOD* partEvent2=0x0;//Particle that passes second particle cut, this event
   AliAOD* partEvent3=0x0;//Particle that passes second particle cut, events from buffer
 
@@ -963,18 +956,12 @@ Int_t AliHBTAnalysis::ProcessSimNonId(AliAOD* /*aodrec*/, AliAOD* aodsim)
 
   register UInt_t ii;
   
-  
-  partEvent1 = new AliAOD();
-  partEvent1->SetOwner(kFALSE);;
-  
-
   /********************************/
   /*      Filtering out           */
   /********************************/
   if (partEvent2==0x0)//in case fBufferSize == 0 and pointers are created do not eneter
    {
      partEvent2  = new AliAOD();
-     partEvent2->SetOwner(kTRUE);
    }
 
   FilterOut(partEvent1, partEvent2, rawpartEvent);
@@ -1068,11 +1055,10 @@ Int_t AliHBTAnalysis::ProcessRecNonId(AliAOD* aodrec, AliAOD* /*aodsim*/)
   AliVAODParticle * track1, * track2;
 
   static AliAOD aodrec1;
-
   AliAOD * trackEvent1=&aodrec1;//Particle that passes first particle cut, this event
+  trackEvent1->Reset();
   AliAOD * trackEvent2=0x0;//Particle that passes second particle cut, this event
   AliAOD * trackEvent3=0x0;//Particle that passes second particle cut, events from buffer
-
   AliAOD* rawtrackEvent = aodrec;//this we get from Reader
 
   static AliHBTPair tpair;
@@ -1082,16 +1068,12 @@ Int_t AliHBTAnalysis::ProcessRecNonId(AliAOD* aodrec, AliAOD* /*aodsim*/)
   register UInt_t ii;
   
   
-  trackEvent1 = new AliAOD();
-  trackEvent1->SetOwner(kFALSE);
-  
   /********************************/
   /*      Filtering out           */
   /********************************/
   if ( trackEvent2==0x0 )//in case fBufferSize == 0 and pointers are created do not eneter
    {
      trackEvent2 = new AliAOD();
-     trackEvent2->SetOwner(kTRUE);
    }
 
   FilterOut(trackEvent1, trackEvent2, rawtrackEvent);
@@ -1759,5 +1741,3 @@ void AliHBTAnalysis::PressAnyKey()
    }
 }
 
-/*************************************************************************************/ 
-