#include <TGeoGlobalMagField.h>
#include "AliV0ReaderV1.h"
#include "AliKFParticle.h"
#include "AliAODv0.h"
#include "AliESDv0.h"
#include "AliAODEvent.h"
#include "AliESDEvent.h"
#include "AliPID.h"
#include "AliMCEvent.h"
#include "AliStack.h"
#include "AliMCEventHandler.h"
#include "AliESDpid.h"
#include "AliESDtrackCuts.h"
#include "TRandom3.h"
#include "AliGenCocktailEventHeader.h"
#include "TList.h"
#include "AliKFConversionPhoton.h"
#include "AliAODConversionPhoton.h"
#include "AliConversionPhotonBase.h"
#include "TVector.h"
#include "AliKFVertex.h"
#include "AliAODTrack.h"
#include "AliESDtrack.h"
#include "AliAnalysisManager.h"
#include "AliInputEventHandler.h"
#include "AliAODHandler.h"
#include "AliPIDResponse.h"
#include "TChain.h"
#include "TFile.h"
#include "TString.h"
#include "TObjArray.h"
class iostream;
using namespace std;
ClassImp(AliV0ReaderV1)
AliV0ReaderV1::AliV0ReaderV1(const char *name) : AliAnalysisTaskSE(name),
fConversionCuts(NULL),
fEventCuts(NULL),
fConversionGammas(NULL),
fUseImprovedVertex(kTRUE),
fUseOwnXYZCalculation(kTRUE),
fUseConstructGamma(kFALSE),
kUseAODConversionPhoton(kTRUE),
fCreateAOD(kFALSE),
fDeltaAODBranchName("GammaConv"),
fDeltaAODFilename("AliAODGammaConversion.root"),
fRelabelAODs(kFALSE),
fEventIsSelected(kFALSE),
fNumberOfPrimaryTracks(0),
fPeriodName("")
{
DefineInput(0, TChain::Class());
}
AliV0ReaderV1::~AliV0ReaderV1()
{
if(fConversionGammas){
fConversionGammas->Delete();
delete fConversionGammas;
fConversionGammas=0x0;
}
}
void AliV0ReaderV1::Init()
{
if(fConversionCuts==NULL){
if(fConversionCuts==NULL)AliError("No Conversion Cut Selection initialized");
}
if(fEventCuts==NULL){
if(fEventCuts==NULL)AliError("No Event Cut Selection initialized");
}
if(fCreateAOD){kUseAODConversionPhoton=kTRUE;}
if(fConversionGammas != NULL){
delete fConversionGammas;
fConversionGammas=NULL;
}
if(fConversionGammas == NULL){
if(kUseAODConversionPhoton){
fConversionGammas = new TClonesArray("AliAODConversionPhoton",100);}
else{
fConversionGammas = new TClonesArray("AliKFConversionPhoton",100);}
}
fConversionGammas->Delete();
}
void AliV0ReaderV1::UserCreateOutputObjects()
{
if(fCreateAOD){
if (fEventCuts){
fDeltaAODBranchName.Append("_");
fDeltaAODBranchName.Append(fEventCuts->GetCutNumber());
}
if(fConversionCuts){
fDeltaAODBranchName.Append("_");
fDeltaAODBranchName.Append(fConversionCuts->GetCutNumber());
fDeltaAODBranchName.Append("_gamma");
}
fConversionGammas->SetName(fDeltaAODBranchName.Data());
AddAODBranch("TClonesArray", &fConversionGammas, fDeltaAODFilename.Data());
AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(fDeltaAODFilename.Data());
}
}
Bool_t AliV0ReaderV1::Notify()
{
if (fPeriodName.CompareTo("") == 0){
AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
if(man) {
AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
if (inputHandler){
TTree* tree = (TTree*) inputHandler->GetTree();
TFile* file = (TFile*) tree->GetCurrentFile();
TString fileName(file->GetName());
TObjArray *arr = fileName.Tokenize("/");
for (Int_t i = 0; i < arr->GetEntriesFast();i++ ){
TObjString* testObjString = (TObjString*)arr->At(i);
if (testObjString->GetString().Contains("LHC")){
fPeriodName = testObjString->GetString();
i = arr->GetEntriesFast();
}
}
}
}
if(!fEventCuts->GetDoEtaShift()) return kTRUE;
if(fEventCuts->GetEtaShift() == 0.0){
fEventCuts->GetCorrectEtaShiftFromPeriod(fPeriodName);
fEventCuts->DoEtaShift(kFALSE);
return kTRUE;
} else {
printf(" Gamma Conversion Reader %s_%s :: Eta Shift Manually Set to %f \n\n",
(fEventCuts->GetCutNumber()).Data(),(fConversionCuts->GetCutNumber()).Data(),fEventCuts->GetEtaShift());
fEventCuts->DoEtaShift(kFALSE);
}
}
return kTRUE;
}
void AliV0ReaderV1::UserExec(Option_t *option){
AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(fInputEvent);
if(esdEvent) {
if (!TGeoGlobalMagField::Instance()->GetField()) esdEvent->InitMagneticField();
}
if(!fConversionGammas)Init();
fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
FillAODOutput();
}
Bool_t AliV0ReaderV1::ProcessEvent(AliVEvent *inputEvent,AliMCEvent *mcEvent)
{
fConversionGammas->Delete();
fInputEvent=inputEvent;
fMCEvent=mcEvent;
if(!fInputEvent){
AliError("No Input event");
return kFALSE;
}
if(!fEventCuts){AliError("No EventCuts");return kFALSE;}
if(!fConversionCuts){AliError("No ConversionCuts");return kFALSE;}
CountTracks();
if(!fEventCuts->EventIsSelected(fInputEvent,fMCEvent))return kFALSE;
AliKFParticle::SetField(fInputEvent->GetMagneticField());
if(fInputEvent->IsA()==AliESDEvent::Class()){
ProcessESDV0s();
}
if(fInputEvent->IsA()==AliAODEvent::Class()){
GetAODConversionGammas();
}
return kTRUE;
}
void AliV0ReaderV1::FillAODOutput()
{
if(fInputEvent->IsA()==AliESDEvent::Class()){
if(fCreateAOD) {
AliAODHandler * aodhandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
if (aodhandler && aodhandler->GetFillAOD()) {
AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
}
}
}
}
const AliExternalTrackParam *AliV0ReaderV1::GetExternalTrackParam(AliESDv0 *fCurrentV0,Int_t &tracklabel,Int_t charge){
if(!(charge==1||charge==-1)){AliError("Charge not defined");return 0x0;}
if(fCurrentV0){
if(!fCurrentV0->GetParamN()||!fCurrentV0->GetParamP())return 0x0;
if(!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex())||!fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))return 0x0;
if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetPindex()))->Charge()==charge){
tracklabel=fCurrentV0->GetPindex();
return fCurrentV0->GetParamP();}
if((fConversionCuts->GetTrack(fInputEvent,fCurrentV0->GetNindex()))->Charge()==charge){
tracklabel=fCurrentV0->GetNindex();
return fCurrentV0->GetParamN();}
}
return 0x0;
}
Bool_t AliV0ReaderV1::ProcessESDV0s()
{
AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent);
AliKFConversionPhoton *fCurrentMotherKFCandidate=NULL;
if(fESDEvent){
for(Int_t currentV0Index=0;currentV0Index<fESDEvent->GetNumberOfV0s();currentV0Index++){
AliESDv0 *fCurrentV0=(AliESDv0*)(fESDEvent->GetV0(currentV0Index));
if(!fCurrentV0){
printf("Requested V0 does not exist");
continue;
}
fCurrentMotherKFCandidate=ReconstructV0(fCurrentV0,currentV0Index);
if(fCurrentMotherKFCandidate){
if(kUseAODConversionPhoton){
new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(fCurrentMotherKFCandidate);
AliAODConversionPhoton * currentConversionPhoton = (AliAODConversionPhoton*)(fConversionGammas->At(fConversionGammas->GetEntriesFast()-1));
currentConversionPhoton->SetMass(fCurrentMotherKFCandidate->M());
currentConversionPhoton->SetMassToZero();
}
else{
new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliKFConversionPhoton(*fCurrentMotherKFCandidate);
}
delete fCurrentMotherKFCandidate;
fCurrentMotherKFCandidate=NULL;
}
}
}
return kTRUE;
}
AliKFConversionPhoton *AliV0ReaderV1::ReconstructV0(AliESDv0 *fCurrentV0,Int_t currentV0Index)
{
fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kPhotonIn);
if(!fConversionCuts->SelectV0Finder(fCurrentV0->GetOnFlyStatus())){
fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kOnFly);
return 0x0;
}
Int_t currentTrackLabels[2]={-1,-1};
const AliExternalTrackParam *fCurrentExternalTrackParamPositive=GetExternalTrackParamP(fCurrentV0,currentTrackLabels[0]);
const AliExternalTrackParam *fCurrentExternalTrackParamNegative=GetExternalTrackParamN(fCurrentV0,currentTrackLabels[1]);
if(!fCurrentExternalTrackParamPositive||!fCurrentExternalTrackParamNegative)return 0x0;
AliVTrack * posTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[0]);
AliVTrack * negTrack = fConversionCuts->GetTrack(fInputEvent,currentTrackLabels[1]);
if(!negTrack || !posTrack) {
fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kNoTracks);
return 0x0;
}
if(!fConversionCuts->TracksAreSelected(negTrack, posTrack)){
fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kTrackCuts);
return 0x0;
}
fConversionCuts->FillV0EtaBeforedEdxCuts(fCurrentV0->Eta());
if (!fConversionCuts->dEdxCuts(posTrack)) {
fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kdEdxCuts);
return 0x0;
}
if(!fConversionCuts->dEdxCuts(negTrack)) {
fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kdEdxCuts);
return 0x0;
}
fConversionCuts->FillV0EtaAfterdEdxCuts(fCurrentV0->Eta());
AliKFConversionPhoton *fCurrentMotherKF=NULL;
AliKFParticle fCurrentNegativeKFParticle(*(fCurrentExternalTrackParamNegative),11);
AliKFParticle fCurrentPositiveKFParticle(*(fCurrentExternalTrackParamPositive),-11);
if(fUseConstructGamma){
fCurrentMotherKF = new AliKFConversionPhoton();
fCurrentMotherKF->ConstructGamma(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
}else{
fCurrentMotherKF = new AliKFConversionPhoton(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
fCurrentMotherKF->SetMassConstraint(0,0.0001);
}
fCurrentMotherKF->SetTrackLabels(currentTrackLabels[0],currentTrackLabels[1]);
fCurrentMotherKF->SetV0Index(currentV0Index);
if(fMCEvent){
AliStack *fMCStack= fMCEvent->Stack();
Int_t labelp=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelPositive())->GetLabel());
Int_t labeln=TMath::Abs(fConversionCuts->GetTrack(fInputEvent,fCurrentMotherKF->GetTrackLabelNegative())->GetLabel());
TParticle *fNegativeMCParticle = fMCStack->Particle(labeln);
TParticle *fPositiveMCParticle = fMCStack->Particle(labelp);
if(fPositiveMCParticle&&fNegativeMCParticle){
fCurrentMotherKF->SetMCLabelPositive(labelp);
fCurrentMotherKF->SetMCLabelNegative(labeln);
}
}
if(fUseImprovedVertex == kTRUE){
AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
primaryVertexImproved+=*fCurrentMotherKF;
fCurrentMotherKF->SetProductionVertex(primaryVertexImproved);
}
Double_t PsiPair=GetPsiPair(fCurrentV0,fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative);
fCurrentMotherKF->SetPsiPair(PsiPair);
Double_t dca[2]={0,0};
if(fUseOwnXYZCalculation){
Double_t convpos[3]={0,0,0};
if(!GetConversionPoint(fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos,dca)){
fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kConvPointFail);
delete fCurrentMotherKF;
fCurrentMotherKF=NULL;
return 0x0;
}
fCurrentMotherKF->SetConversionPoint(convpos);
}
if(fCurrentMotherKF->GetNDF() > 0.)
fCurrentMotherKF->SetChi2perNDF(fCurrentMotherKF->GetChi2()/fCurrentMotherKF->GetNDF());
fCurrentMotherKF->SetMass(fCurrentMotherKF->M());
if(!fConversionCuts->PhotonCuts(fCurrentMotherKF,fInputEvent)){
fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kPhotonCuts);
delete fCurrentMotherKF;
fCurrentMotherKF=NULL;
return 0x0;
}
fConversionCuts->FillPhotonCutIndex(AliConversionPhotonCuts::kPhotonOut);
return fCurrentMotherKF;
}
Double_t AliV0ReaderV1::GetPsiPair(const AliESDv0* v0, const AliExternalTrackParam *positiveparam,const AliExternalTrackParam *negativeparam) const {
AliExternalTrackParam nt(*negativeparam);
AliExternalTrackParam pt(*positiveparam);
Float_t magField = fInputEvent->GetMagneticField();
Double_t xyz[3] = {0.,0.,0.};
v0->GetXYZ(xyz[0],xyz[1],xyz[2]);
Double_t mn[3] = {0,0,0};
Double_t mp[3] = {0,0,0};
v0->GetNPxPyPz(mn[0],mn[1],mn[2]);
v0->GetPPxPyPz(mp[0],mp[1],mp[2]);
Double_t deltat = 1.;
deltat = TMath::ATan(mp[2]/(TMath::Sqrt(mp[0]*mp[0] + mp[1]*mp[1])+1.e-13)) - TMath::ATan(mn[2]/(TMath::Sqrt(mn[0]*mn[0] + mn[1]*mn[1])+1.e-13));
Double_t radiussum = TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]) + 50;
Double_t momPosProp[3] = {0,0,0};
Double_t momNegProp[3] = {0,0,0};
Double_t psiPair = 4.;
if(nt.PropagateTo(radiussum,magField) == 0) return psiPair;
if(pt.PropagateTo(radiussum,magField) == 0) return psiPair;
pt.GetPxPyPz(momPosProp);
nt.GetPxPyPz(momNegProp);
Double_t pEle =
TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);
Double_t pPos =
TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);
Double_t scalarproduct =
momPosProp[0]*momNegProp[0]+momPosProp[1]*momNegProp[1]+momPosProp[2]*momNegProp[2];
Double_t chipair = TMath::ACos(scalarproduct/(pEle*pPos));
psiPair = TMath::ASin(deltat/chipair);
return psiPair;
}
Bool_t AliV0ReaderV1::GetHelixCenter(const AliExternalTrackParam *track,Double_t center[2]){
Int_t charge=track->Charge();
Double_t b=fInputEvent->GetMagneticField();
Double_t helix[6];
track->GetHelixParameters(helix,b);
Double_t xpos = helix[5];
Double_t ypos = helix[0];
Double_t radius = TMath::Abs(1./helix[4]);
Double_t phi = helix[2];
if(phi < 0){
phi = phi + 2*TMath::Pi();
}
phi -= TMath::Pi()/2.;
Double_t xpoint = radius * TMath::Cos(phi);
Double_t ypoint = radius * TMath::Sin(phi);
if(b<0){
if(charge > 0){
xpoint = - xpoint;
ypoint = - ypoint;
}
}
if(b>0){
if(charge < 0){
xpoint = - xpoint;
ypoint = - ypoint;
}
}
center[0] = xpos + xpoint;
center[1] = ypos + ypoint;
return 1;
}
Bool_t AliV0ReaderV1::GetConversionPoint(const AliExternalTrackParam *pparam,const AliExternalTrackParam *nparam,Double_t convpos[3],Double_t dca[2]){
if(!pparam||!nparam)return kFALSE;
Double_t helixcenterpos[2];
GetHelixCenter(pparam,helixcenterpos);
Double_t helixcenterneg[2];
GetHelixCenter(nparam,helixcenterneg);
Double_t helixpos[6];
pparam->GetHelixParameters(helixpos,fInputEvent->GetMagneticField());
Double_t posradius = TMath::Abs(1./helixpos[4]);
Double_t helixneg[6];
nparam->GetHelixParameters(helixneg,fInputEvent->GetMagneticField());
Double_t negradius = TMath::Abs(1./helixneg[4]);
Double_t xpos = helixcenterpos[0];
Double_t ypos = helixcenterpos[1];
Double_t xneg = helixcenterneg[0];
Double_t yneg = helixcenterneg[1];
convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
Double_t deltaXPos = convpos[0] - xpos;
Double_t deltaYPos = convpos[1] - ypos;
Double_t deltaXNeg = convpos[0] - xneg;
Double_t deltaYNeg = convpos[1] - yneg;
Double_t alphaPos = TMath::Pi() + TMath::ATan2(-deltaYPos,-deltaXPos);
Double_t alphaNeg = TMath::Pi() + TMath::ATan2(-deltaYNeg,-deltaXNeg);
Double_t vertexXNeg = xneg + TMath::Abs(negradius)*TMath::Cos(alphaNeg);
Double_t vertexYNeg = yneg + TMath::Abs(negradius)*TMath::Sin(alphaNeg);
Double_t vertexXPos = xpos + TMath::Abs(posradius)*TMath::Cos(alphaPos);
Double_t vertexYPos = ypos + TMath::Abs(posradius)*TMath::Sin(alphaPos);
AliExternalTrackParam p(*pparam);
AliExternalTrackParam n(*nparam);
TVector2 vertexPos(vertexXPos,vertexYPos);
TVector2 vertexNeg(vertexXNeg,vertexYNeg);
TVector2 vertexPosRot=vertexPos.Rotate(-p.GetAlpha());
TVector2 vertexNegRot=vertexNeg.Rotate(-n.GetAlpha());
if(!p.PropagateTo(vertexPosRot.X(),fInputEvent->GetMagneticField()))return kFALSE;
if(!n.PropagateTo(vertexNegRot.X(),fInputEvent->GetMagneticField()))return kFALSE;
if(TMath::Abs(vertexPos.Mod()-TMath::Sqrt(p.GetX()*p.GetX()+p.GetY()*p.GetY()))>0.01)return kFALSE;
if(TMath::Abs(vertexNeg.Mod()-TMath::Sqrt(n.GetX()*n.GetX()+n.GetY()*n.GetY()))>0.01)return kFALSE;
convpos[2] = (p.GetZ()*negradius+n.GetZ()*posradius)/(negradius+posradius);
TVector2 vdca=vertexPos-vertexNeg;
dca[0]=vdca.Mod();
dca[1]=TMath::Abs(n.GetZ()-p.GetZ());
return kTRUE;
}
Bool_t AliV0ReaderV1::GetAODConversionGammas(){
AliAODEvent *fAODEvent=dynamic_cast<AliAODEvent*>(fInputEvent);
if(fAODEvent){
if(fConversionGammas == NULL){
fConversionGammas = new TClonesArray("AliAODConversionPhoton",100);
}
fConversionGammas->Delete();
AliAODConversionPhoton *gamma=0x0;
TClonesArray *fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));
if(!fInputGammas){
FindDeltaAODBranchName();
fInputGammas=dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(fDeltaAODBranchName.Data()));}
if(!fInputGammas){AliError("No Gamma Satellites found");return kFALSE;}
if(fInputGammas){
for(Int_t i=0;i<fInputGammas->GetEntriesFast();i++){
gamma=dynamic_cast<AliAODConversionPhoton*>(fInputGammas->At(i));
if(gamma){
if(fRelabelAODs)RelabelAODPhotonCandidates(gamma);
if(fConversionCuts->PhotonIsSelected(gamma,fInputEvent)){
new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(*gamma);}
}
}
}
}
if(fConversionGammas->GetEntries()){return kTRUE;}
return kFALSE;
}
void AliV0ReaderV1::FindDeltaAODBranchName(){
TList *list=fInputEvent->GetList();
for(Int_t ii=0;ii<list->GetEntries();ii++){
TString name((list->At(ii))->GetName());
if(name.BeginsWith(fDeltaAODBranchName)&&name.EndsWith("gamma")){
fDeltaAODBranchName=name;
AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
return;
}
}
}
void AliV0ReaderV1::RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate){
Bool_t AODLabelPos = kFALSE;
Bool_t AODLabelNeg = kFALSE;
for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
if(!AODLabelPos){
if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelPositive() ){
PhotonCandidate->SetMCLabelPositive(abs(tempDaughter->GetLabel()));
PhotonCandidate->SetLabelPositive(i);
AODLabelPos = kTRUE;
}
}
if(!AODLabelNeg){
if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelNegative()){
PhotonCandidate->SetMCLabelNegative(abs(tempDaughter->GetLabel()));
PhotonCandidate->SetLabelNegative(i);
AODLabelNeg = kTRUE;
}
}
if(AODLabelNeg && AODLabelPos){
return;
}
}
if(!AODLabelPos || !AODLabelNeg){
AliError(Form("NO AOD Daughters Found Pos: %i %i Neg: %i %i",AODLabelPos,PhotonCandidate->GetTrackLabelPositive(),AODLabelNeg,PhotonCandidate->GetTrackLabelNegative()));
}
}
void AliV0ReaderV1::CountTracks(){
if(fInputEvent->IsA()==AliESDEvent::Class()){
Bool_t selectPrimaries=kTRUE;
AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
EsdTrackCuts->SetMaxDCAToVertexZ(2);
EsdTrackCuts->SetEtaRange(-0.8, 0.8);
EsdTrackCuts->SetPtRange(0.15);
fNumberOfPrimaryTracks = 0;
for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
if(!curTrack) continue;
if(!EsdTrackCuts->AcceptTrack(curTrack)) continue;
fNumberOfPrimaryTracks++;
}
delete EsdTrackCuts;
EsdTrackCuts=0x0;
}
else if(fInputEvent->IsA()==AliAODEvent::Class()){
fNumberOfPrimaryTracks = 0;
for(Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
if(curTrack->GetID()<0) continue;
if(!curTrack->IsHybridGlobalConstrainedGlobal()) continue;
if(abs(curTrack->Eta())>0.8) continue;
if(curTrack->Pt()<0.15) continue;
fNumberOfPrimaryTracks++;
}
}
return;
}
void AliV0ReaderV1::Terminate(Option_t *)
{
}