]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added CloseFile that deletes gAlice which in turn closes all the files
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 13 Jun 2002 15:29:34 +0000 (15:29 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 13 Jun 2002 15:29:34 +0000 (15:29 +0000)
Give the right name to the task posted on the folders
Remove retieval for tasks from the file because of a problem in SetAdress I could not solve
Complete the removal of objects posted on the folders

EMCAL/AliEMCALGetter.cxx
PHOS/AliPHOSGetter.cxx

index efcccb5bc5aae28fa5b242653f31a81ad33b4b07..0b0ea662c735ce331ef8523aeecf16c9016ab5ad 100644 (file)
@@ -161,7 +161,6 @@ AliEMCALGetter::~AliEMCALGetter()
   while ( (folder = static_cast<TFolder*>(next())) ) 
     emcalF->Remove(folder) ; 
 
-  fFile->Close() ;  
   delete fFile ; 
   fFile = 0 ;
 
@@ -178,9 +177,8 @@ void AliEMCALGetter::CreateWhiteBoard() const
 //____________________________________________________________________________ 
 void AliEMCALGetter::CloseFile()
 {
-//   delete gAlice ; 
-//   gAlice = 0 ; 
-  fFile->Close() ; 
+  delete gAlice ; 
+  gAlice = 0 ; 
 }
 
 //____________________________________________________________________________ 
@@ -188,14 +186,14 @@ AliEMCALGetter * AliEMCALGetter::GetInstance()
 {
   // Returns the pointer of the unique instance already defined
   
-  AliEMCALGetter * rv = 0 ;
-  if ( fgObjGetter )
-    rv = fgObjGetter ;
-  else
-    cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
-  
-  fFile->cd() ; 
-  return rv ;
+  if ( fgObjGetter ) {
+    fFile->cd() ; 
+    return fgObjGetter ;
+  }
+  else {
+    // cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
+    return 0 ;
+  }
 }
 
 //____________________________________________________________________________ 
@@ -790,10 +788,18 @@ Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
     tasks->Add(emcal) ; 
   } 
 
-  AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
+  TList * l = emcal->GetListOfTasks() ;   
+  TIter it(l) ;
   TString clun(name) ;
-  clun+=":clu-v1" ;
-  emcalcl->SetName(clun) ;
+  clun+=":clu" ; 
+  TTask * task ;
+  while((task = static_cast<TTask *>(it.Next()) )){
+    TString taskname(task->GetName()) ;
+    if(taskname.BeginsWith(clun))
+      return kTRUE ;
+  }
+
+  AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
   emcal->Add(emcalcl) ;
   return kTRUE; 
   
@@ -1244,8 +1250,10 @@ void AliEMCALGetter::ReadTreeD()
   // read  the Digitizer
   if(!Digitizer(fDigitsTitle))
     PostDigitizer(fDigitsTitle) ;
-  digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
-  digitizerbranch->GetEntry(0) ;
+
+  //!!!!!!!!!!!!!!!!!!!!!!!!!! Weird problem, the following line causes a seg fault
+  // digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
+  // digitizerbranch->GetEntry(0) ;
  
   
 }
@@ -1413,8 +1421,9 @@ void AliEMCALGetter::ReadTreeR()
   
   if(!Clusterizer(fRecPointsTitle) )
     PostClusterizer(fRecPointsTitle) ;
-  clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
-  clusterizerbranch->GetEntry(0) ;
+  //!!!!!!!!!!!!!!!!!!!!!!!!!! Weird problem, the following line causes a seg fault
+  //clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
+  //clusterizerbranch->GetEntry(0) ;
  
   
   //------------------- TrackSegments ---------------------
@@ -1451,8 +1460,9 @@ void AliEMCALGetter::ReadTreeR()
 //   // Read and Post the TrackSegment Maker
 //   if(!TrackSegmentMaker(fTrackSegmentsTitle))
 //     PostTrackSegmentMaker(fTrackSegmentsTitle) ;
