+ // Returns the amplitude of a digit
+ //
+
+ return ((Short_t) GetDigits(det)->GetData(row,col,time));
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::Open(const Char_t *file)
+{
+ //
+ // Opens the file for the TRD digits
+ //
+
+ fFile = (TFile*) gROOT->GetListOfFiles()->FindObject(file);
+ if (!fFile) {
+ if (fDebug > 0) {
+ printf("<AliTRDdigitsManager::Open> ");
+ printf("Open the AliROOT-file %s.\n",file);
+ }
+ fFile = new TFile(file,"UPDATE");
+ fFileCreated = kTRUE;
+ if (!fFile) return kFALSE;
+ }
+ else {
+ if (fDebug > 0) {
+ printf("<AliTRDdigitsManager::Open> ");
+ printf("%s is already open.\n",file);
+ }
+ }
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdigitsManager::MakeTreeAndBranches(TFile *file, Int_t iEvent)
+{
+ //
+ // Creates tree for (s)digits in the specified file
+ //
+
+ fEvent = iEvent;
+ TDirectory *wd = gDirectory;
+ file->cd();
+ MakeBranch();
+ wd->cd();
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::MakeBranch(const Char_t *file)
+{
+ //
+ // Creates the tree and branches for the digits and the dictionary
+ //
+
+ // Create the TRD digits tree
+ TTree *tree;
+ Char_t treeName[12];
+ if (fSDigits) {
+ sprintf(treeName,"TreeS%d_TRD",fEvent);
+ tree = new TTree(treeName,"TRD SDigits");
+ }
+ else {
+ sprintf(treeName,"TreeD%d_TRD",fEvent);
+ tree = new TTree(treeName,"TRD Digits");
+ }
+
+ if (fDebug > 0) {
+ printf("<AliTRDdigitsManager::MakeBranch> ");
+ printf("Creating tree %s\n",treeName);
+ }
+
+ return MakeBranch(tree,file);
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::MakeBranch(TTree *tree, const Char_t *file)
+{
+ //
+ // Creates the tree and branches for the digits and the dictionary