]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - CRT/AliCRT.cxx
Clean-up. (A. Gheata)
[u/mrichter/AliRoot.git] / CRT / AliCRT.cxx
index 9d3f1b6e79b93f0a927c1748ee11fb4a06ae3cc1..502f411b031152b464de5e579150b86d70716eab 100644 (file)
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
+#include "AliCRT.h"
+
 #include <TTree.h>
+#include <TVirtualMC.h>
 
 #include "AliRun.h"
 #include "AliMagF.h"
+//#include "AliMC.h"
 
-#include "AliCRT.h"
+//#include "AliCRThit.h"
+#include "AliCRTModule.h"
 
 ClassImp(AliCRT)
 
 //_____________________________________________________________________________
 AliCRT::AliCRT()
-  : AliDetector()
+  : AliDetector(),
+    fModule(0)
 {
   //
   // Default constructor
@@ -57,16 +63,20 @@ AliCRT::AliCRT()
  
 //_____________________________________________________________________________
 AliCRT::AliCRT(const char *name, const char *title)
-  : AliDetector(name, title)
+  : AliDetector(name, title),
+    fModule(0)
 {
   //
   // Standard constructor
   //
+  //fHits =  new TClonesArray("AliCRThit", 400);
+  //gAlice->GetMCApp()->AddHitList(fHits);
 }
 
 //_____________________________________________________________________________
 AliCRT::AliCRT(const AliCRT& crt)
-  : AliDetector(crt)
+  : AliDetector(crt),
+    fModule(crt.fModule)
 {
   //
   // Copy constructor
@@ -80,6 +90,7 @@ AliCRT::~AliCRT()
   //
   // Default destructor
   //
+  if ( fModule ) { delete fModule; fModule = 0; }
 }
 
 //_____________________________________________________________________________
@@ -205,11 +216,25 @@ void AliCRT::SetTreeAddress()
   TBranch *branch;
   char branchname[20];
   sprintf(branchname,"%s",GetName());
-
   // Branch address for hit tree
   TTree *treeH = fLoader->TreeH();
-  if (treeH && fHits) {
+  if (treeH ) {
     branch = treeH->GetBranch(branchname);
     if (branch) branch->SetAddress(&fHits);
   }
 }
+
+//_____________________________________________________________________________
+void AliCRT::MakeBranch(Option_t* opt)
+{
+  //
+  // Initializes the branches of the CRT inside the trees written
+  // for each event.
+  //
+  const char* oH = strstr(opt, "H");
+  if ( fLoader->TreeH() && oH && (fHits == 0x0) ) {
+    fHits = new TClonesArray("AliCRThit", 1000);
+    fNhits = 0;
+  }
+  AliDetector::MakeBranch(opt);
+}