Main Page | Compound List | File List | Compound Members | File Members | Related Pages

McParticle Class Reference

GLAST Monte Carlo particle class. This class mirrors the TDS McParticle class. More...

#include <McParticle.h>

List of all members.

Public Types

enum  StatusBits {
  DECAYED = 1, DECAYFLT = 1<<1, MISSED = 1<<2, NOINTER = 1<<3,
  STOPPED = 1<<4, INTERACT = 1<<5, INTSHDEP = 1<<6, PRIMARY = 1<<7,
  SWERROR = 1<<8, BCKSPL = 1<<9, POSHIT = 1<<10, NOTTRACK = 1<<11,
  Swum = 1<<12, CALOSHOWER = 1 << 13, ORIGIN_PRIMARY = 1 << 14, ORIGIN_CALOSHOWER = 1 << 15,
  NEED_DIGI = 1 << 16
}
 status bits modeled on successful SLD scheme More...


Public Member Functions

 McParticle ()
 McParticle (const McParticle &p)
virtual ~McParticle ()
void Clear (Option_t *option="")
 clear lists, free pointers, etc., after read from / write to file

void Fake (Int_t ievent, UInt_t rank, Float_t randNum)
Bool_t CompareInRange (const McParticle &, const std::string &name="") const
void Print (Option_t *option="") const
void initialize (McParticle *mother, Int_t id, UInt_t statusBits, const TLorentzVector &initalMomentum, const TLorentzVector &finalMomentum, const TVector3 &initialPosition, const TVector3 &finalPosition, const char *process="")
 completely initialize a newed object. No other way to set most attributes.

Int_t getParticleId () const
const McParticlegetMother () const
 return an McParticle pointer to the mother particle

void addDaughter (McParticle *part)
 add a daughter particle to the list

const McParticlegetDaughter (Int_t index) const
 return a daughter McParticle corresponding to index

const TRefArray & getDaughterList () const
 return the full list of daughters

Int_t getParticleProperty () const
UInt_t getStatusFlags () const
Bool_t primaryParticle () const
 Retrieve whether this is a primary particle.

const TVector3 & getInitialPosition () const
 Retrieve pointer to the start vertex positions.

const TVector3 & getFinalPosition () const
 Retrieve pointer to end vertex position.

const TLorentzVector & getInitialFourMomentum () const
const TLorentzVector & getFinalFourMomentum () const
const TString & getProcess () const
void * operator new (size_t size)
void * operator new (size_t size, void *vp)
McParticleoperator= (const McParticle &rhs)

Private Attributes

Int_t m_particleId
 particle property (such as electron or proton or ....) ID

UInt_t m_statusFlags
 Bit-field status flag.

TVector3 m_initialPosition
 Initial position.

TVector3 m_finalPosition
 Final position.

TLorentzVector m_initialFourMomentum
 Initial 4-momentum.

TLorentzVector m_finalFourMomentum
 Final 4-momentum.

TRef m_mother
 Pointer to mother particle.

TRefArray m_daughters
 Reference array of daughter particles.

TString m_process
 String with the process name that produced this particle.


Detailed Description

GLAST Monte Carlo particle class. This class mirrors the TDS McParticle class.

Each McParticle contains:

Author:
Daniel Flath and Heather Kelly
Header
/nfs/slac/g/glast/ground/cvs/mcRootData/mcRootData/McParticle.h,v 1.17 2007/11/13 16:54:46 heather Exp

Definition at line 72 of file McParticle.h.


Member Enumeration Documentation

enum McParticle::StatusBits
 

status bits modeled on successful SLD scheme

