Geant4 examples
basic/B2/B2a/src/B2TrackerHit.cc
Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id$
00027 //
00030 
00031 #include "B2TrackerHit.hh"
00032 #include "G4UnitsTable.hh"
00033 #include "G4VVisManager.hh"
00034 #include "G4Circle.hh"
00035 #include "G4Colour.hh"
00036 #include "G4VisAttributes.hh"
00037 
00038 #include <iomanip>
00039 
00040 G4Allocator<B2TrackerHit> B2TrackerHitAllocator;
00041 
00042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00043 
00044 B2TrackerHit::B2TrackerHit()
00045  : G4VHit(),
00046    fTrackID(-1),
00047    fChamberNb(-1),
00048    fEdep(0.),
00049    fPos(G4ThreeVector())
00050 {}
00051 
00052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00053 
00054 B2TrackerHit::~B2TrackerHit() {}
00055 
00056 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00057 
00058 B2TrackerHit::B2TrackerHit(const B2TrackerHit& right)
00059   : G4VHit()
00060 {
00061   fTrackID   = right.fTrackID;
00062   fChamberNb = right.fChamberNb;
00063   fEdep      = right.fEdep;
00064   fPos       = right.fPos;
00065 }
00066 
00067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00068 
00069 const B2TrackerHit& B2TrackerHit::operator=(const B2TrackerHit& right)
00070 {
00071   fTrackID   = right.fTrackID;
00072   fChamberNb = right.fChamberNb;
00073   fEdep      = right.fEdep;
00074   fPos       = right.fPos;
00075 
00076   return *this;
00077 }
00078 
00079 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00080 
00081 G4int B2TrackerHit::operator==(const B2TrackerHit& right) const
00082 {
00083   return ( this == &right ) ? 1 : 0;
00084 }
00085 
00086 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00087 
00088 void B2TrackerHit::Draw()
00089 {
00090   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
00091   if(pVVisManager)
00092   {
00093     G4Circle circle(fPos);
00094     circle.SetScreenSize(2.);
00095     circle.SetFillStyle(G4Circle::filled);
00096     G4Colour colour(1.,0.,0.);
00097     G4VisAttributes attribs(colour);
00098     circle.SetVisAttributes(attribs);
00099     pVVisManager->Draw(circle);
00100   }
00101 }
00102 
00103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00104 
00105 void B2TrackerHit::Print()
00106 {
00107   G4cout
00108      << "  trackID: " << fTrackID << " chamberNb: " << fChamberNb
00109      << "Edep: "
00110      << std::setw(7) << G4BestUnit(fEdep,"Energy")
00111      << " Position: "
00112      << std::setw(7) << G4BestUnit( fPos,"Length")
00113      << G4endl;
00114 }
00115 
00116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines