Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:43

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