From 87dd0926945cfabf1340f1401f73f6d85c9e7fcc Mon Sep 17 00:00:00 2001 From: miweber Date: Fri, 3 May 2013 12:36:51 +0000 Subject: [PATCH] 1) Choose correction file with TString in AddTask (no file means no correction) 2) Resonance cut also in MCAOD 3) remove neutral tracks from AliBFBasicParticle array (are not used further) --- .../BalanceFunctions/AliAnalysisTaskBFPsi.cxx | 83 ++++++++++++------- .../BalanceFunctions/AliAnalysisTaskBFPsi.h | 8 +- 2 files changed, 53 insertions(+), 38 deletions(-) diff --git a/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBFPsi.cxx b/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBFPsi.cxx index 45b77eed3bb..cc29c675f1d 100755 --- a/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBFPsi.cxx +++ b/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBFPsi.cxx @@ -502,15 +502,23 @@ void AliAnalysisTaskBFPsi::UserCreateOutputObjects() { //________________________________________________________________________ -void AliAnalysisTaskBFPsi::SetInputCorrection(const char* filename, - const char* gCollSystem) { +void AliAnalysisTaskBFPsi::SetInputCorrection(TString filename, + TString gCollSystem) { //Open files that will be used for correction TString gCollidingSystem = gCollSystem; + cout< run without corrections + if(!filename.Contains(".root")) { + AliInfo(Form("No correction file specified (= %s) --> run without corrections",filename.Data())); + return; + } + //Open the input file TFile *f = TFile::Open(filename); if(!f->IsOpen()) { - Printf("File not found!!!"); + AliInfo(Form("File %s not found --> run without corrections",filename.Data())); return; } @@ -1135,7 +1143,6 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC //=======================================correction Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality); - //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality); // add the track to the TObjArray @@ -1170,30 +1177,39 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC if( vPt < fPtMin || vPt > fPtMax) continue; if( vEta < fEtaMin || vEta > fEtaMax) continue; - // //Exclude resonances - // if(fExcludeResonancesInMC) { - // TParticle *particle = track->Particle(); - // if(!particle) continue; + // Remove neutral tracks + if( vCharge == 0 ) continue; + + //Exclude resonances + if(fExcludeResonancesInMC) { - // Bool_t kExcludeParticle = kFALSE; - // Int_t gMotherIndex = particle->GetFirstMother(); - // if(gMotherIndex != -1) { - // AliMCParticle* motherTrack = dynamic_cast(event->GetTrack(gMotherIndex)); - // if(motherTrack) { - // TParticle *motherParticle = motherTrack->Particle(); - // if(motherParticle) { - // Int_t pdgCodeOfMother = motherParticle->GetPdgCode(); - // //if((pdgCodeOfMother == 113)||(pdgCodeOfMother == 213)||(pdgCodeOfMother == 221)||(pdgCodeOfMother == 223)||(pdgCodeOfMother == 331)||(pdgCodeOfMother == 333)) { - // if(pdgCodeOfMother == 113) { - // kExcludeParticle = kTRUE; - // } - // } - // } - // } + Bool_t kExcludeParticle = kFALSE; + Int_t gMotherIndex = aodTrack->GetMother(); + if(gMotherIndex != -1) { + AliAODMCParticle* motherTrack = dynamic_cast(mcEvent->GetTrack(gMotherIndex)); + if(motherTrack) { + Int_t pdgCodeOfMother = motherTrack->GetPdgCode(); + //if((pdgCodeOfMother == 113)||(pdgCodeOfMother == 213)||(pdgCodeOfMother == 221)||(pdgCodeOfMother == 223)||(pdgCodeOfMother == 331)||(pdgCodeOfMother == 333)) { + //if(pdgCodeOfMother == 113) { + if(pdgCodeOfMother == 113 // rho0 + || pdgCodeOfMother == 213 || pdgCodeOfMother == -213 // rho+ + || pdgCodeOfMother == 221 // eta + || pdgCodeOfMother == 331 // eta' + || pdgCodeOfMother == 223 // omega + || pdgCodeOfMother == 333 // phi + || pdgCodeOfMother == 311 || pdgCodeOfMother == -311 // K0 + || pdgCodeOfMother == 313 || pdgCodeOfMother == -313 // K0* + || pdgCodeOfMother == 323 || pdgCodeOfMother == -323 // K+* + + ) { + kExcludeParticle = kTRUE; + } + } + } - // //Exclude from the analysis decay products of rho0, rho+, eta, eta' and phi - // if(kExcludeParticle) continue; - // } + //Exclude from the analysis decay products of rho0, rho+, eta, eta' and phi + if(kExcludeParticle) continue; + } // fill QA histograms fHistPt->Fill(vPt,gCentrality); @@ -1205,8 +1221,9 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC if(vCharge > 0) fHistEtaPhiPos->Fill(vEta,vPhi,gCentrality); else if(vCharge < 0) fHistEtaPhiNeg->Fill(vEta,vPhi,gCentrality); - //=======================================correction (NO corrections in case of MC truth) - Double_t correction = 1.; + //=======================================correction + Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality); + //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality); // add the track to the TObjArray tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction)); @@ -1420,6 +1437,7 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC //exclude non stable particles if(!(gMCEvent->IsPhysicalPrimary(iTracks))) continue; + vCharge = track->Charge(); vEta = track->Eta(); vPt = track->Pt(); vY = track->Y(); @@ -1432,6 +1450,9 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC else if (fUsePID){ if( vY < fEtaMin || vY > fEtaMax) continue; } + + // Remove neutral tracks + if( vCharge == 0 ) continue; //analyze one set of particles if(fUseMCPdgCode) { @@ -1475,7 +1496,6 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC if(kExcludeParticle) continue; } - vCharge = track->Charge(); vPhi = track->Phi(); //Printf("phi (before): %lf",vPhi); @@ -1519,8 +1539,9 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC //vPhi *= TMath::RadToDeg(); - //=======================================correction (NO corrections in case of MC truth) - Double_t correction = 1.; + //=======================================correction + Double_t correction = GetTrackbyTrackCorrectionMatrix(vEta, vPhi, vPt, vCharge, gCentrality); + //Printf("CORRECTIONminus: %.2f | Centrality %lf",correction,gCentrality); tracksAccepted->Add(new AliBFBasicParticle(vEta, vPhi, vPt, vCharge, correction)); } //track loop diff --git a/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBFPsi.h b/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBFPsi.h index ee505f976ff..e43c2b33112 100755 --- a/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBFPsi.h +++ b/PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBFPsi.h @@ -40,9 +40,7 @@ class AliAnalysisTaskBFPsi : public AliAnalysisTaskSE { virtual void Terminate(Option_t *); //========================correction - virtual void SetInputCorrection(const char* filename, const char* gCollSystem);//{ - //fileNameCorrection = filename;//++++++++++++++++++++++++++++++= - //;} + virtual void SetInputCorrection(TString filename, TString gCollSystem);//{ //========================correction void SetAnalysisObject(AliBalancePsi *const analysis) { @@ -149,8 +147,6 @@ class AliAnalysisTaskBFPsi : public AliAnalysisTaskSE { fEventClass = receivedEventClass; } - //========================correction=============================// - // void SetInputCorrection(const char* filename = "efficiencyCorrection.root"){} private: Double_t IsEventAccepted(AliVEvent* event); @@ -234,8 +230,6 @@ class AliAnalysisTaskBFPsi : public AliAnalysisTaskSE { Double_t fPIDNSigma;//nsigma cut for PID Double_t fMinAcceptedPIDProbability;//probability cut for PID - //const char* fileNameCorrection; //++++++++++++++++++++++++++++++++++ - //============PID============// AliESDtrackCuts *fESDtrackCuts; //ESD track cuts -- 2.43.0