]>
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 di-jet Analysis | |
18 | // author: R.Diaz, J. Rak, 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 "AliAnalysisTaskSE.h" | |
26 | #include "AliAODHandler.h" | |
27 | #include "AliAnalysisManager.h" | |
28 | #include "AliLog.h" | |
29 | #include "AliJDiJetTask.h" | |
30 | #include "AliJEventHeader.h" | |
31 | #include "AliJRunHeader.h" | |
32 | #include "AliJCORRANTask.h" | |
33 | #include "AliJCard.h" | |
34 | #include "AliJRunTable.h" | |
35 | #include "AliAnalysisUtils.h" | |
36 | ||
37 | //______________________________________________________________________________ | |
38 | AliJDiJetTask::AliJDiJetTask() : | |
39 | AliAnalysisTaskSE("AliJDiJetTaskTask"), | |
40 | fJetTask(NULL), | |
41 | fJetTaskName(""), | |
42 | fJDiJetAnalysis(0x0), | |
43 | fOutput(NULL), | |
44 | fFirstEvent(kTRUE), | |
45 | fAnaUtils(NULL), | |
46 | fRunTable(NULL), | |
47 | fCard(NULL) | |
48 | { | |
49 | DefineOutput (1, TDirectory::Class()); | |
50 | } | |
51 | ||
52 | //______________________________________________________________________________ | |
53 | AliJDiJetTask::AliJDiJetTask(const char *name, TString inputformat): | |
54 | AliAnalysisTaskSE(name), | |
55 | fJetTask(NULL), | |
56 | fJetTaskName(""), | |
57 | fJDiJetAnalysis(0x0), | |
58 | fOutput(NULL), | |
59 | fFirstEvent(kTRUE), | |
60 | fAnaUtils(NULL), | |
61 | fRunTable(NULL), | |
62 | fCard(NULL) | |
63 | { | |
64 | // Constructor | |
65 | AliInfo("---- AliJDiJetTask Constructor ----"); | |
66 | ||
67 | JUNUSED(inputformat); | |
68 | DefineOutput (1, TDirectory::Class()); | |
69 | } | |
70 | ||
71 | //____________________________________________________________________________ | |
72 | AliJDiJetTask::AliJDiJetTask(const AliJDiJetTask& ap) : | |
73 | AliAnalysisTaskSE(ap.GetName()), | |
74 | fJetTask(ap.fJetTask), | |
75 | fJetTaskName(ap.fJetTaskName), | |
76 | fJDiJetAnalysis( ap.fJDiJetAnalysis ), | |
77 | fOutput( ap.fOutput ), | |
78 | fFirstEvent( ap.fFirstEvent), | |
79 | fAnaUtils(ap.fAnaUtils), | |
80 | fRunTable(ap.fRunTable), | |
81 | fCard( ap.fCard ) | |
82 | { | |
83 | ||
84 | AliInfo("----DEBUG AliJDiJetTask COPY ----"); | |
85 | ||
86 | } | |
87 | ||
88 | //_____________________________________________________________________________ | |
89 | AliJDiJetTask& AliJDiJetTask::operator = (const AliJDiJetTask& ap) | |
90 | { | |
91 | // assignment operator | |
92 | ||
93 | AliInfo("----DEBUG AliJDiJetTask operator= ----"); | |
94 | this->~AliJDiJetTask(); | |
95 | new(this) AliJDiJetTask(ap); | |
96 | return *this; | |
97 | } | |
98 | ||
99 | //______________________________________________________________________________ | |
100 | AliJDiJetTask::~AliJDiJetTask() | |
101 | { | |
102 | // destructor | |
103 | ||
104 | delete fJDiJetAnalysis; | |
105 | delete fAnaUtils; | |
106 | ||
107 | } | |
108 | ||
109 | //________________________________________________________________________ | |
110 | ||
111 | void AliJDiJetTask::UserCreateOutputObjects() | |
112 | { | |
113 | //=== create the jcorran outputs objects | |
114 | if(fDebug > 1) printf("AliJDiJetTask::UserCreateOutPutData() \n"); | |
115 | ||
116 | fAnaUtils = new AliAnalysisUtils(); | |
117 | fAnaUtils->SetUseOutOfBunchPileUp( kTRUE ); | |
118 | ||
119 | //=== Get AnalysisManager | |
120 | AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager(); | |
121 | ||
122 | OpenFile(1); | |
123 | fOutput = gDirectory;//->mkdir("JDiHadronCorr"); | |
124 | fOutput->cd(); | |
125 | ||
126 | fJDiJetAnalysis = new AliJDiJetAnalysis(fCard); | |
127 | fJDiJetAnalysis->UserCreateOutputObjects(); | |
128 | fCard->WriteCard( gDirectory ); | |
129 | ||
130 | PostData( 1, fOutput ); | |
131 | ||
132 | fJetTask = (AliJJetTask*)(man->GetTask( fJetTaskName)); | |
133 | ||
134 | fJDiJetAnalysis->AddJets( NULL ); | |
135 | fJDiJetAnalysis->AddJets( NULL ); | |
136 | //for( int ij=0;ij< fJetTask->GetNumberOfJetCollections();ij++ ){ | |
137 | // fJDiJetAnalysis->AddJets( fJetTask->GetAliJJetList( ij ) ); | |
138 | //} | |
139 | fJDiJetAnalysis->AddJets( fJetTask->GetAliJJetList( 0 ) ); | |
140 | fJDiJetAnalysis->AddJets( fJetTask->GetAliJJetList( 1 ) ); | |
141 | fJDiJetAnalysis->AddJets( fJetTask->GetAliJJetList( 3 ) ); | |
142 | fJDiJetAnalysis->AddJets( fJetTask->GetAliJJetList( 4 ) ); | |
143 | ||
144 | // TODO | |
145 | ||
146 | ||
147 | ||
148 | cout << "Add(fAliRunHeader) in UserCreateObject() ======= " << endl; | |
149 | } | |
150 | ||
151 | //______________________________________________________________________________ | |
152 | void AliJDiJetTask::UserExec(Option_t* /*option*/) | |
153 | { | |
154 | ||
155 | // Processing of one event | |
156 | if(fDebug > 5) cout << "------- AliJDiJetTask Exec-------"<<endl; | |
157 | ||
158 | // Check Event | |
159 | if( fJetTask->GetTaskEntry() != fEntry ) return; | |
160 | AliVEvent *event = InputEvent(); | |
161 | if(!event) return; | |
162 | AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(event); | |
163 | if(!aodEvent) return; | |
164 | if( fFirstEvent ) { | |
165 | fRunTable = & AliJRunTable::GetSpecialInstance(); | |
166 | fRunTable->SetRunNumber( aodEvent->GetRunNumber() ); | |
167 | fFirstEvent = kFALSE; | |
168 | } | |
169 | if(!IsGoodEvent( event )) return; // zBin is set there | |
170 | ||
171 | // Call DiJetAnalysis | |
172 | fJDiJetAnalysis->ClearBeforeEvent(); | |
173 | fJDiJetAnalysis->UserExec(); | |
174 | PostData(1, fOutput ); | |
175 | ||
176 | if(fDebug > 5) cout << "\t------- End UserExec "<<endl; | |
177 | } | |
178 | ||
179 | //______________________________________________________________________________ | |
180 | void AliJDiJetTask::Init() | |
181 | { | |
182 | // Intialisation of parameters | |
183 | AliInfo("Doing initialization") ; | |
184 | //fJDiJetAnalysis->Init(); | |
185 | } | |
186 | ||
187 | //______________________________________________________________________________ | |
188 | void AliJDiJetTask::Terminate(Option_t *) | |
189 | { | |
190 | cout<<"AliJDiJetTask Analysis DONE !!"<<endl; | |
191 | ||
192 | } | |
193 | ||
194 | //________________________________________________________________________ | |
195 | bool AliJDiJetTask::IsGoodEvent(AliVEvent *event) { | |
196 | ||
197 | // TODO pile up test for PP | |
198 | if(fRunTable->IsPP() && fAnaUtils->IsPileUpEvent(event)) { | |
199 | return kFALSE; | |
200 | } else { | |
201 | Bool_t triggeredEventMB = kFALSE; //init | |
202 | ||
203 | Bool_t triggerkMB = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & ( AliVEvent::kMB ); | |
204 | ||
205 | if( triggerkMB ){ | |
206 | triggeredEventMB = kTRUE; //event triggered as minimum bias | |
207 | } | |
208 | //-------------------------------------------------------------- | |
209 | // check reconstructed vertex | |
210 | int ncontributors = 0; | |
211 | Bool_t goodRecVertex = kFALSE; | |
212 | const AliVVertex *vtx = event->GetPrimaryVertex(); | |
213 | if(vtx){ | |
214 | ncontributors = vtx->GetNContributors(); | |
215 | if(ncontributors > 0){ | |
216 | double zVert = vtx->GetZ(); | |
217 | if(fCard->VertInZRange(zVert)) { | |
218 | goodRecVertex = kTRUE; | |
219 | } | |
220 | } | |
221 | } | |
222 | return goodRecVertex; | |
223 | } | |
224 | //--------------------------------- | |
225 | } |