]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliStack.h
Coding conventions (F.Carminati)
[u/mrichter/AliRoot.git] / STEER / AliStack.h
index eb2bfcb8e7d089b814fbe0cb2ab20d32b541bd46..961af6ded84f064747c5b695fc675f437de53e8d 100644 (file)
@@ -5,46 +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::GetDefaultEventFolderName());
     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  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  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* PopNextTrack(Int_t& track);
+    virtual TParticle* GetCurrentTrack() const {return fCurrentTrack;}
+    virtual TParticle* PopPrimaryForTracking(Int_t i);    
+
+    void  ConnectTree();
+    void  BeginEvent();
     void  FinishRun();
-    Bool_t 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, Int_t is = 0);
-    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,
-                  Int_t is = 0);
-    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);
@@ -56,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 GetCurrentTrackNumber() const;
+    virtual Int_t GetCurrentParentTrackNumber() const;
     TObjArray*  Particles() const;
     TParticle*  Particle(Int_t id);
     Int_t       GetPrimary(Int_t id);
-    TTree*      TreeK() const {return fTreeK;}
+    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(TObject &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
@@ -86,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,2) //Particles stack
+    
+    TString        fEventFolderName;   //! Folder name where event is mounted
+    ClassDef(AliStack,4) //Particles stack
 };
 
 // inline
@@ -104,7 +119,7 @@ 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