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 RE05/src/RE05CalorimeterHit.cc 27 /// \file RE05/src/RE05CalorimeterHit.cc 28 /// \brief Implementation of the RE05Calorimet 28 /// \brief Implementation of the RE05CalorimeterHit class 29 // 29 // 30 30 31 #include "RE05CalorimeterHit.hh" 31 #include "RE05CalorimeterHit.hh" 32 << 32 #include "G4ios.hh" 33 #include "G4AttCheck.hh" << 33 #include "G4VVisManager.hh" 34 #include "G4AttDef.hh" << 35 #include "G4AttValue.hh" << 36 #include "G4Colour.hh" 34 #include "G4Colour.hh" >> 35 #include "G4VisAttributes.hh" 37 #include "G4LogicalVolume.hh" 36 #include "G4LogicalVolume.hh" 38 #include "G4UIcommand.hh" 37 #include "G4UIcommand.hh" 39 #include "G4UnitsTable.hh" 38 #include "G4UnitsTable.hh" 40 #include "G4VVisManager.hh" << 39 #include "G4AttValue.hh" 41 #include "G4VisAttributes.hh" << 40 #include "G4AttDef.hh" 42 #include "G4ios.hh" << 41 #include "G4AttCheck.hh" 43 42 44 G4ThreadLocal G4Allocator<RE05CalorimeterHit>* << 43 G4ThreadLocal G4Allocator<RE05CalorimeterHit>* RE05CalorimeterHitAllocator=0; 45 44 46 std::map<G4String, G4AttDef> RE05CalorimeterHi << 45 std::map<G4String,G4AttDef> RE05CalorimeterHit::fAttDefs; 47 46 48 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 49 48 50 RE05CalorimeterHit::RE05CalorimeterHit() 49 RE05CalorimeterHit::RE05CalorimeterHit() 51 : G4VHit(), fZCellID(-1), fPhiCellID(-1), fE << 50 : G4VHit(), >> 51 fZCellID(-1),fPhiCellID(-1),fEdep(0.),fPos(),fRot(),fLogV(0) 52 {} 52 {} 53 53 54 //....oooOO0OOooo........oooOO0OOooo........oo 54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 55 55 56 RE05CalorimeterHit::RE05CalorimeterHit(G4Logic << 56 RE05CalorimeterHit::RE05CalorimeterHit(G4LogicalVolume* logVol,G4int z,G4int phi) 57 : G4VHit(), fZCellID(z), fPhiCellID(phi), fE << 57 : G4VHit(), >> 58 fZCellID(z), fPhiCellID(phi),fEdep(0.),fPos(),fRot(),fLogV(logVol) 58 {} 59 {} 59 60 60 //....oooOO0OOooo........oooOO0OOooo........oo 61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 62 62 RE05CalorimeterHit::~RE05CalorimeterHit() {} << 63 RE05CalorimeterHit::~RE05CalorimeterHit() >> 64 {} 63 65 64 //....oooOO0OOooo........oooOO0OOooo........oo 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 67 66 RE05CalorimeterHit::RE05CalorimeterHit(const R << 68 RE05CalorimeterHit::RE05CalorimeterHit(const RE05CalorimeterHit &right) >> 69 : G4VHit() 67 { 70 { 68 fZCellID = right.fZCellID; 71 fZCellID = right.fZCellID; 69 fPhiCellID = right.fPhiCellID; 72 fPhiCellID = right.fPhiCellID; 70 fEdep = right.fEdep; 73 fEdep = right.fEdep; 71 fPos = right.fPos; 74 fPos = right.fPos; 72 fRot = right.fRot; 75 fRot = right.fRot; 73 fLogV = right.fLogV; 76 fLogV = right.fLogV; 74 } 77 } 75 78 76 //....oooOO0OOooo........oooOO0OOooo........oo 79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 77 80 78 const RE05CalorimeterHit& RE05CalorimeterHit:: << 81 const RE05CalorimeterHit& RE05CalorimeterHit::operator=(const RE05CalorimeterHit &right) 79 { 82 { 80 fZCellID = right.fZCellID; 83 fZCellID = right.fZCellID; 81 fPhiCellID = right.fPhiCellID; 84 fPhiCellID = right.fPhiCellID; 82 fEdep = right.fEdep; 85 fEdep = right.fEdep; 83 fPos = right.fPos; 86 fPos = right.fPos; 84 fRot = right.fRot; 87 fRot = right.fRot; 85 fLogV = right.fLogV; 88 fLogV = right.fLogV; 86 return *this; 89 return *this; 87 } 90 } 88 91 89 //....oooOO0OOooo........oooOO0OOooo........oo 92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 90 93 91 G4bool RE05CalorimeterHit::operator==(const RE << 94 G4bool RE05CalorimeterHit::operator==(const RE05CalorimeterHit &right) const 92 { 95 { 93 return ((fZCellID == right.fZCellID) && (fPh << 96 return ((fZCellID==right.fZCellID)&&(fPhiCellID==right.fPhiCellID)); 94 } 97 } 95 98 96 //....oooOO0OOooo........oooOO0OOooo........oo 99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 97 100 98 void RE05CalorimeterHit::Draw() 101 void RE05CalorimeterHit::Draw() 99 { 102 { 100 G4VVisManager* pVVisManager = G4VVisManager: 103 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); 101 if (pVVisManager) { << 104 if(pVVisManager) 102 G4Transform3D trans(fRot, fPos); << 105 { >> 106 G4Transform3D trans(fRot,fPos); 103 G4VisAttributes attribs; 107 G4VisAttributes attribs; 104 const G4VisAttributes* pVA = fLogV->GetVis 108 const G4VisAttributes* pVA = fLogV->GetVisAttributes(); 105 if (pVA) attribs = *pVA; << 109 if(pVA) attribs = *pVA; 106 G4Colour colour(1., 0., 0.); << 110 G4Colour colour(1.,0.,0.); 107 attribs.SetColour(colour); 111 attribs.SetColour(colour); 108 attribs.SetForceSolid(true); 112 attribs.SetForceSolid(true); 109 pVVisManager->Draw(*fLogV, attribs, trans) << 113 pVVisManager->Draw(*fLogV,attribs,trans); 110 } 114 } 111 } 115 } 112 116 113 //....oooOO0OOooo........oooOO0OOooo........oo 117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 114 118 115 const std::map<G4String, G4AttDef>* RE05Calori << 119 const std::map<G4String,G4AttDef>* RE05CalorimeterHit::GetAttDefs() const 116 { 120 { 117 // G4AttDefs have to have long life. Use st 121 // G4AttDefs have to have long life. Use static member... 118 if (fAttDefs.empty()) { 122 if (fAttDefs.empty()) { 119 fAttDefs["HitType"] = G4AttDef("HitType", << 123 fAttDefs["HitType"] = 120 fAttDefs["ZID"] = G4AttDef("ZID", "Z Cell << 124 G4AttDef("HitType","Type of hit","Physics","","G4String"); 121 fAttDefs["PhiID"] = G4AttDef("PhiID", "Phi << 125 fAttDefs["ZID"] = G4AttDef("ZID","Z Cell ID","Physics","","G4int"); 122 fAttDefs["EDep"] = G4AttDef("EDep", "Energ << 126 fAttDefs["PhiID"] = G4AttDef("PhiID","Phi Cell ID","Physics","","G4int"); >> 127 fAttDefs["EDep"] = >> 128 G4AttDef("EDep","Energy defPosited","Physics","G4BestUnit","G4double"); 123 } 129 } 124 return &fAttDefs; 130 return &fAttDefs; 125 } 131 } 126 132 127 //....oooOO0OOooo........oooOO0OOooo........oo 133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 128 134 129 std::vector<G4AttValue>* RE05CalorimeterHit::C 135 std::vector<G4AttValue>* RE05CalorimeterHit::CreateAttValues() const 130 { 136 { 131 // Create expendable G4AttsValues for pickin 137 // Create expendable G4AttsValues for picking... 132 std::vector<G4AttValue>* attValues = new std 138 std::vector<G4AttValue>* attValues = new std::vector<G4AttValue>; 133 attValues->push_back(G4AttValue("HitType", " << 139 attValues->push_back 134 attValues->push_back(G4AttValue("ZID", G4UIc << 140 (G4AttValue("HitType","RE05CalorimeterHit","")); 135 attValues->push_back(G4AttValue("PhiID", G4U << 141 attValues->push_back 136 attValues->push_back(G4AttValue("EDep", G4Be << 142 (G4AttValue("ZID",G4UIcommand::ConvertToString(fZCellID),"")); 137 // G4cout << "Checking...\n" << G4AttCheck(a << 143 attValues->push_back >> 144 (G4AttValue("PhiID",G4UIcommand::ConvertToString(fPhiCellID),"")); >> 145 attValues->push_back >> 146 (G4AttValue("EDep",G4BestUnit(fEdep,"Energy"),"")); >> 147 //G4cout << "Checking...\n" << G4AttCheck(attValues, GetAttDefs()); 138 return attValues; 148 return attValues; 139 } 149 } 140 150 141 //....oooOO0OOooo........oooOO0OOooo........oo 151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 142 152 143 void RE05CalorimeterHit::Print() {} << 153 void RE05CalorimeterHit::Print() >> 154 {} 144 155 145 //....oooOO0OOooo........oooOO0OOooo........oo 156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 157 146 158