Improved the mechanism to divert SDigits into a separate file.
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 May 2002 14:44:13 +0000 (14:44 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 May 2002 14:44:13 +0000 (14:44 +0000)
PHOS/AliPHOSDigitizer.cxx

index 5b7f42ffb1820074608cfb2575f8431ba3a71f4a..0ac1e94b6e1093041d959799730f26da8f136cb1 100644 (file)
@@ -606,7 +606,8 @@ void AliPHOSDigitizer::SetSplitFile(const TString splitFileName) const
   TDirectory * cwd = gDirectory ;
   TFile * splitFile = gAlice->InitTreeFile("D",splitFileName.Data());
   splitFile->cd() ; 
-  gAlice->Write();
+  if ( !splitFile->Get("gAlice") ) 
+    gAlice->Write();
   
   TTree *treeE  = gAlice->TreeE();
   if (!treeE) {
@@ -615,19 +616,24 @@ void AliPHOSDigitizer::SetSplitFile(const TString splitFileName) const
   }      
   
   // copy TreeE
-  AliHeader *header = new AliHeader();
-  treeE->SetBranchAddress("Header", &header);
-  treeE->SetBranchStatus("*",1);
-  TTree *treeENew =  treeE->CloneTree();
-  treeENew->Write();
-  
+  if ( !splitFile->Get("TreeE") ) {
+    AliHeader *header = new AliHeader();
+    treeE->SetBranchAddress("Header", &header);
+    treeE->SetBranchStatus("*",1);
+    TTree *treeENew =  treeE->CloneTree();
+    treeENew->Write();
+  }
+
   // copy AliceGeom
-  TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
-  if (!AliceGeom) {
-    cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
-    abort() ;
+  if ( !splitFile->Get("AliceGeom") ) {
+    TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
+    if (!AliceGeom) {
+      cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
+      abort() ;
+    }
+    AliceGeom->Write();
   }
-  AliceGeom->Write();
+  
   cwd->cd() ; 
   gAlice->MakeTree("D",splitFile);
   cout << "INFO: AliPHOSDigitizer::SetSPlitMode -> Digits will be stored in " << splitFileName.Data() << endl ;