Adapted (and corrected a few minor defaults) the getter to the new PIDv2 that allows...
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 27 Apr 2002 13:44:58 +0000 (13:44 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 27 Apr 2002 13:44:58 +0000 (13:44 +0000)
PHOS/AliPHOSGetter.cxx
PHOS/AliPHOSGetter.h
PHOS/AliPHOSPIDv2.cxx
PHOS/AliPHOSPIDv2.h

index 516e6636f81b470b390695bca86fdfcb0c430402..0486b1c6036ef045f74cb245d708135ae88e440f 100644 (file)
@@ -109,21 +109,17 @@ AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* branchTitle )
   if ( fHeaderFile != "aliroot"  ) { // to call the getter without a file
 
     //open headers file
-    TFile * file = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
-    if(file == 0){    //if file was not opened yet, read gAlice
-      if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
-       file =  TFile::Open(fHeaderFile.Data(),"update") ;
-      else
-       file = new TFile(fHeaderFile.Data(),"update") ;
+    fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
+    if(!fFile) {    //if file was not opened yet, read gAlice
+      fFile = TFile::Open(fHeaderFile.Data(),"update") ;
       
-      if (!file->IsOpen()) {
+      if (!fFile->IsOpen()) {
        cerr << "ERROR : AliPHOSGetter::AliPHOSGetter -> Cannot open " << fHeaderFile.Data() << endl ; 
        fFailed = kTRUE ;
         return ;  
       }
-      
-      gAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
-    }
+      gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ;
+    } 
   }
 
   if (!gAlice) {
@@ -134,9 +130,13 @@ AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* branchTitle )
   if (!PHOS()) {
     if (fDebug)
       cout << "INFO: AliPHOSGetter -> Posting PHOS to Folders" << endl ; 
-    AliConfig * conf = AliConfig::Instance() ; 
-    conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("PHOS"))) ; 
-    conf->Add(static_cast<AliModule*>(gAlice->GetDetector("PHOS"))) ; 
+    if (gAlice->GetDetector("PHOS")) {
+      AliConfig * conf = AliConfig::Instance() ; 
+      conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("PHOS"))) ; 
+      conf->Add(static_cast<AliModule*>(gAlice->GetDetector("PHOS"))) ; 
+    }
+    else 
+      cerr << "ERROR: AliPHOSGetter -> detector PHOS not found" << endl ;  
   }
   
   fDebug=0;
@@ -148,7 +148,10 @@ AliPHOSGetter::~AliPHOSGetter(){
     fPrimaries->Delete() ; 
     delete fPrimaries ; 
   }
-
+  fFile->Close() ;  
+  delete fFile ;
+  fFile = 0 ;
+    
 }
 
 //____________________________________________________________________________ 
