source: trunk/source/visualization/modeling/src/G4TrajectoriesModel.cc@ 975

Last change on this file since 975 was 954, checked in by garnier, 17 years ago

remise a jour

File size: 4.2 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id: G4TrajectoriesModel.cc,v 1.24 2006/11/14 14:42:08 allison Exp $
28// GEANT4 tag $Name: $
29//
30//
31// John Allison 26th August 1998.
32// Model which knows how to draw GEANT4 trajectories.
33
34#include "G4TrajectoriesModel.hh"
35
36#include "G4ModelingParameters.hh"
37#include "G4VGraphicsScene.hh"
38#include "G4Event.hh"
39#include "G4AttValue.hh"
40#include "G4AttDef.hh"
41#include "G4AttCheck.hh"
42
43G4TrajectoriesModel::G4TrajectoriesModel (G4int drawingMode):
44fDrawingMode(drawingMode), fpCurrentTrajectory(0) {
45 fGlobalTag = "G4TrajectoriesModel for all trajectories.";
46 fGlobalDescription = fGlobalTag;
47}
48
49G4TrajectoriesModel::~G4TrajectoriesModel () {}
50
51void G4TrajectoriesModelDebugG4AttValues(const G4VTrajectory*);
52
53void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
54 const G4Event* event = fpMP->GetEvent();
55 if (event) {
56 G4TrajectoryContainer* TC = event -> GetTrajectoryContainer ();
57 if (TC) {
58 for (G4int iT = 0; iT < TC->entries(); iT++) {
59 fpCurrentTrajectory = (*TC) [iT];
60 // Debug trajectory:
61 // fpCurrentTrajectory->ShowTrajectory(); G4cout << G4endl;
62 // Debug G4AttValues:
63 // G4TrajectoriesModelDebugG4AttValues(fpCurrentTrajectory);
64 if (fpCurrentTrajectory)
65 sceneHandler.AddCompound (*fpCurrentTrajectory);
66 }
67 }
68 }
69}
70
71// Debug material...
72
73#include "G4VTrajectoryPoint.hh"
74
75void G4TrajectoriesModelDebugG4AttValues(const G4VTrajectory* pTraj)
76{
77 std::vector<G4AttValue>* attValues = pTraj->CreateAttValues();
78 if (attValues) {
79 G4AttCheck attCheck(attValues, pTraj->GetAttDefs());
80 G4cout << "\nProvided G4Atts:\n" << attCheck;
81 if (attCheck.Check()) G4cout << "Error" << G4endl;
82 else {
83 std::vector<G4AttValue> standardValues;
84 std::map<G4String,G4AttDef> standardDefinitions;
85 attCheck.Standard(&standardValues, &standardDefinitions);
86 G4cout << "\nStandard G4Atts:\n"
87 << G4AttCheck(&standardValues, &standardDefinitions);
88 }
89 delete attValues;
90 }
91 for (G4int i = 0; i < pTraj->GetPointEntries(); i++) {
92 G4VTrajectoryPoint* aPoint = pTraj->GetPoint(i);
93 std::vector<G4AttValue>* attValues = aPoint->CreateAttValues();
94 if (attValues) {
95 G4AttCheck attCheck(attValues, aPoint->GetAttDefs());
96 G4cout << "\nProvided G4Atts:\n" << attCheck;
97 if (attCheck.Check()) G4cout << "Error" << G4endl;
98 else {
99 std::vector<G4AttValue> standardValues;
100 std::map<G4String,G4AttDef> standardDefinitions;
101 attCheck.Standard(&standardValues, &standardDefinitions);
102 G4cout << "\nStandard G4Atts:\n"
103 << G4AttCheck(&standardValues, &standardDefinitions);
104 }
105 delete attValues;
106 }
107 }
108}
Note: See TracBrowser for help on using the repository browser.