]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliStack.h
Loop over mc and aod possible. (A. Mastroserio)
[u/mrichter/AliRoot.git] / STEER / AliStack.h
index 729ff171df63b2b73c4733f2a356ee63c67fbb21..70d089b90f0dcfb46194c1ea21793ed897bb46b9 100644 (file)
@@ -5,24 +5,29 @@
 
 /* $Id$ */
 
-#include <TArrayI.h>
-#include <TVirtualMCStack.h>
+//  Particles stack class
+//  Implements the TMCVirtualStack of the Virtual Monte Carlo
+//  Author A.Morsch
 
-#include "AliConfig.h"
-
-class AliHeader;
 class TClonesArray;
 class TFile;
 class TObjArray;
 class TParticle;
-class TTree;
 class TString;
+class TTree;
+#include <TClonesArray.h>
+#include <TArrayI.h>
+#include <TVirtualMCStack.h>
+
+class AliHeader;
+
+enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4, kTransportBit=BIT(14)};
 
 class AliStack : public TVirtualMCStack
 {
   public:
     // creators, destructors
-    AliStack(Int_t size, const char* evfoldname = AliConfig::fgkDefaultEventFolderName);
+    AliStack(Int_t size, const char* name = "");
     AliStack();
     AliStack(const AliStack& st);
     virtual ~AliStack();
@@ -31,34 +36,34 @@ class AliStack : public TVirtualMCStack
 
     // methods
 
-    virtual void  SetTrack(Int_t done, Int_t parent, Int_t pdg, 
+    virtual void  PushTrack(Int_t done, Int_t parent, Int_t pdg, 
                            Float_t *pmom, Float_t *vpos, Float_t *polar, 
                            Float_t tof, TMCProcess mech, Int_t &ntr,
                            Float_t weight, Int_t is);
 
-    virtual void  SetTrack(Int_t done, Int_t parent, Int_t pdg,
+    virtual void  PushTrack(Int_t done, Int_t parent, Int_t pdg,
                            Double_t px, Double_t py, Double_t pz, Double_t e,
                            Double_t vx, Double_t vy, Double_t vz, Double_t tof,
                            Double_t polx, Double_t poly, Double_t polz,
                            TMCProcess mech, Int_t &ntr, Double_t weight,
                            Int_t is);
 
-    virtual TParticle* GetNextTrack(Int_t& track);
-    virtual TParticle* GetCurrentTrack() {return fCurrentTrack;}
-    virtual TParticle* GetPrimaryForTracking(Int_t i);    
+    virtual TParticle* PopNextTrack(Int_t& track);
+    virtual TParticle* GetCurrentTrack() const {return fCurrentTrack;}
+    virtual TParticle* PopPrimaryForTracking(Int_t i);    
 
-    void  ConnectTree();
-    void  BeginEvent();
-    void  FinishRun();
+    void   ConnectTree(TTree* tree);
     Bool_t GetEvent();
-    void  PurifyKine();
-    void  FinishEvent();
-    void  FlagTrack(Int_t track);
-    void  KeepTrack(Int_t itrack); 
-    void  Reset(Int_t size = 0);
-    void  DumpPart(Int_t i) const;
-    void  DumpPStack ();
-    void  DumpLoadedStack () const;
+    Bool_t PurifyKine();
+    Bool_t ReorderKine();
+    void   FinishEvent();
+    void   FlagTrack(Int_t track);
+    void   KeepTrack(Int_t itrack); 
+    void   Clean(Int_t size = 0);
+    void   Reset(Int_t size = 0);
+    void   DumpPart(Int_t i) const;
+    void   DumpPStack ();
+    void   DumpLoadedStack () const;
 
     // set methods
     void  SetNtrack(Int_t ntrack);
@@ -67,15 +72,17 @@ class AliStack : public TVirtualMCStack
     // get methods
     virtual Int_t GetNtrack() const;
     Int_t       GetNprimary() const;
-    virtual Int_t CurrentTrack() const;
-    virtual Int_t CurrentTrackParent() const;
-    TObjArray*  Particles() const;
+    virtual Int_t GetCurrentTrackNumber() const;
+    virtual Int_t GetCurrentParentTrackNumber() const;
     TParticle*  Particle(Int_t id);
     Int_t       GetPrimary(Int_t id);
     TTree*      TreeK();
-    void        SetEventFolderName(const char* foldname);
     TParticle*  ParticleFromTreeK(Int_t id) const;
     Int_t       TreeKEntry(Int_t id) const;
+    Bool_t      IsPhysicalPrimary(Int_t i);
+    Int_t       TrackLabel(Int_t label) {return fTrackLabelMap[label];}
+    Int_t*      TrackLabelMap() {return fTrackLabelMap.GetArray();}
+    const TObjArray*  Particles() const;
     
   protected:
     // methods
@@ -83,13 +90,13 @@ class AliStack : public TVirtualMCStack
     void  ResetArrays(Int_t size);
     TParticle* GetNextParticle();
     Bool_t KeepPhysics(TParticle* part);
-    
+    Bool_t IsStable(Int_t pdg) const;
   private:
-    void Copy(AliStack &st) const;
+    void Copy(TObject &st) const;
 
     // data members
-    TClonesArray  *fParticles;         //! Pointer to list of particles
-    TObjArray     *fParticleMap;       //! Map of particles in the supporting TClonesArray
+    TClonesArray   fParticles;         //! Pointer to list of particles
+    TObjArray      fParticleMap;       //! Map of particles in the supporting TClonesArray
     TArrayI        fParticleFileMap;   //  Map for particle ids 
     TParticle     *fParticleBuffer;    //! Pointer to current particle for writing
     TParticle     *fCurrentTrack;      //! Pointer to particle currently transported
@@ -100,9 +107,8 @@ class AliStack : public TVirtualMCStack
     Int_t          fCurrentPrimary;    //! Last primary track returned from the stack
     Int_t          fHgwmk;             //! Last track purified
     Int_t          fLoadPoint;         //! Next free position in the particle buffer
-    
-    TString        fEventFolderName;   //! Folder name where event is mounted
-    ClassDef(AliStack,4) //Particles stack
+    TArrayI        fTrackLabelMap;     //! Map of track labels
+    ClassDef(AliStack,5) //Particles stack
 };
 
 // inline
@@ -119,10 +125,10 @@ inline Int_t AliStack::GetNtrack() const
 inline Int_t AliStack::GetNprimary() const
 { return fNprimary; }
 
-inline Int_t AliStack::CurrentTrack() const 
+inline Int_t AliStack::GetCurrentTrackNumber() const 
 { return fCurrent; }
 
-inline TObjArray* AliStack::Particles() const
-{ return fParticleMap; }
+inline const TObjArray* AliStack::Particles() const
+{ return &fParticleMap; }
 
 #endif //ALI_STACK_H