]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Writing down the TREE headers before job starts
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 20 Jun 2000 13:05:45 +0000 (13:05 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 20 Jun 2000 13:05:45 +0000 (13:05 +0000)
STEER/AliRun.cxx

index 12f3f696a328554a2bf983014c8a91b940febb24..3f853fca47f5f8b19954766c8c6603ecec9262b7 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
 
 /*
 $Log$
+Revision 1.37  2000/06/09 20:05:11  morsch
+Introduce possibility to chose magnetic field version 3: AliMagFDM + field02.dat
+
 Revision 1.36  2000/06/08 14:03:58  hristov
 Only one initializer for a default argument
 
 Revision 1.36  2000/06/08 14:03:58  hristov
 Only one initializer for a default argument
 
@@ -497,13 +500,13 @@ void AliRun::FinishEvent()
   //  Int_t ievent = fHeader.GetEvent();
   //  char hname[30];
   //  sprintf(hname,"TreeK%d",ievent);
   //  Int_t ievent = fHeader.GetEvent();
   //  char hname[30];
   //  sprintf(hname,"TreeK%d",ievent);
-  if (fTreeK) fTreeK->Write();
+  if (fTreeK) fTreeK->Write(0,TObject::kOverwrite);
   //  sprintf(hname,"TreeH%d",ievent);
   //  sprintf(hname,"TreeH%d",ievent);
-  if (fTreeH) fTreeH->Write();
+  if (fTreeH) fTreeH->Write(0,TObject::kOverwrite);
   //  sprintf(hname,"TreeD%d",ievent);
   //  sprintf(hname,"TreeD%d",ievent);
-  if (fTreeD) fTreeD->Write();
+  if (fTreeD) fTreeD->Write(0,TObject::kOverwrite);
   //  sprintf(hname,"TreeR%d",ievent);
   //  sprintf(hname,"TreeR%d",ievent);
-  if (fTreeR) fTreeR->Write();
+  if (fTreeR) fTreeR->Write(0,TObject::kOverwrite);
 
   ++fEvent;
 }
 
   ++fEvent;
 }
@@ -539,7 +542,7 @@ void AliRun::FinishRun()
     exit(1);
   }
   File->cd();
     exit(1);
   }
   File->cd();
-  fTreeE->Write();
+  fTreeE->Write(0,TObject::kOverwrite);
   
   // Clean tree information
   if (fTreeK) {
   
   // Clean tree information
   if (fTreeK) {
@@ -851,6 +854,11 @@ void AliRun::InitMC(const char *setup)
   // Initialize the Alice setup
   //
 
   // Initialize the Alice setup
   //
 
+  if(fInitDone) {
+    Warning("Init","Cannot initialise AliRun twice!\n");
+    return;
+  }
+
   gROOT->LoadMacro(setup);
   gInterpreter->ProcessLine(fConfigFunction.Data());
 
   gROOT->LoadMacro(setup);
   gInterpreter->ProcessLine(fConfigFunction.Data());
 
@@ -894,6 +902,10 @@ void AliRun::InitMC(const char *setup)
    fGeometry->Write();
    
    fInitDone = kTRUE;
    fGeometry->Write();
    
    fInitDone = kTRUE;
+
+   //
+   // Save stuff at the beginning of the file to avoid file corruption
+   Write();
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
@@ -1106,24 +1118,29 @@ void AliRun::MakeTree(Option_t *option)
     fTreeK = new TTree(hname,"Kinematics");
     //  Create a branch for particles
     fTreeK->Branch("Particles",&fParticles,4000);
     fTreeK = new TTree(hname,"Kinematics");
     //  Create a branch for particles
     fTreeK->Branch("Particles",&fParticles,4000);
+    fTreeK->Write();
   }
   if (H && !fTreeH) {
     sprintf(hname,"TreeH%d",fEvent);
     fTreeH = new TTree(hname,"Hits");
     fTreeH->SetAutoSave(1000000000); //no autosave
   }
   if (H && !fTreeH) {
     sprintf(hname,"TreeH%d",fEvent);
     fTreeH = new TTree(hname,"Hits");
     fTreeH->SetAutoSave(1000000000); //no autosave
+    fTreeH->Write();
   }
   if (D && !fTreeD) {
     sprintf(hname,"TreeD%d",fEvent);
     fTreeD = new TTree(hname,"Digits");
   }
   if (D && !fTreeD) {
     sprintf(hname,"TreeD%d",fEvent);
     fTreeD = new TTree(hname,"Digits");
+    fTreeD->Write();
   }
   if (R && !fTreeR) {
     sprintf(hname,"TreeR%d",fEvent);
     fTreeR = new TTree(hname,"Reconstruction");
   }
   if (R && !fTreeR) {
     sprintf(hname,"TreeR%d",fEvent);
     fTreeR = new TTree(hname,"Reconstruction");
+    fTreeR->Write();
   }
   if (E && !fTreeE) {
     fTreeE = new TTree("TE","Header");
     //  Create a branch for Header
     fTreeE->Branch("Header","AliHeader",&header,4000);
   }
   if (E && !fTreeE) {
     fTreeE = new TTree("TE","Header");
     //  Create a branch for Header
     fTreeE->Branch("Header","AliHeader",&header,4000);
+    fTreeE->Write();
   }
   //
   // Create a branch for hits/digits for each detector
   }
   //
   // Create a branch for hits/digits for each detector