| [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 | // $Id: A01HadCalorimeterHit.cc,v 1.11 2006/11/14 07:11:19 perl Exp $
|
|---|
| 27 | // --------------------------------------------------------------
|
|---|
| 28 | //
|
|---|
| 29 |
|
|---|
| 30 | #include "A01HadCalorimeterHit.hh"
|
|---|
| 31 | #include "A01DetectorConstruction.hh"
|
|---|
| 32 | #include "G4RunManager.hh"
|
|---|
| 33 | #include "G4RotationMatrix.hh"
|
|---|
| 34 | #include "G4Box.hh"
|
|---|
| 35 | #include "G4VVisManager.hh"
|
|---|
| 36 | #include "G4Colour.hh"
|
|---|
| 37 | #include "G4AttDefStore.hh"
|
|---|
| 38 | #include "G4AttDef.hh"
|
|---|
| 39 | #include "G4AttValue.hh"
|
|---|
| 40 | #include "G4UIcommand.hh"
|
|---|
| 41 | #include "G4UnitsTable.hh"
|
|---|
| 42 | #include "G4VisAttributes.hh"
|
|---|
| 43 | #include "G4LogicalVolume.hh"
|
|---|
| 44 | #include "G4ios.hh"
|
|---|
| 45 |
|
|---|
| 46 | G4Allocator<A01HadCalorimeterHit> A01HadCalorimeterHitAllocator;
|
|---|
| 47 |
|
|---|
| 48 | A01HadCalorimeterHit::A01HadCalorimeterHit()
|
|---|
| 49 | {
|
|---|
| 50 | columnID = -1;
|
|---|
| 51 | rowID = -1;
|
|---|
| 52 | edep = 0.;
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | A01HadCalorimeterHit::A01HadCalorimeterHit(G4int iCol,G4int iRow)
|
|---|
| 56 | {
|
|---|
| 57 | columnID = iCol;
|
|---|
| 58 | rowID = iRow;
|
|---|
| 59 | edep = 0.;
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | A01HadCalorimeterHit::~A01HadCalorimeterHit()
|
|---|
| 63 | {;}
|
|---|
| 64 |
|
|---|
| 65 | A01HadCalorimeterHit::A01HadCalorimeterHit(const A01HadCalorimeterHit &right)
|
|---|
| 66 | : G4VHit() {
|
|---|
| 67 | columnID = right.columnID;
|
|---|
| 68 | rowID = right.rowID;
|
|---|
| 69 | edep = right.edep;
|
|---|
| 70 | pos = right.pos;
|
|---|
| 71 | rot = right.rot;
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | const A01HadCalorimeterHit& A01HadCalorimeterHit::operator=(const A01HadCalorimeterHit &right)
|
|---|
| 75 | {
|
|---|
| 76 | columnID = right.columnID;
|
|---|
| 77 | rowID = right.rowID;
|
|---|
| 78 | edep = right.edep;
|
|---|
| 79 | pos = right.pos;
|
|---|
| 80 | rot = right.rot;
|
|---|
| 81 | return *this;
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | int A01HadCalorimeterHit::operator==(const A01HadCalorimeterHit &right) const
|
|---|
| 85 | {
|
|---|
| 86 | return (columnID==right.columnID&&rowID==right.rowID);
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | void A01HadCalorimeterHit::Draw()
|
|---|
| 90 | {
|
|---|
| 91 | G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
|---|
| 92 | if(pVVisManager&&(edep>0.))
|
|---|
| 93 | {
|
|---|
| 94 | // Draw a calorimeter cell with depth propotional to the energy deposition
|
|---|
| 95 | G4Transform3D trans(rot.inverse(),pos);
|
|---|
| 96 | G4VisAttributes attribs;
|
|---|
| 97 | G4Colour colour(1.,0.,0.);
|
|---|
| 98 | attribs.SetColour(colour);
|
|---|
| 99 | attribs.SetForceSolid(true);
|
|---|
| 100 | G4Box box("dummy",15.*cm,15.*cm,1.*m*edep/(0.1*GeV));
|
|---|
| 101 | pVVisManager->Draw(box,attribs,trans);
|
|---|
| 102 | }
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 | const std::map<G4String,G4AttDef>* A01HadCalorimeterHit::GetAttDefs() const
|
|---|
| 106 | {
|
|---|
| 107 | G4bool isNew;
|
|---|
| 108 | std::map<G4String,G4AttDef>* store
|
|---|
| 109 | = G4AttDefStore::GetInstance("A01HadCalorimeterHit",isNew);
|
|---|
| 110 | if (isNew) {
|
|---|
| 111 | G4String HitType("HitType");
|
|---|
| 112 | (*store)[HitType] = G4AttDef(HitType,"Hit Type","Physics","","G4String");
|
|---|
| 113 |
|
|---|
| 114 | G4String Column("Column");
|
|---|
| 115 | (*store)[Column] = G4AttDef(Column,"Column ID","Physics","","G4int");
|
|---|
| 116 |
|
|---|
| 117 | G4String Row("Row");
|
|---|
| 118 | (*store)[Row] = G4AttDef(Row,"Row ID","Physics","","G4int");
|
|---|
| 119 |
|
|---|
| 120 | G4String Energy("Energy");
|
|---|
| 121 | (*store)[Energy] = G4AttDef(Energy,"Energy Deposited","Physics","G4BestUnit","G4double");
|
|---|
| 122 |
|
|---|
| 123 | G4String Pos("Pos");
|
|---|
| 124 | (*store)[Pos] = G4AttDef(Pos, "Position",
|
|---|
| 125 | "Physics","G4BestUnit","G4ThreeVector");
|
|---|
| 126 | }
|
|---|
| 127 | return store;
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| 130 | std::vector<G4AttValue>* A01HadCalorimeterHit::CreateAttValues() const
|
|---|
| 131 | {
|
|---|
| 132 | std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
|---|
| 133 |
|
|---|
| 134 | values->push_back(G4AttValue("HitType","HadCalorimeterHit",""));
|
|---|
| 135 |
|
|---|
| 136 | values->push_back
|
|---|
| 137 | (G4AttValue("Column",G4UIcommand::ConvertToString(columnID),""));
|
|---|
| 138 |
|
|---|
| 139 | values->push_back
|
|---|
| 140 | (G4AttValue("Row",G4UIcommand::ConvertToString(rowID),""));
|
|---|
| 141 |
|
|---|
| 142 | values->push_back
|
|---|
| 143 | (G4AttValue("Energy",G4BestUnit(edep,"Energy"),""));
|
|---|
| 144 |
|
|---|
| 145 | values->push_back
|
|---|
| 146 | (G4AttValue("Pos",G4BestUnit(pos,"Length"),""));
|
|---|
| 147 |
|
|---|
| 148 | return values;
|
|---|
| 149 | }
|
|---|
| 150 |
|
|---|
| 151 | void A01HadCalorimeterHit::Print()
|
|---|
| 152 | {
|
|---|
| 153 | G4cout << " Cell[" << rowID << ", " << columnID << "] " << edep/MeV << " (MeV) " << pos << G4endl;
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| 156 |
|
|---|