Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:08

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 eventgenerator/HepMC/HepMCEx02/src/H02MuonHit.cc
0027 /// \brief Implementation of the H02MuonHit class
0028 //
0029 //
0030 #include "H02MuonHit.hh"
0031 
0032 #include "G4Circle.hh"
0033 #include "G4Colour.hh"
0034 #include "G4SystemOfUnits.hh"
0035 #include "G4VVisManager.hh"
0036 #include "G4VisAttributes.hh"
0037 
0038 #include <iomanip>
0039 
0040 G4Allocator<H02MuonHit> H02MuonHitAllocator;
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 H02MuonHit::H02MuonHit() : G4VHit(), fModuleID(-1), fPname(), fMomentum(), fPosition(), fTof(0.) {}
0044 
0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0046 H02MuonHit::H02MuonHit(G4int imod, G4String aname, const G4ThreeVector& pxyz,
0047                        const G4ThreeVector& xyz, G4double atof)
0048   : fModuleID(imod), fPname(aname), fMomentum(pxyz), fPosition(xyz), fTof(atof)
0049 {}
0050 
0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0052 H02MuonHit::~H02MuonHit() {}
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 H02MuonHit::H02MuonHit(const H02MuonHit& right) : G4VHit()
0056 {
0057   *this = right;
0058 }
0059 
0060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0061 const H02MuonHit& H02MuonHit::operator=(const H02MuonHit& right)
0062 {
0063   fModuleID = right.fModuleID;
0064   fPname = right.fPname;
0065   fMomentum = right.fMomentum;
0066   fPosition = right.fPosition;
0067   fTof = right.fTof;
0068 
0069   return *this;
0070 }
0071 
0072 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0073 G4bool H02MuonHit::operator==(const H02MuonHit& right) const
0074 {
0075   return (this == &right) ? true : false;
0076 }
0077 
0078 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0079 void H02MuonHit::Draw()
0080 {
0081   const G4double pt_min = 20. * GeV;
0082 
0083   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0084   if (pVVisManager) {
0085     G4Circle circle(fPosition);
0086     circle.SetScreenSize(5.);
0087     circle.SetFillStyle(G4Circle::filled);
0088 
0089     G4Color color, goodColor(1., 0., 0.), badColor(0., 0., 1.);
0090     if (fMomentum.perp() > pt_min)
0091       color = goodColor;
0092     else
0093       color = badColor;
0094 
0095     G4VisAttributes attribs(color);
0096     circle.SetVisAttributes(attribs);
0097     pVVisManager->Draw(circle);
0098   }
0099 }
0100 
0101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0102 void H02MuonHit::Print()
0103 {
0104   G4int id = fModuleID;
0105   G4String tag = "B";
0106   if (fModuleID >= 10) {
0107     id -= 10;
0108     tag = "E";
0109   }
0110   G4cout << tag << id << " :" << std::setw(12) << fPname.c_str() << " : pT=" << std::setprecision(3)
0111          << fMomentum.perp() / GeV << " : TOF=" << std::setprecision(3) << fTof / ns
0112          << " : x=" << std::setprecision(3) << fPosition * (1. / m) << G4endl;
0113 }