Cluster Map moved to ANALYSIS
[u/mrichter/AliRoot.git] / HBTAN / AliHBTEvent.cxx
index de7cdf29fd8cde7e64ba99aedb0b29732576b96d..9f5275523d788512a24ff307affcfa947f90f3be 100644 (file)
@@ -36,7 +36,42 @@ AliHBTEvent::AliHBTEvent():
    }
  }
 /**************************************************************************/ 
+AliHBTEvent::AliHBTEvent(const AliHBTEvent& source):
+ TObject(source),
+ fSize(source.fSize),
+ fParticles(new AliHBTParticle* [fSize]),
+ fNParticles(source.fNParticles),
+ fOwner(source.fNParticles),
+ fRandomized(source.fRandomized)
+{
+//copy constructor
+  for(Int_t i =0; i<fNParticles; i++)
+   {
+      fParticles[i] = new AliHBTParticle( *(source.fParticles[i]) );
+   }
+  
+}
+/**************************************************************************/ 
 
+AliHBTEvent& AliHBTEvent::operator=(const AliHBTEvent& source)
+{
+  // assigment operator
+  Reset();
+  if (fParticles) delete [] fParticles;
+  fSize = source.fSize;
+  fParticles = new AliHBTParticle* [fSize];
+  fNParticles = source.fNParticles;
+  fOwner = source.fNParticles;
+  fRandomized = source.fRandomized;
+      
+  for(Int_t i =0; i<fNParticles; i++)
+   {
+      fParticles[i] = new AliHBTParticle( *(source.fParticles[i]) );
+   }
+  return *this;
+}
+/**************************************************************************/ 
 AliHBTEvent::~AliHBTEvent()
  {
 //destructor   
@@ -54,9 +89,14 @@ void  AliHBTEvent::Reset()
   if(fParticles && fOwner)
     {
       for(Int_t i =0; i<fNParticles; i++)
-        delete fParticles[i];
+       {
+         for (Int_t j = i+1; j<fNParticles; j++)
+           if (fParticles[j] == fParticles[i]) fParticles[j] = 0x0;
+         delete fParticles[i];
+       }
     }
    fNParticles = 0;
+   fRandomized = kFALSE;
 } 
 /**************************************************************************/ 
 
@@ -110,3 +150,15 @@ void AliHBTEvent::Expand()
  delete [] fParticles; //delete old array
   fParticles = tmpParticles; //copy new pointer to the array of pointers to particles
 }
+/**************************************************************************/ 
+
+void AliHBTEvent::SwapParticles(Int_t i, Int_t j)
+{
+//swaps particles positions; used by AliHBTEvent::Blend
+  if ( (i<0) || (i>=fNParticles)) return;
+  if ( (j<0) || (j>=fNParticles)) return;
+  
+  AliHBTParticle* tmp = fParticles[i];
+  fParticles[i] = fParticles[j];
+  fParticles[j] = tmp;
+}