TestSwimmer Class Reference

#include <TestSwimmer.h>

Inheritance diagram for TestSwimmer:
JobCModule

List of all members.

Public Member Functions

 TestSwimmer ()
JobCResult Ana (const MomNavigator *mom)

Detailed Description

Definition at line 6 of file TestSwimmer.h.


Constructor & Destructor Documentation

TestSwimmer::TestSwimmer (  )  [inline]

Definition at line 9 of file TestSwimmer.h.

00009 { }


Member Function Documentation

JobCResult TestSwimmer::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 62 of file TestSwimmer.cxx.

References SwimStepper::AddStepAction(), SwimParticle::GetEnergy(), SwimParticle::GetMomentum(), SwimParticle::GetMomentumModulus(), SwimParticle::GetPosition(), SwimSwimmer::GetStepper(), Munits::GeV, Detector::kFar, JobCResult::kPassed, SimFlag::kReroot, Munits::m, s(), SwimSwimmer::SwimBackward(), and SwimSwimmer::SwimForward().

00063 {
00064   /*
00065   // Find PrimaryCandidateRecord fragment in MOM.
00066   CandRecord *candrec = dynamic_cast<CandRecord *>
00067     (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00068   if (candrec == 0) {
00069     MSG("Demo", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00070                                << endl;
00071   }
00072   
00073   // Make a swimmer object using the validity context
00074   SwimSwimmer s(candrec->GetVldContext());
00075   */
00076 
00077   /*
00078   // Define a Bfield; remember to delete BField at the end
00079   BField* b;
00080   b = new ConstBField();
00081 
00082   // Make a swimmer object using the BField
00083   SwimSwimmer s(b);
00084   */
00085 
00086   // or one can use the following to make a validity context and a swimmer
00087   VldContext vldContext(Detector::kFar,SimFlag::kReroot,VldTimeStamp());
00088   SwimSwimmer s(vldContext);
00089 
00090   // Add an action to the stepper - in this case a debug printout
00091   SwimPrintStepAction printStep;
00092   s.GetStepper()->AddStepAction(&printStep);
00093 
00094   // Setup the initial condition for the stepper
00095   double x  =  -1.5*Munits::m;
00096   double y  =  0.0*Munits::m;
00097   double z  =  0.1*Munits::m;
00098   double px =  1.0*Munits::GeV;
00099   double py =  -3.5*0.058/sqrt(0.058*0.058+1)*Munits::GeV;
00100   double pz =  3.5/sqrt(0.058*0.058+1)*Munits::GeV;
00101 
00102   TVector3 position(x,y,z);
00103   TVector3 momentum(px,py,pz);
00104 
00105   // Set up the particle to swim. In this case we're swimming a muon
00106   // so we could have used the default mass and charge,
00107   // ie. SwimParticle(position,momentum)
00108   double muMass   = 0.105658357*Munits::GeV;
00109   double muCharge = -1.0;
00110   SwimParticle muon1(position, momentum, muMass, muCharge);
00111 
00112   // Set the Momentum condition for swimming
00113   double pThreshold = 0.3*Munits::GeV;
00114   SwimMomentumCondition pc(pThreshold);
00115 
00116   // Print out inital info of a particle
00117   cout << "0" << " "
00118        << muon1.GetPosition().X() << " "
00119        << muon1.GetPosition().Y() << " "
00120        << muon1.GetPosition().Z() << " "
00121        << muon1.GetMomentum().X() << " "
00122        << muon1.GetMomentum().Y() << " "
00123        << muon1.GetMomentum().Z() << " "
00124        << muon1.GetMomentumModulus() << " "
00125        << muon1.GetEnergy() << " "
00126        << "0" << " "
00127        << muon1.GetPosition().X() << " "
00128        << muon1.GetPosition().Y() << " "
00129        << muon1.GetPosition().Z() << " "
00130        << "0" << " "
00131        << endl;
00132 
00133   // Swim the muon particle until the condition is met
00134   bool done1 = s.SwimForward(muon1,pc);
00135   cout << "Momentum Condition Satisfied: " << done1 << endl;
00136 
00137   // Set the Z condition for swimming
00138   SwimZCondition zc(0.1*Munits::m);
00139 
00140   // Swim the muon particle backward
00141   SwimParticle muon2(muon1.GetPosition(),muon1.GetMomentum());
00142   bool done2 = s.SwimBackward(muon2,zc);
00143 
00144   cout << "99999" << " "
00145        << muon2.GetPosition().X() << " "
00146        << muon2.GetPosition().Y() << " "
00147        << muon2.GetPosition().Z() << " "
00148        << muon2.GetMomentum().X() << " "
00149        << muon2.GetMomentum().Y() << " "
00150        << muon2.GetMomentum().Z() << " "
00151        << muon2.GetMomentumModulus() << " "
00152        << muon2.GetEnergy() << " "
00153        << "0" << " "
00154        << muon2.GetPosition().X() << " "
00155        << muon2.GetPosition().Y() << " "
00156        << muon2.GetPosition().Z() << " "
00157        << "0" << " "
00158        << endl;
00159 
00160   cout << "Z Condition Satisfied: " << done2 << endl;
00161 
00162   return JobCResult::kPassed;
00163 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1