Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file B5/src/HodoscopeHit.cc 27 /// \file B5/src/HodoscopeHit.cc 28 /// \brief Implementation of the B5::Hodoscope 28 /// \brief Implementation of the B5::HodoscopeHit class 29 29 30 #include "HodoscopeHit.hh" 30 #include "HodoscopeHit.hh" 31 31 32 #include "G4AttDef.hh" << 32 #include "G4VVisManager.hh" >> 33 #include "G4VisAttributes.hh" >> 34 #include "G4Circle.hh" >> 35 #include "G4Colour.hh" 33 #include "G4AttDefStore.hh" 36 #include "G4AttDefStore.hh" >> 37 #include "G4AttDef.hh" 34 #include "G4AttValue.hh" 38 #include "G4AttValue.hh" 35 #include "G4Colour.hh" << 36 #include "G4LogicalVolume.hh" << 37 #include "G4SystemOfUnits.hh" << 38 #include "G4Transform3D.hh" << 39 #include "G4UIcommand.hh" 39 #include "G4UIcommand.hh" 40 #include "G4UnitsTable.hh" 40 #include "G4UnitsTable.hh" 41 #include "G4VVisManager.hh" << 41 #include "G4SystemOfUnits.hh" 42 #include "G4VisAttributes.hh" << 43 #include "G4ios.hh" 42 #include "G4ios.hh" 44 43 45 namespace B5 44 namespace B5 46 { 45 { 47 46 48 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 49 48 50 G4ThreadLocal G4Allocator<HodoscopeHit>* Hodos 49 G4ThreadLocal G4Allocator<HodoscopeHit>* HodoscopeHitAllocator; 51 50 52 //....oooOO0OOooo........oooOO0OOooo........oo 51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 53 52 54 HodoscopeHit::HodoscopeHit(G4int id, G4double << 53 HodoscopeHit::HodoscopeHit(G4int id,G4double time) >> 54 : fId(id), fTime(time) >> 55 {} 55 56 56 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 57 58 58 G4bool HodoscopeHit::operator==(const Hodoscop << 59 G4bool HodoscopeHit::operator==(const HodoscopeHit &/*right*/) const 59 { 60 { 60 return false; 61 return false; 61 } 62 } 62 63 63 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 64 65 65 void HodoscopeHit::Draw() 66 void HodoscopeHit::Draw() 66 { 67 { 67 auto visManager = G4VVisManager::GetConcrete 68 auto visManager = G4VVisManager::GetConcreteInstance(); 68 if (!visManager) return; << 69 if (! visManager) return; 69 70 70 G4Transform3D trans(fRot.inverse(), fPos); << 71 G4Transform3D trans(fRot.inverse(),fPos); 71 G4VisAttributes attribs; 72 G4VisAttributes attribs; 72 auto pVA = fPLogV->GetVisAttributes(); 73 auto pVA = fPLogV->GetVisAttributes(); 73 if (pVA) attribs = *pVA; 74 if (pVA) attribs = *pVA; 74 attribs.SetColour(G4Colour::Cyan()); << 75 G4Colour colour(0.,1.,1.); >> 76 attribs.SetColour(colour); 75 attribs.SetForceSolid(true); 77 attribs.SetForceSolid(true); 76 visManager->Draw(*fPLogV, attribs, trans); << 78 visManager->Draw(*fPLogV,attribs,trans); 77 } 79 } 78 80 79 //....oooOO0OOooo........oooOO0OOooo........oo 81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 80 82 81 const std::map<G4String, G4AttDef>* HodoscopeH << 83 const std::map<G4String,G4AttDef>* HodoscopeHit::GetAttDefs() const 82 { 84 { 83 G4bool isNew; 85 G4bool isNew; 84 auto store = G4AttDefStore::GetInstance("Hod << 86 auto store = G4AttDefStore::GetInstance("HodoscopeHit",isNew); 85 87 86 if (isNew) { 88 if (isNew) { 87 (*store)["HitType"] = G4AttDef("HitType", << 89 (*store)["HitType"] >> 90 = G4AttDef("HitType","Hit Type","Physics","","G4String"); 88 91 89 (*store)["ID"] = G4AttDef("ID", "ID", "Phy << 92 (*store)["ID"] >> 93 = G4AttDef("ID","ID","Physics","","G4int"); 90 94 91 (*store)["Time"] = G4AttDef("Time", "Time" << 95 (*store)["Time"] >> 96 = G4AttDef("Time","Time","Physics","G4BestUnit","G4double"); 92 97 93 (*store)["Pos"] = G4AttDef("Pos", "Positio << 98 (*store)["Pos"] >> 99 = G4AttDef("Pos","Position","Physics","G4BestUnit","G4ThreeVector"); 94 100 95 (*store)["LVol"] = G4AttDef("LVol", "Logic << 101 (*store)["LVol"] >> 102 = G4AttDef("LVol","Logical Volume","Physics","","G4String"); 96 } 103 } 97 return store; 104 return store; 98 } 105 } 99 106 100 //....oooOO0OOooo........oooOO0OOooo........oo 107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 101 108 102 std::vector<G4AttValue>* HodoscopeHit::CreateA 109 std::vector<G4AttValue>* HodoscopeHit::CreateAttValues() const 103 { 110 { 104 auto values = new std::vector<G4AttValue>; 111 auto values = new std::vector<G4AttValue>; 105 112 106 values->push_back(G4AttValue("HitType", "Hod << 113 values 107 values->push_back(G4AttValue("ID", G4UIcomma << 114 ->push_back(G4AttValue("HitType","HodoscopeHit","")); 108 values->push_back(G4AttValue("Time", G4BestU << 115 values 109 values->push_back(G4AttValue("Pos", G4BestUn << 116 ->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fId),"")); >> 117 values >> 118 ->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),"")); >> 119 values >> 120 ->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),"")); 110 121 111 if (fPLogV) 122 if (fPLogV) 112 values->push_back(G4AttValue("LVol", fPLog << 123 values->push_back(G4AttValue("LVol",fPLogV->GetName(),"")); 113 else 124 else 114 values->push_back(G4AttValue("LVol", " ", << 125 values->push_back(G4AttValue("LVol"," ","")); 115 126 116 return values; 127 return values; 117 } 128 } 118 129 119 //....oooOO0OOooo........oooOO0OOooo........oo 130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 120 131 121 void HodoscopeHit::Print() 132 void HodoscopeHit::Print() 122 { 133 { 123 G4cout << " Hodoscope[" << fId << "] " << f << 134 G4cout << " Hodoscope[" << fId << "] " << fTime/ns << " (nsec)" << G4endl; 124 } 135 } 125 136 126 //....oooOO0OOooo........oooOO0OOooo........oo 137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 127 138 128 } // namespace B5 << 139 } 129 140