#include <map>
#include <vector>
#include <assert.h>
#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 "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().
00345 { 00346 // If i_mode>=0, draws a trajectory as a polyline (blue for 00347 // positive, red for negative, green for neutral) and, if i_mode!=0, 00348 // adds markers - yellow circles for step points and magenta squares 00349 // for auxiliary points, if any - whose screen size in pixels is 00350 // given by abs(i_mode)/1000. E.g: i_mode = 5000 gives easily 00351 // visible markers. 00352 00353 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); 00354 if (!pVVisManager) return; 00355 00356 const G4double markerSize = abs(i_mode)/1000; 00357 G4bool lineRequired (i_mode >= 0); 00358 G4bool markersRequired (markerSize > 0.); 00359 00360 G4Polyline trajectoryLine; 00361 G4Polymarker stepPoints; 00362 G4Polymarker auxiliaryPoints; 00363 00364 for (G4int i = 0; i < traj->GetPointEntries() ; i++) { 00365 G4VTrajectoryPoint* aTrajectoryPoint = traj->GetPoint(i); 00366 const std::vector<G4ThreeVector>* auxiliaries 00367 = aTrajectoryPoint->GetAuxiliaryPoints(); 00368 if (auxiliaries) { 00369 for (size_t iAux = 0; iAux < auxiliaries->size(); ++iAux) { 00370 const G4ThreeVector pos((*auxiliaries)[iAux]); 00371 if (lineRequired) { 00372 trajectoryLine.push_back(pos); 00373 } 00374 if (markersRequired) { 00375 auxiliaryPoints.push_back(pos); 00376 } 00377 } 00378 } 00379 const G4ThreeVector pos(aTrajectoryPoint->GetPosition()); 00380 if (lineRequired) { 00381 trajectoryLine.push_back(pos); 00382 } 00383 if (markersRequired) { 00384 stepPoints.push_back(pos); 00385 } 00386 } 00387 00388 if (lineRequired) { 00389 if(!va.IsVisible()) return; 00390 trajectoryLine.SetVisAttributes(va); 00391 pVVisManager->Draw(trajectoryLine); 00392 } 00393 if (markersRequired) { 00394 auxiliaryPoints.SetMarkerType(G4Polymarker::squares); 00395 auxiliaryPoints.SetScreenSize(markerSize); 00396 auxiliaryPoints.SetFillStyle(G4VMarker::filled); 00397 G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.)); // Magenta 00398 auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs); 00399 pVVisManager->Draw(auxiliaryPoints); 00400 00401 stepPoints.SetMarkerType(G4Polymarker::circles); 00402 stepPoints.SetScreenSize(markerSize); 00403 stepPoints.SetFillStyle(G4VMarker::filled); 00404 G4VisAttributes stepPointsAttribs(G4Colour(1.,1.,0.)); // Yellow. 00405 stepPoints.SetVisAttributes(&stepPointsAttribs); 00406 pVVisManager->Draw(stepPoints); 00407 } 00408 }
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().