G4TrajectoryDrawByCharge Class Reference

#include <G4TrajectoryDrawByCharge.hh>

Inheritance diagram for G4TrajectoryDrawByCharge:

G4VTrajectoryModel

Public Types

 Negative = -1
 Neutral = 0
 Positive = 1
enum  Charge { Negative = -1, Neutral = 0, Positive = 1 }

Public Member Functions

 G4TrajectoryDrawByCharge (const G4String &name="Unspecified", G4VisTrajContext *context=0)
 G4TrajectoryDrawByCharge (const G4String &name, const G4Colour &positive, const G4Colour &negative, const G4Colour &neutral)
virtual ~G4TrajectoryDrawByCharge ()
virtual void Draw (const G4VTrajectory &trajectory, const G4int &i_mode=0, const G4bool &visible=true) const
virtual void Draw (const G4VTrajectory &trajectory, const G4bool &visible=true) const
virtual void Print (std::ostream &ostr) const
void Set (const Charge &charge, const G4Colour &colour)
void Set (const Charge &charge, const G4String &colour)
void Set (const G4String &charge, const G4Colour &colour)
void Set (const G4String &charge, const G4String &colour)

Detailed Description

Definition at line 43 of file G4TrajectoryDrawByCharge.hh.


Member Enumeration Documentation

enum G4TrajectoryDrawByCharge::Charge

Enumerator:
Negative 
Neutral 
Positive 

Definition at line 47 of file G4TrajectoryDrawByCharge.hh.

00047 {Negative=-1, Neutral=0, Positive=1}; 


Constructor & Destructor Documentation

G4TrajectoryDrawByCharge::G4TrajectoryDrawByCharge ( const G4String name = "Unspecified",
G4VisTrajContext context = 0 
)

Definition at line 35 of file G4TrajectoryDrawByCharge.cc.

References G4Colour::Blue(), G4Colour::Green(), Negative, Neutral, Positive, and G4Colour::Red().

00036   :G4VTrajectoryModel(name, context)
00037 {
00038   // Default configuration
00039   fMap[Positive] = G4Colour::Blue();
00040   fMap[Negative] = G4Colour::Red();
00041   fMap[Neutral] = G4Colour::Green();
00042 }

G4TrajectoryDrawByCharge::G4TrajectoryDrawByCharge ( const G4String name,
const G4Colour positive,
const G4Colour negative,
const G4Colour neutral 
)

Definition at line 44 of file G4TrajectoryDrawByCharge.cc.

References Negative, Neutral, and Positive.

00048   :G4VTrajectoryModel(name)
00049 {
00050   fMap[Positive] = positive;
00051   fMap[Negative] = negative;
00052   fMap[Neutral] = neutral;
00053 }

G4TrajectoryDrawByCharge::~G4TrajectoryDrawByCharge (  )  [virtual]

Definition at line 55 of file G4TrajectoryDrawByCharge.cc.

00055 {}


Member Function Documentation

void G4TrajectoryDrawByCharge::Draw ( const G4VTrajectory trajectory,
const G4bool visible = true 
) const [virtual]

Implements G4VTrajectoryModel.

Definition at line 66 of file G4TrajectoryDrawByCharge.cc.

References G4TrajectoryDrawerUtils::DrawLineAndPoints(), G4cout, G4endl, G4VTrajectory::GetCharge(), G4ModelColourMap< T >::GetColour(), G4VTrajectoryModel::GetContext(), G4VTrajectoryModel::GetVerbose(), G4VTrajectoryModel::Name(), Negative, Neutral, Positive, G4VisTrajContext::Print(), G4VisTrajContext::SetLineColour(), and G4VisTrajContext::SetVisible().

00067 {
00068   G4Colour colour;
00069 
00070   const G4double charge = traj.GetCharge();
00071 
00072   if(charge>0.)      fMap.GetColour(Positive, colour); 
00073   else if(charge<0.) fMap.GetColour(Negative, colour); 
00074   else               fMap.GetColour(Neutral, colour); 
00075 
00076   G4VisTrajContext myContext(GetContext());
00077   
00078   myContext.SetLineColour(colour);
00079   myContext.SetVisible(visible);
00080   
00081   if (GetVerbose()) {
00082     G4cout<<"G4TrajectoryDrawByCharge drawer named "<<Name();
00083     G4cout<<", drawing trajectory with charge, "<<charge<<G4endl;
00084     G4cout<<", with configuration:"<<G4endl;
00085     myContext.Print(G4cout);
00086   }
00087 
00088   G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, myContext);
00089 }

void G4TrajectoryDrawByCharge::Draw ( const G4VTrajectory trajectory,
const G4int i_mode = 0,
const G4bool visible = true 
) const [virtual]

Implements G4VTrajectoryModel.

Definition at line 58 of file G4TrajectoryDrawByCharge.cc.

00061 {
00062   Draw(object, visible);
00063 }

void G4TrajectoryDrawByCharge::Print ( std::ostream &  ostr  )  const [virtual]

Implements G4VTrajectoryModel.

Definition at line 92 of file G4TrajectoryDrawByCharge.cc.

References G4cout, G4endl, G4VTrajectoryModel::GetContext(), G4VTrajectoryModel::Name(), G4VisTrajContext::Print(), and G4ModelColourMap< T >::Print().

00093 {
00094   ostr<<"G4TrajectoryDrawByCharge model "<< Name() <<" colour scheme: "<<std::endl;
00095   fMap.Print(ostr);
00096   ostr<<"Default configuration:"<<G4endl;
00097   GetContext().Print(G4cout);
00098 }

void G4TrajectoryDrawByCharge::Set ( const G4String charge,
const G4String colour 
)

Definition at line 113 of file G4TrajectoryDrawByCharge.cc.

References G4Exception(), JustWarning, and Set().

00114 {  
00115   Charge myCharge;
00116   
00117   if (!ConvertToCharge(charge, myCharge)) {
00118     G4ExceptionDescription ed;
00119     ed << "Invalid charge "<<charge;
00120     G4Exception   
00121       ("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4String& colour)", "modeling0121", JustWarning, ed);
00122     return;
00123   }
00124 
00125   return Set(myCharge, colour);
00126 }

void G4TrajectoryDrawByCharge::Set ( const G4String charge,
const G4Colour colour 
)

Definition at line 129 of file G4TrajectoryDrawByCharge.cc.

References G4Exception(), JustWarning, and Set().

00130 {  
00131   Charge myCharge;
00132   
00133   if (!ConvertToCharge(charge, myCharge)) {
00134     G4ExceptionDescription ed;
00135     ed << "Invalid charge "<<charge;
00136     G4Exception   
00137       ("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4Colour& colour)", "modeling0122", JustWarning, ed);
00138   }
00139 
00140   return Set(myCharge, colour);
00141 }

void G4TrajectoryDrawByCharge::Set ( const Charge charge,
const G4String colour 
)

Definition at line 101 of file G4TrajectoryDrawByCharge.cc.

References G4ModelColourMap< T >::Set().

00102 {
00103   fMap.Set(charge, colour);
00104 }

void G4TrajectoryDrawByCharge::Set ( const Charge charge,
const G4Colour colour 
)

Definition at line 107 of file G4TrajectoryDrawByCharge.cc.

Referenced by Set().

00108 {
00109   fMap[charge] = colour;
00110 }


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