Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-15 07:54:07

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 RE01TrackerHit.cc
0027 /// \brief Implementation of the RE01TrackerHit class
0028 
0029 #include "RE01TrackerHit.hh"
0030 
0031 #include "G4AttDef.hh"
0032 #include "G4AttDefStore.hh"
0033 #include "G4AttValue.hh"
0034 #include "G4Circle.hh"
0035 #include "G4Colour.hh"
0036 #include "G4SystemOfUnits.hh"
0037 #include "G4UIcommand.hh"
0038 #include "G4UnitsTable.hh"
0039 #include "G4VVisManager.hh"
0040 #include "G4VisAttributes.hh"
0041 
0042 G4ThreadLocal G4Allocator<RE01TrackerHit>* RE01TrackerHitAllocator = 0;
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 RE01TrackerHit::RE01TrackerHit() : G4VHit(), fEdep(0.0), fPos(0), fTrackID(-1)
0046 {
0047   ;
0048 }
0049 
0050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0051 RE01TrackerHit::~RE01TrackerHit()
0052 {
0053   ;
0054 }
0055 
0056 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0057 void RE01TrackerHit::Draw()
0058 {
0059   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0060   if (pVVisManager) {
0061     G4Circle circle(fPos);
0062     circle.SetScreenSize(0.04);
0063     circle.SetFillStyle(G4Circle::filled);
0064     G4Colour colour(1., 0., 0.);
0065     G4VisAttributes attribs(colour);
0066     circle.SetVisAttributes(attribs);
0067     pVVisManager->Draw(circle);
0068   }
0069 }
0070 
0071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0072 const std::map<G4String, G4AttDef>* RE01TrackerHit::GetAttDefs() const
0073 {
0074   G4bool isNew;
0075   std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("RE01TrackerHit", isNew);
0076   if (isNew) {
0077     G4String hitType("HitType");
0078     (*store)[hitType] = G4AttDef(hitType, "Hit Type", "Physics", "", "G4String");
0079 
0080     G4String trackID("TrackID");
0081     (*store)[trackID] = G4AttDef(trackID, "Track ID", "Physics", "", "G4int");
0082 
0083     G4String energy("Energy");
0084     (*store)[energy] = G4AttDef(energy, "Energy Deposited", "Physics", "G4BestUnit", "G4double");
0085 
0086     G4String eTrack("ETrack");
0087     (*store)[eTrack] =
0088       G4AttDef(eTrack, "Energy Deposited By Track", "Physics", "G4BestUnit", "G4double");
0089 
0090     G4String pos("Pos");
0091     (*store)[pos] = G4AttDef(pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0092   }
0093   return store;
0094 }
0095 
0096 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0097 std::vector<G4AttValue>* RE01TrackerHit::CreateAttValues() const
0098 {
0099   std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
0100 
0101   values->push_back(G4AttValue("HitType", "RE01TrackerHit", ""));
0102 
0103   values->push_back(G4AttValue("TrackID", G4UIcommand::ConvertToString(fTrackID), ""));
0104 
0105   values->push_back(G4AttValue("Energy", G4BestUnit(fEdep, "Energy"), ""));
0106 
0107   G4double noEnergy = 0. * MeV;
0108   values->push_back(G4AttValue("ETrack", G4BestUnit(noEnergy, "Energy"), ""));
0109 
0110   values->push_back(G4AttValue("Pos", G4BestUnit(fPos, "Length"), ""));
0111 
0112   return values;
0113 }
0114 
0115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0116 void RE01TrackerHit::Print()
0117 {
0118   G4cout << "TrackID " << fTrackID << "   Position " << fPos << "       : " << fEdep / keV
0119          << " [keV]" << G4endl;
0120 }