]>
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 | ||
803d1ab0 | 16 | /* $Id$ */ |
4ae78bb1 | 17 | |
18 | //_________________________________________________________________________ | |
19 | // A singleton. This class should be used in the analysis stage to get | |
20 | // reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles, | |
21 | // instead of directly reading them from galice.root file. This container | |
22 | // ensures, that one reads Digits, made of these particular digits, RecPoints, | |
23 | // made of these particular RecPoints, TrackSegments and RecParticles. | |
24 | // This becomes non trivial if there are several identical branches, produced with | |
25 | // different set of parameters. | |
26 | // | |
27 | // An example of how to use (see also class AliPHOSAnalyser): | |
28 | // AliPHOSGetter * gime = AliPHOSGetter::GetInstance("galice.root","test") ; | |
29 | // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++) | |
30 | // AliPHOSRecParticle * part = gime->RecParticle(1) ; | |
31 | // ................ | |
2a657981 | 32 | // gime->Event(event) ; // reads new event from galice.root |
4ae78bb1 | 33 | // |
2a657981 | 34 | //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) |
35 | //*-- Completely redesigned by Dmitri Peressounko March 2001 | |
4ae78bb1 | 36 | // |
37 | //*-- YS June 2001 : renamed the original AliPHOSIndexToObject and make | |
38 | //*-- systematic usage of TFolders without changing the interface | |
39 | ////////////////////////////////////////////////////////////////////////////// | |
40 | ||
4ae78bb1 | 41 | // --- ROOT system --- |
88cb7938 | 42 | |
d7b234dd | 43 | #include <TFile.h> |
44 | #include <TROOT.h> | |
45 | #include <TSystem.h> | |
46 | #include <TParticle.h> | |
a43c51c3 | 47 | #include <TF1.h> |
e4d04cf1 | 48 | #include <TGraph.h> |
ff808dc7 | 49 | //#include <TCanvas.h> |
351dd634 | 50 | //#include <TFrame.h> |
4ae78bb1 | 51 | |
52 | // --- Standard library --- | |
4ae78bb1 | 53 | |
54 | // --- AliRoot header files --- | |
024a7e64 | 55 | #include "AliESD.h" |
56 | #include "AliHeader.h" | |
57 | #include "AliMC.h" | |
e957fea8 | 58 | #include "AliPHOS.h" |
024a7e64 | 59 | #include "AliPHOSBeamTestEvent.h" |
60 | #include "AliPHOSGetter.h" | |
61 | #include "AliPHOSLoader.h" | |
88cb7938 | 62 | #include "AliRunLoader.h" |
63 | #include "AliStack.h" | |
a43c51c3 | 64 | #include "AliPHOSRawStream.h" |
65 | #include "AliRawReaderFile.h" | |
e4d04cf1 | 66 | #include "AliLog.h" |
7ca0684e | 67 | #include "AliCDBLocal.h" |
68 | #include "AliCDBStorage.h" | |
9e1ceb13 | 69 | #include "AliCDBManager.h" |
88cb7938 | 70 | |
4ae78bb1 | 71 | ClassImp(AliPHOSGetter) |
72 | ||
88cb7938 | 73 | AliPHOSGetter * AliPHOSGetter::fgObjGetter = 0 ; |
74 | AliPHOSLoader * AliPHOSGetter::fgPhosLoader = 0; | |
75 | Int_t AliPHOSGetter::fgDebug = 0; | |
7ca0684e | 76 | AliPHOSCalibData* AliPHOSGetter::fCalibData = 0; |
ef868168 | 77 | AliPHOSAlignData* AliPHOSGetter::fAlignData = 0; |
88cb7938 | 78 | |
79 | // TFile * AliPHOSGetter::fgFile = 0 ; | |
4ae78bb1 | 80 | |
81 | //____________________________________________________________________________ | |
88cb7938 | 82 | AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* version, Option_t * openingOption) |
4ae78bb1 | 83 | { |
88cb7938 | 84 | // ctor only called by Instance() |
4ae78bb1 | 85 | |
88cb7938 | 86 | AliRunLoader* rl = AliRunLoader::GetRunLoader(version) ; |
87 | if (!rl) { | |
88 | rl = AliRunLoader::Open(headerFile, version, openingOption); | |
89 | if (!rl) { | |
90 | Fatal("AliPHOSGetter", "Could not find the Run Loader for %s - %s",headerFile, version) ; | |
91 | return ; | |
92 | } | |
93 | if (rl->GetAliRun() == 0x0) { | |
94 | rl->LoadgAlice(); | |
95 | gAlice = rl->GetAliRun(); // should be removed | |
12a7cec1 | 96 | rl->LoadHeader(); |
88cb7938 | 97 | } |
fbf811ec | 98 | } |
88cb7938 | 99 | fgPhosLoader = dynamic_cast<AliPHOSLoader*>(rl->GetLoader("PHOSLoader")); |
100 | if ( !fgPhosLoader ) | |
101 | Error("AliPHOSGetter", "Could not find PHOSLoader") ; | |
102 | else | |
103 | fgPhosLoader->SetTitle(version); | |
104 | ||
88cb7938 | 105 | // initialize data members |
106 | SetDebug(0) ; | |
107 | fBTE = 0 ; | |
108 | fPrimaries = 0 ; | |
109 | fLoadingStatus = "" ; | |
d2713783 | 110 | |
111 | fESDFileName = rl->GetFileName() ; // this should be the galice.root file | |
112 | fESDFileName.ReplaceAll("galice.root", "AliESDs.root") ; | |
95635748 | 113 | fESDFile = 0 ; |
677c8a30 | 114 | fESD = 0 ; |
115 | fESDTree = 0 ; | |
66f895c8 | 116 | fRawDigits = kFALSE ; |
7ca0684e | 117 | |
88cb7938 | 118 | } |
9bd3caba | 119 | |
88cb7938 | 120 | //____________________________________________________________________________ |
121 | AliPHOSGetter::~AliPHOSGetter() | |
122 | { | |
123 | // dtor | |
66f895c8 | 124 | if(fgPhosLoader){ |
125 | delete fgPhosLoader ; | |
126 | fgPhosLoader = 0 ; | |
127 | } | |
128 | if(fBTE){ | |
129 | delete fBTE ; | |
130 | fBTE = 0 ; | |
131 | } | |
132 | if(fPrimaries){ | |
133 | fPrimaries->Delete() ; | |
134 | delete fPrimaries ; | |
135 | } | |
677c8a30 | 136 | if (fESD) |
137 | delete fESD ; | |
138 | if (fESDTree) | |
66f895c8 | 139 | delete fESDTree ; |
140 | ||
7c193632 | 141 | fgObjGetter = 0; |
0ef40383 | 142 | } |
143 | ||
144 | //____________________________________________________________________________ | |
145 | void AliPHOSGetter::Reset() | |
146 | { | |
147 | // resets things in case the getter is called consecutively with different files | |
148 | // the PHOS Loader is already deleted by the Run Loader | |
149 | ||
150 | if (fPrimaries) { | |
151 | fPrimaries->Delete() ; | |
152 | delete fPrimaries ; | |
153 | } | |
154 | fgPhosLoader = 0; | |
155 | fgObjGetter = 0; | |
88cb7938 | 156 | } |
fbf811ec | 157 | |
88cb7938 | 158 | //____________________________________________________________________________ |
159 | AliPHOSClusterizer * AliPHOSGetter::Clusterizer() | |
160 | { | |
e957fea8 | 161 | // Returns pointer to the Clusterizer task |
88cb7938 | 162 | AliPHOSClusterizer * rv ; |
163 | rv = dynamic_cast<AliPHOSClusterizer *>(PhosLoader()->Reconstructioner()) ; | |
164 | if (!rv) { | |
165 | Event(0, "R") ; | |
166 | rv = dynamic_cast<AliPHOSClusterizer*>(PhosLoader()->Reconstructioner()) ; | |
167 | } | |
168 | return rv ; | |
169 | } | |
4ae78bb1 | 170 | |
88cb7938 | 171 | //____________________________________________________________________________ |
172 | TObjArray * AliPHOSGetter::CpvRecPoints() | |
173 | { | |
174 | // asks the Loader to return the CPV RecPoints container | |
4ae78bb1 | 175 | |
88cb7938 | 176 | TObjArray * rv = 0 ; |
177 | ||
178 | rv = PhosLoader()->CpvRecPoints() ; | |
179 | if (!rv) { | |
180 | PhosLoader()->MakeRecPointsArray() ; | |
181 | rv = PhosLoader()->CpvRecPoints() ; | |
182 | } | |
183 | return rv ; | |
184 | } | |
dca3a7c4 | 185 | |
88cb7938 | 186 | //____________________________________________________________________________ |
187 | TClonesArray * AliPHOSGetter::Digits() | |
188 | { | |
189 | // asks the Loader to return the Digits container | |
7bb289a7 | 190 | |
88cb7938 | 191 | TClonesArray * rv = 0 ; |
192 | rv = PhosLoader()->Digits() ; | |
7bb289a7 | 193 | |
88cb7938 | 194 | if( !rv ) { |
195 | PhosLoader()->MakeDigitsArray() ; | |
196 | rv = PhosLoader()->Digits() ; | |
4ae78bb1 | 197 | } |
88cb7938 | 198 | return rv ; |
199 | } | |
4b808d52 | 200 | |
88cb7938 | 201 | //____________________________________________________________________________ |
202 | AliPHOSDigitizer * AliPHOSGetter::Digitizer() | |
203 | { | |
e957fea8 | 204 | // Returns pointer to the Digitizer task |
88cb7938 | 205 | AliPHOSDigitizer * rv ; |
206 | rv = dynamic_cast<AliPHOSDigitizer *>(PhosLoader()->Digitizer()) ; | |
207 | if (!rv) { | |
208 | Event(0, "D") ; | |
209 | rv = dynamic_cast<AliPHOSDigitizer *>(PhosLoader()->Digitizer()) ; | |
210 | } | |
211 | return rv ; | |
4ae78bb1 | 212 | } |
fbf811ec | 213 | |
88cb7938 | 214 | |
4ae78bb1 | 215 | //____________________________________________________________________________ |
88cb7938 | 216 | TObjArray * AliPHOSGetter::EmcRecPoints() |
0bc3b8ed | 217 | { |
88cb7938 | 218 | // asks the Loader to return the EMC RecPoints container |
d489fb96 | 219 | |
88cb7938 | 220 | TObjArray * rv = 0 ; |
65549808 | 221 | |
88cb7938 | 222 | rv = PhosLoader()->EmcRecPoints() ; |
223 | if (!rv) { | |
224 | PhosLoader()->MakeRecPointsArray() ; | |
225 | rv = PhosLoader()->EmcRecPoints() ; | |
89165262 | 226 | } |
88cb7938 | 227 | return rv ; |
81bb1a45 | 228 | } |
7a9d98f9 | 229 | |
65549808 | 230 | //____________________________________________________________________________ |
88cb7938 | 231 | TClonesArray * AliPHOSGetter::TrackSegments() |
65549808 | 232 | { |
88cb7938 | 233 | // asks the Loader to return the TrackSegments container |
234 | ||
235 | TClonesArray * rv = 0 ; | |
236 | ||
237 | rv = PhosLoader()->TrackSegments() ; | |
238 | if (!rv) { | |
239 | PhosLoader()->MakeTrackSegmentsArray() ; | |
240 | rv = PhosLoader()->TrackSegments() ; | |
241 | } | |
242 | return rv ; | |
65549808 | 243 | } |
4ae78bb1 | 244 | |
0c87da39 | 245 | //____________________________________________________________________________ |
e957fea8 | 246 | AliPHOSTrackSegmentMaker * AliPHOSGetter::TrackSegmentMaker() |
88cb7938 | 247 | { |
e957fea8 | 248 | // Returns pointer to the TrackSegmentMaker task |
88cb7938 | 249 | AliPHOSTrackSegmentMaker * rv ; |
250 | rv = dynamic_cast<AliPHOSTrackSegmentMaker *>(PhosLoader()->TrackSegmentMaker()) ; | |
251 | if (!rv) { | |
252 | Event(0, "T") ; | |
253 | rv = dynamic_cast<AliPHOSTrackSegmentMaker *>(PhosLoader()->TrackSegmentMaker()) ; | |
0c87da39 | 254 | } |
88cb7938 | 255 | return rv ; |
0c87da39 | 256 | } |
257 | ||
4ae78bb1 | 258 | //____________________________________________________________________________ |
88cb7938 | 259 | TClonesArray * AliPHOSGetter::RecParticles() |
4ae78bb1 | 260 | { |
88cb7938 | 261 | // asks the Loader to return the TrackSegments container |
262 | ||
263 | TClonesArray * rv = 0 ; | |
4ae78bb1 | 264 | |
88cb7938 | 265 | rv = PhosLoader()->RecParticles() ; |
266 | if (!rv) { | |
267 | PhosLoader()->MakeRecParticlesArray() ; | |
268 | rv = PhosLoader()->RecParticles() ; | |
b134c32f | 269 | } |
88cb7938 | 270 | return rv ; |
4ae78bb1 | 271 | } |
4ae78bb1 | 272 | //____________________________________________________________________________ |
fc7e2f43 | 273 | void AliPHOSGetter::Event(Int_t event, const char* opt) |
4ae78bb1 | 274 | { |
88cb7938 | 275 | // Reads the content of all Tree's S, D and R |
548f0134 | 276 | |
66f895c8 | 277 | // if ( event >= MaxEvent() ) { |
278 | // Error("Event", "%d not found in TreeE !", event) ; | |
279 | // return ; | |
280 | // } | |
4ae78bb1 | 281 | |
88cb7938 | 282 | AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); |
df25f7dd | 283 | |
66f895c8 | 284 | // // checks if we are dealing with test-beam data |
285 | // TBranch * btb = rl->TreeE()->GetBranch("AliPHOSBeamTestEvent") ; | |
286 | // if(btb){ | |
287 | // if(!fBTE) | |
288 | // fBTE = new AliPHOSBeamTestEvent() ; | |
289 | // btb->SetAddress(&fBTE) ; | |
290 | // btb->GetEntry(event) ; | |
291 | // } | |
292 | // else{ | |
293 | // if(fBTE){ | |
294 | // delete fBTE ; | |
295 | // fBTE = 0 ; | |
296 | // } | |
297 | // } | |
88cb7938 | 298 | |
299 | // Loads the type of object(s) requested | |
b134c32f | 300 | |
88cb7938 | 301 | rl->GetEvent(event) ; |
302 | ||
66f895c8 | 303 | if(strstr(opt,"X") || (strcmp(opt,"")==0)){ |
88cb7938 | 304 | ReadPrimaries() ; |
66f895c8 | 305 | } |
306 | ||
307 | if(strstr(opt,"H") ){ | |
88cb7938 | 308 | ReadTreeH(); |
66f895c8 | 309 | } |
310 | ||
311 | if(strstr(opt,"S") ){ | |
88cb7938 | 312 | ReadTreeS() ; |
66f895c8 | 313 | } |
314 | ||
315 | if(strstr(opt,"D") ){ | |
88cb7938 | 316 | ReadTreeD() ; |
66f895c8 | 317 | } |
318 | ||
319 | if(strstr(opt,"R") ){ | |
88cb7938 | 320 | ReadTreeR() ; |
66f895c8 | 321 | } |
88cb7938 | 322 | |
66f895c8 | 323 | if( strstr(opt,"T") ){ |
88cb7938 | 324 | ReadTreeT() ; |
66f895c8 | 325 | } |
88cb7938 | 326 | |
66f895c8 | 327 | if( strstr(opt,"P") ){ |
88cb7938 | 328 | ReadTreeP() ; |
66f895c8 | 329 | } |
677c8a30 | 330 | |
66f895c8 | 331 | if( strstr(opt,"E") ){ |
677c8a30 | 332 | ReadTreeE(event) ; |
3cf4f75f | 333 | } |
334 | ||
335 | } | |
336 | ||
337 | ||
338 | //____________________________________________________________________________ | |
339 | void AliPHOSGetter::Event(AliRawReader *rawReader, const char* opt) | |
340 | { | |
341 | // Reads the raw event from rawReader | |
a43c51c3 | 342 | |
f88e2313 | 343 | AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); |
344 | ||
3cf4f75f | 345 | if( strstr(opt,"W") ){ |
f88e2313 | 346 | rawReader->NextEvent(); |
347 | Int_t iEvent = rl->GetEventNumber(); | |
348 | rl->GetEvent(iEvent); | |
3cf4f75f | 349 | ReadRaw(rawReader) ; |
f88e2313 | 350 | rl->SetEventNumber(++iEvent); |
66f895c8 | 351 | } |
95635748 | 352 | |
88cb7938 | 353 | } |
354 | ||
355 | ||
356 | //____________________________________________________________________________ | |
357 | Int_t AliPHOSGetter::EventNumber() const | |
358 | { | |
359 | // return the current event number | |
360 | AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); | |
361 | return static_cast<Int_t>(rl->GetEventNumber()) ; | |
fbf811ec | 362 | } |
d489fb96 | 363 | |
fbf811ec | 364 | //____________________________________________________________________________ |
88cb7938 | 365 | TClonesArray * AliPHOSGetter::Hits() |
fbf811ec | 366 | { |
88cb7938 | 367 | // asks the loader to return the Hits container |
368 | ||
369 | TClonesArray * rv = 0 ; | |
370 | ||
371 | rv = PhosLoader()->Hits() ; | |
372 | if ( !rv ) { | |
373 | PhosLoader()->LoadHits("read"); | |
374 | rv = PhosLoader()->Hits() ; | |
fbf811ec | 375 | } |
88cb7938 | 376 | return rv ; |
377 | } | |
fbf811ec | 378 | |
88cb7938 | 379 | //____________________________________________________________________________ |
380 | AliPHOSGetter * AliPHOSGetter::Instance(const char* alirunFileName, const char* version, Option_t * openingOption) | |
381 | { | |
382 | // Creates and returns the pointer of the unique instance | |
383 | // Must be called only when the environment has changed | |
d489fb96 | 384 | |
88cb7938 | 385 | if(!fgObjGetter){ // first time the getter is called |
386 | fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ; | |
fbf811ec | 387 | } |
88cb7938 | 388 | else { // the getter has been called previously |
389 | AliRunLoader * rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle()); | |
390 | if ( rl->GetFileName() == alirunFileName ) {// the alirunFile has the same name | |
391 | // check if the file is already open | |
392 | TFile * galiceFile = dynamic_cast<TFile *>(gROOT->FindObject(rl->GetFileName()) ) ; | |
393 | ||
394 | if ( !galiceFile ) | |
395 | fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ; | |
396 | ||
397 | else { // the file is already open check the version name | |
398 | TString currentVersionName = rl->GetEventFolder()->GetName() ; | |
399 | TString newVersionName(version) ; | |
400 | if (currentVersionName == newVersionName) | |
401 | if(fgDebug) | |
402 | ::Warning( "Instance", "Files with version %s already open", currentVersionName.Data() ) ; | |
403 | else { | |
404 | fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ; | |
405 | } | |
406 | } | |
407 | } | |
7fba1747 | 408 | else { |
409 | AliRunLoader * rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle()) ; | |
e191bb57 | 410 | if ( strstr(version, AliConfig::GetDefaultEventFolderName()) ) // false in case of merging |
1c221c70 | 411 | delete rl ; |
88cb7938 | 412 | fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ; |
7fba1747 | 413 | } |
48f12df6 | 414 | } |
88cb7938 | 415 | if (!fgObjGetter) |
95635748 | 416 | ::Error("AliPHOSGetter::Instance", "Failed to create the PHOS Getter object") ; |
88cb7938 | 417 | else |
418 | if (fgDebug) | |
419 | Print() ; | |
4ae78bb1 | 420 | |
88cb7938 | 421 | return fgObjGetter ; |
4ae78bb1 | 422 | } |
423 | ||
6ad0e528 | 424 | //____________________________________________________________________________ |
88cb7938 | 425 | AliPHOSGetter * AliPHOSGetter::Instance() |
6ad0e528 | 426 | { |
88cb7938 | 427 | // Returns the pointer of the unique instance already defined |
fbf811ec | 428 | |
95635748 | 429 | if(!fgObjGetter && fgDebug) |
430 | ::Warning("AliPHOSGetter::Instance", "Getter not initialized") ; | |
6ad0e528 | 431 | |
88cb7938 | 432 | return fgObjGetter ; |
433 | ||
6ad0e528 | 434 | } |
435 | ||
436 | //____________________________________________________________________________ | |
88cb7938 | 437 | Int_t AliPHOSGetter::MaxEvent() const |
6ad0e528 | 438 | { |
88cb7938 | 439 | // returns the number of events in the run (from TE) |
0bc3b8ed | 440 | |
88cb7938 | 441 | AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); |
442 | return static_cast<Int_t>(rl->GetNumberOfEvents()) ; | |
6ad0e528 | 443 | } |
444 | ||
445 | //____________________________________________________________________________ | |
88cb7938 | 446 | TParticle * AliPHOSGetter::Primary(Int_t index) const |
6ad0e528 | 447 | { |
88cb7938 | 448 | AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); |
449 | return rl->Stack()->Particle(index) ; | |
450 | } | |
6ad0e528 | 451 | |
4ae78bb1 | 452 | //____________________________________________________________________________ |
88cb7938 | 453 | AliPHOS * AliPHOSGetter:: PHOS() const |
4ae78bb1 | 454 | { |
455 | // returns the PHOS object | |
5c4bcd63 | 456 | AliPHOSLoader * loader = 0; |
457 | static AliPHOSLoader * oldloader = 0; | |
458 | static AliPHOS * phos = 0; | |
459 | ||
460 | loader = PhosLoader(); | |
461 | ||
462 | if ( loader != oldloader) { | |
463 | phos = dynamic_cast<AliPHOS*>(loader->GetModulesFolder()->FindObject("PHOS")) ; | |
464 | oldloader = loader; | |
465 | } | |
7a9d98f9 | 466 | if (!phos) |
88cb7938 | 467 | if (fgDebug) |
468 | Warning("PHOS", "PHOS module not found in module folders: %s", PhosLoader()->GetModulesFolder()->GetName() ) ; | |
7a9d98f9 | 469 | return phos ; |
4ae78bb1 | 470 | } |
471 | ||
88cb7938 | 472 | |
473 | ||
474 | //____________________________________________________________________________ | |
e957fea8 | 475 | AliPHOSPID * AliPHOSGetter::PID() |
88cb7938 | 476 | { |
e957fea8 | 477 | // Returns pointer to the PID task |
88cb7938 | 478 | AliPHOSPID * rv ; |
479 | rv = dynamic_cast<AliPHOSPID *>(PhosLoader()->PIDTask()) ; | |
480 | if (!rv) { | |
481 | Event(0, "P") ; | |
482 | rv = dynamic_cast<AliPHOSPID *>(PhosLoader()->PIDTask()) ; | |
483 | } | |
484 | return rv ; | |
485 | } | |
486 | ||
4ae78bb1 | 487 | //____________________________________________________________________________ |
88cb7938 | 488 | AliPHOSGeometry * AliPHOSGetter::PHOSGeometry() const |
4ae78bb1 | 489 | { |
0bc3b8ed | 490 | // Returns PHOS geometry |
491 | ||
7a9d98f9 | 492 | AliPHOSGeometry * rv = 0 ; |
493 | if (PHOS() ) | |
494 | rv = PHOS()->GetGeometry() ; | |
495 | return rv ; | |
496 | } | |
4ae78bb1 | 497 | |
cb34a1fa | 498 | //____________________________________________________________________________ |
88cb7938 | 499 | TClonesArray * AliPHOSGetter::Primaries() |
500 | { | |
501 | // creates the Primaries container if needed | |
502 | if ( !fPrimaries ) { | |
503 | if (fgDebug) | |
504 | Info("Primaries", "Creating a new TClonesArray for primaries") ; | |
505 | fPrimaries = new TClonesArray("TParticle", 1000) ; | |
506 | } | |
507 | return fPrimaries ; | |
508 | } | |
509 | ||
510 | //____________________________________________________________________________ | |
511 | void AliPHOSGetter::Print() | |
512 | { | |
513 | // Print usefull information about the getter | |
514 | ||
515 | AliRunLoader * rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle()); | |
516 | ::Info( "Print", "gAlice file is %s -- version name is %s", (rl->GetFileName()).Data(), rl->GetEventFolder()->GetName() ) ; | |
517 | } | |
cb34a1fa | 518 | |
88cb7938 | 519 | //____________________________________________________________________________ |
520 | void AliPHOSGetter::ReadPrimaries() | |
521 | { | |
522 | // Read Primaries from Kinematics.root | |
cb34a1fa | 523 | |
88cb7938 | 524 | AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); |
cb34a1fa | 525 | |
88cb7938 | 526 | // gets kine tree from the root file (Kinematics.root) |
7fba1747 | 527 | if ( ! rl->TreeK() ) { // load treeK the first time |
88cb7938 | 528 | rl->LoadKinematics() ; |
7fba1747 | 529 | } |
88cb7938 | 530 | |
7fba1747 | 531 | fNPrimaries = (rl->GetHeader())->GetNtrack(); |
88cb7938 | 532 | if (fgDebug) |
533 | Info( "ReadTreeK", "Found %d particles in event # %d", fNPrimaries, EventNumber() ) ; | |
cb34a1fa | 534 | |
cb34a1fa | 535 | |
88cb7938 | 536 | // first time creates the container |
537 | if ( Primaries() ) | |
538 | fPrimaries->Clear() ; | |
cb34a1fa | 539 | |
88cb7938 | 540 | Int_t index = 0 ; |
541 | for (index = 0 ; index < fNPrimaries; index++) { | |
542 | new ((*fPrimaries)[index]) TParticle(*(Primary(index))); | |
cb34a1fa | 543 | } |
cb34a1fa | 544 | } |
545 | ||
95635748 | 546 | //____________________________________________________________________________ |
d2713783 | 547 | Bool_t AliPHOSGetter::OpenESDFile() |
95635748 | 548 | { |
d2713783 | 549 | //Open the ESD file |
95635748 | 550 | Bool_t rv = kTRUE ; |
d2713783 | 551 | if (!fESDFile) { |
552 | fESDFile = TFile::Open(fESDFileName) ; | |
553 | if (!fESDFile ) | |
554 | return kFALSE ; | |
555 | } | |
95635748 | 556 | else if (fESDFile->IsOpen()) { |
557 | fESDFile->Close() ; | |
558 | fESDFile = TFile::Open(fESDFileName) ; | |
559 | } | |
560 | if (!fESDFile->IsOpen()) | |
561 | rv = kFALSE ; | |
562 | return rv ; | |
563 | } | |
564 | ||
45c1ce6f | 565 | //____________________________________________________________________________ |
44ae287e | 566 | void AliPHOSGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Double_t & energy, Double_t & time) |
45c1ce6f | 567 | { |
568 | // Fits the raw signal time distribution | |
569 | ||
570 | const Int_t kNoiseThreshold = 0 ; | |
571 | Double_t timezero1 = 0., timezero2 = 0., timemax = 0. ; | |
572 | Double_t signal = 0., signalmax = 0. ; | |
44ae287e | 573 | time = 0. ; |
574 | energy = 0. ; | |
45c1ce6f | 575 | |
576 | if (lowGainFlag) { | |
577 | timezero1 = timezero2 = signalmax = timemax = 0. ; | |
578 | signalF->FixParameter(0, PHOS()->GetRawFormatLowCharge()) ; | |
579 | signalF->FixParameter(1, PHOS()->GetRawFormatLowGain()) ; | |
580 | Int_t index ; | |
581 | for (index = 0; index < PHOS()->GetRawFormatTimeBins(); index++) { | |
582 | gLowGain->GetPoint(index, time, signal) ; | |
583 | if (signal > kNoiseThreshold && timezero1 == 0.) | |
584 | timezero1 = time ; | |
585 | if (signal <= kNoiseThreshold && timezero1 > 0. && timezero2 == 0.) | |
586 | timezero2 = time ; | |
587 | if (signal > signalmax) { | |
588 | signalmax = signal ; | |
589 | timemax = time ; | |
590 | } | |
591 | } | |
592 | signalmax /= PHOS()->RawResponseFunctionMax(PHOS()->GetRawFormatLowCharge(), | |
593 | PHOS()->GetRawFormatLowGain()) ; | |
594 | if ( timezero1 + PHOS()->GetRawFormatTimePeak() < PHOS()->GetRawFormatTimeMax() * 0.4 ) { // else its noise | |
595 | signalF->SetParameter(2, signalmax) ; | |
596 | signalF->SetParameter(3, timezero1) ; | |
597 | gLowGain->Fit(signalF, "QRON", "", 0., timezero2); //, "QRON") ; | |
598 | energy = signalF->GetParameter(2) ; | |
599 | time = signalF->GetMaximumX() - PHOS()->GetRawFormatTimePeak() - PHOS()->GetRawFormatTimeTrigger() ; | |
600 | } | |
601 | } else { | |
602 | timezero1 = timezero2 = signalmax = timemax = 0. ; | |
603 | signalF->FixParameter(0, PHOS()->GetRawFormatHighCharge()) ; | |
604 | signalF->FixParameter(1, PHOS()->GetRawFormatHighGain()) ; | |
605 | Int_t index ; | |
606 | for (index = 0; index < PHOS()->GetRawFormatTimeBins(); index++) { | |
607 | gHighGain->GetPoint(index, time, signal) ; | |
608 | if (signal > kNoiseThreshold && timezero1 == 0.) | |
609 | timezero1 = time ; | |
610 | if (signal <= kNoiseThreshold && timezero1 > 0. && timezero2 == 0.) | |
611 | timezero2 = time ; | |
612 | if (signal > signalmax) { | |
613 | signalmax = signal ; | |
614 | timemax = time ; | |
615 | } | |
616 | } | |
617 | signalmax /= PHOS()->RawResponseFunctionMax(PHOS()->GetRawFormatHighCharge(), | |
618 | PHOS()->GetRawFormatHighGain()) ;; | |
619 | if ( timezero1 + PHOS()->GetRawFormatTimePeak() < PHOS()->GetRawFormatTimeMax() * 0.4 ) { // else its noise | |
620 | signalF->SetParameter(2, signalmax) ; | |
621 | signalF->SetParameter(3, timezero1) ; | |
622 | gHighGain->Fit(signalF, "QRON", "", 0., timezero2) ; | |
623 | energy = signalF->GetParameter(2) ; | |
624 | time = signalF->GetMaximumX() - PHOS()->GetRawFormatTimePeak() - PHOS()->GetRawFormatTimeTrigger() ; | |
625 | } | |
626 | } | |
44ae287e | 627 | if (time == 0) energy = 0 ; |
45c1ce6f | 628 | } |
629 | ||
44ae287e | 630 | //____________________________________________________________________________ |
631 | Int_t AliPHOSGetter::CalibrateRaw(Double_t energy, Int_t *relId) | |
632 | { | |
633 | // Convert energy into digitized amplitude for a cell relId | |
634 | // It is a user responsilibity to open CDB and set | |
635 | // AliPHOSCalibData object by the following operators: | |
636 | // | |
637 | // AliCDBLocal *loc = new AliCDBLocal("deCalibDB"); | |
638 | // AliPHOSCalibData* clb = (AliPHOSCalibData*)AliCDBStorage::Instance() | |
639 | // ->Get(path_to_calibdata,run_number); | |
640 | // AliPHOSGetter* gime = AliPHOSGetter::Instance("galice.root"); | |
641 | // gime->SetCalibData(clb); | |
642 | ||
643 | if (CalibData() == 0) | |
f88e2313 | 644 | Warning("CalibrateRaw","Calibration DB is not initiated!"); |
44ae287e | 645 | |
646 | Int_t module = relId[0]; | |
f88e2313 | 647 | Int_t column = relId[3]; |
648 | Int_t row = relId[2]; | |
649 | ||
650 | Float_t gainFactor = 0.0015; // width of one Emc ADC channel in GeV | |
651 | Float_t pedestal = 0.005; // Emc pedestals | |
652 | ||
653 | if(CalibData()) { | |
654 | gainFactor = CalibData()->GetADCchannelEmc (module,column,row); | |
655 | pedestal = CalibData()->GetADCpedestalEmc(module,column,row); | |
656 | } | |
657 | ||
44ae287e | 658 | Int_t amp = static_cast<Int_t>( (energy - pedestal) / gainFactor + 0.5 ) ; |
659 | return amp; | |
660 | } | |
a43c51c3 | 661 | //____________________________________________________________________________ |
3cf4f75f | 662 | Int_t AliPHOSGetter::ReadRaw(AliRawReader *rawReader) |
a43c51c3 | 663 | { |
664 | // reads the raw format data, converts it into digits format and store digits in Digits() | |
665 | // container. | |
666 | ||
3cf4f75f | 667 | AliPHOSRawStream in(rawReader); |
a43c51c3 | 668 | |
45c1ce6f | 669 | Bool_t first = kTRUE ; |
670 | ||
671 | TF1 * signalF = new TF1("signal", AliPHOS::RawResponseFunction, 0, PHOS()->GetRawFormatTimeMax(), 4); | |
672 | signalF->SetParNames("Charge", "Gain", "Amplitude", "TimeZero") ; | |
673 | ||
44ae287e | 674 | Int_t relId[4], id =0; |
45c1ce6f | 675 | Bool_t lowGainFlag = kFALSE ; |
676 | ||
a43c51c3 | 677 | TClonesArray * digits = Digits() ; |
678 | digits->Clear() ; | |
679 | Int_t idigit = 0 ; | |
44ae287e | 680 | Int_t amp = 0 ; |
681 | Double_t energy = 0. ; | |
682 | Double_t time = 0. ; | |
ff808dc7 | 683 | |
45c1ce6f | 684 | TGraph * gLowGain = new TGraph(PHOS()->GetRawFormatTimeBins()) ; |
685 | TGraph * gHighGain= new TGraph(PHOS()->GetRawFormatTimeBins()) ; | |
e4d04cf1 | 686 | |
45c1ce6f | 687 | while ( in.Next() ) { // PHOS entries loop |
688 | if ( (in.IsNewRow() || in.IsNewColumn() || in.IsNewModule()) ) { | |
44ae287e | 689 | relId[0] = in.GetModule() ; |
690 | if ( relId[0] >= PHOS()->GetRawFormatLowGainOffset() ) { | |
691 | relId[0] -= PHOS()->GetRawFormatLowGainOffset() ; | |
692 | lowGainFlag = kTRUE ; | |
693 | } else | |
694 | lowGainFlag = kFALSE ; | |
695 | relId[1] = 0 ; | |
696 | relId[2] = in.GetRow() ; | |
697 | relId[3] = in.GetColumn() ; | |
698 | PHOSGeometry()->RelToAbsNumbering(relId, id) ; | |
45c1ce6f | 699 | if (!first) { |
44ae287e | 700 | FitRaw(lowGainFlag, gLowGain, gHighGain, signalF, energy, time) ; |
f88e2313 | 701 | amp = CalibrateRaw(energy,relId); |
45c1ce6f | 702 | if (amp > 0) { |
703 | new((*digits)[idigit]) AliPHOSDigit( -1, id, amp, time) ; | |
704 | idigit++ ; | |
705 | } | |
706 | Int_t index ; | |
707 | for (index = 0; index < PHOS()->GetRawFormatTimeBins(); index++) { | |
708 | gLowGain->SetPoint(index, index * PHOS()->GetRawFormatTimeMax() / PHOS()->GetRawFormatTimeBins(), 0) ; | |
709 | gHighGain->SetPoint(index, index * PHOS()->GetRawFormatTimeMax() / PHOS()->GetRawFormatTimeBins(), 0) ; | |
710 | } | |
711 | } | |
712 | first = kFALSE ; | |
66f895c8 | 713 | } |
45c1ce6f | 714 | if (lowGainFlag) |
715 | gLowGain->SetPoint(in.GetTime(), | |
716 | in.GetTime()* PHOS()->GetRawFormatTimeMax() / PHOS()->GetRawFormatTimeBins(), | |
717 | in.GetSignal()) ; | |
718 | else | |
719 | gHighGain->SetPoint(in.GetTime(), | |
720 | in.GetTime() * PHOS()->GetRawFormatTimeMax() / PHOS()->GetRawFormatTimeBins(), | |
721 | in.GetSignal() ) ; | |
722 | ||
a43c51c3 | 723 | } // PHOS entries loop |
45c1ce6f | 724 | |
44ae287e | 725 | FitRaw(lowGainFlag, gLowGain, gHighGain, signalF, energy, time) ; |
726 | amp = CalibrateRaw(energy,relId); | |
727 | if (amp > 0 ) { | |
728 | new((*digits)[idigit]) AliPHOSDigit( -1, id, amp, time) ; | |
729 | idigit++ ; | |
730 | } | |
ff808dc7 | 731 | digits->Sort() ; |
45c1ce6f | 732 | |
733 | delete signalF ; | |
29167ac3 | 734 | delete gLowGain; |
735 | delete gHighGain ; | |
a43c51c3 | 736 | |
f88e2313 | 737 | // AliInfo(Form("Event %d, digits: %d\n", EventNumber(),digits->GetEntries())); //bvp |
e4d04cf1 | 738 | return digits->GetEntriesFast() ; |
a43c51c3 | 739 | } |
45c1ce6f | 740 | |
741 | // TClonesArray * digits = Digits() ; | |
742 | // digits->Clear() ; | |
743 | // Int_t idigit = 0 ; | |
744 | ||
745 | // while ( in.Next() ) { // PHOS entries loop | |
746 | ||
747 | // Int_t amp = in.GetSignal() ; | |
748 | // Double_t time = in.GetTime() ; | |
749 | // Int_t relId[4], id ; | |
750 | ||
751 | // relId[0] = in.GetModule() ; | |
752 | // if ( relId[0] >= PHOS()->GetRawFormatLowGainOffset() ) { | |
753 | // relId[0] -= PHOS()->GetRawFormatLowGainOffset() ; | |
754 | // } | |
755 | // relId[1] = 0 ; | |
756 | // relId[2] = in.GetRow() ; | |
757 | // relId[3] = in.GetColumn() ; | |
758 | // PHOSGeometry()->RelToAbsNumbering(relId, id) ; | |
759 | ||
760 | // if (amp > 0 && id >=0 ) { | |
761 | // new((*digits)[idigit]) AliPHOSDigit( -1, id, amp, time) ; | |
762 | // idigit++ ; | |
763 | // } | |
764 | ||
765 | // } // PHOS entries loop | |
766 | ||
767 | // digits->Sort() ; | |
768 | ||
769 | // return digits->GetEntriesFast() ; | |
770 | // } | |
b0bba0af | 771 | //____________________________________________________________________________ |
88cb7938 | 772 | Int_t AliPHOSGetter::ReadTreeD() |
773 | { | |
774 | // Read the Digits | |
b0bba0af | 775 | |
41c29fde | 776 | PhosLoader()->CleanDigits() ; |
ff808dc7 | 777 | PhosLoader()->LoadDigits("UPDATE") ; |
778 | PhosLoader()->LoadDigitizer("UPDATE") ; | |
88cb7938 | 779 | return Digits()->GetEntries() ; |
780 | } | |
7a9d98f9 | 781 | |
b0bba0af | 782 | //____________________________________________________________________________ |
88cb7938 | 783 | Int_t AliPHOSGetter::ReadTreeH() |
784 | { | |
785 | // Read the Hits | |
41c29fde | 786 | PhosLoader()->CleanHits() ; |
88cb7938 | 787 | // gets TreeH from the root file (PHOS.Hit.root) |
41c29fde | 788 | //if ( !IsLoaded("H") ) { |
88cb7938 | 789 | PhosLoader()->LoadHits("UPDATE") ; |
41c29fde | 790 | // SetLoaded("H") ; |
791 | //} | |
88cb7938 | 792 | return Hits()->GetEntries() ; |
793 | } | |
4ae78bb1 | 794 | |
88cb7938 | 795 | //____________________________________________________________________________ |
796 | Int_t AliPHOSGetter::ReadTreeR() | |
797 | { | |
798 | // Read the RecPoints | |
b0bba0af | 799 | |
41c29fde | 800 | PhosLoader()->CleanRecPoints() ; |
88cb7938 | 801 | // gets TreeR from the root file (PHOS.RecPoints.root) |
41c29fde | 802 | //if ( !IsLoaded("R") ) { |
88cb7938 | 803 | PhosLoader()->LoadRecPoints("UPDATE") ; |
804 | PhosLoader()->LoadClusterizer("UPDATE") ; | |
41c29fde | 805 | // SetLoaded("R") ; |
806 | //} | |
f1611b7c | 807 | |
88cb7938 | 808 | return EmcRecPoints()->GetEntries() ; |
b0bba0af | 809 | } |
7a9d98f9 | 810 | |
b0bba0af | 811 | //____________________________________________________________________________ |
88cb7938 | 812 | Int_t AliPHOSGetter::ReadTreeT() |
813 | { | |
814 | // Read the TrackSegments | |
7a9d98f9 | 815 | |
41c29fde | 816 | PhosLoader()->CleanTracks() ; |
88cb7938 | 817 | // gets TreeT from the root file (PHOS.TrackSegments.root) |
41c29fde | 818 | //if ( !IsLoaded("T") ) { |
88cb7938 | 819 | PhosLoader()->LoadTracks("UPDATE") ; |
820 | PhosLoader()->LoadTrackSegmentMaker("UPDATE") ; | |
41c29fde | 821 | // SetLoaded("T") ; |
822 | //} | |
fbf811ec | 823 | |
88cb7938 | 824 | return TrackSegments()->GetEntries() ; |
825 | } | |
b0bba0af | 826 | //____________________________________________________________________________ |
88cb7938 | 827 | Int_t AliPHOSGetter::ReadTreeP() |
828 | { | |
41c29fde | 829 | // Read the RecParticles |
88cb7938 | 830 | |
41c29fde | 831 | PhosLoader()->CleanRecParticles() ; |
832 | ||
88cb7938 | 833 | // gets TreeT from the root file (PHOS.TrackSegments.root) |
41c29fde | 834 | // if ( !IsLoaded("P") ) { |
88cb7938 | 835 | PhosLoader()->LoadRecParticles("UPDATE") ; |
836 | PhosLoader()->LoadPID("UPDATE") ; | |
41c29fde | 837 | // SetLoaded("P") ; |
838 | //} | |
7a9d98f9 | 839 | |
88cb7938 | 840 | return RecParticles()->GetEntries() ; |
841 | } | |
842 | //____________________________________________________________________________ | |
843 | Int_t AliPHOSGetter::ReadTreeS() | |
844 | { | |
845 | // Read the SDigits | |
846 | ||
41c29fde | 847 | PhosLoader()->CleanSDigits() ; |
88cb7938 | 848 | // gets TreeS from the root file (PHOS.SDigits.root) |
41c29fde | 849 | //if ( !IsLoaded("S") ) { |
7b4c1168 | 850 | PhosLoader()->LoadSDigits("READ") ; |
851 | PhosLoader()->LoadSDigitizer("READ") ; | |
41c29fde | 852 | // SetLoaded("S") ; |
853 | //} | |
b0bba0af | 854 | |
88cb7938 | 855 | return SDigits()->GetEntries() ; |
856 | } | |
f1611b7c | 857 | |
677c8a30 | 858 | //____________________________________________________________________________ |
859 | Int_t AliPHOSGetter::ReadTreeE(Int_t event) | |
860 | { | |
861 | // Read the ESD | |
862 | ||
863 | // gets esdTree from the root file (AliESDs.root) | |
864 | if (!fESDFile) | |
865 | if ( !OpenESDFile() ) | |
866 | return -1 ; | |
867 | ||
868 | fESDTree = static_cast<TTree*>(fESDFile->Get("esdTree")) ; | |
869 | fESD = new AliESD; | |
870 | if (!fESDTree) { | |
871 | ||
872 | Error("ReadTreeE", "no ESD tree found"); | |
873 | return -1; | |
874 | } | |
875 | fESDTree->SetBranchAddress("ESD", &fESD); | |
876 | fESDTree->GetEvent(event); | |
877 | ||
878 | return event ; | |
879 | } | |
880 | ||
88cb7938 | 881 | //____________________________________________________________________________ |
882 | TClonesArray * AliPHOSGetter::SDigits() | |
883 | { | |
884 | // asks the Loader to return the Digits container | |
b0bba0af | 885 | |
88cb7938 | 886 | TClonesArray * rv = 0 ; |
887 | ||
888 | rv = PhosLoader()->SDigits() ; | |
889 | if (!rv) { | |
890 | PhosLoader()->MakeSDigitsArray() ; | |
891 | rv = PhosLoader()->SDigits() ; | |
892 | } | |
893 | return rv ; | |
b0bba0af | 894 | } |
895 | ||
896 | //____________________________________________________________________________ | |
e957fea8 | 897 | AliPHOSSDigitizer * AliPHOSGetter::SDigitizer() |
88cb7938 | 898 | { |
e957fea8 | 899 | // Returns pointer to the SDigitizer task |
88cb7938 | 900 | AliPHOSSDigitizer * rv ; |
901 | rv = dynamic_cast<AliPHOSSDigitizer *>(PhosLoader()->SDigitizer()) ; | |
902 | if (!rv) { | |
903 | Event(0, "S") ; | |
904 | rv = dynamic_cast<AliPHOSSDigitizer *>(PhosLoader()->SDigitizer()) ; | |
b0bba0af | 905 | } |
88cb7938 | 906 | return rv ; |
b0bba0af | 907 | } |
7a9d98f9 | 908 | |
b0bba0af | 909 | //____________________________________________________________________________ |
fc7e2f43 | 910 | TParticle * AliPHOSGetter::Secondary(const TParticle* p, Int_t index) const |
88cb7938 | 911 | { |
912 | // Return first (index=1) or second (index=2) secondary particle of primary particle p | |
913 | ||
914 | if(index <= 0) | |
915 | return 0 ; | |
916 | if(index > 2) | |
917 | return 0 ; | |
b0bba0af | 918 | |
88cb7938 | 919 | if(p) { |
920 | Int_t daughterIndex = p->GetDaughter(index-1) ; | |
921 | AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); | |
5d12ce38 | 922 | return rl->GetAliRun()->GetMCApp()->Particle(daughterIndex) ; |
88cb7938 | 923 | } |
924 | else | |
925 | return 0 ; | |
926 | } | |
4ae78bb1 | 927 | |
88cb7938 | 928 | //____________________________________________________________________________ |
fc7e2f43 | 929 | void AliPHOSGetter::Track(Int_t itrack) |
88cb7938 | 930 | { |
931 | // Read the first entry of PHOS branch in hit tree gAlice->TreeH() | |
932 | ||
933 | AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); | |
b0bba0af | 934 | |
88cb7938 | 935 | if( !TreeH() ) // load treeH the first time |
936 | rl->LoadHits() ; | |
b0bba0af | 937 | |
88cb7938 | 938 | // first time create the container |
939 | TClonesArray * hits = Hits() ; | |
940 | if ( hits ) | |
941 | hits->Clear() ; | |
b0bba0af | 942 | |
88cb7938 | 943 | TBranch * phosbranch = dynamic_cast<TBranch*>(TreeH()->GetBranch("PHOS")) ; |
944 | phosbranch->SetAddress(&hits) ; | |
945 | phosbranch->GetEntry(itrack) ; | |
b0bba0af | 946 | } |
947 | ||
b0bba0af | 948 | //____________________________________________________________________________ |
88cb7938 | 949 | TTree * AliPHOSGetter::TreeD() const |
950 | { | |
e957fea8 | 951 | // Returns pointer to the Digits Tree |
88cb7938 | 952 | TTree * rv = 0 ; |
953 | rv = PhosLoader()->TreeD() ; | |
954 | if ( !rv ) { | |
955 | PhosLoader()->MakeTree("D"); | |
956 | rv = PhosLoader()->TreeD() ; | |
b0bba0af | 957 | } |
b0bba0af | 958 | |
88cb7938 | 959 | return rv ; |
b0bba0af | 960 | } |
548f0134 | 961 | |
b0bba0af | 962 | //____________________________________________________________________________ |
88cb7938 | 963 | TTree * AliPHOSGetter::TreeH() const |
964 | { | |
e957fea8 | 965 | // Returns pointer to the Hits Tree |
88cb7938 | 966 | TTree * rv = 0 ; |
967 | rv = PhosLoader()->TreeH() ; | |
968 | if ( !rv ) { | |
969 | PhosLoader()->MakeTree("H"); | |
970 | rv = PhosLoader()->TreeH() ; | |
971 | } | |
972 | ||
973 | return rv ; | |
b0bba0af | 974 | } |
7a9d98f9 | 975 | |
b0bba0af | 976 | //____________________________________________________________________________ |
88cb7938 | 977 | TTree * AliPHOSGetter::TreeR() const |
0bc3b8ed | 978 | { |
e957fea8 | 979 | // Returns pointer to the RecPoints Tree |
88cb7938 | 980 | TTree * rv = 0 ; |
981 | rv = PhosLoader()->TreeR() ; | |
982 | if ( !rv ) { | |
983 | PhosLoader()->MakeTree("R"); | |
984 | rv = PhosLoader()->TreeR() ; | |
985 | } | |
b0bba0af | 986 | |
88cb7938 | 987 | return rv ; |
b0bba0af | 988 | } |
989 | ||
b0bba0af | 990 | //____________________________________________________________________________ |
88cb7938 | 991 | TTree * AliPHOSGetter::TreeT() const |
0bc3b8ed | 992 | { |
e957fea8 | 993 | // Returns pointer to the TrackSegments Tree |
88cb7938 | 994 | TTree * rv = 0 ; |
995 | rv = PhosLoader()->TreeT() ; | |
996 | if ( !rv ) { | |
997 | PhosLoader()->MakeTree("T"); | |
998 | rv = PhosLoader()->TreeT() ; | |
999 | } | |
b0bba0af | 1000 | |
88cb7938 | 1001 | return rv ; |
b0bba0af | 1002 | } |
b0bba0af | 1003 | //____________________________________________________________________________ |
88cb7938 | 1004 | TTree * AliPHOSGetter::TreeP() const |
0bc3b8ed | 1005 | { |
e957fea8 | 1006 | // Returns pointer to the RecParticles Tree |
88cb7938 | 1007 | TTree * rv = 0 ; |
1008 | rv = PhosLoader()->TreeP() ; | |
1009 | if ( !rv ) { | |
1010 | PhosLoader()->MakeTree("P"); | |
1011 | rv = PhosLoader()->TreeP() ; | |
1012 | } | |
4ae78bb1 | 1013 | |
88cb7938 | 1014 | return rv ; |
b0bba0af | 1015 | } |
1016 | ||
1017 | //____________________________________________________________________________ | |
88cb7938 | 1018 | TTree * AliPHOSGetter::TreeS() const |
e957fea8 | 1019 | { |
1020 | // Returns pointer to the SDigits Tree | |
88cb7938 | 1021 | TTree * rv = 0 ; |
1022 | rv = PhosLoader()->TreeS() ; | |
1023 | if ( !rv ) { | |
1024 | PhosLoader()->MakeTree("S"); | |
1025 | rv = PhosLoader()->TreeS() ; | |
b0bba0af | 1026 | } |
b0bba0af | 1027 | |
88cb7938 | 1028 | return rv ; |
b0bba0af | 1029 | } |
7a9d98f9 | 1030 | |
b0bba0af | 1031 | //____________________________________________________________________________ |
88cb7938 | 1032 | Bool_t AliPHOSGetter::VersionExists(TString & opt) const |
1033 | { | |
1034 | // checks if the version with the present name already exists in the same directory | |
7a9d98f9 | 1035 | |
88cb7938 | 1036 | Bool_t rv = kFALSE ; |
1037 | ||
1038 | AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); | |
1039 | TString version( rl->GetEventFolder()->GetName() ) ; | |
7a9d98f9 | 1040 | |
88cb7938 | 1041 | opt.ToLower() ; |
b0bba0af | 1042 | |
88cb7938 | 1043 | if ( opt == "sdigits") { |
1044 | // add the version name to the root file name | |
1045 | TString fileName( PhosLoader()->GetSDigitsFileName() ) ; | |
e191bb57 | 1046 | if (version != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name |
88cb7938 | 1047 | fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ; |
1048 | if ( !(gSystem->AccessPathName(fileName)) ) { | |
1049 | Warning("VersionExists", "The file %s already exists", fileName.Data()) ; | |
1050 | rv = kTRUE ; | |
4ae78bb1 | 1051 | } |
88cb7938 | 1052 | PhosLoader()->SetSDigitsFileName(fileName) ; |
b0bba0af | 1053 | } |
7a9d98f9 | 1054 | |
88cb7938 | 1055 | if ( opt == "digits") { |
1056 | // add the version name to the root file name | |
1057 | TString fileName( PhosLoader()->GetDigitsFileName() ) ; | |
e191bb57 | 1058 | if (version != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name |
88cb7938 | 1059 | fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ; |
1060 | if ( !(gSystem->AccessPathName(fileName)) ) { | |
1061 | Warning("VersionExists", "The file %s already exists", fileName.Data()) ; | |
1062 | rv = kTRUE ; | |
7a9d98f9 | 1063 | } |
b0bba0af | 1064 | } |
7a9d98f9 | 1065 | |
88cb7938 | 1066 | return rv ; |
7a9d98f9 | 1067 | |
b0bba0af | 1068 | } |
88cb7938 | 1069 | |
7bb289a7 | 1070 | //____________________________________________________________________________ |
88cb7938 | 1071 | UShort_t AliPHOSGetter::EventPattern(void) const |
0bc3b8ed | 1072 | { |
1073 | // Return the pattern (trigger bit register) of the beam-test event | |
7bb289a7 | 1074 | if(fBTE) |
1075 | return fBTE->GetPattern() ; | |
1076 | else | |
1077 | return 0 ; | |
1078 | } | |
1079 | //____________________________________________________________________________ | |
88cb7938 | 1080 | Float_t AliPHOSGetter::BeamEnergy(void) const |
0bc3b8ed | 1081 | { |
1082 | // Return the beam energy of the beam-test event | |
7bb289a7 | 1083 | if(fBTE) |
1084 | return fBTE->GetBeamEnergy() ; | |
1085 | else | |
1086 | return 0 ; | |
1087 | } | |
7ca0684e | 1088 | //____________________________________________________________________________ |
1089 | ||
1090 | AliPHOSCalibData* AliPHOSGetter::CalibData() | |
1091 | { | |
ef868168 | 1092 | // Check if the instance of AliPHOSCalibData exists, and return it |
7ca0684e | 1093 | |
ef868168 | 1094 | if( !(AliCDBManager::Instance()->IsDefaultStorageSet()) ) |
7ca0684e | 1095 | fCalibData=0x0; |
7ca0684e | 1096 | return fCalibData; |
ef868168 | 1097 | } |
1098 | //____________________________________________________________________________ | |
7ca0684e | 1099 | |
ef868168 | 1100 | AliPHOSAlignData* AliPHOSGetter::AlignData() |
1101 | { | |
1102 | // Check if the instance of AliPHOSAlignData exists, and return it | |
1103 | ||
1104 | if( !(AliCDBManager::Instance()->IsDefaultStorageSet()) ) | |
1105 | fAlignData=0x0; | |
1106 | return fAlignData; | |
7ca0684e | 1107 | } |