Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
H02MuonHit.cc
Go to the documentation of this file.
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 //
28 //
29 // ====================================================================
30 //
31 // H02MuonHit.cc
32 // $Id$
33 //
34 // ====================================================================
35 #include "H02MuonHit.hh"
36 #include "G4VVisManager.hh"
37 #include "G4Circle.hh"
38 #include "G4Colour.hh"
39 #include "G4VisAttributes.hh"
40 #include "G4SystemOfUnits.hh"
41 #include <iomanip>
42 
44 
47  : moduleID(-1)
49 {
50 }
51 
54  const G4ThreeVector& pxyz,
55  const G4ThreeVector& xyz, G4double atof)
56  : moduleID(imod), pname(aname), momentum(pxyz),
57  position(xyz), tof(atof)
59 {
60 }
61 
65 {
66 }
67 
71  : G4VHit()
72 {
73  *this= right;
74 }
75 
79 {
80  moduleID= right.moduleID;
81  pname= right.pname;
82  momentum= right.momentum;
83  position= right.position;
84  tof= right.tof;
85 
86  return *this;
87 }
88 
92 {
93  return (this==&right) ? 1 : 0;
94 }
95 
99 {
100  const G4double pt_min=20.*GeV;
101 
103  if(pVVisManager) {
104  G4Circle circle(position);
105  circle.SetScreenSize(5.);
107 
108  G4Color color, goodColor(1.,0.,0.), badColor(0.,0.,1.);
109  if(momentum.perp()>pt_min) color=goodColor;
110  else color=badColor;
111 
112  G4VisAttributes attribs(color);
113  circle.SetVisAttributes(attribs);
114  pVVisManager->Draw(circle);
115  }
116 }
117 
121 {
122  G4int id= moduleID;
123  G4String tag="B";
124  if(moduleID >=10) {
125  id -=10;
126  tag="E";
127  }
128  G4cout << tag << id << " :" << std::setw(12) << pname.c_str()
129  << " : pT=" << std::setprecision(3) << momentum.perp()/GeV
130  << " : TOF=" << std::setprecision(3) << tof/ns
131  << " : x=" << std::setprecision(3) << position*(1./m)
132  << G4endl;
133 }