Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file runAndEvent/RE01/src/RE01TrackerHit. << 23 // $Id: RE01TrackerHit.cc,v 1.3 2005/06/07 10:53:17 perl Exp $ 27 /// \brief Implementation of the RE01TrackerHi << 24 // GEANT4 tag $Name: geant4-07-01-patch-01 $ 28 // << 29 // 25 // 30 26 31 #include "RE01TrackerHit.hh" << 32 27 33 #include "G4AttDef.hh" << 28 #include "RE01TrackerHit.hh" 34 #include "G4AttDefStore.hh" << 29 #include "G4VVisManager.hh" 35 #include "G4AttValue.hh" << 36 #include "G4Circle.hh" 30 #include "G4Circle.hh" 37 #include "G4Colour.hh" 31 #include "G4Colour.hh" 38 #include "G4SystemOfUnits.hh" << 32 #include "G4AttDefStore.hh" >> 33 #include "G4AttDef.hh" >> 34 #include "G4AttValue.hh" 39 #include "G4UIcommand.hh" 35 #include "G4UIcommand.hh" 40 #include "G4UnitsTable.hh" 36 #include "G4UnitsTable.hh" 41 #include "G4VVisManager.hh" << 42 #include "G4VisAttributes.hh" 37 #include "G4VisAttributes.hh" 43 38 44 G4ThreadLocal G4Allocator<RE01TrackerHit>* RE0 << 45 39 46 //....oooOO0OOooo........oooOO0OOooo........oo << 40 G4Allocator<RE01TrackerHit> RE01TrackerHitAllocator; 47 RE01TrackerHit::RE01TrackerHit() : G4VHit(), f << 41 >> 42 RE01TrackerHit::RE01TrackerHit() >> 43 {;} >> 44 >> 45 RE01TrackerHit::~RE01TrackerHit() >> 46 {;} >> 47 >> 48 RE01TrackerHit::RE01TrackerHit(const RE01TrackerHit &right) >> 49 : G4VHit() 48 { 50 { 49 ; << 51 edep = right.edep; >> 52 pos = right.pos; >> 53 trackID = right.trackID; 50 } 54 } 51 55 52 //....oooOO0OOooo........oooOO0OOooo........oo << 56 const RE01TrackerHit& RE01TrackerHit::operator=(const RE01TrackerHit &right) 53 RE01TrackerHit::~RE01TrackerHit() << 54 { 57 { 55 ; << 58 edep = right.edep; >> 59 pos = right.pos; >> 60 trackID = right.trackID; >> 61 return *this; >> 62 } >> 63 >> 64 G4int RE01TrackerHit::operator==(const RE01TrackerHit &right) const >> 65 { >> 66 return (this==&right) ? 1 : 0; 56 } 67 } 57 68 58 //....oooOO0OOooo........oooOO0OOooo........oo << 59 void RE01TrackerHit::Draw() 69 void RE01TrackerHit::Draw() 60 { 70 { 61 G4VVisManager* pVVisManager = G4VVisManager: 71 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); 62 if (pVVisManager) { << 72 if(pVVisManager) 63 G4Circle circle(fPos); << 73 { >> 74 G4Circle circle(pos); 64 circle.SetScreenSize(0.04); 75 circle.SetScreenSize(0.04); 65 circle.SetFillStyle(G4Circle::filled); 76 circle.SetFillStyle(G4Circle::filled); 66 G4Colour colour(1., 0., 0.); << 77 G4Colour colour(1.,0.,0.); 67 G4VisAttributes attribs(colour); 78 G4VisAttributes attribs(colour); 68 circle.SetVisAttributes(attribs); 79 circle.SetVisAttributes(attribs); 69 pVVisManager->Draw(circle); 80 pVVisManager->Draw(circle); 70 } 81 } 71 } 82 } 72 83 73 //....oooOO0OOooo........oooOO0OOooo........oo << 84 const std::map<G4String,G4AttDef>* RE01TrackerHit::GetAttDefs() const 74 const std::map<G4String, G4AttDef>* RE01Tracke << 75 { 85 { 76 G4bool isNew; 86 G4bool isNew; 77 std::map<G4String, G4AttDef>* store = G4AttD << 87 std::map<G4String,G4AttDef>* store >> 88 = G4AttDefStore::GetInstance("RE01TrackerHit",isNew); 78 if (isNew) { 89 if (isNew) { 79 G4String hitType("HitType"); << 90 G4String HitType("HitType"); 80 (*store)[hitType] = G4AttDef(hitType, "Hit << 91 (*store)[HitType] = G4AttDef(HitType,"Hit Type","Bookkeeping","","G4String"); >> 92 >> 93 G4String TrackID("TrackID"); >> 94 (*store)[TrackID] = G4AttDef(TrackID,"Track ID","Bookkeeping","","G4int"); 81 95 82 G4String trackID("TrackID"); << 96 G4String ZCellID("ZCellID"); 83 (*store)[trackID] = G4AttDef(trackID, "Tra << 97 (*store)[ZCellID] = G4AttDef(ZCellID,"Z Cell ID","Bookkeeping","","G4int"); 84 98 85 G4String energy("Energy"); << 99 G4String PhiCellID("PhiCellID"); 86 (*store)[energy] = G4AttDef(energy, "Energ << 100 (*store)[PhiCellID] = G4AttDef(PhiCellID,"Phi Cell ID","Bookkeeping","","G4int"); 87 101 88 G4String eTrack("ETrack"); << 102 G4String Energy("Energy"); 89 (*store)[eTrack] = << 103 (*store)[Energy] = G4AttDef(Energy,"Energy Deposited","Physics","G4BestUnit","G4double"); 90 G4AttDef(eTrack, "Energy Deposited By Tr << 91 104 92 G4String pos("Pos"); << 105 G4String ETrack("ETrack"); 93 (*store)[pos] = G4AttDef(pos, "Position", << 106 (*store)[ETrack] = G4AttDef(ETrack,"Energy Deposited By Track","Physics","G4BestUnit","G4double"); >> 107 >> 108 G4String Pos("Pos"); >> 109 (*store)[Pos] = G4AttDef(Pos, "Position", >> 110 "Physics","G4BestUnit","G4ThreeVector"); >> 111 >> 112 G4String LVol("LVol"); >> 113 (*store)[LVol] = G4AttDef(LVol,"Logical Volume","Bookkeeping","","G4String"); 94 } 114 } 95 return store; 115 return store; 96 } 116 } 97 117 98 //....oooOO0OOooo........oooOO0OOooo........oo << 99 std::vector<G4AttValue>* RE01TrackerHit::Creat 118 std::vector<G4AttValue>* RE01TrackerHit::CreateAttValues() const 100 { 119 { 101 std::vector<G4AttValue>* values = new std::v 120 std::vector<G4AttValue>* values = new std::vector<G4AttValue>; 102 121 103 values->push_back(G4AttValue("HitType", "RE0 << 122 values->push_back(G4AttValue("HitType","RE01TrackerHit","")); >> 123 >> 124 values->push_back >> 125 (G4AttValue("TrackID",G4UIcommand::ConvertToString(trackID),"")); 104 126 105 values->push_back(G4AttValue("TrackID", G4UI << 127 values->push_back >> 128 (G4AttValue("ZCellID"," ","")); 106 129 107 values->push_back(G4AttValue("Energy", G4Bes << 130 values->push_back >> 131 (G4AttValue("PhiCellID"," ","")); 108 132 109 G4double noEnergy = 0. * MeV; << 133 values->push_back 110 values->push_back(G4AttValue("ETrack", G4Bes << 134 (G4AttValue("Energy",G4BestUnit(edep,"Energy"),"")); 111 135 112 values->push_back(G4AttValue("Pos", G4BestUn << 136 G4double noEnergy = 0.*MeV; >> 137 values->push_back >> 138 (G4AttValue("ETrack",G4BestUnit(noEnergy,"Energy"),"")); 113 139 114 return values; << 140 values->push_back >> 141 (G4AttValue("Pos",G4BestUnit(pos,"Length"),"")); >> 142 >> 143 values->push_back >> 144 (G4AttValue("LVol"," ","")); >> 145 >> 146 return values; 115 } 147 } 116 148 117 //....oooOO0OOooo........oooOO0OOooo........oo << 118 void RE01TrackerHit::Print() 149 void RE01TrackerHit::Print() 119 { 150 { 120 G4cout << "TrackID " << fTrackID << " Posi << 151 G4cout << "TrackID " << trackID << " Position " << pos << " : " << edep/keV << " [keV]" << G4endl; 121 << " [keV]" << G4endl; << 122 } 152 } >> 153 >> 154 123 155