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