G4SmoothTrajectory Class Reference

#include <G4SmoothTrajectory.hh>

Inheritance diagram for G4SmoothTrajectory:

G4VTrajectory

Public Member Functions

 G4SmoothTrajectory ()
 G4SmoothTrajectory (const G4Track *aTrack)
 G4SmoothTrajectory (G4SmoothTrajectory &)
virtual ~G4SmoothTrajectory ()
void * operator new (size_t)
void operator delete (void *)
int operator== (const G4SmoothTrajectory &right) const
G4int GetTrackID () const
G4int GetParentID () const
G4String GetParticleName () const
G4double GetCharge () const
G4int GetPDGEncoding () const
G4double GetInitialKineticEnergy () const
G4ThreeVector GetInitialMomentum () const
virtual void ShowTrajectory (std::ostream &os=G4cout) const
virtual void DrawTrajectory (G4int i_mode=0) const
virtual void AppendStep (const G4Step *aStep)
virtual int GetPointEntries () const
virtual G4VTrajectoryPointGetPoint (G4int i) const
virtual void MergeTrajectory (G4VTrajectory *secondTrajectory)
G4ParticleDefinitionGetParticleDefinition ()
virtual const std::map< G4String,
G4AttDef > * 
GetAttDefs () const
virtual std::vector< G4AttValue > * CreateAttValues () const

Detailed Description

Definition at line 64 of file G4SmoothTrajectory.hh.


Constructor & Destructor Documentation

G4SmoothTrajectory::G4SmoothTrajectory (  ) 

Definition at line 58 of file G4SmoothTrajectory.cc.

00059 :  positionRecord(0), fTrackID(0), fParentID(0),
00060    PDGEncoding( 0 ), PDGCharge(0.0), ParticleName(""),
00061    initialKineticEnergy( 0. ), initialMomentum( G4ThreeVector() )
00062 {;}

G4SmoothTrajectory::G4SmoothTrajectory ( const G4Track aTrack  ) 

Definition at line 64 of file G4SmoothTrajectory.cc.

References G4Track::GetDefinition(), G4Track::GetKineticEnergy(), G4Track::GetMomentum(), G4Track::GetParentID(), G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetPDGCharge(), G4ParticleDefinition::GetPDGEncoding(), G4Track::GetPosition(), and G4Track::GetTrackID().

00065 {
00066    G4ParticleDefinition * fpParticleDefinition = aTrack->GetDefinition();
00067    ParticleName = fpParticleDefinition->GetParticleName();
00068    PDGCharge = fpParticleDefinition->GetPDGCharge();
00069    PDGEncoding = fpParticleDefinition->GetPDGEncoding();
00070    fTrackID = aTrack->GetTrackID();
00071    fParentID = aTrack->GetParentID();
00072    initialKineticEnergy = aTrack->GetKineticEnergy();
00073    initialMomentum = aTrack->GetMomentum();
00074    positionRecord = new TrajectoryPointContainer();
00075    // Following is for the first trajectory point
00076    positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition()));
00077 
00078    // The first point has no auxiliary points, so set the auxiliary
00079    // points vector to NULL (jacek 31/10/2002)
00080    positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition(), 0));
00081 }

G4SmoothTrajectory::G4SmoothTrajectory ( G4SmoothTrajectory  ) 

Definition at line 83 of file G4SmoothTrajectory.cc.

References fParentID, fTrackID, initialKineticEnergy, initialMomentum, ParticleName, PDGCharge, PDGEncoding, and positionRecord.

00083                                                                 :G4VTrajectory()
00084 {
00085   ParticleName = right.ParticleName;
00086   PDGCharge = right.PDGCharge;
00087   PDGEncoding = right.PDGEncoding;
00088   fTrackID = right.fTrackID;
00089   fParentID = right.fParentID;
00090   initialKineticEnergy = right.initialKineticEnergy;
00091   initialMomentum = right.initialMomentum;
00092   positionRecord = new TrajectoryPointContainer();
00093 
00094   for(size_t i=0;i<right.positionRecord->size();i++)
00095   {
00096     G4SmoothTrajectoryPoint* rightPoint = (G4SmoothTrajectoryPoint*)((*(right.positionRecord))[i]);
00097     positionRecord->push_back(new G4SmoothTrajectoryPoint(*rightPoint));
00098   }
00099 }

G4SmoothTrajectory::~G4SmoothTrajectory (  )  [virtual]

Definition at line 101 of file G4SmoothTrajectory.cc.

00102 {
00103   if (positionRecord) {
00104     //  positionRecord->clearAndDestroy();
00105     size_t i;
00106     for(i=0;i<positionRecord->size();i++){
00107       delete  (*positionRecord)[i];
00108     }
00109     positionRecord->clear();
00110     delete positionRecord;
00111   }
00112 }


