Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file eventgenerator/HepMC/HepMCEx02/src/H << 23 // ==================================================================== 27 /// \brief Implementation of the H02MuonHit cl << 28 // 24 // >> 25 // H02MuonHit.cc >> 26 // $Id: H02MuonHit.cc,v 1.4 2003/12/09 15:31:23 gunter Exp $ 29 // 27 // >> 28 // ==================================================================== 30 #include "H02MuonHit.hh" 29 #include "H02MuonHit.hh" 31 << 30 #include "G4VVisManager.hh" 32 #include "G4Circle.hh" 31 #include "G4Circle.hh" 33 #include "G4Colour.hh" 32 #include "G4Colour.hh" 34 #include "G4SystemOfUnits.hh" << 35 #include "G4VVisManager.hh" << 36 #include "G4VisAttributes.hh" 33 #include "G4VisAttributes.hh" 37 << 38 #include <iomanip> 34 #include <iomanip> 39 35 40 G4Allocator<H02MuonHit> H02MuonHitAllocator; 36 G4Allocator<H02MuonHit> H02MuonHitAllocator; 41 37 42 //....oooOO0OOooo........oooOO0OOooo........oo << 38 //////////////////////// 43 H02MuonHit::H02MuonHit() : G4VHit(), fModuleID << 39 H02MuonHit::H02MuonHit() >> 40 : moduleID(-1) >> 41 //////////////////////// >> 42 { >> 43 } 44 44 45 //....oooOO0OOooo........oooOO0OOooo........oo << 45 ///////////////////////////////////////////////////////////// 46 H02MuonHit::H02MuonHit(G4int imod, G4String an << 46 H02MuonHit::H02MuonHit(G4int imod, G4String aname, 47 const G4ThreeVector& xy << 47 const G4ThreeVector& pxyz, 48 : fModuleID(imod), fPname(aname), fMomentum( << 48 const G4ThreeVector& xyz, G4double atof) 49 {} << 49 : moduleID(imod), pname(aname), momentum(pxyz), >> 50 position(xyz), tof(atof) >> 51 ///////////////////////////////////////////////////////////// >> 52 { >> 53 } 50 54 51 //....oooOO0OOooo........oooOO0OOooo........oo << 55 //////////////////////// 52 H02MuonHit::~H02MuonHit() {} << 56 H02MuonHit::~H02MuonHit() >> 57 //////////////////////// >> 58 { >> 59 } 53 60 54 //....oooOO0OOooo........oooOO0OOooo........oo << 61 ///////////////////////////////////////////// 55 H02MuonHit::H02MuonHit(const H02MuonHit& right << 62 H02MuonHit::H02MuonHit(const H02MuonHit& right) >> 63 ///////////////////////////////////////////// >> 64 : G4VHit() 56 { 65 { 57 *this = right; << 66 *this= right; 58 } 67 } 59 68 60 //....oooOO0OOooo........oooOO0OOooo........oo << 69 //////////////////////////////////////////////////////////////// 61 const H02MuonHit& H02MuonHit::operator=(const 70 const H02MuonHit& H02MuonHit::operator=(const H02MuonHit& right) >> 71 //////////////////////////////////////////////////////////////// 62 { 72 { 63 fModuleID = right.fModuleID; << 73 moduleID= right.moduleID; 64 fPname = right.fPname; << 74 pname= right.pname; 65 fMomentum = right.fMomentum; << 75 momentum= right.momentum; 66 fPosition = right.fPosition; << 76 position= right.position; 67 fTof = right.fTof; << 77 tof= right.tof; 68 78 69 return *this; 79 return *this; 70 } 80 } 71 81 72 //....oooOO0OOooo........oooOO0OOooo........oo << 82 ///////////////////////////////////////////////////////// 73 G4bool H02MuonHit::operator==(const H02MuonHit << 83 G4int H02MuonHit::operator==(const H02MuonHit& right) const >> 84 ///////////////////////////////////////////////////////// 74 { 85 { 75 return (this == &right) ? true : false; << 86 return (this==&right) ? 1 : 0; 76 } 87 } 77 88 78 //....oooOO0OOooo........oooOO0OOooo........oo << 89 /////////////////////// 79 void H02MuonHit::Draw() 90 void H02MuonHit::Draw() >> 91 /////////////////////// 80 { 92 { 81 const G4double pt_min = 20. * GeV; << 93 const G4double pt_min=20.*GeV; 82 94 83 G4VVisManager* pVVisManager = G4VVisManager: << 95 G4VVisManager* pVVisManager= G4VVisManager::GetConcreteInstance(); 84 if (pVVisManager) { << 96 if(pVVisManager) { 85 G4Circle circle(fPosition); << 97 G4Circle circle(position); 86 circle.SetScreenSize(5.); 98 circle.SetScreenSize(5.); 87 circle.SetFillStyle(G4Circle::filled); 99 circle.SetFillStyle(G4Circle::filled); 88 100 89 G4Color color, goodColor(1., 0., 0.), badC << 101 G4Color color, goodColor(1.,0.,0.), badColor(0.,0.,1.); 90 if (fMomentum.perp() > pt_min) << 102 if(momentum.perp()>pt_min) color=goodColor; 91 color = goodColor; << 103 else color=badColor; 92 else << 93 color = badColor; << 94 104 95 G4VisAttributes attribs(color); 105 G4VisAttributes attribs(color); 96 circle.SetVisAttributes(attribs); 106 circle.SetVisAttributes(attribs); 97 pVVisManager->Draw(circle); 107 pVVisManager->Draw(circle); 98 } 108 } 99 } 109 } 100 110 101 //....oooOO0OOooo........oooOO0OOooo........oo << 111 //////////////////////// 102 void H02MuonHit::Print() 112 void H02MuonHit::Print() 103 { << 113 //////////////////////// 104 G4int id = fModuleID; << 114 { 105 G4String tag = "B"; << 115 G4int id= moduleID; 106 if (fModuleID >= 10) { << 116 G4String tag="B"; 107 id -= 10; << 117 if(moduleID >=10) { 108 tag = "E"; << 118 id -=10; >> 119 tag="E"; 109 } 120 } 110 G4cout << tag << id << " :" << std::setw(12) << 121 G4cout << tag << id << " :" << std::setw(12) << pname.c_str() 111 << fMomentum.perp() / GeV << " : TOF= << 122 << " : pT=" << std::setprecision(3) << momentum.perp()/GeV 112 << " : x=" << std::setprecision(3) << << 123 << " : TOF=" << std::setprecision(3) << tof/ns >> 124 << " : x=" << std::setprecision(3) << position*(1./m) >> 125 << G4endl; 113 } 126 } 114 127