]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TUHKMgen/UHKM/Particle.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / TUHKMgen / UHKM / Particle.h
index aa1b4b8420311b283dafef39e904a9c3e337bcff..3e676e99137e2f6201150f64f406f08ea0cff8f3 100644 (file)
@@ -1,34 +1,28 @@
-/*                                                                            
-                                                                            
-        Nikolai Amelin, Ludmila Malinina, Timur Pocheptsov (C) JINR/Dubna
-      amelin@sunhe.jinr.ru, malinina@sunhe.jinr.ru, pocheptsov@sunhe.jinr.ru 
-                           November. 2, 2005                                
+//                                                                            
+//                                                                            
+//        Nikolai Amelin, Ludmila Malinina, Timur Pocheptsov (C) JINR/Dubna
+//      amelin@sunhe.jinr.ru, malinina@sunhe.jinr.ru, pocheptsov@sunhe.jinr.ru 
+//                           November. 2, 2005                                
+//
+//
 
-*/
-
-#ifndef PARTICLE_INCLUDED
-#define PARTICLE_INCLUDED
+#ifndef PARTICLE_H
+#define PARTICLE_H
 
 #include <list>
+#include <iostream>
+using namespace std;
 
 #include <TLorentzRotation.h>
 #include <TLorentzVector.h>
 #include <TVector3.h>
-#ifndef PARTICLE_PDG
 #include "ParticlePDG.h"
