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 | // |
---|
28 | // H02MuonHit.cc |
---|
29 | // $Id: H02MuonHit.cc,v 1.5 2006/06/29 17:10:54 gunter Exp $ |
---|
30 | // |
---|
31 | // ==================================================================== |
---|
32 | #include "H02MuonHit.hh" |
---|
33 | #include "G4VVisManager.hh" |
---|
34 | #include "G4Circle.hh" |
---|
35 | #include "G4Colour.hh" |
---|
36 | #include "G4VisAttributes.hh" |
---|
37 | #include <iomanip> |
---|
38 | |
---|
39 | G4Allocator<H02MuonHit> H02MuonHitAllocator; |
---|
40 | |
---|
41 | //////////////////////// |
---|
42 | H02MuonHit::H02MuonHit() |
---|
43 | : moduleID(-1) |
---|
44 | //////////////////////// |
---|
45 | { |
---|
46 | } |
---|
47 | |
---|
48 | ///////////////////////////////////////////////////////////// |
---|
49 | H02MuonHit::H02MuonHit(G4int imod, G4String aname, |
---|
50 | const G4ThreeVector& pxyz, |
---|
51 | const G4ThreeVector& xyz, G4double atof) |
---|
52 | : moduleID(imod), pname(aname), momentum(pxyz), |
---|
53 | position(xyz), tof(atof) |
---|
54 | ///////////////////////////////////////////////////////////// |
---|
55 | { |
---|
56 | } |
---|
57 | |
---|
58 | //////////////////////// |
---|
59 | H02MuonHit::~H02MuonHit() |
---|
60 | //////////////////////// |
---|
61 | { |
---|
62 | } |
---|
63 | |
---|
64 | ///////////////////////////////////////////// |
---|
65 | H02MuonHit::H02MuonHit(const H02MuonHit& right) |
---|
66 | ///////////////////////////////////////////// |
---|
67 | : G4VHit() |
---|
68 | { |
---|
69 | *this= right; |
---|
70 | } |
---|
71 | |
---|
72 | //////////////////////////////////////////////////////////////// |
---|
73 | const H02MuonHit& H02MuonHit::operator=(const H02MuonHit& right) |
---|
74 | //////////////////////////////////////////////////////////////// |
---|
75 | { |
---|
76 | moduleID= right.moduleID; |
---|
77 | pname= right.pname; |
---|
78 | momentum= right.momentum; |
---|
79 | position= right.position; |
---|
80 | tof= right.tof; |
---|
81 | |
---|
82 | return *this; |
---|
83 | } |
---|
84 | |
---|
85 | ///////////////////////////////////////////////////////// |
---|
86 | G4int H02MuonHit::operator==(const H02MuonHit& right) const |
---|
87 | ///////////////////////////////////////////////////////// |
---|
88 | { |
---|
89 | return (this==&right) ? 1 : 0; |
---|
90 | } |
---|
91 | |
---|
92 | /////////////////////// |
---|
93 | void H02MuonHit::Draw() |
---|
94 | /////////////////////// |
---|
95 | { |
---|
96 | const G4double pt_min=20.*GeV; |
---|
97 | |
---|
98 | G4VVisManager* pVVisManager= G4VVisManager::GetConcreteInstance(); |
---|
99 | if(pVVisManager) { |
---|
100 | G4Circle circle(position); |
---|
101 | circle.SetScreenSize(5.); |
---|
102 | circle.SetFillStyle(G4Circle::filled); |
---|
103 | |
---|
104 | G4Color color, goodColor(1.,0.,0.), badColor(0.,0.,1.); |
---|
105 | if(momentum.perp()>pt_min) color=goodColor; |
---|
106 | else color=badColor; |
---|
107 | |
---|
108 | G4VisAttributes attribs(color); |
---|
109 | circle.SetVisAttributes(attribs); |
---|
110 | pVVisManager->Draw(circle); |
---|
111 | } |
---|
112 | } |
---|
113 | |
---|
114 | //////////////////////// |
---|
115 | void H02MuonHit::Print() |
---|
116 | //////////////////////// |
---|
117 | { |
---|
118 | G4int id= moduleID; |
---|
119 | G4String tag="B"; |
---|
120 | if(moduleID >=10) { |
---|
121 | id -=10; |
---|
122 | tag="E"; |
---|
123 | } |
---|
124 | G4cout << tag << id << " :" << std::setw(12) << pname.c_str() |
---|
125 | << " : pT=" << std::setprecision(3) << momentum.perp()/GeV |
---|
126 | << " : TOF=" << std::setprecision(3) << tof/ns |
---|
127 | << " : x=" << std::setprecision(3) << position*(1./m) |
---|
128 | << G4endl; |
---|
129 | } |
---|