MCAppParticle Class Reference

#include <MCAppParticle.h>

Inheritance diagram for MCAppParticle:
PTSimParticle

List of all members.

Public Member Functions

 MCAppParticle (Int_t id, Int_t pdg, Int_t status, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t tof, TMCProcess process)
 MCAppParticle (Int_t id, TParticle *particle, TMCProcess process)
 MCAppParticle ()
virtual ~MCAppParticle ()
virtual Int_t GetID () const
virtual const TParticle * GetTParticle () const
virtual const MCAppParticleGetParent (UInt_t i=0) const
virtual const MCAppParticleGetChild (UInt_t i=0) const
virtual const MCAppParticleGetSibling (UInt_t i=0) const
virtual Int_t GetParentID (UInt_t i=0) const
virtual Int_t GetChildID (UInt_t i=0) const
virtual Int_t GetSiblingID (UInt_t i=0) const
virtual UInt_t GetNChildren () const
virtual UInt_t GetNParents () const
virtual UInt_t GetNSiblings () const
virtual TMCProcess GetProcess () const
virtual Int_t GetPdgCode () const
virtual Double_t GetEnergy () const
virtual Double_t GetMass ()
virtual Int_t GetStatusCode () const
virtual std::string GetStatusCodeName () const
virtual Double_t GetCharge ()
virtual void ProductionMomentum (TLorentzVector &lv) const
virtual void ProductionVertex (TLorentzVector &lv) const
virtual Double_t GetWeight () const
virtual void GetPolarisation (TVector3 &vec)
virtual void SetPolarisation (Double_t polx, Double_t poly, Double_t polz)
virtual void SetWeight (Double_t weight)
virtual void SetProductionMomentum (const TLorentzVector &lv)
virtual void AddParent (const MCAppParticle *parent)
virtual void AddChild (const MCAppParticle *child)
virtual void AddSibling (const MCAppParticle *sibling)
virtual void SetProcess (TMCProcess process)
virtual std::ostream & Print (std::ostream &os) const
virtual void Print (Option_t *option="") const
virtual void SetPrintPreface (std::string preface)
virtual std::string GetPrintPreface () const
virtual void SetPrintOption (std::string option)
virtual std::string GetPrintOption () const

Private Attributes

Int_t fID
TParticle fTParticle
TMCProcess fProcess
std::string fPrintPreface
std::string fPrintOption
std::vector< const
MCAppParticle * > 
fParents
std::vector< const
MCAppParticle * > 
fChildren
std::vector< const
MCAppParticle * > 
fSiblings

Detailed Description

Definition at line 33 of file MCAppParticle.h.


Constructor & Destructor Documentation

MCAppParticle::MCAppParticle ( Int_t  id,
Int_t  pdg,
Int_t  status,
Double_t  px,
Double_t  py,
Double_t  pz,
Double_t  e,
Double_t  vx,
Double_t  vy,
Double_t  vz,
Double_t  tof,
TMCProcess  process 
)

Definition at line 29 of file MCAppParticle.cxx.

00033   : fID(id), fTParticle(pdg,statuscode,-1,-1,-1,-1,
00034     px,py,pz,e,vx,vy,vz,tof), fProcess(process), 
00035     fPrintPreface(""),  fPrintOption("")  {
00036   // Normal constructor, Recommended
00037 
00038 }

MCAppParticle::MCAppParticle ( Int_t  id,
TParticle *  particle,
TMCProcess  process 
)

Definition at line 41 of file MCAppParticle.cxx.

References fTParticle.

00042   : fID(id), fTParticle(), fProcess(process), 
00043     fPrintPreface(""),fPrintOption("") {
00044   // Normal constructor
00045   // The input particle is copied, but not adopted
00046 
00047   if ( particle ) fTParticle = *particle;  // copy the input particle
00048 
00049 }

MCAppParticle::MCAppParticle (  ) 

Definition at line 52 of file MCAppParticle.cxx.

