]>
Commit | Line | Data |
---|---|---|
4ae78bb1 | 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 | /* $Id: */ | |
17 | ||
18 | /* $Log: | |
19 | 29.05.2001 Yuri Kharlov: | |
20 | Everywhere reading the treese TTree->GetEvent(i) | |
21 | is replaced by reading the branches TBranch->GetEntry(0) | |
22 | */ | |
23 | ||
24 | //_________________________________________________________________________ | |
25 | // A singleton. This class should be used in the analysis stage to get | |
26 | // reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles, | |
27 | // instead of directly reading them from galice.root file. This container | |
28 | // ensures, that one reads Digits, made of these particular digits, RecPoints, | |
29 | // made of these particular RecPoints, TrackSegments and RecParticles. | |
30 | // This becomes non trivial if there are several identical branches, produced with | |
31 | // different set of parameters. | |
32 | // | |
33 | // An example of how to use (see also class AliPHOSAnalyser): | |
34 | // AliPHOSGetter * gime = AliPHOSGetter::GetInstance("galice.root","test") ; | |
35 | // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++) | |
36 | // AliPHOSRecParticle * part = gime->RecParticle(1) ; | |
37 | // ................ | |
38 | // please->GetEvent(event) ; // reads new event from galice.root | |
39 | // | |
40 | //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) | |
41 | //*-- Completely redesigned by Dmitri Peressounko March 2001 | |
42 | // | |
43 | //*-- YS June 2001 : renamed the original AliPHOSIndexToObject and make | |
44 | //*-- systematic usage of TFolders without changing the interface | |
45 | ////////////////////////////////////////////////////////////////////////////// | |
46 | ||
47 | ||
48 | // --- ROOT system --- | |
49 | ||
50 | #include "TFile.h" | |
51 | #include "TTree.h" | |
52 | #include "TROOT.h" | |
53 | #include "TObjString.h" | |
54 | #include "TFolder.h" | |
55 | ||
56 | // --- Standard library --- | |
57 | #include <iostream.h> | |
58 | ||
59 | // --- AliRoot header files --- | |
60 | ||
61 | #include "AliRun.h" | |
62 | #include "AliPHOSGetter.h" | |
63 | #include "AliPHOS.h" | |
64 | #include "AliPHOSDigitizer.h" | |
65 | #include "AliPHOSSDigitizer.h" | |
66 | #include "AliPHOSClusterizer.h" | |
67 | #include "AliPHOSClusterizerv1.h" | |
68 | #include "AliPHOSTrackSegmentMaker.h" | |
69 | #include "AliPHOSTrackSegmentMakerv1.h" | |
70 | #include "AliPHOSTrackSegment.h" | |
71 | #include "AliPHOSPID.h" | |
72 | #include "AliPHOSPIDv1.h" | |
73 | #include "AliPHOSGeometry.h" | |
74 | ||
75 | ClassImp(AliPHOSGetter) | |
76 | ||
77 | AliPHOSGetter * AliPHOSGetter::fgObjGetter = 0 ; | |
78 | ||
79 | //____________________________________________________________________________ | |
80 | AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* branchTitle ) | |
81 | { | |
82 | //Initialize all lists | |
83 | ||
84 | fHeaderFile = headerFile ; | |
85 | fSDigitsTitle = branchTitle ; | |
86 | fDigitsTitle = branchTitle ; | |
87 | fRecPointsTitle = branchTitle ; | |
88 | fRecParticlesTitle = branchTitle ; | |
89 | fTrackSegmentsTitle = branchTitle ; | |
90 | ||
91 | fPrimaries = new TObjArray(1) ; | |
92 | ||
eb9763ac | 93 | if ( fHeaderFile != "aliroot" ) { // to call the getter without a file |
518b8b75 | 94 | |
eb9763ac | 95 | //open headers file |
96 | TFile * file = (TFile*) gROOT->GetFile(fHeaderFile.Data() ) ; | |
4ae78bb1 | 97 | |
eb9763ac | 98 | if(file == 0){ //if file was not opened yet, read gAlice |
99 | if(fHeaderFile.Contains("rfio")) // if we read file using HPSS | |
100 | file = TFile::Open(fHeaderFile.Data(),"update") ; | |
101 | else | |
102 | file = new TFile(fHeaderFile.Data(),"update") ; | |
103 | ||
104 | if (!file->IsOpen()) { | |
105 | cerr << "ERROR : AliPHOSGetter::AliPHOSGetter -> Cannot open " << fHeaderFile.Data() << endl ; | |
106 | abort() ; | |
107 | } | |
108 | ||
109 | gAlice = (AliRun *) file->Get("gAlice") ; | |
110 | ||
111 | if (!gAlice) { | |
112 | cerr << "ERROR : AliPHOSGetter::AliPHOSGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ; | |
113 | abort() ; | |
114 | } | |
4ae78bb1 | 115 | } |
116 | } | |
518b8b75 | 117 | fDebug=""; |
4ae78bb1 | 118 | } |
4ae78bb1 | 119 | //____________________________________________________________________________ |
120 | void AliPHOSGetter::CreateWhiteBoard() const | |
121 | { | |
122 | // Posts a few item to the white board (folders) | |
123 | ||
124 | // -- the geometry | |
125 | Post(fHeaderFile, "G") ; | |
126 | ||
127 | // -- the hits | |
128 | Post(fHeaderFile, "H") ; | |
129 | ||
130 | } | |
131 | ||
132 | //____________________________________________________________________________ | |
133 | AliPHOSGetter * AliPHOSGetter::GetInstance() | |
134 | { | |
135 | // Returns the pointer of the unique instance already defined | |
136 | ||
137 | AliPHOSGetter * rv = 0 ; | |
138 | if ( fgObjGetter ) | |
139 | rv = fgObjGetter ; | |
140 | else | |
141 | cout << "AliPHOSGetter::GetInstance ERROR: not yet initialized" << endl ; | |
142 | ||
143 | return rv ; | |
144 | } | |
145 | ||
146 | //____________________________________________________________________________ | |
147 | AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile, | |
148 | const char* branchTitle) | |
149 | { | |
150 | // Creates and returns the pointer of the unique instance | |
151 | // Must be called only when the environment has changed | |
152 | ||
153 | ||
154 | if ( fgObjGetter ) // delete it if already exists | |
155 | delete fgObjGetter ; | |
156 | ||
157 | fgObjGetter = new AliPHOSGetter(headerFile,branchTitle) ; | |
158 | ||
159 | // Posts a few item to the white board (folders) | |
160 | fgObjGetter->CreateWhiteBoard() ; | |
161 | ||
162 | // Get the first event into the arrays posted on the white board | |
163 | // branchTitle = 0, means simulation run and no event yet | |
164 | if (branchTitle) | |
165 | fgObjGetter->Event(0) ; | |
166 | ||
167 | return fgObjGetter ; | |
168 | ||
169 | } | |
170 | ||
171 | //____________________________________________________________________________ | |
172 | const AliPHOS * AliPHOSGetter::PHOS() const | |
173 | { | |
174 | // returns the PHOS object | |
175 | return ( (AliPHOS*)gAlice->GetDetector("PHOS") ); | |
176 | } | |
177 | ||
178 | //____________________________________________________________________________ | |
179 | const AliPHOSGeometry * AliPHOSGetter::PHOSGeometry() const | |
180 | { | |
181 | // retrieves the geometr from the folder | |
182 | ||
183 | TString path("YSAlice/WhiteBoard/Geometry/PHOS/") ; | |
184 | path += PHOS()->GetTitle() ; | |
185 | return (AliPHOSGeometry*)gROOT->FindObjectAny(path.Data()) ; | |
186 | } | |
187 | ||
188 | //____________________________________________________________________________ | |
189 | void AliPHOSGetter::Post(const char * headerFile, const char * opt, const char * name, const Int_t event) const | |
190 | { | |
191 | // Adds a new folder for summable digits | |
dbad285c | 192 | |
4ae78bb1 | 193 | TString foldertitle ; |
194 | if ( event >= 0 ) | |
195 | foldertitle += event ; | |
196 | else | |
197 | foldertitle = "" ; | |
198 | ||
199 | TFolder * aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice") ; | |
200 | ||
201 | if ( strcmp(opt, "G") == 0 ) { // Geometry | |
202 | // the hierarchy is //YSALICE/WhiteBoard/Geometry/PHOS/ | |
203 | AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance(PHOS()->GetTitle(),"") ; | |
204 | TFolder * geomF = (TFolder*)aliceF->FindObject("WhiteBoard/Geometry/PHOS") ; | |
205 | if ( !geomF ) { | |
206 | cerr << "ERROR: AliPHOSGetter::Post G -> Folder WhiteBoard/Geometry/PHOS/" << " not found!" << endl; | |
207 | abort() ; | |
208 | } | |
209 | else | |
210 | geomF->Add((TObject*)geom) ; | |
211 | ||
212 | } else if ( strcmp(opt, "H") == 0 ) { // Hits | |
213 | // the hierarchy is //YSALICE/WhiteBoard/SDigits/PHOS/Hits | |
214 | TClonesArray * hits = new TClonesArray("AliPHOSHit",1000) ; | |
215 | hits->SetName("Hits") ; | |
216 | TFolder * hitsF = (TFolder*)aliceF->FindObject("WhiteBoard/Hits/PHOS") ; | |
217 | if ( !hitsF ) { | |
218 | cerr << "ERROR: AliPHOSGetter::Post H -> Folder WhiteBoard/Hits/PHOS/" << " not found!" << endl; | |
219 | abort() ; | |
220 | } | |
221 | else | |
222 | hitsF->Add(hits) ; | |
223 | ||
224 | } else if ( strcmp(opt, "S") == 0 ) { // summable digits | |
225 | // the hierarchy is //YSALICE/WhiteBoard/SDigits/PHOS/headerFile/sdigitsname | |
226 | // because you can have sdigits from several hit files for mixing | |
227 | TClonesArray * sdigits = new TClonesArray("AliPHOSDigit",1000) ; | |
228 | TString sdigitsName ; | |
229 | if (name) | |
230 | sdigitsName = name ; | |
231 | else | |
232 | sdigitsName = "SDigits" ; | |
233 | sdigits->SetName( sdigitsName.Data() ) ; | |
234 | TFolder * sdigitsF = (TFolder*)aliceF->FindObject("WhiteBoard/SDigits/PHOS") ; | |
235 | TFolder * sdigitsF2 = 0 ; | |
236 | TString subdir(headerFile) ; | |
237 | if ( !(sdigitsF2=(TFolder*)sdigitsF->FindObject(subdir)) ) | |
238 | sdigitsF2 = sdigitsF->AddFolder(subdir, foldertitle); | |
239 | else { | |
240 | if ( sdigitsF2->FindObject( sdigitsName.Data() ) ) { | |
518b8b75 | 241 | if (fDebug.Contains("S")) |
242 | cerr <<"INFO: AliPHOSGetter::Post S -> Folder " << subdir << ", " << foldertitle | |
243 | << " already exists!" << endl ; | |
4ae78bb1 | 244 | return ; |
245 | } | |
246 | } | |
247 | if ( !sdigitsF2 ) { | |
248 | cerr << "ERROR: AliPHOSGetter::Post S -> Folder WhiteBoard/SDigits/PHOS/" << subdir << " not created!" << endl; | |
249 | abort() ; | |
250 | } | |
251 | else | |
252 | sdigitsF2->Add(sdigits) ; | |
253 | ||
254 | } else if ( strcmp(opt, "Ser") == 0 ) { // sdigizer | |
255 | // the hierarchy is //YSALICE/tasks/Digitizer/PHOS/sdigitsname | |
256 | AliPHOSSDigitizer * sdigitizer = new AliPHOSSDigitizer() ; | |
257 | TString sdigitsName ; | |
258 | if (name) | |
259 | sdigitsName = name ; | |
260 | else | |
261 | sdigitsName = "SDigitizer" ; | |
262 | sdigitizer->SetName( sdigitsName.Data() ) ; | |
263 | TTask * sdigitsF = (TTask*)aliceF->FindObject("tasks/SDigitizer") ; | |
264 | if ( !sdigitsF ) { | |
265 | cerr << "ERROR: AliPHOSGetter::Post Ser -> Task tasks/SDigitizer" << " not found!" << endl; | |
266 | abort() ; | |
267 | } | |
268 | TTask * phos = (TTask*)sdigitsF->GetListOfTasks()->FindObject("PHOS") ; | |
269 | if ( !phos ) { | |
270 | cerr <<"ERROR: AliPHOSGetter::Post Ser -> tasks/SDigitizer/PHOS" << " not found!" << endl; | |
271 | abort() ; | |
272 | } else { | |
273 | AliPHOSSDigitizer * phossd = (AliPHOSSDigitizer*)phos->GetListOfTasks()->FindObject(sdigitsName.Data()) ; | |
274 | if (phossd) { | |
518b8b75 | 275 | if (fDebug.Contains("Ser")) |
276 | cout << "INFO: AliPHOSGetter::Post Ser -> Task " << sdigitsName.Data() << " already exists" << endl ; | |
4ae78bb1 | 277 | return ; |
278 | } else | |
279 | phos->Add(sdigitizer) ; | |
280 | } | |
281 | ||
282 | } else if ( strcmp(opt, "D") == 0 ) { // digits | |
283 | // the hierarchy is //YSALICE/WhiteBoard/Digits/PHOS/digitsname | |
284 | TClonesArray * digits = new TClonesArray("AliPHOSDigit",20000) ; | |
285 | TString digitsName ; | |
286 | if (name) | |
287 | digitsName = name ; | |
288 | else | |
289 | digitsName = "Digits" ; | |
290 | digits->SetName( digitsName.Data() ) ; | |
291 | TFolder * digitsF = (TFolder*)aliceF->FindObject("WhiteBoard/Digits/PHOS") ; | |
292 | if ( !digitsF ) { | |
293 | cerr << "ERROR: AliPHOSGetter::Post D -> Folder WhiteBoard/Digits/PHOS/" << " not found!" << endl; | |
294 | abort() ; | |
295 | } | |
296 | digitsF->SetTitle(foldertitle) ; | |
297 | if ( digitsF->FindObject( digitsName.Data() ) ) { | |
518b8b75 | 298 | if (fDebug.Contains("D")) |
299 | cerr <<"INFO: AliPHOSGetter::Post D -> Object " << digitsName.Data() | |
300 | << " already exists!" << endl ; | |
4ae78bb1 | 301 | return ; |
302 | } | |
303 | else | |
304 | digitsF->Add(digits) ; | |
305 | ||
306 | } else if ( strcmp(opt, "Der") == 0 ) { // sdigizer | |
307 | // the hierarchy is //YSALICE/tasks/Digitizer/PHOS/digitsname | |
308 | AliPHOSDigitizer * digitizer = new AliPHOSDigitizer() ; | |
309 | TString digitsName ; | |
310 | if (name) | |
311 | digitsName = name ; | |
312 | else | |
313 | digitsName = "Digitizer" ; | |
314 | digitizer->SetName( digitsName.Data() ) ; | |
315 | TTask * digitsF = (TTask*)aliceF->FindObject("tasks/Digitizer") ; | |
316 | if ( !digitsF ) { | |
317 | cerr << "ERROR: AliPHOSGetter::Post Der -> Task tasks/Digitizer" << " not found!" << endl; | |
318 | abort() ; | |
319 | } | |
320 | TTask * phos = (TTask*)digitsF->GetListOfTasks()->FindObject("PHOS") ; | |
321 | if ( !phos ) { | |
322 | cerr <<"ERROR: AliPHOSGetter::Post Der -> tasks/Digitizer/PHOS" << " not found!" << endl; | |
323 | abort() ; | |
324 | } else { | |
325 | AliPHOSDigitizer * phosd = (AliPHOSDigitizer*)phos->GetListOfTasks()->FindObject(digitsName.Data()) ; | |
326 | if (phosd) { | |
518b8b75 | 327 | if (fDebug.Contains("Der")) |
328 | cout << "INFO: AliPHOSGetter::Post Der -> Task " << digitsName.Data() << " already exists" << endl ; | |
4ae78bb1 | 329 | return ; |
330 | } else | |
331 | phos->Add(digitizer) ; | |
332 | } | |
333 | ||
334 | } else if ( strcmp(opt, "R") == 0 ) { // RecPoints | |
335 | // the hierarchy is //YSALICE/WhiteBoard/RecPoints/PHOS/emc/recpointsname | |
336 | // //YSALICE/WhiteBoard/RecPoints/PHOS/cpv/recpointsname | |
337 | TObjArray * emcrp = new TObjArray(100) ; | |
338 | TObjArray * cpvrp = new TObjArray(100) ; | |
339 | TString recpointsName ; | |
340 | if (name) | |
341 | recpointsName = name ; | |
342 | else | |
343 | recpointsName = "RecPoints" ; | |
344 | emcrp->SetName( recpointsName.Data() ) ; | |
345 | cpvrp->SetName( recpointsName.Data() ) ; | |
346 | TFolder * emcrpF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/emc") ; | |
347 | TFolder * cpvrpF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/cpv") ; | |
348 | emcrpF->SetTitle(foldertitle) ; | |
349 | cpvrpF->SetTitle(foldertitle) ; | |
350 | if ( !emcrpF || !cpvrpF ) { | |
351 | cerr << "ERROR: AliPHOSGetter::Post R -> Folder WhiteBoard/RecPoints/PHOS/emc(cpv)" << " not found!" << endl; | |
352 | abort() ; | |
353 | } | |
354 | // TString title("PHOS Digits") ; | |
355 | if ( emcrpF->FindObject( recpointsName.Data() ) || cpvrpF->FindObject( recpointsName.Data() ) ) { | |
518b8b75 | 356 | if (fDebug.Contains("R")) |
357 | cerr <<"INFO: AliPHOSGetter::Post R -> Object " << recpointsName.Data() | |
358 | << " already exists!" << endl ; | |
4ae78bb1 | 359 | return ; |
360 | } | |
361 | else { | |
362 | emcrpF->Add(emcrp) ; | |
363 | cpvrpF->Add(cpvrp) ; | |
364 | } | |
365 | ||
366 | } else if ( strcmp(opt, "Rer") == 0 ) { // clusterizer | |
367 | // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/recpointsname | |
368 | AliPHOSClusterizer * clusterizer; | |
369 | if ( strstr(name, "clu-v1") != 0 ) | |
dbad285c | 370 | clusterizer = new AliPHOSClusterizerv1() ; |
4ae78bb1 | 371 | else { |
372 | cerr << "ERROR: AliPHOSGetter::Post Rer -> " << name << " unknown clusterizer version" << endl ; | |
373 | abort() ; | |
374 | } | |
375 | TString recpointsName ; | |
376 | if (name) | |
377 | recpointsName = name ; | |
378 | else | |
379 | recpointsName = "Clusterizer" ; | |
380 | clusterizer->SetName( recpointsName.Data() ) ; | |
381 | TTask * reF = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ; | |
382 | if ( !reF ) { | |
383 | cerr << "ERROR: AliPHOSGetter::Post Rer -> Task tasks/Reconstructioner" << " not found!" << endl; | |
384 | abort() ; | |
385 | } | |
386 | TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ; | |
387 | if ( !phos ) { | |
388 | cerr <<"ERROR: AliPHOSGetter::Post Rer -> tasks/Reconstructioner/PHOS" << " not found!" << endl; | |
389 | abort() ; | |
390 | } else { | |
391 | AliPHOSClusterizer * phoscl = (AliPHOSClusterizer*)phos->GetListOfTasks()->FindObject(recpointsName.Data()) ; | |
392 | if (phoscl) { | |
518b8b75 | 393 | if (fDebug.Contains("Rer")) |
394 | cout << "INFO: AliPHOSGetter::Post Rer -> Task " << recpointsName.Data() << " already exists" << endl ; | |
4ae78bb1 | 395 | return ; |
396 | } else | |
397 | phos->Add(clusterizer) ; | |
398 | } | |
399 | ||
400 | } else if ( strcmp(opt, "T") == 0 ) { //TrackSegments | |
401 | // the hierarchy is //YSALICE/WhiteBoard/TrackSegments/PHOS/tracksegmentsname | |
402 | ||
403 | TClonesArray * tracksegments = new TClonesArray("AliPHOSTrackSegment", 200) ; | |
404 | TString tracksegmentsName ; | |
405 | if (name) | |
406 | tracksegmentsName = name ; | |
407 | else | |
408 | tracksegmentsName = "TrackSegments" ; | |
409 | tracksegments->SetName( tracksegmentsName.Data() ) ; | |
410 | TFolder * tracksegmentsF = (TFolder*)aliceF->FindObject("WhiteBoard/TrackSegments/PHOS") ; | |
411 | tracksegmentsF->SetTitle(foldertitle) ; | |
412 | if ( !tracksegmentsF) { | |
413 | cerr << "ERROR: AliPHOSGetter::Post T -> Folder WhiteBoard/TrackSegments/PHOS" << " not found!" << endl; | |
414 | abort() ; | |
415 | } | |
416 | if ( tracksegmentsF->FindObject( tracksegmentsName.Data() ) ) { | |
518b8b75 | 417 | if (fDebug.Contains("T")) |
418 | cerr <<"INFO: AliPHOSGetter::Post T -> Object " << tracksegmentsName.Data() | |
419 | << " already exists!" << endl ; | |
4ae78bb1 | 420 | return ; |
421 | } | |
422 | else | |
423 | tracksegmentsF->Add(tracksegments) ; | |
424 | ||
425 | } else if ( strcmp(opt, "Ter") == 0 ) { // TrackSegmentsMaker | |
426 | // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/tracksegmentsname | |
427 | AliPHOSTrackSegmentMaker * tracksegmentmaker ; | |
428 | if ( strstr(name, "tsm-v1") != 0 ) | |
dbad285c | 429 | tracksegmentmaker = new AliPHOSTrackSegmentMakerv1() ; |
4ae78bb1 | 430 | else { |
431 | cerr << "ERROR: AliPHOSGetter::Post Ter -> " << name << " unknown track segment maker version" << endl ; | |
432 | abort() ; | |
433 | } | |
434 | TString tracksegmentsName ; | |
435 | if (name) | |
436 | tracksegmentsName = name ; | |
437 | else | |
438 | tracksegmentsName = "TrackSegmentMaker" ; | |
439 | tracksegmentmaker->SetName( tracksegmentsName.Data() ) ; | |
440 | TTask * reF = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ; | |
441 | if ( !reF ) { | |
442 | cerr << "ERROR: AliPHOSGetter::Post Ter -> Task tasks/Reconstructioner" << " not found!" << endl; | |
443 | abort() ; | |
444 | } | |
445 | TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ; | |
446 | if ( !phos ) { | |
447 | cerr <<"ERROR: AliPHOSGetter::Post Ter -> tasks/Reconstructioner/PHOS" << " not found!" << endl; | |
448 | abort() ; | |
449 | } else { | |
450 | AliPHOSTrackSegmentMaker * phosts = (AliPHOSTrackSegmentMaker*)phos->GetListOfTasks()->FindObject(tracksegmentsName.Data()) ; | |
451 | if (phosts) { | |
518b8b75 | 452 | if (fDebug.Contains("Ter")) |
453 | cout << "INFO: AliPHOSGetter::Post Ter -> Task " << tracksegmentsName.Data() << " already exists" << endl ; | |
4ae78bb1 | 454 | return ; |
455 | } else | |
456 | phos->Add(tracksegmentmaker) ; | |
457 | } | |
458 | ||
459 | } else if ( strcmp(opt, "P") == 0 ) { // RecParticles | |
460 | // the hierarchy is //YSALICE/WhiteBoard/RecParticles/PHOS/recparticlesname | |
461 | ||
462 | TClonesArray * recparticles = new TClonesArray("AliPHOSRecParticle", 200) ; | |
463 | TString recparticlesName ; | |
464 | if (name) | |
465 | recparticlesName = name ; | |
466 | else | |
467 | recparticlesName = "RecParticles" ; | |
468 | recparticles->SetName( recparticlesName.Data() ) ; | |
469 | TFolder * recparticlesF = (TFolder*)aliceF->FindObject("WhiteBoard/RecParticles/PHOS") ; | |
470 | recparticlesF->SetTitle(foldertitle) ; | |
471 | if ( !recparticlesF) { | |
472 | cerr << "ERROR: AliPHOSGetter::Post P -> Folder WhiteBoard/RecParticles/PHOS" << " not found!" << endl; | |
473 | abort() ; | |
474 | } | |
475 | if ( recparticlesF->FindObject( recparticlesName.Data() ) ) { | |
518b8b75 | 476 | if (fDebug.Contains("P")) |
477 | cerr <<"INFO: AliPHOSGetter::Post P -> Object " << recparticlesName.Data() | |
478 | << " already exists!" << endl ; | |
4ae78bb1 | 479 | return ; |
480 | } | |
481 | else | |
482 | recparticlesF->Add(recparticles) ; | |
483 | ||
484 | } else if ( strcmp(opt, "Per") == 0 ) { // PID Maker | |
485 | // the hierarchy is //YSALICE/tasks/Reconstructionner/PHOS/recparticlesname | |
486 | AliPHOSPID * pid ; | |
487 | if ( strstr(name, "pid-v1") != 0 ) | |
dbad285c | 488 | pid = new AliPHOSPIDv1() ; |
4ae78bb1 | 489 | else { |
490 | cerr << "ERROR: AliPHOSGetter::Post Per -> " << name << " unknown PID maker version" << endl ; | |
491 | abort() ; | |
492 | } | |
493 | TString recparticlesName ; | |
494 | if (name) | |
495 | recparticlesName = name ; | |
496 | else | |
497 | recparticlesName = "PID" ; | |
498 | pid->SetName( recparticlesName.Data() ) ; | |
499 | TTask * reF = (TTask*)aliceF->FindObject("tasks/Reconstructioner") ; | |
500 | if ( !reF ) { | |
501 | cerr << "ERROR: AliPHOSGetter::Post Per -> Task tasks/Reconstructioner" << " not found!" << endl; | |
502 | abort() ; | |
503 | } | |
504 | TTask * phos = (TTask*)reF->GetListOfTasks()->FindObject("PHOS") ; | |
505 | if ( !phos ) { | |
506 | cerr <<"ERROR: AliPHOSGetter::Post Per -> tasks/Reconstructioner/PHOS" << " not found!" << endl; | |
507 | abort() ; | |
508 | } else { | |
509 | AliPHOSPID * phospid = (AliPHOSPID*)phos->GetListOfTasks()->FindObject(recparticlesName.Data()) ; | |
510 | if (phospid) { | |
518b8b75 | 511 | if (fDebug.Contains("Per")) |
512 | cout << "INFO: AliPHOSGetter::Post Per -> Task " << recparticlesName.Data() << " already exists" << endl ; | |
4ae78bb1 | 513 | return ; |
514 | } else | |
515 | phos->Add(pid) ; | |
516 | } | |
517 | } | |
518 | else if ( strcmp(opt, "QA") == 0 ) { // Alarms | |
519 | // the hierarchy is //YSALICE/WhiteBoard/Alarms/PHOS/ | |
520 | ||
521 | TFolder * alarmsF = new TFolder() ; | |
522 | TString alarmsName ; | |
523 | if (name) | |
524 | alarmsName = name ; | |
525 | else | |
526 | alarmsName = "Alarm with no name" ; | |
527 | alarmsF->SetName( alarmsName.Data() ) ; | |
528 | alarmsF->SetTitle(foldertitle) ; | |
529 | TFolder * qaaF = (TFolder*)aliceF->FindObject("WhiteBoard/QAAlarms") ; | |
530 | if ( !qaaF) { | |
531 | cerr << "ERROR: AliPHOSGetter::Post QA -> Folder WhiteBoard/QAAlarms/" << " not found!" << endl; | |
532 | return ; | |
533 | } | |
534 | if ( qaaF->FindObject( alarmsName.Data() ) ) | |
535 | qaaF->RecursiveRemove( qaaF->FindObject( alarmsName.Data() ) ) ; | |
536 | ||
537 | qaaF->Add(alarmsF) ; | |
538 | ||
539 | } | |
540 | } | |
541 | ||
542 | //____________________________________________________________________________ | |
543 | const TParticle * AliPHOSGetter::Primary(Int_t index) const | |
544 | { | |
545 | // Return primary particle numbered by <index> | |
546 | ||
547 | if(index < 0) | |
548 | return 0 ; | |
549 | ||
550 | Int_t primaryIndex = index % 10000000 ; | |
551 | Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ; | |
552 | ||
553 | if ( primaryList > 0 ) { | |
554 | cout << " Getter does not support currently Mixing of primary " << endl ; | |
555 | cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ; | |
556 | return 0; | |
557 | } | |
558 | ||
559 | return gAlice->Particle(primaryIndex) ; | |
560 | ||
561 | } | |
562 | ||
563 | //____________________________________________________________________________ | |
564 | void AliPHOSGetter::ReadTreeD() | |
565 | { | |
566 | // Read the digit tree gAlice->TreeD() | |
567 | if(gAlice->TreeD()== 0){ | |
568 | cerr << "ERROR: AliPHOSGetter::ReadTreeD: can not read TreeD " << endl ; | |
569 | return ; | |
570 | } | |
571 | ||
572 | TObjArray * lob = (TObjArray*)gAlice->TreeD()->GetListOfBranches() ; | |
573 | TIter next(lob) ; | |
574 | TBranch * branch = 0 ; | |
575 | TBranch * digitsbranch = 0 ; | |
576 | TBranch * digitizerbranch = 0 ; | |
577 | Bool_t phosfound = kFALSE, digitizerfound = kFALSE ; | |
578 | ||
579 | while ( (branch = (TBranch*)next()) && (!phosfound || !digitizerfound) ) { | |
580 | if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { | |
581 | digitsbranch = branch ; | |
582 | phosfound = kTRUE ; | |
583 | } | |
584 | else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { | |
585 | digitizerbranch = branch ; | |
586 | digitizerfound = kTRUE ; | |
587 | } | |
588 | } | |
589 | ||
590 | if ( !phosfound || !digitizerfound ) { | |
591 | cerr << "WARNING: AliPHOSGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name " << fDigitsTitle << endl ; | |
592 | return ; | |
593 | } | |
594 | ||
595 | ||
596 | // Post the Digits | |
dbad285c | 597 | if (EventNumber() == 0) |
598 | Post(fHeaderFile, "D", fDigitsTitle) ; | |
4ae78bb1 | 599 | |
600 | // Post the Digitizer | |
dbad285c | 601 | if (EventNumber() == 0) |
602 | Post(fHeaderFile, "Der", fDigitsTitle) ; | |
4ae78bb1 | 603 | |
604 | TClonesArray * digits = Digits(fDigitsTitle) ; | |
605 | digits->Clear() ; | |
606 | digitsbranch ->SetAddress(&digits) ; | |
607 | ||
608 | AliPHOSDigitizer * digitizer = Digitizer(fDigitsTitle) ; | |
609 | digitizerbranch->SetAddress(&digitizer) ; | |
610 | ||
611 | digitsbranch ->GetEntry(0) ; | |
612 | digitizerbranch->GetEntry(0) ; | |
613 | ||
614 | } | |
615 | ||
616 | //____________________________________________________________________________ | |
617 | void AliPHOSGetter::ReadTreeH() | |
618 | { | |
619 | // Read the first entry of PHOS branch in hit tree gAlice->TreeH() | |
620 | ||
621 | if(gAlice->TreeH()== 0){ | |
622 | cerr << "ERROR: AliPHOSGetter::ReadTreeH: -> Cannot read TreeH " << endl ; | |
623 | return ; | |
624 | } | |
625 | ||
626 | TBranch * hitsbranch = (TBranch*)gAlice->TreeH()->GetListOfBranches()->FindObject("PHOS") ; | |
627 | if ( !hitsbranch ) { | |
628 | cerr << "WARNING: AliPHOSGetter::ReadTreeH -> Cannot find branch PHOS" << endl ; | |
629 | } else { | |
630 | TClonesArray * hits = Hits() ; | |
631 | hits->Clear() ; | |
632 | hitsbranch->SetAddress(&hits) ; | |
633 | hitsbranch->GetEntry(0) ; | |
634 | } | |
635 | } | |
636 | ||
637 | //____________________________________________________________________________ | |
638 | void AliPHOSGetter::ReadTreeQA() | |
639 | { | |
640 | // Read the digit tree gAlice->TreeQA() | |
641 | // so far only PHOS knows about this Tree | |
642 | ||
643 | if(PHOS()->TreeQA()== 0){ | |
644 | cerr << "ERROR: AliPHOSGetter::ReadTreeQA: can not read TreeQA " << endl ; | |
645 | return ; | |
646 | } | |
647 | ||
648 | TBranch * qabranch = PHOS()->TreeQA()->GetBranch("PHOS") ; | |
649 | if (!qabranch) { | |
650 | cerr << "WARNING: AliPHOSGetter::ReadTreeQA -> Cannot find QA Alarms for PHOS" << endl ; | |
651 | return ; | |
652 | } | |
653 | ||
654 | // Post the QA Alarms | |
655 | Post(fHeaderFile, "QA", "PHOS") ; | |
656 | TFolder * alarmsF = Alarms() ; | |
657 | alarmsF->Clear() ; | |
658 | qabranch->SetAddress(&alarmsF) ; | |
659 | qabranch->GetEntry(0) ; | |
660 | ||
661 | } | |
662 | ||
663 | //____________________________________________________________________________ | |
664 | void AliPHOSGetter::ReadTreeR() | |
665 | { | |
666 | // Read the reconstrunction tree gAlice->TreeR() | |
667 | ||
668 | if(gAlice->TreeR()== 0){ | |
669 | cout << "ERROR: AliPHOSGetter::ReadTreeR: can not read TreeR " << endl ; | |
670 | return ; | |
671 | } | |
672 | // RecPoints | |
673 | TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ; | |
674 | TIter next(lob) ; | |
675 | TBranch * branch = 0 ; | |
676 | TBranch * emcbranch = 0 ; | |
677 | TBranch * cpvbranch = 0 ; | |
678 | TBranch * clusterizerbranch = 0 ; | |
679 | Bool_t phosemcrpfound = kFALSE, phoscpvrpfound = kFALSE, clusterizerfound = kFALSE ; | |
680 | ||
681 | while ( (branch = (TBranch*)next()) && (!phosemcrpfound || !phoscpvrpfound || !clusterizerfound) ) { | |
682 | if ( (strcmp(branch->GetName(), "PHOSEmcRP")==0) && (strcmp(branch->GetTitle(), fRecPointsTitle)==0) ) { | |
683 | emcbranch = branch ; | |
684 | phosemcrpfound = kTRUE ; | |
685 | } | |
686 | else if ( (strcmp(branch->GetName(), "PHOSCpvRP")==0) && (strcmp(branch->GetTitle(), fRecPointsTitle)==0) ) { | |
687 | cpvbranch = branch ; | |
688 | phoscpvrpfound = kTRUE ; | |
689 | } | |
690 | else if ( (strcmp(branch->GetName(), "AliPHOSClusterizer")==0) && (strcmp(branch->GetTitle(), fRecPointsTitle)==0) ) { | |
691 | clusterizerbranch = branch ; | |
692 | clusterizerfound = kTRUE ; | |
693 | } | |
694 | } | |
695 | ||
696 | if ( !phosemcrpfound || !phoscpvrpfound || !clusterizerfound ) { | |
697 | cerr << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find RecPoints and/or Clusterizer with name " << fRecPointsTitle << endl ; | |
698 | return ; | |
699 | } | |
700 | ||
701 | // Post the RecPoints | |
dbad285c | 702 | if (EventNumber() == 0) |
703 | Post(fHeaderFile, "R", fRecPointsTitle) ; | |
4ae78bb1 | 704 | |
705 | // Post the Clusterizer | |
706 | // Need the version first | |
707 | AliPHOSClusterizer * clusterizer = 0 ; | |
708 | clusterizerbranch->SetAddress(&clusterizer) ; | |
709 | clusterizerbranch->GetEntry(0) ; | |
710 | TString clusterizerName(fRecPointsTitle) ; | |
711 | clusterizerName.Append(clusterizer->Version()) ; | |
dbad285c | 712 | if (EventNumber() == 0) |
713 | Post(fHeaderFile, "Rer", clusterizerName) ; | |
4ae78bb1 | 714 | |
715 | TObjArray * emcRecPoints = EmcRecPoints(fRecPointsTitle) ; | |
518b8b75 | 716 | emcRecPoints->Delete() ; |
4ae78bb1 | 717 | emcbranch->SetAddress(&emcRecPoints) ; |
718 | ||
719 | TObjArray * cpvRecPoints = CpvRecPoints(fRecPointsTitle) ; | |
518b8b75 | 720 | cpvRecPoints->Delete() ; |
4ae78bb1 | 721 | cpvbranch->SetAddress(&cpvRecPoints) ; |
722 | ||
dbad285c | 723 | delete clusterizer ; |
4ae78bb1 | 724 | clusterizer = Clusterizer(clusterizerName) ; |
725 | clusterizerbranch->SetAddress(&clusterizer) ; | |
726 | ||
727 | emcbranch ->GetEntry(0) ; | |
728 | cpvbranch ->GetEntry(0) ; | |
729 | clusterizerbranch->GetEntry(0) ; | |
730 | ||
731 | // TrackSegments | |
732 | next.Reset() ; | |
733 | TBranch * tsbranch = 0 ; | |
734 | TBranch * tsmakerbranch = 0 ; | |
735 | Bool_t phostsfound = kFALSE, tsmakerfound = kFALSE ; | |
736 | ||
737 | while ( (branch = (TBranch*)next()) && (!phostsfound || !tsmakerfound) ) { | |
738 | if ( (strcmp(branch->GetName(), "PHOSTS")==0) && (strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) ) { | |
739 | tsbranch = branch ; | |
740 | phostsfound = kTRUE ; | |
741 | } | |
742 | else if ( (strcmp(branch->GetName(), "AliPHOSTrackSegmentMaker")==0) && (strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) ) { | |
743 | tsmakerbranch = branch ; | |
744 | tsmakerfound = kTRUE ; | |
745 | } | |
746 | } | |
747 | ||
748 | if ( !phostsfound || !tsmakerfound ) { | |
749 | cerr << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name " << fTrackSegmentsTitle << endl ; | |
750 | return ; | |
751 | } | |
752 | ||
753 | // Post the TrackSegments | |
dbad285c | 754 | if (EventNumber() == 0) |
755 | Post(fHeaderFile, "T", fTrackSegmentsTitle) ; | |
4ae78bb1 | 756 | |
757 | // Post the TrackSegment Maker | |
758 | // Need the version first | |
759 | AliPHOSTrackSegmentMaker * tsmaker = 0 ; | |
760 | tsmakerbranch->SetAddress(&tsmaker) ; | |
761 | tsmakerbranch->GetEntry(0) ; | |
762 | TString tsmakerName(fTrackSegmentsTitle) ; | |
763 | tsmakerName.Append(tsmaker->Version()) ; | |
dbad285c | 764 | if (EventNumber() == 0) |
765 | Post(fHeaderFile, "Ter", tsmakerName) ; | |
4ae78bb1 | 766 | |
767 | TClonesArray * tracksegments = TrackSegments(fTrackSegmentsTitle) ; | |
768 | tracksegments->Clear() ; | |
769 | tsbranch->SetAddress(&tracksegments) ; | |
770 | ||
dbad285c | 771 | delete tsmaker ; |
4ae78bb1 | 772 | tsmaker = TrackSegmentMaker(tsmakerName) ; |
773 | tsmakerbranch->SetAddress(&tsmaker) ; | |
774 | ||
775 | tsmakerbranch ->GetEntry(0) ; | |
776 | tsbranch ->GetEntry(0) ; | |
777 | ||
778 | // RecParticles | |
779 | next.Reset() ; | |
780 | TBranch * rpabranch = 0 ; | |
781 | TBranch * pidbranch = 0 ; | |
782 | Bool_t phosrpafound = kFALSE, pidfound = kFALSE ; | |
783 | ||
784 | while ( (branch = (TBranch*)next()) && (!phosrpafound || !pidfound) ) { | |
785 | if ( (strcmp(branch->GetName(), "PHOSRP")==0) && (strcmp(branch->GetTitle(), fRecParticlesTitle)==0) ) { | |
786 | rpabranch = branch ; | |
787 | phosrpafound = kTRUE ; | |
788 | } | |
789 | else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), fRecParticlesTitle)==0) ) { | |
790 | pidbranch = branch ; | |
791 | pidfound = kTRUE ; | |
792 | } | |
793 | } | |
794 | ||
795 | if ( !phosrpafound || !pidfound ) { | |
796 | cerr << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name " << fRecParticlesTitle << endl ; | |
797 | return ; | |
798 | } | |
799 | ||
800 | // Post the RecParticles | |
dbad285c | 801 | if (EventNumber() == 0) |
802 | Post(fHeaderFile, "P", fRecParticlesTitle) ; | |
4ae78bb1 | 803 | |
804 | // Post the PID | |
805 | // Need the version first | |
806 | AliPHOSPID * pid = 0 ; | |
807 | pidbranch->SetAddress(&pid) ; | |
808 | pidbranch->GetEntry(0) ; | |
809 | TString pidName(fRecParticlesTitle) ; | |
810 | pidName.Append(pid->Version()) ; | |
dbad285c | 811 | if (EventNumber() == 0) |
812 | Post(fHeaderFile, "Per", pidName) ; | |
4ae78bb1 | 813 | |
814 | TClonesArray * recParticles = RecParticles(fRecParticlesTitle) ; | |
815 | recParticles->Clear() ; | |
816 | rpabranch->SetAddress(&recParticles) ; | |
817 | ||
dbad285c | 818 | delete pid ; |
4ae78bb1 | 819 | pid = PID(pidName) ; |
820 | pidbranch->SetAddress(&pid) ; | |
821 | ||
822 | pidbranch ->GetEntry(0) ; | |
823 | rpabranch ->GetEntry(0) ; | |
824 | ||
825 | } | |
826 | ||
827 | //____________________________________________________________________________ | |
828 | void AliPHOSGetter::ReadTreeS() | |
829 | { | |
830 | // Read the summable digits tree gAlice->TreeS() | |
831 | ||
832 | if(gAlice->TreeS()== 0){ | |
833 | cerr << "ERROR: AliPHOSGetter::ReadTreeS -> Cannot find TreeS " << endl ; | |
834 | return ; | |
835 | } | |
836 | ||
837 | TObjArray * lob = (TObjArray*)gAlice->TreeS()->GetListOfBranches() ; | |
838 | TIter next(lob) ; | |
839 | TBranch * branch = 0 ; | |
840 | TBranch * sdigitsbranch = 0 ; | |
841 | TBranch * sdigitizerbranch = 0 ; | |
842 | Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ; | |
843 | ||
844 | while ( (branch = (TBranch*)next()) && (!phosfound || !sdigitizerfound) ) { | |
845 | if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { | |
846 | sdigitsbranch = branch ; | |
847 | phosfound = kTRUE ; | |
848 | } | |
849 | else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { | |
850 | sdigitizerbranch = branch ; | |
851 | sdigitizerfound = kTRUE ; | |
852 | } | |
853 | } | |
854 | ||
855 | if ( !phosfound || !sdigitizerfound ) { | |
856 | cerr << "WARNING: AliPHOSGetter::ReadTreeS -> Cannot find SDigits and/or SDigitizer with name " << fSDigitsTitle << endl ; | |
857 | return ; | |
858 | } | |
859 | ||
860 | // -- the SDigits | |
dbad285c | 861 | if (EventNumber() == 0) |
862 | Post(fHeaderFile, "S", fSDigitsTitle) ; | |
4ae78bb1 | 863 | |
864 | // Post the SDigitizer | |
dbad285c | 865 | if (EventNumber() == 0) |
866 | Post(fHeaderFile, "Ser", fSDigitsTitle) ; | |
4ae78bb1 | 867 | |
868 | TClonesArray * sdigits = SDigits(fSDigitsTitle) ; | |
869 | sdigits->Clear() ; | |
870 | sdigitsbranch->SetAddress(&sdigits) ; | |
871 | ||
872 | AliPHOSSDigitizer * sdigitizer = SDigitizer(fSDigitsTitle) ; | |
873 | sdigitizerbranch->SetAddress(&sdigitizer) ; | |
874 | ||
875 | sdigitsbranch->GetEvent(0) ; | |
876 | sdigitizerbranch->GetEvent(0) ; | |
877 | ||
878 | } | |
879 | ||
880 | //____________________________________________________________________________ | |
881 | void AliPHOSGetter::ReadPrimaries() | |
882 | { | |
883 | // Reads specific branches of primaries | |
884 | ||
885 | fNPrimaries = gAlice->GetNtrack(); | |
886 | ||
887 | // //Check, is it necessary to open new files | |
888 | // TArrayI* events = fDigitizer->GetCurrentEvents() ; | |
889 | // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ; | |
890 | // Int_t input ; | |
891 | // for(input = 0; input < filenames->GetEntriesFast(); input++){ | |
892 | ||
893 | // TObjString * filename = (TObjString *) filenames->At(input) ; | |
894 | ||
895 | // //Test, if this file already open | |
896 | // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ; | |
897 | // if(file == 0) | |
898 | // file = new TFile( filename->GetString()) ; | |
899 | // file->cd() ; | |
900 | ||
901 | // // Get Kine Tree from file | |
902 | // // char treeName[20]; | |
903 | // // sprintf(treeName,"TreeK%d",events->At(input)); | |
904 | // // TTree * treeK = (TTree*)gDirectory->Get(treeName); | |
905 | // // if (treeK) | |
906 | // // treeK->SetBranchAddress("Particles", &fParticleBuffer); | |
907 | // // else | |
908 | // // cout << "AliPHOSGetter: cannot find Kine Tree for event:" << events->At(input) << endl; | |
909 | ||
910 | // // // Create the particle stack | |
911 | // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000); | |
912 | // // // Build the pointer list | |
913 | // // if(fParticleMap) { <---- | |
914 | // // fParticleMap->Clear(); | |
915 | // // fParticleMap->Expand(treeK->GetEntries()); | |
916 | // // } else | |
917 | // // fParticleMap = new TObjArray(treeK->GetEntries()); | |
918 | ||
919 | // // From gAlice->Particle(i) | |
920 | ||
921 | ||
922 | // // if(!(*fParticleMap)[i]) { | |
923 | // // Int_t nentries = fParticles->GetEntries(); | |
924 | ||
925 | // // // algorithmic way of getting entry index | |
926 | // // // (primary particles are filled after secondaries) | |
927 | // // Int_t entry; | |
928 | // // if (i<fHeader.GetNprimary()) | |
929 | // // entry = i+fHeader.GetNsecondary(); | |
930 | // // else | |
931 | // // entry = i-fHeader.GetNprimary(); | |
932 | ||
933 | // // // only check the algorithmic way and give | |
934 | // // // the fatal error if it is wrong | |
935 | // // if (entry != fParticleFileMap[i]) { | |
936 | // // Fatal("Particle", | |
937 | // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d", | |
938 | // // entry, fParticleFileMap[i]); | |
939 | // // } | |
940 | ||
941 | // // fTreeK->GetEntry(fParticleFileMap[i]); | |
942 | // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer); | |
943 | // // fParticleMap->AddAt((*fParticles)[nentries],i); | |
944 | // // } | |
945 | // // return (TParticle *) (*fParticleMap)[i]; | |
946 | ||
947 | ||
948 | ||
949 | // } | |
950 | ||
951 | ||
952 | // //scan over opened files and read corresponding TreeK## | |
953 | ||
954 | return ; | |
955 | } | |
956 | //____________________________________________________________________________ | |
957 | void AliPHOSGetter::Event(Int_t event) | |
958 | { | |
959 | // Reads the content of all Tree's S, D and R | |
960 | ||
961 | if ( event > gAlice->TreeE()->GetEntries() ) { | |
962 | cerr << "ERROR: AliPHOSGetter::Event -> There are only " << gAlice->TreeE()->GetEntries() << " events in this file" << endl ; | |
963 | return ; | |
964 | } | |
965 | ||
966 | gAlice->GetEvent(event) ; | |
dbad285c | 967 | gAlice->SetEvent(event) ; |
968 | ||
4ae78bb1 | 969 | ReadTreeH() ; |
970 | ReadTreeS() ; | |
971 | ReadTreeD() ; | |
972 | ReadTreeR() ; | |
dbad285c | 973 | // ReadTreeQA() ; |
4ae78bb1 | 974 | ReadPrimaries() ; |
4ae78bb1 | 975 | } |
976 | ||
977 | //____________________________________________________________________________ | |
978 | const TObject * AliPHOSGetter::ReturnO(TString what, TString name, TString file) const | |
979 | { | |
980 | // get the object named "what" from the folder | |
981 | // folders are named like //YSAlice/WhiteBoard/what/PHOS/name | |
982 | ||
983 | if ( file.IsNull() ) | |
984 | file = fHeaderFile ; | |
985 | TString path("WhiteBoard/") ; | |
986 | if ( name.IsNull() ) { | |
987 | if ( what.CompareTo("Hits") == 0 ) { | |
988 | path += what ; | |
989 | path += "/PHOS/"; | |
990 | path += what ; | |
991 | } | |
992 | else if ( what.CompareTo("SDigits") == 0 ) { | |
993 | path += what ; | |
994 | path += "/PHOS/"; | |
995 | path += file ; | |
996 | path += "/" ; | |
997 | path += fSDigitsTitle ; | |
998 | } | |
999 | else if ( what.CompareTo("Digits") == 0 ){ | |
1000 | path += what ; | |
1001 | path += "/PHOS/"; | |
1002 | path += fDigitsTitle ; | |
1003 | } | |
1004 | else if ( what.CompareTo("EmcRecPoints") == 0 ) { | |
1005 | path += "RecPoints/PHOS/"; | |
1006 | path += "emc/" ; | |
1007 | path += fRecPointsTitle ; | |
1008 | } | |
1009 | else if ( what.CompareTo("CpvRecPoints") == 0 ) { | |
1010 | path += "RecPoints/PHOS/"; | |
1011 | path += "cpv/" ; | |
1012 | path += fRecPointsTitle ; | |
1013 | } | |
1014 | else if ( what.CompareTo("TrackSegments") == 0 ) { | |
1015 | path += "TrackSegments/PHOS/"; | |
1016 | path += fTrackSegmentsTitle ; | |
1017 | } | |
1018 | else if ( what.CompareTo("RecParticles") == 0 ) { | |
1019 | path += "RecParticles/PHOS/"; | |
1020 | path += fRecParticlesTitle ; | |
1021 | } | |
1022 | else if ( what.CompareTo("Alarms") == 0 ) { | |
1023 | path += "QAAlarms/PHOS"; | |
1024 | } | |
1025 | } | |
1026 | else { | |
1027 | if ( what.CompareTo("SDigits") == 0 ) { | |
1028 | path += what ; | |
1029 | path += "/PHOS/"; | |
1030 | path += file ; | |
1031 | path += "/" ; | |
1032 | path += name ; | |
1033 | } | |
1034 | else if ( what.CompareTo("Digits") == 0 ) { | |
1035 | path += what ; | |
1036 | path += "/PHOS/"; | |
1037 | path += name ; | |
1038 | } | |
1039 | else if ( what.CompareTo("EmcRecPoints") == 0 ) { | |
1040 | path += "RecPoints/PHOS/"; | |
1041 | path += "emc/" ; | |
1042 | path += name ; | |
1043 | } | |
1044 | else if ( what.CompareTo("CpvRecPoints") == 0 ) { | |
1045 | path += "RecPoints/PHOS/"; | |
1046 | path += "cpv/" ; | |
1047 | path += name ; | |
1048 | } | |
1049 | else if ( what.CompareTo("TrackSegments") == 0 ) { | |
1050 | path += "TrackSegments/PHOS/"; | |
1051 | path += name ; | |
1052 | } | |
1053 | else if ( what.CompareTo("RecParticles") == 0 ) { | |
1054 | path += "RecParticles/PHOS/"; | |
1055 | path += name ; | |
1056 | } | |
1057 | else if ( what.CompareTo("Alarms") == 0 ) { | |
1058 | path += "QAAlarms/PHOS/"; | |
1059 | path += name ; | |
1060 | } | |
1061 | } | |
1062 | path.Prepend("YSAlice/") ; | |
1063 | TObject * phosO = (TObject*)gROOT->FindObjectAny(path) ; | |
1064 | if (!phosO) { | |
1065 | cerr << "ERROR : AliPHOSGetter::ReturnO -> Object " << path << " not found!" << endl ; | |
1066 | abort() ; | |
1067 | } | |
1068 | return phosO ; | |
1069 | } | |
1070 | ||
1071 | //____________________________________________________________________________ | |
1072 | const TTask * AliPHOSGetter::ReturnT(TString what, TString name) const | |
1073 | { | |
1074 | // get the TTask named "what" from the folder | |
1075 | // folders are named like //YSAlice/Tasks/what/PHOS/name | |
1076 | ||
1077 | TString path("tasks") ; | |
1078 | ||
1079 | if ( what.CompareTo("SDigitizer") == 0 ) | |
1080 | path += "/SDigitizer" ; | |
1081 | else if ( what.CompareTo("Digitizer") == 0 ) | |
1082 | path += "/Digitizer" ; | |
1083 | else if ( what.CompareTo("Clusterizer") == 0 ) | |
1084 | path += "/Reconstructioner" ; | |
1085 | else if ( what.CompareTo("TrackSegmentMaker") == 0 ) | |
1086 | path += "/Reconstructioner" ; | |
1087 | else if ( what.CompareTo("PID") == 0 ) | |
1088 | path += "/Reconstructioner" ; | |
eb9763ac | 1089 | else if ( what.CompareTo("QATasks") == 0 ) |
1090 | path += "/QA" ; | |
4ae78bb1 | 1091 | |
dbad285c | 1092 | TFolder * aliceF = (TFolder*)gROOT ->FindObjectAny("YSAlice") ; |
1093 | TTask * aliceT = (TTask*) aliceF->FindObject(path) ; | |
4ae78bb1 | 1094 | |
1095 | if (!aliceT) { | |
1096 | cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << path << " not found!" << endl ; | |
1097 | abort() ; | |
1098 | } | |
1099 | ||
dbad285c | 1100 | TTask * phosT = (TTask*) aliceT->GetListOfTasks()->FindObject("PHOS") ; |
4ae78bb1 | 1101 | if (!phosT) { |
1102 | cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << path << "/PHOS not found!" << endl ; | |
1103 | abort() ; | |
1104 | } | |
1105 | TList * l = phosT->GetListOfTasks() ; | |
1106 | ||
1107 | if (what.CompareTo("SDigitizer") == 0) { | |
1108 | if ( name.IsNull() ) | |
1109 | name = fSDigitsTitle ; | |
1110 | } else if (what.CompareTo("Digitizer") == 0){ | |
1111 | if ( name.IsNull() ) | |
1112 | name = fDigitsTitle ; | |
1113 | } else if (what.CompareTo("Clusterizer") == 0){ | |
1114 | if ( name.IsNull() ) | |
1115 | name = fRecPointsTitle ; | |
1116 | } | |
1117 | else if (what.CompareTo("TrackSegmentMaker") == 0){ | |
1118 | if ( name.IsNull() ) | |
1119 | name = fTrackSegmentsTitle ; | |
1120 | } | |
1121 | else if (what.CompareTo("PID") == 0){ | |
1122 | if ( name.IsNull() ) | |
1123 | name = fRecParticlesTitle ; | |
1124 | } | |
eb9763ac | 1125 | else if (what.CompareTo("QATasks") == 0){ |
1126 | if ( name.IsNull() ) | |
1127 | return phosT ; | |
1128 | } | |
1129 | ||
4ae78bb1 | 1130 | TTask * task = (TTask*)l->FindObject(name) ; |
1131 | ||
1132 | if (!task) | |
1133 | cout << "WARNING: AliPHOSGetter::ReturnT -> Task " << path << "/" << name << " not found!" << endl ; | |
1134 | ||
1135 | return task ; | |
1136 | } |