]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliDetector.cxx
Regenerated with modifying geometry (adding mother volumes)
[u/mrichter/AliRoot.git] / STEER / AliDetector.cxx
index 1db4b717ba711e4242021faae6e3d47fbcce98a3..71d748b5b2ddc3ef9a386fbd734dfcf045e9f5cc 100644 (file)
@@ -1,3 +1,20 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
 // Base class for ALICE modules. Both sensitive modules (detectors) and      //
 //                                                                           //
 //Begin_Html
 /*
-<img src="gif/AliDetectorClass.gif">
+<img src="picts/AliDetectorClass.gif">
 */
 //End_Html
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
+
+#include <TBrowser.h>
+#include <TTree.h>
+
+#include "AliLog.h"
+#include "AliConfig.h"
 #include "AliDetector.h"
-#include "AliRun.h"
 #include "AliHit.h"
 #include "AliPoints.h"
+#include "AliLoader.h"
+#include "AliRun.h"
 #include "AliMC.h"
-#include <TClass.h>
-#include <TNode.h>
-#include <TRandom.h>
 
-// Static variables for the hit iterator routines
-static Int_t sMaxIterHit=0;
-static Int_t sCurIterHit=0;
 
 ClassImp(AliDetector)
  
-//_____________________________________________________________________________
-AliDetector::AliDetector()
+//_______________________________________________________________________
+AliDetector::AliDetector():
+  AliModule(),
+  fTimeGate(200.e-9),
+  fIshunt(0),
+  fNhits(0),
+  fNdigits(0),
+  fBufferSize(1600),
+  fMaxIterHit(0),
+  fCurIterHit(0),
+  fHits(0),
+  fDigits(0),
+  fPoints(0),
+  fLoader(0x0)
 {
   //
   // Default constructor for the AliDetector class
   //
-  fNhits      = 0;
-  fNdigits    = 0;
-  fHistograms = 0;
-  fNodes      = 0;
-  fPoints     = 0;
-  fHits       = 0;
-  fDigits     = 0;
-  fTimeGate   = 200.e-9;
-  fActive     = kTRUE;
-  fBufferSize = 16000;
 }
  
+//_______________________________________________________________________
+AliDetector::AliDetector(const AliDetector &det):
+  AliModule(det),
+  fTimeGate(200.e-9),
+  fIshunt(0),
+  fNhits(0),
+  fNdigits(0),
+  fBufferSize(1600),
+  fMaxIterHit(0),
+  fCurIterHit(0),
+  fHits(0),
+  fDigits(0),
+  fPoints(0),
+  fLoader(0x0)
+{
+  det.Copy(*this);
+}
+
 //_____________________________________________________________________________
-AliDetector::AliDetector(const char* name,const char *title):TNamed(name,title)
+AliDetector::AliDetector(const char* name,const char *title):
+  AliModule(name,title),
+  fTimeGate(200.e-9),
+  fIshunt(0),
+  fNhits(0),
+  fNdigits(0),
+  fBufferSize(1600),
+  fMaxIterHit(0),
+  fCurIterHit(0),
+  fHits(0),
+  fDigits(0),
+  fPoints(0),
+  fLoader(0x0)
 {
   //
   // Normal constructor invoked by all Detectors.
@@ -57,70 +107,93 @@ AliDetector::AliDetector(const char* name,const char *title):TNamed(name,title)
   // Add this Detector to the global list of Detectors in Run.
   //
 
-  fTimeGate   = 200.e-9;
   fActive     = kTRUE;
-  fNhits      = 0;
-  fHits       = 0;
-  fDigits     = 0;
-  fNdigits    = 0;
-  fPoints     = 0;
-  fBufferSize = 16000;
-  //
-  // Initialises the histogram list
-  fHistograms = new TList();
-  //
-  // Initialises the list of ROOT TNodes
-  fNodes      = new TList();
-  //  
-  // Get the detector numeric ID
-  Int_t id = gAlice->GetDetectorID(name);
-  if (id < 0) {
-    // Unknown detector !
-     printf(" * AliRun::Ctor * ERROR Unknown detector: %s\n",name);
-     return;
-  }
-  //
-  // Add this detector to the list of detectors
-  gAlice->Detectors()->AddAtAndExpand(this,id);
-  //
-  //
-  SetMarkerColor(3);
-  //
-  // Allocate space for tracking media and material indexes
-  fIdtmed = new TArrayI(100);
-  fIdmate  = new TArrayI(100);
-  for(Int_t i=0;i<100;i++) (*fIdmate)[i]=(*fIdtmed)[i]=0;
-  //
-  // Prepare to find the tracking media range
-  fLoMedium = 65536;
-  fHiMedium = 0;
+  AliConfig::Instance()->Add(this);
+
 }
  
