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: MySteppingAction.cc,v 1.16 2006/06/29 21:34:34 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // 16/Apr/1997 J. Allison: For visualization/test/test19. |
---|
32 | |
---|
33 | #include "MySteppingAction.hh" |
---|
34 | |
---|
35 | #include "G4SteppingManager.hh" |
---|
36 | #include "G4ParticleDefinition.hh" |
---|
37 | #include "G4VVisManager.hh" |
---|
38 | #include "G4VisAttributes.hh" |
---|
39 | #include "G4Colour.hh" |
---|
40 | #include "G4Polyline.hh" |
---|
41 | #include "G4Circle.hh" |
---|
42 | #include "G4Square.hh" |
---|
43 | |
---|
44 | void MySteppingAction::UserSteppingAction(const G4Step*) { |
---|
45 | // User Action Example - begin snippet. |
---|
46 | static int coutCount = 0; |
---|
47 | if (coutCount < 10) { |
---|
48 | coutCount++; |
---|
49 | G4cout << "MySteppingAction::UserSteppingAction called." << G4endl; |
---|
50 | } |
---|
51 | /* |
---|
52 | G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); |
---|
53 | if(pVVisManager) { |
---|
54 | G4Polyline pl; |
---|
55 | G4Colour c; |
---|
56 | G4double chg = |
---|
57 | pStep -> GetTrack () -> GetDefinition () -> GetPDGCharge (); |
---|
58 | if (chg != 0.) c = G4Colour (1., 0., 0.); |
---|
59 | else c = G4Colour (0., 1., 0.); |
---|
60 | G4VisAttributes va (c); |
---|
61 | pl.SetVisAttributes (&va); |
---|
62 | pl.push_back (pStep -> GetPreStepPoint () -> GetPosition ()); |
---|
63 | pl.push_back (pStep -> GetPostStepPoint () -> GetPosition ()); |
---|
64 | static int coutCount = 0; |
---|
65 | if (coutCount < 10) { |
---|
66 | coutCount++; |
---|
67 | G4cout << "MySteppingAction::UserSteppingAction: drawing " |
---|
68 | << pl << G4endl; |
---|
69 | } |
---|
70 | pVVisManager -> Draw (pl); |
---|
71 | G4Circle intercept (pStep -> GetPostStepPoint () -> GetPosition ()); |
---|
72 | G4VisAttributes iva (G4Colour(1.,0.,1)); |
---|
73 | intercept.SetVisAttributes (&iva); |
---|
74 | pVVisManager -> Draw (intercept); |
---|
75 | |
---|
76 | const G4double pixels = 1.; |
---|
77 | |
---|
78 | G4Circle circle22(G4Point3D(100.*cm,100.*cm,0.)); |
---|
79 | circle22.SetScreenDiameter(50.*pixels); |
---|
80 | circle22.SetFillStyle(G4Circle::noFill); |
---|
81 | G4Colour colour22; |
---|
82 | G4VisAttributes attribs22; |
---|
83 | colour22=G4Colour(0.,1.,0.); |
---|
84 | attribs22=G4VisAttributes(colour22); |
---|
85 | circle22.SetVisAttributes(attribs22); |
---|
86 | pVVisManager->Draw(circle22); |
---|
87 | |
---|
88 | G4Square square222(G4Point3D(200.*cm,100.*cm,0.)); |
---|
89 | square222.SetWorldDiameter(100.*cm); |
---|
90 | //square222.SetFillStyle(G4Square::filled); |
---|
91 | G4Colour colour222; |
---|
92 | G4VisAttributes attribs222; |
---|
93 | colour222=G4Colour(0.,1.,0.); |
---|
94 | attribs222=G4VisAttributes(colour222); |
---|
95 | square222.SetVisAttributes(attribs222); |
---|
96 | pVVisManager->Draw(square222); |
---|
97 | |
---|
98 | G4Square square33(G4Point3D(-100.*cm,100.*cm,0.)); |
---|
99 | square33.SetScreenDiameter(50.*pixels); |
---|
100 | square33.SetFillStyle(G4Square::hashed); |
---|
101 | G4Colour colour33; |
---|
102 | G4VisAttributes attribs33; |
---|
103 | colour33=G4Colour(1.,0.,0.); |
---|
104 | attribs33=G4VisAttributes(colour33); |
---|
105 | square33.SetVisAttributes(attribs33); |
---|
106 | pVVisManager->Draw(square33); |
---|
107 | |
---|
108 | G4Circle circle333(G4Point3D(-200.*cm,100.*cm,0.)); |
---|
109 | circle333.SetWorldDiameter(100.*cm); |
---|
110 | circle333.SetFillStyle(G4Circle::filled); |
---|
111 | G4Colour colour333; |
---|
112 | G4VisAttributes attribs333; |
---|
113 | colour333=G4Colour(1.,0.,0.); |
---|
114 | attribs333=G4VisAttributes(colour333); |
---|
115 | circle333.SetVisAttributes(attribs333); |
---|
116 | pVVisManager->Draw(circle333); |
---|
117 | } |
---|
118 | // User Action Example - end snippet. |
---|
119 | */ |
---|
120 | } |
---|