Allow reading of multiple events in AliRun, correct the I/O of the header
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Jul 1999 18:11:31 +0000 (18:11 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Jul 1999 18:11:31 +0000 (18:11 +0000)
STEER/AliRun.cxx
STEER/AliRun.h
macros/loadlibs.C

index ce0730a..228df7a 100644 (file)
@@ -421,16 +421,16 @@ void AliRun::FinishEvent()
   ResetStack();
   
   // Write Tree headers
-  Int_t ievent = fHeader.GetEvent();
-  char hname[30];
-  sprintf(hname,"TreeK%d",ievent);
-  if (fTreeK) fTreeK->Write(hname);
-  sprintf(hname,"TreeH%d",ievent);
-  if (fTreeH) fTreeH->Write(hname);
-  sprintf(hname,"TreeD%d",ievent);
-  if (fTreeD) fTreeD->Write(hname);
-  sprintf(hname,"TreeR%d",ievent);
-  if (fTreeR) fTreeR->Write(hname);
+  //  Int_t ievent = fHeader.GetEvent();
+  //  char hname[30];
+  //  sprintf(hname,"TreeK%d",ievent);
+  if (fTreeK) fTreeK->Write();
+  //  sprintf(hname,"TreeH%d",ievent);
+  if (fTreeH) fTreeH->Write();
+  //  sprintf(hname,"TreeD%d",ievent);
+  if (fTreeD) fTreeD->Write();
+  //  sprintf(hname,"TreeR%d",ievent);
+  if (fTreeR) fTreeR->Write();
 }
 
 //_____________________________________________________________________________
@@ -605,7 +605,6 @@ Int_t AliRun::GetEvent(Int_t event)
   // Connect the Trees Kinematics and Hits for event # event
   // Set branch addresses
   //
-  fHeader.SetEvent(event);
 
   // Reset existing structures
   ResetStack();
@@ -617,6 +616,10 @@ Int_t AliRun::GetEvent(Int_t event)
   if (fTreeH) delete fTreeH;
   if (fTreeD) delete fTreeD;
   if (fTreeR) delete fTreeR;
+
+  // Get header from file
+  if(fTreeE) fTreeE->GetEntry(event);
+  else Error("GetEvent","Cannot file Header Tree\n");
   
   // Get Kine Tree from file
   char treeName[20];
@@ -1007,11 +1010,11 @@ void AliRun::MakeTree(Option_t *option)
   char *D = strstr(option,"D");
   char *R = strstr(option,"R");
   //
-  if (K && !fTreeK) fTreeK = new TTree("TK","Kinematics");
-  if (H && !fTreeH) fTreeH = new TTree("TH","Hits");
-  if (D && !fTreeD) fTreeD = new TTree("TD","Digits");
+  if (K && !fTreeK) fTreeK = new TTree("TreeK0","Kinematics");
+  if (H && !fTreeH) fTreeH = new TTree("TreeH0","Hits");
+  if (D && !fTreeD) fTreeD = new TTree("TreeD0","Digits");
   if (E && !fTreeE) fTreeE = new TTree("TE","Header");
-  if (R && !fTreeR) fTreeR = new TTree("TR","Reconstruction");
+  if (R && !fTreeR) fTreeR = new TTree("TreeR0","Reconstruction");
   if (fTreeH) fTreeH->SetAutoSave(1000000000); //no autosave
   //
   // Create a branch for hits/digits for each detector
@@ -1128,6 +1131,8 @@ void AliRun::Reset(Int_t run, Int_t idevent)
   //
   //  Reset all Detectors & kinematics & trees
   //
+  char hname[30];
+  //
   ResetStack();
   ResetHits();
   ResetDigits();
@@ -1135,10 +1140,26 @@ void AliRun::Reset(Int_t run, Int_t idevent)
   // Initialise event header
   fHeader.Reset(run,idevent);
 
