1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 * author: Redmer Alexander Bertens
19 * rbertens@cern.ch, rbertens@nikhef.nl, r.a.bertens@uu.nl
21 * jet correlation task - correlates jets to the vzero reaction plane using
22 * the scalar product method
24 * this task expects POI's in a TClonesArray, e.g. from running it after
25 * $ALICE_ROOT/PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRhoVnModulation()
26 * if subtracted jet pt is stored by using jet->PtSub() run in default mode
27 * to run on unsubtracted jets - or any other class inheriting from AliVParticle - call SetDoVParticleAnalysis(kTRUE)
33 #include <AliAnalysisTask.h>
34 #include <AliAnalysisManager.h>
35 #include <AliFlowEventSimple.h>
36 #include <AliFlowTrack.h>
37 #include <AliFlowTrackCuts.h>
38 #include <AliFlowEventCuts.h>
39 #include <AliFlowCommonConstants.h>
41 #include <AliAODEvent.h>
42 #include <AliESDEvent.h>
43 #include <AliEmcalJet.h>
45 #include "AliAnalysisTaskJetFlow.h"
47 class AliAnalysisTaskJetFlow;
51 ClassImp(AliAnalysisTaskJetFlow)
53 AliAnalysisTaskJetFlow::AliAnalysisTaskJetFlow() : AliAnalysisTaskSE(),
54 fDebug(-1), fJetsName(0), fOutputList(0), fDataType(kESD), fVParticleAnalysis(kFALSE), fInitialized(kFALSE), fPtBump(0), fCCMaxPt(150), fCCBinsInPt(50), fCentralityMin(-1), fCentralityMax(-1), fPOIPtMin(0.15), fPOIPtMax(150), fCutsRP(0), fCutsPOI(0), fCutsNull(0), fCutsEvent(0), fFlowEvent(0), fHistAnalysisSummary(0), fCentralitySelection(0)
55 { /* default constructor */ }
56 //_____________________________________________________________________________
57 AliAnalysisTaskJetFlow::AliAnalysisTaskJetFlow(const char* name) : AliAnalysisTaskSE(name),
58 fDebug(-1), fJetsName(0), fOutputList(0), fDataType(kESD), fVParticleAnalysis(kFALSE), fInitialized(kFALSE), fPtBump(0), fCCMaxPt(150), fCCBinsInPt(50), fCentralityMin(-1), fCentralityMax(-1), fPOIPtMin(0.15), fPOIPtMax(150), fCutsRP(0), fCutsPOI(0), fCutsNull(0), fCutsEvent(0), fFlowEvent(0), fHistAnalysisSummary(0), fCentralitySelection(0)
61 DefineInput(0, TChain::Class());
62 DefineOutput(1, TList::Class());
63 DefineOutput(2, AliFlowEventSimple::Class());
65 //_____________________________________________________________________________
66 AliAnalysisTaskJetFlow::~AliAnalysisTaskJetFlow()
69 if(fOutputList) delete fOutputList;
70 if(fFlowEvent) delete fFlowEvent;
71 if(fCutsEvent) delete fCutsEvent;
73 //_____________________________________________________________________________
74 void AliAnalysisTaskJetFlow::LocalInit()
77 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
78 fCutsEvent = new AliFlowEventCuts();
79 fCutsEvent->SetRefMultMethod(AliESDtrackCuts::kTrackletsITSTPC);
81 //_____________________________________________________________________________
82 void AliAnalysisTaskJetFlow::UserCreateOutputObjects()
84 // create output objects
85 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
86 fOutputList = new TList();
87 fOutputList->SetOwner(kTRUE);
89 fHistAnalysisSummary = new TH1F("fHistAnalysisSummary", "fHistAnalysisSummary", 4, -.5, 3.5);
90 fHistAnalysisSummary->GetXaxis()->SetBinLabel(1, "fDataType");
91 fHistAnalysisSummary->SetBinContent(1, (int)fDataType);
92 fHistAnalysisSummary->GetXaxis()->SetBinLabel(2, "fCentralityMin");
93 fHistAnalysisSummary->SetBinContent(2, fCentralityMin);
94 fHistAnalysisSummary->GetXaxis()->SetBinLabel(3, "fCentralityMax");
95 fHistAnalysisSummary->SetBinContent(3, fCentralityMax);
96 fHistAnalysisSummary->GetXaxis()->SetBinLabel(4, "pt bias");
97 fOutputList->Add(fHistAnalysisSummary);
99 fCentralitySelection = new TH1F("fCentralitySelection", "fCentralitySelection", 100, 0, 100);
100 fOutputList->Add(fCentralitySelection);
102 PostData(1, fOutputList);
103 // create the flow event and configure the static cc object
104 fFlowEvent = new AliFlowEvent(1000);
105 PostData(2, fFlowEvent);
106 AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();
107 cc->SetPtMax(fCCMaxPt+fPtBump);
108 cc->SetNbinsPt(fCCBinsInPt);
110 //_____________________________________________________________________________
111 void AliAnalysisTaskJetFlow::UserExec(Option_t *)
114 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
115 if(!InputEvent() || !fCutsNull || !fCutsRP) return; // coverity (and sanity)
117 if(dynamic_cast<AliAODEvent*>(InputEvent())) fDataType = kAOD; // determine the datatype
118 else if(dynamic_cast<AliESDEvent*>(InputEvent())) fDataType = kESD;
119 fInitialized = kTRUE;
121 if(!PassesCuts(InputEvent())) return; // check the event cuts
122 // get the jet array, which is added as an extension to the AliVEvent by the jetfinder
123 TClonesArray* jets = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fJetsName.Data()));
124 Int_t nAcceptedJets(0);
126 Int_t iJets = jets->GetEntriesFast();
128 if(fDebug>0) printf(" > Retrieved empty AliVEvent extension, aborting ! < \n ");
131 // prepare the track selection for RP's and the flow event
132 fCutsRP->SetEvent(InputEvent(), MCEvent());
133 fCutsNull->SetEvent(InputEvent(), MCEvent());
134 fFlowEvent->ClearFast();
135 fFlowEvent->Fill(fCutsRP, fCutsNull);
136 fFlowEvent->SetReferenceMultiplicity(fCutsEvent->RefMult(InputEvent(), MCEvent()));
137 // loop over jets and inject them as POI's
138 if(fVParticleAnalysis) {
139 for(Int_t i(0); i < iJets; i++) {
140 AliVParticle* jet = static_cast<AliVParticle*>(jets->At(i));
142 if(jet->Pt() + fPtBump <= fPOIPtMin || jet->Pt() > fPOIPtMax) {
143 fHistAnalysisSummary->SetBinContent(4, 1);
147 AliFlowTrack* flowTrack = new AliFlowTrack(jet);
148 flowTrack->SetPt(jet->Pt() + fPtBump);
149 flowTrack->SetForPOISelection(kTRUE);
150 flowTrack->SetForRPSelection(kFALSE);
151 fFlowEvent->InsertTrack(flowTrack);
155 for(Int_t i(0); i < iJets; i++) {
156 AliEmcalJet* jet = static_cast<AliEmcalJet*>(jets->At(i));
158 if(jet->PtSub() + fPtBump <= fPOIPtMin || jet->Pt() > fPOIPtMax) {
159 fHistAnalysisSummary->SetBinContent(4, 1);
163 AliFlowTrack* flowTrack = new AliFlowTrack(jet);
164 flowTrack->SetPt(jet->PtSub() + fPtBump);
165 flowTrack->SetForPOISelection(kTRUE);
166 flowTrack->SetForRPSelection(kFALSE);
167 fFlowEvent->InsertTrack(flowTrack);
172 else if(fDebug > 0 ) printf(" Failed to find TClones Jet array while using name %s \n ", fJetsName.Data());
173 if(nAcceptedJets < 1) {
174 if(fDebug > 0) printf(" > No accepted jets in event ! < " );
177 fCentralitySelection->Fill(InputEvent()->GetCentrality()->GetCentralityPercentile("V0M"));
178 PostData(1, fOutputList);
179 PostData(2, fFlowEvent);
181 printf(" Event summary \n");
182 printf(" > number of POI's (jets) %i ", fFlowEvent->NumberOfTracks() - fFlowEvent->GetNumberOfRPs());
183 printf(" > number of RP's %i \n", fFlowEvent->GetNumberOfRPs());
186 //_____________________________________________________________________________
187 Bool_t AliAnalysisTaskJetFlow::PassesCuts(AliVEvent* event)
190 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
191 if(!event) return kFALSE;
192 if(TMath::Abs(InputEvent()->GetPrimaryVertex()->GetZ()) > 10.) return kFALSE;
193 // aod and esd specific checks
196 AliESDEvent* esdEvent = static_cast<AliESDEvent*>(InputEvent());
197 if( (!esdEvent) || (TMath::Abs(esdEvent->GetPrimaryVertexSPD()->GetZ() - esdEvent->GetPrimaryVertex()->GetZ()) > .5) ) return kFALSE;
200 AliAODEvent* aodEvent = static_cast<AliAODEvent*>(InputEvent());
201 if( (!aodEvent) || (TMath::Abs(aodEvent->GetPrimaryVertexSPD()->GetZ() - aodEvent->GetPrimaryVertex()->GetZ()) > .5) ) return kFALSE;
205 Float_t cent(InputEvent()->GetCentrality()->GetCentralityPercentile("V0M"));
206 return (cent <= fCentralityMin || cent > fCentralityMax || TMath::Abs(cent-InputEvent()->GetCentrality()->GetCentralityPercentile("TRK")) > 5.) ? kFALSE : kTRUE;
208 //_____________________________________________________________________________
209 void AliAnalysisTaskJetFlow::Terminate(Option_t *)
212 if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
214 //_____________________________________________________________________________