Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:53

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