Enumeration values:
DECAYED 
DECAYFLT  Decayed by generator.
MISSED  Decayed in flight by swimmer.
NOINTER  Does not hit detector.
STOPPED  Traverses detector w/o interacting.
INTERACT  Energy below cut; other bits may say why.
INTSHDEP  Interacted, no further decision to be made.
PRIMARY  Interacted, further decision depends on ! selection of shower deposition.
SWERROR  primary particle
BCKSPL  Error occurred in swimming the track.
POSHIT  The particle is backsplashed from the CAL back in the TKR region.
NOTTRACK  The particle released a hit a PositionHit detector.
Swum  Not tracked by user request.
CALOSHOWER  this particle was produced by the swimmer
ORIGIN_PRIMARY 
ORIGIN_CALOSHOWER 
NEED_DIGI 

Definition at line 76 of file McParticle.h.

00076                            {  
00077         DECAYED =1 ,    
00078             DECAYFLT=1<<1,  
00079             MISSED=  1<<2,  
00080             NOINTER =1<<3,  
00081             STOPPED =1<<4,  
00082             INTERACT=1<<5,  
00083             INTSHDEP=1<<6,  
00084             PRIMARY =1<<7,  
00085             SWERROR =1<<8,  
00086             BCKSPL=1<<9,    
00087             POSHIT =1<<10,  
00088             NOTTRACK=1<<11, 
00089             Swum =   1<<12, 
00090             CALOSHOWER = 1 << 13,
00091             ORIGIN_PRIMARY = 1 << 14,
00092             ORIGIN_CALOSHOWER  = 1 << 15,
00093             NEED_DIGI  = 1 << 16
00094     };


Constructor & Destructor Documentation

McParticle::McParticle  ) 
 

McParticle::McParticle const McParticle p  ) 
 

Definition at line 21 of file McParticle.cxx.

References m_daughters, m_finalFourMomentum, m_finalPosition, m_initialFourMomentum, m_initialPosition, m_mother, m_particleId, m_process, and m_statusFlags.

00022  : TObject(p) {
00023     // Purpose and Method:  The copy constructor.  This will make it easier to
00024     //    read in the McParticles within the simulation.
00025 
00026     m_particleId = p.m_particleId;
00027     m_statusFlags = p.m_statusFlags;
00028     m_initialPosition = p.m_initialPosition;
00029     m_finalPosition = p.m_finalPosition;
00030     m_initialFourMomentum = p.m_initialFourMomentum;
00031     m_finalFourMomentum = p.m_finalFourMomentum;
00032     m_mother = p.m_mother;
00033     m_process = p.m_process;
00034     // TRefArrayIter::Next does not seem to be implemented in Root 3.02.03
00035     // or ROOT 3.03.04 - just iterating over the entries for now.
00036     //TRefArrayIter daughterIter(&p.m_daughters);
00037     McParticle *curRef;
00038     Int_t iPart;
00039     for (iPart = 0; iPart < p.m_daughters.GetEntries(); iPart++) {
00040     //while ( (curRef = (McParticle*)daughterIter.Next()) ){
00041         curRef = (McParticle*)p.m_daughters.At(iPart);
00042         m_daughters.Add(curRef);
00043     }
00044 }

McParticle::~McParticle  )  [virtual]
 

Definition at line 46 of file McParticle.cxx.

References Clear().

00046                         {
00047     Clear();
00048 }


Member Function Documentation

void McParticle::addDaughter McParticle part  )  [inline]
 

add a daughter particle to the list

Definition at line 125 of file McParticle.h.

References m_daughters.

00125 { m_daughters.Add(part); };

void McParticle::Clear Option_t *  option = ""  ) 
 

clear lists, free pointers, etc., after read from / write to file

Definition at line 83 of file McParticle.cxx.

References m_daughters, m_finalFourMomentum, m_finalPosition, m_initialFourMomentum, m_initialPosition, m_particleId, and m_statusFlags.

Referenced by Fake(), and ~McParticle().

00083                                  {
00084     m_particleId = 0;
00085     m_statusFlags = 0;
00086     m_initialPosition = TVector3(0., 0., 0.);
00087     m_finalPosition = TVector3(0., 0., 0.);
00088     m_initialFourMomentum = TLorentzVector(0., 0., 0., 0.);
00089     m_finalFourMomentum = TLorentzVector(0., 0., 0., 0.);
00090     m_daughters.Clear();
00091 }

