Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

novamc::MCStack Class Reference

#include <MCStack.h>

List of all members.

Public Member Functions

 MCStack ()
virtual ~MCStack ()
virtual void PushTrack (Int_t toBeDone, 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 * PopPrimaryForTracking (Int_t i)
virtual void SetCurrentTrack (Int_t track)
virtual void Reset ()
virtual Int_t GetNtrack () const
virtual Int_t GetNprimary () const
virtual TParticle * GetCurrentTrack () const
virtual Int_t GetCurrentTrackNumber () const
virtual Int_t GetCurrentParentTrackNumber () const
int GetOriginTrackId (int trackid)
TParticle * GetParticle (Int_t id) const

Private Attributes

std::stack< MCParticle * > fStack
std::vector< MCParticle * > fParticles
Int_t fCurrentTrack
Int_t fNPrimary
Double_t fThresholdToBeStored
short fGeantVer
std::map< int, ProcfParentIndex


Constructor & Destructor Documentation

MCStack::MCStack  ) 
 

Definition at line 13 of file MCStack.cxx.

00013                  : fParticles(0), fCurrentTrack(-1),
00014                      fNPrimary(0), fThresholdToBeStored(0.1),
00015                      fGeantVer(4) {
00016 }

MCStack::~MCStack  )  [virtual]
 

Definition at line 19 of file MCStack.cxx.

References fParticles.

00019                   {
00020   fParticles.clear(); 
00021 }


Member Function Documentation

Int_t MCStack::GetCurrentParentTrackNumber  )  const [virtual]
 

Definition at line 149 of file MCStack.cxx.

References fCurrentTrack, and GetParticle().

00150 {
00151   TParticle* current = GetParticle(fCurrentTrack);
00152   
00153   if (!current) return -1; 
00154   
00155   return current->GetMother(0);
00156   
00157 }  

TParticle * MCStack::GetCurrentTrack  )  const [virtual]
 

Definition at line 135 of file MCStack.cxx.

References fCurrentTrack, and GetParticle().

00136 {
00137   TParticle* current = GetParticle(fCurrentTrack);
00138   
00139   return  current;
00140 }

Int_t MCStack::GetCurrentTrackNumber  )  const [virtual]
 

Definition at line 143 of file MCStack.cxx.

00144 {
00145   return fCurrentTrack;
00146 }  

Int_t MCStack::GetNprimary  )  const [virtual]
 

Definition at line 129 of file MCStack.cxx.

00130 {
00131   return fNPrimary;
00132 }  

Int_t MCStack::GetNtrack  )  const [virtual]
 

Definition at line 123 of file MCStack.cxx.

References fParticles.

Referenced by PushTrack().

00124 {
00125   return fParticles.size();
00126 }  

int MCStack::GetOriginTrackId int  trackid  ) 
 

Definition at line 161 of file MCStack.cxx.

References fParentIndex.

Referenced by novamc::MCApplication::PreTrack(), and novamc::MCApplication::Stepping().

00162 {
00163 
00164   return fParentIndex[trackid].fOriginTrackId;
00165 
00166 }  

TParticle * MCStack::GetParticle Int_t  id  )  const
 

Definition at line 24 of file MCStack.cxx.

References fParticles.

Referenced by GetCurrentParentTrackNumber(), and GetCurrentTrack().

00025 {
00026   if (id < 0 || id >= (int)fParticles.size())
00027     Fatal("GetParticle", "Index out of range"); 
00028    
00029   return fParticles[id]->GetParticle();
00030 }

TParticle * MCStack::PopNextTrack Int_t &  track  )  [virtual]
 

Definition at line 80 of file MCStack.cxx.

References fCurrentTrack, fStack, novamc::MCParticle::GetID(), and novamc::MCParticle::GetParticle().

00080                                               {
00081 
00082   itrack = -1;
00083   if ( fStack.empty() ) return 0;
00084                       
00085   MCParticle *particle = fStack.top();
00086   fStack.pop();
00087 
00088   if ( !particle ) return 0;  
00089   
00090   fCurrentTrack = itrack = particle->GetID();
00091 
00092   return particle->GetParticle();
00093 }    

TParticle * MCStack::PopPrimaryForTracking Int_t  i  )  [virtual]
 

Definition at line 96 of file MCStack.cxx.

References fParticles, and novamc::MCParticle::GetParticle().