-//   tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
-//   tsmakerbranch->GetEntry(0) ;
+     //!!!!!!!!!!!!!!!!!!!!!!!!!! Weird problem, the following line causes a seg fault
+//   //tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
+//   //tsmakerbranch->GetEntry(0) ;
   
   
 //   //------------ RecParticles ----------------------------
@@ -1489,8 +1499,9 @@ void AliEMCALGetter::ReadTreeR()
 //   // Read and Post the PID
 //   if(!PID(fRecParticlesTitle))
 //     PostPID(fRecParticlesTitle) ;
-//   pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
-//   pidbranch->GetEntry(0) ;
+      //!!!!!!!!!!!!!!!!!!!!!!!!!! Weird problem, the following line causes a seg fault
+//   //pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
+//   //pidbranch->GetEntry(0) ;
   
   
 }
@@ -1574,8 +1585,10 @@ void AliEMCALGetter::ReadTreeS(Int_t event)
     sdname+=folder->GetName() ;
     if(!SDigitizer(sdname) ) 
       PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
-    sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
-    sdigitizerBranch->GetEntry(0) ;
+
+    //!!!!!!!!!!!!!!!!!!!!!!!!!! Weird problem, the following line causes a seg fault
+    // sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
+    // sdigitizerBranch->GetEntry(0) ;
     
   }    
   
@@ -1924,22 +1937,27 @@ void AliEMCALGetter::RemoveTask(TString opt, TString name) const
   TTask * emcal = 0 ; 
   TList * lofTasks = 0 ; 
 