Member Function Documentation

void G4SmoothTrajectory::AppendStep ( const G4Step aStep  )  [virtual]

Implements G4VTrajectory.

Definition at line 218 of file G4SmoothTrajectory.cc.

References G4Step::GetPointerToVectorOfAuxiliaryPoints(), G4StepPoint::GetPosition(), and G4Step::GetPostStepPoint().

00219 {
00220   // (jacek 30/10/2002)
00221   positionRecord->push_back(
00222       new G4SmoothTrajectoryPoint(aStep->GetPostStepPoint()->GetPosition(),
00223                                   aStep->GetPointerToVectorOfAuxiliaryPoints()));
00224 }

std::vector< G4AttValue > * G4SmoothTrajectory::CreateAttValues (  )  const [virtual]

Reimplemented from G4VTrajectory.

Definition at line 181 of file G4SmoothTrajectory.cc.

References G4UIcommand::ConvertToString(), G4BestUnit, G4cout, GetAttDefs(), and GetPointEntries().

00182 {
00183   std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
00184 
00185   values->push_back
00186     (G4AttValue("ID",G4UIcommand::ConvertToString(fTrackID),""));
00187 
00188   values->push_back
00189     (G4AttValue("PID",G4UIcommand::ConvertToString(fParentID),""));
00190 
00191   values->push_back(G4AttValue("PN",ParticleName,""));
00192 
00193   values->push_back
00194     (G4AttValue("Ch",G4UIcommand::ConvertToString(PDGCharge),""));
00195 
00196   values->push_back
00197     (G4AttValue("PDG",G4UIcommand::ConvertToString(PDGEncoding),""));
00198 
00199   values->push_back
00200     (G4AttValue("IKE",G4BestUnit(initialKineticEnergy,"Energy"),""));
00201 
00202   values->push_back
00203     (G4AttValue("IMom",G4BestUnit(initialMomentum,"Energy"),""));
00204 
00205   values->push_back
00206     (G4AttValue("IMag",G4BestUnit(initialMomentum.mag(),"Energy"),""));
00207 
00208   values->push_back
00209     (G4AttValue("NTP",G4UIcommand::ConvertToString(GetPointEntries()),""));
00210 
00211 #ifdef G4ATTDEBUG
00212    G4cout << G4AttCheck(values,GetAttDefs());
00213 #endif
00214 
00215   return values;
00216 }

void G4SmoothTrajectory::DrawTrajectory ( G4int  i_mode = 0  )  const [virtual]

Reimplemented from G4VTrajectory.

Definition at line 130 of file G4SmoothTrajectory.cc.

References G4VTrajectory::DrawTrajectory().

00131 {
00132   // Invoke the default implementation in G4VTrajectory...
00133   G4VTrajectory::DrawTrajectory(i_mode);
00134   // ... or override with your own code here.
00135 }

const std::map< G4String, G4AttDef > * G4SmoothTrajectory::GetAttDefs (  )  const [virtual]

Reimplemented from G4VTrajectory.

Definition at line 137 of file G4SmoothTrajectory.cc.

References G4AttDefStore::GetInstance().

Referenced by CreateAttValues().