Bool_t McParticle::CompareInRange const McParticle ,
const std::string &  name = ""
const
 

Definition at line 109 of file McParticle.cxx.

References COMPARE_IN_RANGE, and getMother().

00109                                                                                         {
00110 
00111     Bool_t result = true ;
00112     
00113     result = COMPARE_IN_RANGE(ParticleId) && result ;
00114     result = COMPARE_IN_RANGE(StatusFlags) && result ;
00115     
00116     result = COMPARE_IN_RANGE(InitialFourMomentum) && result ;
00117     result = COMPARE_IN_RANGE(FinalFourMomentum) && result ;
00118 
00119     result = COMPARE_IN_RANGE(InitialPosition) && result ;
00120     result = COMPARE_IN_RANGE(FinalPosition) && result ;
00121         
00122     result = COMPARE_IN_RANGE(Process) && result ;
00123     
00124     // for fake data and comparison
00125     // particles should point to themselves
00126     rootdatautil::CompareInRange(ref.GetUniqueID(),ref.getMother()->GetUniqueID(),"Ref Mother") ;
00127     rootdatautil::CompareInRange(GetUniqueID(),getMother()->GetUniqueID(),"Mother") ;
00128       
00129     if (!result) {
00130         if ( name == "" ) {
00131             std::cout<<"Comparison ERROR for "<<ClassName()<<std::endl ;
00132         }
00133         else {
00134             std::cout<<"Comparison ERROR for "<<name<<std::endl ;
00135         }
00136     }
00137     return result ;
00138 
00139 }

void McParticle::Fake Int_t  ievent,
UInt_t  rank,
Float_t  randNum
 

Definition at line 94 of file McParticle.cxx.

References Clear(), and initialize().

Referenced by McEvent::CompareToFake(), and McEvent::Fake().

00094                                                                   {
00095 
00096     Clear() ;
00097     Float_t f = Float_t(rank);
00098     Float_t fr = f*randNum;
00099     TLorentzVector initMom(f, f, f, f);
00100     TLorentzVector finalMom(fr+ievent, fr+ievent, fr+ievent, fr+ievent);
00101     TVector3 initPos(randNum, f*2.0*randNum, f*4.0*randNum);
00102     TVector3 finalPos(f*randNum, f*randNum, f*randNum);
00103     initialize(this, rank, 0, initMom, finalMom, initPos, finalPos);
00104 
00105 }

const McParticle * McParticle::getDaughter Int_t  index  )  const
 

return a daughter McParticle corresponding to index

Definition at line 187 of file McParticle.cxx.

References m_daughters.

00187                                                            {
00188     return ( (McParticle*)m_daughters.At(index) );
00189 }

const TRefArray& McParticle::getDaughterList  )  const [inline]
 

return the full list of daughters

Definition at line 131 of file McParticle.h.

References m_daughters.

00131 { return m_daughters; };

const TLorentzVector & McParticle::getFinalFourMomentum  )  const
 

Definition at line 213 of file McParticle.cxx.

References m_finalFourMomentum.

00213                                                              {
00214     return m_finalFourMomentum;
00215 };

const TVector3 & McParticle::getFinalPosition  )  const
 

Retrieve pointer to end vertex position.

Definition at line 204 of file McParticle.cxx.

References m_finalPosition.

Referenced by McEvent::CompareToFake(), and McEvent::Fake().

00204                                                    {
00205     return m_finalPosition;
00206 }

const TLorentzVector & McParticle::getInitialFourMomentum  )  const
 

Definition at line 209 of file McParticle.cxx.

References m_initialFourMomentum.

00209                                                                { 
00210     return m_initialFourMomentum; 
00211 }

const TVector3 & McParticle::getInitialPosition  )  const
 

Retrieve pointer to the start vertex positions.

Definition at line 198 of file McParticle.cxx.

