// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * 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. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // #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 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() const { // Invoke the default implementation in G4VTrajectory... G4VTrajectory::DrawTrajectory(); // ... or override with your own code here. } //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 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 std::abs(i_mode)/1000. E.g: i_mode = 5000 gives easily // visible markers. G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); if (!pVVisManager) return; const G4double markerSize = std::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* 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); } }