00052                              : fID(-1), fTParticle(), fProcess(kPNoProcess),
00053                                  fPrintPreface(""), fPrintOption("") {
00054   // Default constructor
00055 
00056 }

MCAppParticle::~MCAppParticle (  )  [virtual]

Definition at line 60 of file MCAppParticle.cxx.

00060                               {
00061   // Destructor.  Delete all owned sub-objects
00062 
00063 }


Member Function Documentation

void MCAppParticle::AddChild ( const MCAppParticle child  )  [virtual]

Definition at line 166 of file MCAppParticle.cxx.

References fChildren, Msg::kWarning, and MSG.

00166                                                        {
00167   // Add child to list of indices.
00168 
00169   if ( !child ) {
00170     MSG("MCApp",Msg::kWarning) 
00171       << "MCAppParticle::AddChild received null child ptr" << endl;
00172     return;
00173   }
00174 
00175   fChildren.push_back(child);
00176   
00177 }

void MCAppParticle::AddParent ( const MCAppParticle parent  )  [virtual]

Definition at line 180 of file MCAppParticle.cxx.

References fParents, Msg::kWarning, and MSG.

Referenced by PTSimValidate::TestParticle(), and MCAppValidate::TestParticle().

00180                                                          {
00181   // Add parent to list of indices.
00182 
00183   if ( !parent ) {
00184     MSG("MCApp",Msg::kWarning) 
00185       << "MCAppParticle::AddParent received null parent ptr" << endl;
00186     return;
00187   }
00188   
00189   fParents.push_back(parent);
00190   
00191 }

void MCAppParticle::AddSibling ( const MCAppParticle sibling  )  [virtual]

Definition at line 194 of file MCAppParticle.cxx.

References fSiblings, Msg::kWarning, and MSG.

Referenced by PTSimValidate::TestParticle(), and MCAppValidate::TestParticle().

00194                                                            {
00195   // Add sibling to list of indices.
00196   // Siblings are particles all generated in the same production
00197   // mechanism event.  For example, decay products from a single decay
00198   // are siblings.
00199 
00200   if ( !sibling ) {
00201     MSG("MCApp",Msg::kWarning) 
00202       << "MCAppParticle::AddSibling received null sibling ptr" << endl;
00203     return;
00204   }
00205   
00206   fSiblings.push_back(sibling);
00207   
00208 }

Double_t MCAppParticle::GetCharge (  )  [virtual]

Definition at line 211 of file MCAppParticle.cxx.

References fTParticle.

00211                                   { 
00212   return ( fTParticle.GetPDG() ) ?  fTParticle.GetPDG() -> Charge() : 0; 
00213 }

const MCAppParticle * MCAppParticle::GetChild ( UInt_t  i = 0  )  const [virtual]

Reimplemented in PTSimParticle.

Definition at line 126 of file MCAppParticle.cxx.

References fChildren.

Referenced by GetChildID(), and Print().

00126                                                             {
00127   // Return pointer to id-th child or null if out-of-range
00128 
00129   if ( id >= fChildren.size() ) return 0;
00130   
00131   const MCAppParticle* child = fChildren[id];
00132 
00133   return child;
00134   
00135 }

Int_t MCAppParticle::GetChildID ( UInt_t  i = 0  )  const [virtual]

Definition at line 241 of file MCAppParticle.cxx.

References GetChild(), and GetID().

Referenced by PTSimStack::FillStdHepArray(), and Print().

00241                                               {
00242   const MCAppParticle* child = GetChild(i);
00243   if ( child ) return child->GetID();
00244   else return -1;
00245 }

virtual Double_t MCAppParticle::GetEnergy (  )  const [inline, virtual]

Definition at line 62 of file MCAppParticle.h.

References fTParticle.

00062 { return fTParticle.Energy(); }

virtual Int_t MCAppParticle::GetID (  )  const [inline, virtual]
virtual Double_t MCAppParticle::GetMass (  )  [inline, virtual]

Definition at line 63 of file MCAppParticle.h.

References fTParticle.

