Import Geant4 6.2.0 source tree
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "LXeTrajectory.hh"
|
||||
#include "G4TrajectoryPoint.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Polymarker.hh"
|
||||
|
||||
G4Allocator<LXeTrajectory> LXeTrajectoryAllocator;
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
LXeTrajectory::LXeTrajectory()
|
||||
:G4Trajectory(),wls(false),drawit(false),forceNoDraw(false),forceDraw(false)
|
||||
{
|
||||
particleDefinition=0;
|
||||
}
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
LXeTrajectory::LXeTrajectory(const G4Track* aTrack)
|
||||
:G4Trajectory(aTrack),wls(false),drawit(false)
|
||||
{
|
||||
particleDefinition=aTrack->GetDefinition();
|
||||
}
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
LXeTrajectory::LXeTrajectory(LXeTrajectory &right)
|
||||
:G4Trajectory(right),wls(right.wls),drawit(right.drawit)
|
||||
{
|
||||
particleDefinition=right.particleDefinition;
|
||||
}
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
LXeTrajectory::~LXeTrajectory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
|
||||
void LXeTrajectory::DrawTrajectory(G4int i_mode) const{
|
||||
//Taken from G4VTrajectory and modified to select colours based on particle
|
||||
//type and to selectively eliminate drawing of certain trajectories.
|
||||
|
||||
if(!forceDraw && (!drawit || forceNoDraw))
|
||||
return;
|
||||
|
||||
// If i_mode>=0, draws a trajectory as a polyline and, if i_mode!=0,
|
||||
// adds markers - yellow circles for step points and magenta squares
|
||||
// for auxiliary points, if any - whose screen size in pixels is
|
||||
// given by abs(i_mode)/1000. E.g: i_mode = 5000 gives easily
|
||||
// visible markers.
|
||||
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if (!pVVisManager) return;
|
||||
|
||||
const G4double markerSize = abs(i_mode)/1000;
|
||||
G4bool lineRequired (i_mode >= 0);
|
||||
G4bool markersRequired (markerSize > 0.);
|
||||
|
||||
G4Polyline trajectoryLine;
|
||||
G4Polymarker stepPoints;
|
||||
G4Polymarker auxiliaryPoints;
|
||||
|
||||
for (G4int i = 0; i < GetPointEntries() ; i++) {
|
||||
G4VTrajectoryPoint* aTrajectoryPoint = GetPoint(i);
|
||||
const std::vector<G4ThreeVector>* auxiliaries
|
||||
= aTrajectoryPoint->GetAuxiliaryPoints();
|
||||
if (auxiliaries) {
|
||||
for (size_t iAux = 0; iAux < auxiliaries->size(); ++iAux) {
|
||||
const G4ThreeVector pos((*auxiliaries)[iAux]);
|
||||
if (lineRequired) {
|
||||
trajectoryLine.push_back(pos);
|
||||
}
|
||||
if (markersRequired) {
|
||||
auxiliaryPoints.push_back(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
const G4ThreeVector pos(aTrajectoryPoint->GetPosition());
|
||||
if (lineRequired) {
|
||||
trajectoryLine.push_back(pos);
|
||||
}
|
||||
if (markersRequired) {
|
||||
stepPoints.push_back(pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (lineRequired) {
|
||||
G4Colour colour;
|
||||
|
||||
if(particleDefinition==G4OpticalPhoton::OpticalPhotonDefinition()){
|
||||
if(wls) //WLS photons are red
|
||||
colour = G4Colour(1.,0.,0.);
|
||||
else{ //Scintillation and Cerenkov photons are green
|
||||
colour = G4Colour(0.,1.,0.);
|
||||
}
|
||||
}
|
||||
else //All other particles are blue
|
||||
colour = G4Colour(0.,0.,1.);
|
||||
|
||||
G4VisAttributes trajectoryLineAttribs(colour);
|
||||
trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
|
||||
pVVisManager->Draw(trajectoryLine);
|
||||
}
|
||||
if (markersRequired) {
|
||||
auxiliaryPoints.SetMarkerType(G4Polymarker::squares);
|
||||
auxiliaryPoints.SetScreenSize(markerSize);
|
||||
auxiliaryPoints.SetFillStyle(G4VMarker::filled);
|
||||
G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.)); // Magenta
|
||||
auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
|
||||
pVVisManager->Draw(auxiliaryPoints);
|
||||
|
||||
stepPoints.SetMarkerType(G4Polymarker::circles);
|
||||
stepPoints.SetScreenSize(markerSize);
|
||||
stepPoints.SetFillStyle(G4VMarker::filled);
|
||||
G4VisAttributes stepPointsAttribs(G4Colour(1.,1.,0.)); // Yellow.
|
||||
stepPoints.SetVisAttributes(&stepPointsAttribs);
|
||||
pVVisManager->Draw(stepPoints);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user