-//_____________________________________________________________________________
+//_______________________________________________________________________
 AliDetector::~AliDetector()
 {
   //
   // Destructor
   //
-  fNhits      = 0;
-  fNdigits    = 0;
-  fHistograms = 0;
-  //
-  // Delete ROOT geometry
-  fNodes->Clear();
-  delete fNodes;
-  //
+
   // Delete space point structure
-  if (fPoints) fPoints->Delete();
-  delete fPoints;
-  fPoints     = 0;
-  //
-  // Delete TArray objects
-  delete fIdtmed;
-  delete fIdmate;
+  if (fPoints) {
+    fPoints->Delete();
+    delete fPoints;
+    fPoints     = 0;
+  }
+  // Delete digits structure
+  if (fDigits) {
+    fDigits->Delete();
+    delete fDigits;
+    fDigits     = 0;
+  }
+
+  if (fLoader)
+   {
+    fLoader->GetModulesFolder()->Remove(this);
+   }
+
 }
-//_____________________________________________________________________________
+
+//_______________________________________________________________________
+void AliDetector::Publish(const char */*dir*/, void */*address*/, const char */*name*/) const
+{
+//
+// Register pointer to detector objects. 
+// 
+  MayNotUse("Publish");
+}
+
+//_______________________________________________________________________
+TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name, 
+                                       void* address, Int_t size,
+                                       const char *file)
+{ 
+    return(MakeBranchInTree(tree,name,0,address,size,99,file));
+}
+
+//_______________________________________________________________________
+TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name, 
+                                       const char *classname, 
+                                       void* address,Int_t size, 
+                                       Int_t splitlevel, const char */*file*/)
+{ 
+//
+// Makes branch in given tree and diverts them to a separate file
+// 
+//
+//
+    
+ AliDebug(2,Form("Making Branch %s",name));
+ if (tree == 0x0) 
+  {
+   AliError(Form("Making Branch %s Tree is NULL",name));
+   return 0x0;
+  }
+ TBranch *branch = tree->GetBranch(name);
+ if (branch) 
+  {  
+    AliDebug(2,Form("Branch %s is already in tree.",name));
+    return branch;
+  }
+    
+ if (classname) 
+  {
+    branch = tree->Branch(name,classname,address,size,splitlevel);
+  } 
+ else 
+  {
+    branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel);
+  }
+ AliDebug(2,Form("Branch %s returning branch %#x",name,branch));
+ return branch;
+}
+
+//_______________________________________________________________________
 void AliDetector::Browse(TBrowser *b)
 {
   //
@@ -139,51 +212,16 @@ void AliDetector::Browse(TBrowser *b)
   }
 }
 
-//_____________________________________________________________________________
-void AliDetector::Disable()
-{
-  //
-  // Disable detector on viewer
-  //
-  fActive = kFALSE;
-  TIter next(fNodes);
-  TNode *node;
-  //
-  // Loop through geometry to disable all
-  // nodes for this detector
-  while((node = (TNode*)next())) {
-    node->SetVisibility(0);
-  }   
-}
-
-//_____________________________________________________________________________
-Int_t AliDetector::DistancetoPrimitive(Int_t, Int_t)
+//_______________________________________________________________________
+void AliDetector::Copy(TObject &) const
 {
   //
-  // Return distance from mouse pointer to object
-  // Dummy routine for the moment
+  // Copy *this onto det -- not implemented
   //
-  return 9999;
+  AliFatal("Not implemented");
 }
 
