Change global directory to original (Marian)
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 12 Apr 2007 13:17:27 +0000 (13:17 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 12 Apr 2007 13:17:27 +0000 (13:17 +0000)
STEER/TTreeStream.cxx

index 3c8e916..445f1fb 100644 (file)
@@ -189,12 +189,14 @@ TTreeStream  & TTreeSRedirector::operator<<(Int_t id)
     }
   }
   if (!clayout){
+    TDirectory * backup = gDirectory;
     fFile->cd();
     char chname[100];
     sprintf(chname,"Tree%d",id);
     clayout = new TTreeStream(chname);
     clayout->fId=id;
     fDataLayouts->AddAt(clayout,entries);
+    if (backup) backup->cd();
   }
   return *clayout;
 }
@@ -210,11 +212,13 @@ TTreeStream  & TTreeSRedirector::operator<<(const char* name)
   Int_t entries = fDataLayouts->GetEntriesFast();
 
   if (!clayout){
+    TDirectory * backup = gDirectory;
     fFile->cd();
     clayout = new TTreeStream(name);
     clayout->fId=-1;
     clayout->SetName(name);
     fDataLayouts->AddAt(clayout,entries);    
+    if (backup) backup->cd();
   }
   return *clayout;
 }