Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 08:29: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 /// \file HodoscopeHit.cc
0027 /// \brief Implementation of the B5::HodoscopeHit class
0028 
0029 #include "HodoscopeHit.hh"
0030 
0031 #include "G4AttDef.hh"
0032 #include "G4AttDefStore.hh"
0033 #include "G4AttValue.hh"
0034 #include "G4Colour.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4SystemOfUnits.hh"
0037 #include "G4Transform3D.hh"
0038 #include "G4UIcommand.hh"
0039 #include "G4UnitsTable.hh"
0040 #include "G4VVisManager.hh"
0041 #include "G4VisAttributes.hh"
0042 #include "G4ios.hh"
0043 
0044 namespace B5
0045 {
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0048 
0049 G4ThreadLocal G4Allocator<HodoscopeHit>* HodoscopeHitAllocator;
0050 
0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0052 
0053 HodoscopeHit::HodoscopeHit(G4int id, G4double time) : fId(id), fTime(time) {}
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 
0057 G4bool HodoscopeHit::operator==(const HodoscopeHit& /*right*/) const
0058 {
0059   return false;
0060 }
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0063 
0064 void HodoscopeHit::Draw()
0065 {
0066   auto visManager = G4VVisManager::GetConcreteInstance();
0067   if (!visManager) return;
0068 
0069   G4Transform3D trans(fRot.inverse(), fPos);
0070   G4VisAttributes attribs;
0071   auto pVA = fPLogV->GetVisAttributes();
0072   if (pVA) attribs = *pVA;
0073   attribs.SetColour(G4Colour::Cyan());
0074   attribs.SetForceSolid(true);
0075   visManager->Draw(*fPLogV, attribs, trans);
0076 }
0077 
0078 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0079 
0080 const std::map<G4String, G4AttDef>* HodoscopeHit::GetAttDefs() const
0081 {
0082   G4bool isNew;
0083   auto store = G4AttDefStore::GetInstance("HodoscopeHit", isNew);
0084 
0085   if (isNew) {
0086     (*store)["HitType"] = G4AttDef("HitType", "Hit Type", "Physics", "", "G4String");
0087 
0088     (*store)["ID"] = G4AttDef("ID", "ID", "Physics", "", "G4int");
0089 
0090     (*store)["Time"] = G4AttDef("Time", "Time", "Physics", "G4BestUnit", "G4double");
0091 
0092     (*store)["Pos"] = G4AttDef("Pos", "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0093 
0094     (*store)["LVol"] = G4AttDef("LVol", "Logical Volume", "Physics", "", "G4String");
0095   }
0096   return store;
0097 }
0098 
0099 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0100 
0101 std::vector<G4AttValue>* HodoscopeHit::CreateAttValues() const
0102 {
0103   auto values = new std::vector<G4AttValue>;
0104 
0105   values->push_back(G4AttValue("HitType", "HodoscopeHit", ""));
0106   values->push_back(G4AttValue("ID", G4UIcommand::ConvertToString(fId), ""));
0107   values->push_back(G4AttValue("Time", G4BestUnit(fTime, "Time"), ""));
0108   values->push_back(G4AttValue("Pos", G4BestUnit(fPos, "Length"), ""));
0109 
0110   if (fPLogV)
0111     values->push_back(G4AttValue("LVol", fPLogV->GetName(), ""));
0112   else
0113     values->push_back(G4AttValue("LVol", " ", ""));
0114 
0115   return values;
0116 }
0117 
0118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0119 
0120 void HodoscopeHit::Print()
0121 {
0122   G4cout << "  Hodoscope[" << fId << "] " << fTime / ns << " (nsec)" << G4endl;
0123 }
0124 
0125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0126 
0127 }  // namespace B5