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;
+}
Bool_t IsOwner() {return fOwner;}
void SetRandomized(Bool_t rd = kTRUE){fRandomized = rd;}
Bool_t IsRandomized()const {return fRandomized;}
+ void SwapParticles(Int_t i, Int_t j);//swaps particles positions; used by AliHBTEvent::Blend
protected:
Int_t fSize; //!current size of the array
AliHBTParticle ** fParticles; //!array of pointers to the particles
#include <TObjString.h>
#include <TObjArray.h>
#include <TClass.h>
+#include <TRandom.h>
#include "AliHBTParticleCut.h"
#include "AliHBTEvent.h"
if ( ReadNext() == kTRUE)
return kTRUE;
+ if (fBlend) Blend();
+
if (fBufferEvents)
{
if ( ReadsTracks() && fTracksEvent)
if (gDebug > 0) Info("GetDirName","Returned ok %s",dir->String().Data());
return dir->String();
}
+/*************************************************************************************/
+void AliHBTReader::Blend()
+{
+ //randomly change positions of the particles after reading
+ //is used to check if some distr depends on order of particles
+ //(tracking gives particles Pt sorted)
+ for (Int_t i = 2; i < fParticlesEvent->GetNumberOfParticles(); i++)
+ {
+ Int_t with = gRandom->Integer(i);
+ fParticlesEvent->SwapParticles(i,with);
+ if (fTracksEvent) fTracksEvent->SwapParticles(i,with);
+ }
+}
void SetDirs(TObjArray* dirs){fDirs = dirs;} //sets array directories names
void SetEventBuffering(Bool_t flag){fBufferEvents = flag;}
-
+ void SetBlend(Bool_t flag = kTRUE){fBlend=flag;}
virtual Int_t GetNumberOfDirs() const {return (fDirs)?fDirs->GetEntries():0;}
protected:
Bool_t fIsRead;//!flag indicating if the data are already read
Bool_t fBufferEvents;//flag indicating if the data should be bufferred
+ Bool_t fBlend;// flag indicating if randomly change positions of the particles after reading
virtual Int_t ReadNext() = 0; //this methods reads next event and put result in fTracksEvent and/or fParticlesEvent
Bool_t Pass(AliHBTParticle*);
Bool_t Pass(Int_t pid);
-
+ void Blend();
+
TString& GetDirName(Int_t);
private:
public:
- ClassDef(AliHBTReader,2)//version 2 - TNamed as parental class
-
+ ClassDef(AliHBTReader,3)//version 2 - TNamed as parental class
+ //version 3 - Blending added
};
#endif