Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 08:37:26

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file H02MuonHit.cc
0027 /// \brief Implementation of the H02MuonHit class
0028 
0029 #include "H02MuonHit.hh"
0030 
0031 #include "G4Circle.hh"
0032 #include "G4Colour.hh"
0033 #include "G4SystemOfUnits.hh"
0034 #include "G4VVisManager.hh"
0035 #include "G4VisAttributes.hh"
0036 
0037 #include <iomanip>
0038 
0039 G4Allocator<H02MuonHit> H02MuonHitAllocator;
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 H02MuonHit::H02MuonHit() : G4VHit(), fModuleID(-1), fPname(), fMomentum(), fPosition(), fTof(0.) {}
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 H02MuonHit::H02MuonHit(G4int imod, G4String aname, const G4ThreeVector& pxyz,
0046                        const G4ThreeVector& xyz, G4double atof)
0047   : fModuleID(imod), fPname(aname), fMomentum(pxyz), fPosition(xyz), fTof(atof)
0048 {}
0049 
0050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0051 H02MuonHit::~H02MuonHit() {}
0052 
0053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0054 H02MuonHit::H02MuonHit(const H02MuonHit& right) : G4VHit()
0055 {
0056   *this = right;
0057 }
0058 
0059 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0060 const H02MuonHit& H02MuonHit::operator=(const H02MuonHit& right)
0061 {
0062   fModuleID = right.fModuleID;
0063   fPname = right.fPname;
0064   fMomentum = right.fMomentum;
0065   fPosition = right.fPosition;
0066   fTof = right.fTof;
0067 
0068   return *this;
0069 }
0070 
0071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0072 G4bool H02MuonHit::operator==(const H02MuonHit& right) const
0073 {
0074   return (this == &right) ? true : false;
0075 }
0076 
0077 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0078 void H02MuonHit::Draw()
0079 {
0080   const G4double pt_min = 20. * GeV;
0081 
0082   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0083   if (pVVisManager) {
0084     G4Circle circle(fPosition);
0085     circle.SetScreenSize(5.);
0086     circle.SetFillStyle(G4Circle::filled);
0087 
0088     G4Color color, goodColor(1., 0., 0.), badColor(0., 0., 1.);
0089     if (fMomentum.perp() > pt_min)
0090       color = goodColor;
0091     else
0092       color = badColor;
0093 
0094     G4VisAttributes attribs(color);
0095     circle.SetVisAttributes(attribs);
0096     pVVisManager->Draw(circle);
0097   }
0098 }
0099 
0100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0101 void H02MuonHit::Print()
0102 {
0103   G4int id = fModuleID;
0104   G4String tag = "B";
0105   if (fModuleID >= 10) {
0106     id -= 10;
0107     tag = "E";
0108   }
0109   G4cout << tag << id << " :" << std::setw(12) << fPname.c_str() << " : pT=" << std::setprecision(3)
0110          << fMomentum.perp() / GeV << " : TOF=" << std::setprecision(3) << fTof / ns
0111          << " : x=" << std::setprecision(3) << fPosition * (1. / m) << G4endl;
0112 }