00199 {
00200     return m_initialPosition;
00201 }

const McParticle * McParticle::getMother  )  const
 

return an McParticle pointer to the mother particle

Definition at line 182 of file McParticle.cxx.

References m_mother.

Referenced by CompareInRange().

00182                                               {
00183 
00184     return ( (McParticle*)(m_mother.GetObject()) );
00185 }

Int_t McParticle::getParticleId  )  const [inline]
 

Definition at line 119 of file McParticle.h.

References m_particleId.

Referenced by McIntegratingHit::Print().

00119 { return m_particleId;};    

Int_t McParticle::getParticleProperty  )  const [inline]
 

Definition at line 133 of file McParticle.h.

References m_statusFlags.

00133 { return m_statusFlags; };

const TString & McParticle::getProcess  )  const
 

Definition at line 217 of file McParticle.cxx.

References m_process.

00217                                             {
00218     return m_process;
00219 }

UInt_t McParticle::getStatusFlags  )  const [inline]
 

Definition at line 135 of file McParticle.h.

References m_statusFlags.

00135 { return m_statusFlags; };

void McParticle::initialize McParticle mother,
Int_t  id,
UInt_t  statusBits,
const TLorentzVector &  initalMomentum,
const TLorentzVector &  finalMomentum,
const TVector3 &  initialPosition,
const TVector3 &  finalPosition,
const char *  process = ""
 

completely initialize a newed object. No other way to set most attributes.

Definition at line 162 of file McParticle.cxx.

References m_finalFourMomentum, m_finalPosition, m_initialFourMomentum, m_initialPosition, m_mother, m_particleId, m_process, and m_statusFlags.

Referenced by Fake().

00168 {
00169     m_mother = mother;
00170     m_particleId = id;
00171     m_statusFlags = statusBits;
00172     m_initialFourMomentum = initMom;
00173     m_finalFourMomentum = finalMom;
00174     m_initialPosition = initPos;
00175     m_finalPosition = finalPos;
00176     m_process = TString(process);
00177     if ( mother == 0 ) return;
00178     if( mother != this) mother->m_daughters.Add(this);
00179 }

void * McParticle::operator new size_t  size,
void *  vp
 

Definition at line 61 of file McParticle.cxx.

00062 {
00063     return vp;
00064 }

void * McParticle::operator new size_t  size  ) 
 

Definition at line 50 of file McParticle.cxx.

References McObjectManager::getNewMcParticle(), McObjectManager::getPointer(), m_daughters, and m_process.

00051 {
00052     McParticle* temp = McObjectManager::getPointer()->getNewMcParticle();
00053 
00054     // Since we recycle, make sure these member functions are cleared
00055     temp->m_daughters.Clear();
00056     temp->m_process = "";
00057 
00058     return temp;
00059 }

McParticle & McParticle::operator= const McParticle rhs  ) 
 

Definition at line 66 of file McParticle.cxx.

References m_daughters, m_finalFourMomentum, m_finalPosition, m_initialFourMomentum, m_initialPosition, m_mother, m_particleId, m_process, and m_statusFlags.

00067 {
00068     m_particleId           = rhs.m_particleId;
00069     m_statusFlags          = rhs.m_statusFlags;
00070     m_initialPosition      = rhs.m_initialPosition;
00071     m_finalPosition        = rhs.m_finalPosition;
00072     m_initialFourMomentum  = rhs.m_initialFourMomentum;
00073     m_finalFourMomentum    = rhs.m_finalFourMomentum;
00074     m_mother               = rhs.m_mother;
00075     m_process              = rhs.m_process; 
00076 
00077     for(int idx = 0; idx < rhs.m_daughters.GetEntries(); idx++)
00078         m_daughters.Add(rhs.m_daughters[idx]);
00079 
00080     return *this;
00081 }

Bool_t McParticle::primaryParticle  )  const
 

Retrieve whether this is a primary particle.

Definition at line 192 of file McParticle.cxx.

References m_statusFlags, and PRIMARY.