-  if (opt == "S") {
+  if (opt == "S") { // SDigitizer
     task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
     if (!task) 
       return ; 
   }
   
-  else if (opt == "D") {
+  else if (opt == "D") { // Digitizer
     task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
     if (!task) 
       return ; 
   }
+  else if (opt == "C") { // Clusterizer
+    task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
+    if (!task) 
+      return ; 
+  }
   else {
-    cerr << "WARNING: AliPHOSGetter::RemoveTask -> Unknown option " << opt.Data() << endl ; 
+    cerr << "WARNING: AliEMCALGetter::RemoveTask -> Unknown option " << opt.Data() << endl ; 
     return ; 
   }
-  
+    
   emcal =  dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
   if (!emcal)
     return ; 
@@ -1950,7 +1968,7 @@ void AliEMCALGetter::RemoveTask(TString opt, TString name) const
   if (obj) 
     lofTasks->Remove(obj) ;
 }
-
+  
 //____________________________________________________________________________ 
 void AliEMCALGetter::RemoveObjects(TString opt, TString name) const 
 {
@@ -1960,14 +1978,14 @@ void AliEMCALGetter::RemoveObjects(TString opt, TString name) const
   TFolder * emcal     = 0 ; 
   TFolder * emcalmain = 0 ; 
 
-  if (opt == "H") {
+  if (opt == "H") { // Hits
     emcal = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
     if (!emcal) 
       return ;
     name = "Hits" ; 
   }
   
-  else if ( opt == "S") {
+  else if ( opt == "S") { // SDigits
     emcalmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
     if (!emcalmain) 
       return ;
@@ -1976,11 +1994,24 @@ void AliEMCALGetter::RemoveObjects(TString opt, TString name) const
       return ;
   }
 
-  else if (opt == "D") {
+  else if (opt == "D") { // Digits
     emcal = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
     if (!emcal) 
       return ;
   }
+
+  else if (opt == "RT") { // Tower RecPoints
+    emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
+    if (!emcal) 
+      return ;
+  }
+
+  else if (opt == "RP") { // Preshower RecPoints
+    emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
+    if (!emcal) 
+      return ;
+  }
+
   else {
     cerr << "WARNING: AliEMCALGetter::RemoveObjects -> Unknown option " << opt.Data() << endl ; 
     return ; 
index 154589d8f4da9ee3dd935e3a66d959e59dd47feb..5bec04e21bf9f0ee8ffbe6456e0f270552741dd7 100644 (file)
@@ -37,8 +37,7 @@
 //     ................
 //  please->GetEvent(event) ;    // reads new event from galice.root
 //                  
-//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
-//*--         Completely redesigned by Dmitri Peressounko March 2001  
+//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)//*--         Completely redesigned by Dmitri Peressounko March 2001  
 //
 //*-- YS June 2001 : renamed the original AliPHOSIndexToObject and make
 //*--         systematic usage of TFolders without changing the interface        
@@ -46,7 +45,6 @@
 
 
 // --- ROOT system ---
-
 #include "TFile.h"
 #include "TTree.h"
 #include "TROOT.h"
@@ -169,9 +167,8 @@ AliPHOSGetter::~AliPHOSGetter(){
 //____________________________________________________________________________ 
 void AliPHOSGetter::CloseFile()
 {
-//   delete gAlice ; 
-//   gAlice = 0 ; 
-  fFile->Close() ; 
+  delete gAlice ;  
+  gAlice = 0 ; 
 }
 
 //____________________________________________________________________________ 
@@ -179,14 +176,14 @@ AliPHOSGetter * AliPHOSGetter::GetInstance()
 {
   // Returns the pointer of the unique instance already defined
   
-  AliPHOSGetter * rv = 0 ;
-  if ( fgObjGetter )
-    rv = fgObjGetter ;
-  else
-    cout << "AliPHOSGetter::GetInstance ERROR: not yet initialized" << endl ;
-
-  fFile->cd() ;  
-  return rv ;
+  if ( fgObjGetter ) {
+    fFile->cd() ; 
+    return fgObjGetter ;
+  }
+  else {
+    //cout << "WARNING: AliPHOSGetter::GetInstance ERROR: not yet initialized" << endl ;
+    return 0 ; 
+  }
 }
 
 //____________________________________________________________________________ 
@@ -204,7 +201,7 @@ AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile,
     }
     else // another file than the existing one is required, scratch the getter
       fgObjGetter->~AliPHOSGetter() ;  // delete it already exists another version
+  
   fgObjGetter = new AliPHOSGetter(headerFile,branchTitle) ; 
 
   if (fgObjGetter->HasFailed() ) 
@@ -213,7 +210,8 @@ AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile,
   // Posts a few item to the white board (folders)
   // fgObjGetter->CreateWhiteBoard() ;
   
-  fFile->cd() ; 
+  if (fFile) 
+    fFile->cd() ; 
   return fgObjGetter ; 
   
 }
@@ -705,6 +703,12 @@ TObject** AliPHOSGetter::DigitizerRef(const char * name) const
 
   TTask * task = dynamic_cast<TTask*>(phos->GetListOfTasks()->FindObject(name)) ; 
 
+  cout << "AliPHOSGetter::DigitizerRef " << task->GetName() << endl ; 
+  cout << "AliPHOSGetter::DigitizerRef " << phos->GetName() << endl ; 
+  cout << "AliPHOSGetter::DigitizerRef " << task->GetListOfTasks() << endl ; 
+  cout << "AliPHOSGetter::DigitizerRef " << task->GetListOfTasks()->GetObjectRef(task) << endl ; 
+
+
   return phos->GetListOfTasks()->GetObjectRef(task) ;
 
 }
@@ -831,7 +835,7 @@ Bool_t AliPHOSGetter::PostClusterizer(AliPHOSClusterizer * clu) const
   TTask * phos = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("PHOS")) ; 
   if ( !phos )  {
     if (fDebug) {
-      cout <<"WARNING: AliPHOSGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerPHOS not found!" << endl; 
+      cout <<"WARNING: AliPHOSGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/PHOS not found!" << endl; 
       cout <<"INFO: AliPHOSGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/PHOS" << endl; 
     }
     phos = new TTask("PHOS", "") ; 
@@ -923,7 +927,6 @@ Bool_t AliPHOSGetter::PostClusterizer(const char * name) const
   }
 
   AliPHOSClusterizerv1 * phoscl = new AliPHOSClusterizerv1() ;
-  phoscl->SetName(clun) ;
   phos->Add(phoscl) ;
   return kTRUE; 
   
@@ -1048,7 +1051,6 @@ Bool_t AliPHOSGetter::PostTrackSegmentMaker(const char * name) const
   TList * l = phos->GetListOfTasks() ;   
   TIter it(l) ;
   TString tsn(name);
-  tsn+=":tsm" ; 
   TTask * task ;
   while((task = static_cast<TTask *>(it.Next()) )){
     TString taskname(task->GetName()) ;
@@ -1107,7 +1109,7 @@ TObject** AliPHOSGetter::TSMakerRef(const char * name) const
 Bool_t AliPHOSGetter::PostRecParticles(const char * name) const 
 {  // -------------------- RecParticles ------------------------
   
-  // the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name
+  // the hierarchy is //Folders/Run/Event/RecData/PHOS/RecParticles/name
 
   TFolder * phosFolder  = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS")) ; 
   
@@ -1220,7 +1222,6 @@ Bool_t AliPHOSGetter::PostPID(const char * name) const
   TList * l = phos->GetListOfTasks() ;   
   TIter it(l) ;
   TString pidname(name) ;
-  pidname+=":pidv1" ; 
   TTask * task ;
   while((task = static_cast<TTask *>(it.Next()) )){
     TString taskname(task->GetName()) ;
@@ -1404,8 +1405,9 @@ Int_t AliPHOSGetter::ReadTreeD()
   // read  the Digitizer
   if(!Digitizer(fDigitsTitle))
     PostDigitizer(fDigitsTitle) ;
-  digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
-  digitizerbranch->GetEntry(0) ;
+    //!!!!!!!!!!!!!!!!!!!!!!!!!! Weird problem, the following line causes a seg fault
+  // digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
+  // digitizerbranch->GetEntry(0) ;
  
   return 0 ; 
 }
@@ -1583,8 +1585,9 @@ Int_t AliPHOSGetter::ReadTreeR(Bool_t any)
   }  else { 
     if(!Clusterizer(fRecPointsTitle) )
       PostClusterizer(fRecPointsTitle) ;
-    clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
-    clusterizerbranch->GetEntry(0) ;
+    //!!!!!!!!!!!!!!!!!!!!!!!!!! Weird problem, the following line causes a seg fault
+    //clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
+    //clusterizerbranch->GetEntry(0) ;
   }
   
   //------------------- TrackSegments ---------------------
@@ -1618,8 +1621,9 @@ Int_t AliPHOSGetter::ReadTreeR(Bool_t any)
     // Read and Post the TrackSegment Maker
     if(!TrackSegmentMaker(fTrackSegmentsTitle))
       PostTrackSegmentMaker(fTrackSegmentsTitle) ;
-    tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
-    tsmakerbranch->GetEntry(0) ;
+    //!!!!!!!!!!!!!!!!!!!!!!!!!! Weird problem, the following line causes a seg fault
+    //tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
+    //tsmakerbranch->GetEntry(0) ;
  }
   
   
@@ -1654,8 +1658,9 @@ Int_t AliPHOSGetter::ReadTreeR(Bool_t any)
     // Read and Post the PID
     if(!PID(fRecParticlesTitle))
       PostPID(fRecParticlesTitle) ;
-    pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
-    pidbranch->GetEntry(0) ;
+    //!!!!!!!!!!!!!!!!!!!!!!!!!! Weird problem, the following line causes a seg fault
+    //pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
+    //pidbranch->GetEntry(0) ;
   }
   return 0 ; 
 }
@@ -1687,7 +1692,6 @@ Int_t AliPHOSGetter::ReadTreeS(Int_t event)
   while ( (folder = static_cast<TFolder*>(next())) ) {
     TString fileName(folder->GetName()) ; 
     fileName.ReplaceAll("_","/") ; 
-    cout << "ALiPHOSGetter::ReadTreeS " << fileName.Data() << " " << fHeaderFile.Data() << endl ; 
     if(fHeaderFile.CompareTo(fileName) == 0 ) 
       treeS=gAlice->TreeS() ;
     else{
@@ -1741,9 +1745,9 @@ Int_t AliPHOSGetter::ReadTreeS(Int_t event)
     sdname+=folder->GetName() ;
     if(!SDigitizer(sdname) ) 
       PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
-
-    sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
-    sdigitizerBranch->GetEntry(0) ;  
+    //!!!!!!!!!!!!!!!!!!!!!!!!!! Weird problem, the following line causes a seg fault
+    //  sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
+    // sdigitizerBranch->GetEntry(0) ;  
   }    
   
   // After SDigits have been read from all files, return to the first one
@@ -2042,22 +2046,26 @@ void AliPHOSGetter::RemoveTask(TString opt, TString name) const
 {
   // remove a task from the folder
   // path is fTasksFolder/SDigitizer/PHOS/name
-
+  
   TTask * task = 0 ; 
   TTask * phos = 0 ; 
   TList * lofTasks = 0 ; 
 
-  if (opt == "S") {
+  if (opt == "S") { // SDigitizer
     task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
     if (!task) 
       return ; 
   }
-
-  else if (opt == "D") {
+  else if (opt == "D") { // Digitizer
     task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
     if (!task) 
       return ; 
   }
+  else if (opt == "C" || opt == "T" || opt == "P"  ) { // Clusterizer, TrackSegmentMaker, PID
+    task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
+    if (!task) 
+      return ; 
+  }
   else {
     cerr << "WARNING: AliPHOSGetter::RemoveTask -> Unknown option " << opt.Data() << endl ; 
     return ; 
@@ -2071,6 +2079,7 @@ void AliPHOSGetter::RemoveTask(TString opt, TString name) const
   TObject * obj = lofTasks->FindObject(name) ; 
   if (obj) 
     lofTasks->Remove(obj) ;
+   
 }
 
 //____________________________________________________________________________ 
@@ -2082,14 +2091,14 @@ void AliPHOSGetter::RemoveObjects(TString opt, TString name) const
   TFolder * phos     = 0 ; 
   TFolder * phosmain = 0 ; 
 
-  if (opt == "H") {
+  if (opt == "H") { // Hits
     phos = dynamic_cast<TFolder*>(fHitsFolder->FindObject("PHOS")) ;
     if (!phos) 
       return ;
     name = "Hits" ; 
   }
 
-  else if ( opt == "S") {
+  else if ( opt == "S") { // SDigits
     phosmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ;
     if (!phosmain) 
       return ;
@@ -2098,11 +2107,36 @@ void AliPHOSGetter::RemoveObjects(TString opt, TString name) const
       return ;
   }
   
-  else if (opt == "D") {
+  else if (opt == "D") { // Digits
     phos = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("PHOS")) ;
     if (!phos) 
       return ;
   }
+
+  else if (opt == "RE") { // EMCARecPoints
+    phos = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/EMCARecPoints")) ;
+    if (!phos) 
+      return ;
+  }
+
+  else if (opt == "RC") { // CPVRecPoints
+    phos = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/CPVRecPoints")) ;
+    if (!phos) 
+      return ;
+  }  
+
+  else if (opt == "T") { // TrackSegments
+    phos = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/TrackSegments")) ;
+    if (!phos) 
+      return ;
+  }
+
+  else if (opt == "P") { // RecParticles
+    phos = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/RecParticles")) ;
+    if (!phos) 
+      return ;
+  }
+  
   else {
     cerr << "WARNING: AliPHOSGetter::RemoveObjects -> Unknown option " << opt.Data() << endl ; 
     return ;