| [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 | #include "ExN04CalorimeterHit.hh"
|
|---|
| 28 | #include "G4ios.hh"
|
|---|
| 29 | #include "G4VVisManager.hh"
|
|---|
| 30 | #include "G4Colour.hh"
|
|---|
| 31 | #include "G4VisAttributes.hh"
|
|---|
| 32 | #include "G4LogicalVolume.hh"
|
|---|
| 33 | #include "G4UIcommand.hh"
|
|---|
| 34 | #include "G4UnitsTable.hh"
|
|---|
| 35 | #include "G4AttValue.hh"
|
|---|
| 36 | #include "G4AttDef.hh"
|
|---|
| 37 | #include "G4AttCheck.hh"
|
|---|
| 38 |
|
|---|
| 39 | G4Allocator<ExN04CalorimeterHit> ExN04CalorimeterHitAllocator;
|
|---|
| 40 |
|
|---|
| 41 | ExN04CalorimeterHit::ExN04CalorimeterHit()
|
|---|
| 42 | {pLogV=0;}
|
|---|
| 43 |
|
|---|
| 44 | ExN04CalorimeterHit::ExN04CalorimeterHit(G4LogicalVolume* logVol,G4int z,G4int phi)
|
|---|
| 45 | : ZCellID(z), PhiCellID(phi), pLogV(logVol)
|
|---|
| 46 | {;}
|
|---|
| 47 |
|
|---|
| 48 | ExN04CalorimeterHit::~ExN04CalorimeterHit()
|
|---|
| 49 | {;}
|
|---|
| 50 |
|
|---|
| 51 | ExN04CalorimeterHit::ExN04CalorimeterHit(const ExN04CalorimeterHit &right)
|
|---|
| 52 | : G4VHit()
|
|---|
| 53 | {
|
|---|
| 54 | ZCellID = right.ZCellID;
|
|---|
| 55 | PhiCellID = right.PhiCellID;
|
|---|
| 56 | edep = right.edep;
|
|---|
| 57 | pos = right.pos;
|
|---|
| 58 | rot = right.rot;
|
|---|
| 59 | pLogV = right.pLogV;
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | const ExN04CalorimeterHit& ExN04CalorimeterHit::operator=(const ExN04CalorimeterHit &right)
|
|---|
| 63 | {
|
|---|
| 64 | ZCellID = right.ZCellID;
|
|---|
| 65 | PhiCellID = right.PhiCellID;
|
|---|
| 66 | edep = right.edep;
|
|---|
| 67 | pos = right.pos;
|
|---|
| 68 | rot = right.rot;
|
|---|
| 69 | pLogV = right.pLogV;
|
|---|
| 70 | return *this;
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | G4int ExN04CalorimeterHit::operator==(const ExN04CalorimeterHit &right) const
|
|---|
| 74 | {
|
|---|
| 75 | return ((ZCellID==right.ZCellID)&&(PhiCellID==right.PhiCellID));
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | std::map<G4String,G4AttDef> ExN04CalorimeterHit::fAttDefs;
|
|---|
| 79 |
|
|---|
| 80 | void ExN04CalorimeterHit::Draw()
|
|---|
| 81 | {
|
|---|
| 82 | G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
|---|
| 83 | if(pVVisManager)
|
|---|
| 84 | {
|
|---|
| 85 | G4Transform3D trans(rot,pos);
|
|---|
| 86 | G4VisAttributes attribs;
|
|---|
| 87 | const G4VisAttributes* pVA = pLogV->GetVisAttributes();
|
|---|
| 88 | if(pVA) attribs = *pVA;
|
|---|
| 89 | G4Colour colour(1.,0.,0.);
|
|---|
| 90 | attribs.SetColour(colour);
|
|---|
| 91 | attribs.SetForceSolid(true);
|
|---|
| 92 | pVVisManager->Draw(*pLogV,attribs,trans);
|
|---|
| 93 | }
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | const std::map<G4String,G4AttDef>* ExN04CalorimeterHit::GetAttDefs() const
|
|---|
| 97 | {
|
|---|
| 98 | // G4AttDefs have to have long life. Use static member...
|
|---|
| 99 | if (fAttDefs.empty()) {
|
|---|
| 100 | fAttDefs["HitType"] =
|
|---|
| 101 | G4AttDef("HitType","Type of hit","Physics","","G4String");
|
|---|
| 102 | fAttDefs["ZID"] = G4AttDef("ZID","Z Cell ID","Physics","","G4int");
|
|---|
| 103 | fAttDefs["PhiID"] = G4AttDef("PhiID","Phi Cell ID","Physics","","G4int");
|
|---|
| 104 | fAttDefs["EDep"] =
|
|---|
| 105 | G4AttDef("EDep","Energy deposited","Physics","G4BestUnit","G4double");
|
|---|
| 106 | }
|
|---|
| 107 | return &fAttDefs;
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | std::vector<G4AttValue>* ExN04CalorimeterHit::CreateAttValues() const
|
|---|
| 111 | {
|
|---|
| 112 | // Create expendable G4AttsValues for picking...
|
|---|
| 113 | std::vector<G4AttValue>* attValues = new std::vector<G4AttValue>;
|
|---|
| 114 | attValues->push_back
|
|---|
| 115 | (G4AttValue("HitType","ExN04CalorimeterHit",""));
|
|---|
| 116 | attValues->push_back
|
|---|
| 117 | (G4AttValue("ZID",G4UIcommand::ConvertToString(ZCellID),""));
|
|---|
| 118 | attValues->push_back
|
|---|
| 119 | (G4AttValue("PhiID",G4UIcommand::ConvertToString(PhiCellID),""));
|
|---|
| 120 | attValues->push_back
|
|---|
| 121 | (G4AttValue("EDep",G4BestUnit(edep,"Energy"),""));
|
|---|
| 122 | //G4cout << "Checking...\n" << G4AttCheck(attValues, GetAttDefs());
|
|---|
| 123 | return attValues;
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | void ExN04CalorimeterHit::Print()
|
|---|
| 127 | {;}
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|