#include <map>
#include <vector>
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4VisAttributes.hh"
#include "G4ParticleTable.hh"
#include "G4Track.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4Polyline.hh"
#include "G4Polymarker.hh"
#include "BLAssert.hh"
#include "BLCommand.hh"
#include "BLCommandAlias.hh"
#include "BLManager.hh"
#include "BLParam.hh"
Classes | |
class | BLCMDparticlecolor |
class BLCMDparticlecolor -- implement the particlecolor command More... | |
class | BLTrajectory |
class BLTrajectory implements particle-color drawing. More... | |
class | BLSaveTrajectory |
class BLSaveTrajectory is used to save a trajectory from the Center particle run to the visual run. More... | |
Functions | |
static void | drawTrajectory (const G4VTrajectory *traj, const G4VisAttributes &va, G4int i_mode=0) |
drawTrajectory() is a static function to draw a trajectory (making it static is the simplest way to share it between classes BLTrajectory and BLSaveTrajectory) | |
Variables | |
BLCMDparticlecolor | defaultParticleColor |
BLCommandAlias | aliasParticleColor ("trackcolor", defaultParticleColor) |
std::vector< BLSaveTrajectory * > | CenterTrajectories |
vector of Center particle trajectories (to be added to the first event during VISUAL tracking) |
static void drawTrajectory | ( | const G4VTrajectory * | traj, | |
const G4VisAttributes & | va, | |||
G4int | i_mode = 0 | |||
) | [static] |
drawTrajectory() is a static function to draw a trajectory (making it static is the simplest way to share it between classes BLTrajectory and BLSaveTrajectory)
Referenced by BLSaveTrajectory::DrawTrajectory(), and BLTrajectory::DrawTrajectory().
00346 { 00347 // If i_mode>=0, draws a trajectory as a polyline (blue for 00348 // positive, red for negative, green for neutral) and, if i_mode!=0, 00349 // adds markers - yellow circles for step points and magenta squares 00350 // for auxiliary points, if any - whose screen size in pixels is 00351 // given by abs(i_mode)/1000. E.g: i_mode = 5000 gives easily 00352 // visible markers. 00353 00354 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); 00355 if (!pVVisManager) return; 00356 00357 const G4double markerSize = abs(i_mode)/1000; 00358 G4bool lineRequired (i_mode >= 0); 00359 G4bool markersRequired (markerSize > 0.); 00360 00361 G4Polyline trajectoryLine; 00362 G4Polymarker stepPoints; 00363 G4Polymarker auxiliaryPoints; 00364 00365 for (G4int i = 0; i < traj->GetPointEntries() ; i++) { 00366 G4VTrajectoryPoint* aTrajectoryPoint = traj->GetPoint(i); 00367 const std::vector<G4ThreeVector>* auxiliaries 00368 = aTrajectoryPoint->GetAuxiliaryPoints(); 00369 if (auxiliaries) { 00370 for (size_t iAux = 0; iAux < auxiliaries->size(); ++iAux) { 00371 const G4ThreeVector pos((*auxiliaries)[iAux]); 00372 if (lineRequired) { 00373 trajectoryLine.push_back(pos); 00374 } 00375 if (markersRequired) { 00376 auxiliaryPoints.push_back(pos); 00377 } 00378 } 00379 } 00380 const G4ThreeVector pos(aTrajectoryPoint->GetPosition()); 00381 if (lineRequired) { 00382 trajectoryLine.push_back(pos); 00383 } 00384 if (markersRequired) { 00385 stepPoints.push_back(pos); 00386 } 00387 } 00388 00389 if (lineRequired) { 00390 if(!va.IsVisible()) return; 00391 trajectoryLine.SetVisAttributes(va); 00392 pVVisManager->Draw(trajectoryLine); 00393 } 00394 if (markersRequired) { 00395 auxiliaryPoints.SetMarkerType(G4Polymarker::squares); 00396 auxiliaryPoints.SetScreenSize(markerSize); 00397 auxiliaryPoints.SetFillStyle(G4VMarker::filled); 00398 G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.)); // Magenta 00399 auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs); 00400 pVVisManager->Draw(auxiliaryPoints); 00401 00402 stepPoints.SetMarkerType(G4Polymarker::circles); 00403 stepPoints.SetScreenSize(markerSize); 00404 stepPoints.SetFillStyle(G4VMarker::filled); 00405 G4VisAttributes stepPointsAttribs(G4Colour(1.,1.,0.)); // Yellow. 00406 stepPoints.SetVisAttributes(&stepPointsAttribs); 00407 pVVisManager->Draw(stepPoints); 00408 } 00409 }
BLCommandAlias aliasParticleColor("trackcolor", defaultParticleColor) |
std::vector<BLSaveTrajectory*> CenterTrajectories |
vector of Center particle trajectories (to be added to the first event during VISUAL tracking)
Referenced by BLCMDparticlecolor::EndOfEventAction(), and BLCMDparticlecolor::PostUserTrackingAction().