// Copy constructor
fTrackFilter = obj.fTrackFilter;
}
+//____________________________________________________________________
+AliAnalysisTaskKineFilter::~AliAnalysisTaskKineFilter()
+{
+ // if( fTrackFilter ) delete fTrackFilter;
+}
+
//____________________________________________________________________
AliAnalysisTaskKineFilter& AliAnalysisTaskKineFilter::operator=(const AliAnalysisTaskKineFilter& other)
AliStack* stack = MCEvent()->Stack();
Int_t nTracks = stack->GetNtrack();
Int_t nPrims = stack->GetNprimary();
+ Int_t nPrimsAdd = 0;
AliAODVertex *primary = NULL;
Int_t nPos = 0;
AliAODVertex(x, NULL, -999., NULL, AliAODVertex::kPrimary);
}
- // only final particles
- if( part->GetStatusCode() !=1 ) continue;
//
// Track selection
// add primary tracks
primary->AddDaughter(new(tracks[jTracks++]) AliAODTrack(0, // ID,
- 0, // Label
+ iTrack, // Label
p,
kTRUE,
x,
NULL,
primary,
kFALSE, // no fit performed
- kFALSE, // no fit preformed
+ kFALSE, // no fit preformed
AliAODTrack::kPrimary,
selectInfo));
-
+
AliAODTrack* currTrack = (AliAODTrack*)tracks.Last();
SetChargeAndPID(part->GetPdgCode(), currTrack);
if (currTrack->Charge() != -99) {
nPos++;
} else if (currTrack->Charge() < 0) {
nNeg++;
- }
+ }
}
+ ++nPrimsAdd;
LoopOverSecondaries(part, jTracks, jVertices, nPos, nNeg);
} // end of track loop
if( fDebug > 1 )
AliInfo(Form("primaries: %d secondaries: %d (pos: %d neg: %d), vertices: %d",
- nPrims, tracks.GetEntriesFast()-nPrims, nPos, nNeg, vertices.GetEntriesFast() ) );
+ nPrimsAdd, tracks.GetEntriesFast()-nPrimsAdd, nPos, nNeg, vertices.GetEntriesFast() ) );
return;
}
for (Int_t iDaughter = mother->GetFirstDaughter(); iDaughter <= mother->GetLastDaughter(); iDaughter++) {
TParticle *part = stack->Particle(iDaughter);
// only final particles
- if( part->GetStatusCode() !=1 ) continue;
p[0] = part->Px();
p[1] = part->Py();
// add secondary vertex
secondary = new(vertices[jVertices++])
AliAODVertex(x, NULL, -999., tracks.Last(), AliAODVertex::kUndef);
-
SetVertexType(part, secondary);
}
-
- UInt_t selectInfo = 0;
+
+ UInt_t selectInfo = 0;
//
// Track selection
if (fTrackFilter) {
// add secondary tracks
secondary->AddDaughter(new(tracks[jTracks++]) AliAODTrack(0, // ID
- 0, // label
+ iDaughter, // label
p,
kTRUE,
x,
nPos++;
} else if (currTrack->Charge() < 0) {
nNeg++;
- }
+ }
}
LoopOverSecondaries(part, jTracks, jVertices, nPos, nNeg);
AliAnalysisTaskKineFilter();
AliAnalysisTaskKineFilter( const char* name );
AliAnalysisTaskKineFilter(const AliAnalysisTaskKineFilter& obj);
- virtual ~AliAnalysisTaskKineFilter() {;}
+ virtual ~AliAnalysisTaskKineFilter();
AliAnalysisTaskKineFilter& operator=(const AliAnalysisTaskKineFilter& other);
// Implementation of interface methods
virtual void Exec( Option_t *option );
// Setters
- virtual void SetTrackFilter(AliAnalysisFilter* trackF) {fTrackFilter = trackF;}
+ virtual void SetTrackFilter(AliAnalysisFilter* trackF) { fTrackFilter = trackF; }
private:
Int_t LoopOverSecondaries(TParticle *mother, Int_t& jTracks, Int_t& jVertices, Int_t& nPos, Int_t& nNeg );
void SetChargeAndPID(Int_t pdgCode, AliAODTrack *track);
void SetVertexType(TParticle *part, AliAODVertex *vertex);
- AliAnalysisFilter* fTrackFilter; // Track Filter
+ AliAnalysisFilter* fTrackFilter; // Track Filter
ClassDef( AliAnalysisTaskKineFilter, 1 ); // Analysis task for Kinematic filtering
};
//____________________________________________________________________
AliKineTrackCuts::AliKineTrackCuts(const Char_t* name, const Char_t* title) :
AliAnalysisCuts(name,title),
+ fOnlyFinalParticles(kFALSE),
+ fOnlyPrimary(kFALSE),
fPMin(0),
fPMax(0),
fPtMin(0),
TParticle * part = (TParticle *)obj;
+ // only final particles
+ if( fOnlyFinalParticles && part->GetStatusCode() !=1 ) return kFALSE;
+ if( fOnlyPrimary && part->IsPrimary() !=1 ) return kFALSE;
+
// getting the kinematic variables of the track
Float_t momentum = part->P();
Float_t pt = part->Pt();
virtual ~AliKineTrackCuts(){;}
Bool_t IsSelected(TObject* obj);
- Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
+ void SetFinalParticles( Bool_t val=kTRUE ) { fOnlyFinalParticles = val; }
+ void SetPrimaryParticles( Bool_t val=kTRUE ) { fOnlyPrimary = val; }
// track kinematic cut setters
- void SetPRange(Float_t r1=0, Float_t r2=1e10) {fPMin=r1; fPMax=r2;}
- void SetPtRange(Float_t r1=0, Float_t r2=1e10) {fPtMin=r1; fPtMax=r2;}
- void SetPxRange(Float_t r1=-1e10, Float_t r2=1e10) {fPxMin=r1; fPxMax=r2;}
- void SetPyRange(Float_t r1=-1e10, Float_t r2=1e10) {fPyMin=r1; fPyMax=r2;}
- void SetPzRange(Float_t r1=-1e10, Float_t r2=1e10) {fPzMin=r1; fPzMax=r2;}
- void SetEtaRange(Float_t r1=-1e10, Float_t r2=1e10) {fEtaMin=r1; fEtaMax=r2;}
- void SetRapRange(Float_t r1=-1e10, Float_t r2=1e10) {fRapMin=r1; fRapMax=r2;}
+ void SetPRange(Float_t r1=0, Float_t r2=1e10) { fPMin=r1; fPMax=r2;}
+ void SetPtRange(Float_t r1=0, Float_t r2=1e10) { fPtMin=r1; fPtMax=r2;}
+ void SetPxRange(Float_t r1=-1e10, Float_t r2=1e10) { fPxMin=r1; fPxMax=r2;}
+ void SetPyRange(Float_t r1=-1e10, Float_t r2=1e10) { fPyMin=r1; fPyMax=r2;}
+ void SetPzRange(Float_t r1=-1e10, Float_t r2=1e10) { fPzMin=r1; fPzMax=r2;}
+ void SetEtaRange(Float_t r1=-1e10, Float_t r2=1e10) { fEtaMin=r1; fEtaMax=r2;}
+ void SetRapRange(Float_t r1=-1e10, Float_t r2=1e10) { fRapMin=r1; fRapMax=r2;}
protected:
+ Bool_t fOnlyFinalParticles; // true => skip part with GetStatusCode()!=1
+ Bool_t fOnlyPrimary; // Only Primary Particles
// kinematics cuts
- Float_t fPMin, fPMax; // definition of the range of the P
- Float_t fPtMin, fPtMax; // definition of the range of the Pt
- Float_t fPxMin, fPxMax; // definition of the range of the Px
- Float_t fPyMin, fPyMax; // definition of the range of the Py
- Float_t fPzMin, fPzMax; // definition of the range of the Pz
- Float_t fEtaMin, fEtaMax; // definition of the range of the eta
- Float_t fRapMin, fRapMax; // definition of the range of the y
+ Float_t fPMin, fPMax; // definition of the range of the P
+ Float_t fPtMin, fPtMax; // definition of the range of the Pt
+ Float_t fPxMin, fPxMax; // definition of the range of the Px
+ Float_t fPyMin, fPyMax; // definition of the range of the Py
+ Float_t fPzMin, fPzMax; // definition of the range of the Pz
+ Float_t fEtaMin, fEtaMax; // definition of the range of the eta
+ Float_t fRapMin, fRapMax; // definition of the range of the y
ClassDef(AliKineTrackCuts, 1)