]>
Commit | Line | Data |
---|---|---|
e1dc3f11 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | * AliAnaysisTaskJet | |
18 | * author: Redmer Alexander Bertens | |
19 | * rbertens@cern.ch, rbertens@nikhef.nl, r.a.bertens@uu.nl | |
20 | * | |
21 | * jet correlation task - correlates jets to the vzero reaction plane using | |
22 | * the scalar product method | |
23 | * | |
a4a06f0e | 24 | * this task expects POI's in a TClonesArray, e.g. from running it after |
e1dc3f11 | 25 | * $ALICE_ROOT/PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRhoVnModulation() |
a4a06f0e | 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) | |
e1dc3f11 | 28 | * |
29 | * */ | |
30 | ||
31 | #include <TChain.h> | |
32 | #include <TH1F.h> | |
33 | #include <AliAnalysisTask.h> | |
34 | #include <AliAnalysisManager.h> | |
35 | #include <AliFlowEventSimple.h> | |
36 | #include <AliFlowTrack.h> | |
37 | #include <AliFlowTrackCuts.h> | |
2045ca8b | 38 | #include <AliFlowEventCuts.h> |
e1dc3f11 | 39 | #include <AliFlowCommonConstants.h> |
40 | #include <TString.h> | |
98bd4878 | 41 | #include <AliAODEvent.h> |
42 | #include <AliESDEvent.h> | |
2db2a6d0 | 43 | #include <AliEmcalJet.h> |
e1dc3f11 | 44 | |
45 | #include "AliAnalysisTaskJetFlow.h" | |
46 | ||
47 | class AliAnalysisTaskJetFlow; | |
48 | ||
49 | using namespace std; | |
50 | ||
51 | ClassImp(AliAnalysisTaskJetFlow) | |
52 | ||
53 | AliAnalysisTaskJetFlow::AliAnalysisTaskJetFlow() : AliAnalysisTaskSE(), | |
a4a06f0e | 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) |
98bd4878 | 55 | { /* default constructor */ } |
e1dc3f11 | 56 | //_____________________________________________________________________________ |
57 | AliAnalysisTaskJetFlow::AliAnalysisTaskJetFlow(const char* name) : AliAnalysisTaskSE(name), | |
a4a06f0e | 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) |
e1dc3f11 | 59 | { |
60 | // constructor | |
61 | DefineInput(0, TChain::Class()); | |
62 | DefineOutput(1, TList::Class()); | |
63 | DefineOutput(2, AliFlowEventSimple::Class()); | |
64 | } | |
65 | //_____________________________________________________________________________ | |
66 | AliAnalysisTaskJetFlow::~AliAnalysisTaskJetFlow() | |
67 | { | |
68 | // destructor | |
69 | if(fOutputList) delete fOutputList; | |
70 | if(fFlowEvent) delete fFlowEvent; | |
2045ca8b | 71 | if(fCutsEvent) delete fCutsEvent; |
e1dc3f11 | 72 | } |
73 | //_____________________________________________________________________________ | |
98bd4878 | 74 | void AliAnalysisTaskJetFlow::LocalInit() |
75 | { | |
76 | // executed once | |
77 | if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); | |
2045ca8b | 78 | fCutsEvent = new AliFlowEventCuts(); |
79 | fCutsEvent->SetRefMultMethod(AliESDtrackCuts::kTrackletsITSTPC); | |
98bd4878 | 80 | } |
81 | //_____________________________________________________________________________ | |
e1dc3f11 | 82 | void AliAnalysisTaskJetFlow::UserCreateOutputObjects() |
83 | { | |
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); | |
98bd4878 | 88 | // histograms |
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); | |
a4a06f0e | 98 | // qa |
99 | fCentralitySelection = new TH1F("fCentralitySelection", "fCentralitySelection", 100, 0, 100); | |
100 | fOutputList->Add(fCentralitySelection); | |
101 | ||
e1dc3f11 | 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(); | |
626d6bc4 | 107 | cc->SetPtMax(fCCMaxPt+fPtBump); |
108 | cc->SetNbinsPt(fCCBinsInPt); | |
e1dc3f11 | 109 | } |
110 | //_____________________________________________________________________________ | |
111 | void AliAnalysisTaskJetFlow::UserExec(Option_t *) | |
112 | { | |
113 | // user exec | |
114 | if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); | |
e1dc3f11 | 115 | if(!InputEvent() || !fCutsNull || !fCutsRP) return; // coverity (and sanity) |
a4a06f0e | 116 | if(!fInitialized) { |
117 | if(dynamic_cast<AliAODEvent*>(InputEvent())) fDataType = kAOD; // determine the datatype | |
118 | else if(dynamic_cast<AliESDEvent*>(InputEvent())) fDataType = kESD; | |
119 | fInitialized = kTRUE; | |
120 | } | |
121 | if(!PassesCuts(InputEvent())) return; // check the event cuts | |
e1dc3f11 | 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())); | |
2db2a6d0 | 124 | Int_t nAcceptedJets(0); |
e1dc3f11 | 125 | if(jets) { |
126 | Int_t iJets = jets->GetEntriesFast(); | |
127 | if(iJets <= 0) { | |
128 | if(fDebug>0) printf(" > Retrieved empty AliVEvent extension, aborting ! < \n "); | |
129 | return; | |
130 | } | |
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); | |
2045ca8b | 136 | fFlowEvent->SetReferenceMultiplicity(fCutsEvent->RefMult(InputEvent(), MCEvent())); |
e1dc3f11 | 137 | // loop over jets and inject them as POI's |
a4a06f0e | 138 | if(fVParticleAnalysis) { |
139 | for(Int_t i(0); i < iJets; i++) { | |
140 | AliVParticle* jet = static_cast<AliVParticle*>(jets->At(i)); | |
141 | if(jet) { | |
142 | if(jet->Pt() + fPtBump <= fPOIPtMin || jet->Pt() > fPOIPtMax) { | |
143 | fHistAnalysisSummary->SetBinContent(4, 1); | |
144 | continue; | |
145 | } | |
146 | nAcceptedJets++; | |
147 | AliFlowTrack* flowTrack = new AliFlowTrack(jet); | |
148 | flowTrack->SetPt(jet->Pt() + fPtBump); | |
149 | flowTrack->SetForPOISelection(kTRUE); | |
150 | flowTrack->SetForRPSelection(kFALSE); | |
151 | fFlowEvent->InsertTrack(flowTrack); | |
152 | } | |
153 | } | |
154 | } else { | |
155 | for(Int_t i(0); i < iJets; i++) { | |
156 | AliEmcalJet* jet = static_cast<AliEmcalJet*>(jets->At(i)); | |
157 | if(jet) { | |
158 | if(jet->PtSub() + fPtBump <= fPOIPtMin || jet->Pt() > fPOIPtMax) { | |
159 | fHistAnalysisSummary->SetBinContent(4, 1); | |
160 | continue; | |
161 | } | |
162 | nAcceptedJets++; | |
163 | AliFlowTrack* flowTrack = new AliFlowTrack(jet); | |
164 | flowTrack->SetPt(jet->PtSub() + fPtBump); | |
165 | flowTrack->SetForPOISelection(kTRUE); | |
166 | flowTrack->SetForRPSelection(kFALSE); | |
167 | fFlowEvent->InsertTrack(flowTrack); | |
98bd4878 | 168 | } |
2db2a6d0 | 169 | } |
e1dc3f11 | 170 | } |
171 | } | |
172 | else if(fDebug > 0 ) printf(" Failed to find TClones Jet array while using name %s \n ", fJetsName.Data()); | |
2db2a6d0 | 173 | if(nAcceptedJets < 1) { |
2045ca8b | 174 | if(fDebug > 0) printf(" > No accepted jets in event ! < " ); |
2db2a6d0 | 175 | return; |
176 | } | |
a4a06f0e | 177 | fCentralitySelection->Fill(InputEvent()->GetCentrality()->GetCentralityPercentile("V0M")); |
e1dc3f11 | 178 | PostData(1, fOutputList); |
179 | PostData(2, fFlowEvent); | |
180 | if(fDebug>0) { | |
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()); | |
184 | } | |
185 | } | |
186 | //_____________________________________________________________________________ | |
98bd4878 | 187 | Bool_t AliAnalysisTaskJetFlow::PassesCuts(AliVEvent* event) |
188 | { | |
189 | // event cuts | |
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 | |
194 | switch (fDataType) { | |
195 | case kESD: { | |
196 | AliESDEvent* esdEvent = static_cast<AliESDEvent*>(InputEvent()); | |
197 | if( (!esdEvent) || (TMath::Abs(esdEvent->GetPrimaryVertexSPD()->GetZ() - esdEvent->GetPrimaryVertex()->GetZ()) > .5) ) return kFALSE; | |
198 | } break; | |
199 | case kAOD: { | |
200 | AliAODEvent* aodEvent = static_cast<AliAODEvent*>(InputEvent()); | |
201 | if( (!aodEvent) || (TMath::Abs(aodEvent->GetPrimaryVertexSPD()->GetZ() - aodEvent->GetPrimaryVertex()->GetZ()) > .5) ) return kFALSE; | |
202 | } break; | |
203 | default: break; | |
204 | } | |
205 | Float_t cent(InputEvent()->GetCentrality()->GetCentralityPercentile("V0M")); | |
206 | return (cent <= fCentralityMin || cent > fCentralityMax || TMath::Abs(cent-InputEvent()->GetCentrality()->GetCentralityPercentile("TRK")) > 5.) ? kFALSE : kTRUE; | |
207 | } | |
208 | //_____________________________________________________________________________ | |
e1dc3f11 | 209 | void AliAnalysisTaskJetFlow::Terminate(Option_t *) |
210 | { | |
211 | // terminate | |
212 | if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__); | |
213 | } | |
214 | //_____________________________________________________________________________ |