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/DriftChamberHit.cc 27 /// \file B5/src/DriftChamberHit.cc 28 /// \brief Implementation of the B5::DriftCham 28 /// \brief Implementation of the B5::DriftChamberHit class 29 29 30 #include "DriftChamberHit.hh" 30 #include "DriftChamberHit.hh" 31 31 32 #include "G4AttDef.hh" << 32 #include "G4VVisManager.hh" 33 #include "G4AttDefStore.hh" << 33 #include "G4VisAttributes.hh" 34 #include "G4AttValue.hh" << 35 #include "G4Circle.hh" 34 #include "G4Circle.hh" 36 #include "G4Colour.hh" 35 #include "G4Colour.hh" 37 #include "G4SystemOfUnits.hh" << 36 #include "G4AttDefStore.hh" >> 37 #include "G4AttDef.hh" >> 38 #include "G4AttValue.hh" 38 #include "G4UIcommand.hh" 39 #include "G4UIcommand.hh" 39 #include "G4UnitsTable.hh" 40 #include "G4UnitsTable.hh" 40 #include "G4VVisManager.hh" << 41 #include "G4SystemOfUnits.hh" 41 #include "G4VisAttributes.hh" << 42 #include "G4ios.hh" 42 43 43 namespace B5 44 namespace B5 44 { 45 { 45 46 46 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 47 48 48 G4ThreadLocal G4Allocator<DriftChamberHit>* Dr 49 G4ThreadLocal G4Allocator<DriftChamberHit>* DriftChamberHitAllocator; 49 50 50 //....oooOO0OOooo........oooOO0OOooo........oo 51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 51 52 52 DriftChamberHit::DriftChamberHit(G4int layerID << 53 DriftChamberHit::DriftChamberHit(G4int layerID) >> 54 : fLayerID(layerID) >> 55 {} 53 56 54 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 55 58 56 G4bool DriftChamberHit::operator==(const Drift << 59 G4bool DriftChamberHit::operator==(const DriftChamberHit &/*right*/) const 57 { 60 { 58 return false; 61 return false; 59 } 62 } 60 63 61 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 62 65 63 void DriftChamberHit::Draw() 66 void DriftChamberHit::Draw() 64 { 67 { 65 auto visManager = G4VVisManager::GetConcrete 68 auto visManager = G4VVisManager::GetConcreteInstance(); 66 if (!visManager) return; << 69 if (! visManager) return; 67 70 68 G4Circle circle(fWorldPos); 71 G4Circle circle(fWorldPos); 69 circle.SetScreenSize(2); 72 circle.SetScreenSize(2); 70 circle.SetFillStyle(G4Circle::filled); 73 circle.SetFillStyle(G4Circle::filled); 71 G4VisAttributes attribs(G4Colour::Yellow()); 74 G4VisAttributes attribs(G4Colour::Yellow()); 72 circle.SetVisAttributes(attribs); 75 circle.SetVisAttributes(attribs); 73 visManager->Draw(circle); 76 visManager->Draw(circle); 74 } 77 } 75 78 76 //....oooOO0OOooo........oooOO0OOooo........oo 79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 77 80 78 const std::map<G4String, G4AttDef>* DriftChamb << 81 const std::map<G4String,G4AttDef>* DriftChamberHit::GetAttDefs() const 79 { 82 { 80 G4bool isNew; 83 G4bool isNew; 81 auto store = G4AttDefStore::GetInstance("Dri << 84 auto store = G4AttDefStore::GetInstance("DriftChamberHit",isNew); 82 85 83 if (isNew) { 86 if (isNew) { 84 (*store)["HitType"] = G4AttDef("HitType", << 87 (*store)["HitType"] >> 88 = G4AttDef("HitType","Hit Type","Physics","","G4String"); 85 89 86 (*store)["ID"] = G4AttDef("ID", "ID", "Phy << 90 (*store)["ID"] >> 91 = G4AttDef("ID","ID","Physics","","G4int"); 87 92 88 (*store)["Time"] = G4AttDef("Time", "Time" << 93 (*store)["Time"] >> 94 = G4AttDef("Time","Time","Physics","G4BestUnit","G4double"); 89 95 90 (*store)["Pos"] = G4AttDef("Pos", "Positio << 96 (*store)["Pos"] >> 97 = G4AttDef("Pos", "Position", "Physics","G4BestUnit","G4ThreeVector"); 91 } 98 } 92 99 93 return store; 100 return store; 94 } 101 } 95 102 96 //....oooOO0OOooo........oooOO0OOooo........oo 103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 97 104 98 std::vector<G4AttValue>* DriftChamberHit::Crea 105 std::vector<G4AttValue>* DriftChamberHit::CreateAttValues() const 99 { 106 { 100 auto values = new std::vector<G4AttValue>; 107 auto values = new std::vector<G4AttValue>; 101 108 102 values->push_back(G4AttValue("HitType", "Dri << 109 values 103 values->push_back(G4AttValue("ID", G4UIcomma << 110 ->push_back(G4AttValue("HitType","DriftChamberHit","")); 104 values->push_back(G4AttValue("Time", G4BestU << 111 values 105 values->push_back(G4AttValue("Pos", G4BestUn << 112 ->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fLayerID),"")); >> 113 values >> 114 ->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),"")); >> 115 values >> 116 ->push_back(G4AttValue("Pos",G4BestUnit(fWorldPos,"Length"),"")); 106 117 107 return values; 118 return values; 108 } 119 } 109 120 110 //....oooOO0OOooo........oooOO0OOooo........oo 121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 111 122 112 void DriftChamberHit::Print() 123 void DriftChamberHit::Print() 113 { 124 { 114 G4cout << " Layer[" << fLayerID << "] : tim << 125 G4cout << " Layer[" << fLayerID << "] : time " << fTime/ns 115 << fLocalPos.x() << ", " << fLocalPos << 126 << " (nsec) --- local (x,y) " << fLocalPos.x() >> 127 << ", " << fLocalPos.y() << G4endl; 116 } 128 } 117 129 118 //....oooOO0OOooo........oooOO0OOooo........oo 130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 119 131 120 } // namespace B5 << 132 } 121 133