#include "AliHBTEvent.h" #include "AliHBTParticle.h" ClassImp(AliHBTEvent) const UInt_t AliHBTEvent::fgkInitEventSize = 10000; /**************************************************************************/ AliHBTEvent::AliHBTEvent() { if(fgkInitEventSize<1) { Fatal("AliHBTEvent::AliHBTEvent()", "fgkInitEventSize has a stiupid value (%d). Change it to positive number and recompile", fgkInitEventSize); } fSize=fgkInitEventSize; fParticles = new AliHBTParticle* [fSize]; fNParticles = 0; fOwner = kTRUE; } /**************************************************************************/ AliHBTEvent::~AliHBTEvent() { this->Reset();//delete all particles if(fParticles) { delete [] fParticles; //and delete array itself } fParticles = 0x0; } /**************************************************************************/ void AliHBTEvent::Reset() { //deletes all particles from the event if(fParticles && fOwner) { for(Int_t i =0; i= fSize) Expand(); //if there is no space in array, expand it fParticles[fNParticles++] = hbtpart; //add a pointer } /**************************************************************************/ void AliHBTEvent::AddParticle(TParticle* part) { AddParticle( new AliHBTParticle(*part) ); } /**************************************************************************/ void AliHBTEvent:: AddParticle(Int_t pdg, Double_t px, Double_t py, Double_t pz, Double_t etot, Double_t vx, Double_t vy, Double_t vz, Double_t time) { AddParticle(new AliHBTParticle(pdg,px,py,pz,etot,vx,vy,vz,time) ); } /**************************************************************************/ void AliHBTEvent::Expand() { //expands the array with pointers to particles //about the size defined in fgkInitEventSize fSize+=fgkInitEventSize; AliHBTParticle** tmpParticles = new AliHBTParticle* [fSize]; //create new array of pointers //check if we got memory / if not Abort if (!tmpParticles) Fatal("AliHBTEvent::Expand()","No more space in memory"); for(Int_t i = 0; i