-Int_t AliEMCALLoader::ReadSDigits()
-{
- // Read the summable digits tree TreeS():
- // Check if TClones is in folder
- // if not create and add to folder
- // connect to tree if available
- // Read the data
-
- TObject** sdref = SDigitsRef();
- if(sdref == 0x0)
- {
- MakeSDigitsArray();
- sdref = SDigitsRef();
- }
-
- TTree * treeS = TreeS();
- if(treeS==0)
- {
- //May happen if file is truncated or new in LoadSDigits
- //Error("ReadSDigits","There is no SDigit Tree");
- return 0;
- }
-
- TBranch * branch = treeS->GetBranch(fDetectorName);
- if (branch == 0)
- {//easy, maybe just a new tree
- //Error("ReadSDigits"," Cannot find branch EMCAL");
- return 0;
- }
-
- branch->SetAddress(SDigitsRef());
- branch->GetEntry(0);
- return 0;
-}
-
-//____________________________________________________________________________
-Int_t AliEMCALLoader::ReadDigits()
-{
- // Read the summable digits tree TreeS():
- // Check if TClones is in folder
- // if not create and add to folder
- // connect to tree if available
- // Read the data
-
- TObject** dref = DigitsRef();
- if(dref == 0x0)
- {//if there is not array in folder, create it and put it there
- MakeDigitsArray();
- dref = DigitsRef();
- }
-
- TTree * treeD = TreeD();
- if(treeD==0)
- {
- //May happen if file is truncated or new in LoadSDigits
- //Error("ReadDigits","There is no Digit Tree");
- return 0;
- }
-
- TBranch * branch = treeD->GetBranch(fDetectorName);
- if (branch == 0)
- {//easy, maybe just a new tree
- //Error("ReadDigits"," Cannot find branch ",fDetectorName.Data());
- return 0;
- }
-
- branch->SetAddress(dref);//connect branch to buffer sitting in folder
- branch->GetEntry(0);//get first event
-
- return 0;
-}
-
-//____________________________________________________________________________
-void AliEMCALLoader::UnloadRecParticles()
-{
- // Unloads the RecParticles array fromthe folder structure
- fRecParticlesLoaded = kFALSE;
- CleanRecParticles();
- if (fTracksLoaded == kFALSE) UnloadTracks();
-}
-
-//____________________________________________________________________________
-void AliEMCALLoader::UnloadTracks()
-{
- // Unloads the Tracks array fromthe folder structure
- CleanTracks();//free the memory
- //in case RecPart are loaded we can not onload tree and close the file
- if (fRecParticlesLoaded == kFALSE) AliLoader::UnloadTracks();
- fTracksLoaded = kFALSE;//mark that nobody needs them
-}
-
-//____________________________________________________________________________
-void AliEMCALLoader::Track(Int_t itrack)
-{
- // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
- if(TreeH()== 0)
- {
- if (LoadHits())
- {
- Error("Track","Can not load hits.");
- return;
- }
- }
-
- TBranch * hitsbranch = dynamic_cast<TBranch*>(TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
- if ( !hitsbranch ) {
- if (fDebug)
- cout << "WARNING: AliEMCALLoader::ReadTreeH -> Cannot find branch EMCAL" << endl ;
- return ;
- }
- if(!Hits()) PostHits();
-
- hitsbranch->SetAddress(HitsRef());
- hitsbranch->GetEntry(itrack);
-
-}
-
-//____________________________________________________________________________
-Int_t AliEMCALLoader::ReadRecPoints()
-{
- //Creates and posts to folder an array container,
- //connects branch in tree (if exists), and reads data to array
-
- MakeRecPointsArray();
-
- TObjArray * eca = 0x0 ;
-
- TTree * treeR = TreeR();
-
- if(treeR==0)
- {
- //May happen if file is truncated or new in LoadSDigits
- return 0;
- }
-
- Int_t retval = 0;
-
- TBranch * ecabranch = treeR->GetBranch(fgkECARecPointsBranchName);
- if (ecabranch == 0x0)
- {
- Error("ReadRecPoints","Can not get branch with ECA Rec. Points named %s",fgkECARecPointsBranchName.Data());
- retval = 2;
- }
- else
- {
- ecabranch->SetAddress(&eca);
- ecabranch->GetEntry(0) ;
- }
-
-
- Int_t ii ;
-
- Int_t maxeca = eca->GetEntries() ;
- for ( ii= 0 ; ii < maxeca ; ii++ )
- ECARecPoints()->Add(eca->At(ii)) ;
-
- return retval;
-}