00063 { return fTParticle.GetMass(); }

virtual UInt_t MCAppParticle::GetNChildren (  )  const [inline, virtual]
virtual UInt_t MCAppParticle::GetNParents (  )  const [inline, virtual]

Definition at line 56 of file MCAppParticle.h.

References fParents.

Referenced by PTSimStack::ParticleIsSelected(), PTSimValidate::TestParticle(), and MCAppValidate::TestParticle().

00056 { return fParents.size(); }

virtual UInt_t MCAppParticle::GetNSiblings (  )  const [inline, virtual]

Definition at line 57 of file MCAppParticle.h.

References fSiblings.

Referenced by PTSimValidate::TestParticle(), and MCAppValidate::TestParticle().

00057 { return fSiblings.size(); }

const MCAppParticle * MCAppParticle::GetParent ( UInt_t  i = 0  )  const [virtual]

Reimplemented in PTSimParticle.

Definition at line 139 of file MCAppParticle.cxx.

References fParents.

Referenced by GetParentID(), and MCAppValidate::TestParticle().

00139                                                              {
00140   // Return pointer to id-th parent (0 or 1) or null if out-of-range
00141 
00142   if ( id >= fParents.size() ) return 0;
00143   
00144   const MCAppParticle* parent = fParents[id];
00145 
00146   return parent;
00147 
00148 }

Int_t MCAppParticle::GetParentID ( UInt_t  i = 0  )  const [virtual]

Definition at line 234 of file MCAppParticle.cxx.

References GetID(), and GetParent().

Referenced by PTSimStack::FillStdHepArray(), Print(), PTSimValidate::TestParticle(), and MCAppValidate::TestParticle().

00234                                                {
00235   const MCAppParticle* parent = GetParent(i);
00236   if ( parent ) return parent->GetID();
00237   else return -1;
00238 }

virtual Int_t MCAppParticle::GetPdgCode (  )  const [inline, virtual]

Definition at line 61 of file MCAppParticle.h.

References fTParticle.

Referenced by PTSimStack::ParticleIsSelected(), and Print().

00061 { return fTParticle.GetPdgCode(); }

void MCAppParticle::GetPolarisation ( TVector3 &  vec  )  [virtual]

Definition at line 228 of file MCAppParticle.cxx.

References fTParticle.

00228                                                  {
00229   vec.SetXYZ(0,0,0);
00230   fTParticle.GetPolarisation(vec); 
00231 }

virtual std::string MCAppParticle::GetPrintOption (  )  const [inline, virtual]

Definition at line 95 of file MCAppParticle.h.

References fPrintOption.

Referenced by Print().

00095 { return fPrintOption; }

virtual std::string MCAppParticle::GetPrintPreface (  )  const [inline, virtual]

Definition at line 93 of file MCAppParticle.h.

References fPrintPreface.

Referenced by Print().

00093 { return fPrintPreface; }

virtual TMCProcess MCAppParticle::GetProcess (  )  const [inline, virtual]

Definition at line 58 of file MCAppParticle.h.

References fProcess.

Referenced by PTSimApplication::Stepping().

00058 { return fProcess; }

const MCAppParticle * MCAppParticle::GetSibling ( UInt_t  i = 0  )  const [virtual]

Reimplemented in PTSimParticle.

Definition at line 151 of file MCAppParticle.cxx.

References fSiblings.

Referenced by GetSiblingID(), and MCAppValidate::TestParticle().

00151                                                               {
00152   // Return pointer to id-th sibling or null if out-of-range
00153   // Siblings are particles all generated in the same production
00154   // mechanism event.  For example, decay products from a single decay
00155   // are siblings.
00156 
00157   if ( id >= fSiblings.size() ) return 0;
00158   
00159   const MCAppParticle* sibling = fSiblings[id];
00160 
00161   return sibling;
00162 
00163 }

Int_t MCAppParticle::GetSiblingID ( UInt_t  i = 0  )  const [virtual]

Definition at line 248 of file MCAppParticle.cxx.