00193 {
00194   return (m_statusFlags & PRIMARY)==PRIMARY;
00195 }

void McParticle::Print Option_t *  option = ""  )  const
 

Definition at line 141 of file McParticle.cxx.

References m_daughters, m_finalFourMomentum, m_finalPosition, m_initialFourMomentum, m_initialPosition, m_mother, m_particleId, m_process, and m_statusFlags.

Referenced by McPositionHit::Print().

00141                                              {
00142     using namespace std;
00143     TObject::Print(option);
00144     cout.precision(2);
00145     cout << "ParticleId: " << m_particleId;
00146     cout << " StatusFlag: " << m_statusFlags << endl;
00147     cout << "Process: " << m_process.Data() << endl;
00148     cout << "InitialPos: (" << m_initialPosition.X() << "," << m_initialPosition.Y()
00149         << "," << m_initialPosition.Z() << ") ";
00150     cout << "FinalPos: (" << m_finalPosition.X() << "," << m_finalPosition.Y()
00151         << "," << m_finalPosition.Z() << ")" << endl;
00152     cout << "InitMom: (" << m_initialFourMomentum.X() << "," << m_initialFourMomentum.Y() << ","
00153         << m_initialFourMomentum.Z() << "," << m_initialFourMomentum.T() << ")    ";
00154     cout << "FinalMom: (" << m_finalFourMomentum.X() << "," << m_finalFourMomentum.Y() << ","
00155         << m_finalFourMomentum.Z() << "," << m_finalFourMomentum.T() << ")" << endl;
00156     cout << "Mother:  ";
00157     m_mother.Print();
00158     cout << "Number of Daughters: " << m_daughters.GetEntries() << endl;
00159 }


Member Data Documentation

TRefArray McParticle::m_daughters [private]
 

Reference array of daughter particles.

Definition at line 175 of file McParticle.h.

Referenced by addDaughter(), Clear(), getDaughter(), getDaughterList(), McParticle(), operator new(), operator=(), and Print().

TLorentzVector McParticle::m_finalFourMomentum [private]
 

Final 4-momentum.

Definition at line 171 of file McParticle.h.

Referenced by Clear(), getFinalFourMomentum(), initialize(), McParticle(), operator=(), and Print().

TVector3 McParticle::m_finalPosition [private]
 

Final position.

Definition at line 167 of file McParticle.h.

Referenced by Clear(), getFinalPosition(), initialize(), McParticle(), operator=(), and Print().

TLorentzVector McParticle::m_initialFourMomentum [private]
 

Initial 4-momentum.

Definition at line 169 of file McParticle.h.

Referenced by Clear(), getInitialFourMomentum(), initialize(), McParticle(), operator=(), and Print().

TVector3 McParticle::m_initialPosition [private]
 

Initial position.

Definition at line 165 of file McParticle.h.

Referenced by Clear(), initialize(), McParticle(), operator=(), and Print().

TRef McParticle::m_mother [private]
 

Pointer to mother particle.

Definition at line 173 of file McParticle.h.

Referenced by getMother(), initialize(), McParticle(), operator=(), and Print().

Int_t McParticle::m_particleId [private]
 

particle property (such as electron or proton or ....) ID

Definition at line 161 of file McParticle.h.

Referenced by Clear(), getParticleId(), initialize(), McParticle(), operator=(), and Print().

TString McParticle::m_process [private]
 

String with the process name that produced this particle.

Definition at line 177 of file McParticle.h.

Referenced by getProcess(), initialize(), McParticle(), operator new(), operator=(), and Print().

UInt_t McParticle::m_statusFlags [private]
 

Bit-field status flag.

Definition at line 163 of file McParticle.h.

Referenced by Clear(), getParticleProperty(), getStatusFlags(), initialize(), McParticle(), operator=(), primaryParticle(), and Print().


The documentation for this class was generated from the following files:
Generated on Tue Dec 11 16:28:56 2007 by doxygen 1.3.3