@@ -182,9 +185,9 @@ AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile,
     if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) && 
        (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
       return fgObjGetter ;
-    else
+    else 
       fgObjGetter->~AliPHOSGetter() ;  // delete it already exists another version
-  
   fgObjGetter = new AliPHOSGetter(headerFile,branchTitle) ; 
   
   // Posts a few item to the white board (folders)
@@ -616,8 +619,8 @@ Bool_t AliPHOSGetter::PostRecPoints(const char * name) const
   
   if ( !phosFolder ) {
     if (fDebug) {
-      cout << "WARNING: AliPHOSGetter::Post RPo -> Folder //" << fRecoFolder << "/PHOS/ not found!" << endl;
-      cout << "INFO:    AliPHOSGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/PHOS/" << endl;
+      cout << "WARNING: AliPHOSGetter::Post RPo -> Folder //" << fRecoFolder->GetName() << "/PHOS/ not found!" << endl;
+      cout << "INFO:    AliPHOSGetter::Post Rpo -> Adding Folder //" << fRecoFolder->GetName() << "/PHOS/" << endl;
     }
     phosFolder = fRecoFolder->AddFolder("PHOS", "Reconstructed data from PHOS") ;  
   }    
@@ -626,8 +629,8 @@ Bool_t AliPHOSGetter::PostRecPoints(const char * name) const
   TFolder * phosRPoEMCAFolder  = dynamic_cast<TFolder*>(phosFolder->FindObject("EMCARecPoints")) ;
   if ( !phosRPoEMCAFolder ) {
     if (fDebug) {
-      cout << "WARNING: AliPHOSGetter::Post RPo -> Folder //" << fRecoFolder << "/PHOS/EMCARecPoints/ not found!" << endl;
-      cout << "INFO:    AliPHOSGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/PHOS/EMCARecPoints not found!" << endl;
+      cout << "WARNING: AliPHOSGetter::Post RPo -> Folder //" << fRecoFolder->GetName() << "/PHOS/EMCARecPoints/ not found!" << endl;
+      cout << "INFO:    AliPHOSGetter::Post Rpo -> Adding Folder //" << fRecoFolder->GetName() << "/PHOS/EMCARecPoints" << endl;
     }
     phosRPoEMCAFolder = phosFolder->AddFolder("EMCARecPoints", "EMCA RecPoints from PHOS") ;  
   }    
@@ -643,8 +646,8 @@ Bool_t AliPHOSGetter::PostRecPoints(const char * name) const
   TFolder * phosRPoCPVFolder  = dynamic_cast<TFolder*>(phosFolder->FindObject("CPVRecPoints")) ;
   if ( !phosRPoCPVFolder ) {
     if (fDebug) {
-      cout << "WARNING: AliPHOSGetter::Post RPo -> Folder //" << fRecoFolder << "/PHOS/CPVRecPoints/ not found!" << endl;
-      cout << "INFO:    AliPHOSGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/PHOS/CPVRecPoints/" << endl;
+      cout << "WARNING: AliPHOSGetter::Post RPo -> Folder //" << fRecoFolder->GetName() << "/PHOS/CPVRecPoints/ not found!" << endl;
+      cout << "INFO:    AliPHOSGetter::Post Rpo -> Adding Folder //" << fRecoFolder->GetName() << "/PHOS/CPVRecPoints/" << endl;
     }
     phosRPoCPVFolder = phosFolder->AddFolder("CPVRecPoints", "CPV RecPoints from PHOS") ;  
   }    
@@ -665,13 +668,13 @@ TObject** AliPHOSGetter::EmcRecPointsRef(const char * name) const
   // the hierarchy is //Folders/Run/Event/RecData/PHOS/EMCARecPoints/name
    
   if ( !fRecoFolder ) {
-    cerr << "ERROR: AliPHOSGetter::EmcRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
+    cerr << "ERROR: AliPHOSGetter::EmcRecPointsRef -> Folder //" << fRecoFolder->GetName() << " not found!" << endl;
     return 0 ; 
   }    
 
   TFolder * phosFolder  = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/EMCARecPoints")) ; 
   if ( !phosFolder ) {
-    cerr << "ERROR: AliPHOSGetter::EmcRecPointsRef -> Folder //" << fRecoFolder << "/PHOS/EMCARecPoints/ not found!" << endl;
+    cerr << "ERROR: AliPHOSGetter::EmcRecPointsRef -> Folder //" << fRecoFolder->GetName() << "/PHOS/EMCARecPoints/ not found!" << endl;
     return 0;
   }    
 
@@ -691,13 +694,13 @@ TObject** AliPHOSGetter::CpvRecPointsRef(const char * name) const
   // the hierarchy is //Folders/Run/Event/RecData/PHOS/CPVRecPoints/name
    
   if ( !fRecoFolder ) {
-    cerr << "ERROR: AliPHOSGetter::EmcRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
+    cerr << "ERROR: AliPHOSGetter::EmcRecPointsRef -> Folder //" << fRecoFolder->GetName() << " not found!" << endl;
     return 0 ; 
   }    
 
   TFolder * phosFolder  = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/CPVRecPoints")) ; 
   if ( !phosFolder ) {
-    cerr << "ERROR: AliPHOSGetter::CpvRecPointsRef -> Folder //" << fRecoFolder << "/PHOS/CPVRecPoints/" << endl;
+    cerr << "ERROR: AliPHOSGetter::CpvRecPointsRef -> Folder //" << fRecoFolder->GetName() << "/PHOS/CPVRecPoints/" << endl;
     return 0;
   }    
 
@@ -823,7 +826,7 @@ Bool_t AliPHOSGetter::PostTrackSegments(const char * name) const
   if ( !phosFolder ) {
     if (fDebug) {
       cout << "WARNING: AliPHOSGetter::Post TS -> Folder //" << fRecoFolder << "/PHOS/ not found!" << endl;
-      cout << "INFO:    AliPHOSGetter::Post TS -> Adding Folder //" << fRecoFolder << "/PHOS" << endl;
+      cout << "INFO:    AliPHOSGetter::Post TS -> Adding Folder //" << fRecoFolder->GetName() << "/PHOS" << endl;
     }
     phosFolder = fRecoFolder->AddFolder("PHOS", "Reconstructed data from PHOS") ;  
   }    
@@ -831,8 +834,8 @@ Bool_t AliPHOSGetter::PostTrackSegments(const char * name) const
   TFolder * phosTSFolder  = dynamic_cast<TFolder*>(phosFolder->FindObject("TrackSegments")) ;
   if ( !phosTSFolder ) {
     if (fDebug) {
-      cout << "WARNING: AliPHOSGetter::Post TS -> Folder//" << fRecoFolder << "/PHOS/TrackSegments/ not found!" << endl; 
-      cout << "INFO:    AliPHOSGetter::Post TS -> Adding Folder //" << fRecoFolder << "/PHOS/TrackSegments/" << endl; 
+      cout << "WARNING: AliPHOSGetter::Post TS -> Folder//" << fRecoFolder->GetName() << "/PHOS/TrackSegments/ not found!" << endl; 
+      cout << "INFO:    AliPHOSGetter::Post TS -> Adding Folder //" << fRecoFolder->GetName() << "/PHOS/TrackSegments/" << endl; 
     }
     phosTSFolder = phosFolder->AddFolder("TrackSegments", "TrackSegments from PHOS") ;  
   }    
@@ -853,13 +856,13 @@ TObject** AliPHOSGetter::TrackSegmentsRef(const char * name) const
   // the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name
 
  if ( !fRecoFolder ) {
-    cerr << "ERROR: AliPHOSGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
+    cerr << "ERROR: AliPHOSGetter::TrackSegmentsRef -> Folder //" << fRecoFolder->GetName() << "not found!" << endl;
     return 0 ; 
   }    
 
   TFolder * phosFolder  = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/TrackSegments")) ; 
   if ( !phosFolder ) {
-    cerr << "ERROR: AliPHOSGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/PHOS/TrackSegments/ not found!" << endl;
+    cerr << "ERROR: AliPHOSGetter::TrackSegmentsRef -> Folder //" << fRecoFolder->GetName() << "/PHOS/TrackSegments/ not found!" << endl;
     return 0;
   }    
   
@@ -988,8 +991,8 @@ Bool_t AliPHOSGetter::PostRecParticles(const char * name) const
   
   if ( !phosFolder ) {
     if (fDebug) {
-      cout << "WARNING: AliPHOSGetter::Post RPa -> Folder //" << fRecoFolder << "/PHOS/ not found!" << endl;
-      cout << "INFO:    AliPHOSGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/PHOS/" << endl;
+      cout << "WARNING: AliPHOSGetter::Post RPa -> Folder //" << fRecoFolder->GetName() << "/PHOS/ not found!" << endl;
+      cout << "INFO:    AliPHOSGetter::Post Rpa -> Adding Folder //" << fRecoFolder->GetName() << "/PHOS/" << endl;
     }
     phosFolder = fRecoFolder->AddFolder("PHOS", "Reconstructed data from PHOS") ;  
   }    
@@ -997,8 +1000,8 @@ Bool_t AliPHOSGetter::PostRecParticles(const char * name) const
  TFolder * phosRPaFolder  = dynamic_cast<TFolder*>(phosFolder->FindObject("RecParticles")) ;
   if ( !phosRPaFolder ) {
     if (fDebug) {
-      cout << "WARNING: AliPHOSGetter::Post RPa -> Folder //" << fRecoFolder << "/PHOS/RecParticles/ not found!" << endl;
-      cout << "INFO:    AliPHOSGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/PHOS/RecParticles/" << endl;
+      cout << "WARNING: AliPHOSGetter::Post RPa -> Folder //" << fRecoFolder->GetName() << "/PHOS/RecParticles/ not found!" << endl;
+      cout << "INFO:    AliPHOSGetter::Post RPa -> Adding Folder //" << fRecoFolder->GetName() << "/PHOS/RecParticles/" << endl;
     }
     phosRPaFolder = phosFolder->AddFolder("RecParticles", "RecParticles from PHOS") ;  
   } 
@@ -1019,13 +1022,13 @@ TObject** AliPHOSGetter::RecParticlesRef(const char * name) const
   // the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name
 
  if ( !fRecoFolder ) {
-    cerr << "ERROR: AliPHOSGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl; 
+    cerr << "ERROR: AliPHOSGetter::RecParticlesRef -> Folder//" << fRecoFolder->GetName() << " not found!" << endl; 
     return 0 ; 
   }    
 
   TFolder * phosFolder  = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/RecParticles")) ; 
   if ( !phosFolder ) {
-    cerr << "ERROR: AliPHOSGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/PHOS/RecParticles/ not found!" << endl;
+    cerr << "ERROR: AliPHOSGetter::RecParticlesRef -> Folder //" << fRecoFolder->GetName() << "/PHOS/RecParticles/ not found!" << endl;
     return 0;
   }    
 
@@ -1383,9 +1386,17 @@ void AliPHOSGetter::ReadTreeQA()
 }
 
 //____________________________________________________________________________ 