References GetID(), and GetSibling().

Referenced by PTSimValidate::TestParticle(), and MCAppValidate::TestParticle().

00248                                                 {
00249   const MCAppParticle* sibling = GetSibling(i);
00250   if ( sibling ) return sibling->GetID();
00251   else return -1;
00252 }

virtual Int_t MCAppParticle::GetStatusCode (  )  const [inline, virtual]

Definition at line 64 of file MCAppParticle.h.

References fTParticle.

Referenced by PTSimStack::FillStdHepArray(), GetStatusCodeName(), and Print().

00064 { return fTParticle.GetStatusCode(); }

virtual std::string MCAppParticle::GetStatusCodeName (  )  const [inline, virtual]

Definition at line 65 of file MCAppParticle.h.

References bfld::AsString(), and GetStatusCode().

Referenced by Print().

00065                                               { 
00066                           return UtilIstHEP::AsString(GetStatusCode()); }

virtual const TParticle* MCAppParticle::GetTParticle (  )  const [inline, virtual]

Definition at line 48 of file MCAppParticle.h.

References fTParticle.

Referenced by PTSimStack::FillStdHepArray(), PTSimValidate::TestParticle(), and MCAppValidate::TestParticle().

00048 { return &fTParticle; }

virtual Double_t MCAppParticle::GetWeight (  )  const [inline, virtual]

Definition at line 71 of file MCAppParticle.h.

References fTParticle.

00071 { return fTParticle.GetWeight(); }

void MCAppParticle::Print ( Option_t *  option = ""  )  const [virtual]

Definition at line 115 of file MCAppParticle.cxx.

References Print().

00115                                                       {
00116   // Print particle in form supported by TObject::Print
00117   // The user can also control the print by specifying a preface using
00118   // the SetPrintPreface method, e.g. to set an indentation.
00119 
00120   Print(std::cout);
00121   return;
00122 
00123 }

std::ostream & MCAppParticle::Print ( std::ostream &  os  )  const [virtual]

Definition at line 66 of file MCAppParticle.cxx.

References fTParticle, GetChild(), GetChildID(), GetID(), GetNChildren(), GetParentID(), GetPdgCode(), GetPrintOption(), GetPrintPreface(), GetStatusCode(), GetStatusCodeName(), SetPrintOption(), and SetPrintPreface().

Referenced by Print(), PTSimValidate::TestParticle(), and MCAppValidate::TestParticle().

00066                                                      {
00067   // Print particle data on ostream.
00068   // GetPrintOption() == "full" will print child particles
00069   // GetPrintOption() == "" prints this particle only
00070   //
00071   
00072   os << GetPrintPreface().c_str() << GetID() << ")";
00073   os << GetPdgCode() << "/" << fTParticle.GetName()
00074      << " s: " << GetStatusCode() << "/" 
00075      << GetStatusCodeName().c_str() 
00076      << " v: " << fTParticle.Vx() 
00077      << " "    << fTParticle.Vy() 
00078      << " "    << fTParticle.Vz() 
00079      << " t: " << fTParticle.T()
00080      << " p: " << fTParticle.Px() 
00081      << " "    << fTParticle.Py()
00082      << " "    << fTParticle.Pz()
00083      << " P:"  << GetParentID(0) 
00084      << ","    << GetParentID(1) 
00085      << " C:"  << GetChildID(0) 
00086      << " to " << GetChildID(GetNChildren()-1)
00087      << "."    << endl;
00088 
00089   if ( !strcmp(GetPrintOption().c_str(),"full") ) {
00090     Int_t nd = GetNChildren();
00091     if ( nd > 0 ) {
00092       os << GetPrintPreface().c_str() << "  " << nd;
00093       if ( nd == 1 ) os << " Child:" << endl;
00094       else os  << " Children:" << endl;
00095       // Recursive loop over children, children's children,...
00096       for ( Int_t id = 0; id < nd; id++ ) {
00097         MCAppParticle* cdpart = const_cast<MCAppParticle*>(GetChild(id));
00098         std::string saveoption  = cdpart->GetPrintOption();
00099         std::string savepreface = cdpart->GetPrintPreface();
00100         cdpart -> SetPrintOption(GetPrintOption());
00101         cdpart -> SetPrintPreface(GetPrintPreface() + "  ");
00102         os << *(cdpart);
00103         cdpart -> SetPrintOption(saveoption);
00104         cdpart -> SetPrintPreface(savepreface);
00105       }
00106     }
00107   }
00108 
00109 
00110   return os;
00111 
00112 }

