Back to home page

EIC code displayed by LXR

 
 

    


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

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 
0027 #include "SensitiveDetectorHit.hh"
0028 
0029 #include "G4AttDef.hh"
0030 #include "G4AttDefStore.hh"
0031 #include "G4AttValue.hh"
0032 #include "G4Circle.hh"
0033 #include "G4Colour.hh"
0034 #include "G4LogicalVolume.hh"
0035 #include "G4SystemOfUnits.hh"
0036 #include "G4UIcommand.hh"
0037 #include "G4UnitsTable.hh"
0038 #include "G4VVisManager.hh"
0039 #include "G4VisAttributes.hh"
0040 #include "G4ios.hh"
0041 
0042 #ifdef G4MULTITHREADED
0043 G4ThreadLocal G4Allocator<SensitiveDetectorHit>* SensitiveDetectorHitAllocator = 0;
0044 #else
0045 G4Allocator<SensitiveDetectorHit> SensitiveDetectorHitAllocator;
0046 #endif
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0049 
0050 SensitiveDetectorHit::SensitiveDetectorHit()
0051 {
0052   fLayerID = -1;
0053 }
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0056 
0057 SensitiveDetectorHit::SensitiveDetectorHit(G4int z)
0058 {
0059   fLayerID = z;
0060 }
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0063 
0064 SensitiveDetectorHit::~SensitiveDetectorHit() {}
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0067 
0068 SensitiveDetectorHit::SensitiveDetectorHit(const SensitiveDetectorHit& right) : G4VHit()
0069 {
0070   fLayerID = right.fLayerID;
0071   fWorldPos = right.fWorldPos;
0072 }
0073 
0074 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0075 
0076 const SensitiveDetectorHit& SensitiveDetectorHit::operator=(const SensitiveDetectorHit& right)
0077 {
0078   fLayerID = right.fLayerID;
0079   fWorldPos = right.fWorldPos;
0080   return *this;
0081 }
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0084 
0085 G4bool SensitiveDetectorHit::operator==(const SensitiveDetectorHit& /*right*/) const
0086 {
0087   return false;
0088 }
0089 
0090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0091 
0092 void SensitiveDetectorHit::Draw()
0093 {
0094   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
0095   if (pVVisManager) {
0096     G4Circle circle(fWorldPos);
0097     circle.SetScreenSize(2);
0098     circle.SetFillStyle(G4Circle::filled);
0099     G4Colour colour(1., 1., 0.);
0100     G4VisAttributes attribs(colour);
0101     circle.SetVisAttributes(attribs);
0102     pVVisManager->Draw(circle);
0103   }
0104 }
0105 
0106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0107 
0108 const std::map<G4String, G4AttDef>* SensitiveDetectorHit::GetAttDefs() const
0109 {
0110   G4bool isNew;
0111   std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("SensitiveDetectorHit", isNew);
0112   if (isNew) {
0113     G4String ID("ID");
0114     (*store)[ID] = G4AttDef(ID, "ID", "Physics", "", "G4int");
0115 
0116     G4String Pos("Pos");
0117     (*store)[Pos] = G4AttDef(Pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0118   }
0119   return store;
0120 }
0121 
0122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0123 
0124 std::vector<G4AttValue>* SensitiveDetectorHit::CreateAttValues() const
0125 {
0126   std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
0127 
0128   values->push_back(G4AttValue("ID", G4UIcommand::ConvertToString(fLayerID), ""));
0129 
0130   values->push_back(G4AttValue("Pos", G4BestUnit(fWorldPos, "Length"), ""));
0131 
0132   return values;
0133 }
0134 
0135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0136 
0137 void SensitiveDetectorHit::Print()
0138 {
0139   G4cout << fLayerID << "," << fWorldPos.x() << "," << fWorldPos.z() << "," << fWorldPos.y()
0140          << G4endl;
0141 }
0142 
0143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....