From 8c483a6b3d4c70a2dbcc2ad00e635c36f9a5001f Mon Sep 17 00:00:00 2001 From: kleinb Date: Tue, 7 Feb 2012 12:32:02 +0000 Subject: [PATCH] clean up old and unused tasks, necessary corrections to includes/forward declaration --- PWGJE/AliAnalyseUE.cxx | 1436 ------------------ PWGJE/AliAnalyseUE.h | 161 -- PWGJE/AliAnalysisTaskCorrectionsUE.cxx | 649 -------- PWGJE/AliAnalysisTaskCorrectionsUE.h | 126 -- PWGJE/AliAnalysisTaskFragmentationFunction.h | 1 + PWGJE/AliAnalysisTaskHardSoft.cxx | 503 ------ PWGJE/AliAnalysisTaskHardSoft.h | 102 -- PWGJE/AliAnalysisTaskJFSystematics.cxx | 628 -------- PWGJE/AliAnalysisTaskJFSystematics.h | 120 -- PWGJE/AliAnalysisTaskJetChem.h | 1 + PWGJE/AliAnalysisTaskJetCore.cxx | 1 + PWGJE/AliAnalysisTaskJetCore.h | 1 + PWGJE/AliAnalysisTaskJetCorrections.cxx | 955 ------------ PWGJE/AliAnalysisTaskJetCorrections.h | 123 -- PWGJE/AliAnalysisTaskJetResponse.cxx | 563 ------- PWGJE/AliAnalysisTaskJetResponse.h | 136 -- PWGJE/AliAnalysisTaskJetResponseV2.cxx | 1 + PWGJE/AliAnalysisTaskJetResponseV2.h | 2 + PWGJE/AliAnalysisTaskJetSpectrum.cxx | 826 ---------- PWGJE/AliAnalysisTaskJetSpectrum.h | 136 -- PWGJE/AliAnalysisTaskJetSpectrum2.h | 2 +- PWGJE/AliAnalysisTaskPWG4PidDetEx.cxx | 943 ------------ PWGJE/AliAnalysisTaskPWG4PidDetEx.h | 97 -- PWGJE/AliAnalysisTaskPartonDisc.h | 1 + PWGJE/AliAnalysisTaskQGSep.cxx | 511 ------- PWGJE/AliAnalysisTaskQGSep.h | 53 - PWGJE/AliAnalysisTaskThreeJets.cxx | 1301 ---------------- PWGJE/AliAnalysisTaskThreeJets.h | 145 -- PWGJE/AliAnalysisTaskUE.cxx | 450 ------ PWGJE/AliAnalysisTaskUE.h | 305 ---- PWGJE/AliHistogramsUE.cxx | 1315 ---------------- PWGJE/AliHistogramsUE.h | 116 -- PWGJE/AliJetSpectrumUnfolding.cxx | 1213 --------------- PWGJE/AliJetSpectrumUnfolding.h | 105 -- PWGJE/CMakelibPWGJE.pkg | 31 +- PWGJE/PWGJELinkDef.h | 11 - PWGJE/macros/AddTaskCorrectionsUE.C | 208 --- PWGJE/macros/AddTaskJFSystematics.C | 49 - PWGJE/macros/AddTaskJetCorrections.C | 63 - PWGJE/macros/AddTaskJetSpectrum.C | 46 - PWGJE/macros/AddTaskPWG4PidDetEx.C | 44 - PWGJE/macros/AddTaskQGSep.C | 27 - PWGJE/macros/AddTaskThreeJets.C | 86 -- PWGJE/macros/AddTaskUE.C | 192 --- 44 files changed, 19 insertions(+), 13766 deletions(-) delete mode 100644 PWGJE/AliAnalyseUE.cxx delete mode 100644 PWGJE/AliAnalyseUE.h delete mode 100644 PWGJE/AliAnalysisTaskCorrectionsUE.cxx delete mode 100644 PWGJE/AliAnalysisTaskCorrectionsUE.h delete mode 100644 PWGJE/AliAnalysisTaskHardSoft.cxx delete mode 100644 PWGJE/AliAnalysisTaskHardSoft.h delete mode 100644 PWGJE/AliAnalysisTaskJFSystematics.cxx delete mode 100644 PWGJE/AliAnalysisTaskJFSystematics.h delete mode 100644 PWGJE/AliAnalysisTaskJetCorrections.cxx delete mode 100644 PWGJE/AliAnalysisTaskJetCorrections.h delete mode 100644 PWGJE/AliAnalysisTaskJetResponse.cxx delete mode 100644 PWGJE/AliAnalysisTaskJetResponse.h delete mode 100644 PWGJE/AliAnalysisTaskJetSpectrum.cxx delete mode 100644 PWGJE/AliAnalysisTaskJetSpectrum.h delete mode 100644 PWGJE/AliAnalysisTaskPWG4PidDetEx.cxx delete mode 100644 PWGJE/AliAnalysisTaskPWG4PidDetEx.h delete mode 100644 PWGJE/AliAnalysisTaskQGSep.cxx delete mode 100644 PWGJE/AliAnalysisTaskQGSep.h delete mode 100644 PWGJE/AliAnalysisTaskThreeJets.cxx delete mode 100644 PWGJE/AliAnalysisTaskThreeJets.h delete mode 100644 PWGJE/AliAnalysisTaskUE.cxx delete mode 100644 PWGJE/AliAnalysisTaskUE.h delete mode 100644 PWGJE/AliHistogramsUE.cxx delete mode 100644 PWGJE/AliHistogramsUE.h delete mode 100644 PWGJE/AliJetSpectrumUnfolding.cxx delete mode 100644 PWGJE/AliJetSpectrumUnfolding.h delete mode 100644 PWGJE/macros/AddTaskCorrectionsUE.C delete mode 100644 PWGJE/macros/AddTaskJFSystematics.C delete mode 100644 PWGJE/macros/AddTaskJetCorrections.C delete mode 100644 PWGJE/macros/AddTaskJetSpectrum.C delete mode 100644 PWGJE/macros/AddTaskPWG4PidDetEx.C delete mode 100644 PWGJE/macros/AddTaskQGSep.C delete mode 100644 PWGJE/macros/AddTaskThreeJets.C delete mode 100644 PWGJE/macros/AddTaskUE.C diff --git a/PWGJE/AliAnalyseUE.cxx b/PWGJE/AliAnalyseUE.cxx deleted file mode 100644 index 95536b79d1e..00000000000 --- a/PWGJE/AliAnalyseUE.cxx +++ /dev/null @@ -1,1436 +0,0 @@ -/************************************************************************* - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: A.Abrahantes, E.Lopez, S.Vallero * - * Version 1.0 * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "AliAnalyseUE.h" -#include "AliAnalysisTaskUE.h" -#include "AliAnalysisTask.h" -#include "AliHistogramsUE.h" - -#include "AliAnalysisManager.h" -#include "AliAODEvent.h" -#include "AliESDEvent.h" -#include "AliAODHandler.h" -#include "AliAODInputHandler.h" -#include "AliAODJet.h" -#include "AliAODMCParticle.h" -#include "AliAODTrack.h" -#include "AliESDtrack.h" -#include "AliKFVertex.h" -#include "AliMCEvent.h" -#include "AliMCEventHandler.h" -#include "AliStack.h" - -#include "AliAnalysisHelperJetTasks.h" -#include "AliGenPythiaEventHeader.h" -#include "AliInputEventHandler.h" -#include "AliLog.h" -#include "AliStack.h" - -//////////////////////////////////////////////// -//--------------------------------------------- -// Class for transverse regions analysis -//--------------------------------------------- -//////////////////////////////////////////////// - - -using namespace std; - -ClassImp(AliAnalyseUE) - -//------------------------------------------------------------------- -AliAnalyseUE::AliAnalyseUE() : - TObject(), - //fTaskUE(0), - fkAOD(0x0), - fkMC(0x0), - fkESD(0x0), - fDebug(0), - fSimulateChJetPt(kFALSE), - fStack(0x0), - fAnaType(1), - fAreaReg(1.5393), // Pi*0.7*0.7 - fConeRadius(0.7), - fFilterBit(0xFF), - fRegionType(1), - fUseChargeHadrons(kFALSE), - fUseChPartJet(kFALSE), - fUsePositiveCharge(kTRUE), - fUseSingleCharge(kFALSE), - fOrdering(1), - fJet1EtaCut(0.2), - fJet2DeltaPhiCut(2.616), // 150 degrees - fJet2RatioPtCut(0.8), - fJet3PtCut(15.), - fTrackEtaCut(0.9), - fTrackPtCut(0.), - fHistos(0x0), - fSumPtRegionPosit(0.), - fSumPtRegionNegat(0.), - fSumPtRegionForward(0.), - fSumPtRegionBackward(0.), - fMaxPartPtRegion(0.), - fNTrackRegionPosit(0), - fNTrackRegionNegat(0), - fNTrackRegionForward(0), - fNTrackRegionBackward(0), - fSettingsTree(0x0), - fLtLabel(-999), - fLtMCLabel(-999) -{ - // constructor -} - - -//------------------------------------------------------------------- -AliAnalyseUE::AliAnalyseUE(const AliAnalyseUE & original) : - TObject(original), - //fTaskUE(original.fTaskUE), - fkAOD(original.fkAOD), - fkMC(original.fkMC), - fkESD(original.fkESD), - fDebug(original.fDebug), - fSimulateChJetPt(original.fSimulateChJetPt), - fStack(original.fStack), - fAnaType(original.fAnaType), - fAreaReg(original.fAreaReg), - fConeRadius(original.fConeRadius), - fFilterBit(original.fFilterBit), - fRegionType(original.fRegionType), - fUseChargeHadrons(original.fUseChargeHadrons), - fUseChPartJet(original.fUseChPartJet), - fUsePositiveCharge(original.fUsePositiveCharge), - fUseSingleCharge(original.fUseSingleCharge), - fOrdering(original.fOrdering), - fJet1EtaCut(original.fJet1EtaCut), - fJet2DeltaPhiCut(original.fJet2DeltaPhiCut), - fJet2RatioPtCut(original.fJet2RatioPtCut), - fJet3PtCut(original.fJet3PtCut), - fTrackEtaCut(original.fTrackEtaCut), - fTrackPtCut(original.fTrackPtCut), - fHistos(original.fHistos), - fSumPtRegionPosit(original.fSumPtRegionPosit), - fSumPtRegionNegat(original.fSumPtRegionNegat), - fSumPtRegionForward(original.fSumPtRegionForward), - fSumPtRegionBackward(original.fSumPtRegionBackward), - fMaxPartPtRegion(original.fMaxPartPtRegion), - fNTrackRegionPosit(original.fNTrackRegionPosit), - fNTrackRegionNegat(original.fNTrackRegionNegat), - fNTrackRegionForward(original.fNTrackRegionForward), - fNTrackRegionBackward(original.fNTrackRegionBackward), - fSettingsTree(original.fSettingsTree), - fLtLabel(original.fLtLabel), - fLtMCLabel(original.fLtMCLabel) -{ - //copy constructor -} - -//------------------------------------------------------------------- -AliAnalyseUE & AliAnalyseUE::operator = (const AliAnalyseUE & /*source*/) -{ - // assignment operator - return *this; -} - - -//------------------------------------------------------------------- -AliAnalyseUE::~AliAnalyseUE(){ - - //clear memory - - - -} - - -//------------------------------------------------------------------- -void AliAnalyseUE::AnalyseMC(TVector3 *jetVect,AliMCEvent *mcEvent, AliGenPythiaEventHeader *pythiaGenHeader,Int_t conePosition, Bool_t useAliStack, Bool_t constrainDistance, Double_t minDistance){ - - // Execute the analysis in case of MC input - fSumPtRegionPosit = 0.; - fSumPtRegionNegat = 0.; - fSumPtRegionForward = 0.; - fSumPtRegionBackward = 0.; - fMaxPartPtRegion = 0.; - fNTrackRegionPosit = 0; - fNTrackRegionNegat = 0; - fNTrackRegionForward = 0; - fNTrackRegionBackward = 0; - - static Double_t const kPI = TMath::Pi(); - static Double_t const k270rad = 270.*kPI/180.; - - //Get Jets from MC header - Int_t nPythiaGenJets = pythiaGenHeader->NTriggerJets(); - AliAODJet pythiaGenJets[4]; - TVector3 jetVectnew[4]; - Int_t iCount = 0; - for(int ip = 0;ip < nPythiaGenJets;++ip){ - if (iCount>3) break; - Float_t p[4]; - pythiaGenHeader->TriggerJet(ip,p); - TVector3 tempVect(p[0],p[1],p[2]); - if ( TMath::Abs(tempVect.Eta())>fJet1EtaCut ) continue; - pythiaGenJets[iCount].SetPxPyPzE(p[0],p[1],p[2],p[3]); - jetVectnew[iCount].SetXYZ(pythiaGenJets[iCount].Px(), pythiaGenJets[iCount].Py(), pythiaGenJets[iCount].Pz()); - iCount++; - } - - if (!iCount) return;// no jet in eta acceptance - - //Search the index of the nearest MC jet to the leading jet reconstructed from the input data - Int_t index = 0; - if (constrainDistance){ - Float_t deltaR = 0.; - Float_t dRTemp = 0.; - for (Int_t i=0; i minDistance) return; - } - - //Let's add some taste to jet and simulate pt of charged alone - //eta and phi are kept as original - //Play a Normal Distribution - Float_t random = 1.; - if (fSimulateChJetPt){ - while(1){ - random = gRandom->Gaus(0.6,0.25); - if (random > 0. && random < 1. && - (random * jetVectnew[index].Pt()>6.)) break; - } - } - - //Set new Pt & Fill histogram accordingly - Double_t maxPtJet1 = random * jetVectnew[index].Pt(); - - fHistos->FillHistogram("hEleadingPt", maxPtJet1 ); - - if (useAliStack){//Try Stack Information to perform UE analysis - - AliStack* mcStack = mcEvent->Stack();//Load Stack - Int_t nTracksMC = mcStack->GetNtrack(); - for (Int_t iTracks = 0; iTracks < nTracksMC; iTracks++) { - //Cuts - if(!(mcStack->IsPhysicalPrimary(iTracks))) continue; - - TParticle* mctrk = mcStack->Particle(iTracks); - - Double_t charge = mctrk->GetPDG()->Charge(); - Double_t pT = mctrk->Pt(); - Double_t eta = mctrk->Eta(); - Int_t pdgCode = mctrk->GetPdgCode(); - - if (!TrackMCSelected(charge, pT, eta, pdgCode))continue; - - TVector3 partVect(mctrk->Px(), mctrk->Py(), mctrk->Pz()); - Double_t deltaPhi = jetVectnew[index].DeltaPhi(partVect)+k270rad; - if( deltaPhi > 2.*TMath::Pi() ) deltaPhi-= 2.*TMath::Pi(); - fHistos->FillHistogram("hdNdEtaPhiDist",deltaPhi, maxPtJet1 ); - - fHistos->FillHistogram("hFullRegPartPtDistVsEt", mctrk->Pt(), maxPtJet1 ); - - //We are not interested on stack organization but don't loose track of info - - TVector3 tempVector = jetVectnew[0]; - jetVectnew[0] = jetVectnew[index]; - jetVectnew[index] = tempVector; - - Int_t region = IsTrackInsideRegion( jetVectnew, &partVect, conePosition ); - - if (region == 1) { - if( fMaxPartPtRegion < mctrk->Pt() ) fMaxPartPtRegion = mctrk->Pt(); - fSumPtRegionPosit += mctrk->Pt(); - fNTrackRegionPosit++; - fHistos->FillHistogram("hTransRegPartPtDistVsEt", mctrk->Pt(), maxPtJet1 ); - } - if (region == -1) { - if( fMaxPartPtRegion < mctrk->Pt() ) fMaxPartPtRegion = mctrk->Pt(); - fSumPtRegionNegat += mctrk->Pt(); - fNTrackRegionNegat++; - fHistos->FillHistogram("hTransRegPartPtDistVsEt", mctrk->Pt(), maxPtJet1 ); - } - if (region == 2){ //forward - fSumPtRegionForward += mctrk->Pt(); - fNTrackRegionForward++; - fHistos->FillHistogram("hRegForwardPartPtDistVsEt", mctrk->Pt(), maxPtJet1 ); - } - if (region == -2){ //backward - fSumPtRegionBackward += mctrk->Pt(); - fNTrackRegionBackward++; - fHistos->FillHistogram("hRegBackwardPartPtDistVsEt", mctrk->Pt(), maxPtJet1 ); - } - } //end loop on stack particles - }else{//Try mc Particle - - TClonesArray* farray = (TClonesArray*)fkAOD->FindListObject("mcparticles"); - - Int_t ntrks = farray->GetEntries(); - if (fDebug>1) AliInfo(Form("In UE MC analysis tracks %d \n",ntrks)); - for (Int_t i =0 ; i < ntrks; i++){ - AliAODMCParticle* mctrk = (AliAODMCParticle*)farray->At(i); - //Cuts - if (!(mctrk->IsPhysicalPrimary())) continue; - //if (!(mctrk->IsPrimary())) continue; - - Double_t charge = mctrk->Charge(); - Double_t pT = mctrk->Pt(); - Double_t eta = mctrk->Eta(); - Int_t pdgCode = mctrk->GetPdgCode(); - - if (!TrackMCSelected(charge, pT, eta, pdgCode))continue; - - TVector3 partVect(mctrk->Px(), mctrk->Py(), mctrk->Pz()); - - Double_t deltaPhi = jetVectnew[index].DeltaPhi(partVect)+k270rad; - if( deltaPhi > 2.*TMath::Pi() ) deltaPhi-= 2.*TMath::Pi(); - fHistos->FillHistogram("hdNdEtaPhiDist", deltaPhi, maxPtJet1 ); - - fHistos->FillHistogram("hFullRegPartPtDistVsEt", mctrk->Pt(), maxPtJet1 ); - - //We are not interested on stack organization but don't loose track of info - TVector3 tempVector = jetVectnew[0]; - jetVectnew[0] = jetVectnew[index]; - jetVectnew[index] = tempVector; - - Int_t region = IsTrackInsideRegion( jetVectnew, &partVect, conePosition ); - - if (region == 1) { //right - if( fMaxPartPtRegion < mctrk->Pt() ) fMaxPartPtRegion = mctrk->Pt(); - fSumPtRegionPosit += mctrk->Pt(); - fNTrackRegionPosit++; - fHistos->FillHistogram("hTransRegPartPtDistVsEt", mctrk->Pt(), maxPtJet1 ); - } - if (region == -1) { //left - if( fMaxPartPtRegion < mctrk->Pt() ) fMaxPartPtRegion = mctrk->Pt(); - fSumPtRegionNegat += mctrk->Pt(); - fNTrackRegionNegat++; - fHistos->FillHistogram("hTransRegPartPtDistVsEt", mctrk->Pt(), maxPtJet1 ); - } - if (region == 2){ //forward - fSumPtRegionForward += mctrk->Pt(); - fNTrackRegionForward++; - fHistos->FillHistogram("hRegForwardPartPtDistVsEt", mctrk->Pt(), maxPtJet1 ); - } - if (region == -2){ //backward - fSumPtRegionBackward += mctrk->Pt(); - fNTrackRegionBackward++; - fHistos->FillHistogram("hRegBackwardPartPtDistVsEt", mctrk->Pt(), maxPtJet1 ); - } - - }//end loop AliAODMCParticle tracks - } -} - - - -//------------------------------------------------------------------- -Bool_t AliAnalyseUE::AnaTypeSelection(TVector3 *jetVect ){ - - // Cut events by jets topology - // anaType: - // 1 = inclusive, - // - Jet1 |eta| < jet1EtaCut - // 2 = back to back inclusive - // - fulfill case 1 - // - |Jet1.Phi - Jet2.Phi| > jet2DeltaPhiCut - // - Jet2.Pt/Jet1Pt > jet2RatioPtCut - // 3 = back to back exclusive - // - fulfill case 2 - // - Jet3.Pt < jet3PtCut - - Double_t eta=jetVect[0].Eta(); - if( TMath::Abs(eta) > fJet1EtaCut) { - if( fDebug > 1 ) AliInfo("\n Skipping Event...Jet1 |eta| > fJet1EtaCut"); - return kFALSE; - } - // back to back inclusive - if( fAnaType > 1 && fAnaType < 4 && jetVect[1].Pt() < 0. ) { - if( fDebug > 1 ) AliInfo("\n Skipping Event... no second Jet found"); - return kFALSE; - } - if( fAnaType > 1 && fAnaType < 4 && jetVect[1].Pt() > 0. ) { - if( TMath::Abs(jetVect[0].DeltaPhi(jetVect[1])) < fJet2DeltaPhiCut || - jetVect[1].Pt()/jetVect[0].Pt() < fJet2RatioPtCut ) { - if( fDebug > 1 ) AliInfo("\n Skipping Event... |Jet1.Phi - Jet2.Phi| < fJet2DeltaPhiCut"); - return kFALSE; - } - } - // back to back exclusive - if( fAnaType > 2 && fAnaType < 4 && jetVect[2].Pt() > 0. ) { - if( jetVect[2].Pt() > fJet3PtCut ) { - if( fDebug > 1 ) AliInfo("\n Skipping Event... Jet3.Pt > fJet3PtCut "); - return kFALSE; - } - } - return kTRUE; -} - - -//------------------------------------------------------------------- -void AliAnalyseUE::FillRegions(Bool_t isNorm2Area, TVector3 *jetVect){ - - // Fill the different topological regions - Double_t maxPtJet1 = jetVect[0].Pt(); - static Double_t const kPI = TMath::Pi(); - static Double_t const k120rad = 120.*kPI/180.; - Double_t const kMyTolerance = 0.0000001; - - //Area for Normalization - // Forward and backward - Double_t normArea = 1.; - // Transverse - if (isNorm2Area) { - SetRegionArea(jetVect); - normArea = 2.*fTrackEtaCut*k120rad ; - } else fAreaReg = 1.; - - Double_t avePosRegion = (fNTrackRegionPosit) ? fSumPtRegionPosit/fNTrackRegionPosit : 0.; - Double_t aveNegRegion = (fNTrackRegionNegat) ? fSumPtRegionNegat/fNTrackRegionNegat : 0.; - if( avePosRegion > aveNegRegion ) { - FillAvePartPtRegion( maxPtJet1, avePosRegion/fAreaReg, aveNegRegion/fAreaReg ); - } else { - FillAvePartPtRegion( maxPtJet1, aveNegRegion/fAreaReg, avePosRegion/fAreaReg ); - } - - //How quantities will be sorted before Fill Min and Max Histogram - // 1=Plots will be CDF-like - // 2=Plots will be Marchesini-like - // 3=Minimum zone is selected as the one having lowest pt per track - if( fOrdering == 1 ) { - if( fSumPtRegionPosit > fSumPtRegionNegat ) { - FillSumPtRegion( maxPtJet1, fSumPtRegionPosit/fAreaReg, fSumPtRegionNegat/fAreaReg ); - } else { - FillSumPtRegion( maxPtJet1, fSumPtRegionNegat/fAreaReg, fSumPtRegionPosit/fAreaReg ); - } - if (fNTrackRegionPosit > fNTrackRegionNegat ) { - FillMultRegion( maxPtJet1, fNTrackRegionPosit/fAreaReg, fNTrackRegionNegat/fAreaReg, fSumPtRegionNegat/fAreaReg ); - } else { - FillMultRegion( maxPtJet1, fNTrackRegionNegat/fAreaReg, fNTrackRegionPosit/fAreaReg, fSumPtRegionPosit/fAreaReg ); - } - } else if( fOrdering == 2 ) { - if (fSumPtRegionPosit > fSumPtRegionNegat) { - FillSumPtRegion( maxPtJet1, fSumPtRegionPosit/fAreaReg, fSumPtRegionNegat/fAreaReg ); - FillMultRegion( maxPtJet1, fNTrackRegionPosit/fAreaReg, fNTrackRegionNegat/fAreaReg, fSumPtRegionNegat/fAreaReg ); - } else { - FillSumPtRegion( maxPtJet1, fSumPtRegionNegat/fAreaReg, fSumPtRegionPosit/fAreaReg ); - FillMultRegion( maxPtJet1, fNTrackRegionNegat/fAreaReg, fNTrackRegionPosit/fAreaReg, fSumPtRegionPosit/fAreaReg ); - } - } else if( fOrdering == 3 ){ - if (avePosRegion > aveNegRegion) { - FillSumPtRegion( maxPtJet1, fSumPtRegionPosit/fAreaReg, fSumPtRegionNegat/fAreaReg ); - FillMultRegion( maxPtJet1, fNTrackRegionPosit/fAreaReg, fNTrackRegionNegat/fAreaReg, fSumPtRegionNegat/fAreaReg ); - }else{ - FillSumPtRegion( maxPtJet1, fSumPtRegionNegat/fAreaReg, fSumPtRegionPosit/fAreaReg ); - FillMultRegion( maxPtJet1, fNTrackRegionNegat/fAreaReg, fNTrackRegionPosit/fAreaReg, fSumPtRegionPosit/fAreaReg ); - } - } - fHistos->FillHistogram("hRegionMaxPartPtMaxVsEt",maxPtJet1, fMaxPartPtRegion); - - // Compute pedestal like magnitudes - fHistos->FillHistogram("hRegionDiffSumPtVsEt",maxPtJet1, (TMath::Abs(fSumPtRegionPosit-fSumPtRegionNegat)/(2.0*fAreaReg))+kMyTolerance); - fHistos->FillHistogram("hRegionAveSumPtVsEt", maxPtJet1, (fSumPtRegionPosit+fSumPtRegionNegat)/(2.0*fAreaReg)); - - // Transverse as a whole - fHistos->FillHistogram("hRegTransMult", maxPtJet1, fNTrackRegionPosit + fNTrackRegionNegat, (fNTrackRegionPosit + fNTrackRegionNegat)/(2.0*fAreaReg)); - fHistos->FillHistogram("hRegTransSumPtVsMult",maxPtJet1, fNTrackRegionPosit + fNTrackRegionNegat , (fSumPtRegionNegat + fSumPtRegionPosit)/(2.0 *fAreaReg)); - - // Fill Histograms for Forward and away side w.r.t. leading jet direction - // Pt dependence - //fHistos->FillHistogram("hRegForwardSumPtVsEt",maxPtJet1, fSumPtRegionForward/normArea ); - //fHistos->FillHistogram("hRegForwardMultVsEt",maxPtJet1, fNTrackRegionForward/normArea ); - //fHistos->FillHistogram("hRegBackwardSumPtVsEt",maxPtJet1, fSumPtRegionBackward/normArea ); - //fHistos->FillHistogram("hRegBackwardMultVsEt",maxPtJet1, fNTrackRegionBackward/normArea); - - // Multiplicity dependence - fHistos->FillHistogram("hRegForwardMult", maxPtJet1, fNTrackRegionForward, fNTrackRegionForward/normArea); - fHistos->FillHistogram("hRegForwardSumPtvsMult", maxPtJet1, fNTrackRegionForward,fSumPtRegionForward/normArea); - fHistos->FillHistogram("hRegBackwardMult", maxPtJet1, fNTrackRegionBackward, fNTrackRegionBackward/normArea ); - fHistos->FillHistogram("hRegBackwardSumPtvsMult", maxPtJet1, fNTrackRegionBackward,fSumPtRegionBackward/normArea); -} - - -//------------------------------------------------------------------- -void AliAnalyseUE::FindMaxMinRegions(TVector3 *jetVect, Int_t conePosition, Int_t mctrue=0, Int_t eff=0){ - - // If mctrue = 1 consider branch AliAODMCParticles - // If eff = 1 track cuts for efficiency studies - - // Identify the different topological zones - fSumPtRegionPosit = 0.; - fSumPtRegionNegat = 0.; - fSumPtRegionForward = 0.; - fSumPtRegionBackward = 0.; - fMaxPartPtRegion = 0.; - fNTrackRegionPosit = 0; - fNTrackRegionNegat = 0; - fNTrackRegionForward = 0; - fNTrackRegionBackward = 0; - static Double_t const kPI = TMath::Pi(); - static Double_t const kTWOPI = 2.*kPI; - static Double_t const k270rad = 270.*kPI/180.; - Double_t const kMyTolerance = 0.0000001; - - Int_t nTracks=0; - TClonesArray *tca = 0; - if (!mctrue) { - nTracks = fkAOD->GetNTracks(); - if (fDebug > 1) AliInfo(Form(" ==== AOD tracks = %d \n ",nTracks)); - }else{ - tca = dynamic_cast(fkAOD->FindListObject(AliAODMCParticle::StdBranchName())); - if(!tca){ - Printf("%s:%d No AODMC Branch found !!!",(char*)__FILE__,__LINE__); - return; - } - nTracks = tca->GetEntriesFast(); - if (fDebug > 1) AliInfo(Form(" ==== AOD MC particles = %d \n ",nTracks)); - } - - //If UE task d0 distribution is not filled - Int_t flag_tmp=0; - if (fHistos->GetHistograms()->FindObject("hDCAxy")) flag_tmp = 1; - - for (Int_t ipart=0; ipart(fkAOD->GetTrack(ipart)); - part = partRECO; - } - else { - partMC = dynamic_cast(tca->At(ipart)); - part = partMC; - if(!partMC)return; - charge = partMC->Charge(); - pt = partMC->Pt(); - eta = partMC->Eta(); - pdgcode = partMC->GetPdgCode(); - suffix.Append("MC"); - } - - if(!part)return; - - if (fDebug > 1) AliInfo(Form(" ==== AOD track = %d pt = %f charge = %d \n ",ipart,part->Pt(),part->Charge())); - - // track selection - if (!mctrue && !eff ){ - if( !TrackSelected(partRECO)) continue; //track selection for data and MC reconstructed - if (flag_tmp){ - if (fkESD && fkESD->GetNumberOfTracks() ){ - AliInfo("READING ESD *************************************************"); - Int_t id = partRECO->GetID(); - AliESDtrack *trackESD; - trackESD = (AliESDtrack*)fkESD->GetTrack(id); - Float_t d0; - Float_t z; - trackESD->GetImpactParameters(d0,z); - fHistos->FillHistogram("hDCAxy", d0, jetVect[0].Pt()); - }else AliInfo("NO TRACKS ************************************************") ; - } - } - - if (!mctrue && eff){ - if (!TrackSelectedEfficiency(partRECO )) continue; //track selection for MC reconstructed for efficiency studies - if(fkESD && fkESD->GetNumberOfTracks()){ - Int_t id = partRECO->GetID(); - AliESDtrack * trackESD = (AliESDtrack*) fkESD->GetTrack(id); - Float_t d0; - Float_t z; - trackESD->GetImpactParameters(d0,z); - fHistos->FillHistogram("hDCAxyPrimary", d0, jetVect[0].Pt()); - } - } - - if (mctrue){ - if ( !(TrackMCSelected(charge, pt, eta, pdgcode) && partMC->IsPhysicalPrimary())) continue; //track selection for MC true - } - - TVector3 partVect(part->Px(), part->Py(), part->Pz()); - Bool_t isFlagPart = kTRUE; - Double_t deltaPhi = jetVect[0].DeltaPhi(partVect)+k270rad; - if( deltaPhi > kTWOPI ) deltaPhi-= kTWOPI; - if (fAnaType != 4 ) fHistos->FillHistogram(Form("hdNdEtaPhiDist%s",suffix.Data()),deltaPhi, jetVect[0].Pt()); - else if (TMath::Abs(deltaPhi-k270rad) >= kMyTolerance && TMath::Abs(jetVect[0].Eta()-partVect.Eta()) >= kMyTolerance){ - fHistos->FillHistogram(Form("hdNdEtaPhiDist%s",suffix.Data()),deltaPhi, jetVect[0].Pt()); - isFlagPart = kFALSE; - } - - fHistos->FillHistogram(Form("hFullRegPartPtDistVsEt%s",suffix.Data()), part->Pt(), jetVect[0].Pt()); - - Int_t region = IsTrackInsideRegion( jetVect, &partVect, conePosition ); - if (region == 1) { - if( fMaxPartPtRegion < part->Pt() ) fMaxPartPtRegion = part->Pt(); - fSumPtRegionPosit += part->Pt(); - fNTrackRegionPosit++; - fHistos->FillHistogram(Form("hTransRegPartPtDistVsEt%s",suffix.Data()),part->Pt(), jetVect[0].Pt()); - } - if (region == -1) { - if( fMaxPartPtRegion < part->Pt() ) fMaxPartPtRegion = part->Pt(); - fSumPtRegionNegat += part->Pt(); - fNTrackRegionNegat++; - fHistos->FillHistogram(Form("hTransRegPartPtDistVsEt%s",suffix.Data()),part->Pt(), jetVect[0].Pt()); - } - if (region == 2){ //forward - fSumPtRegionForward += part->Pt(); - fNTrackRegionForward++; - fHistos->FillHistogram(Form("hRegForwardPartPtDistVsEt%s",suffix.Data()),part->Pt(), jetVect[0].Pt()); - } - if (region == -2){ //backward - fSumPtRegionBackward += part->Pt(); - fNTrackRegionBackward++; - fHistos->FillHistogram(Form("hRegBackwardPartPtDistVsEt%s",suffix.Data()),part->Pt(), jetVect[0].Pt()); - } - }//end loop AOD tracks - -} - -//------------------------------------------------------------------- -/*TVector3 AliAnalyseUE::GetLeadingTracksMC(AliMCEvent *mcEvent){ - - fkMC = mcEvent; - - Double_t maxPtJet1 = 0.; - Int_t index1 = -1; - - TVector3 jetVect[3]; - - jetVect[0].SetPtEtaPhi(-1.,-1.,-1.); - jetVect[1].SetPtEtaPhi(-1.,-1.,-1.); - jetVect[2].SetPtEtaPhi(-1.,-1.,-1.); - - Int_t nJets = 0; - - TObjArray* tracks = SortChargedParticlesMC(); - if( tracks ) { - nJets = tracks->GetEntriesFast(); - if( nJets > 0 ) { - index1 = 0; - TParticle* jet = (TParticle*)tracks->At(0); - maxPtJet1 = jet->Pt(); - jetVect[0].SetXYZ(jet->Px(), jet->Py(), jet->Pz()); - } - tracks->Clear(); - delete tracks; - } - return *jetVect; - -} -*/ - -//------------------------------------------------------------------- -TVector3 AliAnalyseUE::GetLeadingTracksMC(AliMCEvent *mcEvent){ - - fkMC = mcEvent; - - Double_t maxPtJet1 = 0.; - Int_t index1 = -1; - - TVector3 jetVect[3]; - - jetVect[0].SetPtEtaPhi(-1.,-1.,-1.); - jetVect[1].SetPtEtaPhi(-1.,-1.,-1.); - jetVect[2].SetPtEtaPhi(-1.,-1.,-1.); - - Int_t nJets = 0; - - TObjArray* tracks = SortChargedParticlesMC(); - if( tracks ) { - nJets = tracks->GetEntriesFast(); - if( nJets > 0 ) { - index1 = 0; - AliAODMCParticle* jet = (AliAODMCParticle*)tracks->At(0); - fLtMCLabel = jet->GetLabel(); - maxPtJet1 = jet->Pt(); - jetVect[0].SetXYZ(jet->Px(), jet->Py(), jet->Pz()); - } - tracks->Clear(); - delete tracks; - } - return *jetVect; - -} - -//------------------------------------------------------------------- -TVector3 AliAnalyseUE::GetOrderedClusters(TString aodBranch, Bool_t chargedJets, Double_t chJetPtMin){ - - // jets from AOD, on-the-fly or leading particle - Double_t maxPtJet1 = 0.; - Int_t index1 = -1; - Double_t maxPtJet2 = 0.; // jet 2 need for back to back inclusive - Int_t index2 = -1; - Double_t maxPtJet3 = 0.; // jet 3 need for back to back exclusive - Int_t index3 = -1; - TVector3 jetVect[3]; - - jetVect[0].SetPtEtaPhi(-1.,-1.,-1.); - jetVect[1].SetPtEtaPhi(-1.,-1.,-1.); - jetVect[2].SetPtEtaPhi(-1.,-1.,-1.); - - Int_t nJets = 0; - //TClonesArray* fArrayJets; - TObjArray* arrayJets; - // 1) JETS FROM AOD BRANCH (standard, non-standard or delta) - if (!chargedJets && fAnaType != 4 ) { - AliInfo(" ==== Read AODs !"); - AliInfo(Form(" ==== Reading Branch: %s ", aodBranch.Data())); - arrayJets = (TObjArray*)fkAOD->GetList()->FindObject(aodBranch.Data()); - if (!arrayJets){ - AliFatal(" No jet-array! "); - return *jetVect; - } - - // Find Leading Jets 1,2,3 - // (could be skipped if Jets are sort by Pt...) - nJets=arrayJets->GetEntries(); - for( Int_t i=0; iAt(i); - Double_t jetPt = jet->Pt();//*1.666; // FIXME Jet Pt Correction ?????!!! - - if( jetPt > maxPtJet1 ) { - maxPtJet3 = maxPtJet2; index3 = index2; - maxPtJet2 = maxPtJet1; index2 = index1; - maxPtJet1 = jetPt; index1 = i; - } else if( jetPt > maxPtJet2 ) { - maxPtJet3 = maxPtJet2; index3 = index2; - maxPtJet2 = jetPt; index2 = i; - } else if( jetPt > maxPtJet3 ) { - maxPtJet3 = jetPt; index3 = i; - } - } - - if( index1 != -1 ) { - AliAODJet *jet =(AliAODJet*) arrayJets->At(index1); - if(jet)jetVect[0].SetXYZ(jet->Px(), jet->Py(), jet->Pz()); - } - if( index2 != -1 ) { - AliAODJet* jet= (AliAODJet*) arrayJets->At(index2); - if(jet)jetVect[1].SetXYZ(jet->Px(), jet->Py(), jet->Pz()); - } - if( index3 != -1 ) { - AliAODJet* jet = (AliAODJet*) arrayJets->At(index3); - if(jet)jetVect[2].SetXYZ(jet->Px(), jet->Py(), jet->Pz()); - } - - } - - - // 2) ON-THE-FLY CDF ALGORITHM - if (chargedJets){ - arrayJets = FindChargedParticleJets(chJetPtMin); - if( arrayJets ) { - nJets = arrayJets->GetEntriesFast(); - if( nJets > 0 ) { - index1 = 0; - AliAODJet* jet = (AliAODJet*)arrayJets->At(0); - maxPtJet1 = jet->Pt(); - jetVect[0].SetXYZ(jet->Px(), jet->Py(), jet->Pz()); - } - if( nJets > 1 ) { - index2 = 1; - AliAODJet* jet = (AliAODJet*)arrayJets->At(1); - maxPtJet2 = jet->Pt(); - jetVect[1].SetXYZ(jet->Px(), jet->Py(), jet->Pz()); - } - if( nJets > 2 ) { - index3 = 2; - AliAODJet* jet = (AliAODJet*)arrayJets->At(2); - maxPtJet3 = jet->Pt(); - jetVect[2].SetXYZ(jet->Px(), jet->Py(), jet->Pz()); - } - - arrayJets->Delete(); - delete arrayJets; - } - } - - - // 3) LEADING PARTICLE - if( fAnaType == 4 ){ - TObjArray* tracks = SortChargedParticles(); - if( tracks ) { - nJets = tracks->GetEntriesFast(); - if( nJets > 0 ) { - index1 = 0; - AliAODTrack* jet = (AliAODTrack*)tracks->At(0); - fLtLabel = jet->GetLabel(); - maxPtJet1 = jet->Pt(); - jetVect[0].SetXYZ(jet->Px(), jet->Py(), jet->Pz()); - } - tracks->Clear(); - delete tracks; - } - - } - fHistos->FillHistogram("hNJets",nJets); - - return *jetVect; - -} - - -//------------------------------------------------------------------- -void AliAnalyseUE::Initialize(AliAnalysisTaskUE& taskUE){ -/*void AliAnalyseUE::Initialize(AliAnalysisTask& task){// when correction task is in trunk - if (task->InheritsFrom("AliAnalysisTaskUE")){ - AliAnalysisTaskUE *taskUE = dynamic_cast task; - } - else if (task->InheritsFrom("AliAnalysisTaskCorrectionsUE")){ - AliAnalysisTaskCorrectionsUE *taskUE = dynamic_cast task; - } - -*/ - //Get principal settings from current instance of UE analysis-task - fAnaType = taskUE.GetAnaTopology(); - fkAOD = taskUE.GetAOD(); - fConeRadius = taskUE.GetConeRadius(); - fDebug = taskUE.GetDebugLevel(); - fFilterBit = taskUE.GetFilterBit(); - fJet1EtaCut = taskUE.GetJet1EtaCut(); - fJet2DeltaPhiCut = taskUE.GetJet2DeltaPhiCut(); - fJet2RatioPtCut = taskUE.GetJet2RatioPtCut(); - fJet3PtCut = taskUE.GetJet3PtCut(); - fOrdering = taskUE.GetPtSumOrdering() ; - fRegionType = taskUE.GetRegionType(); - fSimulateChJetPt = taskUE.GetSimulateChJetPt(); - fTrackEtaCut = taskUE.GetTrackEtaCut(); - fTrackPtCut = taskUE.GetTrackPtCut(); - fHistos = taskUE.fHistosUE; - fUseChargeHadrons = taskUE.GetUseChargeHadrons(); - fUseChPartJet = taskUE.GetUseChPartJet(); - fUsePositiveCharge = taskUE.GetUseNegativeChargeType(); - fUseSingleCharge = taskUE.GetUseSingleCharge(); - -} - -//------------------------------------------------------------------- -void AliAnalyseUE::Initialize(Int_t anaType, AliAODEvent* aod,Double_t coneRadius, Int_t debug, Int_t filterBit, Double_t jet1EtaCut, Double_t jet2DeltaPhiCut, Double_t jet2RatioPtCut, Double_t jet3PtCut, Int_t ordering, Int_t regionType,Bool_t simulateChJetPt, Double_t trackEtaCut, Double_t trackPtCut, Bool_t useChargeHadrons, Bool_t useChPartJet, Bool_t usePositiveCharge, Bool_t useSingleCharge, AliHistogramsUE* histos){ - - fAnaType = anaType; - fkAOD = aod; - fConeRadius = coneRadius; - fDebug = debug; - fFilterBit = filterBit; - fJet1EtaCut = jet1EtaCut; - fJet2DeltaPhiCut = jet2DeltaPhiCut; - fJet2RatioPtCut = jet2RatioPtCut; - fJet3PtCut = jet3PtCut; - fOrdering = ordering; - fRegionType = regionType; - fSimulateChJetPt = simulateChJetPt; - fTrackEtaCut = trackEtaCut; - fTrackPtCut = trackPtCut; - fUseChargeHadrons = useChargeHadrons; - fUseChPartJet = useChPartJet; - fUsePositiveCharge = usePositiveCharge; - fUseSingleCharge = useSingleCharge; - fHistos = histos; -} - - -//------------------------------------------------------------------- -Bool_t AliAnalyseUE::TriggerSelection(AliInputEventHandler* inputHandler){ - - //Use AliPhysicsSelection to select good events - if( !inputHandler->InheritsFrom("AliAODInputHandler") ) { // input AOD - if (inputHandler->IsEventSelected()) { - if (fDebug > 1) AliInfo(" Trigger Selection: event ACCEPTED ... "); - } else { - if (fDebug > 1) AliInfo(" Trigger Selection: event REJECTED ... "); - return kFALSE; - } - } - - return kTRUE; - -} - - -//------------------------------------------------------------------- -Bool_t AliAnalyseUE::VertexSelection(AliAODEvent *aod, Int_t tracks, Double_t zed ){ - - //Require 1 vertex (no TPC stand-alone) with a minimum number of tracks and z-coordinate in a limited range - Int_t nVertex = aod->GetNumberOfVertices(); - if( nVertex > 0 ) { // Only one vertex (reject pileup) - AliAODVertex* vertex = (AliAODVertex*)aod->GetPrimaryVertex(); - Int_t nTracksPrim = vertex->GetNContributors(); - Double_t zVertex = vertex->GetZ(); - if (fDebug > 1) AliInfo(Form(" Vertex in = %f with %d particles by %s data ...",zVertex,nTracksPrim,vertex->GetName())); - // Select a quality vertex by number of tracks? - if( nTracksPrim < tracks || TMath::Abs(zVertex) > zed ) { - if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ..."); - return kFALSE; - } - if (fDebug > 1) AliInfo(" Primary-vertex Selection: event ACCEPTED..."); - } else { - if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ..."); - return kFALSE; - } - - return kTRUE; -} - -//------------------------------------------------------------------- -Bool_t AliAnalyseUE::VertexSelectionOld(AliAODEvent *aod ){ - - AliKFVertex primVtx(*(aod->GetPrimaryVertex())); - Int_t nTracksPrim=primVtx.GetNContributors(); - if (fDebug > 1) AliInfo(Form(" Primary-vertex Selection: %d",nTracksPrim)); - if(!nTracksPrim){ - if (fDebug > 1) AliInfo(" Primary-vertex Selection: event REJECTED ..."); - return kFALSE; - } - if (fDebug > 1) AliInfo(" Primary-vertex Selection: event ACCEPTED ..."); - - return kTRUE; -} - -// PRIVATE METHODS ************************************************** - -TObjArray* AliAnalyseUE::FindChargedParticleJets( Double_t chJetPtMin ) -{ - // Return a TObjArray of "charged particle jets" - - // Charged particle jet definition from reference: - // "Charged jet evolution and the underlying event - // in proton-antiproton collisions at 1.8 TeV" - // PHYSICAL REVIEW D 65 092002, CDF Collaboration - - // We defined "jets" as circular regions in eta-phi space with - // radius defined by R = sqrt( (eta-eta0)^2 +(phi-phi0)^2 ). - // Our jet algorithm is as follows: - // 1- Order all charged particles according to their pT . - // 2- Start with the highest pT particle and include in the jet all - // particles within the radius R=0.7 considering each particle - // in the order of decreasing pT and recalculating the centroid - // of the jet after each new particle is added to the jet . - // 3- Go to the next highest pT particle not already included in - // a jet and add to the jet all particles not already included in - // a jet within R=0.7. - // 4- Continue until all particles are in a jet. - // We defined the transverse momentum of the jet to be - // the scalar pT sum of all the particles within the jet, where pT - // is measured with respect to the beam axis - - // 1 - Order all charged particles according to their pT . - Int_t nTracks = fkAOD->GetNTracks(); - if( !nTracks ) return 0; - TObjArray tracks(nTracks); - - for (Int_t ipart=0; ipartGetTrack( ipart ); - if( !part->TestFilterBit(fFilterBit) ) continue; // track cut selection - if( !part->Charge() ) continue; - if( part->Pt() < fTrackPtCut ) continue; - tracks.AddLast(part); - } - QSortTracks( tracks, 0, tracks.GetEntriesFast() ); - - nTracks = tracks.GetEntriesFast(); - if( !nTracks ) return 0; - - TObjArray *jets = new TObjArray(nTracks); - TIter itrack(&tracks); - while( nTracks ) { - // 2- Start with the highest pT particle ... - Float_t px,py,pz,pt; - AliAODTrack* track = (AliAODTrack*)itrack.Next(); - if( !track ) continue; - px = track->Px(); - py = track->Py(); - pz = track->Pz(); - pt = track->Pt(); // Use the energy member to store Pt - jets->AddLast( new TLorentzVector(px, py, pz, pt) ); - tracks.Remove( track ); - TLorentzVector* jet = (TLorentzVector*)jets->Last(); - jet->SetPtEtaPhiE( 1., jet->Eta(), jet->Phi(), pt ); - // 3- Go to the next highest pT particle not already included... - AliAODTrack* track1; - Double_t fPt = jet->E(); - while ( (track1 = (AliAODTrack*)(itrack.Next())) ) { - Double_t tphi = track1->Phi(); // here Phi is from 0 <-> 2Pi - if (tphi > TMath::Pi()) tphi -= 2. * TMath::Pi(); // convert to -Pi <-> Pi - Double_t dphi = TVector2::Phi_mpi_pi(jet->Phi()-tphi); - Double_t r = TMath::Sqrt( (jet->Eta()-track1->Eta())*(jet->Eta()-track1->Eta()) +dphi*dphi ); - if( r < fConeRadius ) { - fPt = jet->E()+track1->Pt(); // Scalar sum of Pt - // recalculating the centroid - Double_t eta = jet->Eta()*jet->E()/fPt + track1->Eta()*track1->Pt()/fPt; - Double_t phi = jet->Phi()*jet->E()/fPt + tphi*track1->Pt()/fPt; - jet->SetPtEtaPhiE( 1., eta, phi, fPt ); - tracks.Remove( track1 ); - } - } - - tracks.Compress(); - nTracks = tracks.GetEntries(); - // 4- Continue until all particles are in a jet. - itrack.Reset(); - } // end while nTracks - - // Convert to AODjets.... - Int_t njets = jets->GetEntriesFast(); - TObjArray* aodjets = new TObjArray(njets); - aodjets->SetOwner(kTRUE); - for(Int_t ijet=0; ijetAt(ijet); - if (jet->E() < chJetPtMin) continue; - Float_t px, py,pz,en; // convert to 4-vector - px = jet->E() * TMath::Cos(jet->Phi()); // Pt * cos(phi) - py = jet->E() * TMath::Sin(jet->Phi()); // Pt * sin(phi) - pz = jet->E() / TMath::Tan(2.0 * TMath::ATan(TMath::Exp(-jet->Eta()))); - en = TMath::Sqrt(px * px + py * py + pz * pz); - - aodjets->AddLast( new AliAODJet(px, py, pz, en) ); - } - jets->Delete(); - delete jets; - - // Order jets according to their pT . - QSortTracks( *aodjets, 0, aodjets->GetEntriesFast() ); - - // debug - if (fDebug>3) AliInfo(Form(" %d Charged jets found\n",njets)); - - return aodjets; -} - - -//____________________________________________________________________ -void AliAnalyseUE::FillAvePartPtRegion( Double_t leadingE, Double_t ptMax, Double_t ptMin ) -{ - - // Fill average particle Pt of control regions - - // Max cone - fHistos->FillHistogram("hRegionAvePartPtMaxVsEt", leadingE, ptMax); - // Min cone - fHistos->FillHistogram("hRegionAvePartPtMinVsEt", leadingE, ptMin); - // MAke distributions for UE comparison with MB data - fHistos->FillHistogram("hMinRegAvePt", ptMin); - -} - -//____________________________________________________________________ -void AliAnalyseUE::FillMultRegion( Double_t leadingE, Double_t nTrackPtmax, Double_t nTrackPtmin, Double_t ptMin ) -{ - - // Fill Nch multiplicity of control regions - - // Max cone - fHistos->FillHistogram("hRegionMultMaxVsEt", leadingE, nTrackPtmax); - fHistos->FillHistogram("hRegionMultMax", nTrackPtmax); - - // Min cone - fHistos->FillHistogram("hRegionMultMinVsEt", leadingE, nTrackPtmin ); - fHistos->FillHistogram("hRegionMultMin", nTrackPtmin); - - // MAke distributions for UE comparison with MB data - fHistos->FillHistogram("hMinRegSumPtvsMult", nTrackPtmin,ptMin); - -} - -//____________________________________________________________________ -void AliAnalyseUE::FillSumPtRegion( Double_t leadingE, Double_t ptMax, Double_t ptMin ) -{ - // Fill sumPt of control regions - - // Max cone - fHistos->FillHistogram("hRegionSumPtMaxVsEt", leadingE, ptMax); - - // Min cone - fHistos->FillHistogram("hRegionSumPtMinVsEt", leadingE, ptMin); - - // MAke distributions for UE comparison with MB data - fHistos->FillHistogram("hMinRegSumPt", ptMin); - fHistos->FillHistogram("hMinRegSumPtJetPtBin", leadingE, ptMin); - fHistos->FillHistogram("hMaxRegSumPtJetPtBin", leadingE, ptMax); - -} - -//------------------------------------------------------------------- -Int_t AliAnalyseUE::IsTrackInsideRegion(TVector3 *jetVect, TVector3 *partVect, Int_t conePosition) -{ - // return de region in delta phi - // -1 negative delta phi - // 1 positive delta phi - // 0 outside region - static const Double_t k60rad = 60.*TMath::Pi()/180.; - static const Double_t k120rad = 120.*TMath::Pi()/180.; - - Int_t region = 0; - if( fRegionType == 1 ) { - if( TMath::Abs(partVect->Eta()) > fTrackEtaCut ) return 0; - // transverse regions - if (jetVect[0].DeltaPhi(*partVect) < -k60rad && jetVect[0].DeltaPhi(*partVect) > -k120rad ) region = -1; //left - if (jetVect[0].DeltaPhi(*partVect) > k60rad && jetVect[0].DeltaPhi(*partVect) < k120rad ) region = 1; //right - if (TMath::Abs(jetVect[0].DeltaPhi(*partVect)) < k60rad ) region = 2; //forward - if (TMath::Abs(jetVect[0].DeltaPhi(*partVect)) > k120rad ) region = -2; //backward - - } else if( fRegionType == 2 ) { - // Cone regions - Double_t deltaR = 0.; - - TVector3 positVect,negatVect; - if (conePosition==1){ - positVect.SetMagThetaPhi(1, 2.*atan(exp(-jetVect[0].Eta())), jetVect[0].Phi()+TMath::PiOver2()); - negatVect.SetMagThetaPhi(1, 2.*atan(exp(-jetVect[0].Eta())), jetVect[0].Phi()-TMath::PiOver2()); - }else if (conePosition==2){ - if(fAnaType<2) AliFatal("Prevent error in Analysis type there might be only 1 jet. To avoid overflow better Correct UE config"); - positVect.SetMagThetaPhi(1, 2.*atan(exp(-(jetVect[0].Eta()+jetVect[1].Eta())/2.)), jetVect[0].Phi()+TMath::PiOver2()); - negatVect.SetMagThetaPhi(1, 2.*atan(exp(-(jetVect[0].Eta()+jetVect[1].Eta())/2.)), jetVect[0].Phi()-TMath::PiOver2()); - }else if (conePosition==3){ - if(fAnaType<2) AliFatal("Prevent error in Analysis type there might be only 1 jet. To avoid overflow better Correct UE config"); - Double_t weightEta = jetVect[0].Eta() * jetVect[0].Pt()/(jetVect[0].Pt() + jetVect[1].Pt()) + - jetVect[1].Eta() * jetVect[1].Pt()/(jetVect[0].Pt() + jetVect[1].Pt()); - //Double_t weightEta = jetVect[0].Eta() * jetVect[0].Mag()/(jetVect[0].Mag() + jetVect[1].Mag()) + - // jetVect[1].Eta() * jetVect[1].Mag()/(jetVect[0].Mag() + jetVect[1].Mag()); - positVect.SetMagThetaPhi(1, 2.*atan(exp(-weightEta)), jetVect[0].Phi()+TMath::PiOver2()); - negatVect.SetMagThetaPhi(1, 2.*atan(exp(-weightEta)), jetVect[0].Phi()-TMath::PiOver2()); - } - if (TMath::Abs(positVect.DeltaPhi(*partVect)) < fConeRadius ) { - region = 1; - deltaR = positVect.DrEtaPhi(*partVect); - } else if (TMath::Abs(negatVect.DeltaPhi(*partVect)) < fConeRadius) { - region = -1; - deltaR = negatVect.DrEtaPhi(*partVect); - } - - if (deltaR > fConeRadius) region = 0; - - } else - AliError("Unknow region type"); - - return region; - } - - - -//------------------------------------------------------------------- -void AliAnalyseUE::QSortTracks(TObjArray &a, Int_t first, Int_t last) -{ - // Sort array of TObjArray of tracks by Pt using a quicksort algorithm. - - static TObject *tmp; - static int i; // "static" to save stack space - int j; - - while (last - first > 1) { - i = first; - j = last; - for (;;) { - while (++i < last && ((AliVParticle*)a[i])->Pt() > ((AliVParticle*)a[first])->Pt() ) - ; - while (--j > first && ((AliVParticle*)a[j])->Pt() < ((AliVParticle*)a[first])->Pt() ) - ; - if (i >= j) - break; - - tmp = a[i]; - a[i] = a[j]; - a[j] = tmp; - } - if (j == first) { - ++first; - continue; - } - tmp = a[first]; - a[first] = a[j]; - a[j] = tmp; - if (j - first < last - (j + 1)) { - QSortTracks(a, first, j); - first = j + 1; // QSortTracks(j + 1, last); - } else { - QSortTracks(a, j + 1, last); - last = j; // QSortTracks(first, j); - } - } -} - - -//------------------------------------------------------------------- -void AliAnalyseUE::QSortTracksMC(TObjArray &a, Int_t first, Int_t last) -{ - // Sort array of TObjArray of tracks by Pt using a quicksort algorithm. - - static TObject *tmp; - static int i; // "static" to save stack space - int j; - - while (last - first > 1) { - i = first; - j = last; - for (;;) { - while (++i < last && ((AliAODMCParticle*)a[i])->Pt() > ((AliAODMCParticle*)a[first])->Pt() ) - ; - while (--j > first && ((AliAODMCParticle*)a[j])->Pt() < ((AliAODMCParticle*)a[first])->Pt() ) - ; - if (i >= j) - break; - - tmp = a[i]; - a[i] = a[j]; - a[j] = tmp; - } - if (j == first) { - ++first; - continue; - } - tmp = a[first]; - a[first] = a[j]; - a[j] = tmp; - if (j - first < last - (j + 1)) { - QSortTracksMC(a, first, j); - first = j + 1; // QSortTracks(j + 1, last); - } else { - QSortTracksMC(a, j + 1, last); - last = j; // QSortTracks(first, j); - } - } -} - - - - - -//------------------------------------------------------------------- -void AliAnalyseUE::SetRegionArea(TVector3 *jetVect) -{ - // Set region area - Double_t areaCorrFactor=0.; - Double_t deltaEta = 0.; - if (fRegionType==1) fAreaReg = 2.*fTrackEtaCut*60.*TMath::Pi()/180.; - else if (fRegionType==2){ - deltaEta = 0.9-TMath::Abs(jetVect[0].Eta()); - if (deltaEta>fConeRadius) fAreaReg = TMath::Pi()*fConeRadius*fConeRadius; - else{ - areaCorrFactor = fConeRadius*fConeRadius*TMath::ACos(deltaEta/fConeRadius) - - (deltaEta*fConeRadius)*TMath::Sqrt( 1. - deltaEta*deltaEta/(fConeRadius*fConeRadius)); - fAreaReg=TMath::Pi()*fConeRadius*fConeRadius-areaCorrFactor; - } - }else AliWarning("Unknown Region Type"); - if (fDebug>10) AliInfo(Form("\n dEta=%5.3f Angle =%5.3f Region Area = %5.3f Corr Factor=%5.4f \n",deltaEta,TMath::ACos(deltaEta/fConeRadius),fAreaReg,areaCorrFactor)); -} - - -//____________________________________________________________________ -TObjArray* AliAnalyseUE::SortChargedParticles() -{ - // return an array with all charged particles ordered according to their pT . - Int_t nTracks = fkAOD->GetNTracks(); - if( !nTracks ) return 0; - TObjArray* tracks = new TObjArray(nTracks); - - for (Int_t ipart=0; ipartGetTrack( ipart ); - if( !part->TestFilterBit( fFilterBit ) ) continue; // track cut selection - if( !part->Charge() ) continue; - if( part->Pt() < fTrackPtCut ) continue; - tracks->AddLast( part ); - } - QSortTracks( *tracks, 0, tracks->GetEntriesFast() ); - - nTracks = tracks->GetEntriesFast(); - if( !nTracks ) return 0; - - return tracks; - } - -//____________________________________________________________________ -/*TObjArray* AliAnalyseUE::SortChargedParticlesMC() -{ - // return an array with all charged particles ordered according to their pT . - AliStack *mcStack = fkMC->Stack(); - Int_t nTracks = mcStack->GetNtrack(); - if( !nTracks ) return 0; - TObjArray* tracks = new TObjArray(nTracks); - - for (Int_t ipart=0; ipartIsPhysicalPrimary(ipart))) continue; - TParticle *part = mcStack->Particle(ipart); - - if( !part->GetPDG()->Charge() ) continue; - if( part->Pt() < fTrackPtCut ) continue; - tracks->AddLast( part ); - } - QSortTracksMC( *tracks, 0, tracks->GetEntriesFast() ); - - nTracks = tracks->GetEntriesFast(); - if( !nTracks ) return 0; - - return tracks; - } -*/ - -//____________________________________________________________________ -TObjArray* AliAnalyseUE::SortChargedParticlesMC() -{ - // return an array with all charged particles ordered according to their pT . - TClonesArray *tca = dynamic_cast(fkAOD->FindListObject(AliAODMCParticle::StdBranchName())); - if(!tca){ - Printf("No branch!!!"); - return 0; - } - Int_t nTracks = tca->GetEntriesFast(); - if( !nTracks ) return 0; - TObjArray* tracks = new TObjArray(nTracks); - - for (Int_t ipart=0; ipart(tca->At(ipart)); - if(!part)continue; - if(!part->IsPhysicalPrimary())continue; - if( part->Pt() < fTrackPtCut ) continue; - if(!part->Charge()) continue; - tracks->AddLast( part ); - } - QSortTracksMC( *tracks, 0, tracks->GetEntriesFast() ); - - nTracks = tracks->GetEntriesFast(); - if( !nTracks ) return 0; - - return tracks; - } - - -//____________________________________________________________________ -Bool_t AliAnalyseUE::TrackMCSelected(Double_t charge, Double_t pT, Double_t eta, Int_t pdgCode)const{ - - // MC track selection - Double_t const kMyTolerance = 0.0000001; - //if (charge == 0. || charge == -99.) return kFALSE; - if (charge < kMyTolerance || charge + 99 < kMyTolerance) return kFALSE; - - if ( fUseSingleCharge ) { // Charge selection - if ( fUsePositiveCharge && charge < 0.) return kFALSE; // keep Positives - if ( !fUsePositiveCharge && charge > 0.) return kFALSE; // keep Negatives - } - - //Kinematics cuts on particle - if ((pT < fTrackPtCut) || (TMath::Abs(eta) > fTrackEtaCut )) return kFALSE; - - Bool_t isHadron = TMath::Abs(pdgCode)==211 || - TMath::Abs(pdgCode)==2212 || - TMath::Abs(pdgCode)==321; - - if ( fUseChargeHadrons && !isHadron ) return kFALSE; - - return kTRUE; - -} - -//____________________________________________________________________ -Bool_t AliAnalyseUE::TrackSelected(AliAODTrack* part)const{ - - // Real track selection - if ( !part->TestFilterBit(fFilterBit) ) return kFALSE; // track cut selection - if ( !part->IsPrimaryCandidate()) return kFALSE; // reject whatever is not linked to collision point - // PID Selection: Reject everything but hadrons - Bool_t isHadron = part->GetMostProbablePID()==AliAODTrack::kPion || - part->GetMostProbablePID()==AliAODTrack::kKaon || - part->GetMostProbablePID()==AliAODTrack::kProton; - if ( fUseChargeHadrons && !isHadron ) return kFALSE; - - if ( !part->Charge() ) return kFALSE; //Only charged - if ( fUseSingleCharge ) { // Charge selection - if ( fUsePositiveCharge && part->Charge() < 0.) return kFALSE; // keep Positives - if ( !fUsePositiveCharge && part->Charge() > 0.) return kFALSE; // keep Negatives - } - - if ( part->Pt() < fTrackPtCut ) return kFALSE; - if( TMath::Abs(part->Eta()) > fTrackEtaCut ) return kFALSE; - - return kTRUE; -} - -//____________________________________________________________________ -Bool_t AliAnalyseUE::TrackSelectedEfficiency(AliAODTrack* part)const{ - - if (!fStack) AliWarning("Attention: stack not set from mother task"); - // Real track selection - if ( !part->TestFilterBit(fFilterBit) ) return kFALSE; // track cut selection - if ( !part->IsPrimaryCandidate()) return kFALSE; // reject whatever is not linked to collision point - // PID Selection: Reject everything but hadrons - Bool_t isHadron = part->GetMostProbablePID()==AliAODTrack::kPion || - part->GetMostProbablePID()==AliAODTrack::kKaon || - part->GetMostProbablePID()==AliAODTrack::kProton; - if ( fUseChargeHadrons && !isHadron ) return kFALSE; - - if ( !part->Charge() ) return kFALSE; //Only charged - if ( fUseSingleCharge ) { // Charge selection - if ( fUsePositiveCharge && part->Charge() < 0.) return kFALSE; // keep Positives - if ( !fUsePositiveCharge && part->Charge() > 0.) return kFALSE; // keep Negatives - } - - /*if ( part->Pt() < fTrackPtCut ) return kFALSE; - if( TMath::Abs(part->Eta()) > fTrackEtaCut ) return kFALSE;*/ - - //Check if there was a primary fulfilling the required cuts - Double_t charge=-999.; - Double_t pt=-999.; - Double_t eta=-999.; - Int_t pdgcode=-999; - - Int_t label = part->GetLabel(); - TClonesArray *tca=0; - tca = dynamic_cast(fkAOD->FindListObject(AliAODMCParticle::StdBranchName())); - if(!tca)return kFALSE; - //TParticle *partMC = fStack->ParticleFromTreeK(label); - AliAODMCParticle *partMC=dynamic_cast(tca->At(TMath::Abs(label))); - if(!partMC)return kFALSE; - if (!partMC->IsPhysicalPrimary())return kFALSE; - //charge = ((TParticlePDG*)partMC->GetPDG())->Charge(); - charge = partMC->Charge(); - pt = partMC->Pt(); - eta = partMC->Eta(); - pdgcode = partMC->GetPdgCode(); - - if (!TrackMCSelected(charge, pt, eta, pdgcode)) return kFALSE; - return kTRUE; -} - - diff --git a/PWGJE/AliAnalyseUE.h b/PWGJE/AliAnalyseUE.h deleted file mode 100644 index 3774b46b660..00000000000 --- a/PWGJE/AliAnalyseUE.h +++ /dev/null @@ -1,161 +0,0 @@ -//-*- Mode: C++ -*- -#ifndef ALIANALYSEUE_H -#define ALIANALYSEUE_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -//////////////////////////////////////////////// -//--------------------------------------------- -// Class for transverse regions analysis -//--------------------------------------------- -//////////////////////////////////////////////// - -// --- ROOT system --- -#include - -class AliAnalysisTaskUE; -class AliAODEvent; -class AliESDEvent; -class AliAODTrack; -class AliGenPythiaEventHeader; -class AliHistogramsUE; -class AliInputEventHandler; -class AliMCEvent; -class AliStack; -class TVector3; -class TTree; - -class AliAnalyseUE : public TObject { - - public: - - AliAnalyseUE(); //constructor - AliAnalyseUE(const AliAnalyseUE & g); //copy constructor - AliAnalyseUE & operator = (const AliAnalyseUE & g); //assignment operator - virtual ~AliAnalyseUE(); //virtual destructor - - void AnalyseMC(TVector3 *jetVect, AliMCEvent *mcEvent, AliGenPythiaEventHeader *pythiaGenHeader, Int_t conePosition, Bool_t useAliStack, Bool_t constrainDistance, Double_t minDistance); - Bool_t AnaTypeSelection(TVector3 *jetVect); - - void FillRegions(Bool_t isNorm2Area, TVector3 *jetVect); - - void FindMaxMinRegions(TVector3 *jetVect, Int_t conePosition, Int_t mctrue, Int_t eff); - - TVector3 GetOrderedClusters(TString aodBranch, Bool_t chargedJets, Double_t chJetPtMin); - - TVector3 GetLeadingTracksMC(AliMCEvent *mcEvent); - //leading track label - virtual Int_t GetLtLabel() const { return fLtLabel; } - virtual Int_t GetLtMCLabel() const { return fLtMCLabel; } - - void Initialize(AliAnalysisTaskUE& tmp); - //void Initialize(AliAnalysisTask& tmp); - - void Initialize(Int_t anaType, AliAODEvent* aod,Double_t coneRadius, Int_t debug, Int_t filterBit, Double_t jet1EtaCut, Double_t jet2DeltaPhiCut, Double_t jet2RatioPtCut, Double_t jet3PtCut, Int_t ordering, Int_t regionType,Bool_t simulateChJetPt, Double_t trackEtaCut, Double_t trackPtCut, Bool_t useChargeHadrons, Bool_t useChPartJet, Bool_t usePositiveCharge, Bool_t useSingleCharge, AliHistogramsUE* histos); - - Bool_t TriggerSelection(AliInputEventHandler* input); - - Bool_t VertexSelection(AliAODEvent *value, Int_t tracks, Double_t zed); - - Bool_t VertexSelectionOld(AliAODEvent *value); - - void WriteSettings(); - - // Various setters when you do not want to initialize members from AliAnalysisTaskUE - void SetAnaTopology(Int_t value) { fAnaType = value; } - void SetAOD(AliAODEvent *value) { fkAOD = value; } - void SetConeRadius(Double_t value) { fConeRadius = value; } - void SetDebug(Int_t value) { fDebug = value; } - void SetESDEvent(AliESDEvent *value) { fkESD = value; } - void SetFilterBit(Int_t value) { fFilterBit = value; } - void SetJet1EtaCut(Double_t value) { fJet1EtaCut = value; } - void SetJet2DeltaPhiCut(Double_t value) { fJet2DeltaPhiCut = value; } - void SetJet2RatioPtCut(Double_t value) { fJet2RatioPtCut = value; } - void SetJet3PtCut(Double_t value) { fJet3PtCut = value; } - void SetOrdering(Int_t value) { fOrdering = value; } - void SetRegionType(Int_t value) { fRegionType = value; } - void SetSimulateChJetPt(Bool_t value) { fSimulateChJetPt = value; } - void SetTrackEtaCut(Double_t value) { fTrackEtaCut = value; } - void SetTrackPtCut(Double_t value) { fTrackPtCut = value; } - void SetUseChargeHadrons(Bool_t value) { fUseChargeHadrons = value; } - void SetUseChPartJet(Bool_t value) { fUseChPartJet = value; } - void SetUsePositiveCharge(Bool_t value) { fUsePositiveCharge = value; } - void SetUseSingleCharge(Bool_t value) { fUseSingleCharge = value; } - - void SetStack(AliStack* value) { fStack = value; } - private: - - void FillAvePartPtRegion( Double_t leadingE, Double_t ptMax, Double_t ptMin ); - void FillMultRegion( Double_t leadingE, Double_t nTrackPtmax, Double_t nTrackPtmin, Double_t ptMin ); - void FillSumPtRegion( Double_t leadingE, Double_t ptMax, Double_t ptMin ); - TObjArray* FindChargedParticleJets( Double_t chJetPtMin); - Int_t IsTrackInsideRegion(TVector3 *jetVect, TVector3 *partVect, Int_t conePosition); - void QSortTracks(TObjArray &a, Int_t first, Int_t last); - void QSortTracksMC(TObjArray &a, Int_t first, Int_t last); - void SetRegionArea(TVector3 *jetVect); - TObjArray* SortChargedParticles(); - TObjArray* SortChargedParticlesMC(); - virtual Bool_t TrackSelected(AliAODTrack* part) const; - virtual Bool_t TrackSelectedEfficiency(AliAODTrack* part) const; - virtual Bool_t TrackMCSelected(Double_t charge, Double_t pT, Double_t eta, Int_t pdgCode) const; - - - //AliAnalysisTaskUE fTaskUE; // current instance of the analysis-task - const AliAODEvent* fkAOD; //! AOD Event - AliMCEvent* fkMC; //! MC Event - AliESDEvent* fkESD; //! ESD Event (only needed to get track DCA) - Int_t fDebug; // Debug flag - - - // For MC - Bool_t fSimulateChJetPt; // Naive simulation of charged jet Pt from original Jet in MC Header - AliStack* fStack; // Instance of MC Particle Stack - - // Cuts UE analysis - Int_t fAnaType; // Analysis type on jet topology: - Double_t fAreaReg; // Area of the region To be used as normalization factor when filling histograms - Double_t fConeRadius; // if selected Cone-like region type, set Radius (=0.7 default) - UInt_t fFilterBit; // Select tracks from an specific track cut (default 0xFF all track selected) - Int_t fRegionType; // 1 = transverse regions (default) - // 2 = cone regions - Bool_t fUseChargeHadrons; // Only use charge hadrons - Bool_t fUseChPartJet; // Use "Charged Particle Jet" instead of jets from AOD see FindChargedParticleJets() - - Bool_t fUsePositiveCharge; //If Single type of charge used then set which one (=kTRUE default positive) - Bool_t fUseSingleCharge; //Make analysis for a single type of charge (=kFALSE default) - - Int_t fOrdering; // Pt and multiplicity summation ordering: - - // Jet cuts - Double_t fJet1EtaCut; // |jet1 eta| < fJet1EtaCut (fAnaType = 1,2,3) - Double_t fJet2DeltaPhiCut; // |Jet1.Phi - Jet2.Phi| < fJet2DeltaPhiCut (fAnaType = 2,3) - Double_t fJet2RatioPtCut; // Jet2.Pt/Jet1Pt > fJet2RatioPtCut (fAnaType = 2,3) - Double_t fJet3PtCut; // Jet3.Pt < fJet3PtCut (fAnaType = 3) - - // track cuts - Double_t fTrackEtaCut; // Eta cut on tracks in the regions (fRegionType=1) - Double_t fTrackPtCut; // Pt cut of tracks in the regions - AliHistogramsUE* fHistos; // Pointer to histogram class - - //to fill the different regions - Double_t fSumPtRegionPosit; // Sum pT in positive region - Double_t fSumPtRegionNegat; // Sum pT in negative region - Double_t fSumPtRegionForward; // Sum pT in forward region - Double_t fSumPtRegionBackward; // Sum pT in backward region - Double_t fMaxPartPtRegion; // Max part pt in region - Int_t fNTrackRegionPosit; // Tracks in positive region - Int_t fNTrackRegionNegat; // Tracks in negative region - Int_t fNTrackRegionForward; // Track in forward region - Int_t fNTrackRegionBackward;// Tracks in backward region - - //Store analysis settings - TTree* fSettingsTree; // To store analysis settings - - //Leading track labels - Int_t fLtLabel; // Label of reconstructed leading track - Int_t fLtMCLabel; // Label of true leading track - - - ClassDef(AliAnalyseUE,0) -}; -#endif diff --git a/PWGJE/AliAnalysisTaskCorrectionsUE.cxx b/PWGJE/AliAnalysisTaskCorrectionsUE.cxx deleted file mode 100644 index 7c95938eb65..00000000000 --- a/PWGJE/AliAnalysisTaskCorrectionsUE.cxx +++ /dev/null @@ -1,649 +0,0 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -/* $Id:$ */ - -//////////////////////////////////////////////////////////////////////// -// -// Analysis class to Correct Underlying Event studies -// -// This class needs as input ESDs. -// The output is an analysis-specific container. -// -// The class is used to get the contamination from secondaries -// from tracks DCA distribution -// as function of track pT and pseudo-rapidity. -// It provides additional information for the corrections -// that can not be retrieved by the AliAnalysisTaskLeadingTackUE -// task, which is running on AODs. -// -//////////////////////////////////////////////////////////////////////// - -#include -#include -//#include -//#include -#include -#include -//#include -#include -//#include -#include - -#include "AliAnalyseLeadingTrackUE.h" -#include "AliAnalysisFilter.h" -#include "AliAnalysisHelperJetTasks.h" -#include "AliAnalysisManager.h" -#include "AliAnalysisTaskCorrectionsUE.h" -#include "AliAODHandler.h" -#include "AliESDHandler.h" -#include "AliESDtrack.h" -#include "AliESDtrackCuts.h" -#include "AliESDEvent.h" -#include "AliAODInputHandler.h" -#include "AliESDInputHandler.h" -#include "AliCFContainer.h" -#include "AliCFManager.h" -#include "AliGenDPMjetEventHeader.h" -#include "AliGenPythiaEventHeader.h" -#include "AliInputEventHandler.h" -#include "AliLog.h" -#include "AliMCEventHandler.h" -#include "AliAnalysisHelperJetTasks.h" - -class TCanvas; -class TFile; -class TProfile; -class TVector3; - -ClassImp( AliAnalysisTaskCorrectionsUE) - -// Define global pointer -AliAnalysisTaskCorrectionsUE* AliAnalysisTaskCorrectionsUE::fgTaskCorrectionsUE=NULL; - -//____________________________________________________________________ -AliAnalysisTaskCorrectionsUE:: AliAnalysisTaskCorrectionsUE(const char* name): -AliAnalysisTask(name,""), -fAnalyseUE(0x0), -fDebug(0), -fESDEvent(0x0), -fESDHandler(0x0), -fInputHandler(0x0), -fListOfHistos(0x0), -fMcEvent(0x0), -fMcHandler(0x0), -fMode(0), -fOutCFcont(0x0), -fhEntries(0x0), -fhFakes(0x0), -fhPtMCAll(0x0), -fhPtMCPrim(0x0), -fhPtMCSec(0x0), -fhPtMCPrimFake(0x0), -fhPtMCSecFake(0x0), -fnTracksVertex(1), // QA tracks pointing to principal vertex -fZVertex(10.), -fhVertexContributors(0x0), -fhVertexReso(0x0), -fTrackEtaCut(0.9), -fTrackPtCut(0.), -fEsdTrackCuts(0x0), -fEsdTrackCutsSPD(0x0), -fEsdTrackCutsSDD(0x0), -fEsdTrackCutsDCA(0x0) -{ - // Default constructor - // Define input and output slots here - // Input slot #0 works with a TChain - DefineInput(0, TChain::Class()); - // Output slot #0 writes into a TList container - DefineOutput(0, TList::Class()); - -} - -//______________________________________________________________ -AliAnalysisTaskCorrectionsUE & AliAnalysisTaskCorrectionsUE::operator = (const AliAnalysisTaskCorrectionsUE & /*source*/) -{ - // assignment operator - return *this; -} - - -/************** INTERFACE METHODS *****************************/ - -//______________________________________________________________ -Bool_t AliAnalysisTaskCorrectionsUE::Notify() -{ - - return kTRUE; - -} - -//____________________________________________________________________ -void AliAnalysisTaskCorrectionsUE::ConnectInputData(Option_t* /*option*/) -{ - // Connect the input data - - if (fDebug > 1) AliInfo("ConnectInputData() "); - - //Get the input handler - fESDHandler = (AliESDInputHandler*)AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler(); - if ( !fESDHandler && fDebug > 0 ) { - AliFatal(" No ESD event handler connected !!! "); - return; - } - - //Get ESD event - fESDEvent = (AliESDEvent*)fESDHandler->GetEvent(); - if (!fESDEvent && fDebug > 1) { - AliFatal(" No ESD event retrieved !!! "); - return; - } - - //Get MC handler - fMcHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); - - // Define track cuts - fEsdTrackCuts = new AliESDtrackCuts("ITSTPC", "ITS+TPC standard 2009 cuts w.o. SPD cluster requirement nor DCA cut"); - // TPC - fEsdTrackCuts->SetRequireTPCStandAlone(kTRUE); // to get chi2 and ncls of kTPCin - fEsdTrackCuts->SetMinNClustersTPC(70); - //fEsdTrackCuts->SetMinNClustersTPC(90); // ***** TMP ***** - fEsdTrackCuts->SetMaxChi2PerClusterTPC(4); - fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE); - fEsdTrackCuts->SetRequireTPCRefit(kTRUE); - // ITS - fEsdTrackCuts->SetRequireITSRefit(kTRUE); - fEsdTrackCuts->SetRequireSigmaToVertex(kFALSE); - fEsdTrackCuts->SetMaxDCAToVertexZ(2); // new for pile-up !!! - - // Add SPD requirement - fEsdTrackCutsSPD = new AliESDtrackCuts("SPD", "Require 1 cluster in SPD"); - fEsdTrackCutsSPD->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny); - - // Add SDD requirement - fEsdTrackCutsSDD = new AliESDtrackCuts("SDD", "Require 1 cluster in first layer SDD"); - fEsdTrackCutsSDD->SetClusterRequirementITS(AliESDtrackCuts::kSDD,AliESDtrackCuts::kFirst); - - // Add DCA cuts - fEsdTrackCutsDCA = new AliESDtrackCuts("DCA", "pT dependent DCA cut"); - // 7*(0.0050+0.0060/pt^0.9) - fEsdTrackCutsDCA->SetMaxDCAToVertexXYPtDep("0.0350+0.0420/pt^0.9"); - - fEsdTrackCutsDCA->SetMaxDCAToVertexZ(1.e6); - fEsdTrackCutsDCA->SetDCAToVertex2D(kFALSE); - - // emulates filterbit when getting leading-track from ESD - fAnalyseUE->DefineESDCuts(16); // any number = standard ITS+TPC + (SPD or SDD) -} - -//____________________________________________________________________ -void AliAnalysisTaskCorrectionsUE::CreateOutputObjects() -{ - // Create the output container - - if (fDebug > 1) AliInfo("CreateOutPutData()"); - - // Create pointer to AliAnalyseLeadingTrackUE, a class implementing the main analysis algorithms - fAnalyseUE = new AliAnalyseLeadingTrackUE(); - if (!fAnalyseUE){ - AliError("UE analysis class not initialized!!!"); - return; - } - - // Create list of output histograms - if (fListOfHistos != NULL){ - delete fListOfHistos; - fListOfHistos = NULL; - } - if (!fListOfHistos){ - fListOfHistos = new TList(); - fListOfHistos->SetOwner(kTRUE); - } - - // Create CF container - CreateContainer(); - // number of events - fhEntries = new TH1F("fhEntries","Entries",1,0.,2.); - fListOfHistos->Add(fhEntries); - // tracks contributing to the vertex - fhVertexContributors = new TH1F("fhVertexContributors","Tracks in vertex",51, -0.5, 50.5); - fhVertexContributors->GetXaxis()->SetTitle("# tracks in vertex"); - fhVertexContributors->GetYaxis()->SetTitle("Entries"); - fListOfHistos->Add(fhVertexContributors); - // vertex resolution - fhVertexReso = new TH3F("fhVertexReso","Vertex resolution",51,-0.5,50.5,100,0.,0.05,100.,0.,0.1); - fhVertexContributors->GetXaxis()->SetTitle("# tracks in vertex"); - fhVertexContributors->GetYaxis()->SetTitle("Resolution XY (cm)"); - fhVertexContributors->GetZaxis()->SetTitle("Resolution Z (cm)"); - fListOfHistos->Add(fhVertexReso); - - // number of fake tracks - fhFakes = new TH1F("fhFakes","Fraction of fake tracks",5,-0.5,4.5); - fhFakes->GetXaxis()->SetBinLabel(1,"No MC"); - fhFakes->GetXaxis()->SetBinLabel(2,"Unique MC primary"); - fhFakes->GetXaxis()->SetBinLabel(3,"Unique MC secondary"); - fhFakes->GetXaxis()->SetBinLabel(4,"Multiple MC"); - fListOfHistos->Add(fhFakes); - - //pT distributions - fhPtMCAll = new TH1F("fhPtMCAll","All MC particles reconstructed",100,0., 20.); - fListOfHistos->Add(fhPtMCAll); - fhPtMCPrim = new TH1F("fhPtMCPrim","Primary MC particles reconstructed",100,0., 20.); - fListOfHistos->Add(fhPtMCPrim); - fhPtMCSec = new TH1F("fhPtMCSec","Secondary MC particles reconstructed",100,0., 20.); - fListOfHistos->Add(fhPtMCSec); - fhPtMCPrimFake = new TH1F("fhPtMCPrimFake","Fake primary MC particles reconstructed",100,0., 20.); - fListOfHistos->Add(fhPtMCPrimFake); - fhPtMCSecFake = new TH1F("fhPtMCSecFake","Fake secondary MC particles reconstructed",100,0., 20.); - fListOfHistos->Add(fhPtMCSecFake); - - - // Add task configuration to output list - AddSettingsTree(); - - - //Post outputs - PostData(0,fListOfHistos); - -} - -//____________________________________________________________________ -void AliAnalysisTaskCorrectionsUE::Exec(Option_t */*option*/) -{ - - // Get MC event - if (fMcHandler){ - fMcEvent = fMcHandler->MCEvent(); - if ( fDebug > 3 ) AliInfo( " Processing MC event..." ); - if (fMode && !fMcEvent) return; - } - - // Do the analysis - AnalyseCorrectionMode(); - - - PostData(0,fListOfHistos); - -} - -//____________________________________________________________________ -void AliAnalysisTaskCorrectionsUE::Terminate(Option_t */*option*/) -{ - // Terminate analysis - - if (fDebug >1) AliAnalysisHelperJetTasks::PrintDirectorySize("PWG4_JetTasksOutput.root"); - - if (!gROOT->IsBatch()){ - fListOfHistos = dynamic_cast (GetOutputData(0)); - if (!fListOfHistos){ - AliError("Histogram List is not available"); - return; - } - - } else { - AliInfo(" Batch mode, not histograms will be shown..."); - } - - -} - - -/******************** ANALYSIS METHODS *****************************/ - -//____________________________________________________________________ -void AliAnalysisTaskCorrectionsUE::AddSettingsTree() -{ - //Write settings to output list - TTree *settingsTree = new TTree("UEAnalysisSettings","Analysis Settings in UE estimation"); - settingsTree->Branch("fnTracksVertex", &fnTracksVertex, "TracksInVertex/D"); - settingsTree->Branch("fZVertex", &fZVertex, "VertexZCut/D"); - settingsTree->Branch("fTrackPtCut", &fTrackPtCut, "TrackPtCut/D"); - settingsTree->Branch("fTrackEtaCut", &fTrackEtaCut, "TrackEtaCut/D"); - settingsTree->Fill(); - fListOfHistos->Add(settingsTree); -} - -//____________________________________________________________________ -void AliAnalysisTaskCorrectionsUE::AnalyseCorrectionMode() -{ - - // Analyse the event - Int_t labelMC = -1; - if (fMcHandler && fMcEvent){ - // Only consider MC events within the vtx-z region used also as cut on the reconstructed vertex - if (!fAnalyseUE->VertexSelection(fMcEvent, 0, fZVertex)) - return; - // Get MC-true leading particle - TObjArray *ltMC = (TObjArray*)fAnalyseUE->FindLeadingObjects(fMcEvent); - AliVParticle* leadingMC = 0; - if (ltMC){ - leadingMC = (AliVParticle*) ltMC->At(0); - } - if (!leadingMC)return; - labelMC = TMath::Abs(leadingMC->GetLabel()); - } - - // Trigger selection ************************************************ - if (!fAnalyseUE->TriggerSelection(fESDHandler)) return; - - // PILEUP-CUT ****** NEW !!!!!!!!! ************** - Bool_t select = kTRUE; - //select = AliAnalysisHelperJetTasks::TestSelectInfo(AliAnalysisHelperJetTasks::kIsPileUp); - if (! select) return; - - // Vertex selection ************************************************* - - if(!fAnalyseUE->VertexSelection(fESDEvent, 0, fZVertex)) return; - AliESDVertex* vertex = (AliESDVertex*)fESDEvent->GetPrimaryVertex(); - Int_t nvtx = vertex->GetNContributors(); - fhVertexContributors->Fill(nvtx); - if (fMcHandler){ - AliVVertex *vertexMC = (AliVVertex*)fMcEvent->GetPrimaryVertex(); - if (vertexMC){ - Double_t diffx = vertexMC->GetX()-vertex->GetX(); - Double_t diffy = vertexMC->GetY()-vertex->GetY(); - Double_t diffxy = TMath::Sqrt(TMath::Power(diffx,2)+TMath::Power(diffy,2)); - //Double_t diffxy = TMath::Abs(diffx); // **** TMP **** - //Double_t diffxy = diffy; - Double_t diffz = TMath::Abs(vertexMC->GetZ()-vertex->GetZ()); - - fhVertexReso->Fill(nvtx,diffxy,diffz); - }else if (fDebug>1)Printf("******* NO MC VERTEX ********"); - } - - if(!fAnalyseUE->VertexSelection(fESDEvent, fnTracksVertex, fZVertex)) return; - - // Get Reconstructed leading particle ******************************* - TObjArray *ltRECO = fAnalyseUE->FindLeadingObjects(fESDEvent); - if (!ltRECO){ - delete[] ltRECO; - return; - } - Int_t labelReco= TMath::Abs(((AliVParticle*)ltRECO->At(0))->GetLabel()); - - - // Loop on tracks - Int_t nTracks = fESDEvent->GetNumberOfTracks(); - if (!nTracks)return; - // count accepted events - fhEntries->Fill(1.); - - Int_t npart=0; - Bool_t *labelsArray = 0; - if (fMcHandler){ - npart = fMcEvent->GetNumberOfTracks(); - labelsArray = new Bool_t[npart]; - for(Int_t j = 0; jGetTrack(i); - // only charged - if (!track || !track->Charge())continue; - // apply cuts - Bool_t cut = fEsdTrackCuts->AcceptTrack(track); - Bool_t cutSPD = fEsdTrackCutsSPD->AcceptTrack(track); - Bool_t cutSDD = fEsdTrackCutsSDD->AcceptTrack(track); - Bool_t cutDCA = fEsdTrackCutsDCA->AcceptTrack(track); - - //Exclude the MC leading track - Double_t matchLeading = 1.;//no match - if (fMcHandler){ - if (TMath::Abs(track->GetLabel())==labelMC) matchLeading=0.; //match MC leading - if (TMath::Abs(track->GetLabel())==labelReco) { - matchLeading=2.;//match RECO leading - if (labelMC == labelReco)matchLeading = 3.; // match both (mc = reco leading) - } - } - // Fill step0 (all tracks) - FillContainer(track, 0,kFALSE,matchLeading); - // Fill step1 (no SPD cluster requirement - no DCA cut ) - if ( cut ) FillContainer(track,1,kFALSE,matchLeading); - // Fill step2 - if ( cut && cutDCA && (cutSPD || cutSDD)) FillContainer(track,2,kFALSE,matchLeading); - // Fill step3-step4-step5 - if ( cut && cutDCA && !cutSPD && !cutSDD) FillContainer(track,3,kTRUE,matchLeading); - if ( cut && cutDCA && cutSPD) FillContainer(track,4,kTRUE,matchLeading); - if ( cut && cutDCA && !cutSPD && cutSDD) FillContainer(track,5,kTRUE,matchLeading); - // Fill step 6 - temporary just to define the standard track cuts - if ( cut && cutSPD ) FillContainer(track,6,kFALSE,matchLeading); - //if ( cut && cutSPD ) FillContainer(track,6,kTRUE,matchLeading); // ***** TMP ***** - if ( cut && (cutSPD || cutSDD) ) FillContainer(track,7,kFALSE,matchLeading); - // Study contamination form fakes - if (fMcHandler){ - - // consider standard ITS+TPC cuts without SPD cluster requirement - if (cut && cutDCA){ - //check if it points back to any MC - Int_t label = TMath::Abs(track->GetLabel()); - AliVParticle *part = (AliVParticle*)fMcEvent->GetTrack(label); - if (!part){ - fhFakes->Fill(0.); - //Printf("*************** NO MC PARTICLE ************************"); - continue; - } - - fhPtMCAll->Fill(part->Pt()); - // Check if label is not already in array - if (!labelsArray[label]){ - labelsArray[label]= kTRUE; - if (fMcEvent->IsPhysicalPrimary(label)){ - fhFakes->Fill(1.); - fhPtMCPrim->Fill(part->Pt()); - }else{ - fhFakes->Fill(2.); - fhPtMCSec->Fill(part->Pt()); - } - }else{ - fhFakes->Fill(3.); - if (fMcEvent->IsPhysicalPrimary(label))fhPtMCPrimFake->Fill(part->Pt()); - else fhPtMCSecFake->Fill(part->Pt()); - } - } - } - } // end loop on tracks - if(labelsArray) - delete[] labelsArray; - -} - - -//____________________________________________________________________ -void AliAnalysisTaskCorrectionsUE::CreateContainer() -{ - - // Create the output CF container - // relevant variables - UInt_t iprim = 0; // 0: primaries, 1: secondaries from strangness, 2: secondaries form material - UInt_t iptmc = 1; - UInt_t ipt = 2; - UInt_t ieta = 3; - UInt_t idcaxy = 4; - UInt_t idcaz = 5; - UInt_t imatch = 6; - UInt_t icharge = 7; - // set-up the grid - UInt_t nstep = 8; - const Int_t nvar = 8; - const Int_t nbin0 = 5; // prim - const Int_t nbin1 = 20; // pt resolution - const Int_t nbin2 = 39; // pt - const Int_t nbin3 = 20; // eta - const Int_t nbin4 = 100; // dca xy - const Int_t nbin5 = 100; // dca z - const Int_t nbin6 = 4; // matching with leading track - const Int_t nbin7 = 2; - - // array for the number of bins in each dimension - Int_t iBin[nvar]; - iBin[0] = nbin0; - iBin[1] = nbin1; - iBin[2] = nbin2; - iBin[3] = nbin3; - iBin[4] = nbin4; - iBin[5] = nbin5; - iBin[6] = nbin6; - iBin[7] = nbin7; - - // primaries - Double_t primBins[7] = {-0.5,0.5,1.5,2.5,3.5,4.5,5.5}; - // matching with leading-track - Double_t matchBins[5] = {-0.5,0.5,1.5,2.5,3.5}; - - // pT resolution - Double_t resoBins[nbin1+1]; - for (Int_t i=0; i<=nbin1; i++) - resoBins[i] = -1.0 + 0.1 * i; - - // pT - Double_t ptBins[nbin2+1] = {0.0, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0, 100.0}; - - // eta - Double_t etaBins[nbin3+1]; - for (Int_t i=0; i<=nbin3; i++) - etaBins[i] = -1.0 + 0.1 * i; - - // dca xy - Double_t dcaxyBins[nbin4+1]; - for (Int_t i=0; i<=nbin4; i++) - dcaxyBins[i] = -1.+0.02 * i; - - // dca z - Double_t dcazBins[nbin5+1]; - for (Int_t i=0; i<=nbin5; i++) - dcazBins[i] = -5.0 + 0.1 * i; - - // charge - Double_t chargeBins[nbin7+1] = {-1.,0.,1.}; - - // create container - // set variables - fOutCFcont = new AliCFContainer("fOutCFcont","Output Container",nstep,nvar,iBin); - fOutCFcont->SetBinLimits(iprim,primBins); - fOutCFcont->SetVarTitle(iprim, "Particle type"); - fOutCFcont->SetBinLimits(iptmc,resoBins); - fOutCFcont->SetVarTitle(iptmc, "#Delta p_{T} (DATA-MC) (GeV/c)"); - fOutCFcont->SetBinLimits(ipt,ptBins); - fOutCFcont->SetVarTitle(ipt, "p_{T} (GeV/c)"); - fOutCFcont->SetBinLimits(ieta,etaBins); - fOutCFcont->SetVarTitle(ieta, "#eta"); - fOutCFcont->SetBinLimits(idcaxy,dcaxyBins); - fOutCFcont->SetVarTitle(idcaxy, " DCA_{XY} (cm)"); - fOutCFcont->SetBinLimits(idcaz,dcazBins); - fOutCFcont->SetVarTitle(idcaz, " DCA_{Z} (cm)"); - fOutCFcont->SetBinLimits(imatch,matchBins); - fOutCFcont->SetVarTitle(imatch, "Matching with leading-track"); - fOutCFcont->SetBinLimits(icharge,chargeBins); - fOutCFcont->SetVarTitle(icharge, "Charge"); - - // set steps - fOutCFcont->SetStepTitle(0,"all tracks"); - fOutCFcont->SetStepTitle(1,"ITS+TPC cuts (no SPD cluster requirement and DCA cut)"); - fOutCFcont->SetStepTitle(2,"add DCA cut"); - fOutCFcont->SetStepTitle(3,"NO SPD cluster, NO SDD cluster in first layer"); - fOutCFcont->SetStepTitle(4,"YES SPD cluster, NO SDD cluster in first layer"); - fOutCFcont->SetStepTitle(5,"NO SPD cluster, YES SDD cluster in first layer"); - fOutCFcont->SetStepTitle(6,"ITS+TPC cuts - no DCA cut - SPD cut"); - fOutCFcont->SetStepTitle(7,"ITS+TPC cuts - no DCA cut - SPD or SDD cut"); - fListOfHistos->Add(fOutCFcont); - -} - - -void AliAnalysisTaskCorrectionsUE::FillContainer(AliESDtrack *track, Int_t step,Bool_t mcvertex, Double_t matchLeading) -{ - - // Fill the CF container - - Double_t vars[8]; - Double_t prim = -1.; - - if (track->Charge() > 0.) vars[7] = 0.5; - else vars[7] = -0.5; - - if (fMcHandler){ - // determine if points back to a primary - Int_t label = TMath::Abs(track->GetLabel()); - - AliMCParticle *part = (AliMCParticle*)fMcEvent->GetTrack(label); - for (Int_t i=0; i<=6;i++) vars[i] = -999.; - if (part) { //PRIMARY - if (fMcEvent->IsPhysicalPrimary(label)){ - prim = 0.; - }else { //SECONDARY - // decide if strange - Int_t labelm = TMath::Abs(part->GetMother()); - AliMCParticle *mother = (AliMCParticle*)fMcEvent->GetTrack(labelm); - Int_t code = mother->PdgCode(); - Int_t mfl = Int_t (code/ TMath::Power(10, Int_t(TMath::Log10(code)))); - if (mfl == 3) prim = 1.; - else{ - //Printf("***** PROCESS : %d",part->Particle()->GetUniqueID()); - if (TMath::Abs(code) == 211) prim = 2.; // charged pion decay - else if (part->Particle()->GetUniqueID() == 13 )prim = 3.; // hadronic interactions - else if (part->Particle()->GetUniqueID() == 5 )prim = 4.; // photon conversions - else prim = 5.; // other? - } - } - vars[1]= part->Pt()-track->Pt(); - // In step 2 fill MC pT for contamination study - if (step == 2)vars[2]=part->Pt(); - } - } - vars[0]=prim; - - if (step != 2)vars[2]=track->Pt(); - vars[3]=track->Eta(); - - Bool_t dcaControlFlag = kFALSE; - if (mcvertex && fMcHandler){ - // we want DCA w.r.t. MC vertex - AliVVertex *vtxMC = (AliVVertex*)fMcEvent->GetPrimaryVertex(); - dcaControlFlag = track->RelateToVertex((AliESDVertex*)vtxMC,(Double_t)fESDEvent->GetMagneticField(),10000.); - }else{ - AliESDVertex* vertex = (AliESDVertex*)fESDEvent->GetPrimaryVertex(); - dcaControlFlag = track->RelateToVertex(vertex,(Double_t)fESDEvent->GetMagneticField(),10000.); - } - if (dcaControlFlag){ - Float_t dca[2]; - Float_t dcaCov[2]; - track->GetImpactParameters(dca,dcaCov); - vars[4]=dca[0]; - vars[5]=dca[1]; - } - - - vars[6]= matchLeading; - fOutCFcont->Fill(vars,step); - -} - - -//____________________________________________________________________ -AliAnalysisTaskCorrectionsUE* AliAnalysisTaskCorrectionsUE::Instance() -{ - - //Create instance - if (fgTaskCorrectionsUE) { - return fgTaskCorrectionsUE; - } else { - fgTaskCorrectionsUE = new AliAnalysisTaskCorrectionsUE(); - return fgTaskCorrectionsUE; - } -} - diff --git a/PWGJE/AliAnalysisTaskCorrectionsUE.h b/PWGJE/AliAnalysisTaskCorrectionsUE.h deleted file mode 100644 index b040789fabc..00000000000 --- a/PWGJE/AliAnalysisTaskCorrectionsUE.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef ALIANALYSISTASKCORRECTIONSUE_H -#define ALIANALYSISTASKCORRECTIONSUE_H - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -//////////////////////////////////////////////////////////////////////// -// -// Analysis class to Correct Underlying Event studies -// -// This class needs as input ESDs. -// The output is an analysis-specific container. -// -// The class is used to get the contamination from secondaries -// from tracks DCA distribution -// as function of track pT and pseudo-rapidity. -// It provides additional information for the corrections -// that can not be retrieved by the AliAnalysisTaskLeadingTackUE -// task, which is running on AODs. -// -//////////////////////////////////////////////////////////////////////// - -#include "AliAnalysisTask.h" - -class AliAnalyseLeadingTrackUE; -class AliESDtrackCuts; -class AliInputEventHandler; -class AliAODEvent; -class AliCFContainer; -class AliESDEvent; -class AliESDtrack; -class AliAODInputHandler; -class AliESDInputHandler; -class AliMCEventHandler; -class AliMCEvent; -class TH1F; -class TH2F; -class TH3F; -class TH1I; -class TProfile; -class TTree; -class TVector3; - -class AliAnalysisTaskCorrectionsUE : public AliAnalysisTask - { - public: - // track cuts steps - enum CFSteps { - kCFStepAll = 0, - kCFStepCuts = 1, // standard ITS+TPC 2009 cuts w.o. DCA cut and SPD cluster requirement - kCFStepSPD = 2, // add SPD cluster requirement - kCFStepDCA = 3 // add pT dependent DCA cut - }; - - AliAnalysisTaskCorrectionsUE(const char* name="AliAnalysisTaskCorrectionsUE"); - virtual ~AliAnalysisTaskCorrectionsUE() {if ( fListOfHistos ) delete fListOfHistos; } - AliAnalysisTaskCorrectionsUE(const AliAnalysisTaskCorrectionsUE &det); - AliAnalysisTaskCorrectionsUE& operator=(const AliAnalysisTaskCorrectionsUE &det); - - // return instance of the singleton - static AliAnalysisTaskCorrectionsUE* Instance(); - - // Implementation of interace methods - virtual Bool_t Notify(); - virtual void ConnectInputData(Option_t *); - virtual void CreateOutputObjects(); - virtual void Exec(Option_t *option); - virtual void Terminate(Option_t *); - - // Setters/Getters - virtual void SetDebugLevel( Int_t level ) { fDebug = level; } - virtual void SetMode(Int_t mode) { fMode = mode; } - - //Event QA - void SetZVertex( Double_t val ) { fZVertex = val; } - void SetTracksInVertex( Int_t val ){ fnTracksVertex = val; } - - // Track selection cuts - void SetTrackEtaCut( Double_t val ) { fTrackEtaCut = val; } - void SetTrackPtCut( Double_t val ) { fTrackPtCut = val; } - - protected: - static AliAnalysisTaskCorrectionsUE* fgTaskCorrectionsUE; // Pointer to single instance - private: - void AddSettingsTree(); // add list of settings to output list - // Analysis methods - void AnalyseCorrectionMode(); // main algorithm to get correction maps - void CreateContainer(); // create the output CF container - void FillContainer(AliESDtrack *track, Int_t step,Bool_t mcvertex, Double_t matchLeading); // fill container - AliAnalyseLeadingTrackUE* fAnalyseUE; //! points to AliAnalyseLeadingTrackUE class - Int_t fDebug; // Debug flag - AliESDEvent* fESDEvent; //! ESD Event - AliESDInputHandler* fESDHandler; //! ESD Input Handler - AliInputEventHandler* fInputHandler; // Input event handler - TList* fListOfHistos; // Output list of histograms - AliMCEvent* fMcEvent; // pointer to MC event - AliMCEventHandler* fMcHandler; // pointer to MC handler - Int_t fMode; // fMode = 0: data-like analysis - // fMode = 1: corrections analysis - AliCFContainer* fOutCFcont; // output CF container - TH1F* fhEntries; // count events - TH1F* fhFakes; // counts the amount of fake tracks - TH1F* fhPtMCAll; // pT distribution of all accepted MC tracks - TH1F* fhPtMCPrim; // pT distribution MC primaries - TH1F* fhPtMCSec; // pT distribution MC secondaries - TH1F* fhPtMCPrimFake; // pT distribution MC fake primaries - TH1F* fhPtMCSecFake; // pT distribution MC fake secondaries - - // Cuts Events QA - Int_t fnTracksVertex; // QA tracks pointing to principal vertex (= 3 default) - Double_t fZVertex; // Position of Vertex in Z direction - TH1F* fhVertexContributors; // Plot number of contributors in vertex - TH3F* fhVertexReso; // vertex resolution in XY and Z vs. number of contributors - // Track cuts - Double_t fTrackEtaCut; // Eta cut on tracks in the regions (fRegionType=1) - Double_t fTrackPtCut; // Pt cut of tracks in the regions - AliESDtrackCuts* fEsdTrackCuts; // ITS+TPC 2009 cuts (no SPD requirement, no DCA cut) - AliESDtrackCuts* fEsdTrackCutsSPD; // Require 1 cluser in SPD - AliESDtrackCuts* fEsdTrackCutsSDD; // Require 1 cluser in 1st layer SDD - AliESDtrackCuts* fEsdTrackCutsDCA; // Add pT dependent DCA cut - ClassDef( AliAnalysisTaskCorrectionsUE, 5); // Analysis task to correct Underlying Event analysis - }; - -#endif - - diff --git a/PWGJE/AliAnalysisTaskFragmentationFunction.h b/PWGJE/AliAnalysisTaskFragmentationFunction.h index 642dc8174c7..c93a97ca8ea 100644 --- a/PWGJE/AliAnalysisTaskFragmentationFunction.h +++ b/PWGJE/AliAnalysisTaskFragmentationFunction.h @@ -12,6 +12,7 @@ class AliESDEvent; class AliAODEvent; +class AliAODJet; class AliAODExtension; class TList; class TH1F; diff --git a/PWGJE/AliAnalysisTaskHardSoft.cxx b/PWGJE/AliAnalysisTaskHardSoft.cxx deleted file mode 100644 index 0b53bc24dcc..00000000000 --- a/PWGJE/AliAnalysisTaskHardSoft.cxx +++ /dev/null @@ -1,503 +0,0 @@ -#include "TChain.h" -#include "TTree.h" -#include "TH1F.h" -#include "TH2F.h" -#include "TH3F.h" -#include "TCanvas.h" -#include "TList.h" -#include "TParticle.h" -#include "TParticlePDG.h" -#include "TProfile.h" -#include "TNtuple.h" -#include "TFile.h" -#include "TRandom.h" - -#include "AliAnalysisTask.h" -#include "AliAnalysisManager.h" - -#include "AliESDEvent.h" -#include "AliStack.h" -#include "AliMCParticle.h" -#include "AliMCEvent.h" - -#include "AliLog.h" -#include "AliESDVertex.h" -#include "AliESDInputHandler.h" -#include "AliESDtrackCuts.h" -#include "AliMultiplicity.h" - -#include "AliAnalysisTaskHardSoft.h" -#include "AliExternalTrackParam.h" -#include "AliTrackReference.h" -#include "AliHeader.h" -#include "AliGenEventHeader.h" -#include "AliGenDPMjetEventHeader.h" - -// Analysis Task for Hard and Soft event characteristics - -// Author: E.Sicking - -ClassImp(AliAnalysisTaskHardSoft) - -//________________________________________________________________________ - AliAnalysisTaskHardSoft::AliAnalysisTaskHardSoft(const char *name) - : AliAnalysisTaskSE(name) - ,fUseMc(false) - ,fUseNeutral(false) - ,fRadiusCut(0.7) - ,fTriggerPtCut(0.7) - ,fAssociatePtCut(0.4) - ,fMap(0x0) - ,fMapLeading(0x0) - ,fCuts(0) - ,fFieldOn(kTRUE) - ,fHists(0) - -{ - for(Int_t i = 0;i< 2;i++){ - fPt[i] = 0; - fEta[i] = 0; - fPhi[i] = 0; - fEtaPhi[i] = 0; - fEtaPhiLeading[i] = 0; - fNch[i] = 0; - fPtLeading[i] = 0; - fPtLeadingNch[i] = 0; - fPtSumNch[i] = 0; - fPtAvNch[i] = 0; - fDPhiLeading[i] = 0; - fRadiusLeading[i] = 0; - fDPhiLeadingR[i] = 0; - fRadiusLeadingR[i] = 0; - fDPhiLeadingRS[i] = 0; - fRadiusLeadingRS[i] = 0; - fNchAssInR[i] = 0; - fTrigger[i] = 0; - - for(Int_t j=0;j<100;j++){ - fDPhiLeadingNchBin[i][j] = 0; - } - - for(Int_t j=0;j<2;j++){ - fNchHardSoft[i][j] = 0; - fPtHardSoft[i][j] = 0; - fPtAvHardSoftNch[i][j] = 0; - } - } - DefineOutput(1, TList::Class()); -} - - -//________________________________________________________________________ -void AliAnalysisTaskHardSoft::UserCreateOutputObjects() -{ - // Create histograms - // Called once - - Bool_t oldStatus = TH1::AddDirectoryStatus(); - TH1::AddDirectory(kFALSE); - - fHists = new TList(); - - - - TString labels[2]; - labels[0]="MC"; - labels[1]="ESD"; - - for(Int_t i=0;i<2;i++){ - fPt[i] = new TH1F(Form("fPt%s",labels[i].Data()), - Form("fPt%s",labels[i].Data()) , - 500, 0., 50); - fEta[i] = new TH1F (Form("fEta%s",labels[i].Data()), - Form("fEta%s",labels[i].Data()) , - 100, -1., 1); - fPhi[i] = new TH1F(Form("fPhi%s",labels[i].Data()), - Form("fPhi%s",labels[i].Data()) , - 360, 0.,2*TMath::Pi()); - fEtaPhi[i] = new TH2F(Form("fEtaPhi%s",labels[i].Data()), - Form("fEtaPhi%s",labels[i].Data()) , - 100,-1.,1., - 360, 0.,2*TMath::Pi()); - fEtaPhiLeading[i] = new TH2F(Form("fEtaPhiLeading%s",labels[i].Data()), - Form("fEtaPhiLeading%s",labels[i].Data()) , - 100,-1.,1., - 360, 0.,2*TMath::Pi()); - fNch[i] = new TH1F(Form("fNch%s",labels[i].Data()), - Form("fNch%s",labels[i].Data()) , - 250, -0.5, 249.5); - fPtLeading[i] = new TH1F(Form("fPtLeading%s",labels[i].Data()), - Form("fPtLeading%s",labels[i].Data()) , - 500, 0., 50); - fPtLeadingNch[i] = new TProfile(Form("fPtLeadingNch%s",labels[i].Data()), - Form("fPtLeadingNch%s",labels[i].Data()) , - 250, -0.5, 249.5); - fPtSumNch[i] = new TProfile(Form("fPtSumNch%s",labels[i].Data()), - Form("fPtSumNch%s",labels[i].Data()) , - 250, -0.5, 249.5); - fPtAvNch[i] = new TProfile(Form("fPtAvNch%s",labels[i].Data()), - Form("fPtAvNch%s",labels[i].Data()) , - 250, -0.5, 249.5); - fDPhiLeading[i] = new TH1F(Form("fDPhiLeading%s",labels[i].Data()), - Form("fDPhiLeading%s",labels[i].Data()) , - 180, 0., TMath::Pi()); - fRadiusLeading[i] = new TH1F(Form("fRadiusLeading%s",labels[i].Data()), - Form("fRadiusLeading%s",labels[i].Data()) , - 180, 0., 2*TMath::Pi()); - fDPhiLeadingR[i] = new TH1F(Form("fDPhiLeadingR%s",labels[i].Data()), - Form("fDPhiLeadingR%s",labels[i].Data()) , - 180, 0., TMath::Pi()); - fRadiusLeadingR[i] = new TH1F(Form("fRadiusLeadingR%s",labels[i].Data()), - Form("fRadiusLeadingR%s",labels[i].Data()) , - 180, 0., 2*TMath::Pi()); - fDPhiLeadingRS[i] = new TH1F(Form("fDPhiLeadingRS%s",labels[i].Data()), - Form("fDPhiLeadingRS%s",labels[i].Data()) , - 180, 0., TMath::Pi()); - fRadiusLeadingRS[i] = new TH1F(Form("fRadiusLeadingRS%s",labels[i].Data()), - Form("fRadiusLeadingRS%s",labels[i].Data()) , - 180, 0., 2*TMath::Pi()); - fNchAssInR[i] = new TProfile(Form("fNchAssInR%s",labels[i].Data()), - Form("fNchAssInR%s",labels[i].Data()) , - 250, -0.5, 249.5); - fTrigger[i] = new TH1F(Form("fTrigger%s",labels[i].Data()), - Form("fTrigger%s",labels[i].Data()) , - 250, -0.5, 249.5); - for(Int_t j=0;j<100;j++){ - fDPhiLeadingNchBin[i][j] = new TH1F(Form("fDPhiLeadingNchBin%s%02d",labels[i].Data(),j), - Form("fDPhiLeadingNchBin%s%02d",labels[i].Data(),j) , - 180, 0., TMath::Pi()); - } - - for(Int_t j=0;j<2;j++){ - fNchHardSoft[i][j] = new TH1F(Form("fNchHardSoft%s%d",labels[i].Data(),j), - Form("fNchHardSoft%s%d",labels[i].Data(),j) , - 250, -0.5, 249.5); - fPtHardSoft[i][j] = new TH1F(Form("fPtHardSoft%s%d",labels[i].Data(),j), - Form("fPtHardSoft%s%d",labels[i].Data(),j) , - 500, 0., 50.0); - fPtAvHardSoftNch[i][j] = new TProfile(Form("fPtAvHardSoftNch%s%d",labels[i].Data(),j), - Form("fPtAvHardSoftNch%s%d",labels[i].Data(),j) , - 250, -0.5, 249.5); - } - - } - - - fHists->SetOwner(); - for(Int_t i=0;i<2;i++){ - fHists->Add(fPt[i]); - fHists->Add(fEta[i]); - fHists->Add(fPhi[i]); - fHists->Add(fEtaPhi[i]); - fHists->Add(fEtaPhiLeading[i]); - fHists->Add(fNch[i]); - fHists->Add(fPtLeading[i]); - fHists->Add(fPtLeadingNch[i]); - fHists->Add(fPtSumNch[i]); - fHists->Add(fPtAvNch[i]); - fHists->Add(fDPhiLeading[i]); - fHists->Add(fRadiusLeading[i]); - fHists->Add(fDPhiLeadingR[i]); - fHists->Add(fRadiusLeadingR[i]); - fHists->Add(fDPhiLeadingRS[i]); - fHists->Add(fRadiusLeadingRS[i]); - fHists->Add(fNchAssInR[i]); - fHists->Add(fTrigger[i]); - - for(Int_t j=0;j<100;j++){ - fHists->Add(fDPhiLeadingNchBin[i][j]); - } - - for(Int_t j=0;j<2;j++){ - fHists->Add(fNchHardSoft[i][j]); - fHists->Add(fPtHardSoft[i][j]); - fHists->Add(fPtAvHardSoftNch[i][j]); - } - } - - - TH1::AddDirectory(oldStatus); -} - -//__________________________________________________________ - -void AliAnalysisTaskHardSoft::UserExec(Option_t *) -{ - Int_t nentries[2] = {0,0}; // tracks in event (before selection) - Int_t nTracksAll[2] = {0,0}; // accepted tracks in event - Int_t nTracksAssociate[2] = {0,0}; // accepted tracks in event within R=fRadiusCut around leading track - - Float_t pt[2] = {0.,0.}; // pt - Float_t eta[2] = {0.,0.}; // eta - Float_t phi[2] = {0.,0.}; // phi - Float_t ptSum[2] = {0.,0.}; // pt sum - Float_t ptAv[2] = {0.,0.}; // average pt - - - Float_t ptLeading[2] = {0.,0.}; // pt leading - Float_t etaLeading[2] = {0.,0.}; // eta leading - Float_t phiLeading[2] = {0.,0.}; // phi leading - - Float_t ptOthers[2] = {0.,0.}; // pt others // for second track loop around leading track - Float_t etaOthers[2] = {0.,0.}; // eta others - Float_t phiOthers[2] = {0.,0.}; // phi others - - Double_t etaLeadingRandom[2] = {0.,0.}; // eta leading for random particle position (from fMapLeading) - Double_t phiLeadingRandom[2] = {0.,0.}; // phi leading " - Double_t etaOthersRandom[2] = {0.,0.}; // eta others for random particle position (from fMap) - Double_t phiOthersRandom[2] = {0.,0.}; // phi others " - - Int_t fEventType[2]={1,1}; //hard=0, soft=1 -> set to hard if trigger and associate particle - //are within R=0.7 - - //get event and vertex cut :(MC and ESD) - //--------------------- - //MC - //--------------------- - AliStack *stack = 0x0; // needed for MC studies - Float_t vzMC=0.; // MC vertex position in z - if(fUseMc==true){ - stack = MCEvent()->Stack(); - AliGenEventHeader* header = MCEvent()->GenEventHeader(); - TArrayF mcV; - header->PrimaryVertex(mcV); - vzMC = mcV[2]; - } - //--------------------- - //ESD - //--------------------- - AliVEvent* event = InputEvent(); - if (!event) { - Printf("ERROR: Could not retrieve event"); - return; - } - if(Entry()==0){ - AliESDEvent* esd = dynamic_cast(event); - if(esd)Printf("We are reading from ESD"); - } - const AliVVertex* vertex = event->GetPrimaryVertex(); - Float_t vz = vertex->GetZ(); - //--------------------- - - - - - //Selection of particle(mcesd=0) or esdtracks(mcesd=1) - for(Int_t mcesd=0;mcesd<2;mcesd++){ - if(mcesd==0){ - if(fUseMc==false) //MC part can be switched off for real data by function SetUserMc(kFALSE) - continue; - } - - // vertex cut and number of particles/tracks per event - //--------------------------------------- - if(mcesd==0){//mc particles - if (TMath::Abs(vzMC) > 10.) return; - nentries[mcesd]=MCEvent()->GetNumberOfTracks(); - } - else{// esd tracks - if (TMath::Abs(vz) > 10.) return; - nentries[mcesd]=event->GetNumberOfTracks(); - }//--------------------------------------- - - - - - // arrays for leading track determination (done with TMath::Sort of Array) - Float_t * ptArray = new Float_t[nentries[mcesd]]; - - //array of track properties - Float_t * etaArray = new Float_t[nentries[mcesd]]; - Float_t * phiArray = new Float_t[nentries[mcesd]]; - - Int_t *pindex = new Int_t[nentries[mcesd]]; - for (Int_t i = 0; i < nentries[mcesd]; i++) { - ptArray[i]=0.; - etaArray[i]=0.; - phiArray[i]=0.; - pindex[i]=0; - } - - - - - //first track loop - for (Int_t iTrack = 0; iTrack < nentries[mcesd]; iTrack++) { - - pt[mcesd] = 0.; - eta[mcesd] = 0.; - phi[mcesd] = 0; - - //get properties of mc particle - if(mcesd==0){//mc - AliMCParticle* mcP = (AliMCParticle*) MCEvent()->GetTrack(iTrack); - // Primaries only - if (!(stack->IsPhysicalPrimary(mcP->Label()))) continue; - if(!fUseNeutral)if (mcP->Particle()->GetPDG()->Charge() == 0) continue; - //same cuts as on ESDtracks - if(TMath::Abs(mcP->Eta())>0.9)continue; - if(mcP->Pt()<0.2)continue; - if(mcP->Pt()>200)continue; - - pt[mcesd] = mcP->Pt(); - eta[mcesd] = mcP->Eta(); - phi[mcesd] = mcP->Phi(); - } - - //get properties of esdtracks - else{//esd - AliVParticle *track = event->GetTrack(iTrack); - if (!track) { - Printf("ERROR: Could not receive track %d", iTrack); - continue; - } - AliESDtrack *esdtrack = dynamic_cast(track); - if(!esdtrack)continue; - if (!fCuts->AcceptTrack(esdtrack)) continue; - - pt[mcesd]=esdtrack->Pt(); - eta[mcesd]=esdtrack->Eta(); - phi[mcesd]=esdtrack->Phi(); - } - - ptArray[nTracksAll[mcesd]] = pt[mcesd]; // fill pt array - etaArray[nTracksAll[mcesd]] = eta[mcesd]; // fill eta array - phiArray[nTracksAll[mcesd]++] = phi[mcesd]; // count tracks and fill phi array - - fPt[mcesd] -> Fill(pt[mcesd]); - fEta[mcesd] -> Fill(eta[mcesd]); - fPhi[mcesd] -> Fill(phi[mcesd]); - fEtaPhi[mcesd] -> Fill(eta[mcesd],phi[mcesd]); - - - }//end first track loop - - fNch[mcesd] -> Fill(nTracksAll[mcesd]); - - - //find leading pt tracks - if(nentries[mcesd]>0) TMath::Sort(nentries[mcesd], ptArray, pindex, kTRUE); - //for(Int_t i=0;i0){ - fPtLeading[mcesd]->Fill(ptArray[pindex[0]]); //first entry in array is highest - fPtLeadingNch[mcesd]->Fill(nTracksAll[mcesd],ptArray[pindex[0]]); - - for(Int_t i=0;i - - fPtSumNch[mcesd]->Fill(nTracksAll[mcesd],ptSum[mcesd]); - fPtAvNch[mcesd]->Fill(nTracksAll[mcesd],ptAv[mcesd]); - } - - - if(nTracksAll[mcesd]>1){ // require at least two tracks (leading and prob. accosicates) - - //Leading track properties - ptLeading[mcesd] = ptArray[pindex[0]]; - etaLeading[mcesd] = etaArray[pindex[0]]; - phiLeading[mcesd] = phiArray[pindex[0]]; - - fEtaPhiLeading[mcesd] -> Fill(etaLeading[mcesd],phiLeading[mcesd]); - - fMapLeading->GetRandom2(etaLeadingRandom[mcesd],phiLeadingRandom[mcesd]); - - //second track loop for event propoerties around leading tracks with pt>triggerPtCut - //loop only over already accepted tracks except leading track - if(ptLeading[mcesd]>fTriggerPtCut){ - - fTrigger[mcesd]->Fill(nTracksAll[mcesd]); // how often is there a trigger particle at a certain Nch bin - - for (Int_t iTrack = 1; iTrack < nTracksAll[mcesd]; iTrack++) { // starting at second highest track - - ptOthers[mcesd] = ptArray[pindex[iTrack]]; - etaOthers[mcesd] = etaArray[pindex[iTrack]]; - phiOthers[mcesd] = phiArray[pindex[iTrack]]; - - fMap->GetRandom2(etaOthersRandom[mcesd],phiOthersRandom[mcesd]); - - if(ptOthers[mcesd]>fAssociatePtCut){ // only tracks which fullfill associate pt cut - - //1. real data - - Float_t dPhi=TMath::Abs(phiOthers[mcesd]-phiLeading[mcesd]); - if(dPhi>TMath::Pi()) dPhi=2*TMath::Pi()-dPhi; - Float_t dEta=etaOthers[mcesd]-etaLeading[mcesd]; - - Float_t radius=TMath::Sqrt(dPhi*dPhi+dEta*dEta); - fRadiusLeading[mcesd]->Fill(radius); - fDPhiLeading[mcesd]->Fill(dPhi); - if(nTracksAll[mcesd]<100)fDPhiLeadingNchBin[mcesd][nTracksAll[mcesd]]->Fill(dPhi); - - if(radiusTMath::Pi()) dPhiR=dPhiR-2*TMath::Pi(); - Float_t dEtaR=etaOthersRandom[mcesd]-etaLeadingRandom[mcesd]; - - Float_t radiusR=TMath::Sqrt(dPhiR*dPhiR+dEtaR*dEtaR); - fRadiusLeadingR[mcesd]->Fill(radiusR); - fDPhiLeadingR[mcesd]->Fill(dPhiR); - - - - //3. random position of leading particle - Float_t dPhiRS=TMath::Abs(phiOthers[mcesd]-phiLeadingRandom[mcesd]); - if(dPhiRS>TMath::Pi()) dPhiRS=dPhiRS-2*TMath::Pi(); - Float_t dEtaRS=etaOthers[mcesd]-etaLeadingRandom[mcesd]; - - Float_t radiusRS=TMath::Sqrt(dPhiRS*dPhiRS+dEtaRS*dEtaRS); - fRadiusLeadingRS[mcesd]->Fill(radiusRS); - fDPhiLeadingRS[mcesd]->Fill(dPhiRS); - } - - - - } - //fill histogram with number of tracks (pt>fAssociatePtCut) around leading track - fNchAssInR[mcesd]->Fill(nTracksAll[mcesd],nTracksAssociate[mcesd]); - - } - } - - fNchHardSoft[mcesd][fEventType[mcesd]]->Fill(nTracksAll[mcesd]); - - for(Int_t i=0;iFill(ptArray[i]); - } - - fPtAvHardSoftNch[mcesd][fEventType[mcesd]]->Fill(nTracksAll[mcesd],ptAv[mcesd]); - - - }//double loop over mcP and ESD - - - - // Post output data. - PostData(1, fHists); -} - - - - - -//________________________________________________________________________ -void AliAnalysisTaskHardSoft::Terminate(Option_t *) -{ - - -} - - - - - diff --git a/PWGJE/AliAnalysisTaskHardSoft.h b/PWGJE/AliAnalysisTaskHardSoft.h deleted file mode 100644 index b59f0c0f348..00000000000 --- a/PWGJE/AliAnalysisTaskHardSoft.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef AliAnalysisTaskHardSoft_cxx -#define AliAnalysisTaskHardSoft_cxx - - -class TH1F; -class TH2F; -class TH3F; -class TList; -class TNtuple; - -class AliESDEvent; -class AliESDtrack; -class AliESDtrackCuts; - - -#include "AliAnalysisTaskSE.h" -#include "TFile.h" -#include "TNtuple.h" - -class AliAnalysisTaskHardSoft : public AliAnalysisTaskSE { - public: - AliAnalysisTaskHardSoft(const char *name = "AliAnalysisTaskHardSoft"); - virtual ~AliAnalysisTaskHardSoft() {} - - virtual void UserCreateOutputObjects(); - virtual void UserExec(Option_t *option); - virtual void Terminate(Option_t *); - - virtual void SetUseMc(Bool_t useMc) {fUseMc = useMc;} - virtual void SetUseNeutralMC(Bool_t useNeutral) {fUseNeutral = useNeutral;} - - virtual void SetRadiusCut(Float_t radiusCut) {fRadiusCut = radiusCut;} - virtual void SetTriggerPtCut(Float_t triggerPtCut) {fTriggerPtCut = triggerPtCut;} - virtual void SetAssociatePtCut(Float_t associatePtCut) {fAssociatePtCut = associatePtCut;} - - virtual void SetMap(TH2F* map) {fMap = map;} - virtual void SetMapLeading(TH2F* mapLeading) {fMapLeading = mapLeading;} - - - virtual void SetCuts(AliESDtrackCuts* cuts) - {fCuts = cuts;} - - virtual void SetFieldOn(Bool_t b = kTRUE){fFieldOn = b;} - - - private: - - Bool_t fUseMc; // for simulated data: calculate the same for MCpartciles aswell - Bool_t fUseNeutral; // use also neutral particle in MC case - Float_t fRadiusCut; // radius cut for hard/soft event determination (CDF approach) - Float_t fTriggerPtCut; // first pt cut for hard/soft event determination (CDF approach) - Float_t fAssociatePtCut; // first pt cut for hard/soft event determination (CDF approach) - - TH2F * fMap; // map for eta-phi acceptance (used for random particles) - TH2F * fMapLeading; // map for eta-phi acceptance (used for random particles) - - AliESDtrackCuts* fCuts; // List of cuts for ESDs - Bool_t fFieldOn; - - - TList * fHists; // List of histos - - //properties of particles(0)/esdtracks(1) - TH1F * fPt[2]; // pt - TH1F * fEta[2]; // eta - TH1F * fPhi[2]; // phi - TH2F * fEtaPhi[2]; // eta-phi (needed as input for random position -> will be fMap) - TH2F * fEtaPhiLeading[2]; // eta-phi (needed as input for random position -> will be fMapLeading) - TH1F * fNch[2]; // all accepted tracks/particles - TH1F * fPtLeading[2]; // pt of leading track/particle - - TProfile * fPtLeadingNch[2]; // pt of leading track/particle vs Nch - TProfile * fPtSumNch[2]; // pt sum track/particle vs Nch - TProfile * fPtAvNch[2]; // average pt track/particle vs Nch - - TH1F * fDPhiLeading[2]; // delta phi of associate tracks to leading track - TH1F * fRadiusLeading[2]; // radius of associate tracks to leading track - - TH1F * fDPhiLeadingR[2]; // delta phi of associate tracks to leading track for random pos. - TH1F * fRadiusLeadingR[2]; // radius of associate tracks to leading track for random pos. - - TH1F * fDPhiLeadingRS[2]; // delta phi of associate tracks to leading track for random seed pos. - TH1F * fRadiusLeadingRS[2]; // radius of associate tracks to leading track for random seed pos - - TProfile * fNchAssInR[2]; // number of tracks within R around leading track vs Nch - TH1F * fTrigger[2]; // number of triggers with at accepted-track number - - //per Nch bin of all accepted tracks - TH1F * fDPhiLeadingNchBin[2][100]; // delta phi of associate tracks to leading track per Nch bin - - TH1F * fNchHardSoft[2][2]; // Nch for hard and soft events (classified with CDF algorithm) - TH1F * fPtHardSoft[2][2]; // Pt for hard and soft events (classified with CDF algorithm) - TProfile * fPtAvHardSoftNch[2][2]; // for hard and soft events (classified with CDF algorithm) - - - AliAnalysisTaskHardSoft(const AliAnalysisTaskHardSoft&); // not implemented - AliAnalysisTaskHardSoft& operator=(const AliAnalysisTaskHardSoft&); // not implemented - - ClassDef(AliAnalysisTaskHardSoft, 1); // Hard and Soft event characteristics -}; - -#endif diff --git a/PWGJE/AliAnalysisTaskJFSystematics.cxx b/PWGJE/AliAnalysisTaskJFSystematics.cxx deleted file mode 100644 index 90fbd3ca504..00000000000 --- a/PWGJE/AliAnalysisTaskJFSystematics.cxx +++ /dev/null @@ -1,628 +0,0 @@ -// ************************************** -// Task used for the systematic study of jet finders -// -// Compares input (gen) and output (rec) jets -// gen can also be another jet finder on the rec level, matching is done in eta phi -// -// ******************************************* - - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "TDatabasePDG.h" - -#include "AliAnalysisTaskJFSystematics.h" -#include "AliAnalysisManager.h" -#include "AliJetFinder.h" -#include "AliJetHeader.h" -#include "AliJetReader.h" -#include "AliJetReaderHeader.h" -#include "AliUA1JetHeaderV1.h" -#include "AliESDEvent.h" -#include "AliAODEvent.h" -#include "AliAODHandler.h" -#include "AliAODTrack.h" -#include "AliAODJet.h" -#include "AliMCEventHandler.h" -#include "AliMCEvent.h" -#include "AliStack.h" -#include "AliGenPythiaEventHeader.h" -#include "AliJetKineReaderHeader.h" -#include "AliGenCocktailEventHeader.h" -#include "AliInputEventHandler.h" - - -#include "AliAnalysisHelperJetTasks.h" - -ClassImp(AliAnalysisTaskJFSystematics) - - const Int_t AliAnalysisTaskJFSystematics::fgkSysBins[AliAnalysisTaskJFSystematics::kSysTypes] = {0,AliAnalysisTaskJFSystematics::kMaxJets}; -const char* AliAnalysisTaskJFSystematics::fgkSysName[AliAnalysisTaskJFSystematics::kSysTypes] = {"","j"}; - -AliAnalysisTaskJFSystematics::AliAnalysisTaskJFSystematics(): AliAnalysisTaskSE(), - fJetHeaderRec(0x0), - fJetHeaderGen(0x0), - fAOD(0x0), - fBranchRec("jets"), - fBranchGen(""), - fUseAODInput(kFALSE), - fUseExternalWeightOnly(kFALSE), - fLimitGenJetEta(kFALSE), - fAnalysisType(0), - fExternalWeight(1), - fRecEtaWindow(0.5), - fAvgTrials(1), - fh1Xsec(0x0), - fh1Trials(0x0), - fh1PtHard(0x0), - fh1PtHardNoW(0x0), - fh1PtHardTrials(0x0), - fh1NGenJets(0x0), - fh1NRecJets(0x0), - fh1PtRecIn(0x0), - fh1PtRecOut(0x0), - fh1PtGenIn(0x0), - fh1PtGenOut(0x0), - fh2PtFGen(0x0), - fh2PhiFGen(0x0), - fh2EtaFGen(0x0), - fh2PtGenDeltaPhi(0x0), - fh2PtGenDeltaEta(0x0), - fh3RecInEtaPhiPt(0x0), - fh3RecOutEtaPhiPt(0x0), - fh3GenInEtaPhiPt(0x0), - fh3GenOutEtaPhiPt(0x0), - fhnCorrelation(0x0), - fHistList(0x0) -{ - // Default constructor - /* - for(int ij = 0;ijGetTree(); - Float_t xsection = 0; - Float_t ftrials = 1; - if(tree){ - TFile *curfile = tree->GetCurrentFile(); - if (!curfile) { - Error("Notify","No current file"); - return kFALSE; - } - if(!fh1Xsec||!fh1Trials){ - Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__); - return kFALSE; - } - AliAnalysisHelperJetTasks::PythiaInfoFromFile(curfile->GetName(),xsection,ftrials); - fh1Xsec->Fill("<#sigma>",xsection); - // construct a poor man average trials - Float_t nEntries = (Float_t)tree->GetTree()->GetEntries(); - if(ftrials>=nEntries)fAvgTrials = ftrials/nEntries; - } - return kTRUE; -} - -void AliAnalysisTaskJFSystematics::UserCreateOutputObjects() -{ - - // - // Create the output container - // - - - if (fDebug > 1) printf("AnalysisTaskJFSystematics::UserCreateOutputObjects() \n"); - - OpenFile(1); - if(!fHistList)fHistList = new TList(); - - Bool_t oldStatus = TH1::AddDirectoryStatus(); - TH1::AddDirectory(kFALSE); - - // - // Histograms - // - - const Int_t nBinPt = 100; - Double_t binLimitsPt[nBinPt+1]; - for(Int_t iPt = 0;iPt <= nBinPt;iPt++){ - if(iPt == 0){ - binLimitsPt[iPt] = 0.0; - } - else {// 1.0 - binLimitsPt[iPt] = binLimitsPt[iPt-1] + 1.0; - } - } - - const Int_t nBinEta = 26; - Double_t binLimitsEta[nBinEta+1] = { - -1.6,-1.4,-1.2,-1.0, - -0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,-0.2,-0.1,0.0, - 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, - 1.0, 1.2, 1.4, 1.6 - }; - - - const Int_t nBinPhi = 18; - Double_t binLimitsPhi[nBinPhi+1]; - for(Int_t iPhi = 0;iPhi<=nBinPhi;iPhi++){ - if(iPhi==0){ - binLimitsPhi[iPhi] = 0; - } - else{ - binLimitsPhi[iPhi] = binLimitsPhi[iPhi-1] + 1/(Float_t)nBinPhi * TMath::Pi()*2; - } - } - - - fh1Xsec = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1); - fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>"); - - fh1Trials = new TH1F("fh1Trials","trials event header or pyxsec file",1,0,1); - fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}"); - - fh1PtHard = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",nBinPt,binLimitsPt); - fh1PtHardNoW = new TH1F("fh1PtHardNoW","PYTHIA Pt hard no weight;p_{T,hard}",nBinPt,binLimitsPt); - fh1PtHardTrials = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",nBinPt,binLimitsPt); - fh1NGenJets = new TH1F("fh1NGenJets","N generated jets",20,-0.5,19.5); - fh1NRecJets = new TH1F("fh1NRecJets","N reconstructed jets",20,-0.5,19.5); - - // book the single histograms these we clone for various systematics - // - fh1PtRecIn = new TH1F("fh1PtRecIn","rec p_T input ;p_{T,rec}",nBinPt,binLimitsPt); - fh1PtRecOut = new TH1F("fh1PtRecOut","rec p_T output jets;p_{T,rec}",nBinPt,binLimitsPt); - fh1PtGenIn = new TH1F("fh1PtGenIn","found p_T input ;p_{T,gen}",nBinPt,binLimitsPt); - fh1PtGenOut = new TH1F("fh1PtGenOut","found p_T output jets;p_{T,gen}",nBinPt,binLimitsPt); - - - - fh2PtFGen = new TH2F("fh2PtFGen","Pt Found vs. gen;p_{T,rec} (GeV/c);p_{T,gen} (GeV/c)", - nBinPt,binLimitsPt,nBinPt,binLimitsPt); - fh2PhiFGen = new TH2F("fh2PhiFGen","#phi Found vs. gen;#phi_{rec};#phi_{gen}", - nBinPhi,binLimitsPhi,nBinPhi,binLimitsPhi); - fh2EtaFGen = new TH2F("fh2EtaFGen","#eta Found vs. gen;#eta_{rec};#eta_{gen}", - nBinEta,binLimitsEta,nBinEta,binLimitsEta); - - fh2PtGenDeltaPhi = new TH2F("fh2PtGenDeltaPhi","delta phi vs. P_{T,gen};p_{T,gen} (GeV/c);#phi_{gen}-#phi_{rec}", - nBinPt,binLimitsPt,100,-1.0,1.0); - fh2PtGenDeltaEta = new TH2F("fh2PtGenDeltaEta","delta eta vs. p_{T,gen};p_{T,gen} (GeV/c);#eta_{gen}-#eta_{rec}", - nBinPt,binLimitsPt,100,-1.0,1.0); - - - fh3RecInEtaPhiPt = new TH3F("fh3RecInEtaPhiPt","Rec eta, phi, pt; #eta; #phi; p_{T,rec} (GeV/c)", - nBinEta,binLimitsEta,nBinPhi,binLimitsPhi,nBinPt,binLimitsPt); - fh3RecOutEtaPhiPt = new TH3F("fh3RecOutEtaPhiPt","generated found jet Rec eta, phi, pt; #eta; #phi; p_{T,rec} (GeV/c)", - nBinEta,binLimitsEta,nBinPhi,binLimitsPhi,nBinPt,binLimitsPt); - fh3GenInEtaPhiPt = new TH3F("fh3GenInEtaPhiPt","generated jet eta, phi, pt; #eta; #phi; p_{T,gen} (GeV/c)", - nBinEta,binLimitsEta,nBinPhi,binLimitsPhi,nBinPt,binLimitsPt); - fh3GenOutEtaPhiPt = new TH3F("fh3GenOutEtaPhiPt","reconstructed found for Gen eta, phi, pt; #eta; #phi; p_{T,} (GeV/c)", - nBinEta,binLimitsEta,nBinPhi,binLimitsPhi,nBinPt,binLimitsPt); - - const int nbin[4] = {nBinPt,nBinPt,24,24}; - Double_t vLowEdge[4] = {0,0,-1.2,-1.2}; - Double_t vUpEdge[4] = {250,250,1.2,1.2}; - - fhnCorrelation = new THnSparseF("fhnCorrelation","Response Map", 4, nbin, vLowEdge, vUpEdge); - - - - fHistList->Add(fh1Xsec); - fHistList->Add(fh1Trials); - fHistList->Add(fh1PtHard); - fHistList->Add(fh1PtHardNoW); - fHistList->Add(fh1PtHardTrials); - fHistList->Add(fh1NGenJets); - fHistList->Add(fh1NRecJets); - fHistList->Add(fh1PtRecIn); - fHistList->Add(fh1PtRecOut); - - if(fBranchGen.Length()>0){ - fHistList->Add(fh1PtGenIn); - fHistList->Add(fh1PtGenOut); - fHistList->Add(fh2PtFGen); - fHistList->Add(fh2PhiFGen); - fHistList->Add(fh2EtaFGen); - fHistList->Add(fh2PtGenDeltaEta); - fHistList->Add(fh2PtGenDeltaPhi); - fHistList->Add(fh3RecOutEtaPhiPt); - fHistList->Add(fh3GenOutEtaPhiPt); - fHistList->Add(fh3RecInEtaPhiPt); - fHistList->Add(fh3GenInEtaPhiPt); - fHistList->Add(fhnCorrelation); - } - - if(fAnalysisType==kSysJetOrder){ - // - for(int i = 0; i< fgkSysBins[kSysJetOrder];++i){ - TH1F *hTmp = (TH1F*)fh1PtRecIn->Clone(Form("%s_%s%d",fh1PtRecIn->GetName(),fgkSysName[kSysJetOrder],i)); - fHistList->Add(hTmp); - hTmp = (TH1F*)fh1PtRecOut->Clone(Form("%s_%s%d",fh1PtRecOut->GetName(),fgkSysName[kSysJetOrder],i)); - fHistList->Add(hTmp); - - if(fBranchGen.Length()>0){ - hTmp = (TH1F*)fh1PtGenIn->Clone(Form("%s_%s%d",fh1PtGenIn->GetName(),fgkSysName[kSysJetOrder],i)); - fHistList->Add(hTmp); - hTmp = (TH1F*)fh1PtGenOut->Clone(Form("%s_%s%d",fh1PtGenOut->GetName(),fgkSysName[kSysJetOrder],i)); - fHistList->Add(hTmp); - THnSparseF *hnTmp = (THnSparseF*)fhnCorrelation->Clone(Form("%s_%s%d",fhnCorrelation->GetName(),fgkSysName[kSysJetOrder],i)); - fHistList->Add(hnTmp); - } - } - } - - // =========== Switch on Sumw2 for all histos =========== - for (Int_t i=0; iGetEntries(); ++i) { - TH1 *h1 = dynamic_cast(fHistList->At(i)); - if (h1){ - // Printf("%s ",h1->GetName()); - h1->Sumw2(); - continue; - } - THnSparse *hn = dynamic_cast(fHistList->At(i)); - if(hn)hn->Sumw2(); - } - - TH1::AddDirectory(oldStatus); - - } - -void AliAnalysisTaskJFSystematics::Init() -{ - // - // Initialization - // - - Printf(">>> AnalysisTaskJFSystematics::Init() debug level %d\n",fDebug); - if (fDebug > 1) printf("AnalysisTaskJFSystematics::Init() \n"); - -} - -void AliAnalysisTaskJFSystematics::UserExec(Option_t */*option*/) -{ - // - // Execute analysis for current event - // - - if(fUseAODInput){ - fAOD = dynamic_cast(InputEvent()); - if(!fAOD){ - Printf("%s:%d AODEvent not found in Input Manager %d",(char*)__FILE__,__LINE__,fUseAODInput); - return; - } - // fethc the header - } - else{ - // assume that the AOD is in the general output... - fAOD = AODEvent(); - if(!fAOD){ - Printf("%s:%d AODEvent not found in the Output",(char*)__FILE__,__LINE__); - return; - } - } - - if (fDebug > 1)printf("AliAnalysisTaskJFSystematics::Analysing event # %5d\n", (Int_t) fEntry); - - // ========= These pointers need to be valid in any case ======= - - TClonesArray *aodRecJets = dynamic_cast(fAOD->FindListObject(fBranchRec.Data())); - if(!aodRecJets){ - Printf("%s:%d no reconstructed Jet array with name %s in AOD",(char*)__FILE__,__LINE__,fBranchRec.Data()); - return; - } - - // We use static arrays, not to fragment the memory - // - AliAODJet genJets[kMaxJets]; - Int_t nGenJets = 0; - AliAODJet recJets[kMaxJets]; - Int_t nRecJets = 0; - - Double_t eventW = 1; - Double_t ptHard = 0; - - Double_t nTrials = 1; // Trials for MC trigger weigth for real data - Int_t iProcessType = 0; - if(fUseExternalWeightOnly){ - eventW = fExternalWeight; - } - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - // this is the part where when we need to have MC information - // we can also work on Reconstructed only when just comparing two JF - AliMCEvent* mcEvent = MCEvent(); - if(!mcEvent){ - Printf("%s:%d no mcEvent",(char*)__FILE__,__LINE__); - } - else { - AliGenPythiaEventHeader* pythiaGenHeader = AliAnalysisHelperJetTasks::GetPythiaEventHeader(mcEvent); - if(pythiaGenHeader){ - nTrials = pythiaGenHeader->Trials(); - ptHard = pythiaGenHeader->GetPtHard(); - iProcessType = pythiaGenHeader->ProcessType(); - // 11 f+f -> f+f - // 12 f+barf -> f+barf - // 13 f+barf -> g+g - // 28 f+g -> f+g - // 53 g+g -> f+barf - // 68 g+g -> g+g - if (fDebug > 10)Printf("%d iProcessType %d",__LINE__, iProcessType); - if(fDebug>20)AliAnalysisHelperJetTasks::PrintStack(mcEvent); - // fetch the pythia generated jets only to be used here - Int_t nPythiaGenJets = pythiaGenHeader->NTriggerJets(); - AliAODJet pythiaGenJets[kMaxJets]; - Int_t iCount = 0; - for(int ip = 0;ip < nPythiaGenJets;++ip){ - if(iCount>=kMaxJets)continue; - Float_t p[4]; - pythiaGenHeader->TriggerJet(ip,p); - pythiaGenJets[iCount].SetPxPyPzE(p[0],p[1],p[2],p[3]); - if(fLimitGenJetEta){ - if(pythiaGenJets[iCount].Eta()>fJetHeaderRec->GetJetEtaMax()|| - pythiaGenJets[iCount].Eta()GetJetEtaMin())continue; - } - if(fBranchGen.Length()==0){ - // if we have MC particles and we do not read from the aod branch - // use the pythia jets - genJets[iCount].SetPxPyPzE(p[0],p[1],p[2],p[3]); - } - iCount++; - } - if(fBranchGen.Length()==0)nGenJets = iCount; - } - }// if we had the MCEvent - - - fh1Trials->Fill("#sum{ntrials}",fAvgTrials); - - fh1PtHard->Fill(ptHard,eventW); - fh1PtHardNoW->Fill(ptHard,1); - fh1PtHardTrials->Fill(ptHard,nTrials); - - // If we set a second branch for the input jets fetch this - if(fBranchGen.Length()>0){ - TClonesArray *aodGenJets = dynamic_cast(fAOD->FindListObject(fBranchGen.Data())); - if(aodGenJets){ - Int_t iCount = 0; - for(int ig = 0;ig < aodGenJets->GetEntries();++ig){ - if(iCount>=kMaxJets)continue; - AliAODJet *tmp = dynamic_cast(aodGenJets->At(ig)); - if(!tmp)continue; - if(fLimitGenJetEta){ - if(tmp->Eta()>fJetHeaderRec->GetJetEtaMax()|| - tmp->Eta()GetJetEtaMin())continue; - } - genJets[iCount] = *tmp; - iCount++; - } - nGenJets = iCount; - } - else{ - Printf("%s:%d Generated jet branch %s not found",(char*)__FILE__,__LINE__,fBranchGen.Data()); - } - } - - fh1NGenJets->Fill(nGenJets); - // We do not want to exceed the maximum jet number - nGenJets = TMath::Min(nGenJets,kMaxJets); - - - // - // Fetch the reconstructed jets... - // - - - nRecJets = TMath::Min(nRecJets,kMaxJets); - - for(int ir = 0;ir < nRecJets;++ir){ - AliAODJet *tmp = dynamic_cast(aodRecJets->At(ir)); - if(!tmp)continue; - recJets[ir] = *tmp; - } - - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - - // - // Relate the jets - // - Int_t iGenIndex[kMaxJets]; // Index of the generated jet for i-th rec -1 if none - Int_t iRecIndex[kMaxJets]; // Index of the rec jet for i-th gen -1 if none - - for(int i = 0;i 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - - if(fDebug){ - for(int i = 0;i=0)Printf("iGenFound: %d -> %d",i,iGenIndex[i]); - if(iRecIndex[i]>=0)Printf("iRecFound: %d -> %d",i,iRecIndex[i]); - } - } - - // - // Now the premliminaries are over, lets do the jet analysis - // - - - Double_t value[4]; // for the thnsparse - // loop over reconstructed jets - for(int ir = 0;ir < nRecJets;++ir){ - Double_t ptRec = recJets[ir].Pt(); - Double_t phiRec = recJets[ir].Phi(); - if(phiRec<0)phiRec+=TMath::Pi()*2.; - Double_t etaRec = recJets[ir].Eta(); - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - fh1PtRecIn->Fill(ptRec,eventW); - if(fAnalysisType==kSysJetOrder)((TH1F*)fHistList->FindObject(Form("fh1PtRecIn_%s%d",fgkSysName[kSysJetOrder],ir)))->Fill(ptRec,eventW); - fh3RecInEtaPhiPt->Fill(etaRec,phiRec,ptRec,eventW); - // Fill Correlation - Int_t ig = iGenIndex[ir]; - if(ig>=0 && ig 10)Printf("%s:%d ig = %d ir = %d",(char*)__FILE__,__LINE__,ig,ir); - fh1PtRecOut->Fill(ptRec,eventW); - if(fAnalysisType==kSysJetOrder)((TH1F*)fHistList->FindObject(Form("fh1PtRecOut_%s%d",fgkSysName[kSysJetOrder],ir)))->Fill(ptRec,eventW); - Double_t ptGen = genJets[ig].Pt(); - Double_t phiGen = genJets[ig].Phi(); - if(phiGen<0)phiGen+=TMath::Pi()*2.; - Double_t etaGen = genJets[ig].Eta(); - - fh3RecOutEtaPhiPt->Fill(etaRec,phiRec,ptRec,eventW); - - value[0] = ptRec; - value[1] = ptGen; - value[2] = etaRec; - value[3] = etaGen; - - fhnCorrelation->Fill(value,eventW); - if(fAnalysisType==kSysJetOrder)((THnSparseF*)fHistList->FindObject(Form("fhnCorrelation_%s%d",fgkSysName[kSysJetOrder],ir)))->Fill(value,eventW); - // - // we accept only jets which are detected within a smaller window, to - // avoid ambigious pair association at the edges of the acceptance - // - - if(TMath::Abs(etaRec)Fill(ptRec,ptGen,eventW); - fh2PhiFGen->Fill(phiRec,phiGen,eventW); - fh2EtaFGen->Fill(etaRec,etaGen,eventW); - fh2PtGenDeltaEta->Fill(ptGen,etaGen-etaRec,eventW); - fh2PtGenDeltaPhi->Fill(ptGen,phiGen-phiRec,eventW); - }// if etarec in window - }//if ig valid - }// loop over reconstructed jets - - - // Now llop over generated jets - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - for(int ig = 0;ig < nGenJets;++ig){ - Double_t ptGen = genJets[ig].Pt(); - // Fill Correlation - Double_t phiGen = genJets[ig].Phi(); - if(phiGen<0)phiGen+=TMath::Pi()*2.; - Double_t etaGen = genJets[ig].Eta(); - fh3GenInEtaPhiPt->Fill(etaGen,phiGen,ptGen,eventW); - fh1PtGenIn->Fill(ptGen,eventW); - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - if(fAnalysisType==kSysJetOrder)((TH1F*)fHistList->FindObject(Form("fh1PtGenIn_%s%d",fgkSysName[kSysJetOrder],ig)))->Fill(ptGen,eventW); - Int_t ir = iRecIndex[ig]; - if(ir>=0&&irFill(ptGen,eventW); - fh3GenOutEtaPhiPt->Fill(etaGen,phiGen,ptGen,eventW); - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - if(fAnalysisType==kSysJetOrder)((TH1F*)fHistList->FindObject(Form("fh1PtGenOut_%s%d",fgkSysName[kSysJetOrder],ig)))->Fill(ptGen,eventW); - } - }// loop over reconstructed jets - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - PostData(1, fHistList); -} - -void AliAnalysisTaskJFSystematics::Terminate(Option_t */*option*/) -{ -// Terminate analysis -// - if (fDebug > 1) printf("AnalysisTaskJFSystematics: Terminate() \n"); - // Plot - - -} diff --git a/PWGJE/AliAnalysisTaskJFSystematics.h b/PWGJE/AliAnalysisTaskJFSystematics.h deleted file mode 100644 index 6b62676ee9b..00000000000 --- a/PWGJE/AliAnalysisTaskJFSystematics.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef ALIANALYSISTASKJFSYSTEMATICS_H -#define ALIANALYSISTASKJFSYSTEMATICS_H - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -// ************************************** -// Task used for the correction of determiantion of reconstructed jet spectra -// Compares input (gen) and output (rec) jets -// ******************************************* - -#include "AliAnalysisTaskSE.h" -#include "THnSparse.h" // cannot forward declare ThnSparseF - -//////////////// -class AliJetHeader; -class AliESDEvent; -class AliAODEvent; -class AliAODJet; -class AliGenPythiaEventHeader; - -class TList; -class TChain; -class TH2F; -class TH3F; -class TProfile; - - - -class AliAnalysisTaskJFSystematics : public AliAnalysisTaskSE -{ - public: - AliAnalysisTaskJFSystematics(); - AliAnalysisTaskJFSystematics(const char* name); - virtual ~AliAnalysisTaskJFSystematics() {;} - // Implementation of interface methods - virtual void UserCreateOutputObjects(); - virtual void Init(); - virtual void LocalInit() { Init(); } - virtual void UserExec(Option_t *option); - virtual void Terminate(Option_t *option); - virtual Bool_t Notify(); - - - virtual void SetExternalWeight(Float_t f){fExternalWeight = f;} - virtual void SetUseExternalWeightOnly(Bool_t b){fUseExternalWeightOnly = b;} - virtual void SetAODInput(Bool_t b){fUseAODInput = b;} - virtual void SetLimitGenJetEta(Bool_t b){fLimitGenJetEta = b;} - virtual void SetRecEtaWindow(Float_t f){fRecEtaWindow = f;} - virtual void SetAnalysisType(UInt_t i){fAnalysisType = i;} - virtual void SetBranchGen(const char* c){fBranchGen = c;} - virtual void SetBranchRec(const char* c){fBranchRec = c;} - - // ========= TODO Multiplicity dependence ====== - // ========= TODO z-dependence? ====== - // ========= TODO flavor dependence ======== - // ============================================ - enum {kSysJetOrder = 1, kSysTypes}; - - enum {kMaxJets = 6}; // limit to 6 jets... - - private: - - AliAnalysisTaskJFSystematics(const AliAnalysisTaskJFSystematics&); - AliAnalysisTaskJFSystematics& operator=(const AliAnalysisTaskJFSystematics&); - - - static const Int_t fgkSysBins[kSysTypes]; - static const char* fgkSysName[kSysTypes]; - - AliJetHeader *fJetHeaderRec; - AliJetHeader *fJetHeaderGen; - AliAODEvent *fAOD; // where we take the jets from can be input or output AOD - - TString fBranchRec; // AOD branch name for reconstructed - TString fBranchGen; // AOD brnach for genereated - - Bool_t fUseAODInput; // use AOD input - Bool_t fUseExternalWeightOnly; // use only external weight - Bool_t fLimitGenJetEta; // Limit the eta of the generated jets - UInt_t fAnalysisType; // Analysis type - Float_t fExternalWeight; // external weight - Float_t fRecEtaWindow; // eta window used for corraltion plots between rec and gen - Float_t fAvgTrials; // average number of trials from pyxsec.root or pysec_hists.root in case trials are not avaiable from the MC Header - // Event histograms - TProfile* fh1Xsec; // pythia cross section and trials - TH1F* fh1Trials; // trials are added - TH1F* fh1PtHard; // Pt har of the even - TH1F* fh1PtHardNoW; // Pt hard of the event without trials - TH1F* fh1PtHardTrials; // Number of trials - TH1F* fh1NGenJets; // number of generated jets - TH1F* fh1NRecJets; // number of reconstructed jets - - TH1F* fh1PtRecIn; // Jet pt for all - TH1F* fh1PtRecOut; // Jet pt with corellated generated jet - TH1F* fh1PtGenIn; // Detection efficiency for given p_T.gen - TH1F* fh1PtGenOut; // gen pT of found jets - - TH2F* fh2PtFGen; // correlation betwen genreated and found jet pT - TH2F* fh2PhiFGen; // correlation betwen genreated and found jet phi - TH2F* fh2EtaFGen; // correlation betwen genreated and found jet eta - TH2F* fh2PtGenDeltaPhi; // difference between generated and found jet phi - TH2F* fh2PtGenDeltaEta; // difference between generated and found jet eta - - - TH3F* fh3RecInEtaPhiPt; // correlation between eta phi and rec pt - TH3F* fh3RecOutEtaPhiPt; // correlation between eta phi and rec pt of jets with a partner - TH3F* fh3GenInEtaPhiPt; // correlation between eta phi and gen pt - TH3F* fh3GenOutEtaPhiPt; // correlation between eta phi and gen pt of jets with a partner - - THnSparseF* fhnCorrelation; // correlation can be used for unfolding - - - TList *fHistList; // Output list - - - ClassDef(AliAnalysisTaskJFSystematics, 2) // Analysis task for standard jet analysis -}; - -#endif diff --git a/PWGJE/AliAnalysisTaskJetChem.h b/PWGJE/AliAnalysisTaskJetChem.h index 0394a821102..6c961b4465e 100644 --- a/PWGJE/AliAnalysisTaskJetChem.h +++ b/PWGJE/AliAnalysisTaskJetChem.h @@ -17,6 +17,7 @@ /* $Id$ */ #include "AliAnalysisTaskFragmentationFunction.h" +#include "AliPID.h" class AliAnalysisTaskJetChem : public AliAnalysisTaskFragmentationFunction { diff --git a/PWGJE/AliAnalysisTaskJetCore.cxx b/PWGJE/AliAnalysisTaskJetCore.cxx index 7ab7b24b209..edc2451c42b 100644 --- a/PWGJE/AliAnalysisTaskJetCore.cxx +++ b/PWGJE/AliAnalysisTaskJetCore.cxx @@ -26,6 +26,7 @@ #include "TChain.h" #include "TTree.h" #include "TMath.h" +#include "TH1I.h" #include "TH1F.h" #include "TH2F.h" #include "TH3F.h" diff --git a/PWGJE/AliAnalysisTaskJetCore.h b/PWGJE/AliAnalysisTaskJetCore.h index 1dadd829329..9596e0c68fb 100644 --- a/PWGJE/AliAnalysisTaskJetCore.h +++ b/PWGJE/AliAnalysisTaskJetCore.h @@ -13,6 +13,7 @@ // ******************************************* class TH1F; +class TH1I; class TH2F; class TH3F; class THnSparse; diff --git a/PWGJE/AliAnalysisTaskJetCorrections.cxx b/PWGJE/AliAnalysisTaskJetCorrections.cxx deleted file mode 100644 index 686226cb5ca..00000000000 --- a/PWGJE/AliAnalysisTaskJetCorrections.cxx +++ /dev/null @@ -1,955 +0,0 @@ -// ************************************** -// Task used for estimating a charged to neutral correction -// sona.pochybova@cern.ch -// ******************************************* - - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "AliAnalysisTaskJetCorrections.h" -#include "AliAnalysisManager.h" -#include "AliAODEvent.h" -#include "AliAODVertex.h" -#include "AliAODHandler.h" -#include "AliAODTrack.h" -#include "AliAODJet.h" -//#include "AliMCEvent.h" - -#include "AliAnalysisHelperJetTasks.h" - -// -// -// corrections to jet energy by sona -// -// - -ClassImp(AliAnalysisTaskJetCorrections) - - AliAnalysisTaskJetCorrections::AliAnalysisTaskJetCorrections() : AliAnalysisTaskSE(), - fAOD(0x0), - - fBranchRec(""), - fBranchGen(""), - - fUseAODInput(kFALSE), - - fR(0x0), - fList(0x0), - - fGlobVar(1), - fXsection(1), - - fhEGen(0x0), - fhERec(0x0), - - fhEGenRest(0x0), - fhERecRest(0x0), - - fhEsumGenRest(0x0), - fhEsumRecRest(0x0), - - fhE2vsE1Gen(0x0), - fhE2vsE1Rec(0x0), - fhE2E1vsEsumGen(0x0), - fhE2E1vsEsumRec(0x0), - fhE2E1vsE1Gen(0x0), - fhE2E1vsE1Rec(0x0), - fhE2E1vsdPhiGen(0x0), - fhE2E1vsdPhiRec(0x0), - - fhTrackBalance2(0x0), - fhTrackBalance3(0x0), - - fhEt1Et22(0x0), - fhEt1Et23(0x0) - -{ - // - // ctor - // - for (Int_t i = 0; i < 3; i++) - { - fhECorrJet10[i] = 0; - fhECorrJet05[i] = 0; - fhECorrJet01[i] = 0; - fhECorrJet001[i] = 0; - fhdEvsErec10[i] = 0; - fhdEvsErec05[i] = 0; - fhdEvsErec01[i] = 0; - fhdEvsErec001[i] = 0; - fhdPhidEta10[i] = 0; - fhdPhidEta05[i] = 0; - fhdPhidEta01[i] = 0; - fhdPhidEta001[i] = 0; - fhdPhidEtaPt10[i] = 0; - fhdPhidEtaPt05[i] = 0; - fhdPhidEtaPt01[i] = 0; - fhdPhidEtaPt001[i] = 0; - } -} - -AliAnalysisTaskJetCorrections::AliAnalysisTaskJetCorrections(const char * name): - AliAnalysisTaskSE(name), - - fAOD(0x0), - - fBranchRec(""), - fBranchGen(""), - - fUseAODInput(kFALSE), - - fR(0x0), - fList(0x0), - - fGlobVar(1), - fXsection(1), - - fhEGen(0x0), - fhERec(0x0), - - fhEGenRest(0x0), - fhERecRest(0x0), - - fhEsumGenRest(0x0), - fhEsumRecRest(0x0), - - fhE2vsE1Gen(0x0), - fhE2vsE1Rec(0x0), - fhE2E1vsEsumGen(0x0), - fhE2E1vsEsumRec(0x0), - fhE2E1vsE1Gen(0x0), - fhE2E1vsE1Rec(0x0), - fhE2E1vsdPhiGen(0x0), - fhE2E1vsdPhiRec(0x0), - - fhTrackBalance2(0x0), - fhTrackBalance3(0x0), - - fhEt1Et22(0x0), - fhEt1Et23(0x0) -{ - // - // ctor - // - for (Int_t i = 0; i < 3; i++) - { - fhECorrJet10[i] = 0; - fhECorrJet05[i] = 0; - fhECorrJet01[i] = 0; - fhECorrJet001[i] = 0; - fhdEvsErec10[i] = 0; - fhdEvsErec05[i] = 0; - fhdEvsErec01[i] = 0; - fhdEvsErec001[i] = 0; - fhdPhidEta10[i] = 0; - fhdPhidEta05[i] = 0; - fhdPhidEta01[i] = 0; - fhdPhidEta001[i] = 0; - fhdPhidEtaPt10[i] = 0; - fhdPhidEtaPt05[i] = 0; - fhdPhidEtaPt01[i] = 0; - fhdPhidEtaPt001[i] = 0; - } - DefineOutput(1, TList::Class()); -} - - - -Bool_t AliAnalysisTaskJetCorrections::Notify() -{ - // - // Implemented Notify() to read the cross sections - // and number of trials from pyxsec.root - // - - - TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree(); - Float_t xsection = 0; - Float_t ftrials = 1; - - Float_t fAvgTrials = 1; - if(tree){ - TFile *curfile = tree->GetCurrentFile(); - if (!curfile) { - Error("Notify","No current file"); - return kFALSE; - } - AliAnalysisHelperJetTasks::PythiaInfoFromFile(curfile->GetName(),xsection,ftrials); - // construct a poor man average trials - Float_t nEntries = (Float_t)tree->GetTree()->GetEntries(); - if(ftrials>=nEntries)fAvgTrials = ftrials/nEntries; // CKB take this into account for normalisation - } - - if(xsection>0)fXsection = xsection; - - return kTRUE; - -} - - -//___________________________________________________________________________________________________________________________________ -void AliAnalysisTaskJetCorrections::UserCreateOutputObjects() -{ - // - // Create the output container - // - // Printf("Analysing event %s :: # %5d\n", gSystem->pwd(), (Int_t) fEntry); - - if(fUseAODInput){ - fAOD = dynamic_cast(InputEvent()); - if(!fAOD){ - Printf("%s:%d AODEvent not found in Input Manager %d",(char*)__FILE__,__LINE__,fUseAODInput); - return; - } - } - else{ - // assume that the AOD is in the general output... - fAOD = AODEvent(); - if(!fAOD){ - Printf("%s:%d AODEvent not found in the Output",(char*)__FILE__,__LINE__); - return; - } - } - - printf("AnalysisTaskJetSpectrum::UserCreateOutputObjects() \n"); - - fList = new TList(); - - fhEGen = new TH1F("EGen", "", 100, 0, 200); - fhEGen->Sumw2(); - fList->Add(fhEGen); - - fhERec = new TH1F("ERec", "", 100, 0, 200); - fhERec->Sumw2(); - fList->Add(fhERec); - - fhEGenRest = new TH1F("EGenRest", "", 100, 0, 200); - fhEGenRest->Sumw2(); - fList->Add(fhEGenRest); - - fhERecRest = new TH1F("ERecRest", "", 100, 0, 200); - fhERecRest->Sumw2(); - fList->Add(fhERecRest); - - fhEsumGenRest = new TH1F("EsumGenRest", "", 100, 0, 200); - fhEsumGenRest->Sumw2(); - fList->Add(fhEsumGenRest); - - fhEsumRecRest = new TH1F("EsumRecRest", "", 100, 0, 200); - fhEsumRecRest->Sumw2(); - fList->Add(fhEsumRecRest); - - fhE2vsE1Gen = new TH2F("E2vsE1Gen", "", 100, 0, 200, 100, 0, 200); - fhE2vsE1Gen->Sumw2(); - fList->Add(fhE2vsE1Gen); - - fhE2vsE1Rec = new TH2F("E2vsE1Rec", "", 100, 0, 200, 100, 0, 200); - fhE2vsE1Rec->Sumw2(); - fList->Add(fhE2vsE1Rec); - - fhE2E1vsEsumGen = new TH2F("E2E1vsEsumGen", "", 100, 0, 200, 25, 0, 1); - fhE2E1vsEsumGen->Sumw2(); - fList->Add(fhE2E1vsEsumGen); - - fhE2E1vsEsumRec = new TH2F("E2E1vsEsumRec", "", 100, 0, 200, 25, 0, 1); - fhE2E1vsEsumRec->Sumw2(); - fList->Add(fhE2E1vsEsumRec); - - fhE2E1vsE1Gen = new TH2F("E2E1vsE1Gen", "", 100, 0, 200, 25, 0, 1); - fhE2E1vsE1Gen->Sumw2(); - fList->Add(fhE2E1vsE1Gen); - - fhE2E1vsE1Rec = new TH2F("E2E1vsE1Rec", "", 100, 0, 200, 25, 0, 1); - fhE2E1vsE1Rec->Sumw2(); - fList->Add(fhE2E1vsE1Rec); - - fhE2E1vsdPhiGen = new TH2F("E2E1vsdPhiGen", "", 64, -3.20, 3.20, 25, 0, 1); - fList->Add(fhE2E1vsdPhiGen); - - fhE2E1vsdPhiRec = new TH2F("E2E1vsdPhiRec", "", 64, -3.20, 3.20, 25, 0, 1); - fList->Add(fhE2E1vsdPhiRec); - - fhTrackBalance2 = new TH2F("TrackBalance2", "", 60, 0, 30, 60, 0, 30); - fhTrackBalance2->Sumw2(); - fList->Add(fhTrackBalance2); - - fhTrackBalance3 = new TH2F("TrackBalance3", "", 60, 0, 30, 60, 0, 30); - fhTrackBalance3->Sumw2(); - fList->Add(fhTrackBalance3); - - fhEt1Et22 = new TH2F("Et1Et22", "", 100, 0, 50, 100, 0, 50); - fhEt1Et22->Sumw2(); - fList->Add(fhEt1Et22); - - fhEt1Et23 = new TH2F("Et1Et23", "", 100, 0, 50, 100, 0, 50); - fhEt1Et23->Sumw2(); - fList->Add(fhEt1Et23); - - for(Int_t i = 0; i < 3; i++) - { - fhECorrJet10[i] = new TProfile(Form("ECorrJet10%d", i+1), "", 100, 0, 200, 0, 10); - fhECorrJet10[i]->SetXTitle("E_{rec} [GeV]"); - fhECorrJet10[i]->SetYTitle("C=E_{gen}/E_{rec}"); - fhECorrJet10[i]->Sumw2(); - - fhECorrJet05[i] = new TProfile(Form("ECorrJet05%d", i+1), "", 100, 0, 200, 0, 10); - fhECorrJet05[i]->SetXTitle("E_{rec} [GeV]"); - fhECorrJet05[i]->SetYTitle("C=E_{gen}/E_{rec}"); - fhECorrJet05[i]->Sumw2(); - - fhECorrJet01[i] = new TProfile(Form("ECorrJet01%d", i+1), "", 100, 0, 200, 0, 10); - fhECorrJet01[i]->SetXTitle("E_{rec} [GeV]"); - fhECorrJet01[i]->SetYTitle("C=E_{gen}/E_{rec}"); - fhECorrJet01[i]->Sumw2(); - - fhECorrJet001[i] = new TProfile(Form("ECorrJet001%d", i+1), "", 100, 0, 200, 0, 10); - fhECorrJet001[i]->SetXTitle("E_{rec} [GeV]"); - fhECorrJet001[i]->SetYTitle("C=E_{gen}/E_{rec}"); - fhECorrJet001[i]->Sumw2(); - - fhdEvsErec10[i] = new TProfile(Form("dEvsErec10_%d", i+1),"", 100, 0, 200, -1, 10); - fhdEvsErec10[i]->SetYTitle("|E_{rec}-E_{rec}|/E_{rec}"); - fhdEvsErec10[i]->SetXTitle("E_{rec} [GeV]"); - fhdEvsErec10[i]->Sumw2(); - - fhdEvsErec05[i] = new TProfile(Form("dEvsErec05_%d", i+1),"", 100, 0, 200, -1, 10); - fhdEvsErec05[i]->SetYTitle("|E_{rec}-E_{rec}|/E_{rec}"); - fhdEvsErec05[i]->SetXTitle("E_{rec} [GeV]"); - fhdEvsErec05[i]->Sumw2(); - - fhdEvsErec01[i] = new TProfile(Form("dEvsErec01_%d", i+1),"", 100, 0, 200, -1, 10); - fhdEvsErec01[i]->SetYTitle("|E_{rec}-E_{rec}|/E_{rec}"); - fhdEvsErec01[i]->SetXTitle("E_{rec} [GeV]"); - fhdEvsErec01[i]->Sumw2(); - - fhdEvsErec001[i] = new TProfile(Form("dEvsErec001_%d", i+1),"", 100, 0, 200, -1, 10); - fhdEvsErec001[i]->SetYTitle("|E_{rec}-E_{rec}|/E_{rec}"); - fhdEvsErec001[i]->SetXTitle("E_{rec} [GeV]"); - fhdEvsErec001[i]->Sumw2(); - - fhdPhidEta10[i] = new TH2F(Form("dPhidEta10_%d", i+1), "", 63, (-1)*TMath::Pi(), TMath::Pi(), 18, -0.9, 0.9); - fhdPhidEta10[i]->SetXTitle("#phi [rad]"); - fhdPhidEta10[i]->SetYTitle("#eta"); - fhdPhidEta10[i]->Sumw2(); - - fhdPhidEta05[i] = new TH2F(Form("dPhidEta05_%d", i+1), "", 63, (-1)*TMath::Pi(), TMath::Pi(), 18, -0.9, 0.9); - fhdPhidEta05[i]->SetXTitle("#phi [rad]"); - fhdPhidEta05[i]->SetYTitle("#eta"); - fhdPhidEta05[i]->Sumw2(); - - fhdPhidEta01[i] = new TH2F(Form("dPhidEta01_%d", i+1), "", 63, (-1)*TMath::Pi(), TMath::Pi(), 18, -0.9, 0.9); - fhdPhidEta01[i]->SetXTitle("#phi [rad]"); - fhdPhidEta01[i]->SetYTitle("#eta"); - fhdPhidEta01[i]->Sumw2(); - - fhdPhidEta001[i] = new TH2F(Form("dPhidEta001_%d", i+1), "", 63, (-1)*TMath::Pi(), TMath::Pi(), 18, -0.9, 0.9); - fhdPhidEta001[i]->SetXTitle("#phi [rad]"); - fhdPhidEta001[i]->SetYTitle("#eta"); - fhdPhidEta001[i]->Sumw2(); - - fhdPhidEtaPt10[i] = new TH2F(Form("dPhidEtaPt10_%d", i+1), "", 63, (-1)*TMath::Pi(), TMath::Pi(), 18, -0.9, 0.9); - fhdPhidEtaPt10[i]->SetXTitle("#phi [rad]"); - fhdPhidEtaPt10[i]->SetYTitle("#eta"); - fhdPhidEtaPt10[i]->Sumw2(); - - fhdPhidEtaPt05[i] = new TH2F(Form("dPhidEtaPt05_%d", i+1), "", 63, (-1)*TMath::Pi(), TMath::Pi(), 18, -0.9, 0.9); - fhdPhidEtaPt05[i]->SetXTitle("#phi [rad]"); - fhdPhidEtaPt05[i]->SetYTitle("#eta"); - fhdPhidEtaPt05[i]->Sumw2(); - - fhdPhidEtaPt01[i] = new TH2F(Form("dPhidEtaPt01_%d", i+1), "", 63, (-1)*TMath::Pi(), TMath::Pi(), 18, -0.9, 0.9); - fhdPhidEtaPt01[i]->SetXTitle("#phi [rad]"); - fhdPhidEtaPt01[i]->SetYTitle("#eta"); - fhdPhidEtaPt01[i]->Sumw2(); - - fhdPhidEtaPt001[i] = new TH2F(Form("dPhidEtaPt001_%d", i+1), "", 63, (-1)*TMath::Pi(), TMath::Pi(), 18, -0.9, 0.9); - fhdPhidEtaPt001[i]->SetXTitle("#phi [rad]"); - fhdPhidEtaPt001[i]->SetYTitle("#eta"); - fhdPhidEtaPt001[i]->Sumw2(); - - fList->Add(fhECorrJet10[i]); - fList->Add(fhECorrJet05[i]); - fList->Add(fhECorrJet01[i]); - fList->Add(fhECorrJet001[i]); - fList->Add(fhdEvsErec10[i]); - fList->Add(fhdEvsErec05[i]); - fList->Add(fhdEvsErec01[i]); - fList->Add(fhdEvsErec001[i]); - fList->Add(fhdPhidEta10[i]); - fList->Add(fhdPhidEta05[i]); - fList->Add(fhdPhidEta01[i]); - fList->Add(fhdPhidEta001[i]); - fList->Add(fhdPhidEtaPt10[i]); - fList->Add(fhdPhidEtaPt05[i]); - fList->Add(fhdPhidEtaPt01[i]); - fList->Add(fhdPhidEtaPt001[i]); - } - - Printf("UserCreateOutputObjects finished\n"); -} - -//__________________________________________________________________________________________________________________________________________ -void AliAnalysisTaskJetCorrections::Init() -{ - printf("AliAnalysisJetCut::Init() \n"); -} - -//____________________________________________________________________________________________________________________________________________ -void AliAnalysisTaskJetCorrections::UserExec(Option_t * ) -{ -// if (fDebug > 1) printf("Analysing event # %5d\n", (Int_t) fEntry); - - - //create an AOD handler - AliAODHandler *aodH = dynamic_cast(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()); - - if(!aodH) - { - Printf("%s:%d no output aodHandler found Jet",(char*)__FILE__,__LINE__); - return; - } - -// AliMCEvent* mcEvent =MCEvent(); -// if(!mcEvent){ -// Printf("%s:%d no mcEvent",(char*)__FILE__,__LINE__); -// return; -// } - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - - //primary vertex - AliAODVertex * pvtx = dynamic_cast(fAOD->GetPrimaryVertex()); - if(!pvtx) return; - - AliAODJet genJets[kMaxJets]; - Int_t nGenJets = 0; - - AliAODJet recJets[kMaxJets]; - Int_t nRecJets = 0; - - //array of reconstructed jets from the AOD input - TClonesArray *aodRecJets = dynamic_cast(fAOD->FindListObject(fBranchRec.Data())); - if(!aodRecJets){ - Printf("%s:%d no reconstructed Jet array with name %s in AOD",(char*)__FILE__,__LINE__,fBranchRec.Data()); - return; - } - - // reconstructed jets - nRecJets = aodRecJets->GetEntries(); - nRecJets = TMath::Min(nRecJets, kMaxJets); - - for(int ir = 0;ir < nRecJets;++ir) - { - AliAODJet *tmp = dynamic_cast(aodRecJets->At(ir)); - if(!tmp)continue; - recJets[ir] = *tmp; - } - - // If we set a second branch for the input jets fetch this - TClonesArray * aodGenJets = dynamic_cast(fAOD->FindListObject(fBranchGen.Data())); - - if(!aodGenJets) - { - printf("NO MC jets branch with name %s Found \n",fBranchGen.Data()); - return; - } - - // //Generated jets - nGenJets = aodGenJets->GetEntries(); - nGenJets = TMath::Min(nGenJets, kMaxJets); - - for(Int_t ig =0 ; ig < nGenJets; ++ig) - { - AliAODJet * tmp = dynamic_cast(aodGenJets->At(ig)); - if(!tmp)continue; - genJets[ig] = * tmp; - } - - Double_t eRec[kMaxJets]; - Double_t eGen[kMaxJets]; - - Double_t eRecRest[kMaxJets]; - Double_t eGenRest[kMaxJets]; - -// AliAODJet jetRec[kMaxJets]; - AliAODJet jetGen[kMaxJets]; - - Int_t idxRec[kMaxJets]; - Int_t idxGen[kMaxJets]; - -// Double_t EsumRec = 0; - // Double_t EsumGen =0; - - TLorentzVector vRec[kMaxJets]; - TLorentzVector vGen[kMaxJets]; - - TLorentzVector vsumRec; - TLorentzVector vsumGen; - - TVector3 pRec[kMaxJets]; - TVector3 pGen[kMaxJets]; - - // HISTOS FOR MC - Int_t nGenSel = 0; - Int_t counter = 0; - Int_t tag = 0; - - AliAODJet selJets[kMaxJets]; - - // loop for applying the separation cut - for(Int_t i = 0; i < nGenJets; i++) - { - if(nGenJets == 1) - { - selJets[nGenSel] = genJets[i]; - nGenSel++; - } - else - { - counter = 0; - tag = 0; - for(Int_t j = 0; j < nGenJets; j++) - { - if(i!=j) - { - Double_t dRij = genJets[i].DeltaR(&genJets[j]); - counter++; - if(dRij > 2*fR) tag++; - } - } - if(counter!=0) - { - if(tag/counter == 1) - { - selJets[nGenSel] = genJets[i]; - nGenSel++; - } - } - } - } - - for (Int_t gj = 0; gj < nGenSel; gj++) - { - eGen[gj] = selJets[gj].E(); - fhEGen->Fill(eGen[gj], fXsection); - } - - TMath::Sort(nGenSel, eGen, idxGen); - for (Int_t ig = 0; ig < nGenSel; ig++) - jetGen[ig] = selJets[idxGen[ig]]; - - //rest frame MC jets - for (Int_t i = 0; i < nGenSel; ++i) - { - vGen[i].SetPxPyPzE(jetGen[i].Px(), jetGen[i].Py(), jetGen[i].Pz(), jetGen[i].E()); - pGen[i].SetXYZ(vGen[i].Px(), vGen[i].Py(), vGen[i].Pz()); - vsumGen += vGen[i]; - } - - if(nGenSel > 1 && pGen[0].DeltaPhi(pGen[1]) > 2.8) - { - fhE2vsE1Gen->Fill(jetGen[0].E(), jetGen[1].E(), fXsection); - fhE2E1vsEsumGen->Fill(jetGen[0].E()+jetGen[1].E(), TMath::Abs(jetGen[0].E()-jetGen[1].E())/jetGen[0].E(), fXsection); - fhE2E1vsE1Gen->Fill(jetGen[0].E(), TMath::Abs(jetGen[0].E()-jetGen[1].E())/jetGen[0].E(), fXsection); - Double_t deltaPhi = (jetGen[0].Phi()-jetGen[1].Phi()); - if(deltaPhi > TMath::Pi()) deltaPhi = deltaPhi - 2.*TMath::Pi(); - if(deltaPhi < (-1.*TMath::Pi())) deltaPhi = deltaPhi + 2.*TMath::Pi(); - fhE2E1vsdPhiGen->Fill(deltaPhi, TMath::Abs(jetGen[0].E()-jetGen[1].E())/jetGen[0].E(), fXsection); - } - - Double_t fPxGen = vsumGen.Px(); - Double_t fPyGen = vsumGen.Py(); - Double_t fPzGen = vsumGen.Pz(); - Double_t fEGen = vsumGen.E(); - - Double_t eSumGenRest = 0; - for (Int_t j = 0; j < nGenSel; j++) - { - vGen[j].Boost(-fPxGen/fEGen, -fPyGen/fEGen, -fPzGen/fEGen); - eGenRest[j] = vGen[j].E(); - if(nGenSel > 1) - fhEGenRest->Fill(eGenRest[j], fXsection); - eSumGenRest += eGenRest[j]; - } - - if(nGenSel > 1) - fhEsumGenRest->Fill(eSumGenRest, fXsection); - - //END VARIABLES FOR MC JETS --------------- - // } - - //AOD JET VARIABLES - Int_t nRecSel = 0; - Int_t counter1 = 0; - Int_t tag1 = 0; - - AliAODJet recSelJets[kMaxJets]; - - for(Int_t i = 0; i < nRecJets; i++) - { - if(nRecJets == 1) - { - recSelJets[nRecSel] = recJets[i]; - nRecSel++; - } - else - { - counter1 = 0; - tag1 = 0; - for(Int_t j = 0; j < nRecJets; j++) - { - if(i!=j) - { - Double_t dRij = recJets[i].DeltaR(&recJets[j]); - counter1++; - if(dRij > 2*fR) tag1++; - } - } - if(counter1!=0) - { - if(tag1/counter1 == 1) - { - recSelJets[nRecSel] = recJets[i]; - nRecSel++; - } - } - } - } - - if(nRecSel == 0) return; - Printf("******NUMBER OF JETS AFTER DELTA R CUT : %d **********\n", nRecSel); - //sort rec/gen jets by energy in C.M.S - AliAODJet jetRecTmp[kMaxJets]; - Int_t nAccJets = 0; - Double_t jetTrackPt[kTracks]; - TLorentzVector jetTrackTmp[kTracks]; - Int_t nTracks = 0; - for (Int_t rj = 0; rj < nRecSel; rj++) - { - TRefArray * jetTracksAOD = dynamic_cast(recSelJets[rj].GetRefTracks()); - if(!jetTracksAOD) continue; - if(jetTracksAOD->GetEntries() < 3) continue; - Int_t nJetTracks = 0; - for(Int_t j = 0; j < jetTracksAOD->GetEntries(); j++) - { - AliAODTrack * track = dynamic_cast(jetTracksAOD->At(j)); - if(!track) continue; - Double_t cv[21]; - track->GetCovarianceXYZPxPyPz(cv); - if(cv[14] > 1000.) continue; - jetTrackPt[nTracks] = track->Pt(); - jetTrackTmp[nTracks].SetPxPyPzE(track->Px(),track->Py(),track->Pz(),track->E()); - nTracks++; - nJetTracks++; - } - if(nJetTracks < 4) continue; - jetRecTmp[nAccJets] = recSelJets[rj]; - eRec[nAccJets] = recSelJets[rj].E(); - fhERec->Fill(eRec[nAccJets], fXsection); - nAccJets++; - } - - if(nAccJets == 0) return; - if(nTracks == 0) return; - - Printf(" ************ Number of accepted jets : %d ************ \n", nAccJets); - - AliAODJet jetRecAcc[kMaxJets]; - TMath::Sort(nAccJets, eRec, idxRec); - for (Int_t rj = 0; rj < nAccJets; rj++) - jetRecAcc[rj] = jetRecTmp[idxRec[rj]]; - - //rest frame for reconstructed jets - for (Int_t i = 0; i < nAccJets; i++) - { - vRec[i].SetPxPyPzE(jetRecAcc[i].Px(), jetRecAcc[i].Py(), jetRecAcc[i].Pz(), jetRecAcc[i].E()); - pRec[i].SetXYZ(vRec[i].Px(), vRec[i].Py(), vRec[i].Pz()); - vsumRec += vRec[i]; - } - - //check balance of two leading hadrons, deltaPhi > 2. - Int_t idxTrack[kTracks]; - TMath::Sort(nTracks, jetTrackPt, idxTrack); - - TLorentzVector jetTrack[kTracks]; - for(Int_t iTr = 0; iTr < nTracks; iTr++) - jetTrack[iTr] = jetTrackTmp[idxTrack[iTr]]; - - Int_t n = 1; - while(jetTrack[0].DeltaPhi(jetTrack[n]) < 2.8) - n++; - - Double_t et1 = 0; - Double_t et2 = 0; - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - if(TMath::Abs(jetTrack[0].DeltaPhi(jetTrack[iTr]) < 1.) && iTr != 0) - et1 += jetTrack[iTr].Et(); - - if(TMath::Abs(jetTrack[n].DeltaPhi(jetTrack[iTr]) < 1.) && iTr != n) - et2 += jetTrack[iTr].Et(); - } - - if(nAccJets == 2) - { - fhTrackBalance2->Fill(jetTrack[0].Et(), jetTrack[n].Et()); - fhEt1Et22->Fill(et1, et2); - } - if(nAccJets == 3) - { - fhTrackBalance3->Fill(jetTrack[0].Et(), jetTrack[n].Et()); - fhEt1Et23->Fill(et1, et2); - } - - if(nAccJets > 1 && pRec[0].DeltaPhi(pRec[1]) > 2.8) - { - fhE2vsE1Rec->Fill(jetRecAcc[0].E(), jetRecAcc[1].E(), fXsection); - fhE2E1vsEsumRec->Fill(jetRecAcc[0].E()+jetRecAcc[1].E(), TMath::Abs(jetRecAcc[0].E()-jetRecAcc[1].E())/jetRecAcc[0].E(), fXsection); - fhE2E1vsE1Rec->Fill(jetRecAcc[0].E(), TMath::Abs(jetRecAcc[0].E()-jetRecAcc[1].E())/jetRecAcc[0].E(), fXsection); - Double_t deltaPhi = (jetRecAcc[0].Phi()-jetRecAcc[1].Phi()); - if(deltaPhi > TMath::Pi()) deltaPhi = deltaPhi - 2.*TMath::Pi(); - if(deltaPhi < (-1.*TMath::Pi())) deltaPhi = deltaPhi + 2.*TMath::Pi(); - fhE2E1vsdPhiRec->Fill(-1*deltaPhi, TMath::Abs(jetRecAcc[0].E()-jetRecAcc[1].E())/jetRecAcc[0].E(), fXsection); - } - - Double_t fPx = vsumRec.Px(); - Double_t fPy = vsumRec.Py(); - Double_t fPz = vsumRec.Pz(); - Double_t fE = vsumRec.E(); - - Double_t eSumRecRest = 0; - for (Int_t j = 0; j < nAccJets; j++) - { - vRec[j].Boost(-fPx/fE, -fPy/fE, -fPz/fE); - eRecRest[j] = vRec[j].E(); - if(nAccJets > 1) - fhERecRest->Fill(eRecRest[j], fXsection); - eSumRecRest += eRecRest[j]; - } - if(nAccJets > 1) - fhEsumRecRest->Fill(eSumRecRest, fXsection); - - // Relate the jets - Int_t iGenIndex[kMaxJets]; // Index of the generated jet for i-th rec -1 if none - Int_t iRecIndex[kMaxJets]; // Index of the rec jet for i-th gen -1 if none - - for(int i = 0;i=0&&ig TMath::Pi()) dPhi = dPhi - 2.*TMath::Pi(); - if(dPhi < (-1.*TMath::Pi())) dPhi = dPhi + 2.*TMath::Pi(); - Double_t sigma = TMath::Abs(jetGen[ig].E()-jetRecAcc[ir].E())/jetGen[ig].E(); - dR = jetRecAcc[ir].DeltaR(&jetGen[ig]); - if(dR < 2*fR && dR >= fR) - { - switch(nAccJets) - { - case 1: - { - fhdEvsErec10[0]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - fhECorrJet10[0]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt10[0]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta10[0]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - case 2: - { - fhdEvsErec10[1]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - fhECorrJet10[1]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt10[1]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta10[1]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - case 3: - { - fhdEvsErec10[2]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - fhECorrJet10[2]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt10[2]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta10[2]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - } - } - if(dR < fR && dR >= 0.1) - { - switch(nAccJets) - { - case 1: - { - fhdEvsErec05[0]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - fhECorrJet05[0]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt05[0]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta05[0]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - case 2: - { - fhdEvsErec05[1]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - fhECorrJet05[1]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt05[1]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta05[1]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - case 3: - { - fhdEvsErec05[2]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - fhECorrJet05[2]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt05[2]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta05[2]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - } - } - if(dR < 0.1 && dR >= 0.01) - { - switch(nAccJets) - { - case 1: - { - fhdEvsErec01[0]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - fhECorrJet01[0]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt01[0]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta01[0]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - case 2: - { - fhdEvsErec01[1]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - fhECorrJet01[1]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt01[1]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta01[1]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - case 3: - { - fhdEvsErec01[2]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - fhECorrJet01[2]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt01[2]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta01[2]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - } - } - if(dR > 0.01) continue; - switch(nAccJets) - { - case 1: - { - fhECorrJet001[0]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - fhdEvsErec001[0]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt001[0]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta001[0]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - case 2: - { - fhECorrJet001[1]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - fhdEvsErec001[1]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt001[1]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta001[1]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - case 3: - { - fhECorrJet001[2]->Fill(jetRecAcc[ir].E(), jetGen[ig].E()/jetRecAcc[ir].E(), fXsection); - fhdEvsErec001[2]->Fill(jetRecAcc[ir].E(), sigma, fXsection); - for(Int_t iTr = 0; iTr < nTracks; iTr++) - { - fhdPhidEtaPt001[2]->Fill(jetTrack[iTr].Phi(), jetTrack[iTr].Eta(), jetTrack[iTr].Pt()); - fhdPhidEta001[2]->Fill(jetTrack[iTr].Phi(), jetTrack[ir].Eta()); - } - } - break; - } - } - } - // loop over reconstructed jets - } - - Printf("%s:%d",(char*)__FILE__,__LINE__); - - PostData(1, fList); - - Printf("%s:%d Data Posted",(char*)__FILE__,__LINE__); - -} - - -//__________________________________________________________________________________________________________________________________________________ -void AliAnalysisTaskJetCorrections::Terminate(Option_t *) -{ - printf("AnalysisJetCorrections::Terminate()"); - -} - -//_______________________________________User defined functions_____________________________________________________________________________________ - - diff --git a/PWGJE/AliAnalysisTaskJetCorrections.h b/PWGJE/AliAnalysisTaskJetCorrections.h deleted file mode 100644 index 5739d131640..00000000000 --- a/PWGJE/AliAnalysisTaskJetCorrections.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef ALIANALYSISTASKJETCORRECTIONS_H -#define ALIANALYSISTASKJETCORRECTIONS_H - -#include "AliAnalysisTaskSE.h" - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -// *** -// corrections to jet energy by sona.pochybova@cern.ch -// *** - -class AliJetFinder; -class AliESDEvent; -class AliAODEvent; -class AliAODJet; -class AliGenPythiaEventHeader; -class AliAODPid; - -class TList; -class TArrayD; -class TChain; -class TH1; -class TH2; -class TH1F; -class TH2F; -class TH2I; -class TH3D; -class TTree; -class TProfile; -class TLorentzVector; -class TVector3; -class TParticle; - -class AliAnalysisTaskJetCorrections : public AliAnalysisTaskSE -{ - public: - AliAnalysisTaskJetCorrections(); - AliAnalysisTaskJetCorrections(const char * name); - virtual ~AliAnalysisTaskJetCorrections() {;} - - //Implementation of interface methods - virtual Bool_t Notify(); - virtual void UserCreateOutputObjects(); - virtual void Init(); - virtual void LocalInit() { Init(); }; - virtual void UserExec(Option_t * option); - virtual void Terminate(Option_t * option); - - virtual void SetAODInput(Bool_t b){fUseAODInput = b;} - - virtual void SetBranchGen(const char* c){fBranchGen = c;} - virtual void SetBranchRec(const char* c){fBranchRec = c;} - - virtual Double_t SetR(Double_t b){fR = b; return fR;} - - private: - AliAnalysisTaskJetCorrections(const AliAnalysisTaskJetCorrections&); - AliAnalysisTaskJetCorrections& operator = (const AliAnalysisTaskJetCorrections&); - - enum {kMaxJets = 6}; - enum {kMaxEvents = 10}; - enum {kJets = 3}; - enum {kTracks = 1000}; - - AliAODEvent *fAOD; // where we take the jets from can be input or output AOD - - TString fBranchRec; // AOD branch name for reconstructed - TString fBranchGen; // AOD brnach for genereated - - Bool_t fUseAODInput; // use aod input not output - Double_t fR; // radius - TList * fList; // output list - - Int_t fGlobVar; // switch enabling checking out just one event - Double_t fXsection; // cross-section - - - TH1F * fhEGen; // generated energy histogram - TH1F * fhERec; // reconstructed energy histogram - TH1F * fhEGenRest; // generated energy in the rest frame of three-jet events - TH1F * fhERecRest; // generated energy in the rest frame of three-jet events - TH1F * fhEsumGenRest; //generated summed energy in the rest frame of three-jet events - TH1F * fhEsumRecRest; // reconstructed summed energy in the rest frame of three-jet events - - TH2F * fhE2vsE1Gen; // leading vs next-to leading jet energy, generated - TH2F * fhE2vsE1Rec; // leading vs next-to leading jet energy, reconstruted - TH2F * fhE2E1vsEsumGen; // E2,E1 diference vs. summed energy, generated - TH2F * fhE2E1vsEsumRec; // E2, E1 difference vs summed jet energy, reconstructed - TH2F * fhE2E1vsE1Gen; // E2, E1 difference vs E1, generated - TH2F * fhE2E1vsE1Rec; // E2, E1 diference vs E1, reeconstructed - TH2F * fhE2E1vsdPhiGen; // E2, E1 difference vs dPhi, generated - TH2F * fhE2E1vsdPhiRec; // E2, E1 difference vs dPhi, reconstrted - - TH2F * fhTrackBalance2; // track balance in 2-jet events - TH2F * fhTrackBalance3; // track balance in 3-jet events - - TH2F * fhEt1Et22; // Et1,2 in back-to-back cones in 2-jet events - TH2F * fhEt1Et23; // Et1,2 in back-to-back cones in 3-jet events - - TProfile * fhECorrJet10[3]; // corr. factor for jets matched within dR = 1. - TProfile * fhECorrJet05[3]; // corr. factor for jets matched within dR = .5 - TProfile * fhECorrJet01[3]; // corr. factor for jets matched within dR = .1 - TProfile * fhECorrJet001[3]; // corr. factor for jets matched within dR = .01 - - TProfile * fhdEvsErec10[3]; // energy difference vs rec. energy, dR = 1. - TProfile * fhdEvsErec05[3]; // energy difference vs rec. energy, dR = .5 - TProfile * fhdEvsErec01[3]; // energy difference vs rec. energy, dR = .1 - TProfile * fhdEvsErec001[3]; // energy difference vs rec. energy, dR = .01 - - TH2F * fhdPhidEta10[3]; // dPhi vs dEta of particles, dR = 1. - TH2F * fhdPhidEta05[3]; // dPhi vs dEta of particles, dR = .5 - TH2F * fhdPhidEta01[3]; // dPhi vs dEta of particles, dR = .1 - TH2F * fhdPhidEta001[3]; // dPhi vs dEta of particles, dR = .01 - - TH2F * fhdPhidEtaPt10[3]; // Pt weighted dPhi vs dEta of particles, dR = 1. - TH2F * fhdPhidEtaPt05[3]; // Pt weighted dPhi vs dEta of particles, dR = .5 - TH2F * fhdPhidEtaPt01[3]; // Pt weighted dPhi vs dEta of particles, dR = .1 - TH2F * fhdPhidEtaPt001[3]; // Pt weighted dPhi vs dEta of particles, dR = .01 - ClassDef(AliAnalysisTaskJetCorrections, 1) -}; - -#endif diff --git a/PWGJE/AliAnalysisTaskJetResponse.cxx b/PWGJE/AliAnalysisTaskJetResponse.cxx deleted file mode 100644 index bbf08162ea9..00000000000 --- a/PWGJE/AliAnalysisTaskJetResponse.cxx +++ /dev/null @@ -1,563 +0,0 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -// -// task compares jets in two branches, -// written for analysis of jet embedding in HI events -// -// newer class: AliAnalysisTaskJetResponseV2 -// - -#include "TChain.h" -#include "TTree.h" -#include "TMath.h" -#include "TH1F.h" -#include "TH2F.h" -#include "TH3F.h" -#include "TCanvas.h" - -#include "AliLog.h" - -#include "AliAnalysisTask.h" -#include "AliAnalysisManager.h" - -#include "AliVEvent.h" -#include "AliESDEvent.h" -#include "AliESDInputHandler.h" -#include "AliCentrality.h" -#include "AliAnalysisHelperJetTasks.h" -#include "AliInputEventHandler.h" - -#include "AliAODEvent.h" -#include "AliAODJet.h" - -#include "AliAnalysisTaskJetResponse.h" - -ClassImp(AliAnalysisTaskJetResponse) - -AliAnalysisTaskJetResponse::AliAnalysisTaskJetResponse() : - AliAnalysisTaskSE(), - fESD(0x0), - fAOD(0x0), - fOfflineTrgMask(AliVEvent::kAny), - fMinContribVtx(1), - fVtxZMin(-8.), - fVtxZMax(8.), - fEvtClassMin(1), - fEvtClassMax(4), - fCentMin(0.), - fCentMax(100.), - fNInputTracksMin(0), - fNInputTracksMax(-1), - fReactionPlaneBin(-1), - fJetEtaMin(-.5), - fJetEtaMax(.5), - fJetPtMin(20.), - fJetPtFractionMin(0.5), - fNMatchJets(4), - //fJetDeltaEta(.4), - //fJetDeltaPhi(.4), - fEvtClassMode(0), - fkNbranches(2), - fkEvtClasses(12), - fOutputList(0x0), - fHistEvtSelection(0x0), - fHistEvtClass(0x0), - fHistCentrality(0x0), - fHistNInputTracks(0x0), - //fHistNInputTracks2(0x0), - fHistCentVsTracks(0x0), - fHistReactionPlane(0x0), - fHistReactionPlaneWrtJets(0x0), - fHistPtJet(new TH1F*[fkNbranches]), - fHistEtaPhiJet(new TH2F*[fkNbranches]), - fHistEtaPhiJetCut(new TH2F*[fkNbranches]), - fHistDeltaEtaDeltaPhiJet(new TH2F*[fkEvtClasses]), - fHistDeltaEtaDeltaPhiJetCut(new TH2F*[fkEvtClasses]), - //fHistDeltaEtaDeltaPhiJetNOMatching(new TH2F*[fkEvtClasses]), - fHistDeltaEtaEtaJet(new TH2F*[fkEvtClasses]), - fHistDeltaPtEtaJet(new TH2F*[fkEvtClasses]), - fHistPtFraction(new TH2F*[fkEvtClasses]), - fHistPtResponse(new TH2F*[fkEvtClasses]), - fHistPtSmearing(new TH2F*[fkEvtClasses]), - fHistDeltaR(new TH2F*[fkEvtClasses]), - fHistArea(new TH3F*[fkEvtClasses]), - //fHistJetPtArea(new TH2F*[fkEvtClasses]), - fHistDeltaArea(new TH2F*[fkEvtClasses]), - fHistJetPtDeltaArea(new TH2F*[fkEvtClasses]) -{ - // default Constructor - - fJetBranchName[0] = ""; - fJetBranchName[1] = ""; - - fListJets[0] = new TList; - fListJets[1] = new TList; -} - -AliAnalysisTaskJetResponse::AliAnalysisTaskJetResponse(const char *name) : - AliAnalysisTaskSE(name), - fESD(0x0), - fAOD(0x0), - fOfflineTrgMask(AliVEvent::kAny), - fMinContribVtx(1), - fVtxZMin(-8.), - fVtxZMax(8.), - fEvtClassMin(1), - fEvtClassMax(4), - fCentMin(0.), - fCentMax(100.), - fNInputTracksMin(0), - fNInputTracksMax(-1), - fReactionPlaneBin(-1), - fJetEtaMin(-.5), - fJetEtaMax(.5), - fJetPtMin(20.), - fJetPtFractionMin(0.5), - fNMatchJets(4), - fEvtClassMode(0), - fkNbranches(2), - fkEvtClasses(12), - fOutputList(0x0), - fHistEvtSelection(0x0), - fHistEvtClass(0x0), - fHistCentrality(0x0), - fHistNInputTracks(0x0), - //fHistNInputTracks2(0x0), - fHistCentVsTracks(0x0), - fHistReactionPlane(0x0), - fHistReactionPlaneWrtJets(0x0), - fHistPtJet(new TH1F*[fkNbranches]), - fHistEtaPhiJet(new TH2F*[fkNbranches]), - fHistEtaPhiJetCut(new TH2F*[fkNbranches]), - fHistDeltaEtaDeltaPhiJet(new TH2F*[fkEvtClasses]), - fHistDeltaEtaDeltaPhiJetCut(new TH2F*[fkEvtClasses]), - //fHistDeltaEtaDeltaPhiJetNOMatching(new TH2F*[fkEvtClasses]), - fHistDeltaEtaEtaJet(new TH2F*[fkEvtClasses]), - fHistDeltaPtEtaJet(new TH2F*[fkEvtClasses]), - fHistPtFraction(new TH2F*[fkEvtClasses]), - fHistPtResponse(new TH2F*[fkEvtClasses]), - fHistPtSmearing(new TH2F*[fkEvtClasses]), - fHistDeltaR(new TH2F*[fkEvtClasses]), - fHistArea(new TH3F*[fkEvtClasses]), - //fHistJetPtArea(new TH2F*[fkEvtClasses]), - fHistDeltaArea(new TH2F*[fkEvtClasses]), - fHistJetPtDeltaArea(new TH2F*[fkEvtClasses]) -{ - // Constructor - - fJetBranchName[0] = ""; - fJetBranchName[1] = ""; - - fListJets[0] = new TList; - fListJets[1] = new TList; - - DefineOutput(1, TList::Class()); -} - -AliAnalysisTaskJetResponse::~AliAnalysisTaskJetResponse() -{ - delete fListJets[0]; - delete fListJets[1]; -} - -void AliAnalysisTaskJetResponse::SetBranchNames(const TString &branch1, const TString &branch2) -{ - fJetBranchName[0] = branch1; - fJetBranchName[1] = branch2; -} - -void AliAnalysisTaskJetResponse::Init() -{ - - // check for jet branches - if(!strlen(fJetBranchName[0].Data()) || !strlen(fJetBranchName[1].Data())){ - AliError("Jet branch name not set."); - } - -} - -void AliAnalysisTaskJetResponse::UserCreateOutputObjects() -{ - // Create histograms - // Called once - OpenFile(1); - if(!fOutputList) fOutputList = new TList; - fOutputList->SetOwner(kTRUE); - - Bool_t oldStatus = TH1::AddDirectoryStatus(); - TH1::AddDirectory(kFALSE); - - - fHistEvtSelection = new TH1I("fHistEvtSelection", "event selection", 6, -0.5, 5.5); - fHistEvtSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED"); - fHistEvtSelection->GetXaxis()->SetBinLabel(2,"events IN"); - fHistEvtSelection->GetXaxis()->SetBinLabel(3,"event selection (rejected)"); - fHistEvtSelection->GetXaxis()->SetBinLabel(4,"vertex cut (rejected)"); - fHistEvtSelection->GetXaxis()->SetBinLabel(5,"centrality (rejected)"); - fHistEvtSelection->GetXaxis()->SetBinLabel(6,"multiplicity (rejected)"); - - fHistEvtClass = new TH1I("fHistEvtClass", "event classes (centrality) ", fkEvtClasses, -0.5, fkEvtClasses-0.5); - fHistCentrality = new TH1F("fHistCentrality", "event centrality", 100, 0., 100.); - fHistNInputTracks = new TH1F("fHistNInputTracks", "nb. of input tracks", 400, 0., 4000.); - //fHistNInputTracks2 = new TH2F("fHistNInputTracks2", "nb. of input tracks;from B0;from Bx", 400, 0., 4000., 400, 0., 4000.); - fHistCentVsTracks = new TH2F("fHistCentVsTracks", "centrality vs. nb. of input tracks;centrality;input tracks", 100, 0., 100., 400, 0., 4000.); - fHistReactionPlane = new TH1F("fHistReactionPlane", "reaction plane", 30, 0., TMath::Pi()); - fHistReactionPlaneWrtJets = new TH1F("fHistReactionPlaneWrtJets", "reaction plane wrt jets", 48, -TMath::Pi(), TMath::Pi()); - - for (Int_t iBranch = 0; iBranch < fkNbranches; iBranch++) { - fHistPtJet[iBranch] = new TH1F(Form("fHistPtJet%i", iBranch), - Form("p_{T} of jets from branch %i;p_{T} (GeV/c);counts", iBranch), - 250, 0., 250.); - fHistPtJet[iBranch]->SetMarkerStyle(kFullCircle); - - fHistEtaPhiJet[iBranch] = new TH2F(Form("fHistEtaPhiJet%i", iBranch), - Form("#eta - #phi of jets from branch %i (before cut);#eta;#phi", iBranch), - 28, -0.7, 0.7, 100, 0., 2*TMath::Pi()); - fHistEtaPhiJetCut[iBranch] = new TH2F(Form("fHistEtaPhiJetCut%i", iBranch), - Form("#eta - #phi of jets from branch %i (before cut);#eta;#phi", iBranch), - 28, -0.7, 0.7, 100, 0., 2*TMath::Pi()); - - } - - for (Int_t iEvtClass =0; iEvtClass < fkEvtClasses; iEvtClass++) { - fHistDeltaEtaDeltaPhiJet[iEvtClass] = new TH2F(Form("fHistDeltaEtaDeltaPhiJet%i",iEvtClass), - "#Delta#eta - #Delta#phi of jet;#Delta#eta;#Delta#phi", - 101, -1.01, 1.01, 101, -1.01, 1.01); - fHistDeltaEtaDeltaPhiJetCut[iEvtClass] = new TH2F(Form("fHistDeltaEtaDeltaPhiJetCut%i",iEvtClass), - "#Delta#eta - #Delta#phi of jet;#Delta#eta;#Delta#phi", - 101, -1.01, 1.01, 101, -1.01, 1.01); - //fHistDeltaEtaDeltaPhiJetNOMatching[iEvtClass] = new TH2F("fHistDeltaEtaDeltaPhiJetNOMatching", - // "#Delta#eta - #Delta#phi of jets which do not match;#Delta#eta;#Delta#phi", - // 100, -2., 2., 100, TMath::Pi(), TMath::Pi()); - fHistPtResponse[iEvtClass] = new TH2F(Form("pt_response%i",iEvtClass), Form("pt_response%i;p_{T} (GeV/c);p_{T} (GeV/c)",iEvtClass), - 250, 0., 250., 250, 0., 250.); - fHistPtSmearing[iEvtClass] = new TH2F(Form("pt_smearing%i",iEvtClass), Form("pt_smearing%i;#Deltap_{T} (GeV/c);p_{T} (GeV/c)",iEvtClass), - 161, -80.5, 80.5, 250, 0., 250.); - fHistDeltaR[iEvtClass] = new TH2F(Form("hist_DeltaR%i",iEvtClass), "#DeltaR of matched jets;#Deltap_{T};#DeltaR", 161, -80.5,80.5, 85, 0.,3.4); - fHistArea[iEvtClass] = new TH3F(Form("hist_Area%i",iEvtClass), "jet area;probe p_{T};#Deltap_{T};jet area", 250, 0., 250., 161, -80.5,80.5, 100, 0.,1.0); - //fHistJetPtArea[iEvtClass] = new TH2F(Form("hist_JetPtArea%i",iEvtClass), "jet area vs. probe p_{T};jet p_{T};jet area", 250, 0.,250., 100, 0.,1.0); - fHistDeltaArea[iEvtClass] = new TH2F(Form("hist_DeltaArea%i",iEvtClass), "#DeltaArea of matched jets;#Deltap_{T};#Deltaarea", 161, -80.5, 80.5, 32, -.8, .8); - fHistJetPtDeltaArea[iEvtClass] = new TH2F(Form("hist_JetPtDeltaArea%i",iEvtClass), "#DeltaArea of matched jets vs. probe jet p_{T};#Deltap_{T};#Deltaarea", 250, 0., 250., 32, -.8, .8); - - fHistDeltaEtaEtaJet[iEvtClass] = new TH2F(Form("fHistDeltaEtaEtaJet%i", iEvtClass), - Form("#eta - #Delta#eta of matched jets from event class %i;#eta;#Delta#eta", iEvtClass), - 28, -.7, .7, 101, -1.01, 1.01); - fHistDeltaPtEtaJet[iEvtClass] = new TH2F(Form("fHistDeltaPtEtaJet%i", iEvtClass), - Form("#eta - #Deltap_{T} of matched jets from event class %i;#eta;#Deltap_{T}", iEvtClass), - 28, -.7, .7, 161, -80.5, 80.5); - fHistPtFraction[iEvtClass] = new TH2F(Form("fHistPtFraction%i", iEvtClass), - Form("fraction from embedded jet in reconstructed jet;fraction (event class %i);p_{T}^{emb}", iEvtClass), - 52, 0., 1.04, 250, 0., 250.); - } - - - fOutputList->Add(fHistEvtSelection); - fOutputList->Add(fHistEvtClass); - fOutputList->Add(fHistCentrality); - fOutputList->Add(fHistNInputTracks); - fOutputList->Add(fHistCentVsTracks); - fOutputList->Add(fHistReactionPlane); - fOutputList->Add(fHistReactionPlaneWrtJets); - - - for (Int_t iBranch = 0; iBranch < fkNbranches; iBranch++) { - fOutputList->Add(fHistPtJet[iBranch]); - fOutputList->Add(fHistEtaPhiJet[iBranch]); - fOutputList->Add(fHistEtaPhiJetCut[iBranch]); - } - - for (Int_t iEvtClass =0; iEvtClass < fkEvtClasses; iEvtClass++) { - fOutputList->Add(fHistDeltaEtaDeltaPhiJet[iEvtClass]); - fOutputList->Add(fHistDeltaEtaDeltaPhiJetCut[iEvtClass]); - //fOutputList->Add(fHistDeltaEtaDeltaPhiJetNOMatching[iEvtClass]); - fOutputList->Add(fHistDeltaEtaEtaJet[iEvtClass]); - fOutputList->Add(fHistDeltaPtEtaJet[iEvtClass]); - fOutputList->Add(fHistPtFraction[iEvtClass]); - - fOutputList->Add(fHistPtResponse[iEvtClass]); - fOutputList->Add(fHistPtSmearing[iEvtClass]); - fOutputList->Add(fHistDeltaR[iEvtClass]); - fOutputList->Add(fHistArea[iEvtClass]); - //fOutputList->Add(fHistJetPtArea[iEvtClass]); - fOutputList->Add(fHistDeltaArea[iEvtClass]); - fOutputList->Add(fHistJetPtDeltaArea[iEvtClass]); - } - - // =========== Switch on Sumw2 for all histos =========== - for (Int_t i=0; iGetEntries(); ++i) { - TH1 *h1 = dynamic_cast(fOutputList->At(i)); - if (h1){ - h1->Sumw2(); - continue; - } - } - TH1::AddDirectory(oldStatus); - - PostData(1, fOutputList); -} - -void AliAnalysisTaskJetResponse::UserExec(Option_t *) -{ - // load events, apply event cuts, then compare leading jets - if(!strlen(fJetBranchName[0].Data()) || !strlen(fJetBranchName[1].Data())){ - AliError("Jet branch name not set."); - return; - } - - fESD=dynamic_cast(InputEvent()); - if (!fESD) { - AliError("ESD not available"); - return; - } - fAOD = dynamic_cast(AODEvent()); - if (!fAOD) { - AliError("AOD not available"); - return; - } - - // -- event selection -- - fHistEvtSelection->Fill(1); // number of events before event selection - - // physics selection - AliInputEventHandler* inputHandler = (AliInputEventHandler*) - ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); - if(!(inputHandler->IsEventSelected() & fOfflineTrgMask)){ - if(fDebug) Printf(" Trigger Selection: event REJECTED ... "); - fHistEvtSelection->Fill(2); - PostData(1, fOutputList); - return; - } - - // vertex selection - AliAODVertex* primVtx = fAOD->GetPrimaryVertex(); - Int_t nTracksPrim = primVtx->GetNContributors(); - if ((nTracksPrim < fMinContribVtx) || - (primVtx->GetZ() < fVtxZMin) || - (primVtx->GetZ() > fVtxZMax) ){ - if(fDebug) Printf("%s:%d primary vertex z = %f: event REJECTED...",(char*)__FILE__,__LINE__,primVtx->GetZ()); - fHistEvtSelection->Fill(3); - PostData(1, fOutputList); - return; - } - - // event class selection (from jet helper task) - Int_t eventClass = AliAnalysisHelperJetTasks::EventClass(); - if(fDebug) Printf("Event class %d", eventClass); - if (eventClass < fEvtClassMin || eventClass > fEvtClassMax){ - fHistEvtSelection->Fill(4); - PostData(1, fOutputList); - return; - } - - // centrality selection - AliCentrality *cent = fESD->GetCentrality(); - Float_t centValue = cent->GetCentralityPercentile("V0M"); - if(fDebug) printf("centrality: %f\n", centValue); - if (centValue < fCentMin || centValue > fCentMax){ - fHistEvtSelection->Fill(4); - PostData(1, fOutputList); - return; - } - - - // multiplicity due to input tracks - Int_t nInputTracks = 0; - - TString jbname(fJetBranchName[1]); - for(Int_t i=1; i<=3; ++i){ - if(jbname.Contains(Form("B%d",i))) jbname.ReplaceAll(Form("B%d",i),"B0"); - } - // use only HI event - if(jbname.Contains("AODextraonly")) jbname.ReplaceAll("AODextraonly","AOD"); - if(jbname.Contains("AODextra")) jbname.ReplaceAll("AODextra","AOD"); - - if(fDebug) Printf("Multiplicity from jet branch %s", jbname.Data()); - TClonesArray *tmpAODjets = dynamic_cast(fAOD->FindListObject(jbname.Data())); - - if (tmpAODjets) { - for (Int_t iJet=0; iJetGetEntriesFast(); iJet++){ - AliAODJet *jet = dynamic_cast((*tmpAODjets)[iJet]); - if(!jet) continue; - TRefArray *trackList = jet->GetRefTracks(); - Int_t nTracks = trackList->GetEntriesFast(); - nInputTracks += nTracks; - if(fDebug) Printf("#jet%d: %d tracks", iJet, nTracks); - } - } - if(fDebug) Printf("---> input tracks: %d", nInputTracks); - - if (nInputTracks < fNInputTracksMin || (fNInputTracksMax > -1 && nInputTracks > fNInputTracksMax)){ - fHistEvtSelection->Fill(5); - PostData(1, fOutputList); - return; - } - - if(fEvtClassMode==1){ //multiplicity - fHistEvtClass->SetTitle("event classes (multiplicity)"); - eventClass = fkEvtClasses-1 - (Int_t)(nInputTracks/250.); - if(eventClass<0) eventClass = 0; - } - - - - fHistEvtSelection->Fill(0); // accepted events - fHistEvtClass->Fill(eventClass); - fHistCentrality->Fill(centValue); - fHistNInputTracks->Fill(nInputTracks); - fHistCentVsTracks->Fill(centValue,nInputTracks); - Double_t rp = AliAnalysisHelperJetTasks::ReactionPlane(kFALSE); - // -- end event selection -- - - - - // fetch jets - TClonesArray *aodJets[2]; - aodJets[0] = dynamic_cast(fAOD->FindListObject(fJetBranchName[0].Data())); // in general: embedded jet - aodJets[1] = dynamic_cast(fAOD->FindListObject(fJetBranchName[1].Data())); // in general: embedded jet + UE - - for (Int_t iJetType = 0; iJetType < 2; iJetType++) { - fListJets[iJetType]->Clear(); - if (!aodJets[iJetType]) continue; - - for (Int_t iJet = 0; iJet < aodJets[iJetType]->GetEntriesFast(); iJet++) { - AliAODJet *jet = dynamic_cast((*aodJets[iJetType])[iJet]); - if (jet) fListJets[iJetType]->Add(jet); - } - fListJets[iJetType]->Sort(); - } - - // jet matching - static TArrayI aMatchIndex(fListJets[0]->GetEntries()); - static TArrayF aPtFraction(fListJets[0]->GetEntries()); - if(aMatchIndex.GetSize()GetEntries()) aMatchIndex.Set(fListJets[0]->GetEntries()); - if(aPtFraction.GetSize()GetEntries()) aPtFraction.Set(fListJets[0]->GetEntries()); - - // stores matched jets in 'aMatchIndex' and fraction of pT in 'aPtFraction' - AliAnalysisHelperJetTasks::GetJetMatching(fListJets[0], TMath::Min((Int_t)fNMatchJets,(Int_t)fListJets[0]->GetEntries()), - fListJets[1], TMath::Min((Int_t)fNMatchJets,(Int_t)fListJets[1]->GetEntries()), - aMatchIndex, aPtFraction, fDebug); - - // loop over matched jets - Int_t ir = -1; // index of matched reconstruced jet - Float_t fraction = 0.; - AliAODJet *jet[2] = { 0x0, 0x0 }; - Float_t jetEta[2] = { 0., 0. }; - Float_t jetPhi[2] = { 0., 0. }; - Float_t jetPt[2] = { 0., 0. }; - Float_t jetArea[2] = { 0., 0. }; - - for(Int_t ig=0; igGetEntries(); ++ig){ - ir = aMatchIndex[ig]; - if(ir<0) continue; - fraction = aPtFraction[ig]; - - // fetch jets - jet[0] = (AliAODJet*)(fListJets[0]->At(ig)); - jet[1] = (AliAODJet*)(fListJets[1]->At(ir)); - if(!jet[0] || !jet[1]) continue; - - for(Int_t i=0; iEta(); - jetPhi[i] = jet[i]->Phi(); - jetPt[i] = jet[i]->Pt(); - jetArea[i] = jet[i]->EffectiveAreaCharged(); - } - - // reaction plane; - if(fReactionPlaneBin>=0){ - Int_t rpBin = AliAnalysisHelperJetTasks::GetPhiBin(TVector2::Phi_mpi_pi(rp-jetPhi[1]), 3); - if(rpBin!=fReactionPlaneBin) continue; - } - fHistReactionPlane->Fill(rp); - fHistReactionPlaneWrtJets->Fill(TVector2::Phi_mpi_pi(rp-jetPhi[1])); - - - - if(eventClass > -1 && eventClass < fkEvtClasses){ - fHistPtFraction[eventClass] -> Fill(fraction, jetPt[0]); - } - - if(fraction Fill(jetEta[i], jetPhi[i]); - } - if(eventClass > -1 && eventClass < fkEvtClasses){ - fHistDeltaEtaDeltaPhiJet[eventClass] -> Fill(deltaEta, deltaPhi); - } - - // jet acceptance + minimum pT check - if(jetEta[0]>fJetEtaMax || jetEta[0]fJetEtaMax || jetEta[1] Fill(jetPt[i]); - fHistEtaPhiJetCut[i] -> Fill(jetEta[i], jetPhi[i]); - } - - if(eventClass > -1 && eventClass < fkEvtClasses){ - fHistDeltaEtaDeltaPhiJetCut[eventClass] -> Fill(deltaEta, deltaPhi); - - fHistPtResponse[eventClass] -> Fill(jetPt[1], jetPt[0]); - fHistPtSmearing[eventClass] -> Fill(deltaPt, jetPt[0]); - - fHistDeltaPtEtaJet[eventClass] -> Fill(jetEta[0], deltaPt); - fHistDeltaEtaEtaJet[eventClass] -> Fill(jetEta[0], deltaEta); - - fHistDeltaR[eventClass] -> Fill(deltaPt, deltaR); - fHistArea[eventClass] -> Fill(jetPt[0], deltaPt, jetArea[1]); - //fHistJetPtArea[eventClass] -> Fill(jetPt[0], jetArea[1]); - fHistDeltaArea[eventClass] -> Fill(deltaPt, deltaArea); - fHistJetPtDeltaArea[eventClass] -> Fill(jetPt[0], deltaArea); - - } - } - - PostData(1, fOutputList); -} - -void AliAnalysisTaskJetResponse::Terminate(const Option_t *) -{ - // Draw result to the screen - // Called once at the end of the query - - if (!GetOutputData(1)) - return; -} - diff --git a/PWGJE/AliAnalysisTaskJetResponse.h b/PWGJE/AliAnalysisTaskJetResponse.h deleted file mode 100644 index 5d42b5b4756..00000000000 --- a/PWGJE/AliAnalysisTaskJetResponse.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef ALIANALYSISTASKJETRESPONSE_H -#define ALIANALYSISTASKJETRESPONSE_H - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -// -// task compares jets in two branches, -// written for analysis of jet embedding in HI events -// -// newer class: AliAnalysisTaskJetResponseV2 -// - -class TH1F; -class TH2F; -class TH3F; -class AliESDEvent; -class AliAODEvent; - -#include "AliAnalysisTaskSE.h" -#include "AliVEvent.h" - -class AliAnalysisTaskJetResponse : public AliAnalysisTaskSE { - public: - AliAnalysisTaskJetResponse(); - AliAnalysisTaskJetResponse(const char *name); - virtual ~AliAnalysisTaskJetResponse(); - - virtual void LocalInit() {Init();} - virtual void Init(); - virtual void UserCreateOutputObjects(); - virtual void UserExec(Option_t *option); - virtual void Terminate(const Option_t*); - - virtual AliVEvent::EOfflineTriggerTypes GetOfflineTrgMask() const { return fOfflineTrgMask; } - virtual void GetBranchNames(TString &branch1, TString &branch2) const { branch1 = fJetBranchName[0]; branch2 = fJetBranchName[1]; } - virtual Int_t GetMinContribVtx() const { return fMinContribVtx; }; - virtual Float_t GetVtxZMin() const { return fVtxZMin; } - virtual Float_t GetVtxZMax() const { return fVtxZMax; } - virtual Int_t GetEvtClassMin() const { return fEvtClassMin; } - virtual Int_t GetEvtClassMax() const { return fEvtClassMax; } - virtual Float_t GetCentMin() const { return fCentMin; } - virtual Float_t GetCentMax() const { return fCentMax; } - virtual Int_t GetNInputTracksMin() const { return fNInputTracksMin; } - virtual Int_t GetNInputTracksMax() const { return fNInputTracksMax; } - virtual Float_t GetReactionPlaneBin() const { return fReactionPlaneBin; } - virtual Float_t GetJetEtaMin() const { return fJetEtaMin; } - virtual Float_t GetJetEtaMax() const { return fJetEtaMax; } - virtual Float_t GetJetPtMin() const { return fJetPtMin; } - virtual Float_t GetJetPtFractionMin() const { return fJetPtFractionMin; } - virtual Int_t GetNMatchJets() const { return fNMatchJets; } - virtual Int_t GetEventClassMode() const { return fEvtClassMode; } - - virtual void SetBranchNames(const TString &branch1, const TString &branch2); - virtual void SetOfflineTrgMask(AliVEvent::EOfflineTriggerTypes mask) { fOfflineTrgMask = mask; } - virtual void SetMinContribVtx(Int_t n) { fMinContribVtx = n; } - virtual void SetVtxZMin(Float_t z) { fVtxZMin = z; } - virtual void SetVtxZMax(Float_t z) { fVtxZMax = z; } - virtual void SetEvtClassMin(Int_t evtClass) { fEvtClassMin = evtClass; } - virtual void SetEvtClassMax(Int_t evtClass) { fEvtClassMax = evtClass; } - virtual void SetCentMin(Float_t cent) { fCentMin = cent; } - virtual void SetCentMax(Float_t cent) { fCentMax = cent; } - virtual void SetNInputTracksMin(Int_t nTr) { fNInputTracksMin = nTr; } - virtual void SetNInputTracksMax(Int_t nTr) { fNInputTracksMax = nTr; } - virtual void SetReactionPlaneBin(Int_t rpBin) { fReactionPlaneBin = rpBin; } - virtual void SetJetEtaMin(Float_t eta) { fJetEtaMin = eta; } - virtual void SetJetEtaMax(Float_t eta) { fJetEtaMax = eta; } - virtual void SetJetPtMin(Float_t pt) { fJetPtMin = pt; } - virtual void SetJetPtFractionMin(Float_t pt) { fJetPtFractionMin = pt; } - virtual void SetNMatchJets(Int_t n) { fNMatchJets = n; } - virtual void SetEventClassMode(Int_t mode) { fEvtClassMode = mode; } - - private: - // ESD/AOD events - AliESDEvent *fESD; //! ESD object - AliAODEvent *fAOD; //! AOD event - - // jets to compare - TString fJetBranchName[2]; // name of jet branches to compare - TList *fListJets[2]; //! jet lists - - // event selection - AliVEvent::EOfflineTriggerTypes fOfflineTrgMask; // mask of offline triggers to accept - Int_t fMinContribVtx; // minimum number of track contributors for primary vertex - Float_t fVtxZMin; // lower bound on vertex z - Float_t fVtxZMax; // upper bound on vertex z - Int_t fEvtClassMin; // lower bound on event class - Int_t fEvtClassMax; // upper bound on event class - Float_t fCentMin; // lower bound on centrality - Float_t fCentMax; // upper bound on centrality - Int_t fNInputTracksMin; // lower bound of nb. of input tracks - Int_t fNInputTracksMax; // upper bound of nb. of input tracks - Float_t fReactionPlaneBin; // reaction plane bin - Float_t fJetEtaMin; // lower bound on eta for found jets - Float_t fJetEtaMax; // upper bound on eta for found jets - Float_t fJetPtMin; // minimum jet pT - Float_t fJetPtFractionMin; // minimum fraction for positiv match of jets - Int_t fNMatchJets; // maximal nb. of jets taken for matching - - Int_t fEvtClassMode; // event class mode; 0: centrality (default), 1: multiplicity - - // output objects - const Int_t fkNbranches; //! number of branches to be read - const Int_t fkEvtClasses; //! number of event classes - TList *fOutputList; //! output data container - TH1I *fHistEvtSelection; //! event selection statistic - TH1I *fHistEvtClass; //! event classes (from helper task) - TH1F *fHistCentrality; //! centrality of the event - TH1F *fHistNInputTracks; //! nb. of input tracks in the event - TH2F *fHistCentVsTracks; //! centrality vs. nb. of input tracks of the event - TH1F *fHistReactionPlane; //! reaction plane of the event - TH1F *fHistReactionPlaneWrtJets; //! reaction plane of the event wrt the jet - TH1F **fHistPtJet; //! pt distribution of jets - TH2F **fHistEtaPhiJet; //! eta-phi distribution of jets (before acceptance cuts) - TH2F **fHistEtaPhiJetCut; //! eta-phi distribution of jets in eta acceptace per event class - TH2F **fHistDeltaEtaDeltaPhiJet; //! delta eta vs. delta phi of matched jets (before acceptance cuts) - TH2F **fHistDeltaEtaDeltaPhiJetCut; //! delta eta vs. delta phi of matched jets - //TH2F **fHistDeltaEtaDeltaPhiJetNOMatching; //! delta eta vs. delta phi of jets which do not match - TH2F **fHistDeltaEtaEtaJet; //! delta eta vs. eta of matched jets per event class - TH2F **fHistDeltaPtEtaJet; //! delta eta vs. eta of matched jets per event class - TH2F **fHistPtFraction; //! fraction from embedded jet in reconstructed jet per event class - TH2F **fHistPtResponse; //! jet pt response per event class - TH2F **fHistPtSmearing; //! emb-jet pt vs (emb+UE - emb) pt - TH2F **fHistDeltaR; //! shift dR of jets vs (emb+UE - emb) pt - TH3F **fHistArea; //! area of jets vs (emb+UE - emb) pt - //TH2F **fHistJetPtArea; //! area of jets vs (emb+UE - emb) pt - TH2F **fHistDeltaArea; //! delta area of jets vs (emb+UE - emb) pt - TH2F **fHistJetPtDeltaArea; //! delta area of jets vs emb pt - - AliAnalysisTaskJetResponse(const AliAnalysisTaskJetResponse&); // not implemented - AliAnalysisTaskJetResponse& operator=(const AliAnalysisTaskJetResponse&); // not implemented - - ClassDef(AliAnalysisTaskJetResponse, 3); -}; - -#endif diff --git a/PWGJE/AliAnalysisTaskJetResponseV2.cxx b/PWGJE/AliAnalysisTaskJetResponseV2.cxx index 9276a38a6aa..6b4891f078c 100644 --- a/PWGJE/AliAnalysisTaskJetResponseV2.cxx +++ b/PWGJE/AliAnalysisTaskJetResponseV2.cxx @@ -23,6 +23,7 @@ #include "TTree.h" #include "TMath.h" #include "TH1F.h" +#include "TH1I.h" #include "TH2F.h" #include "TH3F.h" #include "THnSparse.h" diff --git a/PWGJE/AliAnalysisTaskJetResponseV2.h b/PWGJE/AliAnalysisTaskJetResponseV2.h index 74d2356289f..891900c8198 100644 --- a/PWGJE/AliAnalysisTaskJetResponseV2.h +++ b/PWGJE/AliAnalysisTaskJetResponseV2.h @@ -10,11 +10,13 @@ // class TH1F; +class TH1I; class TH2F; class TH3F; class THnSparse; class AliESDEvent; class AliAODEvent; +class AliAODJet; #include "AliAnalysisTaskSE.h" #include "AliVEvent.h" diff --git a/PWGJE/AliAnalysisTaskJetSpectrum.cxx b/PWGJE/AliAnalysisTaskJetSpectrum.cxx deleted file mode 100644 index c5298381c36..00000000000 --- a/PWGJE/AliAnalysisTaskJetSpectrum.cxx +++ /dev/null @@ -1,826 +0,0 @@ -// ************************************** -// Task used for the correction of determiantion of reconstructed jet spectra -// Compares input (gen) and output (rec) jets -// ******************************************* - - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "TDatabasePDG.h" - -#include "AliAnalysisTaskJetSpectrum.h" -#include "AliAnalysisManager.h" -#include "AliJetFinder.h" -#include "AliJetHeader.h" -#include "AliJetReader.h" -#include "AliJetReaderHeader.h" -#include "AliUA1JetHeaderV1.h" -#include "AliESDEvent.h" -#include "AliAODEvent.h" -#include "AliAODHandler.h" -#include "AliAODTrack.h" -#include "AliAODJet.h" -#include "AliMCEventHandler.h" -#include "AliMCEvent.h" -#include "AliStack.h" -#include "AliGenPythiaEventHeader.h" -#include "AliJetKineReaderHeader.h" -#include "AliGenCocktailEventHeader.h" -#include "AliInputEventHandler.h" - - -#include "AliAnalysisHelperJetTasks.h" - -ClassImp(AliAnalysisTaskJetSpectrum) - -const Float_t AliAnalysisTaskJetSpectrum::fgkJetNpartCut[AliAnalysisTaskJetSpectrum::kMaxCorrelation] = {5,10,1E+09}; - -AliAnalysisTaskJetSpectrum::AliAnalysisTaskJetSpectrum(): AliAnalysisTaskSE(), - fJetHeaderRec(0x0), - fJetHeaderGen(0x0), - fAOD(0x0), - fBranchRec("jets"), - fBranchGen(""), - fUseAODInput(kFALSE), - fUseExternalWeightOnly(kFALSE), - fLimitGenJetEta(kFALSE), - fAnalysisType(0), - fExternalWeight(1), - fRecEtaWindow(0.5), - fh1Xsec(0x0), - fh1Trials(0x0), - fh1PtHard(0x0), - fh1PtHardNoW(0x0), - fh1PtHardTrials(0x0), - fh1NGenJets(0x0), - fh1NRecJets(0x0), - fHistList(0x0) , - //////////////// - fh1JetMultiplicity(0x0) , - fh2ERecZRec(0x0) , - fh2EGenZGen(0x0) , - fh2Efficiency(0x0) , - fh3EGenERecN(0x0) - //////////////// -{ - // Default constructor - for(int ij = 0;ijGetTree(); - Double_t xsection = 0; - UInt_t ntrials = 0; - Float_t ftrials = 0; - if(tree){ - TFile *curfile = tree->GetCurrentFile(); - if (!curfile) { - Error("Notify","No current file"); - return kFALSE; - } - if(!fh1Xsec||!fh1Trials){ - Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__); - return kFALSE; - } - - TString fileName(curfile->GetName()); - if(fileName.Contains("AliESDs.root")){ - fileName.ReplaceAll("AliESDs.root", ""); - } - else if(fileName.Contains("AliAOD.root")){ - fileName.ReplaceAll("AliAOD.root", ""); - } - else if(fileName.Contains("AliAODs.root")){ - fileName.ReplaceAll("AliAODs.root", ""); - } - else if(fileName.Contains("galice.root")){ - // for running with galice and kinematics alone... - fileName.ReplaceAll("galice.root", ""); - } - TFile *fxsec = TFile::Open(Form("%s%s",fileName.Data(),"pyxsec.root")); - if(!fxsec){ - if(fDebug>0)Printf("%s:%d %s not found in the Input",(char*)__FILE__,__LINE__,Form("%s%s",fileName.Data(),"pyxsec.root")); - // next trial fetch the histgram file - fxsec = TFile::Open(Form("%s%s",fileName.Data(),"pyxsec_hists.root")); - if(!fxsec){ - // not a severe condition - if(fDebug>0)Printf("%s:%d %s not found in the Input",(char*)__FILE__,__LINE__,Form("%s%s",fileName.Data(),"pyxsec_hists.root")); - return kTRUE; - } - else{ - // find the tlist we want to be independtent of the name so use the Tkey - TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0); - if(!key){ - if(fDebug>0)Printf("%s:%d key not found in the file",(char*)__FILE__,__LINE__); - return kTRUE; - } - TList *list = dynamic_cast(key->ReadObj()); - if(!list){ - if(fDebug>0)Printf("%s:%d key is not a tlist",(char*)__FILE__,__LINE__); - return kTRUE; - } - xsection = ((TProfile*)list->FindObject("h1Xsec"))->GetBinContent(1); - ftrials = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1); - } - } - else{ - TTree *xtree = (TTree*)fxsec->Get("Xsection"); - if(!xtree){ - Printf("%s:%d tree not found in the pyxsec.root",(char*)__FILE__,__LINE__); - } - else{ - xtree->SetBranchAddress("xsection",&xsection); - xtree->SetBranchAddress("ntrials",&ntrials); - ftrials = ntrials; - xtree->GetEntry(0); - } - } - fh1Xsec->Fill("<#sigma>",xsection); - fh1Trials->Fill("#sum{ntrials}",ftrials); - } - - return kTRUE; -} - -void AliAnalysisTaskJetSpectrum::UserCreateOutputObjects() -{ - - // - // Create the output container - // - - - // Connect the AOD - - if(fUseAODInput){ - fAOD = dynamic_cast(InputEvent()); - if(!fAOD){ - Printf("%s:%d AODEvent not found in Input Manager %d",(char*)__FILE__,__LINE__,fUseAODInput); - return; - } - // fethc the header - fJetHeaderRec = dynamic_cast(fInputHandler->GetTree()->GetUserInfo()->FindObject(Form("AliJetHeader_%s",fBranchRec.Data()))); - if(!fJetHeaderRec){ - Printf("%s:%d Jet Header not found in the Input",(char*)__FILE__,__LINE__); - } - } - else{ - // assume that the AOD is in the general output... - fAOD = AODEvent(); - if(!fAOD){ - Printf("%s:%d AODEvent not found in the Output",(char*)__FILE__,__LINE__); - return; - } - fJetHeaderRec = dynamic_cast(OutputTree()->GetUserInfo()->FindObject(Form("AliJetHeader_%s",fBranchRec.Data()))); - if(!fJetHeaderRec){ - Printf("%s:%d Jet Header not found in the Output",(char*)__FILE__,__LINE__); - } - else{ - if(fDebug>10)fJetHeaderRec->Dump(); - } - } - - - - if (fDebug > 1) printf("AnalysisTaskJetSpectrum::UserCreateOutputObjects() \n"); - - OpenFile(1); - if(!fHistList)fHistList = new TList(); - - Bool_t oldStatus = TH1::AddDirectoryStatus(); - TH1::AddDirectory(kFALSE); - - // - // Histogram - - const Int_t nBinPt = 100; - Double_t binLimitsPt[nBinPt+1]; - for(Int_t iPt = 0;iPt <= nBinPt;iPt++){ - if(iPt == 0){ - binLimitsPt[iPt] = 0.0; - } - else {// 1.0 - binLimitsPt[iPt] = binLimitsPt[iPt-1] + 2.5; - } - } - - const Int_t nBinEta = 26; - Double_t binLimitsEta[nBinEta+1] = { - -1.6,-1.4,-1.2,-1.0, - -0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,-0.2,-0.1,0.0, - 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, - 1.0, 1.2, 1.4, 1.6 - }; - - - const Int_t nBinPhi = 30; - Double_t binLimitsPhi[nBinPhi+1]; - for(Int_t iPhi = 0;iPhi<=nBinPhi;iPhi++){ - if(iPhi==0){ - binLimitsPhi[iPhi] = 0; - } - else{ - binLimitsPhi[iPhi] = binLimitsPhi[iPhi-1] + 1/(Float_t)nBinPhi * TMath::Pi()*2; - } - } - - const Int_t nBinFrag = 25; - - - fh1Xsec = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1); - fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>"); - - fh1Trials = new TH1F("fh1Trials","trials from pyxsec.root",1,0,1); - fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}"); - - fh1PtHard = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",nBinPt,binLimitsPt); - - fh1PtHardNoW = new TH1F("fh1PtHardNoW","PYTHIA Pt hard no weight;p_{T,hard}",nBinPt,binLimitsPt); - - fh1PtHardTrials = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",nBinPt,binLimitsPt); - - fh1NGenJets = new TH1F("fh1NGenJets","N generated jets",20,-0.5,19.5); - - fh1NRecJets = new TH1F("fh1NRecJets","N reconstructed jets",20,-0.5,19.5); - - - for(int ij = 0;ij i;p_{T,rec,j};#Delta R", - nBinPt,binLimitsPt,60,0,6.0); - fh2PtGenDeltaR[ij] = new TH2F(Form("fh2PtGenDeltaR_j%d",ij),"#DeltaR to lower energy jets j > i;p_{T,gen,j};#Delta R", - nBinPt,binLimitsPt,60,0,6.0); - - - - fh3PtRecGenHard[ij] = new TH3F(Form("fh3PtRecGenHard_j%d",ij), "Pt hard vs. pt gen vs. pt rec;p_{T,rec};p_{T,gen} (GeV/c);p_{T,hard} (GeV/c)",nBinPt,binLimitsPt,nBinPt,binLimitsPt,nBinPt,binLimitsPt); - - - - fh3PtRecGenHardNoW[ij] = new TH3F(Form("fh3PtRecGenHardNoW_j%d",ij), "Pt hard vs. pt gen vs. pt rec no weight;p_{T,rec};p_{T,gen} (GeV/c);p_{T,hard} (GeV/c)",nBinPt,binLimitsPt,nBinPt,binLimitsPt,nBinPt,binLimitsPt); - - - fh2Frag[ij] = new TH2F(Form("fh2Frag_j%d",ij),"Jet Fragmentation;x=E_{i}/E_{jet};E_{jet};1/N_{jet}dN_{ch}/dx", - nBinFrag,0.,1.,nBinPt,binLimitsPt); - - fh2FragLn[ij] = new TH2F(Form("fh2FragLn_j%d",ij),"Jet Fragmentation Ln;#xi=ln(E_{jet}/E_{i});E_{jet}(GeV);1/N_{jet}dN_{ch}/d#xi", - nBinFrag,0.,10.,nBinPt,binLimitsPt); - - fh3RecEtaPhiPt[ij] = new TH3F(Form("fh3RecEtaPhiPt_j%d",ij),"Rec eta, phi, pt; #eta; #phi; p_{T,rec} (GeV/c)", - nBinEta,binLimitsEta,nBinPhi,binLimitsPhi,nBinPt,binLimitsPt); - - - - fh3RecEtaPhiPtNoGen[ij] = new TH3F(Form("fh3RecEtaPhiPtNoGen_j%d",ij),"No generated for found jet Rec eta, phi, pt; #eta; #phi; p_{T,rec} (GeV/c)", - nBinEta,binLimitsEta,nBinPhi,binLimitsPhi,nBinPt,binLimitsPt); - - - fh3GenEtaPhiPtNoFound[ij] = new TH3F(Form("fh3GenEtaPhiPtNoFound_j%d",ij),"No found for generated jet eta, phi, pt; #eta; #phi; p_{T,gen} (GeV/c)", - nBinEta,binLimitsEta,nBinPhi,binLimitsPhi,nBinPt,binLimitsPt); - - - - fh3GenEtaPhiPt[ij] = new TH3F(Form("fh3GenEtaPhiPt_j%d",ij),"Gen eta, phi, pt; #eta; #phi; p_{T,} (GeV/c)", - nBinEta,binLimitsEta,nBinPhi,binLimitsPhi,nBinPt,binLimitsPt); - - } - - - // tmp histos do not add to the header - TH2F *hCorrPt = new TH2F("fh2PtRecPhiCorrPt","#Delta#phi correlation pt weighted",nBinPt,binLimitsPt,180,TMath::Pi()/-2,1.5*TMath::Pi()); - fHistList->Add(hCorrPt); - TH2F *hCorrRanPt = new TH2F("fh2PtRecPhiCorrPtRan","#Delta#phi Random correlation pt weighted",nBinPt,binLimitsPt,180,TMath::Pi()/-2,1.5*TMath::Pi()); - fHistList->Add(hCorrRanPt); - - TH2F *hCorr = new TH2F("fh2PtRecPhiCorr","#Delta#phi correlation",nBinPt,binLimitsPt,180,TMath::Pi()/-2,1.5*TMath::Pi()); - fHistList->Add(hCorr); - TH2F *hCorrRan = new TH2F("fh2PtRecPhiCorrRan","#Delta#phi Random correlation",nBinPt,binLimitsPt,180,TMath::Pi()/-2,1.5*TMath::Pi()); - fHistList->Add(hCorrRan); - - - ///////////////////////////////////////////////////////////////// - fh1JetMultiplicity = new TH1F("fh1JetMultiplicity", "Jet Multiplicity", 51, 0., 50.); - - fh2ERecZRec = new TH2F("fh2ERecZRec", " ; E^{jet}_{rec} [GeV]; z^{lp}_{rec}", 100, 0., 250., 100, 0., 2.); - fh2EGenZGen = new TH2F("fh2EGenZGen", " ; E^{jet}_{gen} [GeV]; z^{lp}_{gen}", 100, 0., 250., 100, 0., 2.); - fh2Efficiency = new TH2F("fh2Efficiency", "ERec/EGen;E^{jet}_{gen} [GeV];E^{jet}_{rec}/E^{jet}_{gen}", 100, 0., 250., 100, 0., 1.5); - - fh3EGenERecN = new TH3F("fh3EGenERecN", "Efficiency vs. Jet Multiplicity", 100, 0., 250., 100, 0., 250., 51, 0., 50.); - - // Response map - //arrays for bin limits - const Int_t nbin[4] = {100, 100, 100, 100}; - Double_t vLowEdge[4] = {0.,0.,0.,0.}; - Double_t vUpEdge[4] = {250., 250., 1., 1.}; - - for(int ic = 0;ic < kMaxCorrelation;ic++){ - fhnCorrelation[ic] = new THnSparseF(Form("fhnCorrelation_%d",ic), "Response Map", 4, nbin, vLowEdge, vUpEdge); - if(ic==0) fhnCorrelation[ic]->SetTitle(Form("ResponseMap 0 <= npart <= %.0E",fgkJetNpartCut[ic])); - else fhnCorrelation[ic]->SetTitle(Form("ResponseMap %.0E < npart <= %.0E",fgkJetNpartCut[ic-1],fgkJetNpartCut[ic])); - } - const Int_t saveLevel = 3; // large save level more histos - if(saveLevel>0){ - fHistList->Add(fh1Xsec); - fHistList->Add(fh1Trials); - fHistList->Add(fh1PtHard); - fHistList->Add(fh1PtHardNoW); - fHistList->Add(fh1PtHardTrials); - fHistList->Add(fh1NGenJets); - fHistList->Add(fh1NRecJets); - //////////////////////// - fHistList->Add(fh1JetMultiplicity); - fHistList->Add(fh2ERecZRec); - fHistList->Add(fh2EGenZGen); - fHistList->Add(fh2Efficiency); - fHistList->Add(fh3EGenERecN); - - for(int ic = 0;ic < kMaxCorrelation;++ic){ - fHistList->Add(fhnCorrelation[ic]); - } - //////////////////////// - for(int ij = 0;ijAdd(fh1E[ij]); - fHistList->Add(fh1PtRecIn[ij]); - fHistList->Add(fh1PtRecOut[ij]); - fHistList->Add(fh1PtGenIn[ij]); - fHistList->Add(fh1PtGenOut[ij]); - fHistList->Add(fh2PtFGen[ij]); - fHistList->Add(fh2PhiFGen[ij]); - fHistList->Add(fh2EtaFGen[ij]); - fHistList->Add(fh2PtGenDeltaEta[ij]); - fHistList->Add(fh2PtGenDeltaPhi[ij]); - fHistList->Add(fh2PtRecDeltaR[ij]); - fHistList->Add(fh2PtGenDeltaR[ij]); - fHistList->Add(fh3RecEtaPhiPt[ij]); - fHistList->Add(fh3GenEtaPhiPt[ij]); - if(saveLevel>2){ - fHistList->Add(fh3RecEtaPhiPtNoGen[ij]); - fHistList->Add(fh3GenEtaPhiPtNoFound[ij]); - } - } - } - - // =========== Switch on Sumw2 for all histos =========== - for (Int_t i=0; iGetEntries(); ++i) { - TH1 *h1 = dynamic_cast(fHistList->At(i)); - if (h1){ - // Printf("%s ",h1->GetName()); - h1->Sumw2(); - continue; - } - THnSparse *hn = dynamic_cast(fHistList->At(i)); - if(hn)hn->Sumw2(); - } - - TH1::AddDirectory(oldStatus); - -} - -void AliAnalysisTaskJetSpectrum::Init() -{ - // - // Initialization - // - - Printf(">>> AnalysisTaskJetSpectrum::Init() debug level %d\n",fDebug); - if (fDebug > 1) printf("AnalysisTaskJetSpectrum::Init() \n"); - -} - -void AliAnalysisTaskJetSpectrum::UserExec(Option_t */*option*/) -{ - // - // Execute analysis for current event - // - - - - if (fDebug > 1)printf("Analysing event # %5d\n", (Int_t) fEntry); - - - AliAODHandler *aodH = dynamic_cast(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()); - - if(!aodH){ - Printf("%s:%d no output aodHandler found Jet",(char*)__FILE__,__LINE__); - return; - } - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - - TClonesArray *aodRecJets = dynamic_cast(fAOD->FindListObject(fBranchRec.Data())); - if(!aodRecJets){ - Printf("%s:%d no reconstructed Jet array with name %s in AOD",(char*)__FILE__,__LINE__,fBranchRec.Data()); - return; - } - - // ==== General variables needed - - - // We use statice array, not to fragment the memory - AliAODJet genJets[kMaxJets]; - Int_t nGenJets = 0; - AliAODJet recJets[kMaxJets]; - Int_t nRecJets = 0; - /////////////////////////// - Int_t nTracks = 0; - ////////////////////////// - - Double_t eventW = 1; - Double_t ptHard = 0; - Double_t nTrials = 1; // Trials for MC trigger weigth for real data - - if(fUseExternalWeightOnly){ - eventW = fExternalWeight; - } - - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - if((fAnalysisType&kAnaMC)==kAnaMC){ - // this is the part we only use when we have MC information - AliMCEvent* mcEvent = MCEvent(); - // AliStack *pStack = 0; - if(!mcEvent){ - Printf("%s:%d no mcEvent",(char*)__FILE__,__LINE__); - return; - } - AliGenPythiaEventHeader* pythiaGenHeader = AliAnalysisHelperJetTasks::GetPythiaEventHeader(mcEvent); - if(!pythiaGenHeader){ - return; - } - - nTrials = pythiaGenHeader->Trials(); - ptHard = pythiaGenHeader->GetPtHard(); - int iProcessType = pythiaGenHeader->ProcessType(); - // 11 f+f -> f+f - // 12 f+barf -> f+barf - // 13 f+barf -> g+g - // 28 f+g -> f+g - // 53 g+g -> f+barf - // 68 g+g -> g+g - /* - if (fDebug > 10)Printf("%d iProcessType %d",__LINE__, iProcessType); - // if(iProcessType != 13 && iProcessType != 68){ // allow only glue - if(iProcessType != 11 && iProcessType != 12 && iProcessType != 53){ // allow only quark - // if(iProcessType != 28){ // allow only -> f+g - PostData(1, fHistList); - return; - } - */ - if (fDebug > 10)Printf("%d iProcessType %d",__LINE__, iProcessType); - - if(fDebug>20)AliAnalysisHelperJetTasks::PrintStack(mcEvent); - - if(!fUseExternalWeightOnly){ - // case were we combine more than one p_T hard bin... - } - - // fetch the pythia generated jets only to be used here - Int_t nPythiaGenJets = pythiaGenHeader->NTriggerJets(); - AliAODJet pythiaGenJets[kMaxJets]; - Int_t iCount = 0; - for(int ip = 0;ip < nPythiaGenJets;++ip){ - if(iCount>=kMaxJets)continue; - Float_t p[4]; - pythiaGenHeader->TriggerJet(ip,p); - pythiaGenJets[iCount].SetPxPyPzE(p[0],p[1],p[2],p[3]); - - if(fLimitGenJetEta){ - if(pythiaGenJets[iCount].Eta()>fJetHeaderRec->GetJetEtaMax()|| - pythiaGenJets[iCount].Eta()GetJetEtaMin())continue; - } - - - if(fBranchGen.Length()==0){ - // if we have MC particles and we do not read from the aod branch - // use the pythia jets - genJets[iCount].SetPxPyPzE(p[0],p[1],p[2],p[3]); - } - iCount++; - } - if(fBranchGen.Length()==0)nGenJets = iCount; - - }// (fAnalysisType&kMC)==kMC) - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - fh1PtHard->Fill(ptHard,eventW); - fh1PtHardNoW->Fill(ptHard,1); - fh1PtHardTrials->Fill(ptHard,nTrials); - - // If we set a second branch for the input jets fetch this - if(fBranchGen.Length()>0){ - TClonesArray *aodGenJets = dynamic_cast(fAOD->FindListObject(fBranchGen.Data())); - if(aodGenJets){ - Int_t iCount = 0; - for(int ig = 0;ig < aodGenJets->GetEntries();++ig){ - if(iCount>=kMaxJets)continue; - AliAODJet *tmp = dynamic_cast(aodGenJets->At(ig)); - if(!tmp)continue; - if(fLimitGenJetEta){ - if(tmp->Eta()>fJetHeaderRec->GetJetEtaMax()|| - tmp->Eta()GetJetEtaMin())continue; - } - genJets[iCount] = *tmp; - iCount++; - } - nGenJets = iCount; - } - else{ - Printf("%s:%d Generated jet branch %s not found",(char*)__FILE__,__LINE__,fBranchGen.Data()); - } - } - - fh1NGenJets->Fill(nGenJets); - // We do not want to exceed the maximum jet number - nGenJets = TMath::Min(nGenJets,kMaxJets); - - // Fetch the reconstructed jets... - - - nRecJets = aodRecJets->GetEntries(); - fh1NRecJets->Fill(nRecJets); - nRecJets = TMath::Min(nRecJets,kMaxJets); - ////////////////////////////////////////// - nTracks = fAOD->GetNumberOfTracks(); - /////////////////////////////////////////// - - for(int ir = 0;ir < nRecJets;++ir){ - AliAODJet *tmp = dynamic_cast(aodRecJets->At(ir)); - if(!tmp)continue; - recJets[ir] = *tmp; - } - - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - // Relate the jets - Int_t iGenIndex[kMaxJets]; // Index of the generated jet for i-th rec -1 if none - Int_t iRecIndex[kMaxJets]; // Index of the rec jet for i-th gen -1 if none - - for(int i = 0;i 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - - if(fDebug){ - for(int i = 0;i=0)Printf("iGenFound: %d -> %d",i,iGenIndex[i]); - if(iRecIndex[i]>=0)Printf("iRecFound: %d -> %d",i,iRecIndex[i]); - } - } - - // loop over reconstructed jets - for(int ir = 0;ir < nRecJets;++ir){ - Double_t ptRec = recJets[ir].Pt(); - Double_t phiRec = recJets[ir].Phi(); - Double_t phiRecRan = TMath::Pi()*gRandom->Rndm(); // better take real jet axis from previous events (TPC acceptance in phi) - if(phiRec<0)phiRec+=TMath::Pi()*2.; - Double_t etaRec = recJets[ir].Eta(); - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - fh1E[ir]->Fill(recJets[ir].E(),eventW); - fh1PtRecIn[ir]->Fill(ptRec,eventW); - fh3RecEtaPhiPt[ir]->Fill(etaRec,phiRec,ptRec,eventW); - for(int irr = ir+1;irrFill(recJets[irr].Pt(),recJets[ir].DeltaR(&recJets[irr])); - } - // Fill Correlation - Int_t ig = iGenIndex[ir]; - if(ig>=0 && ig 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - if (fDebug > 10)Printf("%s:%d ig = %d ir = %d",(char*)__FILE__,__LINE__,ig,ir); - fh1PtRecOut[ir]->Fill(ptRec,eventW); - Double_t ptGen = genJets[ig].Pt(); - Double_t phiGen = genJets[ig].Phi(); - if(phiGen<0)phiGen+=TMath::Pi()*2.; - Double_t etaGen = genJets[ig].Eta(); - - // - // we accept only jets which are detected within a smaller window, to avoid ambigious pair association at the edges of the acceptance - // - - if(TMath::Abs(etaRec)Fill(ptRec,ptGen,eventW); - fh2PhiFGen[ir]->Fill(phiRec,phiGen,eventW); - fh2EtaFGen[ir]->Fill(etaRec,etaGen,eventW); - fh2PtGenDeltaEta[ir]->Fill(ptGen,etaGen-etaRec,eventW); - fh2PtGenDeltaPhi[ir]->Fill(ptGen,phiGen-phiRec,eventW); - fh3PtRecGenHard[ir]->Fill(ptRec,ptGen,ptHard,eventW); - fh3PtRecGenHardNoW[ir]->Fill(ptRec,ptGen,ptHard,1); - ///////////////////////////////////////////////////// - - // Double_t eRec = recJets[ir].E(); - // Double_t eGen = genJets[ig].E(); - // CKB use p_T not Energy - // TODO recname variabeles and histos - Double_t eRec = recJets[ir].E(); - Double_t eGen = genJets[ig].E(); - - fh2Efficiency->Fill(eGen, eRec/eGen); - - if (eGen>=0. && eGen<=250.){ - Double_t eLeading = -1; - Double_t ptleading = -1; - Int_t nPart=0; - // loop over tracks - for (Int_t it = 0; it< nTracks; it++){ - // if (fAOD->GetTrack(it)->E() > eGen) continue; // CKB. Not allowed! cannot cut on gen properties in real events! - // find leading particle - // if (r<0.4 && fAOD->GetTrack(it)->E()>eLeading){ - // TODO implement esd filter flag to be the same as in the jet finder - // allow also for MC particles... - Float_t r = recJets[ir].DeltaR(fAOD->GetTrack(it)); - if (r<0.4 && fAOD->GetTrack(it)->Pt()>ptleading){ - eLeading = fAOD->GetTrack(it)->E(); - ptleading = fAOD->GetTrack(it)->Pt(); - } - // if (fAOD->GetTrack(it)->Pt()>0.03*eGen && fAOD->GetTrack(it)->E()<=eGen && r<0.7) // CKB cannot cut on gen properties - if (fAOD->GetTrack(it)->Pt()>0.03*eRec && fAOD->GetTrack(it)->Pt()<=eRec && r<0.7) - nPart++; - - - // correlate jet axis of leading jet with particles - if(ir==0){ - Float_t phi = fAOD->GetTrack(it)->Phi(); - Float_t dPhi = phi - phiRec; - if(dPhi>TMath::Pi()/1.5)dPhi = dPhi - 2.*TMath::Pi(); - if(dPhi<(-0.5*TMath::Pi()))dPhi = dPhi + 2.*TMath::Pi(); - Float_t dPhiRan = phi - phiRecRan; - if(dPhiRan>TMath::Pi()/1.5)dPhiRan = dPhiRan - 2.*TMath::Pi(); - if(dPhiRan<(-0.5*TMath::Pi()))dPhiRan = dPhiRan + 2.*TMath::Pi(); - ((TH2F*)fHistList->FindObject("fh2PtRecPhiCorr"))->Fill(ptRec,dPhi); - ((TH2F*)fHistList->FindObject("fh2PtRecPhiCorrRan"))->Fill(ptRec,dPhiRan); - ((TH2F*)fHistList->FindObject("fh2PtRecPhiCorrPt"))->Fill(ptRec,dPhi,fAOD->GetTrack(it)->Pt()); - ((TH2F*)fHistList->FindObject("fh2PtRecPhiCorrPtRan"))->Fill(ptRec,dPhiRan,fAOD->GetTrack(it)->Pt()); - - } - } - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - - // fill Response Map (4D histogram) and Energy vs z distributions - Double_t var[4] = {eGen, eRec, ptleading/eGen, ptleading/eRec}; - fh2ERecZRec->Fill(var[1],var[3]); // this has to be filled always in the real case... - fh2EGenZGen->Fill(var[0],var[2]); - fh1JetMultiplicity->Fill(nPart); - fh3EGenERecN->Fill(eGen, eRec, nPart); - for(int ic = 0;ic Fill(var); - break; - } - } - } - - }// if etarec in window - - } - //////////////////////////////////////////////////// - else{ - fh3RecEtaPhiPtNoGen[ir]->Fill(etaRec,phiRec,ptRec,eventW); - } - }// loop over reconstructed jets - - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - for(int ig = 0;ig < nGenJets;++ig){ - Double_t ptGen = genJets[ig].Pt(); - // Fill Correlation - Double_t phiGen = genJets[ig].Phi(); - if(phiGen<0)phiGen+=TMath::Pi()*2.; - Double_t etaGen = genJets[ig].Eta(); - fh3GenEtaPhiPt[ig]->Fill(etaGen,phiGen,ptGen,eventW); - fh1PtGenIn[ig]->Fill(ptGen,eventW); - for(int igg = ig+1;iggFill(genJets[igg].Pt(),genJets[ig].DeltaR(&genJets[igg])); - } - Int_t ir = iRecIndex[ig]; - if(ir>=0&&irFill(ptGen,eventW); - } - else{ - fh3GenEtaPhiPtNoFound[ig]->Fill(etaGen,phiGen,ptGen,eventW); - } - }// loop over reconstructed jets - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - PostData(1, fHistList); -} - -void AliAnalysisTaskJetSpectrum::Terminate(Option_t */*option*/) -{ -// Terminate analysis -// - if (fDebug > 1) printf("AnalysisJetSpectrum: Terminate() \n"); -} diff --git a/PWGJE/AliAnalysisTaskJetSpectrum.h b/PWGJE/AliAnalysisTaskJetSpectrum.h deleted file mode 100644 index 010254ed40e..00000000000 --- a/PWGJE/AliAnalysisTaskJetSpectrum.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef ALIANALYSISTASKJETSPECTRUM_H -#define ALIANALYSISTASKJETSPECTRUM_H - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -// ************************************** -// Task used for the correction of determiantion of reconstructed jet spectra -// Compares input (gen) and output (rec) jets -// ******************************************* - -#include "AliAnalysisTaskSE.h" -#include "THnSparse.h" // cannot forward declare ThnSparseF - -//////////////// -class AliJetHeader; -class AliESDEvent; -class AliAODEvent; -class AliAODJet; -class AliGenPythiaEventHeader; - -class TList; -class TChain; -class TH2F; -class TH3F; -class TProfile; - - - -class AliAnalysisTaskJetSpectrum : public AliAnalysisTaskSE -{ - public: - AliAnalysisTaskJetSpectrum(); - AliAnalysisTaskJetSpectrum(const char* name); - virtual ~AliAnalysisTaskJetSpectrum() {;} - // Implementation of interface methods - virtual void UserCreateOutputObjects(); - virtual void Init(); - virtual void LocalInit() { Init(); } - virtual void UserExec(Option_t *option); - virtual void Terminate(Option_t *option); - virtual Bool_t Notify(); - - - virtual void SetExternalWeight(Float_t f){fExternalWeight = f;} - virtual void SetUseExternalWeightOnly(Bool_t b){fUseExternalWeightOnly = b;} - virtual void SetAODInput(Bool_t b){fUseAODInput = b;} - virtual void SetLimitGenJetEta(Bool_t b){fLimitGenJetEta = b;} - virtual void SetRecEtaWindow(Float_t f){fRecEtaWindow = f;} - virtual void SetAnalysisType(Int_t i){fAnalysisType = i;} - virtual void SetBranchGen(const char* c){fBranchGen = c;} - virtual void SetBranchRec(const char* c){fBranchRec = c;} - - // Helper - // - - enum {kAnaMC = 0x1}; - enum {kMaxJets = 4}; - enum {kMaxCorrelation = 3}; - - private: - - AliAnalysisTaskJetSpectrum(const AliAnalysisTaskJetSpectrum&); - AliAnalysisTaskJetSpectrum& operator=(const AliAnalysisTaskJetSpectrum&); - - static const Float_t fgkJetNpartCut[kMaxCorrelation]; // n Part cut - - - AliJetHeader *fJetHeaderRec; // store jet header for rec - AliJetHeader *fJetHeaderGen; // store jet header for rec - AliAODEvent *fAOD; // where we take the jets from can be input or output AOD - - TString fBranchRec; // AOD branch name for reconstructed - TString fBranchGen; // AOD brnach for genereated - - Bool_t fUseAODInput; // use AOD input - Bool_t fUseExternalWeightOnly; // use only external weight - Bool_t fLimitGenJetEta; // Limit the eta of the generated jets - Int_t fAnalysisType; // Analysis type - Float_t fExternalWeight; // external weight - Float_t fRecEtaWindow; // eta window used for corraltion plots between rec and gen - - TProfile* fh1Xsec; // pythia cross section and trials - TH1F* fh1Trials; // trials are added - TH1F* fh1PtHard; // Pt har of the event... - TH1F* fh1PtHardNoW; // Pt har of the event... - TH1F* fh1PtHardTrials; // Number of trials - TH1F* fh1NGenJets; // Number of gen jets - TH1F* fh1NRecJets; // Number of rev jets - TH1F* fh1E[kMaxJets]; // Jet Energy - TH1F* fh1PtRecIn[kMaxJets]; // Jet pt for all - TH1F* fh1PtRecOut[kMaxJets]; // Jet pt with corellated generated jet - TH1F* fh1PtGenIn[kMaxJets]; // Detection efficiency for given p_T.gen - TH1F* fh1PtGenOut[kMaxJets]; // gen pT of found jets - - TH2F* fh2PtFGen[kMaxJets]; // correlation betwen genreated and found jet pT - TH2F* fh2PhiFGen[kMaxJets]; // correlation betwen genreated and found jet phi - TH2F* fh2EtaFGen[kMaxJets]; // correlation betwen genreated and found jet eta - TH2F* fh2Frag[kMaxJets]; // fragmentation function - TH2F* fh2FragLn[kMaxJets]; // fragmetation in xi - TH2F* fh2PtGenDeltaPhi[kMaxJets]; // difference between generated and found jet phi - TH2F* fh2PtGenDeltaEta[kMaxJets]; // difference between generated and found jet eta - TH2F* fh2PtRecDeltaR[kMaxJets]; // distance of rec jet i to j > i p_T,j - TH2F* fh2PtGenDeltaR[kMaxJets]; // distance of jet i to j > i vs p_T,j - - TH3F* fh3PtRecGenHard[kMaxJets]; // correlation beetwen pt hard, rec and gen - TH3F* fh3PtRecGenHardNoW[kMaxJets]; // correlation beetwen pt hard, rec and gen no weight - TH3F* fh3RecEtaPhiPt[kMaxJets]; // correlation between eta phi and rec pt - TH3F* fh3RecEtaPhiPtNoGen[kMaxJets]; // correlation between eta phi and rec pt of jets without a partner - TH3F* fh3GenEtaPhiPtNoFound[kMaxJets]; // correlation between eta phi and gen pt of jets without a partner - TH3F* fh3GenEtaPhiPt[kMaxJets]; // correlation between eta phi and gen pt of jets without a partner - // ========= Multiplicity dependence ====== - - // ==========TODO , flavaor dependence ======== - // ============================================ - - - // ============= TODO , phi dependence ======== - // ============================================ - - TList *fHistList; // Output list - - ///////// For 2 dimensional unfolding ////////////////// - TH1F* fh1JetMultiplicity; // JetMultiplicity - TH2F* fh2ERecZRec; // rec e and z - TH2F* fh2EGenZGen; // gen e and z - TH2F* fh2Efficiency; // 2 dimensional efficiency - TH3F* fh3EGenERecN; // correlation rec energy, gen energy N particles - THnSparseF* fhnCorrelation[kMaxCorrelation]; // 4d Correllation for unfolding - /////////////////////////////////////////////////////// - - - ClassDef(AliAnalysisTaskJetSpectrum, 2) // Analysis task for standard jet analysis -}; - -#endif diff --git a/PWGJE/AliAnalysisTaskJetSpectrum2.h b/PWGJE/AliAnalysisTaskJetSpectrum2.h index c1d5d710f30..9c0f8bbfa35 100644 --- a/PWGJE/AliAnalysisTaskJetSpectrum2.h +++ b/PWGJE/AliAnalysisTaskJetSpectrum2.h @@ -231,7 +231,7 @@ class AliAnalysisTaskJetSpectrum2 : public AliAnalysisTaskSE TList *fHistList; //! Output list - ClassDef(AliAnalysisTaskJetSpectrum2, 18) // Analysis task for standard jet analysis + ClassDef(AliAnalysisTaskJetSpectrum2, 18); // Analysis task for standard jet analysis }; #endif diff --git a/PWGJE/AliAnalysisTaskPWG4PidDetEx.cxx b/PWGJE/AliAnalysisTaskPWG4PidDetEx.cxx deleted file mode 100644 index 5fd7da7936d..00000000000 --- a/PWGJE/AliAnalysisTaskPWG4PidDetEx.cxx +++ /dev/null @@ -1,943 +0,0 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "AliAnalysisManager.h" -#include "AliAnalysisFilter.h" -#include "AliESDInputHandler.h" -#include "AliESDEvent.h" -#include "AliESDVertex.h" -#include "AliMCEventHandler.h" -#include "AliMCEvent.h" -#include "AliStack.h" -#include "AliAODInputHandler.h" -#include "AliAODEvent.h" -#include "AliAODVertex.h" -#include "AliAODMCParticle.h" -#include "AliLog.h" - -#include "AliAnalysisTaskPWG4PidDetEx.h" - -// STL includes -#include -using namespace std; - -// -// Analysis class example for PID using detector signals. -// Works on ESD and AOD; has a flag for MC analysis -// -// Alexandru.Dobrin@hep.lu.se -// Peter.Christiansen@hep.lu.se -// - -ClassImp(AliAnalysisTaskPWG4PidDetEx) - -const Double_t AliAnalysisTaskPWG4PidDetEx::fgkCtau = 370; // distance for kaon decay -const Double_t AliAnalysisTaskPWG4PidDetEx::fgkPionMass = 1.39570000000000000e-01; -const Double_t AliAnalysisTaskPWG4PidDetEx::fgkKaonMass = 4.93599999999999983e-01; -const Double_t AliAnalysisTaskPWG4PidDetEx::fgkProtonMass = 9.38270000000000048e-01; -const Double_t AliAnalysisTaskPWG4PidDetEx::fgkC = 2.99792458e-2; - - - - - -//_____________________________________________________________________________ -AliAnalysisTaskPWG4PidDetEx::AliAnalysisTaskPWG4PidDetEx(): - AliAnalysisTaskSE(), - fESD(0), - fAOD(0), - fListOfHists(0), - fEtaCut(0.9), - fPtCut(0.5), - fXbins(20), - fXmin(0.), - fTOFCutP(2.), - fTrackFilter(0x0), - fAnalysisMC(kTRUE), - fAnalysisType("ESD"), - fTriggerMode(kMB2), - fEvents(0), fEffTot(0), fEffPID(0), fAccP(0), fAccPt(0), fKaonDecayCorr(0), - fdNdPt(0), fMassAll(0), - fdNdPtPion(0), fMassPion(0), fdEdxTPCPion(0), fbgTPCPion(0), - fdNdPtKaon(0), fMassKaon(0), fdEdxTPCKaon(0), fbgTPCKaon(0), - fdNdPtProton(0), fMassProton(0), fdEdxTPCProton(0), fbgTPCProton(0), - fdNdPtMC(0), fdNdPtMCPion(0), fdNdPtMCKaon(0), fdNdPtMCProton(0) -{ - // Default constructor (should not be used) -} - -//______________________________________________________________________________ -AliAnalysisTaskPWG4PidDetEx::AliAnalysisTaskPWG4PidDetEx(const char *name): - AliAnalysisTaskSE(name), - fESD(0), - fAOD(0), - fListOfHists(0), - fEtaCut(0.9), - fPtCut(0.5), - fXbins(20), - fXmin(0.), - fTOFCutP(2.), - fTrackFilter(0x0), - fAnalysisMC(kTRUE), - fAnalysisType("ESD"), - fTriggerMode(kMB2), - fEvents(0), fEffTot(0), fEffPID(0), fAccP(0), fAccPt(0), fKaonDecayCorr(0), - fdNdPt(0), fMassAll(0), - fdNdPtPion(0), fMassPion(0), fdEdxTPCPion(0), fbgTPCPion(0), - fdNdPtKaon(0), fMassKaon(0), fdEdxTPCKaon(0), fbgTPCKaon(0), - fdNdPtProton(0), fMassProton(0), fdEdxTPCProton(0), fbgTPCProton(0), - fdNdPtMC(0), fdNdPtMCPion(0), fdNdPtMCKaon(0), fdNdPtMCProton(0) -{ - // Output slot #0 writes into a TList - DefineOutput(1, TList::Class()); - -} - -//_____________________________________________________________________________ -AliAnalysisTaskPWG4PidDetEx::~AliAnalysisTaskPWG4PidDetEx() -{ - // Destructor -} - -// //______________________________________________________________________________ -// void AliAnalysisTaskPWG4PidDetEx::ConnectInputData(Option_t *) -// { -// // Connect AOD here -// // Called once -// if (fDebug > 1) AliInfo("ConnectInputData() \n"); - -// TTree* tree = dynamic_cast (GetInputData(0)); -// if (!tree) { -// Printf("ERROR: Could not read chain from input slot 0"); -// } -// else { -// if(fAnalysisType == "ESD") { -// AliESDInputHandler *esdH = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); -// if (!esdH) { -// Printf("ERROR: Could not get ESDInputHandler"); -// } else -// fESD = esdH->GetEvent(); -// } -// else if(fAnalysisType == "AOD") { -// AliAODInputHandler *aodH = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); -// if (!aodH) { -// Printf("ERROR: Could not get AODInputHandler"); -// } else -// fAOD = aodH->GetEvent(); -// } -// } - -// } - -//______________________________________________________________________________ -void AliAnalysisTaskPWG4PidDetEx::UserCreateOutputObjects() -{ - OpenFile(1); - fListOfHists = new TList(); - - fEvents = new TH1I("fEvents","Number of analyzed events; Events; Counts", 1, 0, 1); - fListOfHists->Add(fEvents); - - fEffTot = new TH1F ("fEffTot","Efficiency; p_{T} [GeV/c]; Counts", fXbins, fXmin, fTOFCutP); - fEffTot->Sumw2(); - fListOfHists->Add(fEffTot); - - fEffPID = new TH1F ("fEffPID","Efficiency; p_{T} [GeV/c]; Counts", fXbins, fXmin, fTOFCutP); - fEffPID->Sumw2(); - fListOfHists->Add(fEffPID); - - fAccP = new TH1F ("fAccP","Acceptance; p_{T} [GeV/c]; Counts", fXbins, fXmin, fTOFCutP); - fAccP->Sumw2(); - fListOfHists->Add(fAccP); - - fAccPt = new TH1F ("fAccPt","Acceptance; p_{T} [GeV/c]; Counts", fXbins, fXmin, fTOFCutP); - fAccPt->Sumw2(); - fListOfHists->Add(fAccPt); - - fKaonDecayCorr = new TProfile("fKaonDecayCorr","Kaon decay correction vs p_{T}; p_{T} [GeV/c]; Kaon decay correction", fXbins, fXmin, fTOFCutP); - fListOfHists->Add(fKaonDecayCorr); - - fdNdPt = new TH1F("fdNdPt","p_{T} distribution; p_{T} [GeV/c]; #frac{1}{2#pip_{T}} #frac{1}{N_{ev}} #frac{dN}{dp_{T}}", 100 , 0, 10); - fdNdPt->Sumw2(); - fListOfHists->Add(fdNdPt); - - fMassAll = new TH2F("fMassAll","Mass^{2} vs momentum (ToF); p [GeV/c]; M^{2} [GeV^{2}/c^{4}]", 100, -5, 5, 100, -0.2, 1.2); - fListOfHists->Add(fMassAll); - - //Pion - fdNdPtPion = new TH1F("fdNdPtPion","p_{T} distribution (Pions); p_{T} [GeV/c]; #frac{1}{2#pip_{T}} #frac{1}{N_{ev}} #frac{dN}{dp_{T}}", fXbins, fXmin, fTOFCutP); - fdNdPtPion->Sumw2(); - fListOfHists->Add(fdNdPtPion); - - fMassPion = new TH2F("fMassPion","Mass squared for pions after cuts vs pmean; p [GeV/c]; Mass^{2} [GeV^{2}/c^{4}]", 100, -5, 5, 100, -0.2, 1.2); - fListOfHists->Add(fMassPion); - - fdEdxTPCPion = new TH2F("fdEdxTPCPion","Energy loss vs momentum; p [GeV/c]; dE/dx [a. u.]", 40, -2, 2, 100, 0, 200); - fListOfHists->Add(fdEdxTPCPion); - - fbgTPCPion = new TH2F("fbgTPCPion", "Energy loss vs #beta#gamma (Pions);#beta#gamma; dE/dx [a. u.]", 100, 0, 15, 100, 0, 200); - fListOfHists->Add(fbgTPCPion); - - //Kaon - fdNdPtKaon = new TH1F("fdNdPtKaon","p_{T} distribution (Kaons);p_{T} [GeV/c]; #frac{1}{2#pip_{T}} #frac{1}{N_{ev}} #frac{dN}{dp_{T}}", fXbins, fXmin, fTOFCutP); - fdNdPtKaon->Sumw2(); - fListOfHists->Add(fdNdPtKaon); - - fMassKaon = new TH2F("fMassKaon","Mass squared for kaons after cuts vs pmean; p [GeV/c]; Mass^{2} [GeV^{2}/c^{4}]", 100, -5, 5, 100, -0.2, 1.2); - fListOfHists->Add(fMassKaon); - - fdEdxTPCKaon = new TH2F("fdEdxTPCKaon","Energy loss vs momentum; p [GeV/c]; dE/dx [a. u.]", 40, -2, 2, 100, 0, 200); - fListOfHists->Add(fdEdxTPCKaon); - - fbgTPCKaon = new TH2F("fbgTPCKaon", "Energy loss vs #beta#gamma (Kaons);#beta#gamma; dE/dx [a. u.]", 100, 0, 15, 100, 0, 200); - fListOfHists->Add(fbgTPCKaon); - - //Proton - fdNdPtProton = new TH1F("fdNdPtProton","p_{T} distribution (Protons);p_{T} [GeV/c]; #frac{1}{2#pip_{T}} #frac{1}{N_{ev}} #frac{dN}{dp_{T}}", fXbins, fXmin, fTOFCutP); - fdNdPtProton->Sumw2(); - fListOfHists->Add(fdNdPtProton); - - fMassProton = new TH2F("fMassProton","Mass squared for protons after cuts vs pmean; p [GeV/c]; Mass^{2} [GeV^{2}/c^{4}]", 100, -5, 5, 100, -0.2, 1.2); - fListOfHists->Add(fMassProton); - - fdEdxTPCProton = new TH2F("fdEdxTPCProton","Energy loss vs momentum; p [GeV/c]; dE/dx [a. u.]", 40, -2, 2, 100, 0, 200); - fListOfHists->Add(fdEdxTPCProton); - - fbgTPCProton = new TH2F("fbgTPCProton", "Energy loss vs #beta#gamma (Protons);#beta#gamma; dE/dx [a. u.]", 100, 0, 15, 100, 0, 200); - fListOfHists->Add(fbgTPCProton); - - - //MC - if(fAnalysisMC){ - fdNdPtMC = new TH1F("fdNdPtMC","p_{T} distribution;p_{T} [GeV/c]; #frac{1}{2#pip_{T}} #frac{1}{N_{ev}} #frac{dN}{dp_{T}}", 100, 0, 10); - fdNdPtMC->SetLineColor(2); - fdNdPtMC->Sumw2(); - fListOfHists->Add(fdNdPtMC); - - fdNdPtMCPion = new TH1F("fdNdPtMCPion","p_{T} distribution;p_{T} [GeV/c]; #frac{1}{2#pip_{T}} #frac{1}{N_{ev}} #frac{dN}{dp_{T}}", fXbins, fXmin, fTOFCutP); - fdNdPtMCPion->SetLineColor(2); - fdNdPtMCPion->Sumw2(); - fListOfHists->Add(fdNdPtMCPion); - - fdNdPtMCKaon = new TH1F("fdNdPtMCKaon","p_{T} distribution;p_{T} [GeV/c]; #frac{1}{2#pip_{T}} #frac{1}{N_{ev}} #frac{dN}{dp_{T}}", fXbins, fXmin, fTOFCutP); - fdNdPtMCKaon->SetLineColor(2); - fdNdPtMCKaon->Sumw2(); - fListOfHists->Add(fdNdPtMCKaon); - - fdNdPtMCProton = new TH1F("fdNdPtMCProton","p_{T} distribution;p_{T} [GeV/c]; #frac{1}{2#pip_{T}} #frac{1}{N_{ev}} #frac{dN}{dp_{T}}", fXbins, fXmin, fTOFCutP); - fdNdPtMCProton->SetLineColor(2); - fdNdPtMCProton->Sumw2(); - fListOfHists->Add(fdNdPtMCProton); - } - -} - -//______________________________________________________________________________ -void AliAnalysisTaskPWG4PidDetEx::UserExec(Option_t *) -{ - - // Create histograms - // Called once - if (fAnalysisType == "AOD") { - fAOD = dynamic_cast(InputEvent()); - if(!fAOD){ - Printf("%s:%d AODEvent not found in Input Manager",(char*)__FILE__,__LINE__); - return; - } - else{ - // assume that the AOD is in the general output... - // fAOD = AODEvent(); - // if(!fAOD){ - // Printf("%s:%d AODEvent not found in the Output",(char*)__FILE__,__LINE__); - } - } - else if (fAnalysisType == "ESD"){ - fESD = dynamic_cast(InputEvent()); - if(!fESD){ - Printf("%s:%d ESDEvent not found in Input Manager",(char*)__FILE__,__LINE__); - this->Dump(); - return; - } - } - - // Main loop - // Called for each event - if (fDebug > 1) AliInfo("Exec() \n" ); - - if(fAnalysisType == "ESD") { - if (!fESD) { - Printf("ERROR: fESD not available"); - return; - } - if(IsEventTriggered(fESD, fTriggerMode)) { - Printf("PWG4 PID ESD analysis"); - AnalyzeESD(fESD); - }//triggered event - }//ESD analysis - - else if(fAnalysisType == "AOD") { - if (!fAOD) { - Printf("ERROR: fAOD not available"); - return; - } - if(IsEventTriggered(fAOD, fTriggerMode)) { - Printf("PWG4 PID AOD analysis"); - AnalyzeAOD(fAOD); - }//triggered event - }//AOD analysis - - // Post output data. - PostData(1, fListOfHists); -} - -//________________________________________________________________________ -void AliAnalysisTaskPWG4PidDetEx::AnalyzeESD(AliESDEvent* esd) -{ - // Get vertex - const AliESDVertex* primaryVertex = esd->GetPrimaryVertex(); - const Double_t vertexResZ = primaryVertex->GetZRes(); - - // Select only events with a reconstructed vertex - if(vertexResZ<5.0) { - const Int_t nESDTracks = esd->GetNumberOfTracks(); - for(Int_t i = 0; i < nESDTracks; i++) { - AliESDtrack* trackESD = esd->GetTrack(i); - - //Cuts - UInt_t selectInfo = 0; - if (fTrackFilter) { - selectInfo = fTrackFilter->IsSelected(trackESD); - if (!selectInfo) continue; - } - - if ((trackESD->Pt() < fPtCut) || (TMath::Abs(trackESD->Eta()) > fEtaCut )) - continue; - - //Corrections - fEffTot->Fill(trackESD->Pt()); - if (trackESD->GetTOFsignal() !=0) - fEffPID->Fill(trackESD->Pt()); - - if (trackESD->P() < fTOFCutP) fAccP->Fill(trackESD->Pt()); - if (trackESD->Pt() < fTOFCutP) fAccPt->Fill(trackESD->Pt()); - - //Analysis - fdNdPt->Fill(trackESD->Pt(), 1.0/trackESD->Pt()); - - //TOF - if ((trackESD->GetIntegratedLength() == 0) || (trackESD->GetTOFsignal() == 0)) - continue; - - fMassAll->Fill(trackESD->Charge()*trackESD->P(), MassSquared(trackESD)); - - if ((MassSquared(trackESD) < 0.15) && (MassSquared(trackESD) > -0.15) && (trackESD->P() < fTOFCutP)){ - fdNdPtPion->Fill(trackESD->Pt(), 1.0/trackESD->Pt()); - fMassPion->Fill(trackESD->Charge()*trackESD->P(), MassSquared(trackESD)); - fdEdxTPCPion->Fill(trackESD->Charge()*trackESD->P(),trackESD->GetTPCsignal()); - fbgTPCPion->Fill(trackESD->P()/fgkPionMass,trackESD->GetTPCsignal()); - } - - if ((MassSquared(trackESD) > 0.15) && (MassSquared(trackESD) < 0.45) && (trackESD->P() < fTOFCutP)){ - fdNdPtKaon->Fill(trackESD->Pt(), 1.0/trackESD->Pt()); - fMassKaon->Fill(trackESD->Charge()*trackESD->P(), MassSquared(trackESD)); - fdEdxTPCKaon->Fill(trackESD->Charge()*trackESD->P(), trackESD->GetTPCsignal()); - fbgTPCKaon->Fill(trackESD->P()/fgkKaonMass, trackESD->GetTPCsignal()); - //Kaon decay correction - fKaonDecayCorr->Fill(trackESD->Pt(), TMath::Exp(KaonDecay(trackESD))); - } - - if ((MassSquared(trackESD) > 0.75) && (MassSquared(trackESD) < 1.05) && (trackESD->P() < fTOFCutP)){ - fdNdPtProton->Fill(trackESD->Pt(), 1.0/trackESD->Pt()); - fMassProton->Fill(trackESD->Charge()*trackESD->P(), MassSquared(trackESD)); - fdEdxTPCProton->Fill(trackESD->Charge()*trackESD->P(),trackESD->GetTPCsignal()); - fbgTPCProton->Fill(trackESD->P()/fgkProtonMass,trackESD->GetTPCsignal()); - } - }//ESD track loop - - //MC - if(fAnalysisMC){ - AliMCEventHandler* mcHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); - if (!mcHandler) { - Printf("ERROR: Could not retrieve MC event handler"); - return; - } - - AliMCEvent* mcEvent = mcHandler->MCEvent(); - if (!mcEvent) { - Printf("ERROR: Could not retrieve MC event"); - return; - } - - AliStack* mcStack = mcEvent->Stack(); - if (!mcStack) { - Printf("ERROR: Could not retrieve MC stack"); - return; - } - - const Int_t nTracksMC = mcStack->GetNtrack(); - for (Int_t iTracks = 0; iTracks < nTracksMC; iTracks++) { - //Cuts - if(!(mcStack->IsPhysicalPrimary(iTracks))) - continue; - - TParticle* mcTrack = mcStack->Particle(iTracks); - - Double_t charge = mcTrack->GetPDG()->Charge(); - if (charge == 0) - continue; - - if ((mcTrack->Pt() < fPtCut) || (TMath::Abs(mcTrack->Eta()) > fEtaCut )) - continue; - - //Analysis - fdNdPtMC->Fill(mcTrack->Pt(), 1.0/mcTrack->Pt()); - - if ((mcTrack->GetPdgCode() == 211) || (mcTrack->GetPdgCode() == -211)) - fdNdPtMCPion->Fill(mcTrack->Pt(),1.0/mcTrack->Pt()); - - if ((mcTrack->GetPdgCode() == 321) || (mcTrack->GetPdgCode() == -321)) - fdNdPtMCKaon->Fill(mcTrack->Pt(),1.0/mcTrack->Pt()); - - if ((mcTrack->GetPdgCode() == 2212) || (mcTrack->GetPdgCode() == -2212)) - fdNdPtMCProton->Fill(mcTrack->Pt(),1.0/mcTrack->Pt()); - }//MC track loop - }//if MC - fEvents->Fill(0); - }//if vertex - -} - -//________________________________________________________________________ -void AliAnalysisTaskPWG4PidDetEx::AnalyzeAOD(AliAODEvent* aod) -{ - // Get vertex - AliAODVertex* primaryVertex = aod->GetPrimaryVertex(); - const Double_t vertexResZ = TMath::Sqrt(primaryVertex->RotatedCovMatrixZZ()); - - // Select only events with a reconstructed vertex - if (vertexResZ < 5) { - //AOD - Int_t nGoodTracks = aod->GetNumberOfTracks(); - - for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { - AliAODTrack* trackAOD = aod->GetTrack(iTracks); - //Cuts - if (!(trackAOD->IsPrimaryCandidate())) - continue; - - if ((trackAOD->Pt() < fPtCut) || (TMath::Abs(trackAOD->Eta()) > fEtaCut )) - continue; - - //Corrections - fEffTot->Fill(trackAOD->Pt()); - if (trackAOD->GetDetPid()->GetTOFsignal() !=0 ) - fEffPID->Fill(trackAOD->Pt()); - - if (trackAOD->P() < fTOFCutP) fAccP->Fill(trackAOD->Pt()); - if (trackAOD->Pt() < fTOFCutP) fAccPt->Fill(trackAOD->Pt()); - - //Analysis - fdNdPt->Fill(trackAOD->Pt(), 1.0/trackAOD->Pt()); - - //TOF - if ((IntegratedLength(trackAOD) == 0) || (trackAOD->GetDetPid()->GetTOFsignal() == 0)) - continue; - - fMassAll->Fill(trackAOD->Charge()*trackAOD->P(), MassSquared(trackAOD)); - - if ((MassSquared(trackAOD) < 0.15) && (MassSquared(trackAOD) > -0.15) && (trackAOD->P() < fTOFCutP)){ - fdNdPtPion->Fill(trackAOD->Pt(), 1.0/trackAOD->Pt()); - fMassPion->Fill(trackAOD->Charge()*trackAOD->P(), MassSquared(trackAOD)); - fdEdxTPCPion->Fill(trackAOD->Charge()*trackAOD->P(),trackAOD->GetDetPid()->GetTPCsignal()); - fbgTPCPion->Fill(trackAOD->P()/fgkPionMass,trackAOD->GetDetPid()->GetTPCsignal()); - } - - if ((MassSquared(trackAOD) > 0.15) && (MassSquared(trackAOD) < 0.45) && (trackAOD->P() < fTOFCutP)){ - fdNdPtKaon->Fill(trackAOD->Pt(), 1.0/trackAOD->Pt()); - fMassKaon->Fill(trackAOD->Charge()*trackAOD->P(), MassSquared(trackAOD)); - fdEdxTPCKaon->Fill(trackAOD->Charge()*trackAOD->P(),trackAOD->GetDetPid()->GetTPCsignal()); - fbgTPCKaon->Fill(trackAOD->P()/fgkKaonMass,trackAOD->GetDetPid()->GetTPCsignal()); - //Kaon decay correction - fKaonDecayCorr->Fill(trackAOD->Pt(), TMath::Exp(KaonDecay(trackAOD))); - } - - if ((MassSquared(trackAOD) > 0.75) && (MassSquared(trackAOD) < 1.05) && (trackAOD->P() < fTOFCutP)){ - fdNdPtProton->Fill(trackAOD->Pt(), 1.0/trackAOD->Pt()); - fMassProton->Fill(trackAOD->Charge()*trackAOD->P(), MassSquared(trackAOD)); - fdEdxTPCProton->Fill(trackAOD->Charge()*trackAOD->P(),trackAOD->GetDetPid()->GetTPCsignal()); - fbgTPCProton->Fill(trackAOD->P()/fgkProtonMass,trackAOD->GetDetPid()->GetTPCsignal()); - } - }//AOD track loop - - //MC - if(fAnalysisMC){ - TClonesArray* farray = (TClonesArray*)aod->FindListObject("mcparticles"); - Int_t ntrks = farray->GetEntries(); - for(Int_t i =0 ; i < ntrks; i++){ - AliAODMCParticle* trk = (AliAODMCParticle*)farray->At(i); - //Cuts - if (!(trk->IsPhysicalPrimary())) - continue; - - if (trk->Charge() == 0) - continue; - - if ((trk->Pt() < fPtCut) || (TMath::Abs(trk->Eta()) > fEtaCut )) - continue; - - //Analysis - fdNdPtMC->Fill(trk->Pt(), 1.0/trk->Pt()); - - if ((trk->GetPdgCode() == 211) || (trk->GetPdgCode() == -211)) - fdNdPtMCPion->Fill(trk->Pt(),1.0/trk->Pt()); - - if ((trk->GetPdgCode() == 321) || (trk->GetPdgCode() == -321)) - fdNdPtMCKaon->Fill(trk->Pt(),1.0/trk->Pt()); - - if ((trk->GetPdgCode() == 2212) || (trk->GetPdgCode() == -2212)) - fdNdPtMCProton->Fill(trk->Pt(),1.0/trk->Pt()); - }//MC track loop - }//if MC - fEvents->Fill(0); - }//if vertex resolution - -} - -//________________________________________________________________________ -Bool_t AliAnalysisTaskPWG4PidDetEx::IsEventTriggered(AliVEvent* ev, TriggerMode trigger) -{ - //adapted from PWG2 (AliAnalysisTaskProton) - - ULong64_t triggerMask = ev->GetTriggerMask(); - - // definitions from p-p.cfg - ULong64_t spdFO = (1 << 14); - ULong64_t v0left = (1 << 11); - ULong64_t v0right = (1 << 12); - - switch (trigger) { - case kMB1: - if (triggerMask & spdFO || ((triggerMask & v0left) || (triggerMask & v0right))) - return kTRUE; - break; - - case kMB2: - if (triggerMask & spdFO && ((triggerMask & v0left) || (triggerMask & v0right))) - return kTRUE; - break; - - case kSPDFASTOR: - if (triggerMask & spdFO) - return kTRUE; - break; - - }//switch - - return kFALSE; -} - -//_____________________________________________________________________________ -Double_t AliAnalysisTaskPWG4PidDetEx::IntegratedLength(AliVTrack* track) const -{ - Double_t intTime [5]; - for (Int_t i = 0; i < 5; i++) intTime[i] = -100.; - Double_t timeElectron = 0, intLength = 0; - - AliAODTrack* trackAOD = (AliAODTrack*)track; - trackAOD->GetDetPid()->GetIntegratedTimes(intTime); - timeElectron = intTime[0]; - intLength = fgkC*timeElectron; - - return intLength; -} - -//_____________________________________________________________________________ -Double_t AliAnalysisTaskPWG4PidDetEx::MassSquared(AliVTrack* track) const -{ - Double_t beta = -10, mass = -10; - - if(fAnalysisType == "ESD"){ - AliESDtrack* trackESD = (AliESDtrack*)track; - beta = trackESD->GetIntegratedLength()/trackESD->GetTOFsignal()/fgkC; - mass = trackESD->P()*trackESD->P()*(1./(beta*beta) - 1.0); - } - - if(fAnalysisType == "AOD"){ - AliAODTrack* trackAOD = (AliAODTrack*)track; - beta =IntegratedLength(trackAOD)/trackAOD->GetDetPid()->GetTOFsignal()/fgkC; - mass = trackAOD->P()*trackAOD->P()*(1./(beta*beta) - 1.0); - } - - return mass; -} - -//_____________________________________________________________________________ -Double_t AliAnalysisTaskPWG4PidDetEx::KaonDecay(AliVTrack* track) const -{ - Double_t decay = -10; - - if(fAnalysisType == "ESD"){ - AliESDtrack* trackESD = (AliESDtrack*)track; - decay = trackESD->GetIntegratedLength()*fgkKaonMass/fgkCtau/trackESD->P(); - } - - if (fAnalysisType == "AOD"){ - AliAODTrack* trackAOD = (AliAODTrack*)track; - decay = IntegratedLength(trackAOD)*fgkKaonMass/fgkCtau/trackAOD->P(); - } - - return decay; -} - -//_____________________________________________________________________________ -void AliAnalysisTaskPWG4PidDetEx::Terminate(Option_t *) -{ - // Terminate loop - if (fDebug > 1) Printf("Terminate()"); - - // - // The followig code has now been moved to drawPid.C - // - -// fListOfHists = dynamic_cast (GetOutputData(0)); -// if (!fListOfHists) { -// Printf("ERROR: fListOfHists not available"); -// return; -// } - -// TH1I* hevents = dynamic_cast (fListOfHists->FindObject("fEvents")); -// Int_t nEvents = (Int_t) hevents->GetBinContent(1); - -// const Float_t normalization = 2.0*fEtaCut*2.0*TMath::Pi(); - -// //----------------- -// TCanvas* c1 = new TCanvas("c1", "c1"); -// c1->cd(); - -// TH2F* hMassAll = dynamic_cast (fListOfHists->FindObject("fMassAll")); -// hMassAll->SetLineColor(1); -// hMassAll->SetMarkerColor(1); -// hMassAll->DrawCopy(); - -// TH2F* hMassPion = dynamic_cast (fListOfHists->FindObject("fMassPion")); -// hMassPion->SetLineColor(2); -// hMassPion->SetMarkerColor(2); -// hMassPion->SetMarkerStyle(7); -// hMassPion->DrawCopy("same"); - -// TH2F* hMassKaon = dynamic_cast (fListOfHists->FindObject("fMassKaon")); -// hMassKaon->SetLineColor(3); -// hMassKaon->SetMarkerColor(3); -// hMassKaon->SetMarkerStyle(7); -// hMassKaon->DrawCopy("same"); - -// TH2F* hMassProton = dynamic_cast (fListOfHists->FindObject("fMassProton")); -// hMassProton->SetLineColor(4); -// hMassProton->SetMarkerColor(4); -// hMassProton->SetMarkerStyle(7); -// hMassProton->DrawCopy("same"); - -// TLegend* legend1 = new TLegend(0.8, 0.8, 1, 1); -// legend1->SetBorderSize(0); -// legend1->SetFillColor(0); -// legend1->AddEntry(hMassAll, "All","LP"); -// legend1->AddEntry(hMassPion, "Pions","LP"); -// legend1->AddEntry(hMassKaon, "Kaons","LP"); -// legend1->AddEntry(hMassProton, "Protons","LP"); -// legend1->Draw(); - -// c1->Update(); - -// //----------------- -// TCanvas* c2 = new TCanvas("c2", "c2"); -// c2->cd(); - -// TH2F* hdEdxTPCPion = dynamic_cast (fListOfHists->FindObject("fdEdxTPCPion")); -// hdEdxTPCPion->SetTitle("dE/dx vs p (TPC)"); -// hdEdxTPCPion->SetLineColor(2); -// hdEdxTPCPion->SetMarkerColor(2); -// hdEdxTPCPion->SetMarkerStyle(7); -// hdEdxTPCPion->DrawCopy(); - -// TH2F* hdEdxTPCKaon = dynamic_cast (fListOfHists->FindObject("fdEdxTPCKaon")); -// hdEdxTPCKaon->SetLineColor(3); -// hdEdxTPCKaon->SetMarkerColor(3); -// hdEdxTPCKaon->SetMarkerStyle(7); -// hdEdxTPCKaon->DrawCopy("same"); - -// TH2F* hdEdxTPCProton = dynamic_cast (fListOfHists->FindObject("fdEdxTPCProton")); -// hdEdxTPCProton->SetLineColor(4); -// hdEdxTPCProton->SetMarkerColor(4); -// hdEdxTPCProton->SetMarkerStyle(7); -// hdEdxTPCProton->DrawCopy("same"); - -// TLegend* legend2 = new TLegend(0.66, 0.66, 0.88, 0.88); -// legend2->SetBorderSize(0); -// legend2->SetFillColor(0); -// legend2->AddEntry(hdEdxTPCPion, "Pions","LP"); -// legend2->AddEntry(hdEdxTPCKaon, "Kaons","LP"); -// legend2->AddEntry(hdEdxTPCProton, "Protons","LP"); -// legend2->Draw(); - -// c2->Update(); - -// //----------------- -// TCanvas* c3 = new TCanvas("c3", "c3"); -// c3->cd(); - -// TH2F* hdEdxTPCbgPion = dynamic_cast (fListOfHists->FindObject("fbgTPCPion")); -// hdEdxTPCbgPion->SetTitle("dE/dx vs #beta#gamma (TPC)"); -// hdEdxTPCbgPion->SetLineColor(2); -// hdEdxTPCbgPion->SetMarkerColor(2); -// hdEdxTPCbgPion->SetMarkerStyle(7); -// hdEdxTPCbgPion->DrawCopy(); - -// TH2F* hdEdxTPCbgKaon = dynamic_cast (fListOfHists->FindObject("fbgTPCKaon")); -// hdEdxTPCbgKaon->SetLineColor(3); -// hdEdxTPCbgKaon->SetMarkerColor(3); -// hdEdxTPCbgKaon->SetMarkerStyle(7); -// hdEdxTPCbgKaon->DrawCopy("same"); - -// TH2F* hdEdxTPCbgProton = dynamic_cast (fListOfHists->FindObject("fbgTPCProton")); -// hdEdxTPCbgProton->SetLineColor(4); -// hdEdxTPCbgProton->SetMarkerColor(4); -// hdEdxTPCbgProton->SetMarkerStyle(7); -// hdEdxTPCbgProton->DrawCopy("same"); - -// TLegend* legend3 = new TLegend(0.66, 0.66, 0.88, 0.88); -// legend3->SetBorderSize(0); -// legend3->SetFillColor(0); -// legend3->AddEntry(hdEdxTPCbgPion, "Pions","LP"); -// legend3->AddEntry(hdEdxTPCbgKaon, "Kaons","LP"); -// legend3->AddEntry(hdEdxTPCbgProton, "Protons","LP"); -// legend3->Draw(); - -// c3->Update(); - -// //----------------- -// TCanvas* c4 = new TCanvas("c4", "c4", 100, 100, 500, 900); -// c4->Divide(1,3); - -// c4->cd(1); -// TH1F* hAccepatncePt = dynamic_cast (fListOfHists->FindObject("fAccPt")); -// TH1F* hAcceptanceP = dynamic_cast (fListOfHists->FindObject("fAccP")); -// hAccepatncePt->Divide(hAcceptanceP); -// hAccepatncePt->SetTitle("Acceptance correction"); -// hAccepatncePt->GetYaxis()->SetTitle("Acceptance correction"); -// hAccepatncePt->DrawCopy(); - -// c4->cd(2); -// TH1F* hEfficiencyPID = dynamic_cast (fListOfHists->FindObject("fEffPID")); -// TH1F* hEfficiencyTot = dynamic_cast (fListOfHists->FindObject("fEffTot")); -// hEfficiencyPID->Divide(hEfficiencyTot); -// hEfficiencyPID->SetTitle("Efficiency correction"); -// hEfficiencyPID->GetYaxis()->SetTitle("Efficiency correction"); -// hEfficiencyPID->DrawCopy(); - -// c4->cd(3); -// TProfile* hKDecayCorr = dynamic_cast (fListOfHists->FindObject("fKaonDecayCorr")); -// hKDecayCorr->SetTitle("Kaon decay correction"); -// hKDecayCorr->GetYaxis()->SetTitle("Kaon decay correction"); -// hKDecayCorr->GetXaxis()->SetTitle(" p_{T} [GeV/c]"); -// hKDecayCorr->DrawCopy(); - -// c4->Update(); - -// //--------------------- -// TCanvas* c5 = new TCanvas("c5", "c5", 100, 100, 600, 900); -// c5->Divide(1,2); - -// c5->cd(1); -// TH1F* hPtPionNoCorr = dynamic_cast (fListOfHists->FindObject("fdNdPtPion")); -// hPtPionNoCorr->Scale(1.0/nEvents/normalization/hPtPionNoCorr->GetBinWidth(1)); -// hPtPionNoCorr->SetTitle("p_{T} distribution (no corrections)"); -// hPtPionNoCorr->SetLineColor(2); -// hPtPionNoCorr->GetYaxis()->SetRangeUser(1E-3,1E1); -// hPtPionNoCorr->DrawCopy(); - -// TH1F* hPtKaonNoCorr = dynamic_cast (fListOfHists->FindObject("fdNdPtKaon")); -// hPtKaonNoCorr->Scale(1.0/nEvents/normalization/hPtKaonNoCorr->GetBinWidth(1)); -// hPtKaonNoCorr->SetLineColor(3); -// hPtKaonNoCorr->GetYaxis()->SetRangeUser(1E-3,1E1); -// hPtKaonNoCorr->DrawCopy("same"); - -// TH1F* hPtProtonNoCorr = dynamic_cast (fListOfHists->FindObject("fdNdPtProton")); -// hPtProtonNoCorr->Scale(1.0/nEvents/normalization/hPtProtonNoCorr->GetBinWidth(1)); -// hPtProtonNoCorr->SetLineColor(4); -// hPtProtonNoCorr->GetYaxis()->SetRangeUser(1E-3,1E1); -// hPtProtonNoCorr->DrawCopy("same"); - -// TH1F* hPt = dynamic_cast (fListOfHists->FindObject("fdNdPt")); -// hPt->Scale(1.0/nEvents/normalization/hPt->GetBinWidth(1)); -// hPt->GetYaxis()->SetRangeUser(1E-3,1E1); -// hPt->DrawCopy("same"); - -// TLegend* legend4 = new TLegend(0.63, 0.63, 0.88, 0.88); -// legend4->SetBorderSize(0); -// legend4->SetFillColor(0); -// legend4->AddEntry(hPt, "p_{T} dist (all)","L"); -// legend4->AddEntry(hPtPionNoCorr, "p_{T} dist (Pions)","L"); -// legend4->AddEntry(hPtKaonNoCorr, "p_{T} dist (Kaons)","L"); -// legend4->AddEntry(hPtProtonNoCorr, "p_{T} dist (Protons)","L"); -// legend4->Draw(); - -// gPad->SetLogy(); - - -// c5->cd(2); -// TH1F* hPtPionCorr = static_cast(hPtPionNoCorr->Clone()); -// hPtPionCorr->SetTitle("p_{T} distribution (with corrections)"); -// hPtPionCorr->Multiply(hAccepatncePt); -// hPtPionCorr->Divide(hEfficiencyPID); -// hPtPionCorr->GetYaxis()->SetRangeUser(1E-2,1E1); -// hPtPionCorr->DrawCopy(); - -// TH1F* hPtKaonCorr = static_cast(hPtKaonNoCorr->Clone()); -// hPtKaonCorr->Multiply(hAccepatncePt); -// hPtKaonCorr->Divide(hEfficiencyPID); -// hPtKaonCorr->Multiply(hKDecayCorr); -// hPtKaonCorr->GetYaxis()->SetRangeUser(1E-2,1E1); -// hPtKaonCorr->DrawCopy("same"); - -// TH1F* hPtProtonCorr = static_cast(hPtProtonNoCorr->Clone()); -// hPtProtonCorr->Multiply(hAccepatncePt); -// hPtProtonCorr->Divide(hEfficiencyPID); -// hPtProtonCorr->GetYaxis()->SetRangeUser(1E-2,1E1); -// hPtProtonCorr->DrawCopy("same"); - -// hPt->GetYaxis()->SetRangeUser(1E-2,1E1); -// hPt->DrawCopy("same"); - -// TLegend* legend5 = new TLegend(0.63, 0.63, 0.88, 0.88); -// legend5->SetBorderSize(0); -// legend5->SetFillColor(0); -// legend5->AddEntry(hPt, "p_{T} dist (all)","L"); -// legend5->AddEntry(hPtPionCorr, "p_{T} dist (Pions)","L"); -// legend5->AddEntry(hPtKaonCorr, "p_{T} dist (Kaons)","L"); -// legend5->AddEntry(hPtProtonCorr, "p_{T} dist (Protons)","L"); -// legend5->Draw(); - -// gPad->SetLogy(); - -// c5->Update(); - -// //----------------- -// if (fAnalysisMC){ -// TCanvas* c6 = new TCanvas("c6", "c6", 100, 100, 1200, 800); -// c6->Divide(2,2); - -// c6->cd(1); -// TH1F* hPt_clone = static_cast(hPt->Clone()); -// hPt_clone->GetYaxis()->SetRangeUser(1E-5,1E1); -// hPt_clone->SetTitle("p_{T} distribution (all)"); -// hPt_clone->SetLineColor(1); -// hPt_clone->DrawCopy(); - -// TH1F* hPtMC = dynamic_cast (fListOfHists->FindObject("fdNdPtMC")); -// hPtMC->Scale(1.0/nEvents/normalization/hPtMC->GetBinWidth(1)); -// hPtMC->GetYaxis()->SetRangeUser(1E-5,1E1); -// hPtMC->DrawCopy("same"); - -// TLegend* legend6 = new TLegend(0.57, 0.57, 0.87, 0.87); -// legend6->SetBorderSize(0); -// legend6->SetFillColor(0); -// legend6->AddEntry(hPt_clone, "p_{T} dist (Rec)", "L"); -// legend6->AddEntry(hPtMC, "p_{T} dist (MC)", "L"); -// legend6->Draw(); - -// gPad->SetLogy(); - -// c6->cd(2); -// TH1F* hPtPion_clone = static_cast(hPtPionCorr->Clone()); -// hPtPion_clone->GetYaxis()->SetRangeUser(1E-2,1E1); -// hPtPion_clone->SetTitle("p_{T} distribution (Pions)"); -// hPtPion_clone->SetLineColor(1); -// hPtPion_clone->DrawCopy(); - -// TH1F* hPtMCPion = dynamic_cast (fListOfHists->FindObject("fdNdPtMCPion")); -// hPtMCPion->Scale(1.0/nEvents/normalization/hPtMCPion->GetBinWidth(1)); -// hPtMCPion->GetYaxis()->SetRangeUser(1E-2,1E1); -// hPtMCPion->DrawCopy("same"); - -// TLegend* legend7 = new TLegend(0.57, 0.57, 0.87, 0.87); -// legend7->SetBorderSize(0); -// legend7->SetFillColor(0); -// legend7->AddEntry(hPtPion_clone, "p_{T} dist (Rec)", "L"); -// legend7->AddEntry(hPtMCPion, "p_{T} dist (MC)", "L"); -// legend7->Draw(); - -// gPad->SetLogy(); - -// c6->cd(3); -// TH1F* hPtKaon_clone = static_cast(hPtKaonCorr->Clone()); -// hPtKaon_clone->GetYaxis()->SetRangeUser(1E-2,1E0); -// hPtKaon_clone->SetLineColor(1); -// hPtKaon_clone->DrawCopy(); - -// TH1F* hPtMCKaon = dynamic_cast (fListOfHists->FindObject("fdNdPtMCKaon")); -// hPtMCKaon->Scale(1.0/nEvents/normalization/hPtMCKaon->GetBinWidth(1)); -// hPtMCKaon->GetYaxis()->SetRangeUser(1E-2,1E0); -// hPtMCKaon->DrawCopy("same"); - -// TLegend* legend8 = new TLegend(0.57, 0.57, 0.87, 0.87); -// legend8->SetBorderSize(0); -// legend8->SetFillColor(0); -// legend8->AddEntry(hPtKaon_clone, "p_{T} dist (Rec)", "L"); -// legend8->AddEntry(hPtMCKaon, "p_{T} dist (MC)", "L"); -// legend8->Draw(); - -// gPad->SetLogy(); - -// c6->cd(4); -// TH1F* hPtProton_clone = static_cast(hPtProtonCorr->Clone()); -// hPtProton_clone->GetYaxis()->SetRangeUser(1E-2,1E-1); -// hPtProton_clone->SetLineColor(1); -// hPtProton_clone->DrawCopy(); - -// TH1F* hPtMCProton = dynamic_cast (fListOfHists->FindObject("fdNdPtMCProton")); -// hPtMCProton->Scale(1.0/nEvents/normalization/hPtMCProton->GetBinWidth(1)); -// hPtMCProton->GetYaxis()->SetRangeUser(1E-2,1E-1); -// hPtMCProton->DrawCopy("same"); - -// TLegend* legend9 = new TLegend(0.2, 0.25, 0.5, 0.55); -// legend9->SetBorderSize(0); -// legend9->SetFillColor(0); -// legend9->AddEntry(hPtProton_clone, "p_{T} dist (Rec)", "L"); -// legend9->AddEntry(hPtMCProton, "p_{T} dist (MC)", "L"); -// legend9->Draw(); - -// gPad->SetLogy(); - -// c6->Update(); -// } - -} diff --git a/PWGJE/AliAnalysisTaskPWG4PidDetEx.h b/PWGJE/AliAnalysisTaskPWG4PidDetEx.h deleted file mode 100644 index d257dc7d2c4..00000000000 --- a/PWGJE/AliAnalysisTaskPWG4PidDetEx.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef ALIANALYSISTASKPWG4PidDetEx_H -#define ALIANALYSISTASKPWG4PidDetEx_H - -#include -#include -#include -#include - -#include "AliAnalysisTaskSE.h" -#include "AliAODEvent.h" -#include "AliESDEvent.h" -#include "AliAnalysisFilter.h" - -class AliAnalysisTaskPWG4PidDetEx : public AliAnalysisTaskSE { - public: - enum TriggerMode {kMB1, kMB2, kSPDFASTOR}; - - AliAnalysisTaskPWG4PidDetEx(); - AliAnalysisTaskPWG4PidDetEx(const char *name); - virtual ~AliAnalysisTaskPWG4PidDetEx(); - - virtual void UserCreateOutputObjects(); - virtual void UserExec(Option_t *option); - virtual void Terminate(Option_t *); - - virtual void SetTrackFilter(AliAnalysisFilter* trackF) {fTrackFilter = trackF;} - void SetAnalysisType(const char* analysisType) {fAnalysisType = analysisType;} - void SetTriggerMode(TriggerMode triggermode) {fTriggerMode = triggermode;} - void SetMC(Bool_t analysisMC){fAnalysisMC = analysisMC;} - void SetPtCut(Double_t ptCut){fPtCut = ptCut;} - void SetEtaCut(Double_t etaCut){fEtaCut = etaCut;} - - Bool_t IsEventTriggered(AliVEvent* ev, TriggerMode trigger); - - void AnalyzeESD(AliESDEvent* esd); - void AnalyzeAOD(AliAODEvent* aod); - - private: - AliAnalysisTaskPWG4PidDetEx(const AliAnalysisTaskPWG4PidDetEx&); - AliAnalysisTaskPWG4PidDetEx& operator=(const AliAnalysisTaskPWG4PidDetEx&); - - Double_t IntegratedLength(AliVTrack* track) const; - Double_t MassSquared (AliVTrack* track) const; - Double_t KaonDecay (AliVTrack* track) const; - - static const Double_t fgkCtau; // distance for kaon decay - static const Double_t fgkPionMass; // pion mass - static const Double_t fgkKaonMass; // kaon mass - static const Double_t fgkProtonMass; // proton mass - static const Double_t fgkC; // peed of light - - - AliESDEvent* fESD; //! ESD object - AliAODEvent* fAOD; //! AOD object - TList* fListOfHists; //! Output list of histograms - Double_t fEtaCut; // Eta cut used to select particles - Double_t fPtCut; // pT cut used to select particles - Int_t fXbins; // #bins for Pt histos range - Double_t fXmin; // min X value for histo range - Double_t fTOFCutP; // max X value for histo range; also the p cut used in TOF for PID - - AliAnalysisFilter* fTrackFilter; // Track Filter - Bool_t fAnalysisMC; // Flag for MC analysis - TString fAnalysisType; // "ESD" or "AOD" - TriggerMode fTriggerMode; // Trigger mode - - - //Histograms - TH1I* fEvents; //! #analyzed events - TH1F* fEffTot; //! pT for all charged particles - TH1F* fEffPID; //! pT for charged particles with TOF signal - TH1F* fAccP; //! pT for charged particles with p < fTOFCutP - TH1F* fAccPt; //! pT for charged particles with pT < fTOFCutP - TProfile* fKaonDecayCorr; //! decay correction for Kaons - TH1F* fdNdPt; //! pT dist (Rec) - TH2F* fMassAll; //! mass calculated from TOF vs p - TH1F* fdNdPtPion; //! pT for pions identified with TOF - TH2F* fMassPion; //! mass for pions identified with TOF - TH2F* fdEdxTPCPion; //! dE/dx vs p (TPC) for pions identified with TOF - TH2F* fbgTPCPion; //! dE/dx vs betagamma (TPC) for pions identified with TOF - TH1F* fdNdPtKaon; //! pT for kaons identified with TOF - TH2F* fMassKaon; //! mass for kaons identified with TOF - TH2F* fdEdxTPCKaon; //! dE/dx vs p (TPC) for kaons identified with TOF - TH2F* fbgTPCKaon; //! dE/dx vs betagamma (TPC) for kaons identified with TOF - TH1F* fdNdPtProton; //! pT for protons identified with TOF - TH2F* fMassProton; //! mass for protons identified with TOF - TH2F* fdEdxTPCProton; //! dE/dx vs p (TPC) for protons identified with TOF - TH2F* fbgTPCProton; //! dE/dx vs betagamma (TPC) for protons identified with TOF - TH1F* fdNdPtMC; //! pT dist (MC) - TH1F* fdNdPtMCPion; //! pT dist for pions (MC) - TH1F* fdNdPtMCKaon; //! pT dist for kaons (MC) - TH1F* fdNdPtMCProton; //! pT dist for protons (MC) - - ClassDef(AliAnalysisTaskPWG4PidDetEx, 1); //Analysis task for PWG4 PID using detector signals -}; - -#endif diff --git a/PWGJE/AliAnalysisTaskPartonDisc.h b/PWGJE/AliAnalysisTaskPartonDisc.h index 83dc913d8f2..1d476a2f302 100644 --- a/PWGJE/AliAnalysisTaskPartonDisc.h +++ b/PWGJE/AliAnalysisTaskPartonDisc.h @@ -19,6 +19,7 @@ class TProfile; class AliAODEvent; class AliMCEvent; class AliAODJet; +class AliAODTrack; class AliAODMCParticle; class AliAODVertex; diff --git a/PWGJE/AliAnalysisTaskQGSep.cxx b/PWGJE/AliAnalysisTaskQGSep.cxx deleted file mode 100644 index d3396d0357a..00000000000 --- a/PWGJE/AliAnalysisTaskQGSep.cxx +++ /dev/null @@ -1,511 +0,0 @@ -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "AliVEvent.h" -#include "AliVParticle.h" - -#include "AliESDEvent.h" -#include "AliESDtrack.h" - -#include "AliAODEvent.h" -#include "AliAODTrack.h" - -#include "AliMCEvent.h" -#include "AliMCParticle.h" -#include "AliAnalysisManager.h" -#include "AliMCEvent.h" -#include "TParticle.h" -#include "AliStack.h" - -#include "AliAODEvent.h" -#include "AliAODVertex.h" -#include "AliAODHandler.h" -#include "AliAODTrack.h" -#include "AliAODJet.h" -#include "AliAODMCParticle.h" - -#include "AliAnalysisTaskQGSep.h" -#include "AliAnalysisHelperJetTasks.h" -ClassImp(AliAnalysisTaskQGSep) - -//________________________________________________________________________ -AliAnalysisTaskQGSep::AliAnalysisTaskQGSep(const char *name) - : AliAnalysisTaskSE(name), - fBranchRec("jets"), - fUseMC(kFALSE), - fUseAOD(kFALSE), - fXsection(0), - fWeight(0), - fMyAODEvent(0), - fOutputList(0), - fpHistPtAvEQ(0), - fpHistPtAvEG(0), - fpHistDrEQ(0), - fpHistDrEG(0), - fpHistDrE(0), - fpHistPtAvE(0), - fpHistDrE3(0), - fpHistPtAvE3(0) - -{ - // Constructor - - DefineOutput(1, TList::Class()); -} - -//________________________________________________________________________ -void AliAnalysisTaskQGSep::UserCreateOutputObjects() -{ - // Create histograms - // Called once - - fOutputList = new TList(); - - if(fUseMC){ - - //histos for quarks - fpHistPtAvEQ = new TProfile("fpHistPtAvEQ", "", 100, 0, 100, 0, 10); - fOutputList->Add(fpHistPtAvEQ); - fpHistDrEQ = new TProfile("fpHistDrEQ", "", 100, 0, 100, 0, 0.5); - fOutputList->Add(fpHistDrEQ); - - //histos for gluons - fpHistPtAvEG = new TProfile("fpHistPtAvEG", "", 100, 0, 100, 0., 10.); - fOutputList->Add(fpHistPtAvEG); - fpHistDrEG = new TProfile("fpHistDrEG", "", 100, 0, 100, 0, 0.5); - fOutputList->Add(fpHistDrEG); - } - - //histos for full spetra, no separation - fpHistDrE = new TProfile("fpHistDrE", "", 100, 0, 100, 0, 0.5); - fOutputList->Add(fpHistDrE); - fpHistPtAvE = new TProfile("fpHistPtAvE", "", 100, 0, 100, 0., 10.); - fOutputList->Add(fpHistPtAvE); - fpHistDrE3 = new TProfile("fpHistDrE3", "", 100, 0, 100, 0, 0.5); - fOutputList->Add(fpHistDrE3); - fpHistPtAvE3 = new TProfile("fpHistPtAvE3", "", 100, 0, 100, 0., 10.); - fOutputList->Add(fpHistPtAvE3); - - for(Int_t i = 0; i < fOutputList->GetEntries(); i++){ - TH1 * h = dynamic_cast(fOutputList->At(i)); - if(h) h->Sumw2(); - } - - if(fDebug)Printf("~# QGSep User objects created"); -} - -//__________________________________________________________________ -Bool_t AliAnalysisTaskQGSep::Notify() -{ - - if(fUseMC){ - // - // Implemented Notify() to read the cross sections - // and number of trials from pyxsec.root - // - - - TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree(); - Float_t xsection = 0; - Float_t ftrials = 1; - - Float_t fAvgTrials = 1; - if(tree){ - TFile *curfile = tree->GetCurrentFile(); - if (!curfile) { - Error("Notify","No current file"); - return kFALSE; - } - AliAnalysisHelperJetTasks::PythiaInfoFromFile(curfile->GetName(),xsection,ftrials); - // construct a poor man average trials - Float_t nEntries = (Float_t)tree->GetTree()->GetEntries(); - if(ftrials>=nEntries)fAvgTrials = ftrials/nEntries; // CKB take this into account for normalisation - } - - if(xsection>0){ - fXsection = xsection; - fWeight = fXsection/fAvgTrials; - } - else fWeight = 1; - return kTRUE; - } - - else{ - fWeight = 1; - return kTRUE; - } - -} - -//________________________________________________________________________ -void AliAnalysisTaskQGSep::UserExec(Option_t *) -{ - // Main loop - // Called for each event - - if(fUseAOD){ - AliVEvent *event = InputEvent(); - if (!event) { - Error("UserExec", "Could not retrieve event"); - return; - } - - fMyAODEvent = dynamic_cast (InputEvent()); - } - - else{ - // assume that the AOD is in the general output... - fMyAODEvent = AODEvent(); - if(!fMyAODEvent){ - Printf("%s:%d AODEvent not found in the Output",(char*)__FILE__,__LINE__); - return; - } - } - - if (fMyAODEvent){ - if(fUseMC) - LoopAODMC(); - else - LoopAOD(); - } - - // Post output data. - PostData(1, fOutputList); -} - -//________________________________________________________________________ -void AliAnalysisTaskQGSep::Terminate(Option_t*) -{ - // Draw result to the screen - // Called once at the end of the query - - fOutputList = dynamic_cast (GetOutputData(1)); - if (!fOutputList) { - Error("Terminate","fOutputList not available"); - return; - } - -} - -//________________________________________________________________________ -void AliAnalysisTaskQGSep::LoopAOD(){ - AliAODJet recJets[4]; - AliAODJet jets[4]; - AliAODJet rJets[4]; - Int_t nRecJets = 0; - - //array of reconstructed jets from the AOD input - TClonesArray *aodRecJets = dynamic_cast(fMyAODEvent->FindListObject(fBranchRec.Data())); - if(!aodRecJets){ - PostData(1, fOutputList); - return; - } - - // reconstructed jets - nRecJets = aodRecJets->GetEntries(); - if(fDebug)Printf("--- Jets found in bRec: %d", nRecJets); - nRecJets = TMath::Min(nRecJets, 4); - for(int ir = 0;ir < nRecJets;++ir) - { - AliAODJet *tmp = dynamic_cast(aodRecJets->At(ir)); - if(!tmp)continue; - jets[ir] = *tmp; - } - - Int_t counter = 0; - Int_t tag = 0; - Int_t nGenSel = 0; - - TLorentzVector v[4]; - Double_t eSum = 0.; - Double_t pxSum = 0.; - Double_t pySum = 0.; - Double_t pzSum = 0.; - - for(Int_t i = 0; i < nRecJets; i++) - { - if(nRecJets == 1) - { - rJets[nGenSel] = jets[i]; - v[nGenSel].SetPxPyPzE(jets[i].Px(), jets[i].Py(), jets[i].Pz(), jets[i].E()); - eSum += jets[i].E(); - pxSum += jets[i].Px(); - pySum += jets[i].Py(); - pzSum += jets[i].Pz(); - nGenSel++; - } - else - { - counter = 0; - tag = 0; - for(Int_t j = 0; j < nRecJets; j++) - { - if(i!=j) - { - Double_t dRij = jets[i].DeltaR(&jets[j]); - counter++; - if(dRij > 2*0.4) tag++; - } - } - if(counter!=0) - { - if(tag/counter == 1) - { - rJets[nGenSel] = jets[i]; - v[nGenSel].SetPxPyPzE(jets[i].Px(), jets[i].Py(), jets[i].Pz(), jets[i].E()); - eSum += jets[i].E(); - pxSum += jets[i].Px(); - pySum += jets[i].Py(); - pzSum += jets[i].Pz(); - nGenSel++; - } - } - } - } - - nRecJets = nGenSel; - - if(nRecJets == 0){ - PostData(1, fOutputList); - return; - } - - TLorentzVector vB; - vB.SetPxPyPzE(pxSum, pySum, pzSum, eSum); - Double_t e[4]; - for(Int_t i = 0; i < nRecJets; i++){ - v[i].Boost(-vB.Px()/vB.E(),-vB.Py()/vB.E(),-vB.Pz()/vB.E()); - e[i] = v[i].E(); - } - - Int_t idxj[4]; - TMath::Sort(TMath::Min(nRecJets,4), e, idxj); - for(Int_t i = 0; i < nRecJets; i++){ - recJets[i] = rJets[idxj[i]]; - } - - - for(Int_t iJ = 0; iJ < nRecJets; iJ++){ - Double_t pTsum = 0.; - TRefArray * tra = dynamic_cast(recJets[iJ].GetRefTracks()); - if(!tra) continue; - Int_t nAODtracks = TMath::Min(1000, tra->GetEntries()); - Double_t dR[1000]; - for(Int_t iT = 0; iT < nAODtracks; iT++){ - AliAODTrack * jetTrack = dynamic_cast(tra->At(iT)); - if(!jetTrack) continue; - pTsum += jetTrack->Pt(); - dR[iT] = recJets[iJ].DeltaR(jetTrack); - } - - - fpHistPtAvE->Fill(recJets[iJ].E(), (Double_t)pTsum/(Double_t)nAODtracks, fWeight); - - if(iJ > 1) //fill mulit-jet histo - fpHistPtAvE3->Fill(recJets[iJ].E(), (Double_t)pTsum/(Double_t)nAODtracks, fWeight); - - Int_t idxAOD[1000]; - TMath::Sort(nAODtracks, dR, idxAOD, kFALSE); - - Double_t pTsum90Inv=0.; - for(Int_t iT = 0; iT < nAODtracks; iT++){ - AliAODTrack * track = dynamic_cast(tra->At(idxAOD[iT])); - if(!track) continue; - pTsum90Inv += track->Pt(); - if(pTsum90Inv >= 0.9*pTsum){ - Double_t deltaR = recJets[iJ].DeltaR(track); - - fpHistDrE->Fill(recJets[iJ].E(), deltaR, fWeight); - - if(iJ > 1) - fpHistDrE3->Fill(recJets[iJ].E(), deltaR, fWeight); - - break; - } - } - } -} - -//__________________________________________________________________ -void AliAnalysisTaskQGSep::LoopAODMC(){ - - AliAODJet recJets[4]; - AliAODJet jets[4]; - AliAODJet rJets[4]; - Int_t nRecJets = 0; - - //array of reconstructed jets from the AOD input - TClonesArray *aodRecJets = dynamic_cast(fMyAODEvent->FindListObject(fBranchRec.Data())); - if(!aodRecJets){ - PostData(1, fOutputList); - return; - } - - // reconstructed jets - nRecJets = aodRecJets->GetEntries(); - if(fDebug)Printf("--- Jets found in bRec: %d", nRecJets); - nRecJets = TMath::Min(nRecJets, 4); - for(int ir = 0;ir < nRecJets;++ir) - { - AliAODJet *tmp = dynamic_cast(aodRecJets->At(ir)); - if(!tmp)continue; - jets[ir] = *tmp; - } - - Int_t counter = 0; - Int_t tag = 0; - Int_t nGenSel = 0; - - TLorentzVector v[4]; - Double_t eSum = 0.; - Double_t pxSum = 0.; - Double_t pySum = 0.; - Double_t pzSum = 0.; - - for(Int_t i = 0; i < nRecJets; i++) - { - if(nRecJets == 1) - { - rJets[nGenSel] = jets[i]; - v[nGenSel].SetPxPyPzE(jets[i].Px(), jets[i].Py(), jets[i].Pz(), jets[i].E()); - eSum += jets[i].E(); - pxSum += jets[i].Px(); - pySum += jets[i].Py(); - pzSum += jets[i].Pz(); - nGenSel++; - } - else - { - counter = 0; - tag = 0; - for(Int_t j = 0; j < nRecJets; j++) - { - if(i!=j) - { - Double_t dRij = jets[i].DeltaR(&jets[j]); - counter++; - if(dRij > 2*0.4) tag++; - } - } - if(counter!=0) - { - if(tag/counter == 1) - { - rJets[nGenSel] = jets[i]; - v[nGenSel].SetPxPyPzE(jets[i].Px(), jets[i].Py(), jets[i].Pz(), jets[i].E()); - eSum += jets[i].E(); - pxSum += jets[i].Px(); - pySum += jets[i].Py(); - pzSum += jets[i].Pz(); - nGenSel++; - } - } - } - } - - nRecJets = nGenSel; - - if(nRecJets == 0){ - PostData(1, fOutputList); - return; - } - - TLorentzVector vB; - vB.SetPxPyPzE(pxSum, pySum, pzSum, eSum); - Double_t e[4]; - for(Int_t i = 0; i < nRecJets; i++){ - v[i].Boost(-vB.Px()/vB.E(),-vB.Py()/vB.E(),-vB.Pz()/vB.E()); - e[i] = v[i].E(); - } - - Int_t idxj[4]; - TMath::Sort(TMath::Min(nRecJets,4), e, idxj); - for(Int_t i = 0; i < nRecJets; i++){ - recJets[i] = rJets[idxj[i]]; - } - - Int_t nMCtracks = 0; - TClonesArray *tca = dynamic_cast(fMyAODEvent->FindListObject(AliAODMCParticle::StdBranchName())); - if(!tca) return; - nMCtracks = TMath::Min(tca->GetEntries(), 10000); - - //sort AliAODMCParticles in pT - Double_t pTMC[10000]; - for(Int_t iMC = 0; iMC < nMCtracks; iMC++){ - AliAODMCParticle *partMC = dynamic_cast(tca->At(iMC)); - if(!partMC) continue; - pTMC[iMC]=partMC->Pt(); - } - - Int_t idxMC[10000]; - TMath::Sort(nMCtracks, pTMC, idxMC); - - - Int_t flagQ[4] = {0}, flagG[4] = {0}; - for(Int_t iJ = 0; iJ < nRecJets; iJ++){ - //flag jet as q/g - - //look for highest momentum parton in the jet cone - for(Int_t iMC = 0; iMC < nMCtracks; iMC++){ - AliAODMCParticle *partMC = dynamic_cast(tca->At(idxMC[iMC])); - if(!partMC) continue; - Double_t r = recJets[iJ].DeltaR(partMC); - if(r < 0.4){ - if(TMath::Abs(partMC->GetPdgCode()) < 9) - flagQ[iJ] = 1; - if(TMath::Abs(partMC->GetPdgCode()) == 21) - flagG[iJ] = 1; - break; - } - } - - Double_t pTsum = 0.; - TRefArray * tra = dynamic_cast(recJets[iJ].GetRefTracks()); - if(!tra) continue; - Int_t nAODtracks = TMath::Min(1000, tra->GetEntries()); - Double_t dR[1000]; - for(Int_t iT = 0; iT < nAODtracks; iT++){ - AliAODTrack * jetTrack = dynamic_cast(tra->At(iT)); - if(!jetTrack) continue; - pTsum += jetTrack->Pt(); - dR[iT] = recJets[iJ].DeltaR(jetTrack); - } - - fpHistPtAvE->Fill(recJets[iJ].E(), (Double_t)pTsum/(Double_t)nAODtracks, fWeight); - if(flagQ[iJ] == 1) fpHistPtAvEQ->Fill(recJets[iJ].E(), (Double_t)pTsum/(Double_t)nAODtracks, fWeight); - if(flagG[iJ] == 1) fpHistPtAvEG->Fill(recJets[iJ].E(), (Double_t)pTsum/(Double_t)nAODtracks, fWeight); - - if(iJ > 1) //fill mulit-jet histo - fpHistPtAvE3->Fill(recJets[iJ].E(), (Double_t)pTsum/(Double_t)nAODtracks, fWeight); - - Int_t idxAOD[1000]; - TMath::Sort(nAODtracks, dR, idxAOD, kFALSE); - - Double_t pTsum90Inv=0.; - for(Int_t iT = 0; iT < nAODtracks; iT++){ - AliAODTrack * track = dynamic_cast(tra->At(idxAOD[iT])); - if(!track) continue; - pTsum90Inv += track->Pt(); - if(pTsum90Inv >= 0.9*pTsum){ - Double_t deltaR = recJets[iJ].DeltaR(track); - - fpHistDrE->Fill(recJets[iJ].E(), deltaR, fWeight); - if(flagQ[iJ] == 1) fpHistDrEQ->Fill(recJets[iJ].E(), deltaR, fWeight); - if(flagG[iJ] == 1) fpHistDrEG->Fill(recJets[iJ].E(), deltaR, fWeight); - - if(iJ > 1) - fpHistDrE3->Fill(recJets[iJ].E(), deltaR, fWeight); - - break; - } - } - } -} diff --git a/PWGJE/AliAnalysisTaskQGSep.h b/PWGJE/AliAnalysisTaskQGSep.h deleted file mode 100644 index c7d2b0f30b0..00000000000 --- a/PWGJE/AliAnalysisTaskQGSep.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef ALIANALYSISTASKQGSEP_H -#define ALIANALYSISTASKQGSEP_H - -// example of an analysis task creating a p_t spectrum -// Authors: Panos Cristakoglou, Jan Fiete Grosse-Oetringhaus, Christian Klein-Boesing - -class TList; -class TProfile; -class AliAODEvent; - -#include "AliAnalysisTaskSE.h" - -class AliAnalysisTaskQGSep : public AliAnalysisTaskSE { - public: - AliAnalysisTaskQGSep(const char *name=""); - virtual ~AliAnalysisTaskQGSep() {} - - virtual void UserCreateOutputObjects(); - virtual Bool_t Notify(); - virtual void UserExec(Option_t* option); - virtual void Terminate(Option_t *); - - void LoopAOD(); //AOD loop - void LoopAODMC(); //loop containing MC information - - void UseMC(Bool_t useMC=kFALSE) { fUseMC = useMC;} //sets use of MC - void UseAOD(Bool_t useAOD=kFALSE) {fUseAOD = useAOD;} //sets use of AOD inoput - - private: - TString fBranchRec; // AOD branch name for reconstructe - Bool_t fUseMC; //switch to use MC info - Bool_t fUseAOD; //swicth between using AOD input - Double_t fXsection; // cross-section from pyxsec.root - Double_t fWeight; //fXsection/fAvgTrials; weighting factor for different pT hard bins - AliAODEvent *fMyAODEvent; // aod event - - TList *fOutputList; // output list - TProfile *fpHistPtAvEQ; //Quark Pt_av vs. Energy - TProfile *fpHistPtAvEG; //Gluon Pt_av vs Energy - TProfile *fpHistDrEQ; //Quark Dr vs Energy - TProfile *fpHistDrEG; //Gluon Dr vs Energy - TProfile *fpHistDrE; //Dr vs E for all jets - TProfile *fpHistPtAvE; //Pt_av vs E for all jets - TProfile *fpHistDrE3; //Dr vs E for multi jets - TProfile *fpHistPtAvE3; //Pt_av vs E for multi jets - - AliAnalysisTaskQGSep(const AliAnalysisTaskQGSep&); // not implemented - AliAnalysisTaskQGSep& operator=(const AliAnalysisTaskQGSep&); // not implemented - - ClassDef(AliAnalysisTaskQGSep, 1); // example of analysis -}; - -#endif diff --git a/PWGJE/AliAnalysisTaskThreeJets.cxx b/PWGJE/AliAnalysisTaskThreeJets.cxx deleted file mode 100644 index be883a97b86..00000000000 --- a/PWGJE/AliAnalysisTaskThreeJets.cxx +++ /dev/null @@ -1,1301 +0,0 @@ - -// ****** -// Task for topological study of three jet events by sona -// ***** -// ***** -// ***** - - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "AliAnalysisTaskThreeJets.h" -#include "AliAnalysisManager.h" -#include "AliAODEvent.h" -#include "AliAODVertex.h" -#include "AliAODHandler.h" -#include "AliAODTrack.h" -#include "AliAODJet.h" -#include "AliAODMCParticle.h" -//#include "AliGenPythiaEventHeader.h" -//#include "AliMCEvent.h" -//#include "AliStack.h" - - -#include "AliAnalysisHelperJetTasks.h" - - -ClassImp(AliAnalysisTaskThreeJets) - - AliAnalysisTaskThreeJets::AliAnalysisTaskThreeJets() : AliAnalysisTaskSE(), - - fAOD(0x0), - fUseMC(0x0), - - fBranchRec(""), - fBranchGen(""), - - fUseAODInput(kFALSE), - - fR(0x0), - fList(0x0), - - fhStopHisto(0x0), - - fGlobVar(1), - fXsection(1), - - fhX3X4Rec(0x0), - fhX3X4Gen(0x0), - - fhMu35Rec(0x0), - fhMu34Rec(0x0), - fhMu45Rec(0x0), - - fhMu35Gen(0x0), - fhMu34Gen(0x0), - fhMu45Gen(0x0), - - fhInOut(0x0), - - fhThrustRec2(0x0), - fhThrustRec3(0x0), - - fhThrustGen2(0x0), - fhThrustGen3(0x0), - - fhCGen2(0x0), - fhCGen3(0x0), - - fhSGen2(0x0), - fhSGen3(0x0), - - fhAGen2(0x0), - fhAGen3(0x0), - - fhCRec2(0x0), - fhCRec3(0x0), - - fhSRec2(0x0), - fhSRec3(0x0), - - fhARec2(0x0), - fhARec3(0x0), - - fhX3(0x0), - fhX4(0x0), - fhX5(0x0), - - fhXSec(0x0), - - fhX3X4Rec60(0x0), - fhX3X4Rec60100(0x0), - fhX3X4Rec100(0x0), - - fhX3X4Gen60(0x0), - fhX3X4Gen60100(0x0), - fhX3X4Gen100(0x0), - - fhdPhiThrustGen(0x0), - fhdPhiThrustGenALL(0x0), - - fhdPhiThrustRec(0x0), - fhdPhiThrustRecALL(0x0) - -{ - -} - -AliAnalysisTaskThreeJets::AliAnalysisTaskThreeJets(const char * name): - AliAnalysisTaskSE(name), - - fAOD(0x0), - fUseMC(0x0), - - fBranchRec(""), - fBranchGen(""), - - fUseAODInput(kFALSE), - - fR(0x0), - fList(0x0), - - fhStopHisto(0x0), - - fGlobVar(1), - fXsection(1), - - fhX3X4Rec(0x0), - fhX3X4Gen(0x0), - - fhMu35Rec(0x0), - fhMu34Rec(0x0), - fhMu45Rec(0x0), - - fhMu35Gen(0x0), - fhMu34Gen(0x0), - fhMu45Gen(0x0), - - fhInOut(0x0), - - fhThrustRec2(0x0), - fhThrustRec3(0x0), - - fhThrustGen2(0x0), - fhThrustGen3(0x0), - - fhCGen2(0x0), - fhCGen3(0x0), - - fhSGen2(0x0), - fhSGen3(0x0), - - fhAGen2(0x0), - fhAGen3(0x0), - - fhCRec2(0x0), - fhCRec3(0x0), - - fhSRec2(0x0), - fhSRec3(0x0), - - fhARec2(0x0), - fhARec3(0x0), - - fhX3(0x0), - fhX4(0x0), - fhX5(0x0), - - fhXSec(0x0), - - fhX3X4Rec60(0x0), - fhX3X4Rec60100(0x0), - fhX3X4Rec100(0x0), - - fhX3X4Gen60(0x0), - fhX3X4Gen60100(0x0), - fhX3X4Gen100(0x0), - - fhdPhiThrustGen(0x0), - fhdPhiThrustGenALL(0x0), - - fhdPhiThrustRec(0x0), - fhdPhiThrustRecALL(0x0) -{ - DefineOutput(1, TList::Class()); -} - - - -Bool_t AliAnalysisTaskThreeJets::Notify() -{ - // - // Implemented Notify() to read the cross sections - // and number of trials from pyxsec.root - // - - - TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree(); - Float_t xsection = 0; - Float_t ftrials = 1; - - Float_t fAvgTrials = 1; - if(tree){ - TFile *curfile = tree->GetCurrentFile(); - if (!curfile) { - Error("Notify","No current file"); - return kFALSE; - } - AliAnalysisHelperJetTasks::PythiaInfoFromFile(curfile->GetName(),xsection,ftrials); - // construct a poor man average trials - Float_t nEntries = (Float_t)tree->GetTree()->GetEntries(); - if(ftrials>=nEntries)fAvgTrials = ftrials/nEntries; // CKB take this into account for normalisation - } - - if(xsection>0)fXsection = xsection; - - return kTRUE; - -} - - -//___________________________________________________________________________________________________________________________________ -void AliAnalysisTaskThreeJets::UserCreateOutputObjects() -{ - // - // Create the output container - // - // Printf("Analysing event %s :: # %5d\n", gSystem->pwd(), (Int_t) fEntry); - - printf("AnalysisTaskJetSpectrum::UserCreateOutputObjects() \n"); - - fList = new TList(); - - //histogram, that maps were the code returns - fhStopHisto = new TH1I("StopHisto", "", 8, 0, 8); - fhStopHisto->SetXTitle("No. of the return"); - fList->Add(fhStopHisto); - - fhX3X4Gen = new TH2F("X3vsX4Gen", "", 22, 0.6, 1.02, 33, 0.4, 1.02); - fhX3X4Gen->SetXTitle("X_{3}"); - fhX3X4Gen->SetYTitle("X_{4}"); - fhX3X4Gen->Sumw2(); - fList->Add(fhX3X4Gen); - - fhX3X4Rec = new TH2F("X3vsX4Rec", "", 22, 0.6, 1.02, 33, 0.4, 1.02); - fhX3X4Rec->SetXTitle("X_{3}"); - fhX3X4Rec->SetYTitle("X_{4}"); - fhX3X4Rec->Sumw2(); - fList->Add(fhX3X4Rec); - - fhMu35Rec = new TH1F("Mu35Rec", "", 20,0.1,0.8); - fhMu35Rec->Sumw2(); - fhMu35Rec->SetXTitle("#mu_{35}"); - fhMu35Rec->SetYTitle("#frac{dN}{d#mu_{35Rec}}"); - fList->Add(fhMu35Rec); - - fhMu34Rec = new TH1F("Mu34Rec", "", 20,0.5,1); - fhMu34Rec->Sumw2(); - fhMu34Rec->SetXTitle("#mu_{34}"); - fhMu34Rec->SetYTitle("#frac{dN}{d#mu_{34}}"); - fList->Add(fhMu34Rec); - - fhMu45Rec = new TH1F("Mu45Rec", "", 20,0,0.65); - fhMu45Rec->Sumw2(); - fhMu45Rec->SetXTitle("#mu_{45}"); - fhMu45Rec->SetYTitle("#frac{dN}{d#mu_{45}}"); - fList->Add(fhMu45Rec); - - fhMu35Gen = new TH1F("Mu35Gen", "", 20,0.1,0.8); - fhMu35Gen->Sumw2(); - fhMu35Gen->SetXTitle("#mu_{35Gen}"); - fhMu35Gen->SetYTitle("#frac{dN}{d#mu_{35Gen}}"); - fList->Add(fhMu35Gen); - - fhMu34Gen = new TH1F("Mu34Gen", "", 20,0.5,1); - fhMu34Gen->Sumw2(); - fhMu34Gen->SetXTitle("#mu_{34Gen}"); - fhMu34Gen->SetYTitle("#frac{dN}{d#mu_{34Gen}}"); - fList->Add(fhMu34Gen); - - fhMu45Gen = new TH1F("Mu45Gen", "", 20,0,0.65); - fhMu45Gen->Sumw2(); - fhMu45Gen->SetXTitle("#mu_{45Gen}"); - fhMu45Gen->SetYTitle("#frac{dN}{d#mu_{45}}"); - fList->Add(fhMu45Gen); - - fhInOut = new TH1I("InOut", "", 6, 0, 6); - fhInOut->SetXTitle("#RecJets_{GenJets=3}"); - fhInOut->SetYTitle("#Entries"); - fList->Add(fhInOut); - - fhThrustGen2 = new TH1F("ThrustGen2", "", 50, 0.5, 1); - fhThrustGen2->Sumw2(); - fList->Add(fhThrustGen2); - - fhThrustGen3 = new TH1F("ThrustGen3", "", 50, 0.5, 1); - fhThrustGen3->Sumw2(); - fList->Add(fhThrustGen3); - - fhThrustRec2 = new TH1F("ThrustRec2", "", 50, 0.5, 1); - fhThrustRec2->Sumw2(); - fList->Add(fhThrustRec2); - - fhThrustRec3 = new TH1F("ThrustRec3", "", 50, 0.5, 1); - fhThrustRec3->Sumw2(); - fList->Add(fhThrustRec3); - - fhCGen2 = new TH1F("CGen2", "", 100, 0, 1); - fhCGen2->Sumw2(); - fList->Add(fhCGen2); - - fhCGen3 = new TH1F("CGen3", "", 100, 0, 1); - fhCGen3->Sumw2(); - fList->Add(fhCGen3); - - fhCRec2 = new TH1F("CRec2", "", 100, 0, 1); - fhCRec2->Sumw2(); - fList->Add(fhCRec2); - - fhCRec3 = new TH1F("CRec3", "", 100, 0, 1); - fhCRec3->Sumw2(); - fList->Add(fhCRec3); - - fhSGen2 = new TH1F("SGen2", "", 100, 0, 1); - fList->Add(fhSGen2); - - fhSGen3 = new TH1F("SGen3", "", 100, 0, 1); - fList->Add(fhSGen3); - - fhSRec2 = new TH1F("SRec2", "", 100, 0, 1); - fList->Add(fhSRec2); - - fhSRec3 = new TH1F("SRec3", "", 100, 0, 1); - fList->Add(fhSRec3); - - fhAGen2 = new TH1F("AGen2", "", 50, 0, 0.5); - fList->Add(fhAGen2); - - fhAGen3 = new TH1F("AGen3", "", 50, 0, 0.5); - fList->Add(fhAGen3); - - fhARec2 = new TH1F("ARec2", "", 50, 0, 0.5); - fList->Add(fhARec2); - - fhARec3 = new TH1F("ARec3", "", 50, 0, 0.5); - fList->Add(fhARec3); - - fhX3 = new TH2F("X3", "", 22, 0.6, 1.02, 100, 0, 1); - fhX3->SetYTitle("|X_{3}^{MC} - X_{3}^{AOD}|/X_{3}^{MC}"); - fhX3->SetXTitle("X_{3}"); - fhX3->Sumw2(); - fList->Add(fhX3); - - fhX4 = new TH2F("X4", "",33, 0.4, 1.02, 100, 0, 1); - fhX4->SetYTitle("|X_{4}^{MC} - X_{4}^{AOD}|/X_{4}^{MC}"); - fhX4->SetXTitle("X_{4}"); - fhX4->Sumw2(); - fList->Add(fhX4); - - fhX5 = new TH2F("X5", "",100, 0., 1., 100, 0, 1); - fhX5->SetYTitle("|X_{5}^{MC} - X_{5}^{AOD}|/X_{5}^{MC}"); - fhX5->SetXTitle("X_{5}"); - fhX5->Sumw2(); - fList->Add(fhX5); - - fhXSec = new TProfile("XSec", "", 200, 0, 200, 0, 1); - fList->Add(fhXSec); - - fhX3X4Rec60 = new TH2F("X3vsX4Rec60", "", 22, 0.6, 1.02, 33, 0.4, 1.02); - fhX3X4Rec60->SetXTitle("X_{3}"); - fhX3X4Rec60->SetYTitle("X_{4}"); - fhX3X4Rec60->Sumw2(); - fList->Add(fhX3X4Rec60); - - fhX3X4Rec60100 = new TH2F("X3vsX4Rec60100", "", 22, 0.6, 1.02, 33, 0.4, 1.02); - fhX3X4Rec60100->SetXTitle("X_{3}"); - fhX3X4Rec60100->SetYTitle("X_{4}"); - fhX3X4Rec60100->Sumw2(); - fList->Add(fhX3X4Rec60100); - - fhX3X4Rec100 = new TH2F("X3vsX4Rec100", "", 22, 0.6, 1.02, 33, 0.4, 1.02); - fhX3X4Rec100->SetXTitle("X_{3}"); - fhX3X4Rec100->SetYTitle("X_{4}"); - fhX3X4Rec100->Sumw2(); - fList->Add(fhX3X4Rec100); - - fhX3X4Gen60 = new TH2F("X3vsX4Gen60", "", 22, 0.6, 1.02, 33, 0.4, 1.02); - fhX3X4Gen60->SetXTitle("X_{3}"); - fhX3X4Gen60->SetYTitle("X_{4}"); - fhX3X4Gen60->Sumw2(); - fList->Add(fhX3X4Gen60); - - fhX3X4Gen60100 = new TH2F("X3vsX4Gen60100", "", 22, 0.6, 1.02, 33, 0.4, 1.02); - fhX3X4Gen60100->SetXTitle("X_{3}"); - fhX3X4Gen60100->SetYTitle("X_{4}"); - fhX3X4Gen60100->Sumw2(); - fList->Add(fhX3X4Gen60100); - - fhX3X4Gen100 = new TH2F("X3vsX4Gen100", "", 22, 0.6, 1.02, 33, 0.4, 1.02); - fhX3X4Gen100->SetXTitle("X_{3}"); - fhX3X4Gen100->SetYTitle("X_{4}"); - fhX3X4Gen100->Sumw2(); - fList->Add(fhX3X4Gen100); - - fhdPhiThrustGen = new TH2F("dPhiThrustGen", "", 32, -1*TMath::Pi(), TMath::Pi(), 25, 0, 150); - fhdPhiThrustGen->Sumw2(); - fList->Add(fhdPhiThrustGen); - - fhdPhiThrustGenALL = new TH2F("dPhiThrustGenALL", "", 32, -1*TMath::Pi(), TMath::Pi(), 25, 0, 150); - fhdPhiThrustGenALL->Sumw2(); - fList->Add(fhdPhiThrustGenALL); - - fhdPhiThrustRec = new TH2F("dPhiThrustRec", "", 32, -1*TMath::Pi(), TMath::Pi(), 25, 0, 150); - fhdPhiThrustRec->Sumw2(); - fList->Add(fhdPhiThrustRec); - - fhdPhiThrustRecALL = new TH2F("dPhiThrustRecALL", "", 32, -1*TMath::Pi(), TMath::Pi(), 25, 0, 150); - fhdPhiThrustRecALL->Sumw2(); - fList->Add(fhdPhiThrustRecALL); - - if(fDebug)Printf("UserCreateOutputObjects finished\n"); -} - -//__________________________________________________________________________________________________________________________________________ -void AliAnalysisTaskThreeJets::Init() -{ - printf("AliAnalysisJetCut::Init() \n"); -} - -//____________________________________________________________________________________________________________________________________________ -void AliAnalysisTaskThreeJets::UserExec(Option_t * ) -{ - if (fDebug > 1) printf("AliAnlysisTaskThreeJets::Analysing event # %5d\n", (Int_t) fEntry); - - if(fUseAODInput){ - fAOD = dynamic_cast(InputEvent()); - if(!fAOD){ - Printf("%s:%d AODEvent not found in Input Manager %d",(char*)__FILE__,__LINE__,fUseAODInput); - return; - } - } - else{ - // assume that the AOD is in the general output... - fAOD = AODEvent(); - if(!fAOD){ - Printf("%s:%d AODEvent not found in the Output",(char*)__FILE__,__LINE__); - return; - } - } - -// AliMCEvent* mcEvent =MCEvent(); -// if(!mcEvent){ -// Printf("%s:%d no mcEvent",(char*)__FILE__,__LINE__); -// return; -// } - - if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__); - - //primary vertex - AliAODVertex * pvtx = dynamic_cast(fAOD->GetPrimaryVertex()); - if(!pvtx){ - //return #1 - fhStopHisto->Fill(0.5); - PostData(1, fList); - return; - } - -// AliAODJet genJetsPythia[kMaxJets]; -// Int_t nPythiaGenJets = 0; - - AliAODJet recJets[kMaxJets]; - Int_t nRecJets = 0; - - //array of reconstructed jets from the AOD input - TClonesArray *aodRecJets = dynamic_cast(fAOD->FindListObject(fBranchRec.Data())); - if(!aodRecJets){ - //return #2 - fhStopHisto->Fill(1.5); - PostData(1, fList); - return; - } - - // reconstructed jets - nRecJets = aodRecJets->GetEntries(); - if(fDebug)Printf("--- Jets found in bRec: %d", nRecJets); - nRecJets = TMath::Min(nRecJets, kMaxJets); - - for(int ir = 0;ir < nRecJets;++ir) - { - AliAODJet *tmp = dynamic_cast(aodRecJets->At(ir)); - if(!tmp)continue; - recJets[ir] = *tmp; - } - - AliAODJet genJets[kMaxJets]; - Int_t nGenJets = 0; - if(fUseMC){ - // If we set a second branch for the input jets fetch this - TClonesArray * aodGenJets = dynamic_cast(fAOD->FindListObject(fBranchGen.Data())); - - if(!aodGenJets) - { - printf("NO MC jets Found\n"); - //return #3 - fhStopHisto->Fill(2.5); - PostData(1, fList); - return; - } - - // //Generated jets - nGenJets = aodGenJets->GetEntries(); - nGenJets = TMath::Min(nGenJets, kMaxJets); - - for(Int_t ig =0 ; ig < nGenJets; ++ig) - { - AliAODJet * tmp = dynamic_cast(aodGenJets->At(ig)); - if(!tmp)continue; - genJets[ig] = * tmp; - } - } - // AliGenPythiaEventHeader* pythiaGenHeader = AliAnalysisHelperJetTasks::GetPythiaEventHeader(mcEvent); -// if(!pythiaGenHeader){ -// Printf("!!!NO GEN HEADER AVALABLE!!!"); -// return; -// } - -// // Int_t ProcessType = pythiaGenHeader->ProcessType(); -// // if(ProcessType != 28) return; -// nPythiaGenJets = pythiaGenHeader->NTriggerJets(); -// nPythiaGenJets = TMath::Min(nPythiaGenJets, kMaxJets); - -// fXsection = 1; - - Double_t eRec[kMaxJets]; - Double_t eGen[kMaxJets]; - - Double_t eJetRec[kMaxJets]; - // Double_t EJetGen[kMaxJets]; - - AliAODJet jetRec[kMaxJets]; - AliAODJet jetGen[kMaxJets]; - - Int_t idxRec[kMaxJets]; - Int_t idxGen[kMaxJets]; - - Double_t xRec[kMaxJets]; - Double_t xGen[kMaxJets]; - - Double_t eSumRec = 0; - Double_t eSumGen = 0; - - TLorentzVector vRec[kMaxJets]; - TLorentzVector vRestRec[kMaxJets]; - - TLorentzVector vGen[kMaxJets]; - TLorentzVector vRestGen[kMaxJets]; - - TLorentzVector vsumRec; - TLorentzVector vsumGen; - - TVector3 pRec[kMaxJets]; - TVector3 pGen[kMaxJets]; - - TVector3 pTrack[kTracks]; - - TVector3 pRestRec[kMaxJets]; - TVector3 pRestGen[kMaxJets]; - - Double_t psumRestRec = 0; - // Double_t psumRestGen = 0; -// //Pythia_________________________________________________________________________________________________________________ - -// for(int ip = 0;ip < nPythiaGenJets;++ip) -// { -// if(ip>=kMaxJets)continue; -// Float_t p[4]; -// pythiaGenHeader->TriggerJet(ip,p); -// genJetsPythia[ip].SetPxPyPzE(p[0],p[1],p[2],p[3]); -// } - -//_________________________________________________________________________________________________________________________ - - -//________histos for MC___________________________________________________________________________________________________________ - Int_t nGenSel = 0; - if(fUseMC){ - Int_t counter = 0; - Int_t tag = 0; - - AliAODJet selJets[kMaxJets]; - - for(Int_t i = 0; i < nGenJets; i++) - { - if(nGenJets == 1) - { - selJets[nGenSel] = genJets[i]; - nGenSel++; - } - else - { - counter = 0; - tag = 0; - for(Int_t j = 0; j < nGenJets; j++) - { - if(i!=j) - { - Double_t dRij = genJets[i].DeltaR(&genJets[j]); - counter++; - if(dRij > 2*fR) tag++; - } - } - if(counter!=0) - { - if(tag/counter == 1) - { - selJets[nGenSel] = genJets[i]; - nGenSel++; - } - } - } - } - - if(nGenSel == 0){ - //return #4 - fhStopHisto->Fill(3.5); - PostData(1, fList); - return; - } - - for (Int_t gj = 0; gj < nGenSel; gj++) - { - eGen[gj] = selJets[gj].E(); - } - - TMath::Sort(nGenSel, eGen, idxGen); - for (Int_t ig = 0; ig < nGenSel; ig++) - { - jetGen[ig] = selJets[idxGen[ig]]; - } - - fhXSec->Fill(jetGen[0].Pt(), fXsection); - // AliStack * stack = mcEvent->Stack(); - - Int_t nMCtracks = 0; - Double_t eTracksMC[kTracks]; - Double_t pTracksMC[kTracks]; - Int_t idxTracksMC[kTracks]; - TLorentzVector jetTracksMC[kTracks]; - TLorentzVector jetTracksSortMC[kTracks]; - TVector3 pTrackMC[kTracks]; - TLorentzVector vTrackMCAll[kTracks]; - Double_t pTrackMCAll[kTracks]; - TLorentzVector vTrackMC[kTracks]; - TVector3 pTrackMCBoost[kTracks]; - Double_t eventShapes[4] = {0,}; - - Int_t nAccTr = 0; - Int_t nInJet[kMaxJets]; - TLorentzVector inJetPartV[kMaxJets][kTracks]; - Int_t nAllTracksMC = 0; - TVector3 n01MC; - - TClonesArray *tca = dynamic_cast(fAOD->FindListObject(AliAODMCParticle::StdBranchName())); - if(!tca){ - if(fDebug)Printf("NO Ref Tracks\n"); - tca = 0; - } - else{ - nMCtracks = tca->GetEntries(); - for(Int_t iTrack = 0; iTrack < nMCtracks; iTrack++) - { - // TParticle * part = (TParticle*)stack->Particle(iTrack); - AliAODMCParticle *part = dynamic_cast(tca->At(iTrack)); - if (!part) continue; - if(!part->IsPhysicalPrimary())continue; - Double_t fEta = part->Eta(); - if(TMath::Abs(fEta) > .9) continue; - vTrackMCAll[nAllTracksMC].SetPxPyPzE(part->Px(), part->Py(), part->Pz(), part->E()); - pTrackMCAll[nAllTracksMC] = part->Pt(); - nAllTracksMC++; - } - if(nAllTracksMC == 0){ - //return #5 - fhStopHisto->Fill(4.5); - PostData(1, fList); - return; - } - - for(Int_t iJet = 0; iJet < nGenSel; iJet++) - { - Int_t nJetTracks = 0; - for(Int_t i = 0; i < nAllTracksMC; i++) - { - Double_t dPhi = (jetGen[iJet].Phi()-vTrackMCAll[i].Phi()); - if(dPhi > TMath::Pi()) dPhi = dPhi - 2.*TMath::Pi(); - if(dPhi < (-1.*TMath::Pi())) dPhi = dPhi + 2.*TMath::Pi(); - Double_t dEta = (jetGen[iJet].Eta()-vTrackMCAll[i].Eta()); - Double_t deltaR = TMath::Sqrt(dPhi*dPhi+dEta*dEta); - if(deltaR < fR && vTrackMCAll[i].Pt() > 1.5) - { - jetTracksMC[nAccTr] = vTrackMCAll[i]; - eTracksMC[nAccTr] = vTrackMCAll[i].E(); - pTracksMC[nAccTr] = vTrackMCAll[i].Pt(); - inJetPartV[iJet][nJetTracks].SetPxPyPzE(vTrackMCAll[i].Px(), vTrackMCAll[i].Py(), vTrackMCAll[i].Pz(),vTrackMCAll[i].E()); - nAccTr++; - nJetTracks++; - } - } - nInJet[iJet] = nJetTracks; - } - - if(nAccTr == 0){ - //return #6 - fhStopHisto->Fill(5.5); - PostData(1, fList); - return; - } - // if(fDebug)Printf("*********** Number of Jets : %d ***************\n", nGenSel); - Double_t pTav[kMaxJets]; - for(Int_t i = 0; i < nGenSel; i++) - { - Double_t pTsum = 0; - // if(fDebug)Printf("*********** Number of particles in Jet %d = %d *******************\n", i+3, nInJet[i]); - for(Int_t iT = 0; iT < nInJet[i]; iT++) - { - Double_t pt = inJetPartV[i][iT].Pt(); - pTsum += pt; - } - pTav[i] = pTsum/nInJet[i]; - } - - TMath::Sort(nAllTracksMC, pTrackMCAll, idxTracksMC); - for(Int_t i = 0; i < nAllTracksMC; i++) - { - jetTracksSortMC[i] = vTrackMCAll[idxTracksMC[i]]; - pTrackMC[i].SetXYZ(jetTracksSortMC[i].Px(), jetTracksSortMC[i].Py(), jetTracksSortMC[i].Pz()); - vTrackMC[i].SetPxPyPzE(jetTracksSortMC[i].Px(), jetTracksSortMC[i].Py(), jetTracksSortMC[i].Pz(), jetTracksSortMC[i].E()); - } - - n01MC = pTrackMC[0].Unit(); - n01MC.SetZ(0.); - - //Thrust calculation, iterative method - if(nGenSel > 1) - { - // if(fGlobVar == 1) - // { - if(fDebug)Printf("**************Shapes for MC*************"); - AliAnalysisHelperJetTasks::GetEventShapes(n01MC, pTrackMC, nAllTracksMC, eventShapes); - // } - if(eventShapes[0] < 2/TMath::Pi()){ - Double_t eventShapesTest[4] = {0,}; - TVector3 n01Test; - Int_t rnd_max = nAllTracksMC; - Int_t k = (Int_t)(gRandom->Rndm()*rnd_max)+3; - while(TMath::Abs(pTrackMC[k].X()) < 10e-5 && TMath::Abs(pTrackMC[k].Y()) < 10e-5){ - k--; - } - n01Test = pTrackMC[k].Unit(); - n01Test.SetZ(0.); - AliAnalysisHelperJetTasks::GetEventShapes(n01Test, pTrackMC, nAllTracksMC, eventShapesTest); - eventShapes[0] = TMath::Max(eventShapes[0], eventShapesTest[0]); - if(TMath::Abs(eventShapes[0]-eventShapesTest[0]) < 10e-7) n01MC = n01Test; - } - - Double_t s = eventShapes[1]; - Double_t a = eventShapes[2]; - Double_t c = eventShapes[3]; - - switch(nGenSel) - { - case 2: - { - fhAGen2->Fill(a); - fhSGen2->Fill(s); - fhCGen2->Fill(c); - } - break; - case 3: - { - fhAGen3->Fill(a); - fhSGen3->Fill(s); - fhCGen3->Fill(c); - } - break; - } - Double_t thrust01MC = eventShapes[0]; - - switch(nGenSel) - { - case 2: - fhThrustGen2->Fill(thrust01MC, fXsection); - break; - case 3: - fhThrustGen3->Fill(thrust01MC, fXsection); - break; - } - } - } - - - //rest frame MC jets - for (Int_t i = 0; i < nGenSel; ++i) - { - vGen[i].SetPxPyPzE(jetGen[i].Px(), jetGen[i].Py(), jetGen[i].Pz(), jetGen[i].E()); - pGen[i].SetXYZ(vGen[i].Px(), vGen[i].Py(), vGen[i].Pz()); - vsumGen += vGen[i]; - } - if(tca){ - if(eventShapes[0] > 0.8 && nGenSel > 1) - { - for(Int_t i = 0; i < nGenSel; i++) - fhdPhiThrustGen->Fill(n01MC.DeltaPhi(pGen[i]), jetGen[i].E()); - } - - if(eventShapes[0] <= 0.8 && nGenSel > 1) - { - for(Int_t i = 0; i < nGenSel; i++) - fhdPhiThrustGenALL->Fill(n01MC.DeltaPhi(pGen[i]), jetGen[i].E()); - } - } - - Double_t fPxGen = vsumGen.Px(); - Double_t fPyGen = vsumGen.Py(); - Double_t fPzGen = vsumGen.Pz(); - Double_t fEGen = vsumGen.E(); - - Double_t eRestGen[kMaxJets]; - for (Int_t j = 0; j < nGenSel; j++) - { - vGen[j].Boost(-fPxGen/fEGen, -fPyGen/fEGen, -fPzGen/fEGen); - eRestGen[j] = vGen[j].E(); - } - - for (Int_t j = 0; j < nAccTr; j++) - { - vTrackMC[j].Boost(-fPxGen/fEGen, -fPyGen/fEGen, -fPzGen/fEGen); - pTrackMCBoost[j].SetXYZ(vTrackMC[j].Px(),vTrackMC[j].Py(),vTrackMC[j].Pz()); - } - - Int_t idxRestGen[kMaxJets]; - TMath::Sort(nGenSel, eRestGen, idxRestGen); - for(Int_t j = 0; j < nGenSel; j++) - { - vRestGen[j] = vGen[idxRestGen[j]]; - eSumGen += vRestGen[j].E(); - } - - if (nGenSel == 3) - { - // if(nInJet[0] < 3 || nInJet[1] < 3 || nInJet[2] < 3) return; - // if(pRestGen[1].DeltaPhi(pRestGen[2]) > 0.95 && pRestGen[1].DeltaPhi(pRestGen[2]) < 1.15) - // { - - for(Int_t i = 0; i < nGenSel; i++) - { - xGen[i] = 2*vRestGen[i].E()/eSumGen; - } - - if(fDebug)Printf("***************** Values of Dalitz variables are : %f, %f, %f ****************\n", xGen[0], xGen[1], xGen[2]); - - if(fDebug)Printf("***************** fXSection = %f ******************\n", fXsection); - if(eSumGen <= 60) - fhX3X4Gen60->Fill(xGen[0], xGen[1], fXsection); - - if(eSumGen > 60 && eSumGen <= 100) - fhX3X4Gen60100->Fill(xGen[0], xGen[1], fXsection); - - if(eSumGen > 100) - fhX3X4Gen100->Fill(xGen[0], xGen[1], fXsection); - - FillTopology(fhX3X4Gen, fhMu34Gen, fhMu45Gen, fhMu35Gen, xGen, pRestGen, fXsection); - } - } - - - -//_______________________________________________histos for MC_____________________________________________________ - - -//_______________________________________________histos AOD________________________________________________________ - -// Printf("Event Number : %d, Number of gen jets : %d ", fEntry, nGenJets); - - Int_t nRecSel = 0; - Int_t counter1 = 0; - Int_t tag1 = 0; - - AliAODJet recSelJets[kMaxJets]; - if(fDebug)Printf("---- Number of reco jets: %d\n",nRecJets); - for(Int_t i = 0; i < nRecJets; i++) - { - if(nRecJets == 1) - { - recSelJets[nRecSel] = recJets[i]; - nRecSel++; - } - else - { - counter1 = 0; - tag1 = 0; - for(Int_t j = 0; j < nRecJets; j++) - { - if(i!=j) - { - Double_t dRij = recJets[i].DeltaR(&recJets[j]); - counter1++; - if(dRij > 2*fR) tag1++; - } - } - if(counter1!=0) - { - if(tag1/counter1 == 1) - { - recSelJets[nRecSel] = recJets[i]; - nRecSel++; - } - } - } - } - - if(nRecSel == 0) - { - //return #7 - fhStopHisto->Fill(6.5); - PostData(1, fList); - return; - } - - //sort rec/gen jets by energy in C.M.S - for (Int_t rj = 0; rj < nRecSel; rj++) - { - eRec[rj] = recSelJets[rj].E(); - } - - Int_t nAODtracks = fAOD->GetNumberOfTracks(); - Int_t nTracks = 0; //tracks accepted in the whole event - Int_t nTracksALL = 0; - TLorentzVector jetTracks[kTracks]; - TLorentzVector jetTracksSort[kTracks]; - Double_t * eTracks = new Double_t[kTracks]; - Double_t pTracks[kTracks]; - Int_t * idxTracks = new Int_t[kTracks]; - Double_t eventShapesRec[4] = {0,}; - Int_t jetMult[kMaxJets]; - // TLorentzVector vTracksAll[kTracks]; - // Double_t pTracksAll[kTracks]; - Int_t nAccJets = 0; - AliAODJet jetRecAcc[kMaxJets]; - Int_t nJetTracks = 0; - - AliAODTrack jetTrack[kTracks]; - Double_t cv[21]; - TMath::Sort(nRecSel, eRec, idxRec); - for (Int_t rj = 0; rj < nRecSel; rj++) - { - nJetTracks = 0; - eJetRec[rj] = eRec[idxRec[rj]]; - jetRec[rj] = recSelJets[idxRec[rj]]; - TRefArray * jetTracksAOD = dynamic_cast(jetRec[rj].GetRefTracks()); - if(!jetTracksAOD) continue; - if(jetTracksAOD->GetEntries() < 3) continue; - for(Int_t i = 0; i < jetTracksAOD->GetEntries(); i++) - { - AliAODTrack * track = (AliAODTrack*)jetTracksAOD->At(i); - track->GetCovarianceXYZPxPyPz(cv); - if(cv[14] > 1000.) continue; - // jetTrack[nTracks] = *track; - // jetTracks[nTracks].SetPxPyPzE(jetTrack[nTracks].Px(), jetTrack[nTracks].Py(), jetTrack[nTracks].Pz(), jetTrack[nTracks].E()); - // eTracks[nTracks] = jetTracks[nTracks].E(); - // pTracks[nTracks] = jetTracks[nTracks].Pt(); - nTracks++; - nJetTracks++; - } - if(nJetTracks < 3) continue; - jetRecAcc[nAccJets] = jetRec[rj]; - jetMult[nAccJets] = jetTracksAOD->GetEntries(); - nAccJets++; - } - - if (nAccJets == 0){ - //return #8 - fhStopHisto->Fill(7.5); - PostData(1, fList); - return; - } - - for(Int_t i = 0; i < nAODtracks; i++) - { - AliAODTrack * track = dynamic_cast(fAOD->GetTrack(i)); - if(!track) continue; - track->GetCovarianceXYZPxPyPz(cv); - if(cv[14] > 1000.) continue; - jetTrack[nTracksALL] = *track; - jetTracks[nTracksALL].SetPxPyPzE(jetTrack[nTracksALL].Px(), jetTrack[nTracksALL].Py(), jetTrack[nTracksALL].Pz(), jetTrack[nTracksALL].E()); - eTracks[nTracksALL] = jetTracks[nTracksALL].E(); - pTracks[nTracksALL] = jetTracks[nTracksALL].Pt(); - nTracksALL++; - } - - - TLorentzVector vTrack[kTracks]; - TMath::Sort(nTracksALL, pTracks, idxTracks); - for(Int_t i = 0; i < nTracksALL; i++) - { - jetTracksSort[i] = jetTracks[idxTracks[i]]; - pTrack[i].SetXYZ(jetTracksSort[i].Px(), jetTracksSort[i].Py(), jetTracksSort[i].Pz()); - vTrack[i].SetPxPyPzE(jetTracksSort[i].Px(), jetTracksSort[i].Py(), jetTracksSort[i].Pz(), jetTracksSort[i].E()); - } - - for (Int_t i = 0; i < nAccJets; ++i) - { - vRec[i].SetPxPyPzE(jetRecAcc[i].Px(), jetRecAcc[i].Py(), jetRecAcc[i].Pz(), jetRecAcc[i].E()); - pRec[i].SetXYZ(vRec[i].Px(), vRec[i].Py(), vRec[i].Pz()); - vsumRec += vRec[i]; - } - - //Thrust, iterative method, AODs - TVector3 n01 = pTrack[0].Unit(); - n01.SetZ(0.); - if(nAccJets > 1) - { -// if(fGlobVar == 1) -// { - if(fDebug)Printf("*********Shapes for AOD********"); - AliAnalysisHelperJetTasks::GetEventShapes(n01, pTrack, nTracksALL, eventShapesRec); - // } - if(eventShapesRec[0] < 2/TMath::Pi()){ - Double_t eventShapesTest[4] = {0,}; - TVector3 n01Test; - Int_t rnd_max = nTracksALL; - Int_t k = (Int_t)(gRandom->Rndm()*rnd_max)+3; - while(TMath::Abs(pTrack[k].X()) < 10e-5 && TMath::Abs(pTrack[k].Y()) < 10e-5){ - k--; - } - - n01Test = pTrack[k].Unit(); - n01Test.SetZ(0.); - AliAnalysisHelperJetTasks::GetEventShapes(n01Test, pTrack, nTracksALL, eventShapesTest); - eventShapesRec[0] = TMath::Max(eventShapesRec[0], eventShapesTest[0]); - if(TMath::Abs(eventShapesRec[0]-eventShapesTest[0]) < 10e-7) n01 = n01Test; - } - - - // fGlobVar = 0; - // Double_t Max3 = TMath::Max(eventShapesRec0[0],eventShapesRec1[0]); - // Double_t Max4 = TMath::Max(eventShapesRec3[0],eventShapesRec2[0]); - - Double_t thrust = eventShapesRec[0]; - - if(eventShapesRec[0] > 0.8) - { - for(Int_t i = 0; i < nAccJets; i++) - fhdPhiThrustRec->Fill(n01.DeltaPhi(pRec[i]), jetRecAcc[i].E()); - - } - - if(eventShapesRec[0] <= 0.8) - { - for(Int_t i = 0; i < nAccJets; i++) - fhdPhiThrustRecALL->Fill(n01.DeltaPhi(pRec[i]), jetRecAcc[i].E()); - } - - switch(nAccJets) - { - case 2: - fhThrustRec2->Fill(thrust, fXsection); - break; - case 3: - fhThrustRec3->Fill(thrust, fXsection); - break; - } - - switch(nAccJets) - { - case 2: - { - fhARec2->Fill(eventShapesRec[2], fXsection); - fhSRec2->Fill(eventShapesRec[1], fXsection); - fhCRec2->Fill(eventShapesRec[3], fXsection); - } - break; - case 3: - { - fhARec3->Fill(eventShapesRec[2], fXsection); - fhSRec3->Fill(eventShapesRec[1], fXsection); - fhCRec3->Fill(eventShapesRec[3], fXsection); - } - break; - } - } - - //rest frame for reconstructed jets - Double_t fPx = vsumRec.Px(); - Double_t fPy = vsumRec.Py(); - Double_t fPz = vsumRec.Pz(); - Double_t fE = vsumRec.E(); - - TVector3 pTrackRest[kTracks]; - for(Int_t j = 0; j < nTracks; j++) - { - vTrack[j].Boost(-fPx/fE, -fPy/fE, -fPz/fE); - pTrackRest[j].SetXYZ(vTrack[j].Px(), vTrack[j].Py(),vTrack[j].Pz()); - } - - Double_t eRestRec[kMaxJets]; - Int_t idxRestRec[kMaxJets]; - for (Int_t j = 0; j < nAccJets; j++) - { - vRec[j].Boost(-fPx/fE, -fPy/fE, -fPz/fE); - eRestRec[j] = vRec[j].E(); - eSumRec += vRec[j].E(); - } - - TMath::Sort(nAccJets, eRestRec, idxRestRec); - for (Int_t i = 0; i < nAccJets; i++) - { - vRestRec[i] = vRec[idxRestRec[i]]; - pRestRec[i].SetXYZ(vRestRec[i].Px(), vRestRec[i].Py(), vRestRec[i].Pz()); - psumRestRec += pRestRec[i].Perp(); - } - - if(nAccJets == 3) - { -// if(pRest[1].DeltaPhi(pRest[2]) > 0.95 && pRest[1].DeltaPhi(pRest[2]) < 1.15) -// { - if(fUseMC) fhInOut->Fill(nGenSel); -// for(Int_t j = 0; j < nTracksALL; j++) -// { -// vTracksAll[j].Boost(-fPx/fE, -fPy/fE, -fPz/fE); -// pTracksAll[j].SetXYZ(vTracksAll[j].Px(), vTracksAll[j].Py(),vTracksAll[j].Pz()); -// fhdPhiRec->Fill(pRest[0].DeltaPhi(pTracksAll[j]), pTracksAll[j].Perp(), fXsection); -// } - //and the Dalitz variables and Energy distributions in the rest frame - for (Int_t i = 0; i < nAccJets; i++) - xRec[i] = 2*vRestRec[i].E()/eSumRec; - - if(eSumRec <= 60) - fhX3X4Rec60->Fill(xRec[0], xRec[1], fXsection); - - if(eSumRec > 60 && eSumRec <= 100) - fhX3X4Rec60100->Fill(xRec[0], xRec[1], fXsection); - - if(eSumRec > 100) - fhX3X4Rec100->Fill(xRec[0], xRec[1], fXsection); - - if(nAccJets == 3 && nAccJets == nGenJets) - { - fhX3->Fill(xGen[0], TMath::Abs(xGen[0]-xRec[0])/xGen[0], fXsection); - fhX4->Fill(xGen[1], TMath::Abs(xGen[1]-xRec[1])/xGen[1], fXsection); - fhX5->Fill(xGen[2], TMath::Abs(xGen[2]-xRec[2])/xGen[2], fXsection); - } - - FillTopology(fhX3X4Rec, fhMu34Rec, fhMu45Rec, fhMu35Rec, xRec, pRestRec, fXsection); - } - if(fDebug)Printf("%s:%d",(char*)__FILE__,__LINE__); - - PostData(1, fList); - - if(fDebug)Printf("%s:%d Data Posted",(char*)__FILE__,__LINE__); - -} - -//__________________________________________________________________________________________________________________________________________________ -void AliAnalysisTaskThreeJets::Terminate(Option_t *) -{ - if(fDebug)printf(" AliAnalysisTaskThreeJets::Terminate()"); - -} - -//_______________________________________User defined functions_____________________________________________________________________________________ -void AliAnalysisTaskThreeJets::FillTopology(TH2F * Dalitz, TH1F * fhMu34, TH1F * fhMu45, TH1F * fhMu35, Double_t * x, TVector3 * pRest, Double_t xsection) -{ - // - // fill the topology histos - // - Dalitz->Fill(x[0], x[1], xsection); - fhMu35->Fill(TMath::Sqrt(x[0]*x[2]*(1-(pRest[0].Unit()).Dot(pRest[2].Unit()))/2), xsection); - fhMu34->Fill(TMath::Sqrt(x[0]*x[1]*(1-(pRest[0].Unit()).Dot(pRest[1].Unit()))/2), xsection); - fhMu45->Fill(TMath::Sqrt(x[1]*x[2]*(1-(pRest[1].Unit()).Dot(pRest[2].Unit()))/2), xsection); -} - -//_____________________________________________________________________________________________________________________________ - -Bool_t AliAnalysisTaskThreeJets::IsPrimChar(TParticle* aParticle, Int_t aTotalPrimaries, Bool_t adebug) -{ - // - // this function checks if a particle from the event generator (i.e. among the nPrim particles in the stack) - // shall be counted as a primary particle - // - // This function or a equivalent should be available in some common place of AliRoot - // - // WARNING: Call this function only for particles that are among the particles from the event generator! - // --> stack->Particle(id) with id < stack->GetNprimary() - - // if the particle has a daughter primary, we do not want to count it - if (aParticle->GetFirstDaughter() != -1 && aParticle->GetFirstDaughter() < aTotalPrimaries) - { - if (adebug) - printf("Dropping particle because it has a daughter among the primaries.\n"); - return kFALSE; - } - - Int_t pdgCode = TMath::Abs(aParticle->GetPdgCode()); - - - // skip quarks and gluon - if (pdgCode <= 10 || pdgCode == 21) - { - if (adebug) - printf("Dropping particle because it is a quark or gluon.\n"); - return kFALSE; - } - - Int_t status = aParticle->GetStatusCode(); - // skip non final state particles.. - if(status!=1){ - if (adebug) - printf("Dropping particle because it is not a final state particle.\n"); - return kFALSE; - } - - if (strcmp(aParticle->GetName(),"XXX") == 0) - { - Printf("WARNING: There is a particle named XXX (pdg code %d).", pdgCode); - return kFALSE; - } - - TParticlePDG* pdgPart = aParticle->GetPDG(); - - if (strcmp(pdgPart->ParticleClass(),"Unknown") == 0) - { - Printf("WARNING: There is a particle with an unknown particle class (pdg code %d).", pdgCode); - return kFALSE; - } - - if (pdgPart->Charge() == 0) - { - if (adebug) - printf("Dropping particle because it is not charged.\n"); - return kTRUE; - } - - return kTRUE; -} - -//______________________________________________________________________________________________________ - - -//__________________________________________________________________________________________________________________________ - -Double_t AliAnalysisTaskThreeJets::Exponent(Double_t x,const Double_t * const par) const -{ - return par[0]*TMath::Power(1/TMath::E(), TMath::Power(par[1]/x, par[2])+0.5*TMath::Power((x-par[3])/par[0], 2))+par[4]*x; -} - -Double_t AliAnalysisTaskThreeJets::Exponent2(Double_t x,const Double_t * const par) const -{ - return par[0]*TMath::Power(1/TMath::E(), TMath::Power(par[1]/x, par[2]))+par[3]*x; -} - -Double_t AliAnalysisTaskThreeJets::Gauss(Double_t x,const Double_t * const par) const -{ - return 1/(par[1])*TMath::Power(1/TMath::E(), 0.5*(x-par[0])*(x-par[0])/(par[1]*par[1])); -} - -Double_t AliAnalysisTaskThreeJets::Total(Double_t x,const Double_t * const par) const -{ - return Exponent(x, par)+Gauss(x, &par[4]); -} - - diff --git a/PWGJE/AliAnalysisTaskThreeJets.h b/PWGJE/AliAnalysisTaskThreeJets.h deleted file mode 100644 index 798c6bfd5f6..00000000000 --- a/PWGJE/AliAnalysisTaskThreeJets.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef ALIANALYSISTASKTHREEJETS_H -#define ALIANALYSISTASKTHREEJETS_H - -#include "AliAnalysisTaskSE.h" - -// -// Task for three jet ana by sona -// - -//class AliJetHistos; -//class AliJetCorrHistos; -class AliJetFinder; -class AliESDEvent; -class AliAODEvent; -class AliAODJet; -class AliGenPythiaEventHeader; -class AliAODPid; - -class TList; -class TArrayD; -class TChain; -class TH1; -class TH2; -class TH1F; -class TH2F; -class TH2I; -class TH3D; -class TTree; -class TProfile; -class TLorentzVector; -class TVector3; -class TParticle; - -class AliAnalysisTaskThreeJets : public AliAnalysisTaskSE -{ - public: - AliAnalysisTaskThreeJets(); - AliAnalysisTaskThreeJets(const char * name); - virtual ~AliAnalysisTaskThreeJets() {;} - - //Implementation of interface methods - virtual Bool_t Notify(); - virtual void UserCreateOutputObjects(); - virtual void Init(); - virtual void LocalInit() { Init(); }; - virtual void UserExec(Option_t * option); - virtual void Terminate(Option_t * option); - - virtual void SetAODInput(Bool_t b){fUseAODInput = b;} - virtual void SetUseMC(Bool_t b){fUseMC = b;} - - virtual void SetBranchGen(const char* c){fBranchGen = c;} - virtual void SetBranchRec(const char* c){fBranchRec = c;} - - virtual void FillTopology(TH2F * Dalitz, TH1F * fhMu34, TH1F * fhMu45, TH1F * fhMu35, Double_t * x, TVector3 * pRest, Double_t xsection); - - virtual Double_t SetR(Double_t b){fR = b; return fR;} - virtual Bool_t IsPrimChar(TParticle* aParticle, Int_t aTotalPrimaries, Bool_t adebug); - - Double_t Exponent(Double_t x,const Double_t * const par) const; - Double_t Exponent2(Double_t x,const Double_t * const par) const; - Double_t Gauss(Double_t x,const Double_t * const par) const; - Double_t Total(Double_t x,const Double_t * const par) const; - - private: - AliAnalysisTaskThreeJets(const AliAnalysisTaskThreeJets&); - AliAnalysisTaskThreeJets& operator = (const AliAnalysisTaskThreeJets&); - - enum {kMaxJets = 6}; - enum {kMaxEvents = 10}; - enum {kJets = 3}; - enum {kTracks = 1000}; - - AliAODEvent *fAOD; // where we take the jets from can be input or output AOD - Bool_t fUseMC; //switch for using MC info - - TString fBranchRec; // AOD branch name for reconstructed - TString fBranchGen; // AOD brnach for genereated - - Bool_t fUseAODInput; // read the AOD from the input no from the output - - Double_t fR; // radius - TList * fList; // output list - - TH1I * fhStopHisto; //Histogram to check were the code returns - Int_t fGlobVar; // globvar - Double_t fXsection; // xsectio - -TH2F * fhX3X4Rec; // Dalitz variables, reconstructed - TH2F * fhX3X4Gen; // Dalitz variables, generated - - TH1F * fhMu35Rec; // scaled masses, 35, reconstructed - TH1F * fhMu34Rec; // scaled masses, 34, reconstructed - TH1F * fhMu45Rec; // scaled masses, 45, reconstructed - - TH1F * fhMu35Gen; // scaled masses, 35, generated - TH1F * fhMu34Gen; // scaled masses, 34, generated - TH1F * fhMu45Gen; // scaled masses, 45, generated - - TH1I * fhInOut; // number of gen. vs number of rec. - TH1F * fhThrustRec2; // thrust for reco 2-jet events - TH1F * fhThrustRec3; // thrust for reco 3-jet events - - TH1F * fhThrustGen2; // thrust for gen 2-jet events - TH1F * fhThrustGen3; // thrust for gen 3-jet events - - TH1F * fhCGen2; // C-variable for gen 2-jets - TH1F * fhCGen3; // C-variable for gen 3-jets - - TH1F * fhSGen2; // Sphericity for gen 2-jets - TH1F * fhSGen3; // Sphericity for gen 3-jets - - TH1F * fhAGen2; // A-variable for gen 2-jets -TH1F * fhAGen3; // A-variable for gen 3-jets - - TH1F * fhCRec2; // C-variable for reco 2-jets - TH1F * fhCRec3; // C-variable for reco 3-jets - - TH1F * fhSRec2; // Sphericity for reco 2-jets - TH1F * fhSRec3; // Sphericity for reco 3-jets - - TH1F * fhARec2; // A-variable for reco 2-jets - TH1F * fhARec3; // A-variable for reco 3-jets - - TH2F * fhX3; // dX3 vs X3 rec - TH2F * fhX4; // dX4 vs X4 rec - TH2F * fhX5; // dX5 vs X5 rec - - TProfile * fhXSec; // cross-section vs PtHard - TH2F * fhX3X4Rec60; // Dalitz plane for Esum < 60, reco - TH2F * fhX3X4Rec60100; // Dalitz plane for 60 < Esum < 100, reco - TH2F * fhX3X4Rec100; // Dalitz plane for Esum > 100, reco^M - TH2F * fhX3X4Gen60; // Dalitz plane for Esum < 60, gen - TH2F * fhX3X4Gen60100; // Dalitz plane for 60 < Esum < 100, gen - TH2F * fhX3X4Gen100; // Dalitz plane for Esum > 100, gen - - TH2F * fhdPhiThrustGen; // energy distribution with rspct to thrust axis, gen, 2-jets - TH2F * fhdPhiThrustGenALL; // energy distribution with rspct to thrust axis, gen 3-jets - TH2F * fhdPhiThrustRec; // energy distribution with rspct to thrust axis, reco, 2-jets - TH2F * fhdPhiThrustRecALL; // energy distribution with rspct to thrust axis, reco, 3-jets - - ClassDef(AliAnalysisTaskThreeJets, 1) -}; - -#endif diff --git a/PWGJE/AliAnalysisTaskUE.cxx b/PWGJE/AliAnalysisTaskUE.cxx deleted file mode 100644 index 893cb0acdc8..00000000000 --- a/PWGJE/AliAnalysisTaskUE.cxx +++ /dev/null @@ -1,450 +0,0 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -/* $Id:$ */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "AliAnalyseUE.h" -#include "AliHistogramsUE.h" -#include "AliAnalysisTaskUE.h" -#include "AliHistogramsUE.h" - -#include "AliAnalysisManager.h" -#include "AliMCEventHandler.h" - -#include "AliAnalysisHelperJetTasks.h" -#include "AliAODHandler.h" -#include "AliAODInputHandler.h" -#include "AliGenPythiaEventHeader.h" -#include "AliLog.h" -#include "AliInputEventHandler.h" - - -//////////////////////////////////////////////////////////////////////// -// -// Analysis class for Underlying Event studies -// -// Look for correlations on the tranverse regions to -// the leading charged jet -// -// This class needs as input AOD with track and Jets. -// The output is a list of histograms -// -// AOD can be either connected to the InputEventHandler -// for a chain of AOD files -// or -// to the OutputEventHandler -// for a chain of ESD files, so this case class should be -// in the train after the Jet finder -// -// Arian.Abrahantes.Quintana@cern.ch -// Ernesto.Lopez.Torres@cern.ch -// vallero@physi.uni-heidelberg.de -// -//////////////////////////////////////////////////////////////////////// - -ClassImp( AliAnalysisTaskUE) - -// Define global pointer -AliAnalysisTaskUE* AliAnalysisTaskUE::fgTaskUE=NULL; - -//____________________________________________________________________ -AliAnalysisTaskUE:: AliAnalysisTaskUE(const char* name): -AliAnalysisTask(name,""), -fHistosUE(0x0), -fAnaUE(0x0), -fAOD(0x0), -fAODBranch("jets"), -fDebug(0), -fListOfHistos(0x0), -//Configuration -fBinsPtInHist(30), -fIsNorm2Area(kTRUE), -fMaxJetPtInHist(300.), -fMinJetPtInHist(0.), -fConstrainDistance(kTRUE), -fMinDistance(0.2), -fSimulateChJetPt(kFALSE), -fUseAliStack(kTRUE), -fUseMCParticleBranch(kFALSE), -fnTracksVertex(3), // QA tracks pointing to principal vertex (= 3 default) -fZVertex(5.), -fAnaType(1), -fConePosition(1), -fConeRadius(0.7), -fFilterBit(0xFF), -fJetsOnFly(kFALSE), -fRegionType(1), -fUseChargeHadrons(kFALSE), -fUseChPartJet(kFALSE), -fUsePositiveCharge(kTRUE), -fUseSingleCharge(kFALSE), -fOrdering(1), -fChJetPtMin(5.0), -fJet1EtaCut(0.2), -fJet2DeltaPhiCut(2.616), // 150 degrees -fJet2RatioPtCut(0.8), -fJet3PtCut(15.), -fTrackEtaCut(0.9), -fTrackPtCut(0.), -//For MC -fAvgTrials(1) -{ - // Default constructor - // Define input and output slots here - // Input slot #0 works with a TChain - DefineInput(0, TChain::Class()); - // Output slot #0 writes into a TList container - DefineOutput(0, TList::Class()); - -} - -//____________________________________________________________________ -AliAnalysisTaskUE:: AliAnalysisTaskUE(const AliAnalysisTaskUE & original): -AliAnalysisTask(), -fHistosUE(original.fHistosUE), -fAnaUE(original.fAnaUE), -fAOD(original.fAOD), -fAODBranch(original.fAODBranch), -fDebug(original.fDebug), -fListOfHistos(original.fListOfHistos), -//Configuration -fBinsPtInHist(original.fBinsPtInHist), -fIsNorm2Area(original.fIsNorm2Area), -fMaxJetPtInHist(original.fMaxJetPtInHist), -fMinJetPtInHist(original.fMinJetPtInHist), -fConstrainDistance(original.fConstrainDistance), -fMinDistance(original.fMinDistance), -fSimulateChJetPt(original.fSimulateChJetPt), -fUseAliStack(original.fUseAliStack), -fUseMCParticleBranch(original.fUseMCParticleBranch), -fnTracksVertex(original.fnTracksVertex), // QA tracks pointing to principal vertex (= 3 default) -fZVertex(original.fZVertex), -fAnaType(original.fAnaType), -fConePosition(original.fConePosition), -fConeRadius(original.fConeRadius), -fFilterBit(original.fFilterBit), -fJetsOnFly(original.fJetsOnFly), -fRegionType(original.fRegionType), -fUseChargeHadrons(original.fUseChargeHadrons), -fUseChPartJet(original.fUseChPartJet), -fUsePositiveCharge(original.fUsePositiveCharge), -fUseSingleCharge(original.fUseSingleCharge), -fOrdering(original.fOrdering), -fChJetPtMin(original.fChJetPtMin), -fJet1EtaCut(original.fJet1EtaCut), -fJet2DeltaPhiCut(original.fJet2DeltaPhiCut), // 150 degrees -fJet2RatioPtCut(original.fJet2RatioPtCut), -fJet3PtCut(original.fJet3PtCut), -fTrackEtaCut(original.fTrackEtaCut), -fTrackPtCut(original.fTrackPtCut), -//For MC -fAvgTrials(original.fAvgTrials) -{ - // Copy constructor -} - - -//______________________________________________________________ -AliAnalysisTaskUE & AliAnalysisTaskUE::operator = (const AliAnalysisTaskUE & /*source*/) -{ - // assignment operator - return *this; -} - -//______________________________________________________________ -Bool_t AliAnalysisTaskUE::Notify() -{ - // - // Implemented Notify() to read the cross sections - // and number of trials from pyxsec.root - // Copy from AliAnalysisTaskJFSystematics - fAvgTrials = 1; - TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree(); - Float_t xsection = 0; - Float_t trials = 1; - if(tree){ - TFile *curfile = tree->GetCurrentFile(); - if (!curfile) { - Error("Notify","No current file"); - return kFALSE; - } - - AliAnalysisHelperJetTasks::PythiaInfoFromFile(curfile->GetName(),xsection,trials); - - fHistosUE->GetXsec()->Fill("<#sigma>",xsection); - - // construct average trials - Float_t nEntries = (Float_t)tree->GetTree()->GetEntries(); - if(trials>=nEntries && nEntries>0.)fAvgTrials = trials/nEntries; - } - - return kTRUE; -} - -//____________________________________________________________________ -void AliAnalysisTaskUE::ConnectInputData(Option_t* /*option*/) -{ - // Connect the input data - - // We need AODs with tracks and jets. - // Since AODs can either be connected to the InputEventHandler - // or to the OutputEventHandler ( the AOD is created by a previus task in the train ) - // we need to check where it is and get the pointer to AODEvent in the right way - - // Delta AODs are also accepted - - - if (fDebug > 1) AliInfo("ConnectInputData() "); - - TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler(); - - if( handler && handler->InheritsFrom("AliAODInputHandler") ) { // input AOD - fAOD = ((AliAODInputHandler*)handler)->GetEvent(); - if(!fJetsOnFly){ - if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODInputHandler"); - }else{ - if (fDebug > 1) AliInfo(" ==== Tracks from AliAODInputHandler / Jets on-the-fly"); - } - } else { //output AOD - handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler(); - if( handler && handler->InheritsFrom("AliAODHandler") ) { - fAOD = ((AliAODHandler*)handler)->GetAOD(); - if (!fJetsOnFly){ - if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODHandler"); - } else { - if (fDebug > 1) AliInfo(" ==== Tracks from AliAODHandler / Jets on-the-fly"); - } - }else { - AliFatal("I can't get any AOD Event Handler"); - return; - } - } - - fAnaUE->Initialize( *this ); - -} - -//____________________________________________________________________ -void AliAnalysisTaskUE::CreateOutputObjects() -{ - // Create the output container - - if (fDebug > 1) AliInfo("CreateOutPutData()"); - - //Initialize AliAnalysisUE, a class implementing the main analysis algorithms - fAnaUE = new AliAnalyseUE(); - fHistosUE = new AliHistogramsUE(); - - if (fListOfHistos != NULL){ - delete fListOfHistos; - fListOfHistos = NULL; - } - if (!fListOfHistos){ - fListOfHistos = new TList(); - fListOfHistos->SetOwner(kTRUE); - } - - //Initialize output histograms - fHistosUE->CreateHistograms(fListOfHistos,fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist, fTrackEtaCut); - AddSettingsTree(); - - PostData(0,fListOfHistos); -} - -//____________________________________________________________________ -void AliAnalysisTaskUE::Exec(Option_t */*option*/) -{ - // Trigger selection ************************************************ - AliInputEventHandler* inputHandler = (AliInputEventHandler*) - ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); - if (!fAnaUE->TriggerSelection(inputHandler)) return; - - // Vertex selection ************************************************* - if(!fAnaUE->VertexSelection(fAOD,fnTracksVertex,fZVertex)) return; - //if(!fAnaUE->VertexSelectionOld(fAOD)) return; // temporary to compare with old task and to have same cuts for MC !!! - - // Execute analysis for current event ****************************** - - if ( fDebug > 3 ) AliInfo( " Processing event..." ); - - // fetch the pythia header info and get the trials - AliMCEventHandler* mcHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); - Float_t nTrials = 1; - if (mcHandler) { - AliMCEvent* mcEvent = mcHandler->MCEvent(); - if (mcEvent) { - AliGenPythiaEventHeader* pythiaGenHeader = AliAnalysisHelperJetTasks::GetPythiaEventHeader(mcEvent); - if(pythiaGenHeader){ - nTrials = pythiaGenHeader->Trials(); - } - } - } - fHistosUE->GetTrials()->Fill("#sum{ntrials}",fAvgTrials); - - //analyse the event - AnalyseUE(); - - PostData(0,fListOfHistos); -} - -//____________________________________________________________________ -void AliAnalysisTaskUE::AddSettingsTree() -{ - //Write settings to output list - TTree *settingsTree = new TTree("UEAnalysisSettings","Analysis Settings in UE estimation"); - settingsTree->Branch("fFilterBit", &fFilterBit,"FilterBit/I"); - settingsTree->Branch("fConeRadius", &fConeRadius,"Rad/D"); - settingsTree->Branch("fJet1EtaCut", &fJet1EtaCut, "LeadJetEtaCut/D"); - settingsTree->Branch("fJet2DeltaPhiCut", &fJet2DeltaPhiCut, "DeltaPhi/D"); - settingsTree->Branch("fJet2RatioPtCut", &fJet2RatioPtCut, "Jet2Ratio/D"); - settingsTree->Branch("fJet3PtCut", &fJet3PtCut, "Jet3PtCut/D"); - settingsTree->Branch("fTrackPtCut", &fTrackPtCut, "TrackPtCut/D"); - settingsTree->Branch("fTrackEtaCut", &fTrackEtaCut, "TrackEtaCut/D"); - settingsTree->Branch("fAnaType", &fAnaType, "Ana/I"); - settingsTree->Branch("fRegionType", &fRegionType,"Reg/I"); - settingsTree->Branch("fOrdering", &fOrdering,"OrderMeth/I"); - settingsTree->Branch("fUseChPartJet", &fUseChPartJet,"UseChPart/O"); - settingsTree->Branch("fUseChargeHadrons", &fUseChargeHadrons,"UseChHadrons/O"); - settingsTree->Branch("fUseSingleCharge", &fUseSingleCharge,"UseSingleCh/O"); - settingsTree->Branch("fUsePositiveCharge", &fUsePositiveCharge,"UsePositiveCh/O"); - settingsTree->Fill(); - fListOfHistos->Add(settingsTree); -} - -//____________________________________________________________________ -void AliAnalysisTaskUE::AnalyseUE() -{ - - - // Get jets and order by pT - TVector3 jetVect[3]; - *jetVect = fAnaUE->GetOrderedClusters(fAODBranch, fUseChPartJet, fChJetPtMin ); - - if( jetVect[0].Pt() < 0. ) { - if( fDebug > 1 ) AliInfo("\n Skipping Event, not jet found..."); - return; - } else { - if (fDebug >1 ) AliInfo(Form("\n Pt Leading Jet = %6.1f eta=%5.3f ", jetVect[0].Pt(), jetVect[0].Eta() )); - } - - // Select events according to analysis type *********************************** - if ( ! (fAnaUE->AnaTypeSelection(jetVect))) return; - - // Find max and min regions with real tracks - if (!fUseMCParticleBranch){ - // Primary vertex distribution - AliAODVertex* vertex = (AliAODVertex*)fAOD->GetPrimaryVertex(); - fHistosUE->FillHistogram("hVertexMult",vertex->GetNContributors()); - - // Fill leading "jet" histogram - fHistosUE->FillHistogram("hEleadingPt",jetVect[0].Pt()); - - fAnaUE->FindMaxMinRegions( jetVect, fConePosition, 0, 0 ); - - }else { - - // this is the part we only use when we have MC information - // More than a test for values of it also resumes the reconstruction efficiency of jets - // As commented bellow if available for the data, we try to pair reconstructed jets with simulated ones - // afterwards we kept angular variables of MC jet to perform UE analysis over MC particles - // TODO: Handle Multiple jet environment. 06/2009 just suited for inclusive jet condition ( fAnaType = 1 ) - - AliMCEventHandler* mcHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); - if (!mcHandler) { - Printf("ERROR: Could not retrieve MC event handler"); - return; - } - - AliMCEvent* mcEvent = mcHandler->MCEvent(); - if (!mcEvent) { - Printf("ERROR: Could not retrieve MC event"); - return; - } - AliGenPythiaEventHeader* pythiaGenHeader = AliAnalysisHelperJetTasks::GetPythiaEventHeader(mcEvent); - if(!pythiaGenHeader){ - return; - } - - fAnaUE->AnalyseMC(jetVect,mcEvent,pythiaGenHeader, fConePosition, fUseAliStack, fConstrainDistance, fMinDistance); - - } - - fAnaUE->FillRegions(fIsNorm2Area, jetVect); - -} - -//____________________________________________________________________ -AliAnalysisTaskUE* AliAnalysisTaskUE::Instance() -{ - - //Create instance - if (fgTaskUE) { - return fgTaskUE; - } else { - fgTaskUE = new AliAnalysisTaskUE(); - return fgTaskUE; - } -} - - -//____________________________________________________________________ -void AliAnalysisTaskUE::Terminate(Option_t */*option*/) -{ - - // Terminate analysis - - if (!gROOT->IsBatch()){ - fListOfHistos = dynamic_cast (GetOutputData(0)); - if (!fListOfHistos){ - AliError("Histogram List is not available"); - return; - } - //call class AliHistogramsUE - AliHistogramsUE *histos=new AliHistogramsUE(fListOfHistos); - histos->DrawUE(0); - } else { - AliInfo(" Batch mode, not histograms will be shown..."); - } - - if( fDebug > 1 ) - AliInfo("End analysis"); - -} - -void AliAnalysisTaskUE::WriteSettings() -{ - - //Print analysis settings on screen - if (fDebug > 5){ - AliInfo(" All Analysis Settings in Saved Tree"); - fListOfHistos = dynamic_cast (GetOutputData(0)); - if (!fListOfHistos){ - AliError("Histogram List is not available"); - return; - } - TTree *tree = (TTree*)(fListOfHistos->FindObject("UEAnalysisSettings")); - tree->Scan(); - } -} diff --git a/PWGJE/AliAnalysisTaskUE.h b/PWGJE/AliAnalysisTaskUE.h deleted file mode 100644 index 59c43ef9f9a..00000000000 --- a/PWGJE/AliAnalysisTaskUE.h +++ /dev/null @@ -1,305 +0,0 @@ -#ifndef ALIANALYSISTASKUE_H -#define ALIANALYSISTASKUE_H - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -//////////////////////////////////////////////////////////////////////// -// -// Analysis class for Underlying Event studies -// -// Look for correlations on the tranverse regions to -// the leading charged jet -// -// This class needs as input AOD with track and Jets. -// The output is a list of histograms -// -// AOD can be either connected to the InputEventHandler -// for a chain of AOD files -// or -// to the OutputEventHandler -// for a chain of ESD files, so this case class should be -// in the train after the Jet finder -// -// Arian.Abrahantes.Quintana@cern.ch -// Ernesto.Lopez.Torres@cern.ch -// vallero@physi.uni-heidelberg.de -// -//////////////////////////////////////////////////////////////////////// - -#include "AliAnalysisTask.h" - -class AliAnalyseUE; -class AliHistogramsUE; -class AliAODEvent; -class AliAODInputHandler; -class AliESDEvent; -class TH1F; -class TH2F; -class TH1I; -class TProfile; -class TTree; -class TVector3; - -class AliAnalysisTaskUE : public AliAnalysisTask - { - public: - AliAnalysisTaskUE(const char* name="AliAnalysisTaskUE"); - virtual ~AliAnalysisTaskUE() {if ( fListOfHistos ) delete fListOfHistos; } - AliAnalysisTaskUE(const AliAnalysisTaskUE &det); - AliAnalysisTaskUE& operator=(const AliAnalysisTaskUE &det); - - // return instance of the singleton - static AliAnalysisTaskUE* Instance(); - - // Implementation of interace methods - virtual Bool_t Notify(); - virtual void ConnectInputData(Option_t *); - virtual void CreateOutputObjects(); - virtual void Exec(Option_t *option); - virtual void Terminate(Option_t *); - - // Setters/Getters - virtual void SetDebugLevel( Int_t level ) { fDebug = level; } - virtual Int_t GetDebugLevel() const { return fDebug; } - - void SetPtRangeInHist( Int_t bin, Double_t min, Double_t max ) { - fBinsPtInHist = bin; - fMinJetPtInHist = min; - fMaxJetPtInHist = max; - } - - // Read AODs - void SelectAODBranch(const char* val) { fAODBranch = val; } - virtual TString GetAODBranch() const { return fAODBranch; } - virtual AliAODEvent* GetAOD() const { return fAOD; } - - // Setters/Getters for MC - void SetConstrainDistance(Bool_t val1, Double_t val2){ fMinDistance = val2; fConstrainDistance = val1;} - void SetSimulateChJetPt(){fSimulateChJetPt = kTRUE;} - void SetUseAODMCParticle(){fUseAliStack = kFALSE;} - void SetUseMCBranch(){fUseMCParticleBranch = kTRUE;} - - virtual Bool_t GetConstrainDistance() const {return fConstrainDistance;} - virtual Double_t GetMinDistance() const {return fMinDistance;} - virtual Bool_t GetSimulateChJetPt() const {return fSimulateChJetPt;} - virtual Bool_t GetUseAODMCParticle() const {return fUseAliStack;} - virtual Bool_t GetUseMCParticleBranch() const {return fUseMCParticleBranch;} - - //Setters for Events QA - void SetZVertex( Double_t val ) { fZVertex = val; } - void SetTracksInVertex( Int_t val ){ fnTracksVertex = val; } - - // Setters/Getters for UE Analysis - void SetAnaTopology( Int_t val ) { fAnaType = val; } - void SetConePosition(Int_t val) { fConePosition= val; } - void SetConeRadius( Double_t val ) { fConeRadius = val; } - void SetDoNotNormalizeQuantities() { fIsNorm2Area = kFALSE; } - void SetFilterBit( UInt_t val ) { fFilterBit = val; } - void SetJetsOnFly( Bool_t val ) { fJetsOnFly = val; } - void SetPtSumOrdering( Int_t val ) { fOrdering = val; } - void SetRegionType( Int_t val ) { fRegionType = val; } - void SetUseChargeHadrons( Bool_t val ) { fUseChargeHadrons = val; } - void SetUseChPartJet( Int_t val ) { fUseChPartJet = val; } - void SetUseNegativeChargeType() { fUsePositiveCharge = kFALSE; } - void SetUseSingleCharge() { fUseSingleCharge = kTRUE; } - - virtual Int_t GetAnaTopology() const { return fAnaType; } - virtual Int_t GetConePosition() const { return fConePosition; } - virtual Double_t GetConeRadius() const { return fConeRadius; } - virtual Bool_t GetDoNotNormalizeQuantities() const { return fIsNorm2Area; } - virtual UInt_t GetFilterBit() const { return fFilterBit; } - virtual Bool_t GetJetsOnFly() const { return fJetsOnFly; } - virtual Int_t GetPtSumOrdering() const { return fOrdering; } - virtual Int_t GetRegionType() const { return fRegionType; } - virtual Bool_t GetUseChargeHadrons() const { return fUseChargeHadrons; } - virtual Int_t GetUseChPartJet() const { return fUseChPartJet; } - virtual Bool_t GetUseNegativeChargeType() const { return fUsePositiveCharge; } - virtual Bool_t GetUseSingleCharge() const { return fUseSingleCharge; } - - // Jet cuts - void SetJet1EtaCut( Double_t val ) { fJet1EtaCut = val; } - void SetJet2DeltaPhiCut( Double_t val ) { fJet2DeltaPhiCut = val; } - void SetJet2RatioPtCut( Double_t val ) { fJet2RatioPtCut = val; } - void SetJet3PtCut( Double_t val ) { fJet3PtCut = val; } - void SetPtMinChPartJet( Double_t val ) { fChJetPtMin = val; } - - virtual Double_t GetJet1EtaCut() const { return fJet1EtaCut; } - virtual Double_t GetJet2DeltaPhiCut() const { return fJet2DeltaPhiCut; } - virtual Double_t GetJet2RatioPtCut() const { return fJet2RatioPtCut; } - virtual Double_t GetJet3PtCut() const { return fJet3PtCut; } - virtual Double_t GetPtMinChPartJet() const { return fChJetPtMin; } - - // track cuts - void SetTrackEtaCut( Double_t val ) { fTrackEtaCut = val; } - void SetTrackPtCut( Double_t val ) { fTrackPtCut = val; } - - virtual Double_t GetTrackEtaCut() const { return fTrackEtaCut; } - virtual Double_t GetTrackPtCut() const { return fTrackPtCut; } - - - AliHistogramsUE* fHistosUE; //! points to AliHistogramsUE class - protected: - static AliAnalysisTaskUE* fgTaskUE; // Pointer to single instance - - private: - void AddSettingsTree(); - void AnalyseUE(); - void FillAvePartPtRegion( Double_t leadingE, Double_t ptMax, Double_t ptMin ); - void FillMultRegion( Double_t leadingE, Double_t nTrackPtmax, Double_t nTrackPtmin, Double_t ptMin ); - void FillSumPtRegion( Double_t leadingE, Double_t ptMax, Double_t ptMin ); - TObjArray* FindChargedParticleJets(); - Int_t IsTrackInsideRegion(TVector3 *jetVect, TVector3 *partVect); - void QSortTracks(TObjArray &a, Int_t first, Int_t last); - void SetRegionArea(TVector3 *jetVect); - TObjArray* SortChargedParticles(); - void WriteSettings(); - - AliAnalyseUE* fAnaUE; //! points to AliAnalyseUE class - AliAODEvent* fAOD; //! AOD Event - TString fAODBranch; // Jet branch name from standard AOD - Int_t fDebug; // Debug flag - TList* fListOfHistos; // Output list of histograms - - // Config - Int_t fBinsPtInHist; // # bins for Pt histos range - Bool_t fIsNorm2Area; // Apply Area Normalization to collected observables - Double_t fMaxJetPtInHist; // max Jet Pt value for histo range - Double_t fMinJetPtInHist; // min Jet Pt value for histo range - - // For MC - Bool_t fConstrainDistance; // Constrain Distance between rec jet and pyth - Double_t fMinDistance; // Minimum distance between rec jet and pyth - Bool_t fSimulateChJetPt; // Naive simulation of charged jet Pt from original Jet in MC Header - Bool_t fUseAliStack; // Use AliSatck for particle info otherwise "mcparticles" branch in AOD - Bool_t fUseMCParticleBranch; // Run Over mcparticles branch in AOD - - // Cuts Events type - Int_t fnTracksVertex; // QA tracks pointing to principal vertex (= 3 default) - Double_t fZVertex; // Position of Vertex in Z direction - - // Cuts UE analysis - Int_t fAnaType; // Analysis type on jet topology: - // 1=inclusive (default) - // 2=back to back inclusive - // 3=back to back exclusive - // 4=Pt max (max Pt track in region) - // 5=gama jet (back to back) ??? - // Minimum bias - // 31 = Semi jet (charged leading particle jets) - // 32 = Random jetcone ? - // 33 = Swiss chees ? - - - Int_t fConePosition; // This parameter set how will cone center in transversal zone will be set - // 1 : To be used in any jet topology (default value) - // eta_cone = eta_leadingjet - // phi_cone = phi_leadingjet + - 90 - // 2 : To be used in multiple jet topology (code will cry otherwise) - // eta_cone = (eta_leadingjet + eta_subleadingjet)/2 - // phi_cone = phi_leadingjet + - 90 - - Double_t fConeRadius; // if selected Cone-like region type, set Radius (=0.7 default) - - UInt_t fFilterBit; // Select tracks from an specific track cut (default 0xFF all track selected) - - Bool_t fJetsOnFly; // if jets are reconstructed on the fly from AOD tracks (see ConnectInputData() ) - - // UE analysis is conducted in different type of regions - // Transverse are those like defined in: R. Field Acta Physica Polonica B. Vol 36 No. 2 pg 167 (2005) - // Cone regions like defined in: Phys. Rev. D 70, 072002 (2004) - Int_t fRegionType; // 1 = transverse regions (default) - // 2 = cone regions - - - - Bool_t fUseChargeHadrons; // Only use charge hadrons - Bool_t fUseChPartJet; // Use "Charged Particle Jet" instead of jets from AOD see FindChargedParticleJets() - - // Theoreticians ask for tools charge-aware - // especially those which are related to multiplicity and MC-tunings - // see arXiv:hep-ph/0507008v3 - Bool_t fUsePositiveCharge; //If Single type of charge used then set which one (=kTRUE default positive) - Bool_t fUseSingleCharge; //Make analysis for a single type of charge (=kFALSE default) - - Int_t fOrdering; // Pt and multiplicity summation ordering: - // 1=CDF-like -independent sorting according quantity to be scored: Double sorting- (default) - // if Pt summation will be scored take Pt minimum between both zones and - // fill Pt Max. and Min. histog. accordingly - // if Multiplicity summation will be scored take Mult. minimum between both zones and - // fill Mult Max and Min histog. accordingly - // Bib: - // 2=Marchesini-like (Only Pt sorting: Single sorting) - // sort only according Pt summation scored, find minimum between both zones and - // fill Pt and Multiplicity Max and Min summation histog. following only this criterium - // Bib: Phys. Rev. D 38, 3419 (1988) - // 3=Nameless pt per track single sorting - // sort according to pt per track scored in each transverse zone - // lowest values indicates minimum zone. - // 4=User Selection sorting (NOTE: USER must implement it within cxx) - - - // Jet cuts - Double_t fChJetPtMin; // Min Pt for charged Particle Jet - Double_t fJet1EtaCut; // |jet1 eta| < fJet1EtaCut (fAnaType = 1,2,3) - Double_t fJet2DeltaPhiCut; // |Jet1.Phi - Jet2.Phi| < fJet2DeltaPhiCut (fAnaType = 2,3) - Double_t fJet2RatioPtCut; // Jet2.Pt/Jet1Pt > fJet2RatioPtCut (fAnaType = 2,3) - Double_t fJet3PtCut; // Jet3.Pt < fJet3PtCut (fAnaType = 3) - - // track cuts - Double_t fTrackEtaCut; // Eta cut on tracks in the regions (fRegionType=1) - Double_t fTrackPtCut; // Pt cut of tracks in the regions - - // MC cross-section - Double_t fAvgTrials; // average trials used to fill the fh1Trials histogram in case we do not have trials on a event by event basis - - /* - // Histograms - TH1F* fhNJets; //! number of reco. jets or leading particles - TH1F* fhEleadingPt; //! pT distribution of leading-jet (leading-particle) - - TH1F* fhMinRegPtDist; //! pT distribution in MIN region - TH1F* fhRegionMultMin; //! average pT in MIN region - TH1F* fhMinRegAvePt; //! sum pT in MIN region - TH1F* fhMinRegSumPt; //! maximum particle pT in MAX region - TH1F* fhMinRegMaxPtPart; //! sum pT vs. multiplicity in MIN region - TH1F* fhMinRegSumPtvsMult; //! - - TH2F* fhdNdEtaPhiDist; //! phi and eta correlation with leading-jet (leading particle) - TH2F* fhFullRegPartPtDistVsEt; //! particle pT distribution vs. transverse energy in FULL region - TH2F* fhTransRegPartPtDistVsEt; //! particle pT distribution vs. transverse energy in TRANSVERSE (MIN+MAX) region - - TH1F* fhRegionSumPtMaxVsEt; //! sum pT vs. transverse energy in MAX region - TH1I* fhRegionMultMax; //! multiplicity in MAX region - TH1F* fhRegionMultMaxVsEt; //! multiplicity vs. transverse energy in MAX region - TH1F* fhRegionSumPtMinVsEt; //! sum pT vs. transverse energy in MIN region - TH1F* fhRegionMultMinVsEt; //! multiplicity vs. transverse energy in MIN region - TH1F* fhRegionAveSumPtVsEt; //! average sum pT in 2 regions - TH1F* fhRegionDiffSumPtVsEt; //! difference sum pT in 2 regions - - TH1F* fhRegionAvePartPtMaxVsEt; //! average particle pT vs. transverse energy in MAX region - TH1F* fhRegionAvePartPtMinVsEt; //! average particle pT vs. transverse energy in MIN region - TH1F* fhRegionMaxPartPtMaxVsEt; //! maximum particle pT vs. transverse energy in MAX region - - TH2F* fhRegForwardMult; //! multiplicity in FORWARD region - TH2F* fhRegForwardSumPtvsMult; //! sum pT vs. multiplicity in FORWARD region - TH2F* fhRegBackwardMult; //! multiplicity in BACKWARD region - TH2F* fhRegBackwardSumPtvsMult; //! sum pT vs. multiplicity in BACKWARD region - TH2F* fhRegForwardPartPtDistVsEt; //! particle pT distribution vs. transverse energy in FORWARD region - TH2F* fhRegBackwardPartPtDistVsEt; //! particle pT distribution vs. transverse energy in BACKWARD - TH2F* fhRegTransMult; //! multiplicity in TRANSVERSE (MIN+MAX) region - TH2F* fhRegTransSumPtVsMult; //! sum pT vs. multiplicity in TRANSVERSE (MIN+MAX) region - TH2F* fhMinRegSumPtJetPtBin; //! - TH2F* fhMaxRegSumPtJetPtBin; //! - TH1F* fhVertexMult; //! vertex multiplicity - - TProfile* fh1Xsec; //! cross-section from MC - TH1F* fh1Trials; //! number of trials from MC - */ - - ClassDef( AliAnalysisTaskUE, 6); // Analysis task for Underlying Event analysis - }; - -#endif - - diff --git a/PWGJE/AliHistogramsUE.cxx b/PWGJE/AliHistogramsUE.cxx deleted file mode 100644 index 97df9b92c9d..00000000000 --- a/PWGJE/AliHistogramsUE.cxx +++ /dev/null @@ -1,1315 +0,0 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: A.Abrahantes, E.Lopez, S.Vallero * - * Version 1.0 * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -/* $Id:$ */ -//////////////////////////////////////////////// -//--------------------------------------------- -// Class to handle histograms for UE analysis -//--------------------------------------------- -//////////////////////////////////////////////// -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "AliHistogramsUE.h" -#include "AliAnalysisTaskUE.h" -#include "AliAnalyseUE.h" -#include "AliCFContainer.h" -#include "AliCFManager.h" -#include "AliLog.h" - -ClassImp( AliHistogramsUE) - -//____________________________________________________________________ -AliHistogramsUE:: AliHistogramsUE(): -TObject(), -fBinsPtInHist(0), -fMinJetPtInHist(0.), -fMaxJetPtInHist(0.), -fTrackEtaCut(0.), -fJet1EtaCut(0.), -fListOfHistos(0x0), -fhNJets(0x0), -fhEleadingPt(0x0), -fhMinRegPtDist(0x0), -fhRegionMultMin(0x0), -fhMinRegAvePt(0x0), -fhMinRegSumPt(0x0), -fhMinRegMaxPtPart(0x0), -fhMinRegSumPtvsMult(0x0), -fhdNdEtaPhiDist(0x0), -fhdNdEtaPhiDistMC(0x0), -fhFullRegPartPtDistVsEt(0x0), -fhFullRegPartPtDistVsEtMC(0x0), -fhTransRegPartPtDistVsEt(0x0), -fhTransRegPartPtDistVsEtMC(0x0), -fhRegionSumPtMaxVsEt(0x0), -fhRegionMultMax(0x0), -fhRegionMultMaxVsEt(0x0), -fhRegionSumPtMinVsEt(0x0), //fhRegionMultMin(0x0), -fhRegionMultMinVsEt(0x0), -fhRegionAveSumPtVsEt(0x0), -fhRegionDiffSumPtVsEt(0x0), -fhRegionAvePartPtMaxVsEt(0x0), -fhRegionAvePartPtMinVsEt(0x0), -fhRegionMaxPartPtMaxVsEt(0x0), -fhRegForwardMult(0x0), -fhRegForwardSumPtvsMult(0x0), -fhRegBackwardMult(0x0), -fhRegBackwardSumPtvsMult(0x0), -fhRegForwardPartPtDistVsEt(0x0), -fhRegForwardPartPtDistVsEtMC(0x0), -fhRegBackwardPartPtDistVsEt(0x0), -fhRegBackwardPartPtDistVsEtMC(0x0), -fhRegTransMult(0x0), -fhRegTransSumPtVsMult(0x0), -fhMinRegSumPtJetPtBin(0x0), -fhMaxRegSumPtJetPtBin(0x0), -fhVertexMult(0x0), -fh1Xsec(0x0), -fh1Trials(0x0), -fhDCAxy(0x0), -fhDCAxyPrimary(0x0) -//For Corrections -{ - // Default constructor - -} - -//____________________________________________________________________ -AliHistogramsUE:: AliHistogramsUE(TList *list): -TObject(), -fBinsPtInHist(0), -fMinJetPtInHist(0.), -fMaxJetPtInHist(0.), -fTrackEtaCut(0.), -fJet1EtaCut(0.), -fListOfHistos(0x0), -fhNJets(0x0), -fhEleadingPt(0x0), -fhMinRegPtDist(0x0), -fhRegionMultMin(0x0), -fhMinRegAvePt(0x0), -fhMinRegSumPt(0x0), -fhMinRegMaxPtPart(0x0), -fhMinRegSumPtvsMult(0x0), -fhdNdEtaPhiDist(0x0), -fhdNdEtaPhiDistMC(0x0), -fhFullRegPartPtDistVsEt(0x0), -fhFullRegPartPtDistVsEtMC(0x0), -fhTransRegPartPtDistVsEt(0x0), -fhTransRegPartPtDistVsEtMC(0x0), -fhRegionSumPtMaxVsEt(0x0), -fhRegionMultMax(0x0), -fhRegionMultMaxVsEt(0x0), -fhRegionSumPtMinVsEt(0x0), //fhRegionMultMin(0x0), -fhRegionMultMinVsEt(0x0), -fhRegionAveSumPtVsEt(0x0), -fhRegionDiffSumPtVsEt(0x0), -fhRegionAvePartPtMaxVsEt(0x0), -fhRegionAvePartPtMinVsEt(0x0), -fhRegionMaxPartPtMaxVsEt(0x0), -fhRegForwardMult(0x0), -fhRegForwardSumPtvsMult(0x0), -fhRegBackwardMult(0x0), -fhRegBackwardSumPtvsMult(0x0), -fhRegForwardPartPtDistVsEt(0x0), -fhRegForwardPartPtDistVsEtMC(0x0), -fhRegBackwardPartPtDistVsEt(0x0), -fhRegBackwardPartPtDistVsEtMC(0x0), -fhRegTransMult(0x0), -fhRegTransSumPtVsMult(0x0), -fhMinRegSumPtJetPtBin(0x0), -fhMaxRegSumPtJetPtBin(0x0), -fhVertexMult(0x0), -fh1Xsec(0x0), -fh1Trials(0x0), -fhDCAxy(0x0), -fhDCAxyPrimary(0x0) -//For Corrections -{ - // Constructor, initialize members from list - fhNJets = (TH1F*)list->FindObject("hNJets"); - fhEleadingPt = (TH1F*)list->FindObject("hEleadingPt"); - fhMinRegPtDist = (TH1F*)list->FindObject("hMinRegPtDist"); - fhRegionMultMin = (TH1F*)list->FindObject("hRegionMultMin"); - fhMinRegAvePt = (TH1F*)list->FindObject("hMinRegAvePt"); - fhMinRegSumPt = (TH1F*)list->FindObject("hMinRegSumPt"); - fhMinRegMaxPtPart = (TH1F*)list->FindObject("hMinRegMaxPtPart"); - fhMinRegSumPtvsMult = (TH1F*)list->FindObject("hMinRegSumPtvsMult"); - fhdNdEtaPhiDist = (TH2F*)list->FindObject("hdNdEtaPhiDist"); - fhdNdEtaPhiDistMC = (TH2F*)list->FindObject("hdNdEtaPhiDistMC"); - fhFullRegPartPtDistVsEt = (TH2F*)list->FindObject("hFullRegPartPtDistVsEt"); - fhFullRegPartPtDistVsEtMC = (TH2F*)list->FindObject("hFullRegPartPtDistVsEtMC"); - fhTransRegPartPtDistVsEt = (TH2F*)list->FindObject("hTransRegPartPtDistVsEt"); - fhTransRegPartPtDistVsEtMC = (TH2F*)list->FindObject("hTransRegPartPtDistVsEtMC"); - fhRegionSumPtMaxVsEt = (TH1F*)list->FindObject("hRegionSumPtMaxVsEt"); - fhRegionMultMax = (TH1I*)list->FindObject("hRegionMultMax"); - fhRegionMultMaxVsEt = (TH1F*)list->FindObject("hRegionMultMaxVsEt"); - fhRegionSumPtMinVsEt = (TH1F*)list->FindObject("hRegionSumPtMinVsEt"); - fhRegionMultMinVsEt = (TH1F*)list->FindObject("hRegionMultMinVsEt"); - fhRegionAveSumPtVsEt = (TH1F*)list->FindObject("hRegionAveSumPtVsEt"); - fhRegionDiffSumPtVsEt = (TH1F*)list->FindObject("hRegionDiffSumPtVsEt"); - fhRegionAvePartPtMaxVsEt = (TH1F*)list->FindObject("hRegionAvePartPtMaxVsEt"); - fhRegionAvePartPtMinVsEt = (TH1F*)list->FindObject("hRegionAvePartPtMinVsEt"); - fhRegionMaxPartPtMaxVsEt = (TH1F*)list->FindObject("hRegionMaxPartPtMaxVsEt"); - fhRegForwardMult = (TH2F*)list->FindObject("hRegForwardMult"); - fhRegForwardSumPtvsMult = (TH2F*)list->FindObject("hRegForwardSumPtvsMult"); - fhRegBackwardMult = (TH2F*)list->FindObject("hRegBackwardMult"); - fhRegBackwardSumPtvsMult = (TH2F*)list->FindObject("hRegBackwardSumPtvsMult"); - fhRegForwardPartPtDistVsEt = (TH2F*)list->FindObject("hRegForwardPartPtDistVsEt"); - fhRegForwardPartPtDistVsEtMC = (TH2F*)list->FindObject("hRegForwardPartPtDistVsEtMC"); - fhRegBackwardPartPtDistVsEt = (TH2F*)list->FindObject("hRegBackwardPartPtDistVsEt"); - fhRegBackwardPartPtDistVsEtMC = (TH2F*)list->FindObject("hRegBackwardPartPtDistVsEtMC"); - fhRegTransMult = (TH2F*)list->FindObject("hRegTransMult"); - fhRegTransSumPtVsMult = (TH2F*)list->FindObject("hRegTransSumPtVsMult"); - fhMinRegSumPtJetPtBin = (TH2F*)list->FindObject("hMinRegSumPtJetPtBin"); - fhMaxRegSumPtJetPtBin = (TH2F*)list->FindObject("hMaxRegSumPtJetPtBin"); - fhVertexMult = (TH1F*)list->FindObject("hVertexMult"); - fh1Xsec = (TProfile*)list->FindObject("h1Xsec"); - fh1Trials = (TH1F*)list->FindObject("h1Trials"); - fhDCAxy = (TH2F*)list->FindObject("hDCAxy"); - fhDCAxyPrimary = (TH2F*)list->FindObject("hDCAxyPrimary"); -} -//____________________________________________________________________ -AliHistogramsUE:: AliHistogramsUE(const AliHistogramsUE & original): -TObject(), -fBinsPtInHist(original.fBinsPtInHist), -fMinJetPtInHist(original.fMinJetPtInHist), -fMaxJetPtInHist(original.fMaxJetPtInHist), -fTrackEtaCut(original.fTrackEtaCut), -fJet1EtaCut(original.fJet1EtaCut), -fListOfHistos(original.fListOfHistos), -fhNJets(original.fhNJets), -fhEleadingPt(original.fhEleadingPt), -fhMinRegPtDist(original.fhMinRegPtDist), -fhRegionMultMin(original.fhRegionMultMin), -fhMinRegAvePt(original.fhMinRegAvePt), -fhMinRegSumPt(original.fhMinRegSumPt), -fhMinRegMaxPtPart(original.fhMinRegMaxPtPart), -fhMinRegSumPtvsMult(original.fhMinRegSumPtvsMult), -fhdNdEtaPhiDist(original.fhdNdEtaPhiDist), -fhdNdEtaPhiDistMC(original.fhdNdEtaPhiDistMC), -fhFullRegPartPtDistVsEt(original.fhFullRegPartPtDistVsEt), -fhFullRegPartPtDistVsEtMC(original.fhFullRegPartPtDistVsEtMC), -fhTransRegPartPtDistVsEt(original.fhTransRegPartPtDistVsEt), -fhTransRegPartPtDistVsEtMC(original.fhTransRegPartPtDistVsEtMC), -fhRegionSumPtMaxVsEt(original.fhRegionSumPtMaxVsEt), -fhRegionMultMax(original.fhRegionMultMax), -fhRegionMultMaxVsEt(original.fhRegionMultMaxVsEt), -fhRegionSumPtMinVsEt(original.fhRegionSumPtMinVsEt), -fhRegionMultMinVsEt(original.fhRegionMultMinVsEt), -fhRegionAveSumPtVsEt(original.fhRegionAveSumPtVsEt), -fhRegionDiffSumPtVsEt(original.fhRegionDiffSumPtVsEt), -fhRegionAvePartPtMaxVsEt(original.fhRegionAvePartPtMaxVsEt), -fhRegionAvePartPtMinVsEt(original.fhRegionAvePartPtMinVsEt), -fhRegionMaxPartPtMaxVsEt(original.fhRegionMaxPartPtMaxVsEt), -fhRegForwardMult(original.fhRegForwardMult), -fhRegForwardSumPtvsMult(original.fhRegForwardSumPtvsMult), -fhRegBackwardMult(original.fhRegBackwardMult), -fhRegBackwardSumPtvsMult(original.fhRegBackwardSumPtvsMult), -fhRegForwardPartPtDistVsEt(original.fhRegForwardPartPtDistVsEt), -fhRegForwardPartPtDistVsEtMC(original.fhRegForwardPartPtDistVsEtMC), -fhRegBackwardPartPtDistVsEt(original.fhRegBackwardPartPtDistVsEt), -fhRegBackwardPartPtDistVsEtMC(original.fhRegBackwardPartPtDistVsEtMC), -fhRegTransMult(original.fhRegTransMult), -fhRegTransSumPtVsMult(original.fhRegTransSumPtVsMult), -fhMinRegSumPtJetPtBin(original.fhMinRegSumPtJetPtBin), -fhMaxRegSumPtJetPtBin(original.fhMaxRegSumPtJetPtBin), -fhVertexMult(original.fhVertexMult), -fh1Xsec(original.fh1Xsec), -fh1Trials(original.fh1Trials), -fhDCAxy(original.fhDCAxy), -fhDCAxyPrimary(original.fhDCAxyPrimary) -//For Corrections -{ - - // Copy constructor - -} - - -//______________________________________________________________ -AliHistogramsUE & AliHistogramsUE::operator = (const AliHistogramsUE & /*source*/) -{ - - // assignment operator - return *this; - -} - -//______________________________________________________________ -TObjArray* AliHistogramsUE::CreateCanvas(const Int_t ncanv){ - - // Create canvas for plotting - printf("Creating %d canvas ... \n",ncanv); - TObjArray *arr=new TObjArray; - TString name; - for(Int_t i=0;iSetFillColor(0); - gStyle->SetOptStat(0); - gStyle->SetOptTitle(0); - arr->Add(c); - } - -return arr; - -} - -//____________________________________________________________________ -void AliHistogramsUE::CreateHistograms(TList *list,Int_t bins, Double_t min, Double_t max, Double_t etacut) -{ - - // Create all histograms necessary for UE analysis - fBinsPtInHist = bins; - fMinJetPtInHist = min; - fMaxJetPtInHist = max; - fTrackEtaCut= etacut; - - //Number of reconstructed clusters - fhNJets = new TH1F("hNJets", "Number of clusters", 20, 0, 20); - fhNJets->SetXTitle("Number of reconstructed clusters"); - fhNJets->SetYTitle("#"); - fhNJets->Sumw2(); - list->Add( fhNJets ); // At(0) - - //pT distribution of leading clusters - fhEleadingPt = new TH1F("hEleadingPt", "Leading cluster p_{T}", bins, min, max); - fhEleadingPt->SetXTitle("p_{T} of cluster (GeV/c)"); - fhEleadingPt->SetYTitle("1/N_{ev} dN/dp_{T} (|#eta|<0.5)"); - fhEleadingPt->Sumw2(); - list->Add( fhEleadingPt ); // At(1) - - //Track pT distribution in MIN zone - fhMinRegPtDist = new TH1F("hMinRegPtDist", "p_{T} distribution in MIN zone", 50,0.,20.); - fhMinRegPtDist->SetXTitle("Track p_{T} (GeV/c)"); - fhMinRegPtDist->SetYTitle("dN/dp_{T}"); - fhMinRegPtDist->Sumw2(); - list->Add( fhMinRegPtDist ); // At(2) - - //Multiplicity in MIN zone - fhRegionMultMin = new TH1F("hRegionMultMin", "N_{ch}^{90, min}", 21, -0.5, 20.5); - fhRegionMultMin->SetXTitle("N_{ch tracks}"); - fhRegionMultMin->Sumw2(); - list->Add( fhRegionMultMin ); // At(3) - - //Average pT in MIN region - fhMinRegAvePt = new TH1F("hMinRegAvePt", "#LTp_{T}#GT", 50, 0., 20.); - fhMinRegAvePt->SetXTitle("p_{T} (GeV/c)"); - fhMinRegAvePt->Sumw2(); - list->Add( fhMinRegAvePt ); // At(4) - - //Sum pT in MIN region - fhMinRegSumPt = new TH1F("hMinRegSumPt", "#Sigma p_{T} ", 50, 0., 20.); - fhMinRegSumPt->SetYTitle("Ed^{3}N_{tracks}/dp^{3} (c^{3}/GeV^{2})"); - fhMinRegSumPt->SetXTitle("#Sigma p_{T} (GeV/c)"); - fhMinRegSumPt->Sumw2(); - list->Add( fhMinRegSumPt ); // At(5) - - //Track with maximum pT in MIN region - fhMinRegMaxPtPart = new TH1F("hMinRegMaxPtPart", "max(p_{T})|_{event} ", 50, 0., 20.); - fhMinRegMaxPtPart->SetYTitle("Ed^{3}N_{tracks}/dp^{3} (c^{3}/GeV^{2})"); - fhMinRegMaxPtPart->SetXTitle("p_{T} (GeV/c)"); - fhMinRegMaxPtPart->Sumw2(); - list->Add( fhMinRegMaxPtPart ); // At(6) - - //Sum pT vs. multiplicity in MIN region - fhMinRegSumPtvsMult = new TH1F("hMinRegSumPtvsMult", "#Sigma p_{T} vs. Multiplicity ", 21, -0.5, 20.5); - fhMinRegSumPtvsMult->SetYTitle("#Sigma p_{T} (GeV/c)"); - fhMinRegSumPtvsMult->SetXTitle("N_{charge}"); - fhMinRegSumPtvsMult->Sumw2(); - list->Add( fhMinRegSumPtvsMult ); // At(7); - - //Phi correlation track-cluster vs. leading cluster pT - fhdNdEtaPhiDist = new TH2F("hdNdEtaPhiDist", Form("Charge particle density |#eta|<%3.1f vs #Delta#phi", fTrackEtaCut),62, 0., 2.*TMath::Pi(), bins, min, max); - fhdNdEtaPhiDist->SetXTitle("#Delta#phi"); - fhdNdEtaPhiDist->SetYTitle("Leading cluster p_{T}"); - fhdNdEtaPhiDist->Sumw2(); - list->Add( fhdNdEtaPhiDist ); // At(8) - - //Can be used to get track pT distribution for different cluster pT bins (full region) - fhFullRegPartPtDistVsEt = new TH2F("hFullRegPartPtDistVsEt", Form( "dN/dp_{T} |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut),100,0.,50., bins, min, max); - fhFullRegPartPtDistVsEt->SetYTitle("Leading cluster p_{T}"); - fhFullRegPartPtDistVsEt->SetXTitle("p_{T}"); - fhFullRegPartPtDistVsEt->Sumw2(); - list->Add( fhFullRegPartPtDistVsEt ); // At(9) - - //Can be used to get part pT distribution for different cluster pT bins (transverse region) - fhTransRegPartPtDistVsEt = new TH2F("hTransRegPartPtDistVsEt", Form( "dN/dp_{T} in tranvese regions |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut),100,0.,50., bins, min, max); - fhTransRegPartPtDistVsEt->SetYTitle("Leading cluster p_{T}"); - fhTransRegPartPtDistVsEt->SetXTitle("p_{T}"); - fhTransRegPartPtDistVsEt->Sumw2(); - list->Add( fhTransRegPartPtDistVsEt ); // At(10) - - //Sum pT in MAX region vs. leading-cluster pT - fhRegionSumPtMaxVsEt = new TH1F("hRegionSumPtMaxVsEt", "P_{T}^{90, max} vs Leading cluster p_{T}", bins, min, max); - fhRegionSumPtMaxVsEt->SetXTitle("p_{T} (GeV/c)"); - fhRegionSumPtMaxVsEt->Sumw2(); - list->Add( fhRegionSumPtMaxVsEt ); // At(11) - - - //Sum pT in MIN region vs. leading-cluster pT - fhRegionSumPtMinVsEt = new TH1F("hRegionSumPtMinVsEt", "P_{T}^{90, min} vs Leading cluster p_{T}", bins, min, max); - fhRegionSumPtMinVsEt->SetXTitle("p_{T} (GeV/c)"); - fhRegionSumPtMinVsEt->Sumw2(); - list->Add( fhRegionSumPtMinVsEt ); // At(12) - - //Multiplicity in MAX region - fhRegionMultMax = new TH1I("hRegionMultMax", "N_{ch}^{90, max}", 21, -0.5, 20.5); - fhRegionMultMax->SetXTitle("N_{ch tracks}"); - fhRegionMultMax->Sumw2(); - list->Add( fhRegionMultMax ); // At(13) - - //Multiplicity in MAX region vs. leading-cluster pT - fhRegionMultMaxVsEt = new TH1F("hRegionMultMaxVsEt", "N_{ch}^{90, max} vs Leading cluster p_{T}", bins, min, max); - fhRegionMultMaxVsEt->SetXTitle("p_{T} (GeV/c)"); - fhRegionMultMaxVsEt->Sumw2(); - list->Add( fhRegionMultMaxVsEt ); // At(14) - - //Multiplicity in MIN region vs. leading-cluster pT - fhRegionMultMinVsEt = new TH1F("hRegionMultMinVsEt", "N_{ch}^{90, min} vs Leading cluster p_{T}", bins, min, max); - fhRegionMultMinVsEt->SetXTitle("p_{T} (GeV/c)"); - fhRegionMultMinVsEt->Sumw2(); - list->Add( fhRegionMultMinVsEt ); // At(15) - - //Average sum pT in TRANSVERSE(MIN+MAX) region vs. leading-cluster pT - fhRegionAveSumPtVsEt = new TH1F("hRegionAveSumPtVsEt", "(P_{T}^{90, max} + P_{T}^{90, min})/2 vs Leading cluster p_{T}", bins, min, max); - fhRegionAveSumPtVsEt->SetXTitle("p_{T} (GeV/c)"); - fhRegionAveSumPtVsEt->Sumw2(); - list->Add( fhRegionAveSumPtVsEt ); // At(16) - - //Difference sum pT (MAX-MIN) vs. leading-cluster pT - fhRegionDiffSumPtVsEt= new TH1F("hRegionDiffSumPtVsEt", "(P_{T}^{90, max} - P_{T}^{90, min}) vs Leading cluster p_{T}", bins, min, max); - fhRegionDiffSumPtVsEt->SetXTitle("P_{T} (GeV/c)"); - fhRegionDiffSumPtVsEt->Sumw2(); - list->Add( fhRegionDiffSumPtVsEt ); // At(17) - - //Average track pT in MAX region vs. leading-cluster pT - fhRegionAvePartPtMaxVsEt = new TH1F("hRegionAvePartPtMaxVsEt", "#LTp_{T}#GT^{90, max} vs Leading cluster p_{T}", bins, min, max); - fhRegionAvePartPtMaxVsEt->SetXTitle("p_{T} (GeV/c)"); - fhRegionAvePartPtMaxVsEt->Sumw2(); - list->Add( fhRegionAvePartPtMaxVsEt ); // At(18) - - //Average track pT in MIN region vs. leading-cluster pT - fhRegionAvePartPtMinVsEt = new TH1F("hRegionAvePartPtMinVsEt", "#LTp_{T}#GT^{90, min} vs Leading cluster p_{T}", bins, min, max); - fhRegionAvePartPtMinVsEt->SetXTitle("p_{T} (GeV/c)"); - fhRegionAvePartPtMinVsEt->Sumw2(); - list->Add( fhRegionAvePartPtMinVsEt ); // At(19) - - //Maximum track pT in MAX region vs. leading-cluster pT - fhRegionMaxPartPtMaxVsEt = new TH1F("hRegionMaxPartPtMaxVsEt", "max(p_{T})^{90} vs Leading cluster p_{T}", bins, min, max); - fhRegionMaxPartPtMaxVsEt->SetXTitle("p_{T} (GeV/c)"); - fhRegionMaxPartPtMaxVsEt->Sumw2(); - list->Add( fhRegionMaxPartPtMaxVsEt ); // At(20) - - //Multiplicity in FORWARD region - fhRegForwardMult = new TH2F("hRegForwardMult", "N_{ch}^{forward}", bins, min, max, 21, -0.5, 20.5); - fhRegForwardMult->SetXTitle("N_{ch tracks}"); - fhRegForwardMult->Sumw2(); - list->Add( fhRegForwardMult ); // At(25) - - //Sum pT in FORWARD region vs. multiplicity - fhRegForwardSumPtvsMult = new TH2F("hRegForwardSumPtvsMult", "Forward #Sigma p_{T} vs. Multiplicity ", bins, min, max, 21, -0.5, 20.5); - fhRegForwardSumPtvsMult->SetYTitle("#Sigma p_{T} (GeV/c)"); - fhRegForwardSumPtvsMult->SetXTitle("N_{charge}"); - fhRegForwardSumPtvsMult->Sumw2(); - list->Add( fhRegForwardSumPtvsMult ); // At(26); - - //Multiplicity in BACKWARD region - fhRegBackwardMult = new TH2F("hRegBackwardMult", "N_{ch}^{backward}", bins, min, max, 21, -0.5, 20.5); - fhRegBackwardMult->SetXTitle("N_{ch tracks}"); - fhRegBackwardMult->Sumw2(); - list->Add( fhRegBackwardMult ); // At(27) - - //Sum pT in BACKWARD region vs. multiplicity - fhRegBackwardSumPtvsMult = new TH2F("hRegBackwardSumPtvsMult", "Backward #Sigma p_{T} vs. Multiplicity ", bins, min, max, 21, -0.5, 20.5); - fhRegBackwardSumPtvsMult->SetYTitle("#Sigma p_{T} (GeV/c)"); - fhRegBackwardSumPtvsMult->SetXTitle("N_{charge}"); - fhRegBackwardSumPtvsMult->Sumw2(); - list->Add( fhRegBackwardSumPtvsMult ); // At(28); - - //Track pT distribution in FORWARD region vs. leading-cluster pT - fhRegForwardPartPtDistVsEt = new TH2F("hRegForwardPartPtDistVsEt", Form( "dN/dP_{T} |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut), 100,0.,50., bins, min, max); - fhRegForwardPartPtDistVsEt->SetYTitle("Leading cluster p_{T}"); - fhRegForwardPartPtDistVsEt->SetXTitle("p_{T} (GeV/c)"); - fhRegForwardPartPtDistVsEt->Sumw2(); - list->Add( fhRegForwardPartPtDistVsEt ); // At(29) - - //Track pT distribution in BACKWARD region vs. leading-cluster pT - fhRegBackwardPartPtDistVsEt = new TH2F("hRegBackwardPartPtDistVsEt", Form( "dN/dP_{T} |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut), 100,0.,50., bins, min, max); - fhRegBackwardPartPtDistVsEt->SetYTitle("Leading cluster p_{T}"); - fhRegBackwardPartPtDistVsEt->SetXTitle("p_{T}"); - fhRegBackwardPartPtDistVsEt->Sumw2(); - list->Add( fhRegBackwardPartPtDistVsEt ); // At(30) - - //Multiplicity in TRANSVERSE (MIN+MAX) region - fhRegTransMult = new TH2F("hRegTransMult", "N_{ch}^{transv}", bins, min, max, 21, -0.5, 20.5); - fhRegTransMult->SetXTitle("N_{ch tracks}"); - fhRegTransMult->Sumw2(); - list->Add( fhRegTransMult ); // At(31) - - //Sum pT in TRANSVERSE (MIN+MAX) region vs. multiplicity - fhRegTransSumPtVsMult = new TH2F("hRegTransSumPtVsMult", "Transverse #Sigma p_{T} vs. Multiplicity ",bins, min, max, 21, -0.5, 20.5); - fhRegTransSumPtVsMult->SetYTitle("#Sigma p_{T} (GeV/c)"); - fhRegTransSumPtVsMult->SetXTitle("N_{charge}"); - fhRegTransSumPtVsMult->Sumw2(); - list->Add( fhRegTransSumPtVsMult ); // At(32); - - //Sum pT in MIN region per cluster pT bin - fhMinRegSumPtJetPtBin = new TH2F("hMinRegSumPtJetPtBin", "Transverse Min Reg #Sigma p_{T} per cluster pT bin",bins, min, max, 50, 0., 20.); - fhMinRegSumPtJetPtBin->SetXTitle("Leading cluster p_{T}"); - fhMinRegSumPtJetPtBin->Sumw2(); - list->Add( fhMinRegSumPtJetPtBin ); // At(33) - - //Sum pT in MAX region per cluster pT bin - fhMaxRegSumPtJetPtBin = new TH2F("hMaxRegSumPtJetPtBin", "Transverse Max Reg #Sigma p_{T} per cluster pT bin", bins, min, max, 50, 0., 20.); - fhMaxRegSumPtJetPtBin->SetXTitle("Leading cluster p_{T}"); - fhMaxRegSumPtJetPtBin->Sumw2(); - list->Add( fhMaxRegSumPtJetPtBin ); // At(34) - - //Multiplicity in main vertex - fhVertexMult = new TH1F("hVertexMult", "Multiplicity in Main Vertex", 81, -0.5 , 80.5); - fhVertexMult->SetXTitle("Main Vertex Multiplicity"); - fhVertexMult->Sumw2(); - list->Add( fhVertexMult ); //At(35) - - fh1Xsec = new TProfile("h1Xsec","xsec from pyxsec.root",1,0,1); - fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>"); - fh1Xsec->Sumw2(); - list->Add( fh1Xsec ); //At(36) - - fh1Trials = new TH1F("h1Trials","trials from pyxsec.root",1,0,1); - fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}"); - fh1Trials->Sumw2(); - list->Add( fh1Trials ); //At(37) - - - fListOfHistos=list; -} - -//____________________________________________________________________ -void AliHistogramsUE::CreateCorrectionsContainer(AliCFManager* cfman,Int_t bins, Double_t min, Double_t max, Double_t etacut, Double_t jetetacut){ - - fBinsPtInHist = bins; - fMinJetPtInHist = min; - fMaxJetPtInHist = max; - fTrackEtaCut= etacut; - fJet1EtaCut = jetetacut; - //Define some constant - const Double_t minpT=fMinJetPtInHist; - const Double_t maxpT=fMaxJetPtInHist; - - const Double_t mineta=(-1.*fJet1EtaCut); - const Double_t maxeta=fJet1EtaCut; - - const Double_t minprocess=-0.5; - const Double_t maxprocess=9.5; - - const Double_t mindeltaeta=-5.; - const Double_t maxdeltaeta=5.; - - const Double_t mindeltaphi=0.; - const Double_t maxdeltaphi=7.; - - const Double_t minradius=0.; - const Double_t maxradius=10.; - - //Define sensitive variables - UInt_t ipT = 0; //leading track pT - UInt_t ieta = 1; //leading track eta - UInt_t iprocess = 2; //process type (ND,DD,SD) - UInt_t ipTMC = 3; //MC leading track pT - UInt_t ietaMC = 4; //MC leading track eta - UInt_t ideltaeta = 5; //leading track eta reco-MC - UInt_t ideltaphi = 6; //leading track phi reco-MC - UInt_t iradius = 7; //leading track radius reco-MC - - //Set-up grid - UInt_t nstep = 6; - const Int_t nvar = 8; - const Int_t nbinspT = fBinsPtInHist; - const Int_t nbinseta = 10; - const Int_t nbinsprocess = 10; - const Int_t nbinsdeltaeta = 20; - const Int_t nbinsdeltaphi = 20; - const Int_t nbinsradius = 20; - - - Int_t iBin[nvar]; - iBin[0] = nbinspT; - iBin[1] = nbinseta; - iBin[2] = nbinsprocess; - iBin[3] = nbinspT; - iBin[4] = nbinseta; - iBin[5] = nbinsdeltaeta; - iBin[6] = nbinsdeltaphi; - iBin[7] = nbinsradius; - - //lower bounds - Double_t *binLimpT=new Double_t[nbinspT+1]; - for (Int_t i=0; i<=nbinspT; i++) binLimpT[i]=(Double_t)minpT + (maxpT-minpT)/nbinspT*(Double_t)i ; - - Double_t *binLimeta=new Double_t[nbinseta+1]; - for (Int_t i=0; i<=nbinseta; i++) binLimeta[i]=(Double_t)mineta + (maxeta-mineta)/nbinseta*(Double_t)i ; - - Double_t *binLimprocess=new Double_t[nbinsprocess+1]; - for (Int_t i=0; i<=nbinsprocess; i++) binLimprocess[i]=(Double_t)minprocess + (maxprocess-minprocess)/nbinsprocess*(Double_t)i ; - - Double_t *binLimdeltaeta=new Double_t[nbinsdeltaeta+1]; - for (Int_t i=0; i<=nbinsdeltaeta; i++) binLimdeltaeta[i]=(Double_t)mindeltaeta + (maxdeltaeta-mindeltaeta)/nbinsdeltaeta*(Double_t)i ; - - Double_t *binLimdeltaphi=new Double_t[nbinsdeltaphi+1]; - for (Int_t i=0; i<=nbinsdeltaphi; i++) binLimdeltaphi[i]=(Double_t)mindeltaphi + (maxdeltaphi-mindeltaphi)/nbinsdeltaphi*(Double_t)i ; - - Double_t *binLimradius=new Double_t[nbinsradius+1]; - for (Int_t i=0; i<=nbinsradius; i++) binLimradius[i]=(Double_t)minradius + (maxradius-minradius)/nbinsradius*(Double_t)i ; - - - //Container - AliCFContainer * container = new AliCFContainer("container1", "EventSelection",nstep,nvar,iBin); - container->SetBinLimits(ipT,binLimpT); - container->SetBinLimits(ieta,binLimeta); - container->SetBinLimits(iprocess,binLimprocess); - container->SetBinLimits(ipTMC,binLimpT); - container->SetBinLimits(ietaMC,binLimeta); - container->SetBinLimits(ideltaeta,binLimdeltaeta); - container->SetBinLimits(ideltaphi,binLimdeltaphi); - container->SetBinLimits(iradius,binLimradius); - - container->SetVarTitle(ipT,"Leading track p_{T} (reco.)"); - container->SetVarTitle(ieta,"Leading track #eta (reco.)"); - container->SetVarTitle(iprocess,"Process"); - container->SetVarTitle(ipTMC,"Leading track p_{T} (true)"); - container->SetVarTitle(ietaMC,"Leading track #eta (true)"); - container->SetVarTitle(ideltaeta,"Leading track #Delta #eta (reco.-true)"); - container->SetVarTitle(ideltaphi,"Leading track #Delta #phi (reco.-true)"); - container->SetVarTitle(iradius,"Leading track R (reco.-true)"); - - //set steps - container->SetStepTitle(0,"Triggered"); - container->SetStepTitle(1,"Pass physics selection"); - container->SetStepTitle(2,"Pass primary vertex cuts"); - container->SetStepTitle(3,"Required analysis topology "); - container->SetStepTitle(4,"Leading track p_{T} > 1 GeV/c"); - container->SetStepTitle(5,"Leading track correctly identified"); - - cfman->SetEventContainer(container); - -} - - - -//____________________________________________________________________ -void AliHistogramsUE::CreateHistogramsCorrections(TList *list,Int_t bins, Double_t min, Double_t max, Double_t etacut) -{ - - // Create all histograms necessary for UE corrections - fBinsPtInHist = bins; - fMinJetPtInHist = min; - fMaxJetPtInHist = max; - fTrackEtaCut= etacut; - - //Number of reconstructed clusters - fhNJets = new TH1F("hNJets", "Number of clusters", 20, 0, 20); - fhNJets->SetXTitle("Number of reconstructed clusters"); - fhNJets->SetYTitle("#"); - fhNJets->Sumw2(); - list->Add( fhNJets ); - - //Cross-section from MC - fh1Xsec = new TProfile("h1Xsec","xsec from pyxsec.root",1,0,1); - fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>"); - fh1Xsec->Sumw2(); - list->Add( fh1Xsec ); - - //Number of trials from MC - fh1Trials = new TH1F("h1Trials","trials from pyxsec.root",1,0,1); - fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}"); - fh1Trials->Sumw2(); - list->Add( fh1Trials ); - - //FOR TRACK EFFICIENCY - //Phi correlation track-cluster vs. leading cluster pT - fhdNdEtaPhiDist = new TH2F("hdNdEtaPhiDist", Form("Charge particle density |#eta|<%3.1f vs #Delta#phi", fTrackEtaCut),62, 0., 2.*TMath::Pi(), bins, min, max); - fhdNdEtaPhiDist->SetXTitle("#Delta#phi"); - fhdNdEtaPhiDist->SetYTitle("Leading cluster p_{T}"); - fhdNdEtaPhiDist->Sumw2(); - list->Add( fhdNdEtaPhiDist ); - //idem for MC true - fhdNdEtaPhiDistMC = new TH2F("hdNdEtaPhiDistMC", Form("Charge particle density |#eta|<%3.1f vs #Delta#phi", fTrackEtaCut),62, 0., 2.*TMath::Pi(), bins, min, max); - fhdNdEtaPhiDistMC->SetXTitle("#Delta#phi"); - fhdNdEtaPhiDistMC->SetYTitle("Leading cluster p_{T}"); - fhdNdEtaPhiDistMC->Sumw2(); - list->Add( fhdNdEtaPhiDistMC ); - - - //Can be used to get track pT distribution for different cluster pT bins (full region) - fhFullRegPartPtDistVsEt = new TH2F("hFullRegPartPtDistVsEt", Form( "dN/dp_{T} |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut),100,0.,50., bins, min, max); - fhFullRegPartPtDistVsEt->SetYTitle("Leading cluster p_{T}"); - fhFullRegPartPtDistVsEt->SetXTitle("p_{T}"); - fhFullRegPartPtDistVsEt->Sumw2(); - list->Add( fhFullRegPartPtDistVsEt ); - //idem for MC true - fhFullRegPartPtDistVsEtMC = new TH2F("hFullRegPartPtDistVsEtMC", Form( "dN/dp_{T} |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut),100,0.,50., bins, min, max); - fhFullRegPartPtDistVsEtMC->SetYTitle("Leading cluster p_{T}"); - fhFullRegPartPtDistVsEtMC->SetXTitle("p_{T}"); - fhFullRegPartPtDistVsEtMC->Sumw2(); - list->Add( fhFullRegPartPtDistVsEtMC ); - - - //Can be used to get part pT distribution for different cluster pT bins (transverse region) - fhTransRegPartPtDistVsEt = new TH2F("hTransRegPartPtDistVsEt", Form( "dN/dp_{T} in tranvese regions |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut),100,0.,50., bins, min, max); - fhTransRegPartPtDistVsEt->SetYTitle("Leading cluster p_{T}"); - fhTransRegPartPtDistVsEt->SetXTitle("p_{T}"); - fhTransRegPartPtDistVsEt->Sumw2(); - list->Add( fhTransRegPartPtDistVsEt ); - //idem for MC true - fhTransRegPartPtDistVsEtMC = new TH2F("hTransRegPartPtDistVsEtMC", Form( "dN/dp_{T} in tranvese regions |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut),100,0.,50., bins, min, max); - fhTransRegPartPtDistVsEtMC->SetYTitle("Leading cluster p_{T}"); - fhTransRegPartPtDistVsEtMC->SetXTitle("p_{T}"); - fhTransRegPartPtDistVsEtMC->Sumw2(); - list->Add( fhTransRegPartPtDistVsEtMC ); - - - //Track pT distribution in FORWARD region vs. leading-cluster pT - fhRegForwardPartPtDistVsEt = new TH2F("hRegForwardPartPtDistVsEt", Form( "dN/dP_{T} |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut), 100,0.,50., bins, min, max); - fhRegForwardPartPtDistVsEt->SetYTitle("Leading cluster p_{T}"); - fhRegForwardPartPtDistVsEt->SetXTitle("p_{T} (GeV/c)"); - fhRegForwardPartPtDistVsEt->Sumw2(); - list->Add( fhRegForwardPartPtDistVsEt ); - //idem for MC true - fhRegForwardPartPtDistVsEtMC = new TH2F("hRegForwardPartPtDistVsEtMC", Form( "dN/dP_{T} |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut), 100,0.,50., bins, min, max); - fhRegForwardPartPtDistVsEtMC->SetYTitle("Leading cluster p_{T}"); - fhRegForwardPartPtDistVsEtMC->SetXTitle("p_{T} (GeV/c)"); - fhRegForwardPartPtDistVsEtMC->Sumw2(); - list->Add( fhRegForwardPartPtDistVsEtMC ); - - //Track pT distribution in BACKWARD region vs. leading-cluster pT - fhRegBackwardPartPtDistVsEt = new TH2F("hRegBackwardPartPtDistVsEt", Form( "dN/dP_{T} |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut), 100,0.,50., bins, min, max); - fhRegBackwardPartPtDistVsEt->SetYTitle("Leading cluster p_{T}"); - fhRegBackwardPartPtDistVsEt->SetXTitle("p_{T}"); - fhRegBackwardPartPtDistVsEt->Sumw2(); - list->Add( fhRegBackwardPartPtDistVsEt ); - //idem for MC true - fhRegBackwardPartPtDistVsEtMC = new TH2F("hRegBackwardPartPtDistVsEtMC", Form( "dN/dP_{T} |#eta|<%3.1f vs Leading cluster p_{T}", fTrackEtaCut), 100,0.,50., bins, min, max); - fhRegBackwardPartPtDistVsEtMC->SetYTitle("Leading cluster p_{T}"); - fhRegBackwardPartPtDistVsEtMC->SetXTitle("p_{T}"); - fhRegBackwardPartPtDistVsEtMC->Sumw2(); - list->Add( fhRegBackwardPartPtDistVsEtMC ); - - //FOR DCA DISTRIBUTION - fhDCAxy = new TH2F("hDCAxy","Transverse DCA vs. leading track p_{T} ",50,-5.,5.,bins,min,max); - fhDCAxy->SetYTitle("Leading cluster p_{T}"); - fhDCAxy->SetXTitle("d_{0}"); - fhDCAxy->Sumw2(); - list->Add( fhDCAxy ); - - //Fill only if reconstructed points back to a true primary - fhDCAxyPrimary = new TH2F("hDCAxyPrimary","Transverse DCA vs. leading track p_{T} (primaries)",50,-5.,5.,bins,min,max); - fhDCAxyPrimary->SetYTitle("Leading cluster p_{T}"); - fhDCAxyPrimary->SetXTitle("d_{0}"); - fhDCAxyPrimary->Sumw2(); - list->Add( fhDCAxyPrimary ); - - fListOfHistos=list; -} - -//____________________________________________________________________ -void AliHistogramsUE::DrawUE(Int_t debug){ - - // To draw histograms at the end of task running - // Normalize histos to region area TODO: - // Normalization done at Analysis, taking into account - // area variations on per-event basis (cone case) - - //HIGH WARNING!!!!!: DO NOT SCALE ANY OF THE ORIGINAL HISTOGRAMS - //MAKE A COPY, DRAW IT, And later sacale that copy. CAF Issue!!!!! - - Int_t binsPtInHist = fhEleadingPt->GetNbinsX(); - Double_t minJetPtInHist = fhEleadingPt->GetXaxis()->GetBinLowEdge(1); - Double_t maxJetPtInHist = fhEleadingPt->GetXaxis()->GetBinUpEdge(binsPtInHist); - - //Sum pT - TCanvas* c1 = new TCanvas("c1",Form("sumPt dist (%s)", GetTitle()),60,60,1100,700); - c1->Divide(2,2); - c1->cd(1); - TH1F *h1r = new TH1F("hRegionEtvsSumPtMax" , "", binsPtInHist, minJetPtInHist, maxJetPtInHist); - //TH1F *h1r = new TH1F(); - h1r->Divide(fhRegionSumPtMaxVsEt,fhEleadingPt,1,1); - //h1r->Scale( areafactor ); - h1r->SetMarkerStyle(20); - h1r->SetXTitle("P_{T} of Leading Jet (GeV/c)"); - h1r->SetYTitle("P_{T}^{90, max}"); - h1r->DrawCopy("p"); - - c1->cd(2); - TH1F *h2r = new TH1F("hRegionEtvsSumPtMin" , "", binsPtInHist, minJetPtInHist, maxJetPtInHist); - h2r->Divide(fhRegionSumPtMinVsEt,fhEleadingPt,1,1); - //h2r->Scale( areafactor ); - h2r->SetMarkerStyle(20); - h2r->SetXTitle("P_{T} of Leading Jet (GeV/c)"); - h2r->SetYTitle("P_{T}^{90, min}"); - h2r->DrawCopy("p"); - - c1->cd(3); - TH1F *h4r = new TH1F("hRegionEtvsDiffPt" , "", binsPtInHist, minJetPtInHist, maxJetPtInHist); - //TH1F *h41r = new TH1F("hRegForwvsDiffPt" , "", fbinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); - //TH1F *h42r = new TH1F("hRegBackvsDiffPt" , "", fbinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist); - //h41r->Divide(fhRegForwardSumPtVsEt,fhEleadingPt,1,1); - //h42r->Divide(fhRegBackwardSumPtVsEt,fhEleadingPt,1,1); - h4r->Divide(fhRegionAveSumPtVsEt,fhEleadingPt,1,1); - //h4r->Scale(2.); // make average - //h4r->Scale( areafactor ); - h4r->SetYTitle("#DeltaP_{T}^{90}"); - h4r->SetXTitle("P_{T} of Leading Jet (GeV/c)"); - h4r->SetMarkerStyle(20); - h4r->DrawCopy("p"); - - c1->cd(4); - TH1F *h5r = new TH1F("hRegionMultMaxVsEtleading", "", binsPtInHist, minJetPtInHist, maxJetPtInHist); - TH1F *h6r = new TH1F("hRegionMultMinVsEtleading", "", binsPtInHist, minJetPtInHist, maxJetPtInHist); - h5r->Divide(fhRegionMultMaxVsEt,fhEleadingPt,1,1); - h6r->Divide(fhRegionMultMinVsEt,fhEleadingPt,1,1); - //h5r->Scale( areafactor ); - h5r->SetYTitle("N_{Tracks}^{90}"); - h5r->SetXTitle("P_{T} of Leading Jet (GeV/c)"); - h5r->SetMarkerStyle(20); - h5r->DrawCopy("p"); - h6r->SetMarkerStyle(21); - h6r->SetMarkerColor(2); - h6r->SetYTitle("N_{Tracks}^{90}"); - h6r->SetXTitle("P_{T} of Leading Jet (GeV/c)"); - h6r->DrawCopy("p same"); - c1->Update(); - - //Get Normalization - //Double_t xsec = fh1Xsec->GetBinContent(1); - Double_t xsec = fh1Xsec->GetBinContent(1); - Double_t ntrials = fh1Trials->GetBinContent(1); - Double_t normFactor = xsec/ntrials; - if(debug > 1)Printf("xSec %f nTrials %f Norm %f \n",xsec,ntrials,normFactor); - - - //Jet pT distribution - TCanvas* c2 = new TCanvas("c2","Jet Pt dist",160,160,1200,800); - TH1 * copy = 0; - c2->Divide(2,2); - c2->cd(1); - fhEleadingPt->SetMarkerStyle(20); - fhEleadingPt->SetMarkerColor(2); - //if( normFactor > 0.) fhEleadingPt->Scale(normFactor); - //fhEleadingPt->Draw("p"); - copy = fhEleadingPt->DrawCopy("p"); - if( normFactor > 0.) copy->Scale(normFactor); - gPad->SetLogy(); - - c2->cd(2); - Int_t xbin1 = fhdNdEtaPhiDist->GetYaxis()->FindFixBin(minJetPtInHist); - Int_t xbin2 = fhdNdEtaPhiDist->GetYaxis()->FindFixBin(maxJetPtInHist); - TH1D* dNdEtaPhiDistAllJets = fhdNdEtaPhiDist->ProjectionX("dNdEtaPhiDistAllJets",xbin1,xbin2); - dNdEtaPhiDistAllJets->SetMarkerStyle(20); - dNdEtaPhiDistAllJets->SetMarkerColor(2); - dNdEtaPhiDistAllJets->DrawCopy("p"); - gPad->SetLogy(); - - c2->cd(3); - fhNJets->DrawCopy(); - //c2->cd(4); - //fhValidRegion->DrawCopy("p"); - //fhTransRegPartPtDist = (TH1F*)fListOfHistos->At(2); - //fhRegionMultMin = (TH1F*)fListOfHistos->At(3); - //fhMinRegAvePt = (TH1F*)fListOfHistos->At(4); - //fhMinRegSumPt = (TH1F*)fListOfHistos->At(5); - //fhMinRegMaxPtPart = (TH1F*)fListOfHistos->At(6); - //fhMinRegSumPtvsMult = (TH1F*)fListOfHistos->At(7); - c2->Update(); - - //pT distributions - TCanvas* c3 = new TCanvas("c3"," pT dist",160,160,1200,800); - c3->Divide(2,2); - c3->cd(1); - //fhTransRegPartPtDist->SetMarkerStyle(20); - //fhTransRegPartPtDist->SetMarkerColor(2); - //fhTransRegPartPtDist->Scale(areafactor/fhTransRegPartPtDist->GetEntries()); - //fhTransRegPartPtDist->DrawCopy("p"); - //gPad->SetLogy(); - - - c3->cd(2); - fhMinRegSumPt->SetMarkerStyle(20); - fhMinRegSumPt->SetMarkerColor(2); - //fhMinRegSumPt->Scale(areafactor); - fhMinRegSumPt->DrawCopy("p"); - gPad->SetLogy(); - - c3->cd(3); - fhMinRegAvePt->SetMarkerStyle(20); - fhMinRegAvePt->SetMarkerColor(2); - //fhMinRegAvePt->Scale(areafactor); - fhMinRegAvePt->DrawCopy("p"); - gPad->SetLogy(); - - c3->cd(4); - TH1F *h7r = new TH1F("hRegionMultMinVsMult", "", 21, -0.5, 20.5); - h7r->Divide(fhMinRegSumPtvsMult,fhRegionMultMin,1,1); - h7r->SetMarkerStyle(20); - h7r->SetMarkerColor(2); - h7r->DrawCopy("p"); - c3->Update(); - - - - //Save canvas - c1->SaveAs("c1.pdf"); - AliInfo("Canvas 1 saved"); - c2->SaveAs("c2.pdf"); - AliInfo("Canvas 2 saved"); - c3->SaveAs("c3.pdf"); - AliInfo("Canvas 3 saved"); - -} - -//____________________________________________________________________ -void AliHistogramsUE::FillHistogram(const char* name, Double_t fillX){ - - // Fill 1D histogram with double - ((TH1F*)fListOfHistos->FindObject(name))->Fill(fillX); - -} - -//____________________________________________________________________ -void AliHistogramsUE::FillHistogram(const char* name, Int_t fillX){ - - // Fill 1D histogram with integer - ((TH1F*)fListOfHistos->FindObject(name))->Fill(fillX); - -} - -//____________________________________________________________________ -void AliHistogramsUE::FillHistogram(const char* name, Double_t fillX, Double_t fillY){ - - // Case of TH1F with weight or TH2F w/o weight - TObject *obj = fListOfHistos->FindObject(name); - if (obj->InheritsFrom("TH1F")){ - ((TH1F*)fListOfHistos->FindObject(name))->Fill(fillX, fillY); - } else { - ((TH2F*)fListOfHistos->FindObject(name))->Fill(fillX, fillY); - } - - -} - -//____________________________________________________________________ -void AliHistogramsUE::FillHistogram(const char* name, Double_t fillX, Double_t fillY, Double_t weight){ - - // Fill 2D histogram with double and weight - ((TH2F*)fListOfHistos->FindObject(name))->Fill(fillX, fillY, weight); - -} - -//____________________________________________________________________ -void AliHistogramsUE::FillHistogram(const char* name, Double_t fillX, Int_t fillY, Double_t weight){ - - // Fill 2D histogram with integer and weight - ((TH2F*)fListOfHistos->FindObject(name))->Fill(fillX, fillY, weight); - -} - -//____________________________________________________________________ -TObjArray* AliHistogramsUE::GetHistosForPlotting(TString data, TString branches){ - - // Instance filled histos for plotting purpose - printf("Creating histograms ... \n"); - - printf("Reading file: %s\n",data.Data()); - - // Read input files ----------------------------------------- - TFile *fdata = new TFile(data.Data()); - TDirectoryFile *ddata[20]; - TList *ldata[20]; - - TObjArray *arrb=branches.Tokenize(";"); - TIter next(arrb); - TObject *o=0; - Int_t br=0; - while ( (o=next()) ){ - ddata[br] = (TDirectoryFile*)fdata->Get(Form("PWG4_UE%s",o->GetName())); - if(!ddata[br]) printf("ERROR: No histo dir found! \n"); - ldata[br] = (TList*)ddata[br]->Get(Form("histosUE%s",o->GetName())); - printf("Reading branch: %s\n",o->GetName()); - if(!ldata[br]) printf("ERROR: No histo list found! \n"); - br++; - } - - TObjArray *arr=new TObjArray; - - TH1F *hjets[20] = {0,}; // accepted leading jets - TH1F *hnjets[20] = {0,}; // number of accepted jets - TH2F *hetaphi[20] = {0,}; // delta-phi particle-jet correlation - TH2F *hptfull[20] = {0,}; // particle pT all regions vs. jet pT - TH2F *hpttransv[20] = {0,}; // particle pT transv. regions vs. jet pT - TH1F *hmax[20] = {0,}; // sum pT in MAX region - TH1F *hmin[20] = {0,}; // sum pT in MIN region - TH1F *hmultmax[20] = {0,}; // multiplicity in MAX region - TH1F *hmultmin[20] = {0,}; // multiplicity in MIN region - - for (Int_t i =0; iFindObject("fhNJets"); - hnjets[i]->GetXaxis()->SetTitle("Number of jets"); - hnjets[i]->GetYaxis()->SetTitle("1/n_{ev} dN/dN_{jets}"); - hnjets[i]->SetMarkerStyle(20); - hnjets[i]->SetMarkerColor(1+i); - - - //Leading jets ---------------------------------------------- - hjets[i] = (TH1F*) ldata[i]->FindObject("hEleadingPt"); - hjets[i]->GetXaxis()->SetTitle("P_{T} (GeV/c)"); - hjets[i]->GetYaxis()->SetTitle("1/n_{ev} dN/dp_{T} (|#eta<0.5|)"); - hjets[i]->SetMarkerStyle(20); - hjets[i]->SetMarkerColor(1+i); - hjets[i]->SetMinimum(0.1); - hjets[i]->SetMaximum(1000.); - - - //Transverse Region MAX ------------------------------------- - hmax[i] = (TH1F*) ldata[i]->FindObject("hRegionSumPtMaxVsEt"); - if (!hmax[i])AliInfo("Histo not found!!!"); - hmax[i]->GetXaxis()->SetTitle("Leading jet P_{T} (GeV/c)"); - hmax[i]->GetYaxis()->SetTitle("P_{T}^{90,max} (GeV/c)"); - hmax[i]->SetMarkerStyle(20); - hmax[i]->SetMarkerColor(1+i); - hmax[i]->Divide(hjets[i]); // normalize for jet spectrum - hmax[i]->SetMaximum(5.); - - - //Transverse Region MIN ------------------------------------- - hmin[i] = (TH1F*) ldata[i]->FindObject("hRegionSumPtMinVsEt"); - hmin[i]->GetXaxis()->SetTitle("Leading jet P_{T} (GeV/c)"); - hmin[i]->GetYaxis()->SetTitle("P_{T}^{90,min} (GeV/c)"); - hmin[i]->SetMarkerStyle(20); - hmin[i]->SetMarkerColor(1+i); - hmin[i]->SetMaximum(3.); - hmin[i]->Divide(hjets[i]); // normalize for jet spectrum - - - //Multiplicity MAX ------------------------------------------ - hmultmax[i] = (TH1F*) ldata[i]->FindObject("hRegionMultMaxVsEt"); - hmultmax[i]->GetXaxis()->SetTitle("Leading Jet P_{T} (GeV/c)"); - hmultmax[i]->GetYaxis()->SetTitle("N_{ch}^{90,max}"); - hmultmax[i]->SetMarkerStyle(20); - hmultmax[i]->SetMarkerColor(1+i); - hmultmax[i]->SetMaximum(10.); - hmultmax[i]->Divide(hjets[i]); // normalize for jet spectrum - - - //Multiplicity MIN ------------------------------------------ - hmultmin[i] = (TH1F*) ldata[i]->FindObject("hRegionMultMinVsEt"); - hmultmin[i]->GetXaxis()->SetTitle("Leading Jet P_{T} (GeV/c)"); - hmultmin[i]->GetYaxis()->SetTitle("N_{ch}^{90,min}"); - hmultmin[i]->SetMarkerStyle(20); - hmultmin[i]->SetMarkerColor(1+i); - hmultmin[i]->SetMaximum(3.); - hmultmin[i]->Divide(hjets[i]); // normalize for jet spectrum - - - // Phi-correlation with leading jet -------------------------- - hetaphi[i] = (TH2F*) ldata[i]->FindObject("hdNdEtaPhiDist"); - hetaphi[i]->GetXaxis()->SetTitle("#Delta #phi (w.r.t. leading jet)"); - hetaphi[i]->SetMarkerStyle(20); - - - // pT distribution in full region vs. jet pT -------------------------- - hptfull[i] = (TH2F*) ldata[i]->FindObject("hFullRegPartPtDistVsEt"); - hptfull[i]->GetYaxis()->SetTitle("Leading Jet P_{T} (GeV/c)"); - hptfull[i]->GetXaxis()->SetTitle("Track P_{T} (GeV/c)"); - - - // pT distribution in transv region vs. jet pT -------------------------- - hpttransv[i] = (TH2F*) ldata[i]->FindObject("hTransRegPartPtDistVsEt"); - hpttransv[i]->GetYaxis()->SetTitle("Leading Jet P_{T} (GeV/c)"); - hpttransv[i]->GetXaxis()->SetTitle("Track P_{T} (GeV/c)"); - - - // Return Histos - arr->Add(hnjets[i]); //at 0 number of jets - arr->Add(hjets[i]); //at 1 leading jets - arr->Add(hmax[i]); //at 2 sum pT MAX - arr->Add(hmin[i]); //at 3 sumpT MIN - arr->Add(hmultmax[i]); //at 4 multiplicity MAX - arr->Add(hmultmin[i]); //at 5 multiplicity MIN - arr->Add(hetaphi[i]); //at 6 phi correlation - arr->Add(hptfull[i]); //at 7 pT distr in full region - arr->Add(hpttransv[i]); //at 8 pT distr in transv region - - } - return arr; -} - -//_______________________________________________________________________________________ -void AliHistogramsUE::SetStyle(){ - - // Set plotting style - gPad->SetFrameFillColor(0); - gPad->SetFillColor(0); - gPad->SetBorderSize(2); - gPad->SetGridy(); - gPad->SetFrameBorderMode(0); - //gStyle->SetOptStat(0); - gStyle->SetOptTitle(0); - -} - - -//____________________________________________________________________ -TList* AliHistogramsUE::GetHistograms(){ - - // Return list of relevant histograms - return fListOfHistos; - -} - -//____________________________________________________________________ -void AliHistogramsUE::PlotBranchesUE(TString file, TString branches, Double_t minJetProjection){ - - // Function to be called by external macro to plot analysis from different jet branches - - //Count the branches - TObjArray *arr=branches.Tokenize(";"); - TIter next(arr); - TObject *o=0; - Int_t br=0; - while ( (o=next()) ){ - if(o)br++; - } - - - //Canvas - TObjArray *arrC=CreateCanvas(9); - - //Histograms - TObjArray *arrH=GetHistosForPlotting(file.Data(),branches.Data()); - TH1F *hnjets[20] = {0,}; - TH1F *hjets[20] = {0,}; - TH1F *hmax[20] = {0,}; - TH1F *hmin[20] = {0,}; - TH1F *hmultmax[20] = {0,}; - TH1F *hmultmin[20] = {0,}; - TH2F *hetaphi[20] = {0,}; - TH2F *hptfull[20] = {0,}; - TH2F *hpttransv[20] = {0,}; - - for (Int_t i= 0; iAt(9*i)); - hjets[i]=((TH1F*)arrH->At(1+(9*i))); - hmax[i]=((TH1F*)arrH->At(2+(9*i))); - hmin[i]=((TH1F*)arrH->At(3+(9*i))); - hmultmax[i]=((TH1F*)arrH->At(4+(9*i))); - hmultmin[i]=((TH1F*)arrH->At(5+(9*i))); - hetaphi[i]=((TH2F*)arrH->At(6+(9*i))); - hptfull[i]=((TH2F*)arrH->At(7+(9*i))); - hpttransv[i]=((TH2F*)arrH->At(8+(9*i))); - } - - //Define jet-pT range in projections - Int_t binstartprojection = hetaphi[0]->GetYaxis()->FindFixBin(minJetProjection); //be careful... - Int_t binstopprojection = hetaphi[0]->GetYaxis()->GetNbins(); - - Double_t normphi[20]; - - for (Int_t i= 0; iIntegral(binstartprojection,binstopprojection); - hnjets[i]->Scale(1./(hnjets[i]->GetBinWidth(1)*hnjets[i]->GetEntries())); - hjets[i]->Scale(1./(hjets[i]->GetBinWidth(1)*hnjets[i]->GetEntries())); - } - - //LEGENDS - //Legend jets - TLegend *leg=new TLegend(0.5,0.6,0.89,0.89); // for jet spectrum - leg->SetFillColor(0); - leg->SetHeader("Jet Finders:"); - //Legend density - TLegend *legd = new TLegend(0.1077586,0.6016949,0.4971264,0.8919492,NULL,"brNDC"); - legd->SetFillColor(0); - legd->SetHeader("Jet Finders:"); - //Legend pT distributions - TLegend *legp = new TLegend(0.1364943,0.1292373,0.5258621,0.4194915,NULL,"brNDC"); - legp->SetFillColor(0); - legp->SetHeader("Jet Finders:"); - - arr=branches.Tokenize(";"); - TIter next1(arr); - o=0; - Int_t brleg=0; - while ( (o=next1()) ){ - leg->AddEntry(hjets[brleg],Form("UE%s",o->GetName()),"p"); - legd->AddEntry(hjets[brleg],Form("UE%s",o->GetName()),"p"); - legp->AddEntry(hjets[brleg],Form("UE%s",o->GetName()),"p"); - brleg++; - } - - //1) NUMBER OF CLUSTERS - TCanvas *c0=((TCanvas*)arrC->At(0)); - c0->cd(); - SetStyle(); - gPad->SetLogy(); - hnjets[0]->SetMaximum(1.4); - hnjets[0]->Draw("E1"); - for (Int_t i= 1; iDraw("same"); - } - leg->Draw("same"); - - //2) LEADING CLUSTERS pT - TCanvas *c1=((TCanvas*)arrC->At(1)); - c1->cd(); - SetStyle(); - gPad->SetLogy(); - hjets[0]->Draw("E1"); - hjets[0]->SetMaximum(1.4); - for (Int_t i= 1; iDraw("same"); - } - leg->Draw("same"); - - //3) SUM-pT IN MAX REGION - TCanvas *c2=((TCanvas*)arrC->At(2)); - c2->cd(); - SetStyle(); - hmax[0]->Draw("E1"); - for (Int_t i= 1; iDraw("same"); - } - leg->Draw("same"); - - //4) SUM-pT IN MIN REGION - TCanvas *c3=((TCanvas*)arrC->At(3)); - c3->cd(); - SetStyle(); - hmin[0]->GetYaxis()->SetRangeUser(0.,2.5); - hmin[0]->Draw("E1"); - for (Int_t i= 1; iDraw("same"); - } - leg->Draw("same"); - - //5) MULTIPLICITY IN MAX REGION - TCanvas *c4=((TCanvas*)arrC->At(4)); - c4->cd(); - SetStyle(); - hmultmax[0]->GetYaxis()->SetRangeUser(0.,5.); - hmultmax[0]->Draw("E1"); - for (Int_t i= 1; iDraw("same"); - } - leg->Draw("same"); - - //6) MULTIPLICITY IN MIN REGION - TCanvas *c5=((TCanvas*)arrC->At(5)); - c5->cd(); - SetStyle(); - hmultmin[0]->GetYaxis()->SetRangeUser(0.,2.5); - hmultmin[0]->Draw("E1"); - for (Int_t i= 1; iDraw("same"); - } - leg->Draw("same"); - - //7) JET-TRACK CORRELATION - TCanvas *c6=((TCanvas*)arrC->At(6)); - c6->cd(); - SetStyle(); - gPad->SetLogy(); - TH1D *tmpetaphi[20]; - for (Int_t i= 0; iProjectionX(Form("data%d",i),binstartprojection); - tmpetaphi[i]->GetYaxis()->SetTitle("1/n_{lj} dN/d#Delta #phi"); - tmpetaphi[i]->Scale(1./(hetaphi[i]->GetBinWidth(1)*normphi[i])); - tmpetaphi[i]->SetMarkerColor(i+1); - tmpetaphi[i]->GetXaxis()->SetLimits(-3.*TMath::Pi()/2.,TMath::Pi()/2.); - tmpetaphi[i]->GetYaxis()->SetRangeUser(0.5,20.); - if (i==0) tmpetaphi[i]->Draw("E1"); - else tmpetaphi[i]->Draw("same"); - // evaluate mean multiplicity in transverse regions - Double_t err1=0.; - Double_t err2=0.; - Double_t err3=0.; - Double_t mean=(tmpetaphi[i]->IntegralAndError(1,5,err1)+tmpetaphi[i]->IntegralAndError(27,36,err2)+tmpetaphi[i]->IntegralAndError(58,62,err3))/(20.); - err1=TMath::Sqrt(err1*err1+err2*err2+err3*err3)/20.; - Printf("Branch: %d MeanTransvMult: %f err: %f",i,mean,err1); - } - legd->Draw("same"); - - //8) TRACK-pT DISTRIBUTION IN FULL REGION - TCanvas *c7=((TCanvas*)arrC->At(7)); - c7->cd(); - SetStyle(); - gPad->SetLogy(); - gPad->SetLogx(); - gPad->SetTitle("Full region (projection X)"); - TH1D *tmpfull[20]; - for (Int_t i= 0; iProjectionX(Form("full%d",i),binstartprojection); - tmpfull[i]->GetYaxis()->SetTitle("1/n_{lj} dN/dp_{T}"); - tmpfull[i]->Scale(1./(tmpfull[i]->GetBinWidth(1)*normphi[i])); - tmpfull[i]->SetMarkerStyle(20); - tmpfull[i]->SetMarkerColor(i+1); - tmpfull[i]->SetMaximum(100.); - if (i==0)tmpfull[i]->Draw("E1"); - else tmpfull[i]->Draw("same"); - } - legp->Draw("same"); - - //9) TRACK-pT DISTRIBUTION IN TRANSVERSE (MIN+MAX) REGION - TCanvas *c8=((TCanvas*)arrC->At(8)); - c8->cd(); - SetStyle(); - gPad->SetLogy(); - gPad->SetLogx(); - gPad->SetTitle("Transverse regions (projection X)"); - TH1D *tmptransv[20]; - for (Int_t i= 0; iProjectionX(Form("transv%d",i),binstartprojection); - tmptransv[i]->GetYaxis()->SetTitle("1/n_{lj} dN/dp_{T}"); - tmptransv[i]->Scale(1./(tmptransv[i]->GetBinWidth(1)*normphi[i])); - tmptransv[i]->SetMarkerStyle(20); - tmptransv[i]->SetMarkerColor(i+1); - tmptransv[i]->SetMaximum(10.); - if (i==0)tmptransv[i]->Draw("E1"); - else tmptransv[i]->Draw("same"); - } - legp->Draw("same"); -} diff --git a/PWGJE/AliHistogramsUE.h b/PWGJE/AliHistogramsUE.h deleted file mode 100644 index 9913eab40eb..00000000000 --- a/PWGJE/AliHistogramsUE.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef ALIHISTOGRAMSUE_H -#define ALIHISTOGRAMSUE_H - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -//////////////////////////////////////////////// -//--------------------------------------------- -// Class to handle histograms for UE analysis -//--------------------------------------------- -//////////////////////////////////////////////// - -class TH1F; -class TH2F; -class TH1I; -class TObjArray; -class TProfile; -class TTree; -class TVector3; -class AliAnalysisTaskUE; -class AliCFManager; - -class AliHistogramsUE : public TObject - { - public: - AliHistogramsUE(); - AliHistogramsUE(TList * list); - virtual ~AliHistogramsUE() { } - AliHistogramsUE(const AliHistogramsUE &det); - AliHistogramsUE& operator=(const AliHistogramsUE &det); - - TObjArray* CreateCanvas(const Int_t ncanv); - TObjArray* GetHistosForPlotting(TString file, TString branches); - void CreateHistograms(TList* list,Int_t bins, Double_t min, Double_t max, Double_t etacut); - void CreateHistogramsCorrections(TList* list,Int_t bins, Double_t min, Double_t max, Double_t etacut); - void CreateCorrectionsContainer(AliCFManager* cfman,Int_t bins, Double_t min, Double_t max, Double_t etacut, Double_t jetetacut); - void DrawUE(Int_t debug); //to draw final plots (normalized) - void FillHistogram(const char* name,Double_t fillX); //One dimensional - void FillHistogram(const char* name,Int_t fillX); //One dimensional - void FillHistogram(const char* name,Double_t fillX, Double_t fillY); //Two dimensional - void FillHistogram(const char* name,Double_t fillX, Double_t fillY, Double_t weight); //Two dimensional - void FillHistogram(const char* name,Double_t fillX, Int_t fillY, Double_t weight); //Two dimensional - TList* GetHistograms(); - TH1F* GetTrials() {return fh1Trials;} - TProfile* GetXsec() {return fh1Xsec;} - void PlotBranchesUE(TString file, TString branches, Double_t minJetProjection); //TO BE CALLED BY EXTERNAL MACRO !!! - void SetStyle(); - protected: - - private: - - Int_t fBinsPtInHist; // Number of pT bins in histograms - Double_t fMinJetPtInHist; // Minimum jet pT in histograms - Double_t fMaxJetPtInHist; // Maximum jet pT in histograms - Double_t fTrackEtaCut; // Track eta cut - Double_t fJet1EtaCut; // Jet eta cut - TList* fListOfHistos; // Output list of histograms - - - // Histograms - TH1F* fhNJets; //! - TH1F* fhEleadingPt; //! - - TH1F* fhMinRegPtDist; //! - TH1F* fhRegionMultMin; //! - TH1F* fhMinRegAvePt; //! - TH1F* fhMinRegSumPt; //! - TH1F* fhMinRegMaxPtPart; //! - TH1F* fhMinRegSumPtvsMult; //! - - TH2F* fhdNdEtaPhiDist; //! - TH2F* fhdNdEtaPhiDistMC; //! - TH2F* fhFullRegPartPtDistVsEt; //! - TH2F* fhFullRegPartPtDistVsEtMC; //! - TH2F* fhTransRegPartPtDistVsEt; //! - TH2F* fhTransRegPartPtDistVsEtMC; //! - - TH1F* fhRegionSumPtMaxVsEt; //! - TH1I* fhRegionMultMax; //! - TH1F* fhRegionMultMaxVsEt; //! - TH1F* fhRegionSumPtMinVsEt; //! - TH1F* fhRegionMultMinVsEt; //! - TH1F* fhRegionAveSumPtVsEt; //! - TH1F* fhRegionDiffSumPtVsEt; //! - - TH1F* fhRegionAvePartPtMaxVsEt; //! - TH1F* fhRegionAvePartPtMinVsEt; //! - TH1F* fhRegionMaxPartPtMaxVsEt; //! - - TH2F* fhRegForwardMult; //! - TH2F* fhRegForwardSumPtvsMult; //! - TH2F* fhRegBackwardMult; //! - TH2F* fhRegBackwardSumPtvsMult; //! - TH2F* fhRegForwardPartPtDistVsEt; //! - TH2F* fhRegForwardPartPtDistVsEtMC; //! - TH2F* fhRegBackwardPartPtDistVsEt; //! - TH2F* fhRegBackwardPartPtDistVsEtMC; //! - TH2F* fhRegTransMult; //! - TH2F* fhRegTransSumPtVsMult; //! - TH2F* fhMinRegSumPtJetPtBin; //! - TH2F* fhMaxRegSumPtJetPtBin; //! - TH1F* fhVertexMult; //! - - TProfile* fh1Xsec; //! - TH1F* fh1Trials; //! - - //For corrections - TH2F *fhDCAxy; //! - TH2F *fhDCAxyPrimary; //! - - ClassDef( AliHistogramsUE, 0 ); // Class to manage histograms in UE analysis - }; - -#endif - - diff --git a/PWGJE/AliJetSpectrumUnfolding.cxx b/PWGJE/AliJetSpectrumUnfolding.cxx deleted file mode 100644 index 3e758d54890..00000000000 --- a/PWGJE/AliJetSpectrumUnfolding.cxx +++ /dev/null @@ -1,1213 +0,0 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ -// -// This class is used to store correlation maps, generated and reconstructed data of the jet spectrum -// It also contains functions to correct the spectrum using the bayesian unfolding -// - -#include "AliJetSpectrumUnfolding.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -ClassImp(AliJetSpectrumUnfolding) - -const Int_t AliJetSpectrumUnfolding::fgkNBINSE = 50; -const Int_t AliJetSpectrumUnfolding::fgkNBINSZ = 50; -const Int_t AliJetSpectrumUnfolding::fgkNEVENTS = 500000; -const Double_t AliJetSpectrumUnfolding::fgkaxisLowerLimitE = 0.; -const Double_t AliJetSpectrumUnfolding::fgkaxisLowerLimitZ = 0.; -const Double_t AliJetSpectrumUnfolding::fgkaxisUpperLimitE = 250.; -const Double_t AliJetSpectrumUnfolding::fgkaxisUpperLimitZ = 1.; - -Float_t AliJetSpectrumUnfolding::fgBayesianSmoothing = 1; // smoothing parameter (0 = no smoothing) -Int_t AliJetSpectrumUnfolding::fgBayesianIterations = 100; // number of iterations in Bayesian method - -//____________________________________________________________________ - -AliJetSpectrumUnfolding::AliJetSpectrumUnfolding() : - TNamed(), fCurrentRec(0), fCurrentCorrelation(0), fRecSpectrum(0), fGenSpectrum(0), - fUnfSpectrum(0), fCorrelation(0), fLastChi2MC(0), fLastChi2MCLimit(0), fLastChi2Residuals(0), fRatioAverage(0) -{ - // - // default constructor - // - - fGenSpectrum = 0; - fRecSpectrum = 0; - fUnfSpectrum = 0; - fCorrelation = 0; -} - -//____________________________________________________________________ -AliJetSpectrumUnfolding::AliJetSpectrumUnfolding(const Char_t* name, const Char_t* title) : - TNamed(name, title), fCurrentRec(0), fCurrentCorrelation(0), fRecSpectrum(0), - fGenSpectrum(0), fUnfSpectrum(0), fCorrelation(0), fLastChi2MC(0), fLastChi2MCLimit(0), fLastChi2Residuals(0), fRatioAverage(0) -{ - // - // named constructor - // - - // do not add this hists to the directory - Bool_t oldStatus = TH1::AddDirectoryStatus(); - TH1::AddDirectory(kFALSE); - fRecSpectrum = new TH2F("fRecSpectrum", "Reconstructed Spectrum;E^{jet}_{rec} [GeV];z^{lp}_{rec}", - fgkNBINSE, fgkaxisLowerLimitE, fgkaxisUpperLimitE, - fgkNBINSZ, fgkaxisLowerLimitZ, fgkaxisUpperLimitZ); - fGenSpectrum = new TH2F("fGenSpectrum", "Generated Spectrum;E^{jet}_{gen} [GeV];z^{lp}_{gen}", - fgkNBINSE, fgkaxisLowerLimitE, fgkaxisUpperLimitE, - fgkNBINSZ, fgkaxisLowerLimitZ, fgkaxisUpperLimitZ); - fUnfSpectrum = new TH2F("fUnfSpectrum", "Unfolded Spectrum;E^{jet} [GeV];z^{lp}", - fgkNBINSE, fgkaxisLowerLimitE, fgkaxisUpperLimitE, - fgkNBINSZ, fgkaxisLowerLimitZ, fgkaxisUpperLimitZ); - - const Int_t nbin[4]={fgkNBINSE, fgkNBINSE, fgkNBINSZ, fgkNBINSZ}; - //arrays for bin limits - Double_t lowEdge[4] = {fgkaxisLowerLimitE, fgkaxisLowerLimitE, fgkaxisLowerLimitZ, fgkaxisLowerLimitZ}; - Double_t upEdge[4] = {fgkaxisUpperLimitE, fgkaxisUpperLimitE, fgkaxisUpperLimitZ, fgkaxisUpperLimitZ}; - - fCorrelation = new THnSparseF("fCorrelation", "Correlation Function", 4, nbin, lowEdge, upEdge); - - TH1::AddDirectory(oldStatus); -} - -//____________________________________________________________________ -AliJetSpectrumUnfolding::~AliJetSpectrumUnfolding() -{ - // - // Destructor - // - - if (fGenSpectrum) - delete fGenSpectrum; - fGenSpectrum = 0; - - if (fRecSpectrum) - delete fRecSpectrum; - fRecSpectrum = 0; - - if (fUnfSpectrum) - delete fUnfSpectrum; - fUnfSpectrum = 0; - - if (fCorrelation) - delete fCorrelation; - fCorrelation = 0; - -} - -//____________________________________________________________________ -Long64_t AliJetSpectrumUnfolding::Merge(TCollection* list) -{ - // Merge a list of AliJetSpectrumUnfolding objects with this (needed for - // PROOF). - // Returns the number of merged objects (including this). - - if (!list) - return 0; - - if (list->IsEmpty()) - return 1; - - TIterator* iter = list->MakeIterator(); - TObject* obj; - - // collections of all histograms - TList collections[4]; - - Int_t count = 0; - while ((obj = iter->Next())) { - - AliJetSpectrumUnfolding* entry = dynamic_cast (obj); - if (entry == 0) - continue; - - collections[0].Add(entry->fGenSpectrum); - collections[1].Add(entry->fRecSpectrum); - collections[2].Add(entry->fUnfSpectrum); - collections[3].Add(entry->fCorrelation); - - count++; - } - - fGenSpectrum->Merge(&collections[0]); - fRecSpectrum->Merge(&collections[1]); - fUnfSpectrum->Merge(&collections[2]); - fCorrelation->Merge(&collections[3]); - - delete iter; - - return count+1; -} - -//____________________________________________________________________ -Bool_t AliJetSpectrumUnfolding::LoadHistograms(const Char_t* dir) -{ - // - // loads the histograms from a file - // if dir is empty a directory with the name of this object is taken (like in SaveHistogram) - // - - if (!dir) - dir = GetName(); - - if (!gDirectory->cd(dir)) - return kFALSE; - - Bool_t success = kTRUE; - - // store old histograms to delete them later - TList oldHistograms; - oldHistograms.SetOwner(1); - - if (fGenSpectrum) oldHistograms.Add(fGenSpectrum); - else return kFALSE; - if (fRecSpectrum) oldHistograms.Add(fRecSpectrum); - else return kFALSE; - if (fUnfSpectrum) oldHistograms.Add(fUnfSpectrum); - else return kFALSE; - if (fCorrelation) oldHistograms.Add(fCorrelation); - else return kFALSE; - - // load new histograms - fGenSpectrum = dynamic_cast (gDirectory->Get(fGenSpectrum->GetName())); - if (!fGenSpectrum) - success = kFALSE; - - fRecSpectrum = dynamic_cast (gDirectory->Get(fRecSpectrum->GetName())); - if (!fRecSpectrum) - success = kFALSE; - - fUnfSpectrum = dynamic_cast (gDirectory->Get(fUnfSpectrum->GetName())); - if (!fUnfSpectrum) - success = kFALSE; - - fCorrelation = dynamic_cast (gDirectory->Get(fCorrelation->GetName())); - if (!fCorrelation) - success = kFALSE; - - gDirectory->cd(".."); - - // delete old histograms - oldHistograms.Delete(); - - return success; -} - -//____________________________________________________________________ -void AliJetSpectrumUnfolding::SaveHistograms() -{ - // - // saves the histograms - // - - gDirectory->mkdir(GetName()); - gDirectory->cd(GetName()); - - if (fGenSpectrum) - fGenSpectrum->Write(); - - if (fRecSpectrum) - fRecSpectrum->Write(); - - if (fUnfSpectrum) - fUnfSpectrum->Write(); - - if (fCorrelation) - fCorrelation->Write(); - - gDirectory->cd(".."); -} - -//____________________________________________________________________ -void AliJetSpectrumUnfolding::SetupCurrentHists(Bool_t createBigBin) -{ - // - // resets fUnfSpectrum - // - - fUnfSpectrum->Reset(); - fUnfSpectrum->Sumw2(); - - fCurrentRec = (TH2F*)fRecSpectrum->Clone("fCurrentRec"); - fCurrentRec->Sumw2(); - - fCurrentCorrelation = (THnSparseF*)fCorrelation->Clone("fCurrentCorrelation"); - fCurrentCorrelation->Sumw2(); - - Printf("Correlation Matrix has %d filled bins", (Int_t)fCurrentCorrelation->GetNbins()); - - if (createBigBin) - { - Int_t maxBinE = 0, maxBinZ = 0; - Float_t maxE = 0, maxZ = 0; - for (Int_t me=1; me<=fCurrentRec->GetNbinsX(); me++) - for (Int_t mz=1; mz<=fCurrentRec->GetNbinsY(); mz++) - { - if (fCurrentRec->GetBinContent(me,mz) <= 5 && me>fgkNBINSE/2 && mz>fgkNBINSZ/2) - { - maxBinE = me; - maxBinZ = mz; - maxE = fCurrentRec->GetXaxis()->GetBinCenter(me); - maxZ = fCurrentRec->GetYaxis()->GetBinCenter(mz); - break; - } - } - - if (maxBinE > 0 || maxBinZ > 0) - { - printf("Bin limit in measured spectrum is e = %d and z = %d.\n", maxBinE, maxBinZ); - fCurrentRec->SetBinContent(maxBinE, maxBinZ, fCurrentRec->Integral(maxBinE, fCurrentRec->GetNbinsX(), maxBinZ, fCurrentRec->GetNbinsY())); - for (Int_t me=maxBinE+1; me<=fCurrentRec->GetNbinsX(); me++) - for (Int_t mz=maxBinZ+1; mz<=fCurrentRec->GetNbinsY(); mz++) - { - fCurrentRec->SetBinContent(me, mz, 0); - fCurrentRec->SetBinError(me, mz, 0); - } - // the error is set to sqrt(N), better solution possible?, sum of relative errors of all contributions??? - fCurrentRec->SetBinError(maxBinE, maxBinZ, TMath::Sqrt(fCurrentRec->GetBinContent(maxBinE, maxBinZ))); - - printf("This bin has now %f +- %f entries\n", fCurrentRec->GetBinContent(maxBinE, maxBinZ), fCurrentRec->GetBinError(maxBinE, maxBinZ)); - - /* for (Int_t te=1; te<=NBINSE; te++) - { - for (Int_t tz=1; tz<=NBINSZ; tz++) - { - Int_t binMin[4] = {te, maxBinE, tz, maxBinZ}; - Int_t binMax[4] = {NBINSE, NBINSE, NBINSZ, NBINSZ}; - Float_t sum=0; - for (Int_t ite=te; ite<=NBINSE; ite++) - for (Int_t itz=tz; itz<=NBINSZ; itz++) - for (Int_t ime=maxBinE; ime<=NBINSE; ime++) - for (Int_t imz=maxBinZ; imz<=NBINSZ; imz++) - { - Int_t bin[4] = {ite, ime, itz, imz}; - sum += fCurrentCorrelation->GetBinContent(bin); - } - fCurrentCorrelation->SetBinContent(binMin, sum); - fCurrentCorrelation->SetBinError(binMin, TMath::Sqrt(fCurrentCorrelation->GetBinContent(binMin))); - printf("create big bin1, nbins = %d, te = %d, tz = %d\n", NBINSE, te, tz); - for (Int_t me=maxBinE; me<=NBINSE; me++) - { - for (Int_t mz=maxBinZ; mz<=NBINSZ; mz++) - { - Int_t bin[4] = {te, me, tz, mz}; - fCurrentCorrelation->SetBinContent(bin, 0.); - fCurrentCorrelation->SetBinError(bin, 0.); - printf("create big bin2\n"); - } - } - } - }*/ - - for(Int_t idx = 0; idx<=fCurrentCorrelation->GetNbins(); idx++) - { - Int_t bin[4]; - Float_t binContent = fCurrentCorrelation->GetBinContent(idx,bin); - Float_t binError = fCurrentCorrelation->GetBinError(idx); - Int_t binMin[4] = {bin[0], maxBinE, bin[2], maxBinZ}; - if ( (bin[1]>maxBinE && bin[1]<=fgkNBINSE) && (bin[3]>maxBinZ && bin[3]<=fgkNBINSZ) ) - { - fCurrentCorrelation->SetBinContent(binMin, binContent + fCurrentCorrelation->GetBinContent(binMin)); - fCurrentCorrelation->SetBinError(binMin, binError + TMath::Sqrt(fCurrentCorrelation->GetBinContent(binMin))); - fCurrentCorrelation->SetBinContent(bin, 0.); - fCurrentCorrelation->SetBinError(bin, 0.); - } - printf("create big bin1, nbins = %d, te = %d, tz = %d\n", fgkNBINSE, bin[0], bin[1]); - } - - printf("Adjusted correlation matrix!\n"); - } - } // end Create Big Bin - -} - -//____________________________________________________________________ -void AliJetSpectrumUnfolding::SetBayesianParameters(Float_t smoothing, Int_t nIterations) -{ - // - // sets the parameters for Bayesian unfolding - // - - fgBayesianSmoothing = smoothing; - fgBayesianIterations = nIterations; - - printf("AliJetSpectrumUnfolding::SetBayesianParameters --> Paramaters set to %d iterations with smoothing %f\n", fgBayesianIterations, fgBayesianSmoothing); -} - -//____________________________________________________________________ -void AliJetSpectrumUnfolding::NormalizeToBinWidth(TH2* const hist) -{ - // - // normalizes a 2-d histogram to its bin width (x width * y width) - // - - for (Int_t i=1; i<=hist->GetNbinsX(); i++) - for (Int_t j=1; j<=hist->GetNbinsY(); j++) - { - Double_t factor = hist->GetXaxis()->GetBinWidth(i) * hist->GetYaxis()->GetBinWidth(j); - hist->SetBinContent(i, j, hist->GetBinContent(i, j) / factor); - hist->SetBinError(i, j, hist->GetBinError(i, j) / factor); - } -} - -//____________________________________________________________________ -void AliJetSpectrumUnfolding::DrawHistograms() -{ - // - // draws the histograms of this class - // - - gStyle->SetPalette(1); - - TCanvas* canvas1 = new TCanvas("fRecSpectrum", "fRecSpectrum", 900, 600); - gPad->SetLogz(); - fRecSpectrum->DrawCopy("COLZ"); - - TCanvas* canvas2 = new TCanvas("fGenSpectrum", "fGenSpectrum", 900, 600); - canvas2->cd(); - gPad->SetLogz(); - fGenSpectrum->DrawCopy("COLZ"); - - TCanvas* canvas3 = new TCanvas("fUnfSpectrum", "fUnfSpectrum", 900, 600); - canvas3->cd(); - gPad->SetLogz(); - fUnfSpectrum->DrawCopy("COLZ"); - - TCanvas* canvas4 = new TCanvas("fCorrelation", "fCorrelation", 500, 500); - canvas1->Divide(2); - - canvas4->cd(1); - gPad->SetLogz(); - TH2D* h0 = fCorrelation->Projection(1,0); - h0->SetXTitle("E^{jet}_{gen} [GeV]"); - h0->SetYTitle("E^{jet}_{rec} [GeV]"); - h0->SetTitle("Projection: Jet Energy"); - h0->DrawCopy("colz"); - - canvas1->cd(2); - gPad->SetLogz(); - TH2D* h1 = fCorrelation->Projection(3,2); - h1->SetXTitle("z^{lp}_{gen}"); - h1->SetYTitle("z^{lp}_{rec}"); - h1->SetTitle("Projection: Leading Particle Fragmentation"); - h1->DrawCopy("colz"); - -} - -//____________________________________________________________________ -void AliJetSpectrumUnfolding::DrawComparison(const char* name, TH2* const genHist) -{ - // - // Draws the copmparison plot (gen,rec and unfolded distributions - // - - if (fUnfSpectrum->Integral() == 0) - { - printf("ERROR. Unfolded histogram is empty\n"); - return; - } - - //regain measured distribution used for unfolding, because the bins were modified in SetupCurrentHists - //in create big bin - fCurrentRec = (TH2F*)fRecSpectrum->Clone(); - fCurrentRec->Sumw2(); - fCurrentRec->Scale(1.0 / fCurrentRec->Integral()); - - // normalize unfolded result to 1 - fUnfSpectrum->Scale(1.0 / fUnfSpectrum->Integral()); - - // find bin with <= 100 entries. this is used as limit for the chi2 calculation - Int_t mcBinLimitE = 0, mcBinLimitZ = 0; - for (Int_t i=0; iGetNbinsX(); ++i) - for (Int_t j=0; jGetNbinsY(); ++j) - { - if (genHist->GetBinContent(i,j) > 100) - { - mcBinLimitE = i; - mcBinLimitZ = j; - } - else - break; - } - Printf("AliJetSpectrumUnfolding::DrawComparison: Gen bin limit is (x,y) = (%d,%d)", mcBinLimitE,mcBinLimitZ); - - // scale to 1 true spectrum - genHist->Sumw2(); - genHist->Scale(1.0 / genHist->Integral()); - - // calculate residual - // for that we convolute the response matrix with the gathered result - TH2* tmpRecRecorrected = (TH2*) fUnfSpectrum->Clone("tmpRecRecorrected"); - TH2* convoluted = CalculateRecSpectrum(tmpRecRecorrected); - if (convoluted->Integral() > 0) - convoluted->Scale(1.0 / convoluted->Integral()); - else - printf("ERROR: convoluted is empty. Something went wrong calculating the convoluted histogram.\n"); - - TH2* residual = (TH2*) convoluted->Clone("residual"); - residual->SetTitle("(R#otimesUnfolded - Reconstructed)/Reconstructed;E^{jet} [GeV]; z^{lp}"); - - fCurrentRec->Scale(1./fCurrentRec->Integral()); - residual->Add(fCurrentRec, -1); - //residual->Divide(residual, fCurrentRec, 1, 1, "B"); - - // draw canvas - TCanvas* canvas1 = new TCanvas(name, name, 1000, 1000); - canvas1->Divide(2, 3); - - Int_t style = 1; - const Int_t nRGBs = 5; - const Int_t nCont = 500; - - Double_t stops[nRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; - Double_t red[nRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 }; - Double_t green[nRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 }; - Double_t blue[nRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 }; - TColor::CreateGradientColorTable(nRGBs, stops, red, green, blue, nCont); - gStyle->SetNumberContours(nCont); - - canvas1->cd(1); - gStyle->SetPalette(style); - gPad->SetLogz(); - genHist->SetTitle("Generated Spectrum;E^{jet}_{gen} [GeV];z^{lp}"); - genHist->SetStats(0); - genHist->DrawCopy("colz"); - - canvas1->cd(2); - gStyle->SetPalette(style); - gPad->SetLogz(); - fUnfSpectrum->SetStats(0); - fUnfSpectrum->DrawCopy("colz"); - - canvas1->cd(3); - gStyle->SetPalette(style); - gPad->SetLogz(); - fCurrentRec->SetTitle(fRecSpectrum->GetTitle()); - fCurrentRec->SetStats(0); - fCurrentRec->DrawCopy("colz"); - - canvas1->cd(4); - gStyle->SetPalette(style); - gPad->SetLogy(); - TH1D* projGenX = genHist->ProjectionX(); - projGenX->SetTitle("Projection: Jet Energy; E^{jet} [GeV]"); - TH1D* projUnfX = fUnfSpectrum->ProjectionX(); - TH1D* projRecX = fCurrentRec->ProjectionX(); - projGenX->SetStats(0); - projRecX->SetStats(0); - projUnfX->SetStats(0); - projGenX->SetLineColor(8); - projRecX->SetLineColor(2); - projGenX->DrawCopy(); - projUnfX->DrawCopy("same"); - projRecX->DrawCopy("same"); - - TLegend* legend = new TLegend(0.6, 0.85, 0.98, 0.98); - legend->AddEntry(projGenX, "Generated Spectrum"); - legend->AddEntry(projUnfX, "Unfolded Spectrum"); - legend->AddEntry(projRecX, "Reconstructed Spectrum"); - //legend->SetFillColor(0); - legend->Draw("same"); - - canvas1->cd(5); - gPad->SetLogy(); - gStyle->SetPalette(style); - TH1D* projGenY = genHist->ProjectionY(); - projGenY->SetTitle("Projection: Leading Particle Fragmentation; z^{lp}"); - TH1D* projUnfY = fUnfSpectrum->ProjectionY(); - TH1D* projRecY = fCurrentRec->ProjectionY(); - projGenY->SetStats(0); - projRecY->SetStats(0); - projUnfY->SetStats(0); - projGenY->SetLineColor(8); - projRecY->SetLineColor(2); - projGenY->DrawCopy(); - projUnfY->DrawCopy("same"); - projRecY->DrawCopy("same"); - - TLegend* legend1 = new TLegend(0.6, 0.85, 0.98, 0.98); - legend1->AddEntry(projGenY, "Generated Spectrum"); - legend1->AddEntry(projUnfY, "Unfolded Spectrum"); - legend1->AddEntry(projRecY, "Recontructed Spectrum"); - //legend1->SetFillColor(0); - legend1->Draw("same"); - - // Draw residuals - canvas1->cd(6); - gStyle->SetPalette(style); - gPad->SetLogz(); - residual->SetStats(0); - residual->DrawCopy("colz"); - - canvas1->SaveAs(Form("%s.png", canvas1->GetName())); -} - - -//____________________________________________________________________ -void AliJetSpectrumUnfolding::ApplyBayesianMethod(Float_t regPar, Int_t nIterations, TH2* const initialConditions, Bool_t determineError) -{ - // - // correct spectrum using bayesian unfolding - // - - // initialize seed with current time - gRandom->SetSeed(0); - - printf("seting up current arrays and histograms...\n"); - SetupCurrentHists(kFALSE); // kFALSE to not create big bin - - // normalize Correlation Map to convert number of events into probabilities - /*for (Int_t te=1; te<=NBINSE; te++) - for (Int_t tz=1; tz<=NBINSZ; tz++) - { - Int_t bin[4]; - Float_t sum=0.; - for (Int_t me = 1; me<=NBINSE; me++) - for (Int_t mz = 1; mz<=NBINSZ; mz++) - { - bin[0] = te; bin[1] = me; - bin[2] = tz; bin[3] = mz; - sum += fCurrentCorrelation->GetBinContent(bin); - } - if (sum > 0.) - for (Int_t me = 1; me<=NBINSE; me++) - for (Int_t mz = 1; mz<=NBINSZ; mz++) - { - bin[0] = te; bin[1] = me; - bin[2] = tz; bin[3] = mz; - fCurrentCorrelation->SetBinContent(bin, fCurrentCorrelation->GetBinContent(bin)/sum); - fCurrentCorrelation->SetBinError(bin, fCurrentCorrelation->GetBinError(bin)/sum); - } - }*/ - Float_t sum[fgkNBINSE+2][fgkNBINSZ+2]; - memset(sum,0,sizeof(Float_t)*(fgkNBINSE+2)*(fgkNBINSZ+2)); - - for (Int_t idx=0; idx<=fCurrentCorrelation->GetNbins(); idx++) - { - Int_t bin[4]; - Float_t binContent = fCurrentCorrelation->GetBinContent(idx, bin); - if ( (bin[1]>0 && bin[1]<=fgkNBINSE) && (bin[3]>0 && bin[3]<=fgkNBINSZ) ) - sum[bin[0]][bin[2]] += binContent; - } - - for (Int_t idx=0; idx<=fCurrentCorrelation->GetNbins(); idx++) - { - Int_t bin[4]; - Float_t binContent = fCurrentCorrelation->GetBinContent(idx, bin); - Float_t binError = fCurrentCorrelation->GetBinError(bin); - if (sum[bin[0]][bin[2]]>0 && (bin[1]>0 && bin[1]<=fgkNBINSE) && - (bin[3]>0 && bin[3]<=fgkNBINSZ) && (bin[0]>0 && bin[0]<=fgkNBINSE) && (bin[2]>0 && bin[2]<=fgkNBINSZ) ) - { - fCurrentCorrelation->SetBinContent(bin, binContent/sum[bin[0]][bin[2]]); - fCurrentCorrelation->SetBinError(bin, binError/sum[bin[0]][bin[2]]); - } - } - - printf("calling UnfoldWithBayesian\n"); - Int_t success = UnfoldWithBayesian(fCurrentCorrelation, fCurrentRec, initialConditions, fUnfSpectrum, regPar, nIterations, kFALSE); - - if ( success != 0) - return; - - if (!determineError) - { - Printf("AliJetSpectrumUnfolding::ApplyBayesianMethod: WARNING: No errors calculated."); - return; - } - - // evaluate errors, this is done by randomizing the measured spectrum following Poission statistics - // this (new) measured spectrum is then unfolded and the different to the result from the "real" measured - // spectrum calculated. This is performed N times and the maximum difference is taken as the systematic - // error of the unfolding method itself. - - TH2* maxError = (TH2*) fUnfSpectrum->Clone("maxError"); - maxError->Reset(); - - TH2* normalizedResult = (TH2*) fUnfSpectrum->Clone("normalizedResult"); - normalizedResult->Scale(1.0 / normalizedResult->Integral()); - - const Int_t kErrorIterations = 20; - - printf("Spectrum unfolded. Determining error (%d iterations)...\n", kErrorIterations); - - TH2* randomized = (TH2*) fCurrentRec->Clone("randomized"); - TH2* result2 = (TH2*) fUnfSpectrum->Clone("result2"); - for (Int_t n=0; nGetNbinsX(); x++) - for (Int_t y=1; y<=randomized->GetNbinsY(); y++) - { - Float_t randomValue = fCurrentRec->GetBinContent(x,y); - TF1* poisson = new TF1("poisson", "TMath::Poisson(x,[0])",randomValue*0.25, randomValue*1.25); - poisson->SetParameters(randomValue,0.); - randomValue = poisson->GetRandom(); - //printf("%e --> %e\n", fCurrentRec->GetBinContent(x,y), (Double_t)randomValue); - randomized->SetBinContent(x, y, randomValue); - delete poisson; - } - - result2->Reset(); - if (UnfoldWithBayesian(fCurrentCorrelation, randomized, initialConditions, result2, regPar, nIterations) != 0) - return; - - result2->Scale(1.0 / result2->Integral()); - - // calculate ratio - result2->Divide(normalizedResult); - - //new TCanvas; result2->DrawCopy("HIST"); - - // find max. deviation - for (Int_t i=1; i<=result2->GetNbinsX(); i++) - for (Int_t j=1; j<=result2->GetNbinsY(); j++) - maxError->SetBinContent(i, j, TMath::Max(maxError->GetBinContent(i,j), TMath::Abs(1 - result2->GetBinContent(i,j)))); - } - delete randomized; - delete result2; - - for (Int_t i=1; i<=fUnfSpectrum->GetNbinsX(); i++) - for (Int_t j=1; j<=fUnfSpectrum->GetNbinsY(); j++) - fUnfSpectrum->SetBinError(i, j, fUnfSpectrum->GetBinError(i,j) + maxError->GetBinContent(i,j)*fUnfSpectrum->GetBinContent(i,j)); - - delete maxError; - delete normalizedResult; -} - -//____________________________________________________________________ -Int_t AliJetSpectrumUnfolding::UnfoldWithBayesian(THnSparseF* const correlation, TH2* const measured, TH2* const initialConditions, TH2* const aResult, Float_t regPar, Int_t nIterations, Bool_t calculateErrors) -{ - // - // unfolds a spectrum - // - - if (measured->Integral() <= 0) - { - Printf("AliJetSpectrumUnfolding::UnfoldWithBayesian: ERROR: The measured spectrum is empty"); - return 1; - } - const Int_t nFillesBins = correlation->GetNbins(); - const Int_t kStartBin = 1; - - const Int_t kMaxTZ = fgkNBINSZ; // max true axis fragmentation function - const Int_t kMaxMZ = fgkNBINSZ; // max measured axis fragmentation function - const Int_t kMaxTE = fgkNBINSE; // max true axis energy - const Int_t kMaxME = fgkNBINSE; // max measured axis energy - - printf("NbinsE=%d - NbinsZ=%d\n", fgkNBINSE, fgkNBINSZ); - - // store information in arrays, to increase processing speed - Double_t measuredCopy[kMaxME+1][kMaxMZ+1]; - Double_t prior[kMaxTE+1][kMaxTZ+1]; - Double_t errors[kMaxTE+1][kMaxTZ+1]; - Double_t result[kMaxTE+1][kMaxTZ+1]; - - THnSparseF *inverseCorrelation; - inverseCorrelation = (THnSparseF*)correlation->Clone("inverseCorrelation"); - inverseCorrelation->Reset(); - - Float_t inputDistIntegral = 1; - if (initialConditions) - { - printf("Using different starting conditions...\n"); - inputDistIntegral = initialConditions->Integral(); - } - Float_t measuredIntegral = measured->Integral(); - for (Int_t me=1; me<=kMaxME; me++) - for (Int_t mz=1; mz<=kMaxMZ; mz++) - { - // normalization of the measured spectrum - measuredCopy[me][mz] = measured->GetBinContent(me,mz) / measuredIntegral; - errors[me][mz] = measured->GetBinError(me, mz) / measuredIntegral; - // pick prior distribution and normalize it - if (initialConditions) - prior[me][mz] = initialConditions->GetBinContent(me,mz) / inputDistIntegral; - else - prior[me][mz] = measured->GetBinContent(me,mz) / measuredIntegral; - } - - // unfold... - for (Int_t i=0; iGetBinContent(bin)*prior[te][tz]; - } - if (norm > 0) - for (Int_t te = kStartBin; te <= kMaxTE; te++) - for (Int_t tz = kStartBin; tz <= kMaxTZ; tz++) - { - Int_t bin[4] = {te, me, tz, mz}; - inverseCorrelation->SetBinContent(bin, correlation->GetBinContent(bin)*prior[te][tz]/norm ); - } - //else - // inverse response set to '0' wich has been already done in line 2069 - }*/ - inverseCorrelation->Reset(); - Float_t norm[kMaxTE+2][kMaxTZ+2]; - for (Int_t te=0; te<(kMaxTE+2); te++) - for (Int_t tz=0; tz<(kMaxTZ+2); tz++) - norm[te][tz]=0; - for (Int_t idx=0; idx<=correlation->GetNbins(); idx++) - { - Int_t bin[4]; - Float_t binContent = correlation->GetBinContent(idx, bin); - if (bin[1]>0 && bin[1]<=fgkNBINSE && bin[3]>0 && bin[3]<=fgkNBINSZ && - bin[0]>0 && bin[0]<=fgkNBINSE && bin[2]>0 && bin[2]<=fgkNBINSZ) - norm[bin[1]][bin[3]] += binContent*prior[bin[0]][bin[2]]; - } - Float_t chi2Measured=0, diff; - for (Int_t idx=0; idx<=correlation->GetNbins(); idx++) - { - Int_t bin[4]; - Float_t binContent = correlation->GetBinContent(idx, bin); - if (norm[bin[1]][bin[3]]>0 && bin[1]>0 && bin[1]<=fgkNBINSE && - bin[3]>0 && bin[3]<=fgkNBINSZ && bin[0]>0 && bin[2]>0 && bin[0]<=fgkNBINSE && bin[2]<=fgkNBINSZ) - { - inverseCorrelation->SetBinContent(bin, binContent*prior[bin[0]][bin[2]]/norm[bin[1]][bin[3]]); - if (errors[bin[1]][bin[3]]>0) - { - diff = ((measuredCopy[bin[1]][bin[3]]-norm[bin[1]][bin[3]])/(errors[bin[1]][bin[3]])); - chi2Measured += diff*diff; - } - } - } - - // calculate "generated" spectrum - for (Int_t te = kStartBin; te<=kMaxTE; te++) - for (Int_t tz = kStartBin; tz<=kMaxTZ; tz++) - { - Float_t value = 0; - for (Int_t me=1; me<=kMaxME; me++) - for (Int_t mz=1; mz<=kMaxMZ; mz++) - { - Int_t bin[4] = {te, me, tz, mz}; - value += inverseCorrelation->GetBinContent(bin)*measuredCopy[me][mz]; - } - result[te][tz] = value; - //printf("%e\n", result[te][tz]); - } - - // regularization (simple smoothing) - Float_t chi2LastIter = 0; - for (Int_t te=kStartBin; te<=kMaxTE; te++) - for (Int_t tz=kStartBin; tz<=kMaxTZ; tz++) - { - Float_t newValue = 0; - // 0 bin excluded from smoothing - if (( te >(kStartBin+1) && te<(kMaxTE-1) ) && ( tz > (kStartBin+1) && tz<(kMaxTZ-1) )) - { - Float_t average = ((result[te-1][tz-1] + result[te-1][tz] + result[te-1][tz+1])+(result[te][tz-1] + result[te][tz] + result[te][tz+1])+(result[te+1][tz-1] + result[te+1][tz] + result[te+1][tz+1]))/9.; - - // weight the average with the regularization parameter - newValue = (1 - regPar) * result[te][tz] + regPar * average; - } - else - newValue = result[te][tz]; - if (prior[te][tz]>1.e-5) - { - diff = ((prior[te][tz]-newValue)/prior[te][tz]); - chi2LastIter = diff*diff; - } - prior[te][tz] = newValue; - } - //printf(" iteration %d - chi2LastIter = %e - chi2Measured = %e \n", i, chi2LastIter/((Float_t)kMaxTE*(Float_t)kMaxTZ), chi2Measured/((Float_t)kMaxTE*(Float_t)kMaxTZ)); - if (chi2LastIter/((Float_t)kMaxTE*(Float_t)kMaxTZ)<5.e-6 && chi2Measured/((Float_t)kMaxTE*(Float_t)kMaxTZ)<5.e-3) - break; - } // end of iterations - - // propagate errors of the reconstructed distribution through the unfolding - for (Int_t te = kStartBin; te<=kMaxTE; te++) - for (Int_t tz = kStartBin; tz<=kMaxTZ; tz++) - { - Float_t valueError = 0; - // Float_t binError = 0; - for (Int_t me=1; me<=kMaxME; me++) - for (Int_t mz=1; mz<=kMaxMZ; mz++) - { - Int_t bin[4] = {te, me, tz, mz}; - valueError += inverseCorrelation->GetBinContent(bin)*inverseCorrelation->GetBinContent(bin)*errors[me][mz]*errors[me][mz]; - } - //if (errors[te][tz]!=0)printf("errors[%d][%d]=%e\n", te, tz, valueError); - aResult->SetBinContent(te, tz, prior[te][tz]); - aResult->SetBinError(te, tz, TMath::Sqrt(valueError)); - } - - // *********************************************************************************************************** - // Calculate the covariance matrix, all arguments are taken from G. D'Agostini (p.6-8) - if (calculateErrors) - { - printf("Covariance matrix will be calculated... this will take a lot of time (>1 day) ;)\n"); - - //Variables and Matrices that will be use along the calculation - const Int_t binsV[4] = {fgkNBINSE,fgkNBINSE, fgkNBINSZ, fgkNBINSZ}; - const Double_t lowEdgeV[4] = {fgkaxisLowerLimitE, fgkaxisLowerLimitE, fgkaxisLowerLimitZ, fgkaxisLowerLimitZ}; - const Double_t upEdgeV[4] = {fgkaxisUpperLimitE, fgkaxisUpperLimitE, fgkaxisUpperLimitZ, fgkaxisUpperLimitZ}; - - const Double_t nTrue = (Double_t)measured->Integral(); - - THnSparseF *v = new THnSparseF("V","",4, binsV, lowEdgeV, upEdgeV); - v->Reset(); - Double_t invCorrContent1, nt; - Double_t invCorrContent2, v11,v12, v2; - // calculate V1 and V2 - for (Int_t idx1=0; idx1<=nFillesBins; idx1++) - { - printf("Covariance Matrix calculation: iteration idx1=%d of %d\n", idx1, nFillesBins); - for (Int_t idx2=0; idx2<=nFillesBins; idx2++) - { - Int_t bin1[4]; - Int_t bin2[4]; - invCorrContent1 = inverseCorrelation->GetBinContent(idx1, bin1); - invCorrContent2 = inverseCorrelation->GetBinContent(idx2, bin2); - v11=0; v12=0; v2=0; - if(bin1[0]>0 && bin1[0]<=fgkNBINSE && bin1[1]>0 && bin1[1]<=fgkNBINSE && - bin1[2]>0 && bin1[2]<=fgkNBINSZ && bin1[3]>0 && bin1[3]<=fgkNBINSZ && - bin2[0]>0 && bin2[0]<=fgkNBINSE && bin2[1]>0 && bin2[1]<=fgkNBINSE && - bin2[2]>0 && bin2[2]<=fgkNBINSZ && bin2[3]>0 && bin2[3]<=fgkNBINSZ) - { - if (bin1[1]==bin2[1] && bin1[3]==bin2[3]) - v11 = invCorrContent1*invCorrContent2*measuredCopy[bin1[1]][bin1[3]] - *(1. - measuredCopy[bin2[1]][bin2[3]]/nTrue); - else - v12 = invCorrContent1*invCorrContent2*measuredCopy[bin1[1]][bin1[3]]* - measuredCopy[bin2[1]][bin2[3]]/nTrue; - nt = (Double_t)prior[bin2[0]][bin2[2]]; - v2 = measuredCopy[bin1[1]][bin1[3]]*measuredCopy[bin2[1]][bin2[3]]* - invCorrContent1*invCorrContent2* - BayesUncertaintyTerms(inverseCorrelation, correlation, bin1, bin2, nt); - Int_t binV[4] = {bin1[0],bin2[0],bin1[2],bin2[2]}; - v->SetBinContent(binV,v11-v12 + v2); - } - } - } - - for(Int_t te = 1; te<=fgkNBINSE; te++) - for(Int_t tz = 1; tz<=fgkNBINSZ; tz++) - { - Int_t binV[4] = {te,te,tz,tz}; - aResult->SetBinError( te, tz, v->GetBinContent(binV) ); - } - - TFile* f = new TFile("Covariance_UnfSpectrum.root"); - f->Open("RECREATE"); - v->Write(); - f->Close(); - } - - return 0; - -} - -//____________________________________________________________________ -Double_t AliJetSpectrumUnfolding::BayesUncertaintyTerms(THnSparseF* const M, THnSparseF* const C,const Int_t* const binTM, const Int_t* const binTM1, Double_t nt) -{ - // - // helper function for the covariance matrix of the bayesian method - // - - Double_t result = 0; - Float_t term[9] = {0.}; - Int_t tmpBin[4] = {0}, tmpBin1[4] = {0}; - const Int_t nFilledBins = C->GetNbins(); - if (!(nt>0&&nt<0)) - return 0; - - Float_t corrContent; - Float_t invCorrContent; - - tmpBin[0] =binTM[0]; tmpBin[1] =binTM[1]; tmpBin[2] =binTM[2]; tmpBin[3] =binTM[3]; - tmpBin1[0]=binTM[0]; tmpBin1[1]=binTM1[1]; tmpBin1[2]=binTM[2]; tmpBin1[3]=binTM1[3]; - if (C->GetBinContent(tmpBin)!=0 && C->GetBinContent(tmpBin1)!=0) - { - if (binTM[0]==binTM1[0] && binTM[2]==binTM1[2]) - term[0] = BayesCov(M, C, tmpBin, tmpBin1)/ - (C->GetBinContent(tmpBin)*C->GetBinContent(tmpBin1)); - term[2] = term[0]*M->GetBinContent(tmpBin1); - } - else - { - term[0] = 0; - term[2] = 0; - } - - tmpBin[0]=binTM1[0]; tmpBin[1]=binTM[1]; tmpBin[2]=binTM1[2]; tmpBin[3]=binTM[3]; - tmpBin1[0]=binTM1[0]; tmpBin1[1]=binTM1[1]; tmpBin1[2]=binTM1[2]; tmpBin1[3]=binTM1[3]; - if (C->GetBinContent(tmpBin)!=0 && C->GetBinContent(tmpBin1)!=0) - term[6] = BayesCov(M, C, tmpBin, tmpBin1)* - M->GetBinContent(tmpBin)/ - (C->GetBinContent(tmpBin)*C->GetBinContent(tmpBin1)); - else - term[6] = 0; - - for(Int_t idx1=0; idx1<=nFilledBins; idx1++) - { - Int_t bin1[4]; - corrContent = C->GetBinContent(idx1, bin1); - invCorrContent = M->GetBinContent(idx1, bin1); - if(bin1[0]>0 && bin1[0]<=fgkNBINSE && bin1[1]>0 && bin1[1]<=fgkNBINSE && - bin1[2]>0 && bin1[2]<=fgkNBINSZ && bin1[3]>0 && bin1[3]<=fgkNBINSZ) - { - tmpBin[0] =binTM[0]; tmpBin[1] =binTM[1]; tmpBin[2] =binTM[2]; tmpBin[3] =binTM[3]; - tmpBin1[0]=binTM[0]; tmpBin1[1]=bin1[1]; tmpBin1[2]=binTM[2]; tmpBin1[3]=bin1[3]; - if (C->GetBinContent(tmpBin)!=0 && - binTM[0]==binTM1[0] && binTM[2]==binTM1[2]) - term[1] = BayesCov(M, C, tmpBin, tmpBin1)/C->GetBinContent(tmpBin); - else - term[1] = 0; - - tmpBin[0] =binTM[0]; tmpBin[1] =bin1[1]; tmpBin[2] =binTM[2]; tmpBin[3] =bin1[3]; - tmpBin1[0]=binTM[0]; tmpBin1[1]=binTM1[1]; tmpBin1[2]=binTM[2]; tmpBin1[3]=binTM1[3]; - if (C->GetBinContent(tmpBin1)!=0) - { - if (binTM[0]==binTM1[0] && binTM[2]==binTM1[2]) - term[3] = BayesCov(M, C, tmpBin, tmpBin1)/ - C->GetBinContent(tmpBin1); - term[5] = BayesCov(M, C, tmpBin, tmpBin1)*M->GetBinContent(tmpBin1)/ - C->GetBinContent(tmpBin1); - } - else - { - term[3] = 0; - term[5] = 0; - } - - tmpBin[0] =binTM1[0]; tmpBin[1] =binTM[1]; tmpBin[2] =binTM1[2]; tmpBin[3] =binTM[3]; - tmpBin1[0]=binTM1[0]; tmpBin1[1]=bin1[1]; tmpBin1[2]=binTM1[2]; tmpBin1[3]=bin1[3]; - if (C->GetBinContent(tmpBin)!=0) - term[7] = BayesCov(M, C, tmpBin, tmpBin1)*M->GetBinContent(tmpBin)/ - C->GetBinContent(tmpBin); - else - term[7] = 0; - - tmpBin[0] =bin1[0]; tmpBin[1] =binTM[1]; tmpBin[2] =bin1[2]; tmpBin[3] =binTM[3]; - tmpBin1[0]=bin1[0]; tmpBin1[1]=binTM1[1]; tmpBin1[2]=bin1[2]; tmpBin1[3]=binTM1[3]; - if (C->GetBinContent(tmpBin)!=0 && C->GetBinContent(tmpBin1)!=0) - term[8] = BayesCov(M, C, tmpBin, tmpBin1)* - M->GetBinContent(tmpBin)*M->GetBinContent(tmpBin)/ - (C->GetBinContent(tmpBin)*C->GetBinContent(tmpBin1)); - else - term[8] = 0; - - for (Int_t i=0; i<9; i++) - result += term[i]/nt; - } - } - - return result; -} - -//____________________________________________________________________ -Double_t AliJetSpectrumUnfolding::BayesCov(THnSparseF* const M, THnSparseF* const correlation,const Int_t* const binTM,const Int_t* const bin1) -{ - - // - // get the covariance matrix - // - - - Double_t result, result1, result2, result3; - - if (binTM[0]==bin1[0] && binTM[2]==bin1[2]) - { - if (correlation->GetBinContent(bin1)!=0) - result1 = 1./correlation->GetBinContent(bin1); - else - result1 = 0; - result2 = 1.; - } - else - { - result1 = 0; - result2 = 0; - } - - if (binTM[1]==bin1[1] && binTM[3]==bin1[3]) - { - Int_t tmpbin[4] = {bin1[0], binTM[1], bin1[2], binTM[3]}; - if(correlation->GetBinContent(tmpbin)!=0) - result3 = M->GetBinContent(tmpbin)/correlation->GetBinContent(tmpbin); - else - result3 = 0; - } - else - { - result1 = 0; - result3 = 0; - } - - return result = result1 + result2 + result3; -} - -//____________________________________________________________________ -TH2F* AliJetSpectrumUnfolding::CalculateRecSpectrum(TH2* const inputGen) -{ - // runs the distribution given in inputGen through the correlation histogram identified by - // fCorrelation and produces a reconstructed spectrum - - if (!inputGen) - return 0; - - // normalize to convert number of events into probability - /*for (Int_t te=1; te<=NBINSE; te++) - for (Int_t tz=1; tz<=NBINSZ; tz++) - { - Int_t bin[4]; - Float_t sum=0.; - for (Int_t me = 1; me<=NBINSE; me++) - for (Int_t mz = 1; mz<=NBINSZ; mz++) - { - bin[0] = te; bin[1] = me; - bin[2] = tz; bin[3] = mz; - sum += fCorrelation[correlationMap]->GetBinContent(bin); - } - if (sum > 0.) - for (Int_t me = 1; me<=NBINSE; me++) - for (Int_t mz = 1; mz<=NBINSZ; mz++) - { - bin[0] = te; bin[1] = me; - bin[2] = tz; bin[3] = mz; - fCorrelation[correlationMap]->SetBinContent(bin, fCorrelation[correlationMap]->GetBinContent(bin)/sum); - fCorrelation[correlationMap]->SetBinError(bin, fCorrelation[correlationMap]->GetBinError(bin)/sum); - } - }*/ - // normalize to convert number of events into probability (the following loop is much faster) - Float_t sum[fgkNBINSE+2][fgkNBINSZ+2]; - memset(sum,0,sizeof(Float_t)*(fgkNBINSE+2)*(fgkNBINSZ+2)); - - for (Int_t idx=0; idxGetNbins(); idx++) - { - Int_t bin[4]; - Float_t binContent = fCorrelation->GetBinContent(idx, bin); - if (bin[1]>0 && bin[1]<=fgkNBINSE && bin[3]>0 && bin[3]<=fgkNBINSZ){ - sum[bin[0]][bin[2]] += binContent; - } - } - - for (Int_t idx=0; idxGetNbins(); idx++) - { - Int_t bin[4]; - Float_t binContent = fCorrelation->GetBinContent(idx, bin); - Float_t binError = fCorrelation->GetBinError(bin); - if (sum[bin[0]][bin[2]]>0 && bin[1]>0 && bin[1]<=fgkNBINSE && - bin[3]>0 && bin[3]<=fgkNBINSZ && bin[0]>0 && bin[2]>0 && bin[0]<=fgkNBINSE && bin[2]<=fgkNBINSZ) - { - fCorrelation->SetBinContent(bin, binContent/sum[bin[0]][bin[2]]); - fCorrelation->SetBinError(bin, binError/sum[bin[0]][bin[2]]); - } - } - - TH2F* target = dynamic_cast (fRecSpectrum->Clone(Form("reconstructed_%s", inputGen->GetName()))); - if(!target)return 0; - - target->Reset(); - - for (Int_t me=1; me<=fgkNBINSE; ++me) - for (Int_t mz=1; mz<=fgkNBINSZ; ++mz) - { - Float_t measured = 0; - Float_t error = 0; - - for (Int_t te=1; te<=fgkNBINSE; ++te) - for (Int_t tz=1; tz<=fgkNBINSZ; ++tz) - { - Int_t bin[4] = {te, me, tz, mz}; - measured += inputGen->GetBinContent(te,tz) * fCorrelation->GetBinContent(bin); - error += inputGen->GetBinError(te,tz) * fCorrelation->GetBinContent(bin); - } - target->SetBinContent(me, mz, measured); - target->SetBinError(me, mz, error); - } - - return target; -} - -//__________________________________________________________________________________________________ -void AliJetSpectrumUnfolding::SetGenRecFromFunc(const TF2* const inputGen) -{ - // uses the given function to fill the input Generated histogram and generates from that - // the reconstructed histogram by applying the response histogram - // this can be used to evaluate if the methods work indepedently of the input - // distribution - - if (!inputGen) - return; - - TH2F* histtmp = new TH2F("histtmp", "tmp", - fgkNBINSE, fgkaxisLowerLimitE, fgkaxisUpperLimitE, - fgkNBINSZ, fgkaxisLowerLimitZ, fgkaxisUpperLimitZ); - - TH2F* gen = fGenSpectrum; - - histtmp->Reset(); - gen->Reset(); - - histtmp->FillRandom(inputGen->GetName(), fgkNEVENTS); - - for (Int_t i=1; i<=gen->GetNbinsX(); ++i) - for (Int_t j=1; j<=gen->GetNbinsY(); ++j) - { - gen->SetBinContent(i, j, histtmp->GetBinContent(i,j)); - gen->SetBinError(i, j, histtmp->GetBinError(i,j)); - } - - delete histtmp; - - //new TCanvas; - //gStyle->SetPalette(1); - //gPad->SetLogz(); - //gen->Draw("COLZ"); - - - TH2 *recsave = fRecSpectrum; - - fRecSpectrum = CalculateRecSpectrum(gen); - fRecSpectrum->SetName(recsave->GetName()); - delete recsave; - - return; -} -//________________________________________________________________________________________ diff --git a/PWGJE/AliJetSpectrumUnfolding.h b/PWGJE/AliJetSpectrumUnfolding.h deleted file mode 100644 index 48823a1be5c..00000000000 --- a/PWGJE/AliJetSpectrumUnfolding.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef ALIJETSPECTRUMUNFOLDING_H -#define ALIJETSPECTRUMUNFOLDING_H -// -// class that contains the correction matrix and the functions for -// correction the jet spectrum -// implements 2-dim bayesian method -// - - - - -class TH1; -class TH2; -class TH3; -class TH1F; - -class TH3F; -class TF1; -class TF2; -class TCollection; - -#include "TNamed.h" -#include -#include // need to included for delete - - -class AliJetSpectrumUnfolding : public TNamed { - public: - AliJetSpectrumUnfolding(); - AliJetSpectrumUnfolding(const Char_t* name, const Char_t* title); - virtual ~AliJetSpectrumUnfolding(); - - virtual Long64_t Merge(TCollection* list); - - Bool_t LoadHistograms(const Char_t* dir = 0); - void SaveHistograms(); - void DrawHistograms(); - void DrawComparison(const char* name, TH2* const genSpec); - - void SetBayesianParameters(Float_t smoothing, Int_t nIterations); - void ApplyBayesianMethod(Float_t regPar = 1, Int_t nIterations = 100, TH2* initialConditions = 0, Bool_t determineError = kTRUE); - - TH2F* GetRecSpectrum() const { return fRecSpectrum; } - TH2F* GetGenSpectrum() const { return fGenSpectrum; } - TH2F* GetUnfSpectrum() const { return fUnfSpectrum; } - THnSparseF* GetCorrelation() const { return fCorrelation; } - - void SetRecSpectrum(TH2F* const hist) { if(fRecSpectrum) delete fRecSpectrum; - fRecSpectrum = hist; } - void SetGenSpectrum(TH2F* const hist) { if(fGenSpectrum)delete fGenSpectrum; - fGenSpectrum = hist; } - void SetUnfSpectrum(TH2F* const hist) { if(fUnfSpectrum)delete fUnfSpectrum; - fUnfSpectrum = hist; } - void SetCorrelation(THnSparseF* const hist){ if(fCorrelation)delete fCorrelation; - fCorrelation = hist; } - - void SetGenRecFromFunc(const TF2* const inputGen); - TH2F* CalculateRecSpectrum(TH2* inputGen); - - static void NormalizeToBinWidth(TH2* const hist); - - - protected: - void SetupCurrentHists(Bool_t createBigBin); - - static Double_t BayesCov(THnSparseF* const M, THnSparseF* const correlation,const Int_t* const binTM,const Int_t* const binTM1); - static Double_t BayesUncertaintyTerms(THnSparseF* const M, THnSparseF *const C,const Int_t* const binTM,const Int_t* const binTM1, Double_t nt); - static Int_t UnfoldWithBayesian(THnSparseF* const correlation, TH2* const measured, TH2* const initialConditions, TH2* const aResult, Float_t regPar, Int_t nIterations, Bool_t calculateErrors = kFALSE); - - static Float_t fgBayesianSmoothing; //! smoothing parameter (0 = no smoothing) - static Int_t fgBayesianIterations; //! number of iterations in Bayesian method - - TH2F* fCurrentRec; // current rec - THnSparseF* fCurrentCorrelation; // current correlat - - TH2F* fRecSpectrum; // rec spectrum - TH2F* fGenSpectrum; // gen spectrum - TH2F* fUnfSpectrum; // Unfolded spectrum - THnSparseF* fCorrelation; // corealtion matrix - - Float_t fLastChi2MC; //! last Chi2 between MC and unfolded ESD (calculated in DrawComparison) - Int_t fLastChi2MCLimit; //! bin where the last chi2 breached a certain threshold - Float_t fLastChi2Residuals; //! last Chi2 of the ESD and the folded unfolded ESD (calculated in DrawComparison) - Float_t fRatioAverage; //! last average of |ratio-1| where ratio = unfolded / mc (bin 2..150) - - private: - - static const Int_t fgkNBINSE; // bins energy - static const Int_t fgkNBINSZ; // bins Z - static const Int_t fgkNEVENTS; // bins events - static const Double_t fgkaxisLowerLimitE; // lower limit e - static const Double_t fgkaxisLowerLimitZ; // lower limit Z - static const Double_t fgkaxisUpperLimitE; // upper limit E - static const Double_t fgkaxisUpperLimitZ; // upper limit Z - - - - AliJetSpectrumUnfolding(const AliJetSpectrumUnfolding&); - AliJetSpectrumUnfolding& operator=(const AliJetSpectrumUnfolding&); - - ClassDef(AliJetSpectrumUnfolding, 2); -}; - -#endif - diff --git a/PWGJE/CMakelibPWGJE.pkg b/PWGJE/CMakelibPWGJE.pkg index f3d91528153..67b5ae6d05d 100644 --- a/PWGJE/CMakelibPWGJE.pkg +++ b/PWGJE/CMakelibPWGJE.pkg @@ -27,31 +27,20 @@ #--------------------------------------------------------------------------------# set ( SRCS - AliAnalysisTaskUE.cxx - AliHistogramsUE.cxx - AliAnalyseUE.cxx - AliAnalysisTaskJetSpectrum.cxx - AliAnalysisTaskJetSpectrum2.cxx - AliAnalysisTaskJetServices.cxx - AliAnalysisTaskPWG4PidDetEx.cxx - AliJetSpectrumUnfolding.cxx - AliAnalysisTaskJFSystematics.cxx - AliAnalysisTaskJetCorrections.cxx - AliAnalysisTaskThreeJets.cxx - AliPWG4HighPtQATPConly.cxx - AliPWG4HighPtQAMC.cxx - AliPWG4HighPtSpectra.cxx - AliPWG4CosmicCandidates.cxx - AliAnalysisTaskJetChem.cxx AliAnalysisTaskFragmentationFunction.cxx - AliFragmentationFunctionCorrections.cxx - AliAnalysisTaskQGSep.cxx + AliAnalysisTaskJetChem.cxx AliAnalysisTaskJetCore.cxx - AliAnalysisTaskJetsTM.cxx - AliAnalysisTaskJetResponse.cxx - AliPWG4HighPtTrackQA.cxx AliAnalysisTaskJetResponseV2.cxx + AliAnalysisTaskJetServices.cxx + AliAnalysisTaskJetSpectrum2.cxx + AliAnalysisTaskJetsTM.cxx AliAnalysisTaskPartonDisc.cxx + AliFragmentationFunctionCorrections.cxx + AliPWG4CosmicCandidates.cxx + AliPWG4HighPtQAMC.cxx + AliPWG4HighPtQATPConly.cxx + AliPWG4HighPtSpectra.cxx + AliPWG4HighPtTrackQA.cxx ) string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" ) diff --git a/PWGJE/PWGJELinkDef.h b/PWGJE/PWGJELinkDef.h index 6153fb14b6f..570debb0fd6 100644 --- a/PWGJE/PWGJELinkDef.h +++ b/PWGJE/PWGJELinkDef.h @@ -4,22 +4,13 @@ #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class AliAnalysisTaskUE+; -#pragma link C++ class AliAnalyseUE+; -#pragma link C++ class AliHistogramsUE+; #pragma link C++ class AliAnalysisTaskJetServices+; -#pragma link C++ class AliAnalysisTaskJetSpectrum+; #pragma link C++ class AliAnalysisTaskJetSpectrum2+; -#pragma link C++ class AliAnalysisTaskJFSystematics+; -#pragma link C++ class AliAnalysisTaskJetCorrections+; -#pragma link C++ class AliAnalysisTaskThreeJets+; #pragma link C++ class AliPWG4HighPtQATPConly+; #pragma link C++ class AliPWG4HighPtQAMC+; #pragma link C++ class AliPWG4HighPtSpectra+; #pragma link C++ class AliPWG4CosmicCandidates+; #pragma link C++ class AliPWG4HighPtTrackQA+; -#pragma link C++ class AliAnalysisTaskPWG4PidDetEx+; -#pragma link C++ class AliJetSpectrumUnfolding+; #pragma link C++ class AliAnalysisTaskFragmentationFunction+; #pragma link C++ class AliAnalysisTaskFragmentationFunction::AliFragFuncHistos+; #pragma link C++ class AliAnalysisTaskFragmentationFunction::AliFragFuncDiJetHistos+; @@ -34,8 +25,6 @@ #pragma link C++ class AliAnalysisTaskJetChem::AliFragFuncHistosPhiCorrInvMass+; #pragma link C++ class AliAnalysisTaskJetsTM+; #pragma link C++ class AliAnalysisTaskJetCore+; -#pragma link C++ class AliAnalysisTaskQGSep+; -#pragma link C++ class AliAnalysisTaskJetResponse+; #pragma link C++ class AliAnalysisTaskJetResponseV2+; #pragma link C++ class AliAnalysisTaskPartonDisc+; #endif diff --git a/PWGJE/macros/AddTaskCorrectionsUE.C b/PWGJE/macros/AddTaskCorrectionsUE.C deleted file mode 100644 index 6cb329f7e43..00000000000 --- a/PWGJE/macros/AddTaskCorrectionsUE.C +++ /dev/null @@ -1,208 +0,0 @@ -void ConfigTaskCorrectionsUE(AliAnalysisTaskCorrectionsUE * uecorr ); // common config, extend with different cases -void SetTrackCuts(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *ct); //can be extended -void SetAnaTopology(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *at); //can be extended -void SetRegionType(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *rt); //can be extended -void SetSorting(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *sort); - -AliAnalysisTaskCorrectionsUE *AddTaskCorrectionsUE(Char_t *jetBranch = "jets",Char_t *cuts = "ALICE", Char_t *anaTopology="LJ", Char_t *regionType="TRANSV", Char_t *sortBy="MSP", Bool_t proof=0) -{ - - gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/lib/tgt_linux -I$ALICE_ROOT/ANALYSIS -I$ALICE_ROOT/JETAN -I$ALICE_ROOT/JETAN/fastjet -I$ALICE_ROOT/PWG4 -I$ALICE_ROOT/PYTHIA6 -I$ALICE_ROOT/CORRFW"); - - // Get the pointer to the existing analysis manager via the static access method. - //============================================================================== - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - if (!mgr) { - ::Error("AddTaskCorrectionsUE", "No analysis manager to connect to."); - return NULL; - } - - // Check the analysis type using the event handlers connected to the analysis manager. - //============================================================================== - if (!mgr->GetInputEventHandler()) { - ::Error("AddTaskCorrectionsUE", "This task requires an input event handler"); - return NULL; - } - - // Create the task and configure it. - //=========================================================================== - - TString jb(jetBranch); - TString ct(cuts); - TString at(anaTopology); - TString rt(regionType); - TString sort(sortBy); - TString name(Form("%s_%s_%s_%s_%s",jb.Data(),ct.Data(),at.Data(),rt.Data(),sort.Data())); - - AliAnalysisTaskCorrectionsUE* uecorr = new AliAnalysisTaskCorrectionsUE(Form("UECorrections_%s",name.Data())); - uecorr->SelectAODBranch(jb.Data()); - ConfigTaskCorrectionsUE(uecorr); - SetTrackCuts(uecorr,cuts); - SetAnaTopology(uecorr,anaTopology); - SetRegionType(uecorr,regionType); - SetSorting(uecorr,sortBy); - - if( jb.Contains("ICDF") ) { // Use internal "Charged Particle Jet CDF" instead of jets from AOD - uecorr->SetUseChPartJet( kTRUE ); - uecorr->SetPtMinChPartJet(0.5); - } - - // ***** to be fixed ******* - /* - if(jb.Length()>0){ - ueana->ReadDeltaAOD(kTRUE); - ueana->SelectDeltaAODBranch(jb.Data()); - } - */ - - mgr->AddTask(uecorr); - - // Create ONLY the output containers for the data produced by the task. - // Get and connect other common input/output containers via the manager as below - //============================================================================== - AliAnalysisDataContainer *coutput1_UE = 0; - AliAnalysisDataContainer *coutput2_UE = 0; - - if (!proof){ - if(jb.Length()==0)coutput1_UE = mgr->CreateContainer("histosCorrectionsUE", TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_CorrectionsUE",AliAnalysisManager::GetCommonFileName())); - else coutput1_UE = mgr->CreateContainer(Form("histosCorrectionsUE_%s",name.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_CorrectionsUE_%s",AliAnalysisManager::GetCommonFileName(),name.Data())); - - if(jb.Length()==0)coutput2_UE = mgr->CreateContainer("containersCorrectionsUE", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_CorrectionsUE",AliAnalysisManager::GetCommonFileName())); - else coutput2_UE = mgr->CreateContainer(Form("containersCorrectionsUE_%s",name.Data()), AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_CorrectionsUE_%s",AliAnalysisManager::GetCommonFileName(),name.Data())); - } else {//simplify output structure in case of PROOF or it crashes while transferring files from master) - if(jb.Length()==0)coutput1_UE = mgr->CreateContainer("histosCorrectionsUE", TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s",AliAnalysisManager::GetCommonFileName())); - else coutput1_UE = mgr->CreateContainer(Form("histosCorrectionsUE_%s",name.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s",AliAnalysisManager::GetCommonFileName())); - - if(jb.Length()==0)coutput2_UE = mgr->CreateContainer("containersCorrectionsUE", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,Form("%s",AliAnalysisManager::GetCommonFileName())); - else coutput2_UE = mgr->CreateContainer(Form("containersCorrectionsUE_%s",name.Data()), AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,Form("%s",AliAnalysisManager::GetCommonFileName())); - - - - } - - mgr->ConnectInput (uecorr, 0, mgr->GetCommonInputContainer()); - mgr->ConnectOutput (uecorr, 0, coutput1_UE ); - mgr->ConnectOutput (uecorr, 1, coutput2_UE ); - - return uecorr; -} - -//------------------------------------------------------------------------ -void ConfigTaskCorrectionsUE(AliAnalysisTaskCorrectionsUE * uecorr){ - // common config, - uecorr->SetDebugLevel(10); - uecorr->SetPtRangeInHist(100, 0., 100.); -} - -//------------------------------------------------------------------------ -SetTrackCuts(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *ct){ - - uecorr->SetFilterBit(16); // Standard TPC+ITS cuts 2009 - - switch (ct) { - case "ALICE": - uecorr->SetTrackPtCut(0.1); - uecorr->SetTrackEtaCut(0.9); - break; - - case "CDF": - uecorr->SetTrackPtCut(0.5); - uecorr->SetTrackEtaCut(0.9); - break; - - default: - Printf("\n >>>>>>> AddTaskCorrectionsUE Error Wrong Set of Track Cuts selected\n"); - break; - } -} - -//------------------------------------------------------------------------ -SetAnaTopology(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *at){ - - switch (at) { - case "LJ": // leading jet - uecorr->SetAnaTopology(1); - uecorr->SetJet1EtaCut(0.5); - break; - - case "LJCC": // leading jet with charged cluster - uecorr->SetAnaTopology(1); - uecorr->SetJet1EtaCut(0.9); // CDF allow jet radius extend ouside |eta|<1 - break; - - case "BB": // back-to-back - uecorr->SetAnaTopology(2); - uecorr->SetJet1EtaCut(0.5); - uecorr->SetJet2DeltaPhiCut(2.616); - break; - - case "BE": // back-to-back exclusive - uecorr->SetAnaTopology(3); - uecorr->SetJet1EtaCut(0.5); - uecorr->SetJet2DeltaPhiCut(2.616); - uecorr->SetJet3PtCut(10.); - break; - - case "MP_eta05": - uecorr->SetAnaTopology(4); - uecorr->SetJet1EtaCut(0.9); - break; - - case "MP_eta09": // max Pt charged particle - uecorr->SetAnaTopology(4); - uecorr->SetJet1EtaCut(0.9); - break; - - - default: - Printf("\n >>>>>>> AddTaskCorrectionsUE Error Wrong Analysis Topology selected\n"); - break; - } - -} - -//------------------------------------------------------------------------ -SetRegionType(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *rt){ - - switch (rt) { - case "TRANSV": - uecorr->SetRegionType(1); - break; - - case "CONE": - uecorr->SetRegionType(2); - uecorr->SetConeRadius(0.4); - break; - - default: - Printf("\n >>>>>>> AddTaskCorrectionsUE Error Wrong Region Type selected\n"); - break; - } -} - -//------------------------------------------------------------------------ -SetSorting(AliAnalysisTaskCorrectionsUE * uecorr, Char_t *sort){ - - switch (sort){ - // Minimum zone is selected per quantity type - case "MQA": - uecorr->SetPtSumOrdering(1); - break; - - // Minimum Zone is selected at the region having lowest pt summation of all tracks - case "MSP": - uecorr->SetPtSumOrdering(2); - break; - - // Minimum Zone is selected at the region having lowest average pt per track - case "MAP": - uecorr->SetPtSumOrdering(3); - break; - - default: - Printf("\n >>>>>>> AddTaskCorrectionsUE Error Wrong Sorting selected\n"); - Printf("\n >>>>>>> AddTaskCorrectionsUE Sort by Set to MSP \n"); - uecorr->SetPtSumOrdering(2); - break; - } -} diff --git a/PWGJE/macros/AddTaskJFSystematics.C b/PWGJE/macros/AddTaskJFSystematics.C deleted file mode 100644 index dd8f68434b9..00000000000 --- a/PWGJE/macros/AddTaskJFSystematics.C +++ /dev/null @@ -1,49 +0,0 @@ -AliAnalysisTaskJFSystematics *AddTaskJFSystematics(char *jf1 = "jets",char *jf2 = "jetsAODMC_UA104") -{ - - // Get the pointer to the existing analysis manager via the static access method. - //============================================================================== - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - if (!mgr) { - ::Error("AddTaskJFSystematics", "No analysis manager to connect to."); - return NULL; - } - - // Check the analysis type using the event handlers connected to the analysis manager. - //============================================================================== - if (!mgr->GetInputEventHandler()) { - ::Error("AddTaskJFSystematics", "This task requires an input event handler"); - return NULL; - } - - // Create the task and configure it. - //=========================================================================== - - AliAnalysisTaskJFSystematics* pwg4jfs = new AliAnalysisTaskJFSystematics("JF Systematics"); - - // or a config file - pwg4jfs->SetAnalysisType(AliAnalysisTaskJFSystematics::kSysJetOrder); - // if(iAODanalysis)pwg4spec->SetAODInput(kTRUE); - // pwg4jfs->SetDebugLevel(11); - TString type = mgr->GetInputEventHandler()->GetDataType(); - if(type == "AOD"){ - pwg4jfs->SetAODInput(kTRUE); - } - - pwg4jfs->SetBranchGen(jf2); - pwg4jfs->SetBranchRec(jf1); - mgr->AddTask(pwg4jfs); - - // Create ONLY the output containers for the data produced by the task. - // Get and connect other common input/output containers via the manager as below - //============================================================================== - AliAnalysisDataContainer *coutput1_jfs = mgr->CreateContainer(Form("pwg4jfs_%s_%s",jf1,jf2), - TList::Class(),AliAnalysisManager::kOutputContainer, - Form("%s:PWG4_jfs_%s_%s",AliAnalysisManager::GetCommonFileName(),jf1,jf2)); - - mgr->ConnectInput (pwg4jfs, 0, mgr->GetCommonInputContainer()); - mgr->ConnectOutput (pwg4jfs, 0, mgr->GetCommonOutputContainer()); - mgr->ConnectOutput (pwg4jfs, 1, coutput1_jfs ); - - return pwg4jfs; -} diff --git a/PWGJE/macros/AddTaskJetCorrections.C b/PWGJE/macros/AddTaskJetCorrections.C deleted file mode 100644 index f925b65a1ad..00000000000 --- a/PWGJE/macros/AddTaskJetCorrections.C +++ /dev/null @@ -1,63 +0,0 @@ -AliAnalysisTaskJetCorrections * AddTaskJetCorrections() -{ - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - if (!mgr) { - ::Error("AddTaskJetSpectrum", "No analysis manager to connect to."); - return NULL; - } - - // Check the analysis type using the event handlers connected to the analysis manager. - //============================================================================== - if (!mgr->GetInputEventHandler()) { - ::Error("AddTaskJetSpectrum", "This task requires an input event handler"); - return NULL; - } - - AliAnalysisTaskJetCorrections * jetCorr = new AliAnalysisTaskJetCorrections("Jet Corrections"); - - jetCorr->SetBranchGen("jetsMC"); - jetCorr->SetBranchRec("jets"); - jetCorr->SetR(.5); - mgr->AddTask(jetCorr); - - AliAnalysisDataContainer *coutput1_Corr = mgr->CreateContainer("jetCorr", TList::Class(),AliAnalysisManager::kOutputContainer,"jetCorr.root"); - - mgr->ConnectInput (jetCorr, 0, mgr->GetCommonInputContainer()); - mgr->ConnectOutput (jetCorr, 0, mgr->GetCommonOutputContainer()); - mgr->ConnectOutput (jetCorr, 1, coutput1_Corr ); - - return jetCorr; -} - - -AliAnalysisTaskJetCorrections * AddTaskJetCorrections(AliAnalysisManager* mgr ,AliAnalysisDataContainer *cinput) -{ - if (!mgr) { - ::Error("AddTaskJetSpectrum", "No analysis manager to connect to."); - return NULL; - } - - // Check the analysis type using the event handlers connected to the analysis manager. - //============================================================================== - if (!mgr->GetInputEventHandler()) { - ::Error("AddTaskJetSpectrum", "This task requires an input event handler"); - return NULL; - } - - AliAnalysisTaskJetCorrections * jetCorr = new AliAnalysisTaskJetCorrections("Jet Corrections"); - - jetCorr->SetBranchGen("jetsMC"); - jetCorr->SetBranchRec("jets"); - jetCorr->SetR(.5); - mgr->AddTask(jetCorr); - - AliAnalysisDataContainer * coutpu0 = mgr->CreateContainer("coutpu0", TTree::Class(), - AliAnalysisManager::kExchangeContainer); - AliAnalysisDataContainer *coutput1_jetCorr = mgr->CreateContainer("jetCorr", TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWGJE_jetCorr",AliAnalysisManager::GetCommonFileName())); - - mgr->ConnectInput (jetCorr, 0, cinput); - mgr->ConnectOutput (jetCorr, 0, coutpu0); - mgr->ConnectOutput (jetCorr, 1, coutput1_Corr ); - - return jetCorr; -} diff --git a/PWGJE/macros/AddTaskJetSpectrum.C b/PWGJE/macros/AddTaskJetSpectrum.C deleted file mode 100644 index 27ded56db18..00000000000 --- a/PWGJE/macros/AddTaskJetSpectrum.C +++ /dev/null @@ -1,46 +0,0 @@ -AliAnalysisTaskJetSpectrum *AddTaskJetSpectrum() -{ -// Creates a jet fider task, configures it and adds it to the analysis manager. - - // Get the pointer to the existing analysis manager via the static access method. - //============================================================================== - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - if (!mgr) { - ::Error("AddTaskJetSpectrum", "No analysis manager to connect to."); - return NULL; - } - - // Check the analysis type using the event handlers connected to the analysis manager. - //============================================================================== - if (!mgr->GetInputEventHandler()) { - ::Error("AddTaskJetSpectrum", "This task requires an input event handler"); - return NULL; - } - - // Create the task and configure it. - //=========================================================================== - - AliAnalysisTaskJetSpectrum* pwg4spec = new AliAnalysisTaskJetSpectrum("Jet Spectrum"); - - // or a config file - pwg4spec->SetAnalysisType(AliAnalysisTaskJetSpectrum::kAnaMC); - // if(iAODanalysis)pwg4spec->SetAODInput(kTRUE); - // pwg4spec->SetDebugLevel(11); - pwg4spec->SetBranchGen("jetsMC"); - pwg4spec->SetBranchRec("jetsAOD"); - mgr->AddTask(pwg4spec); - - - - - // Create ONLY the output containers for the data produced by the task. - // Get and connect other common input/output containers via the manager as below - //============================================================================== - AliAnalysisDataContainer *coutput1_Spec = mgr->CreateContainer("pwg4spec", TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_spec",AliAnalysisManager::GetCommonFileName())); - - mgr->ConnectInput (pwg4spec, 0, mgr->GetCommonInputContainer()); - mgr->ConnectOutput (pwg4spec, 0, mgr->GetCommonOutputContainer()); - mgr->ConnectOutput (pwg4spec, 1, coutput1_Spec ); - - return pwg4spec; -} diff --git a/PWGJE/macros/AddTaskPWG4PidDetEx.C b/PWGJE/macros/AddTaskPWG4PidDetEx.C deleted file mode 100644 index fd3a4ace617..00000000000 --- a/PWGJE/macros/AddTaskPWG4PidDetEx.C +++ /dev/null @@ -1,44 +0,0 @@ -AliAnalysisTaskPWG4PidDetEx *AddTaskPWG4PidDetEx() -{ -// Creates a jet fider task, configures it and adds it to the analysis manager. - - // Get the pointer to the existing analysis manager via the static access method. - //============================================================================== - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - if (!mgr) { - ::Error("AddTaskJets", "No analysis manager to connect to."); - return NULL; - } - - // Check the analysis type using the event handlers connected to the analysis manager. - //============================================================================== - if (!mgr->GetInputEventHandler()) { - ::Error("AddTaskPWG4PidDetEx", "This task requires an input event handler"); - return NULL; - } - - // Create the task and configure it. - //=========================================================================== - - AliAnalysisTaskPWG4PidDetEx* taskPid = new AliAnalysisTaskPWG4PidDetEx("TaskPID"); - if(mgr->GetInputEventHandler()->InheritsFrom("AliAODInputHandler"))taskPid->SetAnalysisType("AOD"); - else { - // Either we assume taht w have the cuts already loaded or we just do it again - // this can be done more elegant when also accepting AOD filtered output - gROOT->LoadMacro("AddTaskESDfilter.C"); - AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter"); - trackFilter->AddCuts(CreateCuts(0)); - taskPid->SetTrackFilter(trackFilter); - } - mgr->AddTask(taskPid); - - // Create ONLY the output containers for the data produced by the task. - // Get and connect other common input/output containers via the manager as below - //============================================================================== - AliAnalysisDataContainer *coutput1_PID = mgr->CreateContainer("histosPID", TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_pid",AliAnalysisManager::GetCommonFileName()); - - mgr->ConnectInput (taskPid, 0, mgr->GetCommonInputContainer()); - mgr->ConnectOutput (taskPid, 0, mgr->GetCommonOutputContainer()); - mgr->ConnectOutput (taskPid, 1, coutput1_PID); - return taskPid; -} diff --git a/PWGJE/macros/AddTaskQGSep.C b/PWGJE/macros/AddTaskQGSep.C deleted file mode 100644 index cf03f043c8a..00000000000 --- a/PWGJE/macros/AddTaskQGSep.C +++ /dev/null @@ -1,27 +0,0 @@ -AliAnalysisTaskQGSep * AddTaskQGSep(Bool_t useMC = kFALSE, Bool_t useAOD = kFALSE) -{ - // create manager - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - if (!mgr) mgr = new AliAnalysisManager("My test train"); - - // create our task - AliAnalysisTaskQGSep *task = new AliAnalysisTaskQGSep("AliAnalysisTaskQGSep"); - - // uncomment this to use MC - task->UseMC(useMC); - task->UseAOD(useAOD); - - // create output container - AliAnalysisDataContainer *output1 = mgr->CreateContainer("cCustomList", TList::Class(), AliAnalysisManager::kOutputContainer, - Form("%s:PWG4_QGSep_UA104",AliAnalysisManager::GetCommonFileName())); - - // add our task to the manager - mgr->AddTask(task); - - // finaly connect input and output - mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); - mgr->ConnectOutput(task, 1, output1); - - return task; - -} diff --git a/PWGJE/macros/AddTaskThreeJets.C b/PWGJE/macros/AddTaskThreeJets.C deleted file mode 100644 index 5cbca109ebb..00000000000 --- a/PWGJE/macros/AddTaskThreeJets.C +++ /dev/null @@ -1,86 +0,0 @@ -AliAnalysisTaskThreeJets * AddTaskThreeJets(char *bRec = "jets",char * bGen = "jetsAODMC_UA104") -{ - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - if (!mgr) { - ::Error("AddTaskThreeJets", "No analysis manager to connect to."); - return NULL; - } - - // Check the analysis type using the event handlers connected to the analysis manager. - //============================================================================== - if (!mgr->GetInputEventHandler()) { - ::Error("AddTaskThreeJets", "This task requires an input event handler"); - return NULL; - } - - // Create the task and configure it. - //=========================================================================== - - AliAnalysisTaskThreeJets * threeJets = new AliAnalysisTaskThreeJets("Three Jet Analysis"); - - threeJets->SetBranchRec(bRec); - threeJets->SetBranchGen(bGen); - // threeJets->SetDebugLevel(10); - threeJets->SetR(.5); - threeJets->SelectCollisionCandidates(); - // threeJets->SetUseMC(kFALSE); // explicitly switch of use of MC/search for MC Jets - - - TString type = mgr->GetInputEventHandler()->GetDataType(); - if(type == "AOD"){ - threeJets->SetAODInput(kTRUE); - } - - - - mgr->AddTask(threeJets); - - - - - - // Create ONLY the output containers for the data produced by the task. - // Get and connect other common input/output containers via the manager as below - //============================================================================== - AliAnalysisDataContainer *coutput1_Corr = mgr->CreateContainer(Form("threeJets_%s_%s",bRec,bGen), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_threeJets_%s_%s",AliAnalysisManager::GetCommonFileName(),bRec,bGen)); - - mgr->ConnectInput (threeJets, 0, mgr->GetCommonInputContainer()); - mgr->ConnectOutput (threeJets, 0, mgr->GetCommonOutputContainer()); - mgr->ConnectOutput (threeJets, 1, coutput1_Corr ); - - return threeJets; -} - - -AliAnalysisTaskThreeJets * AddTaskJetCorrections(AliAnalysisManager* mgr,AliAnalysisDataContainer *cinput) -{ - if (!mgr) { - ::Error("AddTaskJetSpectrum", "No analysis manager to connect to."); - return NULL; - } - - // Check the analysis type using the event handlers connected to the analysis manager. - //============================================================================== - if (!mgr->GetInputEventHandler()) { - ::Error("AddTaskJetSpectrum", "This task requires an input event handler"); - return NULL; - } - - AliAnalysisTaskThreeJets * threeJets = new AliAnalysisTaskThreeJets("ThreeJetAnalysis"); - - threeJets->SetBranchGen("jetsMC"); - threeJets->SetBranchRec("jets"); - threeJets->SetR(.5); - mgr->AddTask(threeJets); - - AliAnalysisDataContainer * coutpu0 = mgr->CreateContainer("coutpu0", TTree::Class(), - AliAnalysisManager::kExchangeContainer); - AliAnalysisDataContainer *coutput1_threeJets = mgr->CreateContainer("threeJets", TList::Class(),AliAnalysisManager::kOutputContainer,"threeJets.root"); - - mgr->ConnectInput (threeJets, 0, cinput); - mgr->ConnectOutput (threeJets, 0, coutpu0); - mgr->ConnectOutput (threeJets, 1, coutput1_Corr ); - - return threeJets; -} - diff --git a/PWGJE/macros/AddTaskUE.C b/PWGJE/macros/AddTaskUE.C deleted file mode 100644 index f58c79a87e5..00000000000 --- a/PWGJE/macros/AddTaskUE.C +++ /dev/null @@ -1,192 +0,0 @@ - - -void ConfigTaskUE(AliAnalysisTaskUE * ueana ); // common config, extend with different cases -void SetTrackCuts(AliAnalysisTaskUE * ueana, Char_t *ct); //can be extended -void SetAnaTopology(AliAnalysisTaskUE * ueana, Char_t *at); //can be extended -void SetRegionType(AliAnalysisTaskUE * ueana, Char_t *rt); //can be extended -void SetSorting(AliAnalysisTaskUE * ueana, Char_t *sort); - -AliAnalysisTaskUE *AddTaskUE(Char_t *jetBranch = "jets",Char_t *cuts = "ALICE", Char_t *anaTopology="LJ", Char_t *regionType="TRANSV", Char_t *sortBy="MSP") -{ -// Creates a jet fider task, configures it and adds it to the analysis manager. - - // Get the pointer to the existing analysis manager via the static access method. - //============================================================================== - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - if (!mgr) { - ::Error("AddTaskUE", "No analysis manager to connect to."); - return NULL; - } - - // Check the analysis type using the event handlers connected to the analysis manager. - //============================================================================== - if (!mgr->GetInputEventHandler()) { - ::Error("AddTaskUE", "This task requires an input event handler"); - return NULL; - } - - // Create the task and configure it. - //=========================================================================== - - TString jb(jetBranch); - TString ct(cuts); - TString at(anaTopology); - TString rt(regionType); - TString sort(sortBy); - TString name(Form("%s_%s_%s_%s_%s",jb.Data(),ct.Data(),at.Data(),rt.Data(),sort.Data())); - - AliAnalysisTaskUE* ueana = new AliAnalysisTaskUE(Form("UEAnalysis_%s",name.Data())); - ueana->SelectAODBranch(jb.Data()); - ConfigTaskUE(ueana); - SetTrackCuts(ueana,cuts); - SetAnaTopology(ueana,anaTopology); - SetRegionType(ueana,regionType); - SetSorting(ueana,sortBy); - - if( jb.Contains("ICDF") ) { // Use internal "Charged Particle Jet CDF" instead of jets from AOD - ueana->SetUseChPartJet( kTRUE ); - ueana->SetPtMinChPartJet(0.5); - } - - // ***** to be fixed ******* - /* - if(jb.Length()>0){ - ueana->ReadDeltaAOD(kTRUE); - ueana->SelectDeltaAODBranch(jb.Data()); - } - */ - - mgr->AddTask(ueana); - - // Create ONLY the output containers for the data produced by the task. - // Get and connect other common input/output containers via the manager as below - //============================================================================== - AliAnalysisDataContainer *coutput1_UE = 0; - if(jb.Length()==0)coutput1_UE = mgr->CreateContainer("histosUE", TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_UE",AliAnalysisManager::GetCommonFileName())); - else coutput1_UE = mgr->CreateContainer(Form("histosUE_%s",name.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_UE_%s",AliAnalysisManager::GetCommonFileName(),name.Data())); - - mgr->ConnectInput (ueana, 0, mgr->GetCommonInputContainer()); - mgr->ConnectOutput (ueana, 0, coutput1_UE ); - - return ueana; -} - -void ConfigTaskUE(AliAnalysisTaskUE * ueana){ - // common config, - ueana->SetDebugLevel(0); - ueana->SetPtRangeInHist(100, 0., 100.); -} - -//------------------------------------------------------------------------ -SetTrackCuts(AliAnalysisTaskUE * ueana, Char_t *ct){ - - ueana->SetFilterBit(16); // ITS refit - - switch (ct) { - case "ALICE": - ueana->SetTrackPtCut(0.1); - ueana->SetTrackEtaCut(0.9); - break; - - case "CDF": - ueana->SetTrackPtCut(0.5); - ueana->SetTrackEtaCut(0.9); // meaningful only for pure MC - break; - - default: - Printf("\n >>>>>>> AddTaskUE Error Wrong Set of Track Cuts selected\n"); - break; - } -} - -//------------------------------------------------------------------------ -//------------------------------------------------------------------------ -SetAnaTopology(AliAnalysisTaskUE * ueana, Char_t *at){ - - switch (at) { - case "LJ": // leading jet - ueana->SetAnaTopology(1); - ueana->SetJet1EtaCut(0.5); - break; - - case "LJCC": // leading jet with charged cluster - ueana->SetAnaTopology(1); - ueana->SetJet1EtaCut(0.9); // CDF allow jet radius extend ouside |eta|<1 - break; - - case "BB": // back-to-back - ueana->SetAnaTopology(2); - ueana->SetJet1EtaCut(0.5); - ueana->SetJet2DeltaPhiCut(2.616); - break; - - case "BE": // back-to-back exclusive - ueana->SetAnaTopology(3); - ueana->SetJet1EtaCut(0.5); - ueana->SetJet2DeltaPhiCut(2.616); - ueana->SetJet3PtCut(10.); - break; - - case "MP_eta05": - ueana->SetAnaTopology(4); - ueana->SetJet1EtaCut(0.9); - break; - - case "MP_eta09": // max Pt charged particle - ueana->SetAnaTopology(4); - ueana->SetJet1EtaCut(0.9); - break; - - - default: - Printf("\n >>>>>>> AddTaskUE Error Wrong Analysis Topology selected\n"); - break; - } - -} - -//------------------------------------------------------------------------ -SetRegionType(AliAnalysisTaskUE * ueana, Char_t *rt){ - - switch (rt) { - case "TRANSV": - ueana->SetRegionType(1); - break; - - case "CONE": - ueana->SetRegionType(2); - ueana->SetConeRadius(0.4); - break; - - default: - Printf("\n >>>>>>> AddTaskUE Error Wrong Region Type selected\n"); - break; - } -} - -//------------------------------------------------------------------------ -SetSorting(AliAnalysisTaskUE * ueana, Char_t *sort){ - - switch (sort){ - // Minimum zone is selected per quantity type - case "MQA": - ueana->SetPtSumOrdering(1); - break; - - // Minimum Zone is selected at the region having lowest pt summation of all tracks - case "MSP": - ueana->SetPtSumOrdering(2); - break; - - // Minimum Zone is selected at the region having lowest average pt per track - case "MAP": - ueana->SetPtSumOrdering(3); - break; - - default: - Printf("\n >>>>>>> AddTaskUE Error Wrong Sorting selected\n"); - Printf("\n >>>>>>> AddTaskUE Sort by Set to MSP \n"); - ueana->SetPtSumOrdering(2); - break; - } -} -- 2.43.0