+
+ if(!track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue; // TESTBIT FOR AOD double Counting
+ //----------hfe begin---------
+ if(track->Eta()<-0.7 || track->Eta()>0.7) continue; //eta cuts on candidates
+
+ // RecKine: ITSTPC cuts
+ if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
+
+ // Reject kink mother
+ Bool_t kinkmotherpass = kTRUE;
+ for(Int_t kinkmother = 0; kinkmother < numberofmotherkink; kinkmother++) {
+ if(track->GetID() == listofmotherkink[kinkmother]) {
+ kinkmotherpass = kFALSE;
+ continue;
+ }
+ }
+ if(!kinkmotherpass) continue;
+
+ // RecPrim
+ // if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue; //deleted for DCA absence
+ // HFEcuts: ITS layers cuts
+ if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
+ // HFE cuts: TPC PID cleanup
+ if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
+
+ Double_t fClsE = -999, p = -999, fEovP=-999, pt = -999, fTPCnSigma=0;
+ // Track extrapolation
+ Int_t fClsId = track->GetEMCALcluster();
+ if(fClsId < 0) continue;
+ AliAODCaloCluster *cluster = fAOD->GetCaloCluster(fClsId);
+ if(TMath::Abs(cluster->GetTrackDx()) > 0.05 || TMath::Abs(cluster->GetTrackDz()) > 0.05) continue;
+
+ pt = track->Pt(); //pt track after cuts
+ if(pt<fpTCut) continue;
+ fClsE = cluster->E();
+ p = track->P();
+ // dEdx = track->GetTPCsignal();
+ fEovP = fClsE/p;
+ fTPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
+ Double_t m20 =cluster->GetM20();
+ Double_t m02 =cluster->GetM02();
+ Double_t disp=cluster->GetDispersion();
+ if(fTPCnSigma >= -1 && fTPCnSigma <= 3)fTrkEovPBef->Fill(pt,fEovP);
+ fTPCnsigma->Fill(p,fTPCnSigma);
+ // fdEdxBef->Fill(p,dEdx);
+ Double_t eta = track->Eta();
+ Double_t phi = track->Phi();
+ //-----------------------Phiminupsi method to remove the contamination-----------------------------------------------
+ //-----------------------fTPCnSigma < -3.5 hadrons will be selected from this region--------------------------
+ Float_t dPhi_aeh = TVector2::Phi_0_2pi(phi - evPlAngV0A);
+ if(dPhi_aeh > TMath::Pi()) dPhi_aeh = dPhi_aeh - TMath::Pi();
+ Float_t dPhi_ceh = TVector2::Phi_0_2pi(phi - evPlAngV0C);
+ if(dPhi_ceh > TMath::Pi()) dPhi_ceh = dPhi_ceh - TMath::Pi();
+
+ if(fPhiminusPsi){
+ Double_t valueElh[8] = {
+ pt,
+ fEovP,
+ fTPCnSigma,
+ m20,
+ m02,
+ disp,
+ dPhi_aeh,
+ dPhi_ceh};
+ fSparseElectronHadron->Fill(valueElh);
+ }
+ //----------------------------------------------------------------------------------------------------------
+ //---------------------------From here usual electron selection---------------------------------------------
+ //----------------------------------------------------------------------------------------------------------
+ if(m20 < fminM20 || m20 > fmaxM20) continue;
+ if(m02 < fminM02 || m02 > fmaxM02) continue;
+ if(disp > fDispersion ) continue;
+ //---------------------------------for purity---------------------------------------------------------------
+ if(fpurity){
+ Double_t valuepurity[3] = {
+ pt,
+ fEovP,
+ fTPCnSigma};
+ fSparseElectronpurity->Fill(valuepurity);
+ }
+ //----------------------------------------------------------------------------------------------------------
+ //----------------------------------------------------------------------------------------------------------
+ if(fTPCnSigma < fminTPC || fTPCnSigma > fmaxTPC) continue; //cuts on nsigma tpc and EoP
+ //===============================Flow Event for Contamination=============================================
+ if(fSideBandsFlow){
+ if(fEovP>0 && fEovP<0.6){
+ AliFlowTrack *sTrackCont = new AliFlowTrack();
+ sTrackCont->Set(track);
+ sTrackCont->SetID(track->GetID());
+ sTrackCont->SetForRPSelection(kTRUE);
+ sTrackCont->SetForPOISelection(kTRUE);
+ sTrackCont->SetMass(2637);
+ for(int iRPs=0; iRPs!=fFlowEventCont->NumberOfTracks(); ++iRPs)
+ {
+ // cout << " no of rps " << iRPs << endl;
+ AliFlowTrack *iRPCont = dynamic_cast<AliFlowTrack*>(fFlowEventCont->GetTrack( iRPs ));
+ if (!iRPCont) continue;
+ if (!iRPCont->InRPSelection()) continue;
+ if( sTrackCont->GetID() == iRPCont->GetID())
+ {
+ if(fDebug) printf(" was in RP set");
+ // cout << sTrack->GetID() <<" == " << iRP->GetID() << " was in RP set" <<endl;
+ iRPCont->SetForRPSelection(kFALSE);
+ // fFlowEventCont->SetNumberOfRPs(fFlowEventCont->GetNumberOfRPs() - 1);
+ }
+ } //end of for loop on RPs
+ fFlowEventCont->InsertTrack(((AliFlowTrack*) sTrackCont));
+ fFlowEventCont->SetNumberOfPOIs(fFlowEventCont->GetNumberOfPOIs()+1);
+
+ }
+ }
+ //==========================================================================================================
+ //===============================From here eovP cut is used fro QC, SP and EPV0=============================
+ if(fEovP < fminEovP || fEovP >fmaxEovP) continue;
+ //==========================================================================================================
+ //============================Event Plane Method with V0====================================================
+ Double_t v2PhiV0A = TMath::Cos(2*(phi - evPlAngV0A));
+ Double_t v2PhiV0C = TMath::Cos(2*(phi - evPlAngV0C));
+ Double_t v2Phi[3] = {
+ v2PhiV0A,
+ v2PhiV0C,
+ pt};
+ fV2Phi->Fill(v2Phi);
+
+ Double_t v2PhiVz = TMath::Cos(2*(phi - evPlAngV0));
+ Double_t v2PhiV0tot[2] = {
+ v2PhiVz,
+ pt};
+ fV2Phivzerotot->Fill(v2PhiV0tot);
+ //=========================================================================================================
+ fTPCnsigmaAft->Fill(p,fTPCnSigma);
+ fInclusiveElecPt->Fill(pt);
+ fPhi->Fill(phi);
+ fEta->Fill(eta);
+ //----------------------Flow of Inclusive Electrons--------------------------------------------------------
+ AliFlowTrack *sTrack = new AliFlowTrack();
+ sTrack->Set(track);
+ sTrack->SetID(track->GetID());
+ sTrack->SetForRPSelection(kTRUE);
+ sTrack->SetForPOISelection(kTRUE);
+ sTrack->SetMass(263732);
+ for(int iRPs=0; iRPs!=fFlowEvent->NumberOfTracks(); ++iRPs)
+ {
+ // cout << " no of rps " << iRPs << endl;
+ AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEvent->GetTrack( iRPs ));
+ if (!iRP) continue;
+ if (!iRP->InRPSelection()) continue;
+ if( sTrack->GetID() == iRP->GetID())
+ {
+ if(fDebug) printf(" was in RP set");
+ // cout << sTrack->GetID() <<" == " << iRP->GetID() << " was in RP set" <<endl;
+ iRP->SetForRPSelection(kFALSE);
+ // fFlowEvent->SetNumberOfRPs(fFlowEvent->GetNumberOfRPs() - 1);
+ }
+ } //end of for loop on RPs
+ fFlowEvent->InsertTrack(((AliFlowTrack*) sTrack));
+ fFlowEvent->SetNumberOfPOIs(fFlowEvent->GetNumberOfPOIs()+1);
+
+
+ if(fDCA){
+ //----------------------Selection of Photonic Electrons DCA-----------------------------
+ fNonHFE = new AliSelectNonHFE();
+ fNonHFE->SetAODanalysis(kTRUE);
+ fNonHFE->SetInvariantMassCut(fInvmassCut);
+ if(fOP_angle) fNonHFE->SetOpeningAngleCut(fOpeningAngleCut);
+ //fNonHFE->SetChi2OverNDFCut(fChi2Cut);
+ //if(fDCAcutFlag) fNonHFE->SetDCACut(fDCAcut);
+ fNonHFE->SetAlgorithm("DCA"); //KF
+ fNonHFE->SetPIDresponse(pidResponse);
+ fNonHFE->SetTrackCuts(-3,3);
+
+ fNonHFE->SetHistAngleBack(fOpeningAngleLS);
+ fNonHFE->SetHistAngle(fOpeningAngleULS);
+ //fNonHFE->SetHistDCABack(fDCABack);
+ //fNonHFE->SetHistDCA(fDCA);
+ fNonHFE->SetHistMassBack(fInvmassLS1);
+ fNonHFE->SetHistMass(fInvmassULS1);
+
+ fNonHFE->FindNonHFE(iTracks,track,fAOD);
+
+ // Int_t *fUlsPartner = fNonHFE->GetPartnersULS();
+ // Int_t *fLsPartner = fNonHFE->GetPartnersLS();
+ // Bool_t fUlsIsPartner = kFALSE;
+ // Bool_t fLsIsPartner = kFALSE;
+ if(fNonHFE->IsULS()){
+ for(Int_t kULS =0; kULS < fNonHFE->GetNULS(); kULS++){
+ fULSElecPt->Fill(track->Pt());
+ }
+ }
+
+ if(fNonHFE->IsLS()){
+ for(Int_t kLS =0; kLS < fNonHFE->GetNLS(); kLS++){
+ fLSElecPt->Fill(track->Pt());
+ }
+ }
+ }
+
+ if(!fDCA){
+ //----------------------Selection of Photonic Electrons KFParticle-----------------------------
+ Bool_t fFlagPhotonicElec = kFALSE;
+ SelectPhotonicElectron(iTracks,track,fEovP, evPlAngV0, fFlagPhotonicElec);
+ if(fFlagPhotonicElec){fPhotoElecPt->Fill(pt);}
+ // Semi inclusive electron
+ if(!fFlagPhotonicElec){fSemiInclElecPt->Fill(pt);}
+ }
+
+
+
+ }//end loop on track
+
+ PostData(1, fOutputList);
+ PostData(2, fFlowEvent);