Initialization of SDigits and Digits trees
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Dec 2003 12:51:23 +0000 (12:51 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Dec 2003 12:51:23 +0000 (12:51 +0000)
TRD/AliTRDdigitizer.cxx

index 7dbc3ad..bc0f6c2 100644 (file)
@@ -318,8 +318,34 @@ void AliTRDdigitizer::Exec(Option_t* option)
   }
 
   // Initialization
-  InitDetector();
 
+  AliRunLoader* orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
+  if (InitDetector()) {
+    AliLoader* ogime = orl->GetLoader("TRDLoader");
+
+    TTree* tree = 0;
+    if (fSDigits)
+      { 
+       //if we produce SDigits
+       tree = ogime->TreeS();
+       if (!tree)
+         {
+           ogime->MakeTree("S");
+           tree = ogime->TreeS();
+         }
+      }
+    else
+      {//if we produce Digits
+       tree = ogime->TreeD();
+       if (!tree)
+         {
+           ogime->MakeTree("D");
+           tree = ogime->TreeD();
+         }
+      }
+    MakeBranch(tree);
+  }
   for (iInput = 0; iInput < nInput; iInput++) {
 
     if (fDebug > 0) {
@@ -376,13 +402,12 @@ void AliTRDdigitizer::Exec(Option_t* option)
     printf("Write the digits\n");
   }
   
-  AliRunLoader* orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
-  AliLoader* ogime = orl->GetLoader("TRDLoader");
-
-  fDigitsManager->MakeBranch(ogime->TreeD());
-
   fDigitsManager->WriteDigits();
 
+  //Write parameters
+  orl->CdGAFile();
+  GetParameter()->Write();
+
   if (fDebug > 0) {
     printf("<AliTRDdigitizer::Exec> ");
     printf("Done\n");