source: trunk/examples/novice/gemc/src/MHit.cc @ 893

Last change on this file since 893 was 807, checked in by garnier, 16 years ago

update

File size: 1.7 KB
Line 
1// %%%%%%%%%%
2// G4 headers
3// %%%%%%%%%%
4#include "G4VVisManager.hh"
5#include "G4Circle.hh"
6#include "G4VisAttributes.hh"
7
8// %%%%%%%%%%%%%
9// gemc headers
10// %%%%%%%%%%%%%
11#include "MHit.h"
12
13MHit::MHit() : G4VHit() {;}
14MHit::~MHit() {;}
15
16void MHit::Draw()
17{
18 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
19 if(pVVisManager)
20 {
21    G4Circle circle(pos[0]);
22    circle.SetFillStyle(G4Circle::filled);
23    G4Colour colour_touch (0.0, 0.0, 1.0);
24    G4Colour colour_hit   (1.0, 0.0, 0.0);
25    G4Colour colour_passby(0.0, 1.0, 0.0);
26
27    // If the energy is above threshold, red circle.
28    // If the energy is below threshold, blue smaller circle.
29    // If no energy deposited, green smaller circle.
30    if(edep[0] > minEdep)
31    {
32       circle.SetVisAttributes(G4VisAttributes(colour_hit));
33       circle.SetScreenSize(5);
34    }
35    else if(edep[0] > 0 && edep[0] <= minEdep)
36    {
37      circle.SetVisAttributes(G4VisAttributes(colour_touch));
38      circle.SetScreenSize(4);
39    }
40    else if(edep[0] == 0)
41    {
42      circle.SetVisAttributes(G4VisAttributes(colour_passby));
43      circle.SetScreenSize(4);
44    }
45
46    pVVisManager->Draw(circle);
47 }
48}
49
50int MHit::mc_number_scheme(string pid)
51{
52 if(pid=="e-")            return 11;
53 if(pid=="e+")            return -11;
54 if(pid=="gamma")         return 22;
55 if(pid=="neutron")       return 2112;
56 if(pid=="proton")        return 2212;
57 if(pid=="kaon+")         return 321;
58 if(pid=="kaon-")         return -321;
59 if(pid=="kaon0")         return 311;
60 if(pid=="kaon0L")        return 130;
61 if(pid=="pi+")           return 211;
62 if(pid=="pi-")           return -211;
63 if(pid=="p0")            return 111;
64 if(pid=="opticalphoton") return -22;
65 else return 0;
66}
Note: See TracBrowser for help on using the repository browser.