OpengAliceFile method removed, loaders data members set in the constructor, loading...
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Apr 2004 10:52:24 +0000 (10:52 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Apr 2004 10:52:24 +0000 (10:52 +0000)
PMD/AliPMD.cxx
PMD/AliPMDClusterFinder.cxx
PMD/AliPMDClusterFinder.h

index 225003c..3727fd3 100644 (file)
@@ -373,16 +373,12 @@ void  AliPMD::Reconstruct() const
 // create reconstructed points
   
   AliRunLoader* runLoader = fLoader->GetRunLoader(); 
-  AliPMDClusterFinder *pmdClus = new AliPMDClusterFinder();
-  pmdClus->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(),"DR");
+  AliPMDClusterFinder *pmdClus = new AliPMDClusterFinder(runLoader);
   for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++)
     {
       pmdClus->Digits2RecPoints(iEvent);
     }
 
-  fLoader->UnloadRecPoints();
-  fLoader->UnloadDigits();
-
   delete pmdClus;
 
 }
@@ -390,22 +386,16 @@ void  AliPMD::Reconstruct() const
 void  AliPMD::FillESD(AliESD* esd) const
 {
 
-  AliRunLoader* runLoader = fLoader->GetRunLoader();
   fLoader->LoadRecPoints("READ");
-  Int_t ievent = runLoader->GetEventNumber();
-  runLoader->GetEvent(ievent);
-  AliLoader *pmdloader = runLoader->GetLoader("PMDLoader");
-  TTree *treeR = pmdloader->TreeR();
-  AliPMDtracker *pmdtracker = new AliPMDtracker();
-  pmdtracker->LoadClusters(treeR);
-  pmdtracker->Clusters2Tracks(esd);
-  delete pmdtracker; 
-
+  TTree *treeR = fLoader->TreeR();
+  AliPMDtracker pmdtracker;
+  pmdtracker.LoadClusters(treeR);
+  pmdtracker.Clusters2Tracks(esd);
   fLoader->UnloadRecPoints();
 }
 
 // ---------------------------------------------------------------------------
-AliDigitizer* AliPMD::CreateDigitizer(AliRunDigitizer* manager)
+AliDigitizer* AliPMD::CreateDigitizer(AliRunDigitizer* manager) const
 { 
   return new AliPMDDigitizer(manager);
 }
index db55008..19f5b05 100644 (file)
@@ -50,9 +50,9 @@
 
 ClassImp(AliPMDClusterFinder)
 
-AliPMDClusterFinder::AliPMDClusterFinder():
-  fRunLoader(0),
-  fPMDLoader(0),
+AliPMDClusterFinder::AliPMDClusterFinder(AliRunLoader* runLoader):
+  fRunLoader(runLoader),
+  fPMDLoader(runLoader->GetLoader("PMDLoader")),
   fTreeD(0),
   fTreeR(0),
   fDigits(0),
@@ -62,7 +62,7 @@ AliPMDClusterFinder::AliPMDClusterFinder():
   fEcut(0.)
 {
 //
-// Default Constructor
+// Constructor
 //
 }
 // ------------------------------------------------------------------------- //
@@ -78,48 +78,6 @@ AliPMDClusterFinder::~AliPMDClusterFinder()
 }
 // ------------------------------------------------------------------------- //
 
-void AliPMDClusterFinder::OpengAliceFile(const Char_t *file, Option_t *option)
-{
-  // Loads galice.root file and corresponding header, kinematics
-  // hits and sdigits or digits depending on the option
-  //
-  fRunLoader = AliRunLoader::Open(file,AliConfig::GetDefaultEventFolderName(),
-                                 "UPDATE");
-  
-  if (!fRunLoader)
-   {
-     Error("Open","Can not open session for file %s.",file);
-   }
-  
-  fRunLoader->LoadgAlice();
-  gAlice = fRunLoader->GetAliRun();
-  
-  if (gAlice)
-    {
-      printf("<AliPMDdigitizer::Open> ");
-      printf("AliRun object found on file.\n");
-    }
-  else
-    {
-      printf("<AliPMDdigitizer::Open> ");
-      printf("Could not find AliRun object.\n");
-    }
-  fPMDLoader = fRunLoader->GetLoader("PMDLoader");
-  if (fPMDLoader == 0x0)
-    {
-      cerr<<"OpengAlice : Can not find PMD or PMDLoader\n";
-    }
-
-  const char *cDR = strstr(option,"DR");
-
-  if (cDR)
-    {
-      fPMDLoader->LoadDigits("READ");
-      fPMDLoader->LoadRecPoints("recreate");
-    }
-}
-// ------------------------------------------------------------------------- //
-
 void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
 {
   // Converts digits to recpoints after running clustering
@@ -138,6 +96,8 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
   pmdclust->SetDebug(fDebug);
   pmdclust->SetEdepCut(fEcut);
 
+  fPMDLoader->LoadDigits("READ");
+  fPMDLoader->LoadRecPoints("recreate");
   fRunLoader->GetEvent(ievt);
   //cout << " ***** Beginning::Digits2RecPoints *****" << endl;
   fTreeD = fPMDLoader->TreeD();
@@ -186,7 +146,7 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
       pmdclust->DoClust(idet,ismn,fCellADC,pmdcont);
       
       Int_t nentries1 = pmdcont->GetEntries();
-      cout << " nentries1 = " << nentries1 << endl;
+//      cout << " nentries1 = " << nentries1 << endl;
       for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
        {
          pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
@@ -210,6 +170,8 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
   ResetCellADC();
   fPMDLoader = fRunLoader->GetLoader("PMDLoader");  
   fPMDLoader->WriteRecPoints("OVERWRITE");
+  fPMDLoader->UnloadRecPoints();
+  fPMDLoader->UnloadDigits();
 
   //   delete the pointers
   delete pmdclust;
index 040f47c..bdb3c27 100644 (file)
@@ -34,11 +34,9 @@ class AliPMDClusterFinder
 
  public:
 
-  AliPMDClusterFinder();
+  AliPMDClusterFinder(AliRunLoader* runLoader);
   virtual ~AliPMDClusterFinder();
 
-  void OpengAliceFile(const char * file, Option_t * option);
-
   void Digits2RecPoints(Int_t ievt);
   void SetCellEdepCut(Float_t ecut);
   void SetDebug(Int_t idebug);