]>
Commit | Line | Data |
---|---|---|
67427ff7 | 1 | /*************************************************************************** |
2 | * | |
3 | * $Id$ | |
4 | * | |
5 | * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu | |
6 | *************************************************************************** | |
7 | * | |
8 | * Description: part of STAR HBT Framework: AliFemtoMaker package | |
9 | * The Manager is the top-level object that coordinates activities | |
10 | * and performs event, particle, and pair loops, and checks the | |
11 | * various Cuts of the Analyses in its AnalysisCollection | |
12 | * | |
13 | *************************************************************************** | |
14 | * | |
15 | * $Log$ | |
0215f606 | 16 | * Revision 1.1.1.1 2007/04/25 15:38:41 panos |
17 | * Importing the HBT code dir | |
18 | * | |
67427ff7 | 19 | * Revision 1.1.1.1 2007/03/07 10:14:49 mchojnacki |
20 | * First version on CVS | |
21 | * | |
22 | * Revision 1.20 2001/06/21 19:15:46 laue | |
23 | * Modified fiels: | |
24 | * CTH.h : new constructor added | |
25 | * AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent | |
26 | * (TTree) classes added | |
27 | * AliFemtoLikeSignAnalysis : minor changes, for debugging | |
28 | * AliFemtoTypes: split into different files | |
29 | * Added files: for the new TTree muDst's | |
30 | * StExceptions.cxx StExceptions.h AliFemtoEnumeration.h | |
31 | * AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h | |
32 | * AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx | |
33 | * AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h | |
34 | * AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h | |
35 | * | |
36 | * Revision 1.19 2000/05/08 15:45:50 laue | |
37 | * Memory leak fixed. Current hbt event was not deleted | |
38 | * | |
39 | * Revision 1.18 2000/03/17 17:23:05 laue | |
40 | * Roberts new three particle correlations implemented. | |
41 | * | |
42 | * Revision 1.16 2000/02/26 19:04:52 laue | |
43 | * Some unnecessary includes removed. | |
44 | * StThreeVectorD replace by AliFemtoThreeVector. | |
45 | * AliFemtoCoulomb modified to compile without Root (ClassDef embraced into | |
46 | * #ifdef __ROOT__ ..... #endif) | |
47 | * AliFemtoParticle now returns references (FourMomentum(),Helix(), | |
48 | * DecayVertexPosiion()) | |
49 | * | |
50 | * Revision 1.15 2000/02/18 21:32:24 laue | |
51 | * franksTrackCut changed. If mCharge is set to '0' there will be no cut | |
52 | * on charge. This is important for front-loaded cuts. | |
53 | * | |
54 | * copy constructor implemented for AliFemtoEvent, AliFemtoTrack and AliFemtoV0. | |
55 | * | |
56 | * franks1HistoD.cxx franks1HistoD.h franks2HistoD.cxx franks2HistoD.h | |
57 | * removed. We can now (CC5 on Solaris) use the versions (no D) | |
58 | * | |
59 | * Revision 1.14 2000/02/13 17:17:12 laue | |
60 | * Calls to the EventBegin() and EventEnd() functions implemented | |
61 | * The actual analysis is moved from AliFemtoManager to AliFemtoAnalysis | |
62 | * | |
63 | * Revision 1.13 2000/01/25 17:35:17 laue | |
64 | * I. In order to run the stand alone version of the AliFemtoMaker the following | |
65 | * changes have been done: | |
66 | * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements | |
67 | * b) unnecessary includes of StMaker.h have been removed | |
68 | * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything | |
69 | * needed for the stand alone version | |
70 | * | |
71 | * II. To reduce the amount of compiler warning | |
72 | * a) some variables have been type casted | |
73 | * b) some destructors have been declared as virtual | |
74 | * | |
75 | * Revision 1.12 1999/10/15 01:57:29 lisa | |
76 | * Important enhancement of AliFemtoMaker - implement Franks CutMonitors | |
77 | * ---------------------------------------------------------- | |
78 | * This means 3 new files in Infrastructure area (CutMonitor), | |
79 | * several specific CutMonitor classes in the Cut area | |
80 | * and a new base class in the Base area (AliFemtoCutMonitor). | |
81 | * This means also changing all Cut Base class header files from .h to .h | |
82 | * so we have access to CutMonitor methods from Cint command line. | |
83 | * This last means | |
84 | * 1) files which include these header files are slightly modified | |
85 | * 2) a side benefit: the TrackCuts and V0Cuts no longer need | |
86 | * a SetMass() implementation in each Cut class, which was stupid. | |
87 | * Also: | |
88 | * ----- | |
89 | * Include Franks AliFemtoAssociationReader | |
90 | * ** None of these changes should affect any user ** | |
91 | * | |
92 | * Revision 1.11 1999/10/04 15:38:57 lisa | |
93 | * include Franks new accessor methods AliFemtoAnalysis::CorrFctn and AliFemtoManager::Analysis as well as McEnt example macro | |
94 | * | |
95 | * Revision 1.10 1999/09/17 22:38:02 lisa | |
96 | * first full integration of V0s into AliFemto framework | |
97 | * | |
98 | * Revision 1.9 1999/09/08 04:15:52 lisa | |
99 | * persistent microDST implementation tweaked to please fickle solaris details | |
100 | * | |
101 | * Revision 1.8 1999/09/05 02:58:11 lisa | |
102 | * add ASCII microDST reader/writer AND franksParticle cuts | |
103 | * | |
104 | * Revision 1.7 1999/09/04 04:41:01 lisa | |
105 | * AliFemtoEvent IO --and-- AliFemtoEventWriter (microDST) method added to framework | |
106 | * | |
107 | * Revision 1.6 1999/09/03 22:39:15 lisa | |
108 | * Readers now MUST have Report() methods and MAY have WriteHbtEvent() methods | |
109 | * | |
110 | * Revision 1.5 1999/07/27 10:47:04 lisa | |
111 | * now works in dev on linux and solaris - mistake in deleting picoEvents fixed | |
112 | * | |
113 | * Revision 1.4 1999/07/26 16:21:26 lisa | |
114 | * always convert string to char when output - needed on solaris | |
115 | * | |
116 | * Revision 1.3 1999/07/22 18:49:10 lisa | |
117 | * Implement idea of Fabrice to not create and delete AliFemtoPair all the time | |
118 | * | |
119 | * Revision 1.2 1999/07/06 22:33:22 lisa | |
120 | * Adjusted all to work in pro and new - dev itself is broken | |
121 | * | |
122 | * Revision 1.1.1.1 1999/06/29 16:02:57 lisa | |
123 | * Installation of AliFemtoMaker | |
124 | * | |
125 | **************************************************************************/ | |
126 | ||
127 | #include "Infrastructure/AliFemtoManager.h" | |
128 | //#include "Infrastructure/AliFemtoParticleCollection.h" | |
129 | //#include "Base/AliFemtoTrackCut.h" | |
130 | //#include "Base/AliFemtoV0Cut.h" | |
131 | #include <cstdio> | |
132 | ||
133 | #ifdef __ROOT__ | |
134 | ClassImp(AliFemtoManager) | |
135 | #endif | |
136 | ||
137 | ||
138 | ||
139 | //____________________________ | |
0215f606 | 140 | AliFemtoManager::AliFemtoManager(): |
141 | fAnalysisCollection(0), | |
142 | fEventReader(0), | |
143 | fEventWriterCollection(0) | |
144 | { | |
67427ff7 | 145 | fAnalysisCollection = new AliFemtoAnalysisCollection; |
146 | fEventWriterCollection = new AliFemtoEventWriterCollection; | |
147 | fEventReader = 0; | |
148 | } | |
0215f606 | 149 | //____________________________ |
150 | AliFemtoManager::AliFemtoManager(const AliFemtoManager& aManager) : | |
151 | fAnalysisCollection(0), | |
152 | fEventReader(0), | |
153 | fEventWriterCollection(0) | |
154 | { | |
155 | fEventReader = aManager.fEventReader; | |
156 | AliFemtoAnalysisIterator AnalysisIter; | |
157 | fAnalysisCollection = new AliFemtoAnalysisCollection; | |
158 | for (AnalysisIter=aManager.fAnalysisCollection->begin();AnalysisIter!=aManager.fAnalysisCollection->end();AnalysisIter++){ | |
159 | fAnalysisCollection->push_back(*AnalysisIter); | |
160 | } | |
161 | AliFemtoEventWriterIterator EventWriterIter; | |
162 | fEventWriterCollection = new AliFemtoEventWriterCollection; | |
163 | for (EventWriterIter=aManager.fEventWriterCollection->begin();EventWriterIter!=aManager.fEventWriterCollection->end();EventWriterIter++){ | |
164 | fEventWriterCollection->push_back(*EventWriterIter); | |
165 | } | |
166 | } | |
167 | ||
67427ff7 | 168 | //____________________________ |
169 | AliFemtoManager::~AliFemtoManager(){ | |
170 | delete fEventReader; | |
171 | // now delete each Analysis in the Collection, and then the Collection itself | |
172 | AliFemtoAnalysisIterator AnalysisIter; | |
173 | for (AnalysisIter=fAnalysisCollection->begin();AnalysisIter!=fAnalysisCollection->end();AnalysisIter++){ | |
174 | delete *AnalysisIter; | |
175 | *AnalysisIter = 0; | |
176 | } | |
177 | delete fAnalysisCollection; | |
178 | // now delete each EventWriter in the Collection, and then the Collection itself | |
179 | AliFemtoEventWriterIterator EventWriterIter; | |
180 | for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){ | |
181 | delete *EventWriterIter; | |
182 | *EventWriterIter = 0; | |
183 | } | |
184 | delete fEventWriterCollection; | |
185 | } | |
0215f606 | 186 | //____________________________ |
187 | AliFemtoManager& AliFemtoManager::operator=(const AliFemtoManager& aManager) | |
188 | { | |
189 | if (this == &aManager) | |
190 | return *this; | |
191 | ||
192 | fEventReader = aManager.fEventReader; | |
193 | AliFemtoAnalysisIterator AnalysisIter; | |
194 | if (fAnalysisCollection) { | |
195 | for (AnalysisIter=fAnalysisCollection->begin();AnalysisIter!=fAnalysisCollection->end();AnalysisIter++){ | |
196 | delete *AnalysisIter; | |
197 | *AnalysisIter = 0; | |
198 | } | |
199 | delete fAnalysisCollection; | |
200 | } | |
201 | // now delete each EventWriter in the Collection, and then the Collection itself | |
202 | AliFemtoEventWriterIterator EventWriterIter; | |
203 | if (fEventWriterCollection) { | |
204 | for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){ | |
205 | delete *EventWriterIter; | |
206 | *EventWriterIter = 0; | |
207 | } | |
208 | delete fEventWriterCollection; | |
209 | } | |
210 | ||
211 | fAnalysisCollection = new AliFemtoAnalysisCollection; | |
212 | for (AnalysisIter=aManager.fAnalysisCollection->begin();AnalysisIter!=aManager.fAnalysisCollection->end();AnalysisIter++){ | |
213 | fAnalysisCollection->push_back(*AnalysisIter); | |
214 | } | |
215 | ||
216 | fEventWriterCollection = new AliFemtoEventWriterCollection; | |
217 | for (EventWriterIter=aManager.fEventWriterCollection->begin();EventWriterIter!=aManager.fEventWriterCollection->end();EventWriterIter++){ | |
218 | fEventWriterCollection->push_back(*EventWriterIter); | |
219 | } | |
220 | return *this; | |
221 | } | |
222 | ||
67427ff7 | 223 | //____________________________ |
224 | int AliFemtoManager::Init(){ | |
225 | AliFemtoString readerMessage; | |
226 | readerMessage += "*** *** *** *** *** *** *** *** *** *** *** *** \n"; | |
227 | // EventReader | |
228 | if (fEventReader) { | |
229 | if (fEventReader->Init("r",readerMessage)){ | |
230 | cout << " AliFemtoManager::Init() - Reader initialization failed " << endl; | |
231 | return (1); | |
232 | } | |
233 | readerMessage += fEventReader->Report(); | |
234 | } | |
235 | // EventWriters | |
236 | AliFemtoEventWriterIterator EventWriterIter; | |
237 | for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){ | |
238 | //cout << "*EventWriterIter " << *EventWriterIter << endl; | |
239 | // The message (AliFemtoString) passed into Init will be at the file header. | |
240 | // for that reason take the readerReport, add my own report and pass as message | |
241 | AliFemtoString writerMessage = readerMessage; | |
242 | writerMessage += "*** *** *** *** *** *** *** *** *** *** *** *** \n"; | |
243 | writerMessage += (*EventWriterIter)->Report(); | |
244 | if (*EventWriterIter) { | |
245 | if ( (*EventWriterIter)->Init("w",writerMessage)){ // yes, the message from the reader is passed into the writer | |
246 | cout << " AliFemtoManager::Init() - Writer initialization failed " << endl; | |
247 | return (1); | |
248 | } | |
249 | } | |
250 | } | |
251 | ||
252 | ||
253 | return (0); | |
254 | } | |
255 | //____________________________ | |
256 | void AliFemtoManager::Finish(){ | |
257 | // EventReader | |
258 | if (fEventReader) fEventReader->Finish(); | |
259 | // EventWriters | |
260 | AliFemtoEventWriterIterator EventWriterIter; | |
261 | AliFemtoEventWriter* currentEventWriter; | |
262 | for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){ | |
263 | currentEventWriter = *EventWriterIter; | |
264 | currentEventWriter->Finish(); | |
265 | } | |
266 | // Analyses | |
267 | AliFemtoAnalysisIterator AnalysisIter; | |
268 | AliFemtoBaseAnalysis* currentAnalysis; | |
269 | for (AnalysisIter=fAnalysisCollection->begin();AnalysisIter!=fAnalysisCollection->end();AnalysisIter++){ | |
270 | currentAnalysis = *AnalysisIter; | |
271 | currentAnalysis->Finish(); | |
272 | } | |
273 | } | |
274 | //____________________________ | |
275 | AliFemtoString AliFemtoManager::Report(){ | |
276 | string stemp; | |
277 | char ctemp[100]; | |
278 | // EventReader | |
279 | stemp = fEventReader->Report(); | |
280 | // EventWriters | |
0215f606 | 281 | sprintf(ctemp,"\nAliFemtoManager Reporting %u EventWriters\n",(unsigned int) fEventWriterCollection->size()); |
67427ff7 | 282 | stemp += ctemp; |
283 | AliFemtoEventWriterIterator EventWriterIter; | |
284 | AliFemtoEventWriter* currentEventWriter; | |
285 | for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){ | |
286 | cout << "AliFemtoManager - asking for EventWriter Report" << endl; | |
287 | currentEventWriter = *EventWriterIter; | |
288 | stemp+=currentEventWriter->Report(); | |
289 | } | |
290 | // Analyses | |
0215f606 | 291 | sprintf(ctemp,"\nAliFemtoManager Reporting %u Analyses\n",(unsigned int) fAnalysisCollection->size()); |
67427ff7 | 292 | stemp += ctemp; |
293 | AliFemtoAnalysisIterator AnalysisIter; | |
294 | AliFemtoBaseAnalysis* currentAnalysis; | |
295 | for (AnalysisIter=fAnalysisCollection->begin();AnalysisIter!=fAnalysisCollection->end();AnalysisIter++){ | |
296 | cout << "AliFemtoManager - asking for Analysis Report" << endl; | |
297 | currentAnalysis = *AnalysisIter; | |
298 | stemp+=currentAnalysis->Report(); | |
299 | } | |
300 | ||
301 | AliFemtoString returnThis = stemp; | |
302 | return returnThis; | |
303 | } | |
304 | //____________________________ | |
305 | AliFemtoBaseAnalysis* AliFemtoManager::Analysis( int n ){ // return pointer to n-th analysis | |
306 | if ( n<0 || n > (int) fAnalysisCollection->size() ) | |
307 | return NULL; | |
308 | AliFemtoAnalysisIterator iter = fAnalysisCollection->begin(); | |
309 | for (int i=0; i<n ;i++){ | |
310 | iter++; | |
311 | } | |
312 | return *iter; | |
313 | } | |
314 | //____________________________ | |
315 | AliFemtoEventWriter* AliFemtoManager::EventWriter( int n ){ // return pointer to n-th analysis | |
316 | if ( n<0 || n > (int) fEventWriterCollection->size() ) | |
317 | return NULL; | |
318 | AliFemtoEventWriterIterator iter = fEventWriterCollection->begin(); | |
319 | for (int i=0; i<n ;i++){ | |
320 | iter++; | |
321 | } | |
322 | return *iter; | |
323 | } | |
324 | //____________________________ | |
325 | int AliFemtoManager::ProcessEvent(){ | |
326 | cout << "AliFemtoManager::ProcessEvent" << endl; | |
327 | // NOTE - this ReturnHbtEvent makes a *new* AliFemtoEvent - delete it when done! | |
328 | AliFemtoEvent* currentHbtEvent = fEventReader->ReturnHbtEvent(); | |
329 | cout << "Event reader has returned control to manager" << endl; | |
330 | ||
331 | // if no HbtEvent is returned, then we abort processing. | |
332 | // the question is now: do we try again next time (i.e. there may be an HbtEvent next time) | |
333 | // or are we at EOF or something? If Reader says Status=0, then that means try again later. | |
334 | // so, we just return the Reader's Status. | |
335 | if (!currentHbtEvent){ | |
336 | cout << "AliFemtoManager::ProcessEvent() - Reader::ReturnHbtEvent() has returned null pointer\n"; | |
337 | return fEventReader->Status(); | |
338 | } | |
339 | ||
340 | // loop over all the EventWriters | |
341 | AliFemtoEventWriterIterator EventWriterIter; | |
342 | for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){ | |
343 | #ifdef STHBRDEBUG | |
344 | cout << " *EventWriterIter " << *EventWriterIter << endl; | |
345 | #endif | |
346 | (*EventWriterIter)->WriteHbtEvent(currentHbtEvent); | |
347 | } | |
348 | ||
349 | // loop over all the Analysis | |
350 | AliFemtoAnalysisIterator AnalysisIter; | |
351 | for (AnalysisIter=fAnalysisCollection->begin();AnalysisIter!=fAnalysisCollection->end();AnalysisIter++){ | |
352 | (*AnalysisIter)->ProcessEvent(currentHbtEvent); | |
353 | } | |
354 | ||
355 | if (currentHbtEvent) delete currentHbtEvent; | |
356 | #ifdef STHBRDEBUG | |
357 | cout << "AliFemtoManager::ProcessEvent() - return to caller ... " << endl; | |
358 | #endif | |
359 | return 0; // 0 = "good return" | |
360 | } // ProcessEvent |