+
+//________________________________________________________________________________________________
+Bool_t AliTRDdigitsManager::LoadArrayDict()
+{
+ //
+ // Loads dictionary arrays for all detectors
+ //
+
+ if (!fTree)
+ {
+ AliError("Digits tree is not defined\n");
+ return kFALSE;
+ }
+
+ Bool_t status = kTRUE;
+
+ for (Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+
+ // Get the branch
+ Char_t branchname[15];
+ snprintf(branchname,15,"TRDdictionary%d",iDict);
+ TBranch *branch = fTree->GetBranch(branchname);
+ if (!branch)
+ {
+ AliError(Form("Branch %s is not defined\n",branchname));
+ return kFALSE;
+ }
+
+ // Loop through all detectors and read them from the tree
+ for (Int_t iDet = 0; iDet < fDets; iDet++)
+ {
+ AliTRDarrayDictionary *dataArray = (AliTRDarrayDictionary *) fDict[iDict]->At(iDet);
+ if (!dataArray)
+ {
+ status = kFALSE;
+ break;
+ }
+ branch->SetAddress(&dataArray);
+ branch->GetEntry(iDet);
+ }
+
+ }
+
+ return status;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::LoadDigitsParam()
+{
+ //
+ // Loads the digits parameter object from the digits tree
+ //
+
+ if (!fTree)
+ {
+ AliError("Digits tree is not defined\n");
+ return kFALSE;
+ }
+
+ // Get the branch
+ TBranch *branch = fTree->GetBranch("TRDdigitsParam");
+ if (!branch)
+ {
+ AliError("Branch TRDdigitsParam is not defined\n");
+ return kFALSE;
+ }
+
+ // Read the parameter object
+ AliTRDdigitsParam *digitsParam = fDigitsParam;
+ if (!digitsParam)
+ {
+ return kFALSE;
+ }
+
+ branch->SetAddress(&digitsParam);
+ branch->GetEntry();
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::StoreArrayDigits()
+{
+ //
+ // Stores the digit arrays for all detectors
+ //
+
+ if (!fTree)
+ {
+ AliError("Digits tree is not defined\n");
+ return kFALSE;
+ }
+
+ // Get the branch
+ TBranch *branch = fTree->GetBranch("TRDdigits");
+ if (!branch)
+ {
+ AliError("Branch TRDdigits is not defined\n");
+ return kFALSE;
+ }
+
+ // Loop through all detectors and fill them into the tree
+ Bool_t status = kTRUE;
+ for (Int_t iDet = 0; iDet < fDets; iDet++)
+ {
+ if (fHasSDigits)
+ {
+ const AliTRDarraySignal *kDataArray = (AliTRDarraySignal *) fDigits->At(iDet);
+ if (!kDataArray)
+ {
+ status = kFALSE;
+ break;
+ }
+ branch->SetAddress(&kDataArray);
+ branch->Fill();
+ }
+ else
+ {
+ const AliTRDarrayADC *kDataArray = (AliTRDarrayADC *) fDigits->At(iDet);
+ if (!kDataArray)
+ {
+ status = kFALSE;
+ break;
+ }
+ branch->SetAddress(&kDataArray);
+ branch->Fill();
+ }
+ }
+
+ return status;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::StoreArrayDict()
+{
+ //
+ // Stores the dictionary arrays for all detectors
+ //
+
+ if (!fTree)
+ {
+ AliError("Digits tree is not defined\n");
+ return kFALSE;
+ }
+
+ Bool_t status = kTRUE;
+
+ for (Int_t iDict = 0; iDict < kNDict; iDict++)
+ {
+
+ // Get the branch
+ Char_t branchname[15];
+ snprintf(branchname,15,"TRDdictionary%d",iDict);
+ TBranch *branch = fTree->GetBranch(branchname);
+ if (!branch)
+ {
+ AliError(Form("Branch %s is not defined\n",branchname));
+ return kFALSE;
+ }
+
+ // Loop through all detectors and fill them into the tree
+ for (Int_t iDet = 0; iDet < fDets; iDet++)
+ {
+ const AliTRDarrayDictionary *kDataArray = (AliTRDarrayDictionary *) fDict[iDict]->At(iDet);
+ if (!kDataArray)
+ {
+ status = kFALSE;
+ break;
+ }
+ branch->SetAddress(&kDataArray);
+ branch->Fill();
+ }
+
+ }
+
+ return status;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::StoreDigitsParam()
+{
+ //
+ // Stores the digits parameter object from the digits tree
+ //
+
+ if (!fTree)
+ {
+ AliError("Digits tree is not defined\n");
+ return kFALSE;
+ }
+
+ // Get the branch
+ TBranch *branch = fTree->GetBranch("TRDdigitsParam");
+ if (!branch)
+ {
+ AliError("Branch TRDdigitsParam is not defined\n");
+ return kFALSE;
+ }
+
+ // Fill the digits object in the tree
+ const AliTRDdigitsParam *kDigitsParam = fDigitsParam;
+ if (!kDigitsParam)
+ {
+ return kFALSE;
+ }
+ branch->SetAddress(&kDigitsParam);
+ branch->Fill();
+
+ return kTRUE;
+
+}
+