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