]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDClusterFinder.cxx
Static method SetReadField() to enable/disable reading from file.
[u/mrichter/AliRoot.git] / PMD / AliPMDClusterFinder.cxx
index db55008758a2a3b21b7d71e367d7b23519057edd..b21c55151e68b888b73df3385d288058540120d8 100644 (file)
 
 ClassImp(AliPMDClusterFinder)
 
-AliPMDClusterFinder::AliPMDClusterFinder():
-  fRunLoader(0),
-  fPMDLoader(0),
+AliPMDClusterFinder::AliPMDClusterFinder(AliRunLoader* runLoader):
+  fRunLoader(runLoader),
+  fPMDLoader(runLoader->GetLoader("PMDLoader")),
   fTreeD(0),
   fTreeR(0),
-  fDigits(0),
+  fDigits(new TClonesArray("AliPMDdigit", 1000)),
   fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)),
   fNpoint(0),
   fDebug(0),
   fEcut(0.)
 {
 //
-// Default Constructor
+// Constructor
 //
 }
 // ------------------------------------------------------------------------- //
 AliPMDClusterFinder::~AliPMDClusterFinder()
 {
   // Destructor
+  if (fDigits)
+    {
+      fDigits->Delete();
+      delete fDigits;
+      fDigits=0;
+    }
   if (fRecpoints)
     {
       fRecpoints->Delete();
@@ -78,48 +84,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
@@ -133,7 +97,6 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
   Float_t  clusdata[5];
 
   TObjArray *pmdcont = new TObjArray();
-  AliPMDcluster  *pmdcl  = new AliPMDcluster;
   AliPMDClustering *pmdclust = new AliPMDClustering();
   pmdclust->SetDebug(fDebug);
   pmdclust->SetEdepCut(fEcut);
@@ -186,10 +149,10 @@ 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);
+         AliPMDcluster *pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
          idet        = pmdcl->GetDetector();
          ismn        = pmdcl->GetSMN();
          clusdata[0] = pmdcl->GetClusX();
@@ -260,18 +223,19 @@ void AliPMDClusterFinder::ResetRecpoint()
   if (fRecpoints) fRecpoints->Clear();
 }
 // ------------------------------------------------------------------------- //
-void AliPMDClusterFinder::UnLoad(Option_t *option)
+void AliPMDClusterFinder::Load()
+{
+  // Load all the *.root files
+  //
+  fPMDLoader->LoadDigits("READ");
+  fPMDLoader->LoadRecPoints("recreate");
+}
+// ------------------------------------------------------------------------- //
+void AliPMDClusterFinder::UnLoad()
 {
   // Unload all the *.root files
   //
-  const char *cR = strstr(option,"R");
-
-  fRunLoader->UnloadgAlice();
-
-  if (cR)
-    {
-      fPMDLoader->UnloadDigits();
-      fPMDLoader->UnloadRecPoints();
-    }
+  fPMDLoader->UnloadDigits();
+  fPMDLoader->UnloadRecPoints();
 }
 // ------------------------------------------------------------------------- //