#include "TBrowser.h"
#include "AliFlowVector.h"
#include "AliFlowTrackSimple.h"
-#include "AliFlowEventSimple.h"
#include "AliFlowTrackSimpleCuts.h"
+#include "AliFlowEventSimple.h"
#include "TRandom.h"
ClassImp(AliFlowEventSimple)
AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& anEvent)
{
//assignment operator
+ if (fTrackCollection) fTrackCollection->Delete();
delete fTrackCollection;
fTrackCollection = (TObjArray*)(anEvent.fTrackCollection)->Clone(); //deep copy
fReferenceMultiplicity = anEvent.fReferenceMultiplicity;
//according to the specified pt distribution
for (Int_t i=0; i<nParticles; i++)
{
- AddTrack(new AliFlowTrackSimple( gRandom->Uniform(phiMin,phiMax),
- gRandom->Uniform(etaMin,etaMax),
- ptDist->GetRandom(),1.));
+ AliFlowTrackSimple* track = new AliFlowTrackSimple();
+ track->SetPhi( gRandom->Uniform(phiMin,phiMax) );
+ track->SetEta( gRandom->Uniform(etaMin,etaMax) );
+ track->SetPt( ptDist->GetRandom() );
+ track->SetCharge( (gRandom->Uniform()-0.5<0)?-1:1 );
+ AddTrack(track);
}
}
dPhi = pTrack->Phi();
dPt = pTrack->Pt();
dEta = pTrack->Eta();
- dWeight = pTrack->Weight();
+ dWeight = pTrack->Weight();
// determine Phi weight: (to be improved, I should here only access it + the treatment of gaps in the if statement)
if(phiWeights && nBinsPhi)
{
AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
if (!track) continue;
- if (cuts->PassesCuts(track))
- {
- track->SetForRPSelection();
+ Bool_t pass=cuts->PassesCuts(track);
+ track->SetForRPSelection(pass);
+ if (pass)
fNumberOfRPs++;
- }
+ else
+ fNumberOfRPs--;
}
}
{
AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
if (!track) continue;
- if (cuts->PassesCuts(track)) track->SetForPOISelection();
+ Bool_t pass=cuts->PassesCuts(track);
+ track->SetForPOISelection(pass);
}
}
#include "TObject.h"
#include "TParticle.h"
+#include "TParticlePDG.h"
#include "AliFlowTrackSimple.h"
#include "TRandom.h"
+#include "TMath.h"
ClassImp(AliFlowTrackSimple)
fPt(0),
fPhi(0),
fTrackWeight(1.),
+ fCharge(0),
fFlowBits(0),
fSubEventBits(0)
{
}
//-----------------------------------------------------------------------
-AliFlowTrackSimple::AliFlowTrackSimple(Double_t phi, Double_t eta, Double_t pt, Double_t weight):
+AliFlowTrackSimple::AliFlowTrackSimple(Double_t phi, Double_t eta, Double_t pt, Double_t weight, Int_t charge):
TObject(),
fEta(eta),
fPt(pt),
fPhi(phi),
fTrackWeight(weight),
+ fCharge(charge),
fFlowBits(0),
fSubEventBits(0)
{
}
//-----------------------------------------------------------------------
-AliFlowTrackSimple::AliFlowTrackSimple(const TParticle* p):
+AliFlowTrackSimple::AliFlowTrackSimple( TParticle* p ):
TObject(),
fEta(p->Eta()),
fPt(p->Pt()),
fPhi(p->Phi()),
fTrackWeight(1.),
+ fCharge(0),
fFlowBits(0),
fSubEventBits(0)
{
//ctor
+ TParticlePDG* ppdg = p->GetPDG();
+ fCharge = TMath::Nint(ppdg->Charge()/3.0);
}
//-----------------------------------------------------------------------
fPt(aTrack.fPt),
fPhi(aTrack.fPhi),
fTrackWeight(aTrack.fTrackWeight),
+ fCharge(aTrack.fCharge),
fFlowBits(aTrack.fFlowBits),
fSubEventBits(aTrack.fSubEventBits)
{
fPt = aTrack.fPt;
fPhi = aTrack.fPhi;
fTrackWeight = aTrack.fTrackWeight;
+ fCharge = aTrack.fCharge;
fFlowBits = aTrack.fFlowBits;
fSubEventBits = aTrack.fSubEventBits;
public:
AliFlowTrackSimple();
- AliFlowTrackSimple(const TParticle* p);
+ AliFlowTrackSimple(TParticle* p);
AliFlowTrackSimple(const AliFlowTrackSimple& aTrack);
- AliFlowTrackSimple(Double_t phi, Double_t eta, Double_t pt, Double_t weight);
virtual AliFlowTrackSimple& operator=(const AliFlowTrackSimple& aTrack);
virtual ~AliFlowTrackSimple();
virtual AliFlowTrackSimple* Clone(const char* option="") const;
Double_t Pt() const;
Double_t Phi() const;
Double_t Weight() const;
+ Int_t Charge() const;
+
Bool_t InRPSelection() const;
Bool_t InPOISelection() const;
void SetPt(Double_t pt);
void SetPhi(Double_t phi);
void SetWeight(Double_t weight);
+ void SetCharge(Int_t charge);
void SetForRPSelection(Bool_t b=kTRUE);
void SetForPOISelection(Bool_t b=kTRUE);
void SetForSubevent(Int_t i);
const TBits* GetFlowBits() const {return &fFlowBits;}
private:
+ AliFlowTrackSimple(Double_t phi, Double_t eta, Double_t pt, Double_t weight, Int_t charge);
Double_t fEta; // eta
Double_t fPt; // pt
Double_t fPhi; // phi
Double_t fTrackWeight; // weight
+ Int_t fCharge; //charge
TBits fFlowBits; // bits to set if track is selected
TBits fSubEventBits;// bits to set if track is selected for a subevent
};
-//Setters
+//Getters
inline Double_t AliFlowTrackSimple::Eta() const {
return this->fEta; }
inline Double_t AliFlowTrackSimple::Pt() const {
return this->fPhi; }
inline Double_t AliFlowTrackSimple::Weight() const {
return this->fTrackWeight; }
+inline Int_t AliFlowTrackSimple::Charge() const {
+ return this->fCharge; }
//TBits
inline Bool_t AliFlowTrackSimple::InRPSelection() const {
return this->fFlowBits.TestBitNumber(0); }
inline Bool_t AliFlowTrackSimple::InSubevent(Int_t i) const {
return this->fSubEventBits.TestBitNumber(i); }
-//Getters
+//Setters
inline void AliFlowTrackSimple::SetEta(Double_t val) {
fEta = val; }
inline void AliFlowTrackSimple::SetPt(Double_t val) {
fPhi = val; }
inline void AliFlowTrackSimple::SetWeight(Double_t val) {
fTrackWeight = val; }
+inline void AliFlowTrackSimple::SetCharge(Int_t val) {
+ fCharge = val; }
//TBits
inline void AliFlowTrackSimple::SetForRPSelection(Bool_t val) {
fFlowBits.SetBitNumber(0,val); }
#include "TNamed.h"
#include "TParticle.h"
+#include "TParticlePDG.h"
#include "AliFlowTrackSimpleCuts.h"
#include "AliFlowTrackSimple.h"
fEtaMin(0.),
fPhiMax(0.),
fPhiMin(0.),
- fPID(0)
+ fPID(0),
+ fCharge(fgkIgnoreCharge)
{
//constructor
fEtaMin(someCuts.fEtaMin),
fPhiMax(someCuts.fPhiMax),
fPhiMin(someCuts.fPhiMin),
- fPID(someCuts.fPID)
+ fPID(someCuts.fPID),
+ fCharge(someCuts.fCharge)
{
//copy constructor
}
fPhiMax = someCuts.fPhiMax;
fPhiMin = someCuts.fPhiMin;
fPID = someCuts.fPID;
+ fCharge = someCuts.fCharge;
return *this;
//simple method to check if the simple track passes the simple cuts
if(track->Pt() >= fPtMin && track->Pt() < fPtMax &&
track->Eta() >= fEtaMin && track->Eta() < fEtaMax &&
- track->Phi() >= fPhiMin && track->Phi() < fPhiMax)
+ track->Phi() >= fPhiMin && track->Phi() < fPhiMax &&
+ (track->Charge()==fCharge || fCharge==fgkIgnoreCharge))
{ return kTRUE; }
else
{ return kFALSE; }
}
//-----------------------------------------------------------------------
-Bool_t AliFlowTrackSimpleCuts::PassesCuts(const TParticle* track) const
+Bool_t AliFlowTrackSimpleCuts::PassesCuts(TParticle* track) const
{
//simple method to check if the simple track passes the simple cuts
- if(track->Pt() >= fPtMin && track->Pt() < fPtMax &&
- track->Eta() >= fEtaMin && track->Eta() < fEtaMax &&
- track->Phi() >= fPhiMin && track->Phi() < fPhiMax)
- return kTRUE;
- else
- return kFALSE;
+ Bool_t result = (track->Pt() >= fPtMin && track->Pt() < fPtMax &&
+ track->Eta() >= fEtaMin && track->Eta() < fEtaMax &&
+ track->Phi() >= fPhiMin && track->Phi() < fPhiMax);
+
+ //getting the charge from a tparticle is expensive
+ //only do it if neccesary
+ if (fCharge!=fgkIgnoreCharge)
+ {
+ TParticlePDG* ppdg = track->GetPDG();
+ Int_t charge = TMath::Nint(ppdg->Charge()/3.0);
+ result = (charge==fCharge) && result;
+ }
+ return result;
}
void SetPhiMax(Double_t max) {this->fPhiMax = max; }
void SetPhiMin(Double_t min) {this->fPhiMin = min; }
void SetPID(Int_t pid) {this->fPID = pid; }
+ void SetCharge(Int_t c) {this->fCharge = c; }
//getters
Double_t GetPtMax() const {return this->fPtMax; }
Double_t GetPhiMax() const {return this->fPhiMax; }
Double_t GetPhiMin() const {return this->fPhiMin; }
Int_t GetPID() const {return this->fPID; }
+ Int_t GetCharge() const {return this->fCharge; }
//simple method to check if the simple track passes the simple cuts:
Bool_t PassesCuts(const AliFlowTrackSimple *track) const;
- Bool_t PassesCuts(const TParticle* p) const;
+ Bool_t PassesCuts(TParticle* p) const;
private:
Double_t fPtMax;
Double_t fPhiMax;
Double_t fPhiMin;
Int_t fPID;
+ Int_t fCharge;
+
+ static const Int_t fgkIgnoreCharge=999;
ClassDef(AliFlowTrackSimpleCuts,1)
};
if (!(rpOK || poiOK)) continue;
//make new AliFlowTrack
- AliFlowTrack* pTrack = new AliFlowTrack();
+ AliFlowTrack* pTrack = NULL;
if(anOption == kESDkine) //take the PID from the MC & the kinematics from the ESD
{
- pTrack->SetPt(pParticle->Pt() );
- pTrack->SetEta(pParticle->Eta() );
- pTrack->SetPhi(pParticle->Phi() );
+ pTrack = new AliFlowTrack(pParticle);
}
else if (anOption == kMCkine) //take the PID and kinematics from the MC
{
- pTrack->SetPt(pMcParticle->Pt() );
- pTrack->SetEta(pMcParticle->Eta() );
- pTrack->SetPhi(pMcParticle->Phi() );
+ pTrack = new AliFlowTrack(pMcParticle);
}
if (rpOK && rpCFManager)
if (!poiOK) continue;
//make new AliFLowTrack
- AliFlowTrack* pTrack = new AliFlowTrack();
- pTrack->SetPt(pParticle->Pt() );
- pTrack->SetEta(pParticle->Eta() );
- pTrack->SetPhi(pParticle->Phi() );
+ AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
//marking the particles used for the particle of interest (POI) selection:
if(poiOK && poiCFManager)
if (!poiOK) continue;
//make new AliFLowTrack
- AliFlowTrack* pTrack = new AliFlowTrack();
- pTrack->SetPt(pParticle->Pt() );
- pTrack->SetEta(pParticle->Eta() );
- pTrack->SetPhi(pParticle->Phi() );
+ AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
//marking the particles used for the particle of interest (POI) selection:
if(poiOK && poiCFManager)
#include "AliVParticle.h"
#include "AliFlowTrack.h"
+#include "AliFlowTrackSimple.h"
ClassImp(AliFlowTrack)
//-----------------------------------------------------------------------
AliFlowTrack::AliFlowTrack(AliVParticle* p):
- AliFlowTrackSimple(p->Phi(),p->Eta(),p->Pt(),1.),
+ AliFlowTrackSimple(),
fTrackSourceBits()
{
//constructor
+ SetPhi(p->Phi());
+ SetEta(p->Eta());
+ SetPt(p->Pt());
+ SetCharge(p->Charge());
}
//-----------------------------------------------------------------------