////////////////////////////////////////////////////////////////////////////////
#include <TRandom.h>
-#include "AliHBTRun.h"
-#include "AliHBTEvent.h"
-#include "AliHBTParticle.h"
+#include "AliAOD.h"
+#include "AliVAODParticle.h"
ClassImp(AliHBTPositionRandomizer)
fModel(0),
fAddToExistingPos(kFALSE),
fOnlyParticlesFromVertex(kFALSE),
+ fRandomizeTracks(kFALSE),
fVX(0.0),
fVY(0.0),
fVZ(0.0)
}
/*********************************************************************/
-AliHBTPositionRandomizer::AliHBTPositionRandomizer(AliHBTReader* reader):
+AliHBTPositionRandomizer::AliHBTPositionRandomizer(AliReader* reader):
fReader(reader),
fRandomizer(new AliHBTRndmGaussBall(8.0)),
fModel(0),
fAddToExistingPos(kFALSE),
fOnlyParticlesFromVertex(kFALSE),
+ fRandomizeTracks(kFALSE),
fVX(0.0),
fVY(0.0),
fVZ(0.0)
/*********************************************************************/
AliHBTPositionRandomizer::AliHBTPositionRandomizer(const AliHBTPositionRandomizer& in):
- AliHBTReader(in),
+ AliReader(in),
fReader(),
fRandomizer(0x0),
fModel(0),
fAddToExistingPos(kFALSE),
fOnlyParticlesFromVertex(kFALSE),
+ fRandomizeTracks(kFALSE),
fVX(0.0),
fVY(0.0),
fVZ(0.0)
}
/*********************************************************************/
-AliHBTEvent* AliHBTPositionRandomizer::GetParticleEvent()
+AliAOD* AliHBTPositionRandomizer::GetEventSim() const
{
// gets from fReader and randomizes current particle event
- if (fReader == 0x0) return 0x0;
- AliHBTEvent *e = fReader->GetParticleEvent();
- if (e->IsRandomized() == kFALSE) Randomize(e);
+ if (fReader == 0x0)
+ {
+ Error("GetEventSim","Reader is null");
+ return 0x0;
+ }
+ AliAOD *e = fReader->GetEventSim();
+ if (e)
+ if (e->IsRandomized() == kFALSE)
+ Randomize(e);
return e;
}
/*********************************************************************/
-AliHBTEvent* AliHBTPositionRandomizer::GetTrackEvent()
+AliAOD* AliHBTPositionRandomizer::GetEventRec() const
{
// gets from fReader and randomizes current track event
- if (fReader == 0x0) return 0x0;
- AliHBTEvent *e = fReader->GetTrackEvent();
- if (e->IsRandomized() == kFALSE) Randomize(e);
+ if (fReader == 0x0)
+ {
+ Error("GetEventRec","Reader is null");
+ return 0x0;
+ }
+ AliAOD *e = fReader->GetEventRec();
+ if (fRandomizeTracks && e) 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;
- if (AliHBTParticle::GetDebug() > 5) Info("Randomize(AliHBTRun*)","");
- Int_t err = fReader->Read(particles,tracks);
- if (err) return err;
- Randomize(particles);
- return 0;
-}
-/*********************************************************************/
-
-AliHBTEvent* AliHBTPositionRandomizer::GetParticleEvent(Int_t n)
+AliAOD* AliHBTPositionRandomizer::GetEventSim(Int_t n)
{
//returns event n
if (fReader == 0x0) return 0x0;
- AliHBTEvent *e = fReader->GetParticleEvent(n);
+ AliAOD *e = fReader->GetEventSim(n);
if (e->IsRandomized() == kFALSE) Randomize(e);
return e;
}
/*********************************************************************/
-
-void AliHBTPositionRandomizer::Randomize(AliHBTRun* run) const
-{
-// randomizes postions of all particles in the run
- if (run == 0x0) return;
- if (AliHBTParticle::GetDebug() > 5) Info("Randomize(AliHBTRun*)","");
- for (Int_t i = 0; i < run->GetNumberOfEvents(); i++)
- {
- Randomize(run->GetEvent(i));
- }
-}
-/*********************************************************************/
-void AliHBTPositionRandomizer::Randomize(AliHBTEvent* event) const
+void AliHBTPositionRandomizer::Randomize(AliAOD* event) const
{
// randomizes postions of all particles in the event
static const Double_t kfmtocm = 1.e-13;
- if (AliHBTParticle::GetDebug() > 5) Info("Randomize(AliHBTEvent*)","");
+ if (AliVAODParticle::GetDebug() > 5) Info("Randomize(AliAOD*)","");
if (event == 0x0) return;
for (Int_t i = 0; i < event->GetNumberOfParticles(); i++)
{
- AliHBTParticle* p = event->GetParticle(i);
+ AliVAODParticle* p = event->GetParticle(i);
Double_t x,y,z,t=0.0;
fRandomizer->Randomize(x,y,z,p);
- p->SetProductionVertex(x*kfmtocm,y*kfmtocm,z*kfmtocm,t*kfmtocm);
+
+ Double_t nx = x*kfmtocm;
+ Double_t ny = y*kfmtocm;
+ Double_t nz = z*kfmtocm;
+ Double_t nt = t*kfmtocm;
+
+ if (fAddToExistingPos)
+ {
+ nx += p->Vx();
+ ny += p->Vy();
+ nz += p->Vz();
+ nt += p->T();
+ }
+ p->SetProductionVertex(nx,ny,nz,nt);
}
event->SetRandomized();
}
}
/*********************************************************************/
-void AliHBTRndmGaussBall::Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*/*particle*/) const
+void AliHBTRndmGaussBall::Randomize(Double_t& x,Double_t& y,Double_t&z, AliVAODParticle*/*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* particle) const
+void AliHBTRndmCyllSurf::Randomize(Double_t& x,Double_t& y,Double_t&z, AliVAODParticle* particle) const
{
//Randomizes x,y,z
Double_t r = fR + gRandom->Gaus(0.0, 1.0);