00096                                                  {
00097 
00098   if (i < 0 || i >= fNPrimary) {
00099     return 0;
00100   } 
00101 
00102   return fParticles[i]->GetParticle();
00103 }     

void MCStack::PushTrack Int_t  toBeDone,
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]
 

Definition at line 33 of file MCStack.cxx.

References fGeantVer, novamc::Proc::fMech, fNPrimary, novamc::Proc::fOriginTrackId, fParentIndex, novamc::Proc::fParentTrackId, fParticles, fStack, and GetNtrack().

Referenced by novamc::NOVAMC::Reco().

00038                                    {
00039   const Int_t kFirstDaughter = -1;
00040   const Int_t kLastDaughter  = -1;
00041 
00042   // Unit is nsec in Geant4, while sec in Geant3. Make it to be sec unit.
00043   if(fGeantVer==4) tof *= 1.E-9;
00044   TParticle particleDef(pdg, is, parent, -1, kFirstDaughter, kLastDaughter,
00045                         px, py, pz, e, vx, vy, vz, tof);
00046    
00047   particleDef.SetPolarisation(polx, poly, polz);
00048   particleDef.SetWeight(weight);
00049 
00050   ntr = GetNtrack();
00051 
00052   Proc process;
00053   process.fParentTrackId = parent;
00054   process.fMech = mech;
00055   process.fOriginTrackId = ntr;
00056   if(parent!=-1 &&
00057      (mech==kPPair || mech==kPCompton || mech==kPPhotoelectric ||
00058       mech==kPBrem || mech==kPDeltaRay || mech==kPAnnihilation) &&
00059      e < fThresholdToBeStored) {
00060     int origin = parent;
00061     while(origin!=fParentIndex[origin].fOriginTrackId) {
00062       origin = fParentIndex[origin].fParentTrackId;
00063     }
00064     process.fOriginTrackId = origin;
00065   }
00066   fParentIndex.insert(map<int,Proc>::value_type(ntr,process));
00067   
00068   if ( parent == -1 ) fNPrimary++;  
00069 
00070   // All particles 
00071   fParticles.push_back(new MCParticle(particleDef, ntr));
00072     
00073   // Stack for particles
00074   if (toBeDone) fStack.push(fParticles[ntr]);
00075 
00076 }                        

void MCStack::Reset  )  [virtual]
 

Definition at line 112 of file MCStack.cxx.

References fCurrentTrack, fNPrimary, fParentIndex, fParticles, and fStack.

00113 {
00114   fCurrentTrack = -1;
00115   fNPrimary = 0;
00116   while ( !fStack.empty() ) fStack.pop();
00117   for(unsigned int i=0; i<fParticles.size(); i++) delete fParticles[i];
00118   fParticles.clear();
00119   fParentIndex.clear();
00120 }     

void MCStack::SetCurrentTrack Int_t  track  )  [virtual]
 

Definition at line 106 of file MCStack.cxx.

References fCurrentTrack.

00107 {
00108   fCurrentTrack = track;
00109 }     


Member Data Documentation

Int_t novamc::MCStack::fCurrentTrack [private]
 

Definition at line 57 of file MCStack.h.

Referenced by GetCurrentParentTrackNumber(), GetCurrentTrack(), PopNextTrack(), Reset(), and SetCurrentTrack().

short novamc::MCStack::fGeantVer [private]
 

Definition at line 60 of file MCStack.h.

Referenced by PushTrack().

Int_t novamc::MCStack::fNPrimary [private]
 

Definition at line 58 of file MCStack.h.

Referenced by PushTrack(), and Reset().

std::map<int, Proc> novamc::MCStack::fParentIndex [private]
 

Definition at line 62 of file MCStack.h.

Referenced by GetOriginTrackId(), PushTrack(), and Reset().

std::vector<MCParticle*> novamc::MCStack::fParticles [private]
 

Definition at line 56 of file MCStack.h.

Referenced by GetNtrack(), GetParticle(), PopPrimaryForTracking(), PushTrack(), Reset(), and ~MCStack().

std::stack<MCParticle*> novamc::MCStack::fStack [private]
 

Definition at line 55 of file MCStack.h.

Referenced by PopNextTrack(), PushTrack(), and Reset().

Double_t novamc::MCStack::fThresholdToBeStored [private]
 

Definition at line 59 of file MCStack.h.


The documentation for this class was generated from the following files:
Generated on Sat Oct 11 02:35:33 2008 for NOvA Offline by  doxygen 1.3.9.1