-  if(fTreeK) fTreeK->Reset();
-  if(fTreeH) fTreeH->Reset();
-  if(fTreeD) fTreeD->Reset();
-  if(fTreeR) fTreeR->Reset();
+  if(fTreeK) {
+    fTreeK->Reset();
+    sprintf(hname,"TreeK%d",idevent);
+    fTreeK->SetName(hname);
+  }
+  if(fTreeH) {
+    fTreeH->Reset();
+    sprintf(hname,"TreeH%d",idevent);
+    fTreeH->SetName(hname);
+  }
+  if(fTreeD) {
+    fTreeD->Reset();
+    sprintf(hname,"TreeD%d",idevent);
+    fTreeD->SetName(hname);
+  }
+  if(fTreeR) {
+    fTreeR->Reset();
+    sprintf(hname,"TreeR%d",idevent);
+    fTreeR->SetName(hname);
+  }
 }
 
 //_____________________________________________________________________________
@@ -1626,6 +1647,9 @@ void AliRun::Streamer(TBuffer &R__b)
     TNamed::Streamer(R__b);
     if (!gAlice) gAlice = this;
     gROOT->GetListOfBrowsables()->Add(this,"Run");
+    fTreeE = (TTree*)gDirectory->Get("TE");
+    if (fTreeE) fTreeE->SetBranchAddress("Header", &header);
+    else    Error("Streamer","cannot find Header Tree\n");
     R__b >> fNtrack;
     R__b >> fHgwmk;
     R__b >> fDebug;
@@ -1638,7 +1662,13 @@ void AliRun::Streamer(TBuffer &R__b)
     R__b >> fTrRmax;
     R__b >> fTrZmax;
     R__b >> fGenerator;
-    R__b >> fPDGDB;        //Particle factory object!
+    if(R__v>1) {
+      R__b >> fPDGDB;        //Particle factory object!
+      fTreeE->GetEntry(0);
+    } else {
+      fHeader.SetEvent(0);
+      fPDGDB     = TDatabasePDG::Instance();        //Particle factory object!
+    }
   } else {
     R__b.WriteVersion(AliRun::IsA());
     TNamed::Streamer(R__b);
index 521a221..1a12c95 100644 (file)
@@ -139,7 +139,7 @@ public:
 
   // --------------------------- commons -------------------------------------
 
-   ClassDef(AliRun,1)      //Supervisor class for all Alice detectors
+   ClassDef(AliRun,2)      //Supervisor class for all Alice detectors
 };
  
 EXTERN  AliRun *gAlice;
index 419f58b..f066624 100644 (file)
@@ -1,22 +1,22 @@
 void loadlibs () 
 {
   gSystem->Load("$(ROOTSYS)/lib/libEG");
-  gSystem->Load("$(ALICE_ROOT)/lib/libSTEER");
-  gSystem->Load("$(ALICE_ROOT)/lib/libTGeant3Dummy");
-  gSystem->Load("$(ALICE_ROOT)/lib/libdummypythia");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libSTEER");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libTGeant3Dummy");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libdummypythia");
   gSystem->Load("$(ROOTSYS)/lib/libEGPythia");
-  gSystem->Load("$(ALICE_ROOT)/lib/libEVGEN");
-  gSystem->Load("$(ALICE_ROOT)/lib/libFMD");
-  gSystem->Load("$(ALICE_ROOT)/lib/libMUON");
-  gSystem->Load("$(ALICE_ROOT)/lib/libPHOSdummy");
-  gSystem->Load("$(ALICE_ROOT)/lib/libPHOS");
-  gSystem->Load("$(ALICE_ROOT)/lib/libPMD");
-  gSystem->Load("$(ALICE_ROOT)/lib/libRICH");
-  gSystem->Load("$(ALICE_ROOT)/lib/libSTRUCT");
-  gSystem->Load("$(ALICE_ROOT)/lib/libTOF");
-  gSystem->Load("$(ALICE_ROOT)/lib/libTPC");
-  gSystem->Load("$(ALICE_ROOT)/lib/libTRD");
-  gSystem->Load("$(ALICE_ROOT)/lib/libZDC");
-  gSystem->Load("$(ALICE_ROOT)/lib/libITS");
-  gSystem->Load("$(ALICE_ROOT)/lib/libCASTOR");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libEVGEN");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libFMD");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libMUON");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libPHOSdummy");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libPHOS");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libPMD");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libRICH");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libSTRUCT");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libTOF");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libTPC");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libTRD");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libZDC");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libITS");
+  gSystem->Load("$(ALICE_ROOT)/lib/$(ALICE_TARGET)/libCASTOR");
 }