]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliStack.h
Transition to NewIO
[u/mrichter/AliRoot.git] / STEER / AliStack.h
index 094288bb748339080e8d69be290285beaff152c8..729ff171df63b2b73c4733f2a356ee63c67fbb21 100644 (file)
@@ -5,45 +5,52 @@
 
 /* $Id$ */
 
-#include <TObject.h>
 #include <TArrayI.h>
-#include <TStopwatch.h>
+#include <TVirtualMCStack.h>
 
-#include "AliMCProcess.h"
+#include "AliConfig.h"
 
-class TObjArray;
-class TClonesArray;
-class TParticle;
 class AliHeader;
+class TClonesArray;
 class TFile;
+class TObjArray;
+class TParticle;
 class TTree;
+class TString;
 
-
-
-class AliStack : public TObject
+class AliStack : public TVirtualMCStack
 {
   public:
     // creators, destructors
-    AliStack(Int_t size);
+    AliStack(Int_t size, const char* evfoldname = AliConfig::fgkDefaultEventFolderName);
     AliStack();
+    AliStack(const AliStack& st);
     virtual ~AliStack();
+    AliStack& operator=(const AliStack& st)
+      {st.Copy(*this); return(*this);}
 
     // methods
-    void  MakeTree(Int_t event, const char *file);
-    void  BeginEvent(Int_t event);
+
+    virtual void  SetTrack(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,
+                           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);    
+
+    void  ConnectTree();
+    void  BeginEvent();
     void  FinishRun();
-    void  GetEvent(Int_t nevent);
-    void  SetTrack(Int_t done, Int_t parent, Int_t pdg, 
-                  Float_t *pmom, Float_t *vpos, Float_t *polar, 
-                   Float_t tof, AliMCProcess mech, Int_t &ntr,
-                   Float_t weight=1);
-    void  SetTrack(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,
-                  AliMCProcess mech, Int_t &ntr, Float_t weight=1);
-    void  GetNextTrack(Int_t &mtrack, Int_t &ipart, Float_t *pmom,
-                  Float_t &e, Float_t *vpos, Float_t *polar, Float_t &tof);
+    Bool_t GetEvent();
     void  PurifyKine();
     void  FinishEvent();
     void  FlagTrack(Int_t track);
@@ -55,29 +62,37 @@ class AliStack : public TObject
 
     // set methods
     void  SetNtrack(Int_t ntrack);
-    void  SetCurrentTrack(Int_t track);                           
+    virtual void  SetCurrentTrack(Int_t track);                           
     void  SetHighWaterMark(Int_t hgwmk);    
     // get methods
-    Int_t       GetNtrack() const;
+    virtual Int_t GetNtrack() const;
     Int_t       GetNprimary() const;
-    Int_t       CurrentTrack() const;
+    virtual Int_t CurrentTrack() const;
+    virtual Int_t CurrentTrackParent() const;
     TObjArray*  Particles() const;
     TParticle*  Particle(Int_t id);
-    Int_t       GetPrimary(Int_t id) const;
-    TTree*      TreeK() const {return fTreeK;}
+    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;
     
   protected:
     // methods
     void  CleanParents();
     void  ResetArrays(Int_t size);
     TParticle* GetNextParticle();
+    Bool_t KeepPhysics(TParticle* part);
     
   private:
+    void Copy(AliStack &st) const;
+
     // data members
     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
     TTree         *fTreeK;             //! Particle stack  
     Int_t          fNtrack;            //  Number of tracks
     Int_t          fNprimary;          //  Number of primaries
@@ -85,8 +100,9 @@ class AliStack : public TObject
     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
-    TStopwatch     fTimer;             //! Timer object
-    ClassDef(AliStack,1) //Particles stack
+    
+    TString        fEventFolderName;   //! Folder name where event is mounted
+    ClassDef(AliStack,4) //Particles stack
 };
 
 // inline