-//_____________________________________________________________________________
-void AliDetector::Enable()
-{
-  //
-  // Enable detector on the viewver
-  //
-  fActive = kTRUE;
-  TIter next(fNodes);
-  TNode *node;
-  //
-  // Loop through geometry to enable all
-  // nodes for this detector
-  while((node = (TNode*)next())) {
-    node->SetVisibility(1);
-  }   
-}
-
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliDetector::FinishRun()
 {
   //
@@ -191,7 +229,7 @@ void AliDetector::FinishRun()
   //
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 AliHit* AliDetector::FirstHit(Int_t track)
 {
   //
@@ -202,215 +240,155 @@ AliHit* AliDetector::FirstHit(Int_t track)
   // track is returned
   // 
   if(track>=0) {
-    gAlice->ResetHits();
-    gAlice->TreeH()->GetEvent(track);
+    gAlice->ResetHits(); //stupid = if N detector this method is called N times
+    TreeH()->GetEvent(track); //skowron
   }
   //
-  sMaxIterHit=fHits->GetEntriesFast();
-  sCurIterHit=0;
-  if(sMaxIterHit) return (AliHit*) fHits->UncheckedAt(0);
+  fMaxIterHit=fHits->GetEntriesFast();
+  fCurIterHit=0;
+  if(fMaxIterHit) return dynamic_cast<AliHit*>(fHits->UncheckedAt(0));
   else            return 0;
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 AliHit* AliDetector::NextHit()
 {
   //
   // Return the next hit for the current track
   //
-  if(sMaxIterHit) {
-    if(++sCurIterHit<sMaxIterHit) 
-      return (AliHit*) fHits->UncheckedAt(sCurIterHit);
+  if(fMaxIterHit) {
+    if(++fCurIterHit<fMaxIterHit) 
+      return dynamic_cast<AliHit*>(fHits->UncheckedAt(fCurIterHit));
     else        
       return 0;
   } else {
-    printf("* AliDetector::NextHit * Hit Iterator called without calling FistHit before\n");
+    AliWarning("Hit Iterator called without calling FistHit before");
     return 0;
   }
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliDetector::LoadPoints(Int_t)
 {
   //
   // Store x, y, z of all hits in memory
   //
-  if (fHits == 0) return;
+  if (fHits == 0) 
+   {
+    AliError(Form("fHits == 0. Name is %s",GetName()));
+    return;
+   }
   //
-  if (fPoints == 0) fPoints = new TObjArray(gAlice->GetNtrack());
   Int_t nhits = fHits->GetEntriesFast();
-  if (nhits == 0) return;
+  if (nhits == 0) 
+   {
+//    Error("LoadPoints","nhits == 0. Name is %s",GetName());
+    return;
+   }
+  Int_t tracks = gAlice->GetMCApp()->GetNtrack();
+  if (fPoints == 0) fPoints = new TObjArray(tracks);
   AliHit *ahit;
   //
+  Int_t *ntrk=new Int_t[tracks];
+  Int_t *limi=new Int_t[tracks];
+  Float_t **coor=new Float_t*[tracks];
+  for(Int_t i=0;i<tracks;i++) {
+    ntrk[i]=0;
+    coor[i]=0;
+    limi[i]=0;
+  }
+  //
   AliPoints *points = 0;
-  Int_t trko=-99, trk;
+  Float_t *fp=0;
+  Int_t trk;
+  Int_t chunk=nhits/4+1;
   //
   // Loop over all the hits and store their position
   for (Int_t hit=0;hit<nhits;hit++) {
-    ahit = (AliHit*)fHits->UncheckedAt(hit);
-    if(trko!=(trk=ahit->GetTrack())) {
+    ahit = dynamic_cast<AliHit*>(fHits->UncheckedAt(hit));
+    trk=ahit->GetTrack();
+    if(trk>tracks) {
+      AliError(Form("Found track number %d, max track %d",trk, tracks));
+      continue;
+    }
+    if(ntrk[trk]==limi[trk])
+     {
       //
       // Initialise a new track
-      trko=trk;
-      points = new AliPoints(nhits);
-      fPoints->AddAt(points,trk);
+      fp=new Float_t[3*(limi[trk]+chunk)];
+      if(coor[trk]) 
+       {
+          memcpy(fp,coor[trk],sizeof(Float_t)*3*limi[trk]);
+          delete [] coor[trk];
+       }
+      limi[trk]+=chunk;
+      coor[trk] = fp;
+     } 
+    else 
+     {
+      fp = coor[trk];
+     }
+    fp[3*ntrk[trk]  ] = ahit->X();
+    fp[3*ntrk[trk]+1] = ahit->Y();
+    fp[3*ntrk[trk]+2] = ahit->Z();
+    ntrk[trk]++;
+  }
+  //
+  for(trk=0; trk<tracks; ++trk) {
+    if(ntrk[trk]) {
+      points = new AliPoints();
       points->SetMarkerColor(GetMarkerColor());
-      points->SetMarkerStyle(GetMarkerStyle());
       points->SetMarkerSize(GetMarkerSize());
       points->SetDetector(this);
       points->SetParticle(trk);
+      points->SetPolyMarker(ntrk[trk],coor[trk],GetMarkerStyle());
+      fPoints->AddAt(points,trk);
+      delete [] coor[trk];
+      coor[trk]=0;
     }
-    points->SetPoint(hit,ahit->fX,ahit->fY,ahit->fZ);
   }
+  delete [] coor;
+  delete [] ntrk;
+  delete [] limi;
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliDetector::MakeBranch(Option_t *option)
 {
   //
-  // Create a new branch in the current Root Tree
-  // The branch of fHits is automatically split
-  //
-  char branchname[10];
-  sprintf(branchname,"%s",GetName());
+  // Create a new branch for this detector in its treeH
   //
-  // Get the pointer to the header
-  char *H = strstr(option,"H");
-  //
-  if (fHits   && gAlice->TreeH() && H) {
-    gAlice->TreeH()->Branch(branchname,&fHits, fBufferSize);
-    printf("* AliDetector::MakeBranch * Making Branch %s for hits\n",branchname);
-  }    
-}
 
-//_____________________________________________________________________________
-void AliDetector::AliMaterial(Int_t imat, const char* name, Float_t a, 
-                             Float_t z, Float_t dens, Float_t radl,
-                             Float_t absl, Float_t *buf, Int_t nwbuf) const
-{
-  //
-  // Store the parameters for a material
-  //
-  // imat        the material index will be stored in (*fIdmate)[imat]
-  // name        material name
-  // a           atomic mass
-  // z           atomic number
-  // dens        density
-  // radl        radiation length
-  // absl        absorbtion length
-  // buf         adress of an array user words
-  // nwbuf       number of user words
-  //
-  Int_t kmat;
-  AliMC::GetMC()->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
-  (*fIdmate)[imat]=kmat;
-}
-  
+  AliDebug(2,Form(" for %s",GetName()));
+  const char *cH = strstr(option,"H");
 
-//_____________________________________________________________________________
-void AliDetector::AliMixture(Int_t imat, const char *name, Float_t *a,
-                            Float_t *z, Float_t dens, Int_t nlmat,
-                            Float_t *wmat) const
-{ 
-  //
-  // Defines mixture or compound imat as composed by 
-  // nlmat materials defined by arrays a, z and wmat
-  // 
-  // If nlmat > 0 wmat contains the proportion by
-  // weights of each basic material in the mixture  
-  // 
-  // If nlmat < 0 wmat contains the number of atoms 
-  // of eack kind in the molecule of the compound
-  // In this case, wmat is changed on output to the relative weigths.
-  //
-  // imat        the material index will be stored in (*fIdmate)[imat]
-  // name        material name
-  // a           array of atomic masses
-  // z           array of atomic numbers
-  // dens        density
-  // nlmat       number of components
-  // wmat        array of concentrations
-  //
-  Int_t kmat;
-  AliMC::GetMC()->Mixture(kmat, name, a, z, dens, nlmat, wmat);
-  (*fIdmate)[imat]=kmat;
-} 
-//_____________________________________________________________________________
-void AliDetector::AliMedium(Int_t numed, const char *name, Int_t nmat,
-                           Int_t isvol, Int_t ifield, Float_t fieldm,
-                           Float_t tmaxfd, Float_t stemax, Float_t deemax,
-                           Float_t epsil, Float_t stmin, Float_t *ubuf,
-                           Int_t nbuf) const
-{ 
-  //
-  // Store the parameters of a tracking medium
-  //
-  // numed       the medium number is stored into (*fIdtmed)[numed-1]
-  // name        medium name
-  // nmat        the material number is stored into (*fIdmate)[nmat]
-  // isvol       sensitive volume if isvol!=0
-  // ifield      magnetic field flag (see below)
-  // fieldm      maximum magnetic field
-  // tmaxfd      maximum deflection angle due to magnetic field
-  // stemax      maximum step allowed
-  // deemax      maximum fractional energy loss in one step
-  // epsil       tracking precision in cm
-  // stmin       minimum step due to continuous processes
-  //
-  // ifield =  0       no magnetic field
-  //        = -1       user decision in guswim
-  //        =  1       tracking performed with Runge Kutta
-  //        =  2       tracking performed with helix
-  //        =  3       constant magnetic field along z
-  //  
-  Int_t kmed;
-  Int_t *idtmed = gAlice->Idtmed();
-  AliMC::GetMC()->Medium(kmed,name, (*fIdmate)[nmat], isvol, ifield, fieldm,
-                        tmaxfd, stemax, deemax, epsil, stmin, ubuf, nbuf); 
-  idtmed[numed-1]=kmed;
-} 
-//_____________________________________________________________________________
-void AliDetector::AliMatrix(Int_t &nmat, Float_t theta1, Float_t phi1,
-                           Float_t theta2, Float_t phi2, Float_t theta3,
-                           Float_t phi3) const
-{
-  // 
-  // Define a rotation matrix. Angles are in degrees.
-  //
-  // nmat        on output contains the number assigned to the rotation matrix
-  // theta1      polar angle for axis I
-  // phi1        azimuthal angle for axis I
-  // theta2      polar angle for axis II
-  // phi2        azimuthal angle for axis II
-  // theta3      polar angle for axis III
-  // phi3        azimuthal angle for axis III
-  //
-  AliMC::GetMC()->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3); 
-} 
+  if (fHits && TreeH() && cH) 
+   {
+     MakeBranchInTree(TreeH(), GetName(), &fHits, fBufferSize, 0);
+   }   
+}
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliDetector::ResetDigits()
 {
   //
   // Reset number of digits and the digits array
   //
   fNdigits   = 0;
-  if (fDigits)   fDigits->Clear();
+  if (fDigits) fDigits->Clear();
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliDetector::ResetHits()
 {
   //
   // Reset number of hits and the hits array
   //
   fNhits   = 0;
-  if (fHits)   fHits->Clear();
+  if (fHits) fHits->Clear();
 }
 
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliDetector::ResetPoints()
 {
   //
@@ -423,102 +401,84 @@ void AliDetector::ResetPoints()
   }
 }
 
-  
-//_____________________________________________________________________________
-void AliDetector::StepManager()
-{
-  //
-  // Procedure called at every step inside the detector
-  //
-  printf("* AliDetector::StepManager * Generic Step Manager called for Detector: %s\n",fName.Data());
-}
-
-//_____________________________________________________________________________
-void AliDetector::SetEuclidFile(char* material, char* geometry)
-{
-  //
-  // Sets the name of the Euclid file
-  //
-  fEuclidMaterial=material;
-  if(geometry) {
-    fEuclidGeometry=geometry;
-  } else {
-    char* name = new char[strlen(material)];
-    strcpy(name,material);
-    strcpy(&name[strlen(name)-4],".euc");
-    fEuclidGeometry=name;
-    delete [] name;
-  }
-}
-//_____________________________________________________________________________
+//_______________________________________________________________________
 void AliDetector::SetTreeAddress()
 {
   //
   // Set branch address for the Hits and Digits Trees
   //
   TBranch *branch;
-  char branchname[20];
-  sprintf(branchname,"%s",GetName());
   //
   // Branch address for hit tree
-  TTree *treeH = gAlice->TreeH();
-  if (treeH && fHits) {
-    branch = treeH->GetBranch(branchname);
-    if (branch) branch->SetAddress(&fHits);
+  
+  TTree *tree = TreeH();
+  if (tree && fHits) {
+    branch = tree->GetBranch(GetName());
+    if (branch) 
+     {
+       AliDebug(2,Form("(%s) Setting for Hits",GetName()));
+       branch->SetAddress(&fHits);
+     }
+    else
+     { //can be invoked before branch creation
+       AliDebug(2,Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
+     }
   }
+  
   //
   // Branch address for digit tree
-  TTree *treeD = gAlice->TreeD();
+  TTree *treeD = fLoader->TreeD();
   if (treeD && fDigits) {
-    branch = treeD->GetBranch(branchname);
+    branch = treeD->GetBranch(GetName());
     if (branch) branch->SetAddress(&fDigits);
   }
+  
+  AliModule::SetTreeAddress();
 }
 
-//_____________________________________________________________________________
-void AliDetector::Streamer(TBuffer &R__b)
-{
-  //
-  // Stream an object of class Detector.
-  //
-  if (R__b.IsReading()) {
-    Version_t R__v = R__b.ReadVersion(); if (R__v) { }
-    TNamed::Streamer(R__b);
-    TAttLine::Streamer(R__b);
-    TAttMarker::Streamer(R__b);
-    fEuclidMaterial.Streamer(R__b);
-    fEuclidGeometry.Streamer(R__b);
-    R__b >> fTimeGate;
-    R__b >> fActive;
-    R__b >> fIshunt;
-    //R__b >> fNhits;
-    R__b >> fHistograms;
-    //
-    // Stream the pointers but not the TClonesArrays
-    R__b >> fNodes; // diff
-
-    R__b >> fHits; // diff
-    R__b >> fDigits; // diff
-    
-  } else {
-    R__b.WriteVersion(AliDetector::IsA());
-    TNamed::Streamer(R__b);
-    TAttLine::Streamer(R__b);
-    TAttMarker::Streamer(R__b);
-    fEuclidMaterial.Streamer(R__b);
-    fEuclidGeometry.Streamer(R__b);
-    R__b << fTimeGate;
-    R__b << fActive;
-    R__b << fIshunt;
-    //R__b << fNhits;
-    R__b << fHistograms;
-    //
-    // Stream the pointers but not the TClonesArrays
-    R__b << fNodes; // diff
-    
-    R__b << fHits; // diff
-    R__b << fDigits; // diff
-  }
+//_______________________________________________________________________
+void AliDetector::MakeTree(Option_t *option)
+ {
+ //makes a tree (container) for the data defined in option
+ //"H" - hits
+ //"D" - digits
+ //"S" - summable digits
+ //"R" - recontructed points and tracks
+    AliLoader* loader = GetLoader();
+    if (loader == 0x0)
+     {
+       AliError(Form("Can not get loader for %s",GetName()));
+       return;
+     }
+    loader->MakeTree(option); //delegate this job to getter
+ }
+
+//_______________________________________________________________________
+AliLoader* AliDetector::MakeLoader(const char* topfoldername)
+{ 
+//builds standard getter (AliLoader type)
+//if detector wants to use castomized getter, it must overload this method
+
+ AliDebug(1,Form("Creating standard getter for detector %s. Top folder is %s.",
+         GetName(),topfoldername));
+     
+ fLoader = new AliLoader(GetName(),topfoldername);
+ return fLoader;
 }
+
+//_______________________________________________________________________
+TTree* AliDetector::TreeH() const
+{
+//Get the hits container from the folder
+  if (GetLoader() == 0x0) 
+    {
+    //sunstitude this with make getter when we can obtain the event folder name 
+     AliError("Can not get the getter");
+     return 0x0;
+    }
  
+  TTree* tree = (TTree*)GetLoader()->TreeH();
+  return tree;
+}
+