00138 {
00139   G4bool isNew;
00140   std::map<G4String,G4AttDef>* store
00141     = G4AttDefStore::GetInstance("G4SmoothTrajectory",isNew);
00142   if (isNew) {
00143 
00144     G4String ID("ID");
00145     (*store)[ID] = G4AttDef(ID,"Track ID","Physics","","G4int");
00146 
00147     G4String PID("PID");
00148     (*store)[PID] = G4AttDef(PID,"Parent ID","Physics","","G4int");
00149 
00150     G4String PN("PN");
00151     (*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String");
00152 
00153     G4String Ch("Ch");
00154     (*store)[Ch] = G4AttDef(Ch,"Charge","Physics","e+","G4double");
00155 
00156     G4String PDG("PDG");
00157     (*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
00158 
00159     G4String IKE("IKE");
00160     (*store)[IKE] = 
00161       G4AttDef(IKE, "Initial kinetic energy",
00162                "Physics","G4BestUnit","G4double");
00163 
00164     G4String IMom("IMom");
00165     (*store)[IMom] = G4AttDef(IMom, "Initial momentum",
00166                               "Physics","G4BestUnit","G4ThreeVector");
00167 
00168     G4String IMag("IMag");
00169     (*store)[IMag] = G4AttDef
00170       (IMag, "Initial momentum magnitude",
00171        "Physics","G4BestUnit","G4double");
00172 
00173     G4String NTP("NTP");
00174     (*store)[NTP] = G4AttDef(NTP,"No. of points","Physics","","G4int");
00175 
00176   }
00177   return store;
00178 }

G4double G4SmoothTrajectory::GetCharge (  )  const [inline, virtual]

Implements G4VTrajectory.

Definition at line 96 of file G4SmoothTrajectory.hh.

00097    { return PDGCharge; }

G4double G4SmoothTrajectory::GetInitialKineticEnergy (  )  const [inline]

Definition at line 100 of file G4SmoothTrajectory.hh.

00101    { return initialKineticEnergy; }

G4ThreeVector G4SmoothTrajectory::GetInitialMomentum (  )  const [inline, virtual]

Implements G4VTrajectory.

Definition at line 102 of file G4SmoothTrajectory.hh.

00103    { return initialMomentum; }

G4int G4SmoothTrajectory::GetParentID (  )  const [inline, virtual]

Implements G4VTrajectory.

Definition at line 92 of file G4SmoothTrajectory.hh.

00093    { return fParentID; }

G4ParticleDefinition * G4SmoothTrajectory::GetParticleDefinition (  ) 

Definition at line 226 of file G4SmoothTrajectory.cc.

References G4ParticleTable::GetParticleTable().

00227 {
00228    return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
00229 }

G4String G4SmoothTrajectory::GetParticleName (  )  const [inline, virtual]

Implements G4VTrajectory.

Definition at line 94 of file G4SmoothTrajectory.hh.

00095    { return ParticleName; }

G4int G4SmoothTrajectory::GetPDGEncoding (  )  const [inline, virtual]

Implements G4VTrajectory.

Definition at line 98 of file G4SmoothTrajectory.hh.

00099    { return PDGEncoding; }

virtual G4VTrajectoryPoint* G4SmoothTrajectory::GetPoint ( G4int  i  )  const [inline, virtual]

Implements G4VTrajectory.

Definition at line 111 of file G4SmoothTrajectory.hh.

00112    { return (*positionRecord)[i]; }

virtual int G4SmoothTrajectory::GetPointEntries (  )  const [inline, virtual]

Implements G4VTrajectory.

Definition at line 110 of file G4SmoothTrajectory.hh.

Referenced by CreateAttValues(), and MergeTrajectory().

00110 { return positionRecord->size(); }

G4int G4SmoothTrajectory::GetTrackID (  )  const [inline, virtual]

Implements G4VTrajectory.

Definition at line 90 of file G4SmoothTrajectory.hh.

00091    { return fTrackID; }

void G4SmoothTrajectory::MergeTrajectory ( G4VTrajectory secondTrajectory  )  [virtual]

Implements G4VTrajectory.

Definition at line 231 of file G4SmoothTrajectory.cc.

References GetPointEntries(), and positionRecord.

00232 {
00233   if(!secondTrajectory) return;
00234 
00235   G4SmoothTrajectory* seco = (G4SmoothTrajectory*)secondTrajectory;
00236   G4int ent = seco->GetPointEntries();
00237   for(G4int i=1;i<ent;i++) // initial point of the second trajectory should not be merged
00238   { 
00239     positionRecord->push_back((*(seco->positionRecord))[i]);
00240     //    positionRecord->push_back(seco->positionRecord->removeAt(1));
00241   }
00242   delete (*seco->positionRecord)[0];
00243   seco->positionRecord->clear();
00244 }

void G4SmoothTrajectory::operator delete ( void *   )  [inline]

Definition at line 149 of file G4SmoothTrajectory.hh.

References aSmoothTrajectoryAllocator.

00150 {
00151   aSmoothTrajectoryAllocator.FreeSingle((G4SmoothTrajectory*)aTrajectory);
00152 }

void * G4SmoothTrajectory::operator new ( size_t   )  [inline]

Definition at line 142 of file G4SmoothTrajectory.hh.

References aSmoothTrajectoryAllocator.

00143 {
00144   void* aTrajectory;
00145   aTrajectory = (void*)aSmoothTrajectoryAllocator.MallocSingle();
00146   return aTrajectory;
00147 }

int G4SmoothTrajectory::operator== ( const G4SmoothTrajectory right  )  const [inline]

Definition at line 86 of file G4SmoothTrajectory.hh.

00087    {return (this==&right);} 

void G4SmoothTrajectory::ShowTrajectory ( std::ostream &  os = G4cout  )  const [virtual]

Reimplemented from G4VTrajectory.

Definition at line 114 of file G4SmoothTrajectory.cc.

References G4VTrajectory::ShowTrajectory().

00115 {
00116   // Invoke the default implementation in G4VTrajectory...
00117   G4VTrajectory::ShowTrajectory(os);
00118   // ... or override with your own code here.
00119 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:24 2013 for Geant4 by  doxygen 1.4.7