Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:52:14

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 // gpaterno, October 2025
0027 //
0028 /// \file SensitiveDetectorHit.cc
0029 /// \brief Implementation of the SensitiveDetectorHit class
0030 //
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0032 
0033 #include "SensitiveDetectorHit.hh"
0034 
0035 #include "G4ios.hh"
0036 #include "G4VVisManager.hh"
0037 #include "G4Circle.hh"
0038 #include "G4Colour.hh"
0039 #include "G4AttDefStore.hh"
0040 #include "G4AttDef.hh"
0041 #include "G4AttValue.hh"
0042 #include "G4UIcommand.hh"
0043 #include "G4UnitsTable.hh"
0044 #include "G4VisAttributes.hh"
0045 #include "G4LogicalVolume.hh"
0046 #include "G4SystemOfUnits.hh"
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0049 
0050 G4ThreadLocal G4Allocator<SensitiveDetectorHit>* SensitiveDetectorHitAllocator = nullptr;
0051 
0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0053 
0054 int SensitiveDetectorHit::operator==(const SensitiveDetectorHit &) const
0055 {
0056     return 0;
0057 }
0058 
0059 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0060 
0061 void SensitiveDetectorHit::Draw()
0062 {
0063     G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0064     if (pVVisManager){
0065         G4Circle circle(fPos);
0066         circle.SetScreenSize(2);
0067         circle.SetFillStyle(G4Circle::filled);
0068         G4Colour colour(1.,1.,0.);
0069         G4VisAttributes attribs(colour);
0070         circle.SetVisAttributes(attribs);
0071         pVVisManager->Draw(circle);
0072     }
0073 }
0074 
0075 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0076 
0077 const std::map<G4String,G4AttDef>* SensitiveDetectorHit::GetAttDefs() const
0078 {
0079     G4bool isNew;
0080     std::map<G4String,G4AttDef>* store = 
0081         G4AttDefStore::GetInstance("SensitiveDetectorHit",isNew);
0082     
0083     if (isNew) {
0084         G4String ID("ID");
0085         (*store)[ID] = G4AttDef(ID,"ID","Physics","","G4int");
0086         
0087         G4String IDP("IDP");
0088         (*store)[IDP] = G4AttDef(IDP,"IDP","Physics","","G4int");
0089         
0090         G4String Time("t");
0091         (*store)[Time] = G4AttDef(Time,"Time","Physics","G4BestUnit","G4double");
0092         
0093         G4String Pos("pos");
0094         (*store)[Pos] = G4AttDef(Pos, "Position","Physics","G4BestUnit","G4ThreeVector");
0095 
0096         G4String Mom("mom");
0097         (*store)[Mom] = G4AttDef(Mom, "Momentum","Physics","G4BestUnit","G4ThreeVector");
0098 
0099         G4String En("en");
0100         (*store)[En] = G4AttDef(En, "Energy","Physics","G4BestUnit","G4double");       
0101     }
0102     
0103     return store;
0104 }
0105 
0106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0107 
0108 std::vector<G4AttValue>* SensitiveDetectorHit::CreateAttValues() const
0109 {
0110     std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
0111     
0112     values->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fTrackID),""));
0113     
0114     values->push_back(G4AttValue("IDP",G4UIcommand::ConvertToString(fTrackIDP),""));
0115 
0116     values->push_back(G4AttValue("t",G4BestUnit(fTime,"Time"),""));
0117     
0118     values->push_back(G4AttValue("pos",G4BestUnit(fPos,"Length"),""));
0119 
0120     values->push_back(G4AttValue("mom",G4BestUnit(fMom,"Energy"),""));
0121 
0122     values->push_back(G4AttValue("en",G4BestUnit(fEnergy,"Energy"),""));
0123 
0124     values->push_back(G4AttValue("type","",""));
0125     
0126     return values;
0127 }
0128 
0129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0130 
0131 void SensitiveDetectorHit::Print()
0132 {
0133     G4cout << " Hit at time " << fTime/ns
0134     << " (nsec) - pos(x,y,z) " << fPos/mm
0135     << " (mm) - mom(x,y,z) " << fMom/eV << " eV" << G4endl;
0136 }
0137 
0138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0139