SwimStepOnceAction Class Reference

#include <SwimStepOnceAction.h>

Inheritance diagram for SwimStepOnceAction:
SwimStepAction

List of all members.

Public Member Functions

 SwimStepOnceAction ()
virtual ~SwimStepOnceAction ()
virtual void Perform (SwimParticle &particle, SwimStepData *stepData)

Detailed Description

Definition at line 16 of file SwimStepOnceAction.h.


Constructor & Destructor Documentation

SwimStepOnceAction::SwimStepOnceAction (  )  [inline]

Definition at line 19 of file SwimStepOnceAction.h.

00019 {;}

virtual SwimStepOnceAction::~SwimStepOnceAction (  )  [inline, virtual]

Definition at line 20 of file SwimStepOnceAction.h.

00020 {;}


Member Function Documentation

void SwimStepOnceAction::Perform ( SwimParticle particle,
SwimStepData stepData 
) [virtual]

Implements SwimStepAction.

Definition at line 17 of file SwimStepOnceAction.cxx.

References SwimParticle::AddRange(), SwimParticle::AddS(), Munits::cm2, Munits::g, SwimParticle::GetDirection(), SwimStepData::GetIsForward(), SwimParticle::GetMomentumModulus(), SwimParticle::GetPosition(), SwimStepData::GetStepper(), SwimStepData::GetStepSize(), SwimStepData::GetSwimMaterial(), SwimGeo::GetSwimMaterialDensity(), SwimGeo::kAir, Msg::kDebug, SwimGeo::kScint, Msg::kWarning, MSG, SwimParticle::SetPosition(), and SwimStepper::StepOnce().

00019 {
00020   //====================================================================
00021   // Set the start point to be the previous end point and swim through 
00022   // again
00023   //====================================================================
00024   SwimGeo::SwimMaterial_t material = stepData->GetSwimMaterial();
00025   if (particle.GetMomentumModulus()!=0.0) {
00026     if (material==SwimGeo::kAir || 
00027         material==SwimGeo::kScint)
00028     {
00029       // Used to calculate path, range traveled in this step
00030       double density = SwimGeo::GetSwimMaterialDensity(material);
00031       TVector3 startpos, path;
00032       startpos = particle.GetPosition();
00033       
00034       // If material is Air or Scint
00035       // straight line approximation
00036 
00037       TVector3 position;
00038       double   xNext[3];
00039       double   stepSize = stepData->GetStepSize();
00040 
00041       if (stepData->GetIsForward()) {
00042         xNext[0] =
00043           particle.GetPosition().X()+stepSize*particle.GetDirection().X();
00044         xNext[1] = 
00045           particle.GetPosition().Y()+stepSize*particle.GetDirection().Y();
00046         xNext[2] = 
00047           particle.GetPosition().Z()+stepSize*particle.GetDirection().Z();
00048       }
00049       else {
00050         xNext[0] =
00051           particle.GetPosition().X()-stepSize*particle.GetDirection().X();
00052         xNext[1] = 
00053           particle.GetPosition().Y()-stepSize*particle.GetDirection().Y();
00054         xNext[2] =
00055           particle.GetPosition().Z()-stepSize*particle.GetDirection().Z();
00056       }
00057 
00058       //===============================================================
00059       // Set position, momentum of the particle
00060       //===============================================================
00061       position.SetXYZ(xNext[0],xNext[1],xNext[2]);
00062       particle.SetPosition(position);
00063   
00064       // Calculate path, range in this step, add to particle totals
00065       path = particle.GetPosition();
00066       double endz = path[2];
00067       path -= startpos;
00068       particle.AddS(path.Mag());
00069       particle.AddRange(density*path.Mag()/(Munits::g/Munits::cm2));
00070       MSG("Swim",Msg::kDebug)  << " start/end z " << startpos[2] <<  "/" << endz << " density " << density/1000. << " dzds " << fabs(path[2]/path.Mag()) << " dRange  " << density*path.Mag() << endl;
00071     }
00072     else {
00073       MSG("Swim",Msg::kDebug) << "StepOnce\n";
00074 
00075       bool stepOk = stepData->GetStepper()->StepOnce(particle, stepData);
00076       MSG("Swim",Msg::kDebug) << "StepOnce complete\n";
00077 
00078       if (stepOk == false) {
00079         // Didn't get the step we asked for
00080         MSG("Swim",Msg::kWarning) << "Step error\n";
00081       }
00082     }
00083   }
00084 }


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1