#include "AliHBTPositionRandomizer.h"
+//___________________________________________________
+////////////////////////////////////////////////////////////////////////////////
+//
+// class AliHBTPositionRandomizer
+//
+// These class randomizes particle vertex positions
+// Piotr.Skowronski@cern.ch
+//
+////////////////////////////////////////////////////////////////////////////////
+
#include <TRandom.h>
#include "AliHBTRun.h"
#include "AliHBTEvent.h"
}
/*********************************************************************/
+AliHBTPositionRandomizer::AliHBTPositionRandomizer(const AliHBTPositionRandomizer& in):
+ AliHBTReader(in),
+ fReader(),
+ fRandomizer(0x0),
+ fModel(0),
+ fAddToExistingPos(kFALSE),
+ fOnlyParticlesFromVertex(kFALSE),
+ fVX(0.0),
+ fVY(0.0),
+ fVZ(0.0)
+{
+ //cpy constructor
+ in.Copy(*this);
+}
+/*********************************************************************/
+AliHBTPositionRandomizer::~AliHBTPositionRandomizer()
+{
+ //dtor
+ delete fReader;
+ delete fRandomizer;
+}
+/*********************************************************************/
+AliHBTPositionRandomizer& AliHBTPositionRandomizer::operator=(const AliHBTPositionRandomizer& in)
+{
+ //assigment operator
+ in.Copy(*this);
+ return *this;
+}
+/*********************************************************************/
+
+AliHBTEvent* AliHBTPositionRandomizer::GetParticleEvent()
+{
+ // gets from fReader and randomizes current particle event
+ if (fReader == 0x0) return 0x0;
+ AliHBTEvent *e = fReader->GetParticleEvent();
+ if (e->IsRandomized() == kFALSE) Randomize(e);
+ return e;
+}
+/*********************************************************************/
+
+AliHBTEvent* AliHBTPositionRandomizer::GetTrackEvent()
+{
+ // gets from fReader and randomizes current track event
+ if (fReader == 0x0) return 0x0;
+ AliHBTEvent *e = fReader->GetTrackEvent();
+ if (e->IsRandomized() == kFALSE) Randomize(e);
+ return e;
+}
+/*********************************************************************/
+
Int_t AliHBTPositionRandomizer::Read(AliHBTRun* particles, AliHBTRun *tracks)
{
+ //Reads all available events and randomizes them
if (fReader == 0x0) return 1;
Info("Randomize(AliHBTRun*)","");
Int_t err = fReader->Read(particles,tracks);
/*********************************************************************/
-void AliHBTPositionRandomizer::Randomize(AliHBTRun* run)
+void AliHBTPositionRandomizer::Randomize(AliHBTRun* run) const
{
// randomizes postions of all particles in the run
if (run == 0x0) return;
}
}
/*********************************************************************/
-void AliHBTPositionRandomizer::Randomize(AliHBTEvent* event)
+void AliHBTPositionRandomizer::Randomize(AliHBTEvent* event) const
{
// randomizes postions of all particles in the event
- static const Double_t fmtocm = 1.e-13;
+ static const Double_t kfmtocm = 1.e-13;
Info("Randomize(AliHBTEvent*)","");
if (event == 0x0) return;
AliHBTParticle* p = event->GetParticle(i);
Double_t x,y,z,t=0.0;
fRandomizer->Randomize(x,y,z,p);
- p->SetProductionVertex(x*fmtocm,y*fmtocm,z*fmtocm,t*fmtocm);
+ p->SetProductionVertex(x*kfmtocm,y*kfmtocm,z*kfmtocm,t*kfmtocm);
}
event->SetRandomized();
}
void AliHBTPositionRandomizer::SetGaussianBall(Double_t r)
{
+ //Sets Gaussian Ball Model
SetGaussianBall(r,r,r);
}
/*********************************************************************/
void AliHBTPositionRandomizer::SetGaussianBall(Double_t rx, Double_t ry, Double_t rz)
{
+ //Sets Gaussian Ball Model
delete fRandomizer;
fRandomizer = new AliHBTRndmGaussBall(rx,ry,rz);
}
void AliHBTPositionRandomizer::SetCyllinderSurface(Double_t r, Double_t l)
{
+ //Sets Cylinder Surface Model
delete fRandomizer;
fRandomizer = new AliHBTRndmCyllSurf(r,l);
}
}
/*********************************************************************/
-void AliHBTRndmGaussBall::Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*p)
+void AliHBTRndmGaussBall::Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*/*particle*/) const
{
//randomizez gauss for each coordinate separately
x = gRandom->Gaus(0.0,fRx);
// //
///////////////////////////////////////////////////////////////////////
-void AliHBTRndmCyllSurf::Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*p)
+void AliHBTRndmCyllSurf::Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle* particle) const
{
- Double_t sf = fR/p->Pt();//scaling factor for position transformation ->
+//Randomizes x,y,z
+ Double_t r = fR + gRandom->Gaus(0.0, 1.0);
+ Double_t sf = r/particle->Pt();//scaling factor for position transformation ->
//we move direction of string momentum but legth defined by r
- x = sf*p->Px();
- y = sf*p->Py();
+ x = sf*particle->Px();
+ y = sf*particle->Py();
z = gRandom->Uniform(-fL,fL);
-
}