]>
Commit | Line | Data |
---|---|---|
a5c83ba9 | 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 | // Analysis task for jet correlation Analysis | |
18 | // author: B.S Chang D.J. Kim | |
19 | // ALICE Group University of Jyvaskyla | |
20 | // Finland | |
21 | // Fill the analysis containers for ESD or AOD | |
22 | // Adapted for AliAnalysisTaskSE and AOD objects | |
23 | ////////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | #include "AliAODEvent.h" | |
26 | #include "AliInputEventHandler.h" | |
27 | #include "AliAnalysisUtils.h" | |
28 | #include "AliAnalysisTaskSE.h" | |
29 | #include "AliAODHandler.h" | |
30 | #include "AliAnalysisManager.h" | |
31 | #include "AliLog.h" | |
32 | #include "AliJJetCORRTask.h" | |
33 | #include "AliJEventHeader.h" | |
34 | #include "AliJCard.h" | |
35 | #include "AliJRunTable.h" | |
36 | #include "AliJEfficiency.h" | |
37 | #include "AliJHistos.h" | |
38 | ||
39 | //______________________________________________________________________________ | |
40 | AliJJetCORRTask::AliJJetCORRTask() : | |
41 | AliAnalysisTaskSE("AliJJetCORRTaskTask"), | |
42 | fJetTask(NULL), | |
43 | fJetTaskName(""), | |
44 | fJJetCORRAnalysis(0x0), | |
45 | fOutput(NULL), | |
46 | fCard(NULL), | |
47 | fAnaUtils(NULL), | |
48 | fRunTable(NULL), | |
49 | fFirstEvent(kTRUE), | |
50 | cBin(-1), | |
51 | zBin(-1), | |
52 | zVert(-999), | |
53 | fDebugMode(0), | |
54 | fTargetJetIndex(0), | |
55 | fevt(-1) | |
56 | { | |
57 | DefineOutput (1, TDirectory::Class()); | |
58 | } | |
59 | ||
60 | //______________________________________________________________________________ | |
61 | AliJJetCORRTask::AliJJetCORRTask(const char *name, TString inputformat): | |
62 | AliAnalysisTaskSE(name), | |
63 | fJetTask(NULL), | |
64 | fJetTaskName(""), | |
65 | fJJetCORRAnalysis(0x0), | |
66 | fOutput(NULL), | |
67 | fCard(NULL), | |
68 | fAnaUtils(NULL), | |
69 | fRunTable(NULL), | |
70 | fFirstEvent(kTRUE), | |
71 | cBin(-1), | |
72 | zBin(-1), | |
73 | zVert(-999), | |
74 | fDebugMode(0), | |
75 | fTargetJetIndex(0), | |
76 | fevt(-1) | |
77 | { | |
78 | // Constructor | |
79 | AliInfo("---- AliJJetCORRTask Constructor ----"); | |
80 | ||
81 | JUNUSED(inputformat); | |
82 | DefineOutput (1, TDirectory::Class()); | |
83 | } | |
84 | ||
85 | //____________________________________________________________________________ | |
86 | AliJJetCORRTask::AliJJetCORRTask(const AliJJetCORRTask& ap) : | |
87 | AliAnalysisTaskSE(ap.GetName()), | |
88 | fJetTask(ap.fJetTask), | |
89 | fJetTaskName(ap.fJetTaskName), | |
90 | fJJetCORRAnalysis( ap.fJJetCORRAnalysis ), | |
91 | fOutput( ap.fOutput ), | |
92 | fCard( ap.fCard ), | |
93 | fAnaUtils(ap.fAnaUtils), | |
94 | fRunTable(ap.fRunTable), | |
95 | fFirstEvent(kTRUE), | |
96 | cBin(-1), | |
97 | zBin(-1), | |
98 | zVert(-999), | |
99 | fDebugMode(0), | |
100 | fTargetJetIndex(0), | |
101 | fevt(-1) | |
102 | { | |
103 | ||
104 | AliInfo("----DEBUG AliJJetCORRTask COPY ----"); | |
105 | ||
106 | } | |
107 | ||
108 | //_____________________________________________________________________________ | |
109 | AliJJetCORRTask& AliJJetCORRTask::operator = (const AliJJetCORRTask& ap) | |
110 | { | |
111 | // assignment operator | |
112 | ||
113 | AliInfo("----DEBUG AliJJetCORRTask operator= ----"); | |
114 | this->~AliJJetCORRTask(); | |
115 | new(this) AliJJetCORRTask(ap); | |
116 | return *this; | |
117 | } | |
118 | ||
119 | //______________________________________________________________________________ | |
120 | AliJJetCORRTask::~AliJJetCORRTask() | |
121 | { | |
122 | // destructor | |
123 | ||
124 | delete fJJetCORRAnalysis; | |
4265bf81 | 125 | delete fAnaUtils; |
a5c83ba9 | 126 | |
127 | } | |
128 | ||
129 | //________________________________________________________________________ | |
130 | ||
131 | void AliJJetCORRTask::UserCreateOutputObjects() | |
132 | { | |
133 | //=== create the jcorran outputs objects | |
134 | if(fDebugMode > 1) printf("AliJJetCORRTask::UserCreateOutPutData() \n"); | |
135 | ||
136 | fAnaUtils = new AliAnalysisUtils(); | |
137 | fAnaUtils->SetUseOutOfBunchPileUp( kTRUE ); | |
138 | ||
139 | //=== Get AnalysisManager | |
140 | AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager(); | |
141 | fJetTask = (AliJJetTask*)(man->GetTask( fJetTaskName)); | |
142 | ||
143 | OpenFile(1); | |
144 | fOutput = gDirectory;//->mkdir("JDiHadronCorr"); | |
145 | fOutput->cd(); | |
146 | ||
147 | fJJetCORRAnalysis = new AliJJetCORRAnalysis(fCard); | |
148 | fJJetCORRAnalysis->UserCreateOutputObjects(); | |
149 | TNamed jetFinderName("JetFinder", fJetTask->GetJetFinderString()[fTargetJetIndex].Data() ); | |
150 | jetFinderName.Write(); | |
151 | fCard->WriteCard( gDirectory ); | |
152 | ||
153 | ||
154 | PostData( 1, fOutput ); | |
155 | ||
156 | ||
157 | cout << fJetTaskName <<"\t NumberOfJetCollections = "<< fJetTask->GetNumberOfJetCollections() << endl; | |
158 | ||
159 | // Add jets into the fJJetCORRAnalysis- | |
160 | for( int ij=0;ij< fJetTask->GetNumberOfJetCollections();ij++ ){ | |
161 | fJJetCORRAnalysis->AddJets( fJetTask->GetAliJJetList( ij ) ); | |
162 | } | |
163 | ||
164 | fFirstEvent = kTRUE; | |
4265bf81 | 165 | fevt = -1; |
a5c83ba9 | 166 | |
167 | cout << "Add(fAliRunHeader) in UserCreateObject() ======= " << endl; | |
168 | } | |
169 | ||
170 | //______________________________________________________________________________ | |
171 | void AliJJetCORRTask::UserExec(Option_t* /*option*/) | |
172 | { | |
173 | ||
174 | // Processing of one event | |
175 | if(fDebugMode > 5) cout << "------- AliJJetCORRTask Exec-------"<<endl; | |
176 | if( fJetTask->GetTaskEntry() != fEntry ) return; // Make sure if we loop over the same event | |
4265bf81 | 177 | |
178 | fevt++; | |
179 | if(fevt % 1000 == 0) cout << "AliJJetCORRTask:: Numer of event scanned = "<< fevt << endl; | |
180 | ||
a5c83ba9 | 181 | fJJetCORRAnalysis->ClearBeforeEvent(); |
182 | ||
183 | // Main loop | |
184 | // Called for each event | |
185 | AliVEvent *event = InputEvent(); | |
186 | if(!event) return; | |
187 | ||
188 | //--------------------------------------------------------------- | |
189 | // check if the event was triggered or not and vertex | |
190 | ||
191 | AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(event); | |
192 | if(!aodEvent) return; | |
193 | ||
194 | if( fFirstEvent ) { | |
195 | fRunTable = & AliJRunTable::GetSpecialInstance(); | |
196 | fRunTable->SetRunNumber( aodEvent->GetRunNumber() ); | |
197 | fJJetCORRAnalysis->GetAliJEfficiency()->SetRunNumber( aodEvent->GetRunNumber() ); | |
198 | fJJetCORRAnalysis->GetAliJEfficiency()->Load(); | |
199 | fFirstEvent = kFALSE; | |
200 | } | |
201 | ||
202 | if(!IsGoodEvent( event )) return; // zBin is set there | |
4265bf81 | 203 | if(fDebugMode>5) cout << "zvtx = " << zVert << endl; |
a5c83ba9 | 204 | |
205 | // centrality | |
206 | float fcent = -999; | |
207 | if(fRunTable->IsHeavyIon() || fRunTable->IsPA()){ | |
208 | AliCentrality *cent = event->GetCentrality(); | |
209 | if( ! cent ) return; | |
210 | fcent = cent->GetCentralityPercentile("V0M"); | |
211 | } else { | |
212 | fcent = -1; | |
213 | } | |
214 | cBin = fCard->GetBin(kCentrType, fcent);; | |
215 | ||
216 | if(cBin<0) return; | |
217 | ||
218 | fJJetCORRAnalysis->SetCentralityBin( cBin ); | |
219 | fJJetCORRAnalysis->SetCentrality( fcent ); | |
220 | fJJetCORRAnalysis->SetZVertexBin( cBin ); | |
4265bf81 | 221 | fJJetCORRAnalysis->SetZVertex( zVert ); |
a5c83ba9 | 222 | fJJetCORRAnalysis->SetTargetJetIndex( fTargetJetIndex ); |
223 | ||
224 | fJJetCORRAnalysis->UserExec(); | |
225 | ||
226 | PostData(1, fOutput ); | |
227 | ||
228 | if(fDebugMode > 5) cout << "\t------- End UserExec "<<endl; | |
229 | } | |
230 | ||
231 | //______________________________________________________________________________ | |
232 | void AliJJetCORRTask::Init() | |
233 | { | |
234 | // Intialisation of parameters | |
235 | AliInfo("Doing initialization") ; | |
236 | //fJJetCORRAnalysis->Init(); | |
237 | } | |
238 | ||
239 | //______________________________________________________________________________ | |
240 | void AliJJetCORRTask::Terminate(Option_t *) | |
241 | { | |
242 | cout<<"AliJJetCORRTask Analysis DONE !!"<<endl; | |
243 | ||
244 | } | |
245 | ||
246 | //________________________________________________________________________ | |
247 | bool AliJJetCORRTask::IsGoodEvent(AliVEvent *event) { | |
248 | ||
249 | if(fRunTable->IsPP() && fAnaUtils->IsPileUpEvent(event)) { | |
250 | return kFALSE; | |
251 | } else { | |
252 | Bool_t triggeredEventMB = kFALSE; //init | |
253 | ||
254 | fJJetCORRAnalysis->GetAliJHistos()->fhEvents->Fill( 0 ); | |
255 | ||
256 | Bool_t triggerkMB = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & ( AliVEvent::kMB ); | |
257 | ||
258 | if( triggerkMB ){ | |
259 | triggeredEventMB = kTRUE; //event triggered as minimum bias | |
260 | fJJetCORRAnalysis->GetAliJHistos()->fhEvents->Fill( 1 ); | |
261 | } | |
262 | //-------------------------------------------------------------- | |
263 | // check reconstructed vertex | |
264 | int ncontributors = 0; | |
265 | Bool_t goodRecVertex = kFALSE; | |
266 | const AliVVertex *vtx = event->GetPrimaryVertex(); | |
267 | if(vtx){ | |
268 | ncontributors = vtx->GetNContributors(); | |
269 | if(ncontributors > 0){ | |
270 | zVert = vtx->GetZ(); | |
271 | fJJetCORRAnalysis->GetAliJHistos()->fhEvents->Fill( 2 ); | |
272 | if(fCard->VertInZRange(zVert)) { | |
273 | goodRecVertex = kTRUE; | |
274 | fJJetCORRAnalysis->GetAliJHistos()->fhEvents->Fill( 3 ); | |
275 | zBin = fCard->GetBin(kZVertType, zVert); | |
276 | } | |
277 | } | |
278 | } | |
279 | return goodRecVertex; | |
280 | } | |
281 | //--------------------------------- | |
282 | } |