]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliStack.cxx
Splitting of TRD library (T.Kuhr)
[u/mrichter/AliRoot.git] / STEER / AliStack.cxx
index 3f9e663ab0e01d7a4aef4ec2b8a734e39034235f..8b5128b5d64dfe961b25bbbe509905817bf4f85c 100644 (file)
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
-//  Particles stack class
+//  Particles stack class                                                    //
+//  Implements the TMCVirtualStack of the Virtual Monte Carlo                //
+//  Holds the particles transported during simulation                        //
+//  Is used to compare results of reconstruction with simulation             //
+//  Author A.Morsch                                                          //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
  
-#include <TFile.h>
-#include <TFolder.h>
 #include <TObjArray.h>
 #include <TParticle.h>
 #include <TParticlePDG.h>
@@ -32,6 +34,7 @@
 #include "AliHit.h"
 #include "AliModule.h"
 #include "AliRun.h"
+#include "AliMC.h"
 #include "AliRunLoader.h"
 #include "AliStack.h"
 
@@ -50,7 +53,7 @@ AliStack::AliStack():
   fCurrentPrimary(-1),
   fHgwmk(0),
   fLoadPoint(0),
-  fEventFolderName(AliConfig::fgkDefaultEventFolderName)
+  fEventFolderName(AliConfig::GetDefaultEventFolderName())
 {
   //
   // Default constructor
@@ -99,7 +102,7 @@ AliStack::AliStack(const AliStack& st):
 }
 
 //_______________________________________________________________________
-void AliStack::Copy(AliStack&) const
+void AliStack::Copy(TObject&) const
 {
   Fatal("Copy","Not implemented!\n");
 }
@@ -359,7 +362,7 @@ void AliStack::PurifyKine()
   }
   
   // Now loop on all registered hit lists
-  TList* hitLists = gAlice->GetHitLists();
+  TList* hitLists = gAlice->GetMCApp()->GetHitLists();
   TIter next(hitLists);
   TCollection *hitList;
   while((hitList = dynamic_cast<TCollection*>(next()))) {
@@ -374,7 +377,7 @@ void AliStack::PurifyKine()
   // This for detectors which have a special mapping mechanism
   // for hits, such as TPC and TRD
   //
-
+  
    TObjArray* modules = gAlice->Modules();
    TIter nextmod(modules);
    AliModule *detector;
@@ -382,7 +385,9 @@ void AliStack::PurifyKine()
      detector->RemapTrackHitIDs(map.GetArray());
      detector->RemapTrackReferencesIDs(map.GetArray());
    }
-  
+   //
+   gAlice->GetMCApp()->RemapTrackReferencesIDs(map.GetArray());
+
    // Now the output bit, from fHgwmk to nkeep we write everything and we erase
    if(nkeep>fParticleFileMap.GetSize()) fParticleFileMap.Set(Int_t (nkeep*1.5));
 
@@ -795,13 +800,17 @@ TTree* AliStack::TreeK()
         return 0x0;//pro forma
       }
     fTreeK = rl->TreeK();
-    if ( fTreeK == 0x0)
+    if ( fTreeK )
      {
-      Error("TreeK","Can not get TreeK from RL. Ev. Folder is %s",fEventFolderName.Data());
+      ConnectTree();
      }
     else
      {
-      ConnectTree();
+      //don't panic - could be Lego
+      if (AliLoader::GetDebug()) 
+       { 
+         Warning("TreeK","Can not get TreeK from RL. Ev. Folder is %s",fEventFolderName.Data());
+       } 
      }
    }
   return fTreeK;//never reached
@@ -813,7 +822,7 @@ void AliStack::ConnectTree()
 //
 //  Creates branch for writing particles
 //
-  if (AliLoader::fgDebug) Info("ConnectTree","Connecting TreeK");
+  if (AliLoader::GetDebug()) Info("ConnectTree","Connecting TreeK");
   if (fTreeK == 0x0)
    {
     if (TreeK() == 0x0)
@@ -828,31 +837,31 @@ void AliStack::ConnectTree()
 
  //  Create a branch for particles   
   
-  if (AliLoader::fgDebug
+  if (AliLoader::GetDebug()
    Info("ConnectTree","Tree name is %s",fTreeK->GetName());
    
   if (fTreeK->GetDirectory())
    {
-     if (AliLoader::fgDebug)    
+     if (AliLoader::GetDebug())    
       Info("ConnectTree","and dir is %s",fTreeK->GetDirectory()->GetName());
    }    
   else
     Warning("ConnectTree","DIR IS NOT SET !!!");
   
-  TBranch *branch=fTreeK->GetBranch(AliRunLoader::fgkKineBranchName);
+  TBranch *branch=fTreeK->GetBranch(AliRunLoader::GetKineBranchName());
   if(branch == 0x0)
    {
-    branch = fTreeK->Branch(AliRunLoader::fgkKineBranchName, "TParticle", &fParticleBuffer, 4000);
-    if (AliLoader::fgDebug) Info("ConnectTree","Creating Branch in Tree");
+    branch = fTreeK->Branch(AliRunLoader::GetKineBranchName(), "TParticle", &fParticleBuffer, 4000);
+    if (AliLoader::GetDebug()) Info("ConnectTree","Creating Branch in Tree");
    }  
   else
    {
-    if (AliLoader::fgDebug) Info("ConnectTree","Branch Found in Tree");
+    if (AliLoader::GetDebug()) Info("ConnectTree","Branch Found in Tree");
     branch->SetAddress(&fParticleBuffer);
    }
   if (branch->GetDirectory())
    {
-    if (AliLoader::fgDebug
+    if (AliLoader::GetDebug()
       Info("ConnectTree","Branch Dir Name is %s",branch->GetDirectory()->GetName());
    } 
   else