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