From b422cf0d63d9749130cc4ed73f552bad10669e64 Mon Sep 17 00:00:00 2001 From: miweber Date: Thu, 31 Jan 2013 13:30:17 +0000 Subject: [PATCH] Update DHC task: running on AODs (Tim Schuster ) --- .../DPhi/FourierDecomposition/AddTaskDhc.C | 82 +++++++++++-------- .../DPhi/FourierDecomposition/AliDhcTask.cxx | 14 ++-- .../DPhi/FourierDecomposition/AliDhcTask.h | 2 + 3 files changed, 61 insertions(+), 37 deletions(-) diff --git a/PWGCF/Correlations/DPhi/FourierDecomposition/AddTaskDhc.C b/PWGCF/Correlations/DPhi/FourierDecomposition/AddTaskDhc.C index e940897c5b5..1879d201b88 100644 --- a/PWGCF/Correlations/DPhi/FourierDecomposition/AddTaskDhc.C +++ b/PWGCF/Correlations/DPhi/FourierDecomposition/AddTaskDhc.C @@ -1,4 +1,4 @@ -AliDhcTask *AddTaskDhc(Int_t iAna = 1, TString chTaskFile = "alien:///alice/cern.ch/user/t/tschuste/LEGO_DhcTask.root") +AliDhcTask *AddTaskDhc(Int_t iAna = 2, TString chHEffFile = "alien:///alice/cern.ch/user/t/tschuste/correction_hybrid_nulled.root", TString chMuEffFile = "", TString chTaskFile = "", TString chTaskName = "") { const char *nTracks = "PicoTracks"; const char *inputTracks = "HybridTracks"; @@ -8,25 +8,32 @@ AliDhcTask *AddTaskDhc(Int_t iAna = 1, TString chTaskFile = "alien:///alice/cern Error("AddTaskDhc", "No analysis manager found."); return; } - - // Track Cuts - gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalEsdTpcTrack.C"); - AliEmcalEsdTpcTrackTask *hybTask = AddTaskEmcalEsdTpcTrack(inputTracks,"Hybrid_LHC11h"); - - // Pico Tracks - gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalPicoTrackMaker.C"); - AliEmcalPicoTrackMaker *pTrackTask = AddTaskEmcalPicoTrackMaker(nTracks, inputTracks, "LHC11h"); - + + TString chIsESD("ESD"); + if (chIsESD.EqualTo(mgr->GetInputEventHandler()->GetDataType())) { + Info("AddTaskDhc","adding ESD track selection tasks ..."); + // ESD Track Cuts + gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalEsdTpcTrack.C"); + AliEmcalEsdTpcTrackTask *hybTask = AddTaskEmcalEsdTpcTrack(inputTracks,"Hybrid_LHC11h",kFALSE); + // Pico Tracks + gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalPicoTrackMaker.C"); + AliEmcalPicoTrackMaker *pTrackTask = AddTaskEmcalPicoTrackMaker(nTracks, inputTracks, "LHC11h"); + } else { + Info("AddTaskDhc","AOD analysis, no extra track selection tasks required."); + sprintf(nTracks,"tracks"); + } + AliDhcTask *dhcTask = 0x0; - if (iAna==99) { // load task from file + if (!chTaskFile.EqualTo("")) { // if string is given, load the task from file + iAna=999; TFile *fiDhcTask = 0x0; fiDhcTask = TFile::Open(chTaskFile,"OLD"); if (!fiDhcTask){ cout << "Requested file:" << fiDhcTask << " was not opened. ABORT." << endl; return; } - dhcTask = (AliDhcTask*) fiDhcTask->Get("Task_tschuste_Dhc"); + dhcTask = (AliDhcTask*) fiDhcTask->Get(chTaskName); } else { // create a new task // Binning Double_t arPt[5] = {0.5, 1.0, 2.0, 4.0}; @@ -41,22 +48,27 @@ AliDhcTask *AddTaskDhc(Int_t iAna = 1, TString chTaskFile = "alien:///alice/cern // Efficiency correction files TFile *fiHEff = 0x0; TFile *fiMuEff = 0x0; - fiHEff = TFile::Open("alien:///alice/cern.ch/user/t/tschuste/correction_hybrid_nulled.root","OLD"); - if (!fiHEff){ - cout << "Requested file:" << fiHEff << " was not opened. ABORT." << endl; - return; + THnF* hHEff = 0x0; + THnF* hMuEff = 0x0; + if (!chHEffFile.EqualTo("")) { + fiHEff = TFile::Open(chHEffFile,"OLD"); + if (!fiHEff){ + cout << "Requested file:" << fiHEff << " was not opened. ABORT." << endl; + return; + } + hHEff = (THnF*) fiHEff->Get("correction"); } - THnF* hHEff = (THnF*) fiHEff->Get("correction"); - fiMuEff = TFile::Open("alien:///alice/cern.ch/user/t/tschuste/correction_muon.root","OLD"); - if (!fiMuEff){ - cout << "Requested file:" << fiMuEff << " was not opened. ABORT." << endl; - return; + if (!chMuEffFile.EqualTo("")) { + fiMuEff = TFile::Open(chMuEffFile,"OLD"); + if (!fiMuEff){ + cout << "Requested file:" << fiMuEff << " was not opened. ABORT." << endl; + return; + } + hMuEff = (THnF*) fiMuEff->Get("correction"); } - THnF* hMuEff = (THnF*) fiMuEff->Get("correction"); - - dhcTask = new AliDhcTask("Task_tschuste_Dhc"); + dhcTask = new AliDhcTask(Form("Task_tschuste_Dhc_%d",iAna)); if (iAna==1) { // h-h Int_t nDetaBins = 40; Int_t nDPhiBins = 72; @@ -64,6 +76,7 @@ AliDhcTask *AddTaskDhc(Int_t iAna = 1, TString chTaskFile = "alien:///alice/cern dhcTask->SetHEffT(hHEff); dhcTask->SetHEffA(hHEff); dhcTask->SetEtaMax(1.2); + dhcTask->SetPtTACrit(kTRUE); } else if (iAna==2) { // mu-h Int_t nDetaBins = 100; Int_t nDPhiBins = 36; @@ -71,6 +84,7 @@ AliDhcTask *AddTaskDhc(Int_t iAna = 1, TString chTaskFile = "alien:///alice/cern dhcTask->SetHEffT(hMuEff); dhcTask->SetHEffA(hHEff); dhcTask->SetEtaMax(5.0); + dhcTask->SetPtTACrit(kFALSE); } dhcTask->SetTracksName(nTracks); dhcTask->SetDoWeights(kFALSE); @@ -84,15 +98,19 @@ AliDhcTask *AddTaskDhc(Int_t iAna = 1, TString chTaskFile = "alien:///alice/cern dhcTask->SetZVtxMixBins(axZvtxMix); dhcTask->SelectCollisionCandidates(AliVEvent::kINT7); dhcTask->SetVerbosity(0); - mgr->AddTask(dhcTask); - - AliAnalysisDataContainer *co_Dhc = mgr->CreateContainer("Cont_tschuste_DhcAna", - TList::Class(), - AliAnalysisManager::kOutputContainer, - Form("%s:PWGCF.outDhc_%d.root", AliAnalysisManager::GetCommonFileName(), iAna)); - mgr->ConnectInput(dhcTask,0,mgr->GetCommonInputContainer()); - mgr->ConnectOutput(dhcTask,1,co_Dhc); } + if (!dhcTask) { + cout << "no DhcTask---return" << endl; + return 0x0; + } + + mgr->AddTask(dhcTask); + AliAnalysisDataContainer *co_Dhc = mgr->CreateContainer(Form("Cont_tschuste_DhcAna_%d",iAna), + TList::Class(), + AliAnalysisManager::kOutputContainer, + Form("%s:PWGCF_outDhc_%d", AliAnalysisManager::GetCommonFileName(), iAna)); + mgr->ConnectInput(dhcTask,0,mgr->GetCommonInputContainer()); + mgr->ConnectOutput(dhcTask,1,co_Dhc); return dhcTask; diff --git a/PWGCF/Correlations/DPhi/FourierDecomposition/AliDhcTask.cxx b/PWGCF/Correlations/DPhi/FourierDecomposition/AliDhcTask.cxx index 77aa89f1422..dc06d46458f 100644 --- a/PWGCF/Correlations/DPhi/FourierDecomposition/AliDhcTask.cxx +++ b/PWGCF/Correlations/DPhi/FourierDecomposition/AliDhcTask.cxx @@ -35,6 +35,7 @@ ClassImp(AliDhcTask) AliDhcTask::AliDhcTask() : AliAnalysisTaskSE(), fVerbosity(0), fEtaMax(1), fZVtxMax(10), fPtMin(0.25), fPtMax(15), fTrackDepth(1000), fPoolSize(200), fTracksName(), fDoWeights(kFALSE), fFillMuons(kFALSE), + fPtTACrit(kTRUE), fEtaTLo(-1.0), fEtaTHi(1.0), fEtaALo(-1.0), fEtaAHi(1.0), fESD(0x0), fAOD(0x0), fOutputList(0x0), fHEvt(0x0), fHTrk(0x0), fHPtAss(0x0), fHPtTrg(0x0), fHPtTrgEvt(0x0), @@ -53,6 +54,7 @@ AliDhcTask::AliDhcTask() AliDhcTask::AliDhcTask(const char *name) : AliAnalysisTaskSE(name), fVerbosity(0), fEtaMax(1), fZVtxMax(10), fPtMin(0.25), fPtMax(15), fTrackDepth(1000), fPoolSize(200), fTracksName(), fDoWeights(kFALSE), fFillMuons(kFALSE), + fPtTACrit(kTRUE), fEtaTLo(-1.0), fEtaTHi(1.0), fEtaALo(-1.0), fEtaAHi(1.0), fESD(0x0), fAOD(0x0), fOutputList(0x0), fHEvt(0x0), fHTrk(0x0), fHPtAss(0x0), fHPtTrg(0x0), fHPtTrgEvt(0x0), @@ -100,6 +102,7 @@ void AliDhcTask::UserCreateOutputObjects() AliInfo(Form(" efficiency correct triggers? %d", fHEffT!=0)); AliInfo(Form(" efficiency correct associates? %d", fHEffA!=0)); AliInfo(Form(" fill muons? %d", fFillMuons)); + AliInfo(Form(" use pTT > pTA criterion? %d", fPtTACrit)); AliInfo(Form(" trigger eta range %f .. %f", fEtaTLo, fEtaTHi)); AliInfo(Form(" associate eta range %f .. %f", fEtaALo, fEtaAHi)); } @@ -236,7 +239,7 @@ void AliDhcTask::BookHistos() } //________________________________________________________________________ -void AliDhcTask::SetAnaMode(Int_t iAna=kHH) +void AliDhcTask::SetAnaMode(Int_t iAna) { if (iAna==kHH) { SetFillMuons(kFALSE); @@ -570,7 +573,7 @@ void AliDhcTask::GetESDTracks(MiniEvent* miniEvt) Double_t ptMu = muonTrack->Pt(); Double_t etaMu = muonTrack->Eta(); Double_t phiMu = muonTrack->Phi(); - Double_t signMu = muonTrack->Charge() > 0 ? 1 : -1; + Int_t signMu = muonTrack->Charge() > 0 ? 1 : -1; miniEvt->push_back(AliMiniTrack(ptMu, etaMu, phiMu, signMu)); } } @@ -694,7 +697,7 @@ void AliDhcTask::GetAODTracks(MiniEvent* miniEvt) Double_t ptMu = muonTrack->Pt(); Double_t etaMu = muonTrack->Eta(); Double_t phiMu = muonTrack->Phi(); - Double_t signMu = muonTrack->Charge() > 0 ? 1 : -1; + Int_t signMu = muonTrack->Charge() > 0 ? 1 : -1; miniEvt->push_back(AliMiniTrack(ptMu, etaMu, phiMu, signMu)); } } @@ -814,8 +817,9 @@ Int_t AliDhcTask::Correlate(const MiniEvent &evt1, const MiniEvent &evt2, Int_t Float_t ptb = b.Pt(); Float_t etab = b.Eta(); Float_t phib = b.Phi(); - if (pta < ptb) - continue; + if (pta < ptb) { + continue; + } Int_t bbin = fHPtAss->FindBin(ptb); if (fHPtAss->IsBinOverflow(bbin) || fHPtAss->IsBinUnderflow(bbin)) diff --git a/PWGCF/Correlations/DPhi/FourierDecomposition/AliDhcTask.h b/PWGCF/Correlations/DPhi/FourierDecomposition/AliDhcTask.h index f887dacd2cd..e21e43908e0 100644 --- a/PWGCF/Correlations/DPhi/FourierDecomposition/AliDhcTask.h +++ b/PWGCF/Correlations/DPhi/FourierDecomposition/AliDhcTask.h @@ -37,6 +37,7 @@ class AliDhcTask : public AliAnalysisTaskSE { void SetDEtaDPhiBins(Int_t nbe, Int_t nbp) { fNBdeta=nbe; fNBdphi=nbp; } void SetDoWeights(Bool_t b) { fDoWeights = b; } void SetFillMuons(Bool_t b) { fFillMuons = b; } + void SetPtTACrit(Bool_t b) { fPtTACrit = b; } void SetEtaMax(Double_t eta) { fEtaMax = eta; } void SetPoolSize(Int_t p) { fPoolSize = p; } void SetPtABins(TAxis *bins) { fBPtA=bins; } @@ -83,6 +84,7 @@ class AliDhcTask : public AliAnalysisTaskSE { TString fTracksName; // name of track collection Bool_t fDoWeights; // if true weight with 1/N per event Bool_t fFillMuons; // fill the muon tracks into the mini event + Bool_t fPtTACrit; // use the pTT > pTA criterion? Double_t fEtaTLo; // Min eta for triggers Double_t fEtaTHi; // Max eta for triggers Double_t fEtaALo; // Min eta for associated -- 2.43.0