void MCAppParticle::ProductionMomentum ( TLorentzVector &  lv  )  const [virtual]

Definition at line 222 of file MCAppParticle.cxx.

References fTParticle.

00222                                                                {
00223   lv.SetPxPyPzE(0,0,0,0);
00224   fTParticle.Momentum(lv); 
00225 }

void MCAppParticle::ProductionVertex ( TLorentzVector &  lv  )  const [virtual]

Definition at line 216 of file MCAppParticle.cxx.

References fTParticle.

00216                                                              {
00217   lv.SetXYZT(0,0,0,0);
00218   fTParticle.ProductionVertex(lv); 
00219 }

virtual void MCAppParticle::SetPolarisation ( Double_t  polx,
Double_t  poly,
Double_t  polz 
) [inline, virtual]

Definition at line 76 of file MCAppParticle.h.

References fTParticle.

00077                             { fTParticle.SetPolarisation(polx,poly,polz); }

virtual void MCAppParticle::SetPrintOption ( std::string  option  )  [inline, virtual]

Definition at line 94 of file MCAppParticle.h.

References fPrintOption.

Referenced by Print().

00094 { fPrintOption = option; }

virtual void MCAppParticle::SetPrintPreface ( std::string  preface  )  [inline, virtual]

Definition at line 92 of file MCAppParticle.h.

References fPrintPreface.

Referenced by Print().

00092 { fPrintPreface=preface; }

virtual void MCAppParticle::SetProcess ( TMCProcess  process  )  [inline, virtual]

Definition at line 87 of file MCAppParticle.h.

References fProcess.

00087 { fProcess = process; }

virtual void MCAppParticle::SetProductionMomentum ( const TLorentzVector &  lv  )  [inline, virtual]

Definition at line 79 of file MCAppParticle.h.

References fTParticle.

00080                                             { fTParticle.SetMomentum(lv); }

virtual void MCAppParticle::SetWeight ( Double_t  weight  )  [inline, virtual]

Definition at line 78 of file MCAppParticle.h.

References fTParticle.

00078 { fTParticle.SetWeight(weight); }


Member Data Documentation

std::vector<const MCAppParticle*> MCAppParticle::fChildren [private]

Definition at line 106 of file MCAppParticle.h.

Referenced by AddChild(), GetChild(), and GetNChildren().

Int_t MCAppParticle::fID [private]

Definition at line 100 of file MCAppParticle.h.

Referenced by GetID().

std::vector<const MCAppParticle*> MCAppParticle::fParents [private]

Definition at line 105 of file MCAppParticle.h.

Referenced by AddParent(), GetNParents(), and GetParent().

std::string MCAppParticle::fPrintOption [private]

Definition at line 104 of file MCAppParticle.h.

Referenced by GetPrintOption(), and SetPrintOption().

std::string MCAppParticle::fPrintPreface [private]

Definition at line 103 of file MCAppParticle.h.

Referenced by GetPrintPreface(), and SetPrintPreface().

TMCProcess MCAppParticle::fProcess [private]

Definition at line 102 of file MCAppParticle.h.

Referenced by GetProcess(), and SetProcess().

std::vector<const MCAppParticle*> MCAppParticle::fSiblings [private]

Definition at line 107 of file MCAppParticle.h.

Referenced by AddSibling(), GetNSiblings(), and GetSibling().

TParticle MCAppParticle::fTParticle [private]

The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1