[807] | 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 | // $Id: RE01CalorimeterHit.cc,v 1.5 2006/11/14 07:07:38 perl Exp $ |
---|
[1337] | 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[807] | 29 | // |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | #include "RE01CalorimeterHit.hh" |
---|
| 33 | #include "G4ios.hh" |
---|
| 34 | #include "G4VVisManager.hh" |
---|
| 35 | #include "G4Colour.hh" |
---|
| 36 | #include "G4AttDefStore.hh" |
---|
| 37 | #include "G4AttDef.hh" |
---|
| 38 | #include "G4AttValue.hh" |
---|
| 39 | #include "G4UIcommand.hh" |
---|
| 40 | #include "G4UnitsTable.hh" |
---|
| 41 | #include "G4VisAttributes.hh" |
---|
| 42 | #include "G4LogicalVolume.hh" |
---|
| 43 | |
---|
| 44 | G4Allocator<RE01CalorimeterHit> RE01CalorimeterHitAllocator; |
---|
| 45 | |
---|
| 46 | RE01CalorimeterHit::RE01CalorimeterHit() |
---|
| 47 | {pLogV=0;} |
---|
| 48 | |
---|
| 49 | RE01CalorimeterHit::RE01CalorimeterHit(G4LogicalVolume* logVol,G4int z,G4int phi) |
---|
| 50 | : ZCellID(z), PhiCellID(phi), pLogV(logVol) |
---|
| 51 | {;} |
---|
| 52 | |
---|
| 53 | RE01CalorimeterHit::~RE01CalorimeterHit() |
---|
| 54 | {;} |
---|
| 55 | |
---|
| 56 | RE01CalorimeterHit::RE01CalorimeterHit(const RE01CalorimeterHit &right) |
---|
| 57 | : G4VHit() |
---|
| 58 | { |
---|
| 59 | ZCellID = right.ZCellID; |
---|
| 60 | PhiCellID = right.PhiCellID; |
---|
| 61 | edep = right.edep; |
---|
| 62 | pos = right.pos; |
---|
| 63 | rot = right.rot; |
---|
| 64 | pLogV = right.pLogV; |
---|
| 65 | edepByATrack = right.edepByATrack; |
---|
| 66 | trackInfo = right.trackInfo; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | const RE01CalorimeterHit& RE01CalorimeterHit::operator=(const RE01CalorimeterHit &right) |
---|
| 70 | { |
---|
| 71 | ZCellID = right.ZCellID; |
---|
| 72 | PhiCellID = right.PhiCellID; |
---|
| 73 | edep = right.edep; |
---|
| 74 | pos = right.pos; |
---|
| 75 | rot = right.rot; |
---|
| 76 | pLogV = right.pLogV; |
---|
| 77 | edepByATrack = right.edepByATrack; |
---|
| 78 | trackInfo = right.trackInfo; |
---|
| 79 | return *this; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | G4int RE01CalorimeterHit::operator==(const RE01CalorimeterHit &right) const |
---|
| 83 | { |
---|
| 84 | return ((ZCellID==right.ZCellID)&&(PhiCellID==right.PhiCellID)); |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | void RE01CalorimeterHit::Draw() |
---|
| 88 | { |
---|
| 89 | G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); |
---|
| 90 | if(pVVisManager) |
---|
| 91 | { |
---|
| 92 | G4Transform3D trans(rot,pos); |
---|
| 93 | G4VisAttributes attribs; |
---|
| 94 | const G4VisAttributes* pVA = pLogV->GetVisAttributes(); |
---|
| 95 | if(pVA) attribs = *pVA; |
---|
| 96 | G4Colour colour(1.,0.,0.); |
---|
| 97 | attribs.SetColour(colour); |
---|
| 98 | attribs.SetForceWireframe(false); |
---|
| 99 | attribs.SetForceSolid(true); |
---|
| 100 | pVVisManager->Draw(*pLogV,attribs,trans); |
---|
| 101 | } |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | const std::map<G4String,G4AttDef>* RE01CalorimeterHit::GetAttDefs() const |
---|
| 105 | { |
---|
| 106 | G4bool isNew; |
---|
| 107 | std::map<G4String,G4AttDef>* store |
---|
| 108 | = G4AttDefStore::GetInstance("RE01CalorimeterHit",isNew); |
---|
| 109 | if (isNew) { |
---|
| 110 | G4String HitType("HitType"); |
---|
| 111 | (*store)[HitType] = G4AttDef(HitType,"Hit Type","Physics","","G4String"); |
---|
| 112 | |
---|
| 113 | G4String ZCellID("ZCellID"); |
---|
| 114 | (*store)[ZCellID] = G4AttDef(ZCellID,"Z Cell ID","Physics","","G4int"); |
---|
| 115 | |
---|
| 116 | G4String PhiCellID("PhiCellID"); |
---|
| 117 | (*store)[PhiCellID] = G4AttDef(PhiCellID,"Phi Cell ID","Physics","","G4int"); |
---|
| 118 | |
---|
| 119 | G4String Energy("Energy"); |
---|
| 120 | (*store)[Energy] = G4AttDef(Energy,"Energy Deposited","Physics","G4BestUnit","G4double"); |
---|
| 121 | |
---|
| 122 | G4String ETrack("ETrack"); |
---|
| 123 | (*store)[ETrack] = G4AttDef(ETrack,"Energy Deposited By Track","Physics","G4BestUnit","G4double"); |
---|
| 124 | |
---|
| 125 | G4String Pos("Pos"); |
---|
| 126 | (*store)[Pos] = G4AttDef(Pos, "Position", |
---|
| 127 | "Physics","G4BestUnit","G4ThreeVector"); |
---|
| 128 | |
---|
| 129 | G4String LVol("LVol"); |
---|
| 130 | (*store)[LVol] = G4AttDef(LVol,"Logical Volume","Physics","","G4String"); |
---|
| 131 | } |
---|
| 132 | return store; |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | std::vector<G4AttValue>* RE01CalorimeterHit::CreateAttValues() const |
---|
| 136 | { |
---|
| 137 | std::vector<G4AttValue>* values = new std::vector<G4AttValue>; |
---|
| 138 | |
---|
| 139 | values->push_back(G4AttValue("HitType","RE01CalorimeterHit","")); |
---|
| 140 | |
---|
| 141 | values->push_back |
---|
| 142 | (G4AttValue("ZCellID",G4UIcommand::ConvertToString(ZCellID),"")); |
---|
| 143 | |
---|
| 144 | values->push_back |
---|
| 145 | (G4AttValue("PhiCellID",G4UIcommand::ConvertToString(PhiCellID),"")); |
---|
| 146 | |
---|
| 147 | values->push_back |
---|
| 148 | (G4AttValue("Energy",G4BestUnit(edep,"Energy"),"")); |
---|
| 149 | |
---|
| 150 | values->push_back |
---|
| 151 | (G4AttValue("ETrack",G4BestUnit(edepByATrack,"Energy"),"")); |
---|
| 152 | |
---|
| 153 | values->push_back |
---|
| 154 | (G4AttValue("Pos",G4BestUnit(pos,"Length"),"")); |
---|
| 155 | |
---|
| 156 | if (pLogV) |
---|
| 157 | values->push_back |
---|
| 158 | (G4AttValue("LVol",pLogV->GetName(),"")); |
---|
| 159 | else |
---|
| 160 | values->push_back |
---|
| 161 | (G4AttValue("LVol"," ","")); |
---|
| 162 | |
---|
| 163 | return values; |
---|
| 164 | } |
---|
| 165 | |
---|
| 166 | void RE01CalorimeterHit::Print() |
---|
| 167 | { |
---|
| 168 | G4cout << "Cell[" << ZCellID << "," << PhiCellID << "] " << edep/GeV << " [GeV]" << G4endl; |
---|
| 169 | } |
---|
| 170 | |
---|
| 171 | |
---|