]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMD.cxx
Including St2 in the new geometry segmentation (Christian)
[u/mrichter/AliRoot.git] / PMD / AliPMD.cxx
index 97b0c9bdacf148950a629de23b1a872402a6fcf4..e2b12dc2b5e09198569f328cc0dd5caabc4c2172 100644 (file)
 
 #include <TBRIK.h>
 #include <TClonesArray.h>
-#include <TFile.h>
 #include <TGeometry.h>
 #include <TNode.h>
 #include <TTree.h>
 #include <TVirtualMC.h>
 
-#include "AliConst.h" 
+#include "AliLog.h"
 #include "AliLoader.h" 
 #include "AliPMDLoader.h" 
 #include "AliPMD.h"
-#include "AliPMDRecPoint.h"
 #include "AliRun.h"
 #include "AliMC.h"
 #include "AliPMDDigitizer.h"
 #include "AliPMDhit.h"
+#include "AliPMDDDLRawData.h"
   
 ClassImp(AliPMD)
  
@@ -66,8 +65,6 @@ AliPMD::AliPMD()
   //
   fIshunt = 0;
 
-  fRecPoints  = 0;
-
 }
  
 //_____________________________________________________________________________
@@ -83,9 +80,6 @@ AliPMD::AliPMD(const char *name, const char *title)
   fHits   = new TClonesArray("AliPMDhit",  405);
   gAlice->GetMCApp()->AddHitList(fHits);
 
-  fRecPoints  = new TClonesArray("AliPMDRecPoint",10000); 
-  fNRecPoints = 0;
-  
 
   fIshunt =  0;
   
@@ -115,11 +109,11 @@ AliLoader* AliPMD::MakeLoader(const char* topfoldername)
  
   if (fLoader)
     {
-      cout<<"Success"<<endl;
+      AliInfo("Success");
     }
   else
     {
-      cout<<"Failure"<<endl;
+      AliError("Failure");
     }
 
   return fLoader;
@@ -128,10 +122,8 @@ AliLoader* AliPMD::MakeLoader(const char* topfoldername)
 AliPMD::~AliPMD()
 {
   //
-  // Default constructor
+  // Destructor
   //
-    delete fRecPoints;
-    fNRecPoints=0;
 }
 
 //_____________________________________________________________________________
@@ -251,76 +243,28 @@ void AliPMD::StepManager()
   //
 }
 
-void AliPMD::AddRecPoint(const AliPMDRecPoint &p)
-{
-    //
-    // Add a PMD reconstructed hit to the list
-    //
-    TClonesArray &lrecpoints = *fRecPoints;
-    new(lrecpoints[fNRecPoints++]) AliPMDRecPoint(p);
-}
-
 void AliPMD::MakeBranch(Option_t* option)
 {
     // Create Tree branches for the PMD
     
-    const char *cR = strstr(option,"R");
     const char *cH = strstr(option,"H");
     if (cH && fLoader->TreeH() && (fHits == 0x0))
       fHits   = new TClonesArray("AliPMDhit",  405);
     
     AliDetector::MakeBranch(option);
-
-    if (cR  && fLoader->TreeR()) {
-      printf("Make Branch - TreeR address %p\n",fLoader->TreeR());
-    
-      const Int_t kBufferSize = 4000;
-      char branchname[30];
-      
-      sprintf(branchname,"%sRecPoints",GetName());
-      if (fRecPoints == 0x0) {
-        fRecPoints  = new TClonesArray("AliPMDRecPoint",10000); 
-      }
-      MakeBranchInTree(fLoader->TreeR(), branchname, &fRecPoints, kBufferSize,0);
-   }   
 }
 
 
 void AliPMD::SetTreeAddress()
 {
-  // Set branch address for the TreeR
-    char branchname[30];
-    
+  // Set branch address
+
     if (fLoader->TreeH() && fHits==0x0)
       fHits   = new TClonesArray("AliPMDhit",  405);
       
     AliDetector::SetTreeAddress();
-
-    TBranch *branch;
-    TTree *treeR = fLoader->TreeR();
-
-    sprintf(branchname,"%s",GetName());
-    if (treeR) {
-       branch = treeR->GetBranch(branchname);
-       if (branch) 
-       {
-         if (fRecPoints == 0x0) {
-           fRecPoints  = new TClonesArray("AliPMDRecPoint",10000); 
-         }
-         branch->SetAddress(&fRecPoints);
-       }
-    }
 }
 
-void AliPMD::ResetHits()
-{
-  //
-  // Reset number of hits and the hits array
-  //
-    AliDetector::ResetHits();
-    fNRecPoints   = 0;
-    if (fRecPoints)   fRecPoints->Clear();
-}
 //____________________________________________________________________________
 void AliPMD::Hits2SDigits()  
 { 
@@ -369,5 +313,22 @@ AliDigitizer* AliPMD::CreateDigitizer(AliRunDigitizer* manager) const
   return new AliPMDDigitizer(manager);
 }
 // ---------------------------------------------------------------------------
+void AliPMD::Digits2Raw()
+{ 
+// convert digits of the current event to raw data
+
+  fLoader->LoadDigits();
+  TTree* digits = fLoader->TreeD();
+  if (!digits) {
+    AliError("No digits tree");
+    return;
+  }
+
+  AliPMDDDLRawData rawWriter;
+  rawWriter.WritePMDRawData(digits);
+
+  fLoader->UnloadDigits();
+}
+