-Int_t AliPHOSGetter::ReadTreeR()
+Int_t AliPHOSGetter::ReadTreeR(Bool_t any)
 {
   // Read the reconstrunction tree gAlice->TreeR()
+  // A particularity has been introduced here :
+  //  if gime->Event(ievent,"R") is called branches with the current title are read, the current title
+  //   being for example give in AliPHOSPID(fileName, title)
+  //  if gime(Event(ievent, "RA") is called the title of the branches is not checked anymore, "A" stands for any
+  // This is a feature needed by PID to be able to reconstruct several times particles (each time a ther title is given)
+  // from a given set of TrackSegments (with a given name)
+  // This is why any is NOT used to read the branch of RecParticles
+  // See AliPHOSPIDv2    
 
   if(gAlice->TreeR()== 0){
     cerr <<   "WARNING: AliPHOSGetter::ReadTreeR: can not read TreeR " << endl ;
@@ -1402,7 +1413,7 @@ Int_t AliPHOSGetter::ReadTreeR()
   Bool_t phosemcrpfound = kFALSE, phoscpvrpfound = kFALSE, clusterizerfound = kFALSE ; 
   
   while ( (branch = static_cast<TBranch*>(next())) && (!phosemcrpfound || !phoscpvrpfound || !clusterizerfound) ) 
-    if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
+    if(strcmp(branch->GetTitle(), fRecPointsTitle)==0 || any) {
       if ( strcmp(branch->GetName(), "PHOSEmcRP")==0) {
        emcbranch = branch ; 
        phosemcrpfound = kTRUE ;
@@ -1460,7 +1471,7 @@ Int_t AliPHOSGetter::ReadTreeR()
   Bool_t phostsfound = kFALSE, tsmakerfound = kFALSE ; 
     
   while ( (branch = static_cast<TBranch*>(next())) && (!phostsfound || !tsmakerfound) ) 
-    if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0)  {
+    if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0 || any)  {
       if ( strcmp(branch->GetName(), "PHOSTS")==0){
        tsbranch = branch ; 
        phostsfound = kTRUE ;
@@ -1711,11 +1722,16 @@ void AliPHOSGetter::ReadPrimaries()
 void AliPHOSGetter::Event(const Int_t event, const char* opt)
 {
   // Reads the content of all Tree's S, D and R
-  
   if (event >= gAlice->TreeE()->GetEntries() ) {
     cerr << "ERROR: AliPHOSGetter::Event -> " << event << " not found in TreeE!" << endl ; 
     return ; 
   }
+
+  Bool_t any = kFALSE ; 
+  if (strstr(opt,"A") ) // do not check the title of the branches
+    any = kTRUE; 
+
   gAlice->GetEvent(event) ; 
 
   Int_t rvRH = 0 ;
@@ -1733,7 +1749,7 @@ void AliPHOSGetter::Event(const Int_t event, const char* opt)
     rvRD = ReadTreeD() ;
 
   if( strstr(opt,"R") )
-    rvRR = ReadTreeR() ;
+    rvRR = ReadTreeR(any) ;
 
   if( strstr(opt,"Q") )
     ReadTreeQA() ;
@@ -1790,7 +1806,7 @@ TObject * AliPHOSGetter::ReturnO(TString what, TString name, TString file) const
     if (folder) { 
       if (name.IsNull())
        name = fRecPointsTitle ; 
-      phosO  = dynamic_cast<TObject *>(folder->FindObject(name)) ; 
+      phosO  = dynamic_cast<TObject *>(folder->FindObject(name)) ;
     } 
   }
   else if ( what.CompareTo("CpvRecPoints") == 0 ) {
@@ -1830,7 +1846,7 @@ TObject * AliPHOSGetter::ReturnO(TString what, TString name, TString file) const
   }
   if (!phosO) {
     if(fDebug)
-      cerr << "ERROR : AliPHOSGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ; 
+      cerr << "ERROR : AliPHOSGetter::ReturnO -> Object " << what << " not found in " << fQAFolder->GetName() << endl ; 
     return 0 ;
   }
 
index 994e6c1dfb0672ebd59e9ad2cb92c49afe3e8df2..ef1f28b29dc709ea7d618d256b62ce4a1bf73b15 100644 (file)
@@ -183,6 +183,8 @@ class AliPHOSGetter : public TObject {
   }
   
   TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ; }
+
+  void SetRecParticlesTitle(const TString title) { fRecParticlesTitle = title ; }
   
 private:
   
@@ -193,7 +195,7 @@ private:
   void DefineBranchTitles(char* branch, char* branchTitle) ;
   Int_t ReadTreeD() ;
   Int_t ReadTreeH() ;
-  Int_t ReadTreeR() ;
+  Int_t ReadTreeR(Bool_t any=kFALSE) ;
   Int_t ReadTreeS(Int_t event) ;
   void ReadTreeQA() ;
   void ReadPrimaries() ;
@@ -216,6 +218,7 @@ private:
 
  private:
 
+  TFile *        fFile;               //! 
   TString        fHeaderFile ;        //! File in which gAlice lives
   TString        fBranchTitle ;       //!
   TString        fTrackSegmentsTitle ;//! 
index 21a52a8a237fb50c0b415c81c7af982235e34886..22915515ad28417ef927cb6f6b261b6962cc6b3e 100644 (file)
 //  Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
 //  root [1] p1->SetIdentificationMethod("disp ellipse")
 //  root [2] p1->ExecuteTask()
-//  root [3] AliPHOSPIDv2 * p2 = new AliPHOSPIDv2("galice1.root","ts1")
+//  root [3] AliPHOSPIDv2 * p2 = new AliPHOSPIDv2("galice1.root","v2")
 //  Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
-//                // reading headers from file galice1.root and TrackSegments 
-//                // with title "ts1"
-//  root [4] p2->SetRecParticlesBranch("rp1")
+//                // reading headers from file galice1.root and create  RecParticles with title v2
+                  // TrackSegments and RecPoints with title "v2" are used 
 //                // set file name for the branch RecParticles
-//  root [5] p2->ExecuteTask("deb all time")
+//  root [4] p2->ExecuteTask("deb all time")
 //                // available options
 //                // "deb" - prints # of reconstructed particles
 //                // "deb all" -  prints # and list of RecParticles
 //                // "time" - prints benchmarking results
 //                  
+//  root [5] AliPHOSPIDv2 * p3 = new AliPHOSPIDv2("galice1.root","v2","v0")
+//  Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
+//                // reading headers from file galice1.root and create  RecParticles with title v2
+                  // RecPoints and TrackSegments with title "v0" are used 
+//  root [6] p3->ExecuteTask()
 //*-- Author: Yves Schutz (SUBATECH)  & Gines Martinez (SUBATECH) & 
 //            Gustavo Conesa April 2002
 
@@ -93,11 +97,12 @@ AliPHOSPIDv2::AliPHOSPIDv2():AliPHOSPID()
   fRecParticlesInRun = 0 ;
   fClusterizer       = 0 ; 
   fTSMaker           = 0 ;
+  fFrom              = "" ;  
   
 }
 
 //____________________________________________________________________________
-AliPHOSPIDv2::AliPHOSPIDv2(const char * headerFile,const char * name) : AliPHOSPID(headerFile, name)
+AliPHOSPIDv2::AliPHOSPIDv2(const char * headerFile,const char * name, const char * from) : AliPHOSPID(headerFile, name)
 { 
   //ctor with the indication on where to look for the track segments
  
@@ -110,7 +115,10 @@ AliPHOSPIDv2::AliPHOSPIDv2(const char * headerFile,const char * name) : AliPHOSP
   tempo.Append(Version()) ; 
   SetName(tempo) ; 
   fRecParticlesInRun = 0 ; 
-
+  if ( from == 0 ) 
+    fFrom = name ; 
+  else
+    fFrom = from ; 
   Init() ;
 
 }
@@ -221,7 +229,10 @@ void  AliPHOSPIDv2::Exec(Option_t * option)
     return ; 
   }
 
+  cout << gDirectory->GetName() << endl ; 
+
   gAlice->GetEvent(0) ;
+
   //check, if the branch with name of this" already exits?
   TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
   TIter next(lob) ; 
@@ -247,11 +258,10 @@ void  AliPHOSPIDv2::Exec(Option_t * option)
   
   Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
   Int_t ievent ;
-  AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
-  
+  AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;  
   for(ievent = 0; ievent < nevents; ievent++){
-    gime->Event(ievent,"R") ;
-    
+    gime->Event(ievent,"RA") ;
     MakeRecParticles() ;
     
     WriteRecParticles(ievent);
@@ -260,7 +270,7 @@ void  AliPHOSPIDv2::Exec(Option_t * option)
       PrintRecParticles(option) ;
 
     //increment the total number of rec particles per run 
-    fRecParticlesInRun += gime->RecParticles()->GetEntriesFast() ; 
+    fRecParticlesInRun += gime->RecParticles(taskName)->GetEntriesFast() ; 
 
   }
   
@@ -294,7 +304,7 @@ void AliPHOSPIDv2::Init()
   fFileName       = "$ALICE_ROOT/PHOS/PCA8pa15_0.5-100.root" ; 
   TFile f( fFileName.Data(), "read" ) ;
   fPrincipal      = dynamic_cast<TPrincipal*> (f.Get("principal")) ; 
+  f.Close() ; 
   // Ellipse parameters 
   fX_center          = 2.0 ; 
   fY_center          = -0.35 ; 
@@ -303,7 +313,9 @@ void AliPHOSPIDv2::Init()
   fB                 = 1.0 ; 
   fAngle             = -60. ;
  
-  AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), taskName.Data()) ; 
+  AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), fFrom.Data()) ; 
+
+  gime->SetRecParticlesTitle(taskName) ;
   if ( gime == 0 ) {
     cerr << "ERROR: AliPHOSPIDv2::Init -> Could not obtain the Getter object !" << endl ; 
     return ;
@@ -319,13 +331,19 @@ void AliPHOSPIDv2::Init()
 void  AliPHOSPIDv2::MakeRecParticles(){
 
   // Makes a RecParticle out of a TrackSegment
+
   TString taskName(GetName()) ; 
   taskName.Remove(taskName.Index(Version())-1) ;
-
+  
   AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; 
-  TObjArray * emcRecPoints = gime->EmcRecPoints(taskName) ; 
-  TObjArray * cpvRecPoints = gime->CpvRecPoints(taskName) ; 
-  TClonesArray * trackSegments = gime->TrackSegments(taskName) ; 
+  TObjArray * emcRecPoints = gime->EmcRecPoints(fFrom) ; 
+  TObjArray * cpvRecPoints = gime->CpvRecPoints(fFrom) ; 
+  TClonesArray * trackSegments = gime->TrackSegments(fFrom) ; 
+  if ( !emcRecPoints || !cpvRecPoints || !trackSegments ) {
+    cerr << "ERROR:  AliPHOSPIDv2::MakeRecParticles -> RecPoints or TrackSegments with name " 
+        << fFrom << " not found ! " << endl ; 
+    abort() ; 
+  }
   TClonesArray * recParticles  = gime->RecParticles(taskName) ; 
   recParticles->Clear();
  
index e719ae66a6bae8b61cab4e760d1f4c25b484f3db..29c51aa58fda8672612388a3ac62de29818af12e 100644 (file)
@@ -31,7 +31,7 @@ class  AliPHOSPIDv2 : public AliPHOSPID {
 public:
 
   AliPHOSPIDv2() ;          // ctor            
-  AliPHOSPIDv2(const char* headerFile, const char * tsBranch = "Default") ;
+  AliPHOSPIDv2(const char* headerFile, const char * tsBranch = "Default", const char * from = 0) ;
   virtual ~AliPHOSPIDv2() ; // dtor
 
   virtual void Exec(Option_t * option);
@@ -68,6 +68,7 @@ public:
 
  private:
 
+  TString                fFrom ;              // name of Recpoints and TrackSegments 
   TString                fHeaderFileName ;    // file name with event header
   TString                fTrackSegmentsTitle; // branch name with track segments
   TString                fRecPointsTitle ;    // branch name with rec points