-#endif
-#include <iostream>
-
-//class ParticlePDG;
 
 class Particle {
  public:
-
   Particle(const TLorentzVector &, const TLorentzVector &);
   Particle(const Particle& copy);
   Particle& operator=(const Particle&);
-
   virtual ~Particle() {};
   Particle(ParticlePDG *pdg = 0);
   Particle(ParticlePDG *pdg, const TLorentzVector &pos, const TLorentzVector &mom,
@@ -60,6 +54,9 @@ class Particle {
   TLorentzVector &Mom(){return fMomentum;}
   const TLorentzVector &Mom()const{return fMomentum;}
   TLorentzVector &Mom(const TLorentzVector &val){return fMomentum = val;}
+
+  void SetDecayed() {fDecayed = kTRUE;}
+  Bool_t GetDecayed() const {return fDecayed;}
                
   void Boost(const TVector3 &val){fMomentum.Boost(val);}
   void Boost(const TLorentzVector &val){fMomentum.Boost(val.BoostVector());}
@@ -77,41 +74,39 @@ class Particle {
 
   Int_t Encoding() const;
   Double_t TableMass() const;
-  ParticlePDG *Def() const {return fParticleProperties;}
-  ParticlePDG *Def(ParticlePDG *newProp) {return fParticleProperties = newProp;}
+  ParticlePDGDef() const {return fParticleProperties;}
+  void Def(ParticlePDG *newProp) {fParticleProperties = newProp;}
   //mother   
   void SetLastMotherPdg(Int_t value){fLastMotherPdg = value;}
   Int_t GetLastMotherPdg() const {return fLastMotherPdg;}
 
   // aic(2008/08/08): functions added in order to enable tracking of mother/daughter particles by a unique index
   // The index coincides with the position of the particle in the secondaries list.
-  Int_t SetIndex() {fIndex = ++fLastIndex; return fIndex;}
+  Int_t SetIndex() {
+    fIndex = ++fgLastIndex; 
+    return fIndex;
+  }
   Int_t GetIndex() const {return fIndex;}
-  static Int_t GetLastIndex() {return fLastIndex;}
-  void InitIndexing() {fLastIndex = -1;}
+  static Int_t GetLastIndex() {return fgLastIndex;}
+  static void InitIndexing() {
+    fgLastIndex = -1;
+  }
   void SetMother(Int_t value) {fMotherIndex = value;}
   Int_t GetMother() const {return fMotherIndex;}
-  void SetDaughter(Int_t value) {
-    if(fNDaughters==3) {
-      std::cout << "Warning in Particle::SetDaughter() Already 3 daughters are set!! Check it out!!" << std::endl;
-      return;
-    }
-    fDaughterIndex[fNDaughters++] = value;
-  }
-  Int_t GetNDaughters() const {return fNDaughters;}
-  Int_t GetDaughter(Int_t value) const {
-    if(value<0 || value>fNDaughters-1) {
-      std::cout << "Warning in Particle::GetDaughter(Int_t) This particle has " << fNDaughters 
-               << " daughters. The argument must range from 0 to " << fNDaughters-1 << std::endl;
-      return -1;
-    }
-    return fDaughterIndex[value];
+  void SetFirstDaughterIndex(Int_t index) {fFirstDaughterIndex = index;}
+  void SetLastDaughterIndex(Int_t index) {fLastDaughterIndex = index;}
+  void SetPythiaStatusCode(Int_t code) {fPythiaStatusCode = code;}
+  Int_t GetPythiaStatusCode() const {return fPythiaStatusCode;}
+
+  Int_t GetNDaughters() const {
+    if(fFirstDaughterIndex==-1 || fLastDaughterIndex==-1) return 0;
+    else return fLastDaughterIndex-fFirstDaughterIndex+1;
   }
+  Int_t GetFirstDaughterIndex() const {return fFirstDaughterIndex;}
+  Int_t GetLastDaughterIndex() const {return fLastDaughterIndex;}
 
-  // void SetLastMotherDecayCoor(TLorentzVector fLastMotherDecayCoor);
   TLorentzVector &SetLastMotherDecayCoor(const TLorentzVector &val){return fLastMotherDecayCoor = val;}
   const TLorentzVector &GetLastMotherDecayCoor()const{return fLastMotherDecayCoor;}
-  //  void SetLastMotherDecayMom(TLorentzVector fLastMotherDecayMom);
   TLorentzVector &SetLastMotherDecayMom(const TLorentzVector &val){return fLastMotherDecayMom = val;}
   const TLorentzVector &GetLastMotherDecayMom()const{return fLastMotherDecayMom;}
 
@@ -125,21 +120,23 @@ class Particle {
   Int_t GetType()const{return fType;}
 
  protected:
-  TLorentzVector   fPosition;
-  TLorentzVector   fMomentum;
-  TLorentzVector   fLastMotherDecayCoor;
-  TLorentzVector   fLastMotherDecayMom;
-  ParticlePDG     *fParticleProperties;
-  Double_t         fLastInteractionTime;
-  Int_t            fInteractionNumber;
-  Int_t            fLastMotherPdg;
-  Int_t            fType; //0-hydro, 1-jets
+  TLorentzVector   fPosition;               // 4-position vector
+  TLorentzVector   fMomentum;               // 4-momentum vector
+  TLorentzVector   fLastMotherDecayCoor;    // 4-position vector of mother 
+  TLorentzVector   fLastMotherDecayMom;     // 4-momentum vector of mother
+  ParticlePDG     *fParticleProperties;     // particle PDG properties
+  Double_t         fLastInteractionTime;    // last interaction time
+  Int_t            fInteractionNumber;      // interaction number
+  Int_t            fPythiaStatusCode;       // PYTHIA status code
+  Int_t            fLastMotherPdg;          // mother's PDG code
+  Int_t            fType;                   // particle type: 0-hydro, 1-jets
   Int_t            fIndex;                    // index (0 based) of particle in the final particle list which will contain both primaries and secondaries
   Int_t            fMotherIndex;              // index of the mother (-1 if its a primary particle)
   Int_t            fNDaughters;               // number of daughter particles (0 if the particle had not decayed)
-  Int_t            fDaughterIndex[3];         // array of indexes for the daughter particles (the indexes are -1 for non-existing daughters)
-  static Int_t     fLastIndex;                // the last index assigned
-
+  Int_t            fFirstDaughterIndex;       // index for the first daughter particle (-1 if non-existing)
+  Int_t            fLastDaughterIndex;        // index for the last daughter particle (-1 if non-existing)
+  Bool_t           fDecayed;                  // true if the decay procedure already applied
+  static Int_t     fgLastIndex;                // the last index assigned
 };
 
 Double_t S(const TLorentzVector &, const TLorentzVector &);
@@ -150,13 +147,13 @@ typedef std::list<Particle>::iterator LPIT_t;
 
 class ParticleAllocator {
  public:
-  ParticleAllocator() : fFreeNodes(0) {};
+  ParticleAllocator() : fFreeNodes() {};
   void AddParticle(const Particle & particle, List_t & list);
   void FreeListNode(List_t & list, LPIT_t it);
   void FreeList(List_t & list);
 
  private:
-  List_t fFreeNodes;
+  List_t fFreeNodes;          // list
 };
 
 #endif