Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 /// \file RE05/src/RE05CalorimeterHit.cc 28 /// \brief Implementation of the RE05CalorimeterHit class 29 // 30 31 #include "RE05CalorimeterHit.hh" 32 33 #include "G4AttCheck.hh" 34 #include "G4AttDef.hh" 35 #include "G4AttValue.hh" 36 #include "G4Colour.hh" 37 #include "G4LogicalVolume.hh" 38 #include "G4UIcommand.hh" 39 #include "G4UnitsTable.hh" 40 #include "G4VVisManager.hh" 41 #include "G4VisAttributes.hh" 42 #include "G4ios.hh" 43 44 G4ThreadLocal G4Allocator<RE05CalorimeterHit>* RE05CalorimeterHitAllocator = 0; 45 46 std::map<G4String, G4AttDef> RE05CalorimeterHit::fAttDefs; 47 48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 49 50 RE05CalorimeterHit::RE05CalorimeterHit() 51 : G4VHit(), fZCellID(-1), fPhiCellID(-1), fEdep(0.), fPos(), fRot(), fLogV(0) 52 {} 53 54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 55 56 RE05CalorimeterHit::RE05CalorimeterHit(G4LogicalVolume* logVol, G4int z, G4int phi) 57 : G4VHit(), fZCellID(z), fPhiCellID(phi), fEdep(0.), fPos(), fRot(), fLogV(logVol) 58 {} 59 60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 62 RE05CalorimeterHit::~RE05CalorimeterHit() {} 63 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 66 RE05CalorimeterHit::RE05CalorimeterHit(const RE05CalorimeterHit& right) : G4VHit() 67 { 68 fZCellID = right.fZCellID; 69 fPhiCellID = right.fPhiCellID; 70 fEdep = right.fEdep; 71 fPos = right.fPos; 72 fRot = right.fRot; 73 fLogV = right.fLogV; 74 } 75 76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 77 78 const RE05CalorimeterHit& RE05CalorimeterHit::operator=(const RE05CalorimeterHit& right) 79 { 80 fZCellID = right.fZCellID; 81 fPhiCellID = right.fPhiCellID; 82 fEdep = right.fEdep; 83 fPos = right.fPos; 84 fRot = right.fRot; 85 fLogV = right.fLogV; 86 return *this; 87 } 88 89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 90 91 G4bool RE05CalorimeterHit::operator==(const RE05CalorimeterHit& right) const 92 { 93 return ((fZCellID == right.fZCellID) && (fPhiCellID == right.fPhiCellID)); 94 } 95 96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 97 98 void RE05CalorimeterHit::Draw() 99 { 100 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); 101 if (pVVisManager) { 102 G4Transform3D trans(fRot, fPos); 103 G4VisAttributes attribs; 104 const G4VisAttributes* pVA = fLogV->GetVisAttributes(); 105 if (pVA) attribs = *pVA; 106 G4Colour colour(1., 0., 0.); 107 attribs.SetColour(colour); 108 attribs.SetForceSolid(true); 109 pVVisManager->Draw(*fLogV, attribs, trans); 110 } 111 } 112 113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 114 115 const std::map<G4String, G4AttDef>* RE05CalorimeterHit::GetAttDefs() const 116 { 117 // G4AttDefs have to have long life. Use static member... 118 if (fAttDefs.empty()) { 119 fAttDefs["HitType"] = G4AttDef("HitType", "Type of hit", "Physics", "", "G4String"); 120 fAttDefs["ZID"] = G4AttDef("ZID", "Z Cell ID", "Physics", "", "G4int"); 121 fAttDefs["PhiID"] = G4AttDef("PhiID", "Phi Cell ID", "Physics", "", "G4int"); 122 fAttDefs["EDep"] = G4AttDef("EDep", "Energy defPosited", "Physics", "G4BestUnit", "G4double"); 123 } 124 return &fAttDefs; 125 } 126 127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 128 129 std::vector<G4AttValue>* RE05CalorimeterHit::CreateAttValues() const 130 { 131 // Create expendable G4AttsValues for picking... 132 std::vector<G4AttValue>* attValues = new std::vector<G4AttValue>; 133 attValues->push_back(G4AttValue("HitType", "RE05CalorimeterHit", "")); 134 attValues->push_back(G4AttValue("ZID", G4UIcommand::ConvertToString(fZCellID), "")); 135 attValues->push_back(G4AttValue("PhiID", G4UIcommand::ConvertToString(fPhiCellID), "")); 136 attValues->push_back(G4AttValue("EDep", G4BestUnit(fEdep, "Energy"), "")); 137 // G4cout << "Checking...\n" << G4AttCheck(attValues, GetAttDefs()); 138 return attValues; 139 } 140 141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 142 143 void RE05CalorimeterHit::Print() {} 144 145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 146